/* ========================================
   Finanzas Pro - Estilos principales
   Mezcla: Monday (claro) + Dark Premium (oscuro)
   ======================================== */

:root,
[data-theme="light"] {
    --bg: #f0f3f8;
    --card: #ffffff;
    --primary: #0073ea;
    --primary-dark: #005bb5;
    --primary-soft: rgba(0, 115, 234, 0.12);
    --accent: #a25ddc;
    --accent-soft: rgba(162, 93, 220, 0.12);
    --success: #00c875;
    --success-soft: rgba(0, 200, 117, 0.14);
    --error: #e2445c;
    --error-soft: rgba(226, 68, 92, 0.14);
    --warning: #fdab3d;
    --warning-soft: rgba(253, 171, 61, 0.16);
    --info: #579bfc;
    --info-soft: rgba(87, 155, 252, 0.14);
    --text: #323338;
    --text-secondary: #676879;
    --border: #e6e9ef;
    --shadow: 0 4px 16px rgba(50, 51, 56, 0.06);
    --shadow-lg: 0 12px 32px rgba(50, 51, 56, 0.1);
    --header-bg: rgba(255, 255, 255, 0.92);
    --input-bg: #ffffff;
    --muted-bg: #f6f7fb;
    --nav-active-bg: #cce5ff;
    --glow: transparent;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 18px;
    --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    --transition: 0.2s ease;
}

[data-theme="dark"] {
    --bg: #0b0f14;
    --card: #151b24;
    --primary: #2dd4bf;
    --primary-dark: #5eead4;
    --primary-soft: rgba(45, 212, 191, 0.14);
    --accent: #d4a853;
    --accent-soft: rgba(212, 168, 83, 0.16);
    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.16);
    --error: #ff6b6b;
    --error-soft: rgba(255, 107, 107, 0.16);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.16);
    --info: #38bdf8;
    --info-soft: rgba(56, 189, 248, 0.14);
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #243041;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
    --header-bg: rgba(15, 20, 28, 0.92);
    --input-bg: #0f141c;
    --muted-bg: #1a2230;
    --nav-active-bg: rgba(45, 212, 191, 0.16);
    --glow: 0 0 24px rgba(45, 212, 191, 0.18);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 18px;
    --font: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    --transition: 0.2s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 130px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

[data-theme="light"] body,
body:not([data-theme]) {
    background:
        radial-gradient(1200px 400px at 10% -10%, rgba(0, 115, 234, 0.1), transparent 55%),
        radial-gradient(900px 360px at 90% 0%, rgba(0, 200, 117, 0.08), transparent 50%),
        var(--bg);
}

[data-theme="dark"] body {
    background:
        radial-gradient(900px 420px at 15% -5%, rgba(45, 212, 191, 0.14), transparent 55%),
        radial-gradient(700px 320px at 95% 5%, rgba(212, 168, 83, 0.08), transparent 50%),
        var(--bg);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ---------- Utilities ---------- */

.hidden { display: none !important; }

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 24px;
}

/* Escritorio: contenido centrado */
@media (min-width: 1101px) {
    .container {
        max-width: 1280px;
        padding: 28px 20px 40px;
    }

    .app-header .header-top,
    .app-header .header-nav {
        width: 100%;
        max-width: 1280px;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
    }

    .app-header .header-top {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Nav: una sola fila, centrada; puede salir un poco del bloque */
    .app-header .header-nav {
        max-width: none;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0 6px 12px;
        justify-content: center;
        align-items: center;
        flex-wrap: nowrap;
        gap: 2px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .app-header .header-nav::-webkit-scrollbar {
        display: none;
    }

    .app-header .header-nav .nav-link {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 7px 10px;
        font-size: 0.8rem;
        text-align: center;
    }

    .app-header .sub-banner {
        display: flex;
        justify-content: center;
    }

    .app-header .sub-banner-inner {
        width: 100%;
        max-width: 1280px;
        margin: 0 auto;
        padding-left: 20px;
        padding-right: 20px;
        box-sizing: border-box;
        justify-content: center;
        text-align: center;
    }

    .page .card,
    .page .table-wrap,
    .page .toolbar,
    .page .page-header {
        max-width: 100%;
    }

    /* Sin scroll horizontal: la tabla se adapta al ancho */
    .page .table-wrap,
    .page .card:has(.table-wrap) {
        overflow-x: hidden;
    }

    .list-desktop {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .list-desktop table {
        width: 100%;
        max-width: 100%;
        table-layout: fixed;
    }

    .list-desktop th,
    .list-desktop td {
        padding: 10px 8px;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: middle;
    }

    .list-desktop td.cell-wrap {
        white-space: normal;
        overflow: hidden;
    }

    /* Acciones: una sola fila, sin desbordar la página */
    .list-desktop td.actions {
        display: table-cell;
        width: 252px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: clip;
        vertical-align: middle;
    }

    .list-desktop td.actions .btn {
        display: inline-block;
        vertical-align: middle;
        margin: 0 3px 0 0;
        padding: 5px 9px;
        font-size: 0.74rem;
        line-height: 1.15;
        white-space: nowrap;
    }

    #page-clients .list-desktop td.actions,
    #page-recurring .list-desktop td.actions {
        width: 252px;
    }

    #page-payables .list-desktop td.actions,
    #page-receivables .list-desktop td.actions {
        width: 300px;
    }

    #page-users .list-desktop td.actions {
        width: 300px;
    }

    .list-desktop .actions:not(td) {
        display: inline-flex;
        flex-wrap: nowrap;
        gap: 4px;
        align-items: center;
        justify-content: flex-start;
        white-space: nowrap;
    }

    /* Configuración: tarjetas alineadas */
    .settings-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 20px;
        align-items: stretch;
        width: 100%;
    }

    .settings-grid > .card {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .settings-grid .settings-card-password {
        grid-column: auto;
        max-width: none;
    }

    .settings-grid .btn {
        margin-top: auto;
        align-self: flex-start;
    }

    /* Calendario más legible */
    #page-calendar .card {
        overflow: visible;
    }

    .calendar-grid {
        gap: 8px;
    }

    .cal-day {
        min-height: 118px;
        padding: 8px;
    }

    .cal-event {
        white-space: normal;
        line-height: 1.25;
        font-size: 0.68rem;
        padding: 3px 5px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .cal-event.cal-more {
        background: transparent;
        color: var(--text-secondary);
        font-weight: 700;
        -webkit-line-clamp: 1;
    }
}

.card {
    background: var(--card);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text);
    letter-spacing: -0.02em;
}

.flex {
    display: flex;
    gap: 15px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-20 { gap: 20px; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.875rem; }
.text-center { text-align: center; }
.mt-15 { margin-top: 15px; }
.mt-20 { margin-top: 20px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.w-full { width: 100%; }

.cat-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.cat-chip {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 6px 12px;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.cat-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cat-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.multi-cat-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    max-height: 240px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--muted-bg);
    box-sizing: border-box;
}

.multi-cat-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    text-align: left !important;
    box-sizing: border-box;
    white-space: normal;
}

.multi-cat-item:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    background: var(--primary-soft);
}

.multi-cat-item input[type="checkbox"] {
    width: 18px !important;
    height: 18px;
    min-width: 18px;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 18px;
    accent-color: var(--primary);
}

.multi-cat-item span {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.35;
    text-align: left !important;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.modal-body > .form-group.form-span-full,
.modal-body .form-group:has(.multi-cat-grid) {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
}

.modal-body .multi-cat-grid,
.modal-body .form-group:has(.multi-cat-grid) {
    max-width: 100%;
}

.category-group {
    margin-bottom: 22px;
}

.category-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 2px 12px;
    margin-bottom: 4px;
}

.category-group-head strong {
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.category-group-head span {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
}

.category-group .entity-cards-grid {
    margin-top: 0;
}

.dash-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.dash-billing-title {
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.dash-billing-total {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
}

.dash-billing-total.is-overdue {
    color: var(--error);
}

.dash-period-toolbar {
    margin-bottom: 8px;
}

.dash-cashflow .stat-card {
    box-shadow: var(--shadow);
    border: none;
    overflow: hidden;
    position: relative;
}

.dash-cashflow .stat-card::before {
    display: none;
}

.dash-cashflow .kpi-income {
    background: var(--success-soft);
}

.dash-cashflow .kpi-expense {
    background: var(--error-soft);
}

.dash-cashflow .kpi-balance {
    background: var(--primary-soft);
}

.dash-cashflow .stat-card:hover {
    transform: translateY(-2px);
}

/* Monday-style quick actions: card clara + círculo de color */
.quick-action {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    min-height: 84px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    background: var(--card);
    font-family: var(--font);
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    text-align: left;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.quick-action:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.quick-action:active {
    transform: translateY(0);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    line-height: 1;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.quick-action-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.quick-action-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.quick-action-sub {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.quick-income .quick-action-icon {
    background: linear-gradient(135deg, #00c875, #00a35a);
    box-shadow: 0 8px 18px rgba(0, 200, 117, 0.35);
}

.quick-expense .quick-action-icon {
    background: linear-gradient(135deg, #e2445c, #c6284a);
    box-shadow: 0 8px 18px rgba(226, 68, 92, 0.35);
}

.quick-transfer .quick-action-icon {
    background: linear-gradient(135deg, #0073ea, #579bfc);
    box-shadow: 0 8px 18px rgba(0, 115, 234, 0.35);
}

.quick-income:hover { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.quick-expense:hover { border-color: color-mix(in srgb, var(--error) 45%, var(--border)); }
.quick-transfer:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }

@media (max-width: 768px) {
    .dash-quick-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
        width: 100%;
    }

    .quick-action {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 8px;
        min-height: 100px;
        padding: 14px 8px;
    }

    .quick-action-text {
        align-items: center;
        width: 100%;
    }

    .quick-action-title {
        text-align: center;
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .quick-action-sub {
        display: none;
    }
}

@media (max-width: 640px) {
    .dash-quick-actions {
        gap: 8px;
        margin-left: 0;
        margin-right: 0;
    }

    .quick-action {
        min-height: 96px;
        width: 100%;
        max-width: 100%;
        padding: 14px 6px;
        border-radius: 14px;
        gap: 8px;
    }

    .quick-action-icon {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        font-size: 1.25rem;
        margin: 0 auto;
    }

    .quick-action-title {
        font-size: 0.78rem;
        width: 100%;
        word-break: break-word;
        hyphens: auto;
    }
}

@media (max-width: 380px) {
    .dash-quick-actions {
        gap: 6px;
    }

    .quick-action {
        min-height: 88px;
        padding: 12px 4px;
        gap: 6px;
    }

    .quick-action-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
        border-radius: 10px;
    }

    .quick-action-title {
        font-size: 0.7rem;
    }
}

.chart-box {
    position: relative;
    height: 260px;
}

.chart-box-tall {
    height: 300px;
}

.kpi-mini .stat-value {
    font-size: 1.15rem;
}

.reports-toolbar {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
}

.period-btns {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 480px;
}

.period-btns .period-btn,
.period-btns [data-dash-period] {
    width: 100%;
    min-width: 0;
    padding: 10px 6px;
    font-size: 0.85rem;
    font-weight: 800;
    white-space: nowrap;
    color: var(--text);
    background: var(--muted-bg);
    border: 2px solid transparent;
    border-radius: 999px;
}

.period-btn.active,
.period-btns .period-btn.active,
.period-btns [data-dash-period].active {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 6px 16px rgba(0, 115, 234, 0.28);
}

.debt-payments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.debt-payment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--muted-bg);
}

.debt-payment-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.debt-summary .form-group label {
    margin-bottom: 2px;
}

.debt-summary .form-group > div {
    font-weight: 700;
}

.recurring-filter-bar .btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    width: 100%;
}

.page-hint {
    margin: 0;
    flex: 1 1 220px;
    text-align: left;
    line-height: 1.4;
}

.period-range {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.period-range.is-open {
    display: flex;
}

.period-range input[type="date"] {
    width: auto;
    min-width: 130px;
    flex: 1 1 130px;
    max-width: 180px;
}

.dash-cashflow .stat-label {
    color: var(--text);
    font-weight: 700;
    opacity: 0.75;
}

.dash-cashflow #dash-cashflow-stats {
    gap: 12px;
}

@media (max-width: 480px) {
    .dash-cashflow #dash-cashflow-stats {
        grid-template-columns: 1fr;
    }
}

.reports-filters {
    margin-bottom: 20px;
}

.reports-filters .card-title {
    text-align: center;
}

/* ---------- Forms ---------- */

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--input-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea {
    min-height: 90px;
    resize: vertical;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    border: 2px solid transparent;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    background: #38a169;
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 8px 12px;
    min-width: 36px;
}

/* ---------- Login ---------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
    background:
        radial-gradient(ellipse at top left, var(--primary-soft), transparent 50%),
        radial-gradient(ellipse at bottom right, var(--success-soft), transparent 50%),
        var(--bg);
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.login-box {
    width: 100%;
    background: var(--card);
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.55;
    padding: 4px 8px 8px;
}

.login-footer p {
    margin: 0 0 4px;
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

.login-footer-sep {
    margin: 0 6px;
    opacity: 0.55;
}

.clients-breakdown {
    margin-bottom: 15px;
    padding: 16px 18px;
}

.clients-month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.clients-month-title {
    text-align: center;
    flex: 1;
}

.clients-month-title h3 {
    margin: 0;
    font-size: 1.15rem;
}

.clients-month-list {
    min-height: 60px;
}

.clients-month-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clients-month-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
}

.clients-month-row.is-overdue {
    border-color: rgba(245, 101, 101, 0.55);
    background: rgba(245, 101, 101, 0.08);
}

.clients-month-row.is-due-today {
    border-color: rgba(237, 137, 54, 0.55);
    background: rgba(237, 137, 54, 0.08);
}

.clients-month-row .debt-line {
    color: var(--error);
    font-weight: 600;
}

.clients-month-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-weight: 600;
}

.text-warning { color: #dd6b20; }

.clients-month-main .meta {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin-top: 3px;
}

.clients-month-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.receipt-preview img {
    max-height: 55vh;
    object-fit: contain;
}

/* Factura WhatsApp */
.invoice-builder .invoice-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.invoice-builder .invoice-items-table th,
.invoice-builder .invoice-items-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.invoice-builder .invoice-items-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}

.invoice-builder .invoice-items-table input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
}

.invoice-totals-box {
    max-width: 280px;
    margin-left: auto;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary, var(--bg));
}

.invoice-totals-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    font-size: 0.92rem;
}

.invoice-totals-grand {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 2px solid var(--primary, #2b6cb0);
    font-size: 1.05rem;
}

.logo-preview-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 96px;
}

.logo-preview {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fff;
    padding: 8px;
}

.logo-placeholder {
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.mt-15 { margin-top: 15px; }
.mb-15 { margin-bottom: 15px; }

@media (max-width: 800px) {
    .clients-month-row {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }
    .clients-month-main {
        width: 100%;
        text-align: center;
    }
    .clients-month-stats {
        justify-content: center;
        width: 100%;
    }
    .clients-month-actions {
        justify-content: center;
        width: 100%;
    }
    .clients-month-actions .btn {
        flex: 1;
        min-width: 0;
    }
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.breakdown-block h4 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0 0 10px;
    color: var(--text);
}

.breakdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.breakdown-list li:last-child {
    border-bottom: none;
}

.breakdown-list small {
    color: var(--text-secondary);
    font-weight: 600;
}

.mb-10 { margin-bottom: 10px; }

@media (max-width: 900px) {
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
}

.login-brand {
    text-align: center;
    margin-bottom: 25px;
}

.login-brand .logo-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: 0 6px 18px var(--primary-soft);
}

.login-brand h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.login-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-error {
    background: rgba(245, 101, 101, 0.1);
    color: var(--error);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 15px;
    font-size: 0.9rem;
    border: 1px solid rgba(245, 101, 101, 0.25);
}

/* ---------- Header / Nav ---------- */

.app-header {
    background: var(--header-bg);
    padding: 0;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.sub-banner {
    border-top: 1px solid var(--border);
    background: linear-gradient(90deg, var(--primary-soft), var(--success-soft));
    padding: 8px 20px;
    position: relative;
    z-index: 1;
}

/* Espacio al hacer scroll hacia módulos (header sticky + banner) */
#modules-section,
.page {
    scroll-margin-top: 140px;
}

.sub-banner.is-warning {
    background: linear-gradient(90deg, #fffaf0, #feebc8);
}

.sub-banner.is-danger {
    background: linear-gradient(90deg, #fff5f5, #fed7d7);
}

.sub-banner-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 0.9rem;
}

.sub-banner-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.sub-banner-ends {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text);
    min-width: 0;
}

.header-brand span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-brand .logo-mini {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
}

.brand-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.brand-text span {
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ni-clock,
.header-brand-user {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--text);
    font-size: 1.15rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.mobile-only { display: none !important; }
.desktop-only { display: inline-flex !important; }

/* Module cards (dashboard) */
.module-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.module-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 10px;
    background: #f7fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    transition: transform var(--transition), border-color var(--transition), background var(--transition);
    min-height: 88px;
}

.module-card:hover,
.module-card:active {
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-1px);
}

.module-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.list-desktop { display: block; }
.list-mobile { display: none; }

/* Cuentas / módulos en tarjetas (escritorio y móvil) */
.accounts-board,
.entity-board {
    width: 100%;
}

.accounts-cards-grid,
.entity-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}

.account-card,
.entity-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.account-card:hover,
.entity-card:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.account-card.is-inactive {
    opacity: 0.72;
}

.account-card-top,
.entity-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.account-card-title,
.entity-card-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.account-card-title strong,
.entity-card-title strong {
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
}

.account-card-bank,
.entity-card-sub {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-card-balance,
.entity-card-amount {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.entity-card-amount.is-balance {
    color: var(--primary);
}

.entity-card-amount.is-payable {
    color: var(--error);
}

.entity-card-amount.is-muted {
    color: var(--text);
    font-size: 1.1rem;
}

.account-card-meta,
.entity-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.account-card-meta span,
.entity-card-meta span,
.entity-card-meta .badge {
    background: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
}

.entity-card-meta .badge {
    background: transparent;
}

.account-card-actions,
.entity-card-actions {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: stretch;
}

.account-card-actions .btn,
.entity-card-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
    white-space: nowrap;
}

.entity-card-actions.actions .btn {
    flex: 1 1 0;
}

@media (max-width: 1100px) {
    .accounts-cards-grid,
    .entity-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-grid {
        grid-template-columns: 1fr 1fr;
    }

    .settings-grid .settings-card-password {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .accounts-cards-grid,
    .entity-cards-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid .settings-card-password {
        grid-column: auto;
    }
}

.data-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.data-card-head {
    font-weight: 800;
    font-size: 1.05rem;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    color: var(--text);
}

.data-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.data-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.data-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
    word-break: break-word;
}

.data-card-actions {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.data-card-actions .btn {
    flex: 1;
    min-width: 0;
}

.mobile-modules-card {
    display: none;
}

/* Bottom nav + more sheet */
.bottom-nav {
    display: none;
}

.more-sheet-overlay {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 0 20px 12px;
    width: 100%;
    text-align: center;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
    cursor: pointer;
    border: none;
    background: transparent;
    font-family: var(--font);
    text-align: left;
}

.nav-link:hover,
.nav-link.active {
    background: var(--nav-active-bg);
    color: var(--primary);
}

.nav-link.active {
    font-weight: 800;
    box-shadow: var(--glow);
}

.user-badge {
    text-align: right;
}

.user-badge .name {
    font-weight: 700;
    font-size: 0.875rem;
}

.user-badge .role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.menu-toggle {
    display: none;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text);
    min-width: 42px;
    min-height: 42px;
}

/* ---------- Page sections ---------- */

.page {
    display: none;
    animation: fadeIn 0.25s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.toolbar .search-input {
    max-width: 420px;
    flex: 1;
    min-width: 220px;
}

#categories-toolbar {
    justify-content: center;
}

/* ---------- Stats ---------- */

.stat-card {
    background: var(--card);
    padding: 22px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: none;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card::after {
    display: none;
}

.stat-card.kpi-saldo {
    background: var(--primary-soft);
}

.stat-card.kpi-usd {
    background: var(--success-soft);
}

.stat-card.kpi-eur {
    background: var(--accent-soft);
}

.stat-card.kpi-rates {
    background: var(--warning-soft);
}

.stat-card.kpi-income {
    background: var(--success-soft);
}

.stat-card.kpi-expense {
    background: var(--error-soft);
}

.stat-card.kpi-balance {
    background: var(--primary-soft);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

.stat-value.primary { color: var(--primary); }
.stat-value.success { color: var(--success); }
.stat-value.error { color: var(--error); }

/* ---------- Tables ---------- */

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead {
    background: #f7fafc;
}

th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: #f7fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

.list-desktop td.cell-mono {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

@media (min-width: 1101px) {
    .list-desktop td.cell-mono {
        white-space: nowrap;
    }
}

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.actions .btn {
    flex: 0 0 auto;
}

td.actions {
    width: 1%;
    min-width: 0;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-top: 8px;
}

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-error {
    background: var(--error-soft);
    color: var(--error);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-info {
    background: var(--info-soft);
    color: var(--info);
}

.badge-muted {
    background: var(--muted-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ---------- Modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 55, 72, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: min(920px, 94vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(12px);
    transition: transform var(--transition);
}

.modal:has(.invoice-builder) {
    max-width: min(980px, 96vw);
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 22px 24px;
    overflow-y: auto;
    flex: 1 1 auto;
}

/* Escritorio: campos en horizontal (2 columnas) */
@media (min-width: 769px) {
    .modal-body {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 18px;
        align-content: start;
    }

    .modal-body > .form-row,
    .modal-body > .form-hint,
    .modal-body > p,
    .modal-body > .form-span-full,
    .modal-body > #client-monthly-fields,
    .modal-body > .form-group:has(textarea),
    .modal-body > input[type="hidden"] {
        grid-column: 1 / -1;
    }

    .modal-body > #client-monthly-fields .form-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .modal-body > input[type="hidden"] {
        display: none;
    }

    .modal-body > .form-group {
        margin-bottom: 14px;
        min-width: 0;
    }

    .modal-body > .form-row {
        margin-bottom: 0;
    }

    .modal-body > .form-row > .form-group {
        margin-bottom: 14px;
    }
}

.modal-footer {
    padding: 14px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: #fff;
}

/* ---------- Toast ---------- */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #fff;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 260px;
    max-width: 360px;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.25s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }

.quick-create-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 350;
    padding: 16px;
}

.quick-create-card {
    width: min(420px, 100%);
    background: var(--card, #fff);
    border-radius: var(--radius-lg, 14px);
    box-shadow: var(--shadow-lg);
    padding: 20px 22px;
    border: 1px solid var(--border);
}

.quick-create-card h4 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.quick-create-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---------- Calendar ---------- */

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 15px;
}

.calendar-nav h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cal-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 8px 0;
}

.cal-day {
    min-height: 80px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.cal-day:hover {
    border-color: var(--primary);
}

.cal-day.other-month {
    opacity: 0.4;
    background: #fafbfc;
}

.cal-day.today {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 115, 234, 0.2);
}

.cal-day-num {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.cal-event {
    font-size: 0.65rem;
    padding: 2px 4px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--primary-soft);
    color: #2b6cb0;
    cursor: default;
}

.cal-event.paid {
    background: rgba(72, 187, 120, 0.15);
    color: #276749;
}

.cal-event.overdue {
    background: rgba(245, 101, 101, 0.15);
    color: #c53030;
}

/* ---------- Dashboard lists ---------- */

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-main {
    min-width: 0;
    flex: 1;
}

.list-item .title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
}

.list-item-category {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 2px;
    line-height: 1.3;
    word-break: break-word;
}

.list-item .meta {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.list-item-amount {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.95rem;
    text-align: right;
    align-self: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .desktop-nav {
        display: none !important;
    }

    .desktop-nav.open {
        display: flex !important;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 8px 16px 16px;
        border-top: 1px solid var(--border);
        background: #fff;
    }

    .nav-link {
        padding: 12px 14px;
        width: 100%;
        font-size: 1rem;
    }

    .mobile-only { display: inline-flex !important; }
    .desktop-only { display: none !important; }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-modules-card {
        display: block;
    }

    .list-desktop {
        display: none !important;
    }

    .list-mobile {
        display: block !important;
        padding: 12px;
    }

    .table-wrap {
        border: none;
        overflow: visible;
    }

    .card:has(.table-wrap) {
        padding: 0;
        background: transparent;
        box-shadow: none;
    }

    .page-header {
        text-align: center;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }

    .page-header h2 {
        width: 100%;
        text-align: center;
    }

    .page-header > div {
        width: 100%;
        text-align: center;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-title,
    .stat-card,
    .stat-label,
    .stat-value,
    .empty-state,
    .page .text-secondary,
    .page > p,
    .form-hint {
        text-align: center;
    }

    /* Cards móviles: todo centrado / simétrico */
    .data-card {
        text-align: center;
    }

    .data-card-body {
        align-items: center;
    }

    .data-row {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 100%;
        text-align: center;
    }

    .data-label,
    .data-value {
        text-align: center;
        width: 100%;
        flex: none;
    }

    .data-card-actions {
        justify-content: center;
    }

    .data-card-actions .btn {
        flex: 1 1 calc(50% - 8px);
        max-width: 100%;
    }

    .list-mobile {
        text-align: center;
    }

    .more-sheet-title {
        text-align: center;
    }

    .more-item {
        justify-content: center;
        text-align: center;
        flex-direction: column;
        gap: 6px;
    }

    .app-main {
        padding-bottom: 90px;
        transition: padding-bottom 0.25s ease;
    }

    body.nav-bottom-hidden .app-main {
        padding-bottom: 20px;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 150;
        background: #fff;
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        justify-content: space-around;
        align-items: stretch;
        transform: translateY(0);
        transition: transform 0.28s ease, box-shadow 0.28s ease;
        will-change: transform;
    }

    .bottom-nav.is-hidden {
        transform: translateY(calc(100% + 12px));
        box-shadow: none;
        pointer-events: none;
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 4px;
        border: none;
        background: transparent;
        color: var(--text-secondary);
        font-family: var(--font);
        font-size: 0.68rem;
        font-weight: 700;
        cursor: pointer;
        border-radius: 10px;
        min-height: 52px;
        transition: color var(--transition), background var(--transition);
    }

    .bottom-nav-item .bn-icon {
        font-size: 1.15rem;
        line-height: 1;
    }

    .bottom-nav-item.active,
    .bottom-nav-item:active {
        color: var(--primary);
        background: var(--primary-soft);
    }

    .more-sheet-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(45, 55, 72, 0.45);
        z-index: 180;
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition), visibility var(--transition);
    }

    .more-sheet-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .more-sheet {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        border-radius: 20px 20px 0 0;
        padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
        transform: translateY(100%);
        transition: transform var(--transition);
        max-height: 80vh;
        overflow-y: auto;
    }

    .more-sheet-overlay.open .more-sheet {
        transform: translateY(0);
    }

    .more-sheet-handle {
        width: 40px;
        height: 4px;
        background: var(--border);
        border-radius: 4px;
        margin: 4px auto 14px;
    }

    .more-sheet-title {
        font-weight: 800;
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .more-sheet-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .more-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: #f7fafc;
        font-family: var(--font);
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--text);
        cursor: pointer;
        text-align: left;
    }

    .more-item.more-logout {
        grid-column: 1 / -1;
        color: var(--error);
        border-color: rgba(245, 101, 101, 0.3);
        background: rgba(245, 101, 101, 0.06);
    }

    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .cal-day {
        min-height: 60px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
        width: 100%;
        max-width: 100%;
    }

    .header-top {
        padding: 10px 15px;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
    }

    .header-brand {
        font-size: 1rem;
        justify-content: flex-start;
        width: auto;
        flex: 1;
        min-width: 0;
        text-align: left;
    }

    .brand-text {
        text-align: left;
    }

    .header-actions {
        width: auto;
        flex-shrink: 0;
        justify-content: flex-end;
        gap: 8px;
    }

    .header-brand-user {
        max-width: 140px;
    }

    .sub-banner {
        text-align: center;
        padding: 10px 14px;
    }

    .sub-banner-inner {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        text-align: center;
    }

    .grid-2,
    .grid-3,
    .grid-4,
    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .page-header .btn {
        width: 100%;
    }

    .page-header h2 {
        font-size: 1.35rem;
        text-align: center;
    }
    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .page-toolbar .page-hint {
        text-align: center;
    }
    .page-toolbar .toolbar,
    .page-toolbar .recurring-filter-bar {
        justify-content: center;
        width: 100%;
    }
    .page-hint {
        text-align: center;
    }

    .toolbar {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .toolbar > * {
        width: 100%;
        justify-content: center;
    }

    #categories-toolbar,
    #reports-period-toolbar,
    .clients-month-nav {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .toolbar .search-input {
        max-width: none;
        width: 100%;
        text-align: center;
    }

    /* Formularios y modales centrados en celular */
    .form-group {
        text-align: center;
    }

    .form-group label {
        display: block;
        text-align: center;
        width: 100%;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        text-align: center;
    }

    .modal-header {
        justify-content: center;
        position: relative;
        text-align: center;
    }

    .modal-header h3,
    #modal-title {
        width: 100%;
        text-align: center;
        padding: 0 36px;
    }

    .modal-close {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
    }

    .modal-footer {
        justify-content: center;
        text-align: center;
    }

    .pay-total-box {
        justify-content: center;
        text-align: center;
    }

    .breakdown-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .breakdown-block h4,
    .breakdown-block {
        text-align: center;
    }

    .cal-header,
    #cal-title {
        text-align: center;
        justify-content: center;
    }

    .settings-form,
    #page-settings .card {
        text-align: center;
    }

    .module-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .calendar-grid {
        gap: 3px;
    }

    .cal-day {
        min-height: 44px;
        padding: 3px;
    }

    .cal-weekday {
        font-size: 0.65rem;
        padding: 4px 0;
    }

    .cal-event {
        font-size: 0.55rem;
        padding: 1px 2px;
    }

    .card,
    .stat-card {
        padding: 18px;
    }

    .stat-value {
        font-size: 1.45rem;
    }

    .modal-overlay {
        padding: 10px;
        align-items: flex-end;
    }

    .modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }

    /* Celular: siempre vertical (1 columna) */
    .modal-body {
        display: block;
        padding: 18px 16px;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-footer .btn {
        flex: 1;
        min-width: 120px;
    }

    .table-wrap {
        margin: 0;
        border: none;
        overflow: visible;
    }

    table {
        display: none;
    }

    .actions {
        flex-direction: row;
    }

    .actions .btn {
        flex: 1;
        width: auto;
    }

    .toast-container {
        left: 12px;
        right: 12px;
        top: 12px;
    }

    .toast {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .login-page {
        padding: 16px;
        align-items: center;
        justify-content: center;
        min-height: 100dvh;
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .login-box {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        text-align: center;
    }

    .login-box .form-group {
        text-align: center;
    }

    .login-box label {
        text-align: center;
        display: block;
    }

    .login-box input {
        text-align: center;
    }

    .login-footer {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 22px;
        border-radius: 14px;
    }

    .login-brand h1 {
        font-size: 1.4rem;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .btn {
        padding: 10px 14px;
    }

    .module-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .module-card {
        min-height: 78px;
        padding: 12px 6px;
        font-size: 0.72rem;
    }
}

/* Evitar zoom raro en iOS al enfocar inputs */
@supports (-webkit-touch-callout: none) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="tel"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px;
    }
}

@media (min-width: 1101px) {
    .mobile-modules-card {
        display: block;
    }

    .module-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    /* Escritorio: mismo criterio visual — todo al mismo ancho */
    .page-header {
        justify-content: space-between;
        align-items: center;
        text-align: left;
        width: 100%;
    }

    .page-header h2 {
        text-align: left;
        width: auto;
    }

    .page-header .btn {
        width: auto;
        flex-shrink: 0;
    }

    .page > .text-secondary,
    .page > p.text-secondary,
    .page .page-hint {
        text-align: left;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }

    .page-toolbar {
        width: 100%;
        align-items: center;
    }

    .page-toolbar .page-hint {
        width: auto;
        margin: 0;
    }

    .page-toolbar .toolbar,
    .page-toolbar .recurring-filter-bar {
        justify-content: flex-end;
        margin-bottom: 0;
        flex: 0 0 auto;
    }

    .toolbar,
    #categories-toolbar {
        justify-content: flex-start;
        width: 100%;
    }

    #reports-toolbar,
    .reports-toolbar {
        justify-content: center;
        width: 100%;
    }

    .page .grid-2,
    .page .grid-3,
    .page .grid-4,
    .page > .card,
    .page .page-header,
    .page .page-toolbar,
    .page .toolbar {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .stat-card,
    .stat-label,
    .stat-value,
    .card-title,
    .kpi-mini {
        text-align: center;
    }

    .clients-month-nav {
        justify-content: center;
        gap: 20px;
    }

    .clients-month-title {
        text-align: center;
    }

    .calendar-nav {
        justify-content: center;
        gap: 20px;
    }

    #cal-title {
        text-align: center;
        min-width: 220px;
    }

    .sub-banner-inner {
        justify-content: center;
    }

    .dash-quick-actions {
        justify-items: center;
        align-items: stretch;
    }

    .module-card {
        text-align: center;
    }

    /* Tablas escritorio: acciones en una sola fila */
    .list-desktop table {
        table-layout: fixed;
        width: 100%;
        max-width: 100%;
    }

    td.actions .actions,
    .list-desktop .actions:not(td) {
        justify-content: flex-start;
        flex-wrap: nowrap;
        white-space: nowrap;
        gap: 4px;
        align-items: center;
    }

    .list-desktop td.actions {
        display: table-cell;
        white-space: nowrap;
        min-width: 0;
        overflow: visible;
    }

    .modal-header {
        text-align: left;
    }

    .modal-header h3,
    #modal-title {
        text-align: left;
        padding: 0;
        width: auto;
    }

    .modal-close {
        position: static;
        transform: none;
    }
}

/* ---------- Categorías en árbol ---------- */

.cat-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 42px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #f7fafc;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.cat-toggle:hover {
    background: #edf2f7;
    border-color: var(--primary);
    color: var(--primary);
}

.cat-toggle[aria-expanded="true"] {
    background: rgba(14, 116, 144, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

.cat-toggle-icon {
    font-size: 0.65rem;
    line-height: 1;
}

.cat-toggle-spacer {
    display: inline-block;
    width: 42px;
}

.cat-child-row td {
    background: #f8fafc;
}

.cat-child-label {
    display: inline-block;
    padding-left: 36px;
    position: relative;
    color: var(--text);
}

.cat-child-label::before {
    content: '↳';
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
}

.cat-card {
    padding: 16px;
}

.cat-card-title {
    text-align: center;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
    padding: 0 8px;
}

.cat-card-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cat-card-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.cat-card-chevron {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-secondary);
    transform: rotate(-90deg);
    transition: transform 0.15s ease;
}

.cat-tree-details[open] .cat-card-chevron {
    transform: rotate(0deg);
}

.cat-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.cat-actions .btn {
    width: 100%;
    min-height: 38px;
    margin: 0;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.cat-tree-details {
    margin-bottom: 12px;
    padding: 0;
    overflow: hidden;
}

.cat-tree-summary {
    list-style: none;
    cursor: pointer;
    display: block;
    padding: 16px;
    user-select: none;
}

.cat-tree-summary::-webkit-details-marker {
    display: none;
}

.cat-tree-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
}

.cat-tree-body > .cat-actions {
    margin-top: 14px;
}

.cat-subs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.cat-sub-card {
    display: block;
    background: #f7fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 12px;
}

.cat-sub-card .cat-card-title {
    font-size: 0.98rem;
}

.cat-sub-card .cat-actions {
    margin-top: 12px;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
}

.pay-total-box {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--muted-bg);
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--success);
}

/* ---------- Tema oscuro: Dark Premium ---------- */

[data-theme="dark"] .app-header,
[data-theme="dark"] .bottom-nav,
[data-theme="dark"] .more-sheet,
[data-theme="dark"] .modal,
[data-theme="dark"] .toast,
[data-theme="dark"] .data-card,
[data-theme="dark"] .account-card,
[data-theme="dark"] .entity-card,
[data-theme="dark"] .clients-month-row,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .card,
[data-theme="dark"] thead {
    background: var(--card);
}

[data-theme="dark"] .desktop-nav.open,
[data-theme="dark"] .menu-toggle,
[data-theme="dark"] .cat-toggle,
[data-theme="dark"] .more-item,
[data-theme="dark"] .cat-sub-card,
[data-theme="dark"] .cat-child-row td {
    background: var(--muted-bg);
}

[data-theme="dark"] tbody tr:hover {
    background: var(--primary-soft);
}

[data-theme="dark"] .sub-banner {
    background: linear-gradient(90deg, #122018, #15202b);
    border-top-color: var(--border);
}

[data-theme="dark"] .sub-banner.is-warning {
    background: linear-gradient(90deg, #2a2210, #1a1f28);
}

[data-theme="dark"] .sub-banner.is-danger {
    background: linear-gradient(90deg, #2a1418, #1a1f28);
}

[data-theme="dark"] .btn-outline {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--glow);
}

[data-theme="dark"] .btn-primary {
    color: #042f2e;
    background: linear-gradient(135deg, var(--primary), #5eead4);
    border-color: transparent;
    box-shadow: var(--glow);
}

[data-theme="dark"] .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #042f2e;
}

[data-theme="dark"] .login-page {
    background: radial-gradient(ellipse at top, #12302c 0%, var(--bg) 55%);
}

[data-theme="dark"] .bottom-nav-item.active,
[data-theme="dark"] .bottom-nav-item:active {
    background: var(--nav-active-bg);
    color: var(--primary);
}

[data-theme="dark"] .badge-success { color: #6ee7b7; }
[data-theme="dark"] .badge-error { color: #fda4a4; }
[data-theme="dark"] .badge-warning { color: #fcd34d; }
[data-theme="dark"] .badge-info { color: #7dd3fc; }

[data-theme="dark"] .header-brand .logo-mini,
[data-theme="dark"] .login-brand .logo-icon {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.25);
}

[data-theme="dark"] .account-card:hover,
[data-theme="dark"] .entity-card:hover,
[data-theme="dark"] .stat-card:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
    box-shadow: var(--glow), var(--shadow-lg);
}

[data-theme="dark"] .cat-chip.active {
    color: #042f2e;
    background: linear-gradient(135deg, var(--primary), #5eead4);
    border-color: transparent;
}

[data-theme="light"] .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(0, 115, 234, 0.28);
}

[data-theme="light"] .btn-success {
    background: var(--success);
    border-color: var(--success);
}

[data-theme="light"] .btn-danger {
    background: var(--error);
    border-color: var(--error);
}

[data-theme="light"] .module-card:hover,
[data-theme="light"] .module-card:active {
    border-color: var(--primary);
    background: var(--primary-soft);
}

/* ---------- Viajes / Bitácora ---------- */

.btn-lg {
    padding: 14px 22px;
    font-size: 1.05rem;
}

.trips-section-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 8px 0 14px;
    letter-spacing: -0.02em;
}

.trips-start-card .card-title,
.trips-active-card .card-title {
    margin-bottom: 6px;
}

.trip-stops-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.trip-stops-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trip-stop-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-family: var(--font);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.trip-stop-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: translateY(-1px);
}

.trip-stop-btn:disabled {
    cursor: default;
    opacity: 0.85;
}

.trip-stop-btn.is-marked {
    background: var(--success-soft);
    border-color: color-mix(in srgb, var(--success) 35%, var(--border));
}

.trip-stop-name {
    font-weight: 800;
    font-size: 1rem;
}

.trip-stop-meta {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.trip-segment {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.trip-segment:last-child {
    border-bottom: none;
}

.trip-pause-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--warning-soft);
    border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
}

.trip-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.trip-actions .btn {
    flex: 1 1 140px;
}

.trip-share-pre {
    white-space: pre-wrap;
    font-family: var(--font);
    font-size: 0.95rem;
    line-height: 1.5;
    background: var(--muted-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}

.trip-detail-list {
    margin: 12px 0 0;
    padding-left: 18px;
}

.trip-detail-list li {
    margin-bottom: 6px;
}

@media (max-width: 640px) {
    .trip-stop-btn {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* Quick actions + KPIs: Dark Premium */
[data-theme="dark"] .quick-action {
    background: linear-gradient(180deg, #1a2230 0%, #151b24 100%);
    border-color: #2a3a4f;
}

[data-theme="dark"] .quick-income .quick-action-icon {
    box-shadow: 0 0 20px rgba(52, 211, 153, 0.45);
}

[data-theme="dark"] .quick-expense .quick-action-icon {
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.4);
}

[data-theme="dark"] .quick-transfer .quick-action-icon {
    background: linear-gradient(135deg, #2dd4bf, #5eead4);
    color: #042f2e;
    box-shadow: 0 0 22px rgba(45, 212, 191, 0.5);
}

[data-theme="dark"] .period-btn.active,
[data-theme="dark"] .period-btns .period-btn.active,
[data-theme="dark"] .period-btns [data-dash-period].active {
    color: #042f2e !important;
    background: linear-gradient(135deg, var(--primary), #5eead4) !important;
    border-color: transparent !important;
    box-shadow: var(--glow);
}

[data-theme="dark"] .nav-link.active {
    color: var(--primary);
    background: var(--nav-active-bg);
    box-shadow: var(--glow);
}

[data-theme="dark"] .stat-card.kpi-saldo,
[data-theme="dark"] .stat-card.kpi-balance {
    background: rgba(45, 212, 191, 0.12);
}

[data-theme="dark"] .stat-card.kpi-usd,
[data-theme="dark"] .stat-card.kpi-income {
    background: rgba(52, 211, 153, 0.12);
}

[data-theme="dark"] .stat-card.kpi-eur {
    background: rgba(212, 168, 83, 0.12);
}

[data-theme="dark"] .stat-card.kpi-rates {
    background: rgba(251, 191, 36, 0.12);
}

[data-theme="dark"] .stat-card.kpi-expense {
    background: rgba(255, 107, 107, 0.12);
}

[data-theme="dark"] .stat-card::after {
    display: none;
}
