/* Elysium Patrimonio — componentes. */

/* ── Botones ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border-radius: 13px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: -0.005em;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
    user-select: none;
    text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(0.975); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
    color: var(--on-accent);
    background: linear-gradient(180deg, var(--accent-strong), var(--accent));
    box-shadow: 0 10px 24px -12px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover { color: var(--on-accent); filter: brightness(1.06); }
.btn-gold {
    color: var(--on-gold);
    background: linear-gradient(160deg, var(--gold-hi), var(--gold) 48%, var(--gold-lo));
    box-shadow: 0 12px 26px -12px rgba(212, 175, 55, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-gold:hover { color: var(--on-gold); filter: brightness(1.05); }
.btn-ghost {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--line-strong);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn-quiet { color: var(--text-2); background: none; padding: 0 10px; }
.btn-quiet:hover { color: var(--text); background: var(--surface-hover); }
.btn-danger { color: #fff; background: linear-gradient(180deg, #ff8b8b, #e04848); }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 0.82rem; }
.btn-lg { height: 52px; padding: 0 24px; border-radius: 16px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn .i { margin-left: -2px; }

.icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-sunken);
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
    flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); border-color: var(--line-strong); }
.icon-btn.is-plain { border-color: transparent; background: none; }
.icon-btn.is-sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 2px var(--bg);
}
.icon-btn .dot:empty { display: none; }

.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 560; font-size: 0.86rem; }
.link-btn:hover { color: var(--accent-strong); }

/* ── Superficies ──────────────────────────────────────────────────────────── */

.card {
    position: relative;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft), inset 0 1px 0 var(--highlight);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    padding: 20px;
    min-width: 0;
}
.card.is-tight { padding: 16px; }
.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.card-head h2 { font-size: 1.02rem; }
.card-head p { color: var(--text-2); font-size: 0.82rem; margin-top: 3px; }
.card-head .link-btn, .card-head .card-link { font-size: 0.82rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px; }
a.card { color: inherit; transition: border-color 0.2s, transform 0.2s var(--ease); }
a.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.section-gap { margin-top: 16px; }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } .grid { gap: 12px; } .card { padding: 16px; border-radius: 20px; } }

.section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 28px 2px 12px;
}
.section-title h2 { font-size: 1.05rem; }

/* ── Tarjeta de patrimonio (héroe) ────────────────────────────────────────── */

.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    padding: clamp(24px, 3.2vw, 36px);
    background:
        radial-gradient(130% 120% at 0% 0%, rgba(220, 179, 92, 0.16), transparent 55%),
        radial-gradient(100% 140% at 100% 100%, rgba(16, 185, 129, 0.12), transparent 60%),
        radial-gradient(80% 80% at 50% -20%, rgba(250, 238, 199, 0.08), transparent 70%),
        linear-gradient(155deg, #131b2c 0%, #0a101b 50%, #0d1522 100%);
    border: 1px solid var(--gold-line);
    box-shadow:
        0 24px 50px -20px rgba(0, 0, 0, 0.85),
        0 0 35px -10px rgba(220, 179, 92, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 0 20px rgba(220, 179, 92, 0.04);
    color: #f4f6fa;
    isolation: isolate;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
:root[data-theme="light"] .hero {
    background:
        radial-gradient(130% 120% at 0% 0%, rgba(184, 138, 40, 0.18), transparent 55%),
        radial-gradient(100% 140% at 100% 100%, rgba(15, 159, 89, 0.12), transparent 60%),
        linear-gradient(155deg, #242c3d 0%, #171d2b 60%, #1e2637 100%);
    color: #f4f6fa;
    border-color: rgba(220, 179, 92, 0.4);
}
.hero .guilloche {
    position: absolute;
    right: -100px;
    top: 50%;
    width: 440px;
    height: 440px;
    transform: translateY(-50%);
    color: var(--gold);
    opacity: 0.28;
    z-index: -1;
    pointer-events: none;
    filter: drop-shadow(0 0 16px rgba(220, 179, 92, 0.2));
}
.hero .guilloche-band {
    position: absolute;
    inset: auto 0 0 0;
    height: 55%;
    width: 100%;
    color: #34d399;
    opacity: 0.14;
    z-index: -1;
    pointer-events: none;
}
.hero-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.hero .eyebrow { color: rgba(244, 246, 250, 0.7); }
.hero-value {
    margin: 10px 0 8px;
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 5.8vw, 3.8rem);
    font-weight: 580;
    letter-spacing: -0.04em;
    line-height: 1.05;
    background: linear-gradient(170deg, #ffffff 15%, #f9f5e8 55%, var(--gold-hi) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 4px 24px rgba(220, 179, 92, 0.12);
}
.is-private .hero-value .amt { text-shadow: 0 0 18px rgba(255, 255, 255, 0.7); }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; color: rgba(244, 246, 250, 0.76); font-size: 0.86rem; }
.hero-split { display: grid; grid-template-columns: repeat(3, auto); gap: 8px 28px; margin-top: 22px; justify-content: start; }
.hero-split div { display: flex; flex-direction: column; gap: 2px; }
.hero-split small { color: rgba(244, 246, 250, 0.58); font-size: 0.72rem; letter-spacing: 0.04em; }
.hero-split b { font-weight: 580; font-size: 1.05rem; }
.hero-spark { position: absolute; right: clamp(20px, 3vw, 32px); bottom: clamp(20px, 3vw, 30px); }
.hero-spark .spark polyline { stroke: var(--gold-hi); }
.hero-spark .spark circle { fill: var(--gold-hi); }

/* Indicador de Paz Mental / Respaldo */
.badge-peace {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 580;
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
    white-space: nowrap;
    letter-spacing: -0.01em;
}
.badge-peace .i { color: #34d399; }
.badge-peace b { color: #ffffff; font-weight: 700; }

/* Banner de Racha y Dopamina Diaria */
.streak-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(220, 179, 92, 0.14) 0%, rgba(16, 23, 36, 0.85) 60%);
    border: 1px solid var(--gold-line);
    box-shadow: 0 8px 24px -10px rgba(220, 179, 92, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    color: var(--text);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.streak-banner:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -10px rgba(220, 179, 92, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.streak-flame {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
}
.streak-flame .flame-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
    animation: flamePulse 3s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes flamePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 6px 20px rgba(245, 158, 11, 0.65); }
}
.streak-level-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--surface-sunken);
    border: 1px solid var(--gold-line);
    color: var(--text);
    font-size: 0.82rem;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.streak-level-pill:hover { background: var(--surface-hover); border-color: var(--gold); color: var(--text); }

@media (max-width: 760px) {
    .hero-split { grid-template-columns: repeat(2, auto); }
    .hero-spark { display: none; }
    .hero .guilloche { right: -180px; width: 380px; height: 380px; opacity: 0.18; }
    .streak-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
    .streak-level-pill { align-self: flex-start; }
}

.delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 650;
    background: rgba(255, 255, 255, 0.08);
}
.delta.is-up { color: #34d399; background: rgba(16, 185, 129, 0.16); }
.delta.is-down { color: #fb7185; background: rgba(244, 63, 94, 0.16); }
.card .delta.is-up { color: var(--ok); background: var(--ok-soft); }
.card .delta.is-down { color: var(--danger); background: var(--danger-soft); }
.card .delta { background: var(--surface-hover); color: var(--text-2); }

/* ── KPI ──────────────────────────────────────────────────────────────────── */

.kpi {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 132px;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 0.8rem; color: var(--text-2); font-weight: 540; }
.kpi-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
}
.kpi-icon.is-gold { background: var(--gold-soft); color: var(--gold-text); }
.kpi-icon.is-ok { background: var(--ok-soft); color: var(--ok); }
.kpi-icon.is-warn { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.kpi-value {
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 2.2vw, 1.75rem);
    font-weight: 560;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-top: auto;
}
.kpi-value .amt { font-variant-numeric: normal; }
.kpi-sub { font-size: 0.78rem; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Listas de movimientos ────────────────────────────────────────────────── */

.list { display: flex; flex-direction: column; }
.list-day {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 18px 4px 8px;
    font-size: 0.76rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    color: var(--text-3);
    text-transform: capitalize;
}
.list-day:first-child { padding-top: 4px; }
.tx {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 10px 10px;
    border: 0;
    border-radius: 14px;
    background: none;
    text-align: left;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.tx:hover { background: var(--surface-hover); }
.tx + .tx { position: relative; }
.tx-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tx-title { font-weight: 560; font-size: 0.93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { display: flex; align-items: center; gap: 6px; font-size: 0.76rem; color: var(--text-3); overflow: hidden; white-space: nowrap; }
.tx-meta .i { opacity: 0.8; }
.tx-meta .sep { opacity: 0.5; }
.tx-amount { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-weight: 600; font-size: 0.95rem; }
.tx-amount small { font-weight: 450; font-size: 0.72rem; color: var(--text-3); }
.flag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.66rem;
    font-weight: 650;
    background: var(--surface-hover);
    color: var(--text-2);
}
.flag.is-impulse { background: var(--warn-soft); color: var(--warn); }
.flag.is-receipt { background: var(--accent-soft); color: var(--accent); }

.cat-chip {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: var(--chip-ink, var(--text));
    background: var(--chip-bg, var(--surface-hover));
    border: 1px solid color-mix(in srgb, var(--chip-ink, var(--text)) 18%, transparent);
}
.cat-chip.is-sm { width: 32px; height: 32px; border-radius: 10px; }
.cat-chip.is-lg { width: 56px; height: 56px; border-radius: 18px; }
.tone-green { --chip-ink: #4fd8a0; --chip-bg: rgba(79, 216, 160, 0.12); }
.tone-orange { --chip-ink: #ff9a62; --chip-bg: rgba(255, 154, 98, 0.12); }
.tone-amber { --chip-ink: #f4c95d; --chip-bg: rgba(244, 201, 93, 0.12); }
.tone-blue { --chip-ink: #6fb5ff; --chip-bg: rgba(111, 181, 255, 0.12); }
.tone-sky { --chip-ink: #7fd3ff; --chip-bg: rgba(127, 211, 255, 0.12); }
.tone-slate { --chip-ink: #a9b6cc; --chip-bg: rgba(169, 182, 204, 0.12); }
.tone-violet { --chip-ink: #b19cff; --chip-bg: rgba(177, 156, 255, 0.13); }
.tone-cyan { --chip-ink: #5fe0e6; --chip-bg: rgba(95, 224, 230, 0.12); }
.tone-red { --chip-ink: #ff8c8c; --chip-bg: rgba(255, 140, 140, 0.12); }
.tone-indigo { --chip-ink: #8f9dff; --chip-bg: rgba(143, 157, 255, 0.13); }
.tone-pink { --chip-ink: #ff8fc7; --chip-bg: rgba(255, 143, 199, 0.12); }
.tone-magenta { --chip-ink: #f07ae6; --chip-bg: rgba(240, 122, 230, 0.12); }
.tone-rose { --chip-ink: #ff8fa3; --chip-bg: rgba(255, 143, 163, 0.12); }
.tone-teal { --chip-ink: #4fd1c1; --chip-bg: rgba(79, 209, 193, 0.12); }
.tone-gray { --chip-ink: #b4bac6; --chip-bg: rgba(180, 186, 198, 0.1); }
.tone-gold { --chip-ink: var(--gold-text); --chip-bg: var(--gold-soft); }
:root[data-theme="light"] .tone-green { --chip-ink: #0f8a55; }
:root[data-theme="light"] .tone-orange { --chip-ink: #c2551b; }
:root[data-theme="light"] .tone-amber { --chip-ink: #9b6a10; }
:root[data-theme="light"] .tone-blue { --chip-ink: #1f63c0; }
:root[data-theme="light"] .tone-sky { --chip-ink: #1478a8; }
:root[data-theme="light"] .tone-slate { --chip-ink: #4f5d75; }
:root[data-theme="light"] .tone-violet { --chip-ink: #6246c9; }
:root[data-theme="light"] .tone-cyan { --chip-ink: #0f8790; }
:root[data-theme="light"] .tone-red { --chip-ink: #c23636; }
:root[data-theme="light"] .tone-indigo { --chip-ink: #4150c8; }
:root[data-theme="light"] .tone-pink { --chip-ink: #c2327a; }
:root[data-theme="light"] .tone-magenta { --chip-ink: #a52a9a; }
:root[data-theme="light"] .tone-rose { --chip-ink: #c2344f; }
:root[data-theme="light"] .tone-teal { --chip-ink: #0f8577; }
:root[data-theme="light"] .tone-gray { --chip-ink: #5f6674; }
@media (prefers-color-scheme: light) {
    :root:not([data-theme]) .tone-green { --chip-ink: #0f8a55; }
    :root:not([data-theme]) .tone-orange { --chip-ink: #c2551b; }
    :root:not([data-theme]) .tone-amber { --chip-ink: #9b6a10; }
    :root:not([data-theme]) .tone-blue { --chip-ink: #1f63c0; }
    :root:not([data-theme]) .tone-sky { --chip-ink: #1478a8; }
    :root:not([data-theme]) .tone-slate { --chip-ink: #4f5d75; }
    :root:not([data-theme]) .tone-violet { --chip-ink: #6246c9; }
    :root:not([data-theme]) .tone-cyan { --chip-ink: #0f8790; }
    :root:not([data-theme]) .tone-red { --chip-ink: #c23636; }
    :root:not([data-theme]) .tone-indigo { --chip-ink: #4150c8; }
    :root:not([data-theme]) .tone-pink { --chip-ink: #c2327a; }
    :root:not([data-theme]) .tone-magenta { --chip-ink: #a52a9a; }
    :root:not([data-theme]) .tone-rose { --chip-ink: #c2344f; }
    :root:not([data-theme]) .tone-teal { --chip-ink: #0f8577; }
    :root:not([data-theme]) .tone-gray { --chip-ink: #5f6674; }
}

/* ── Chips, pastillas y segmentados ───────────────────────────────────────── */

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.is-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; padding: 2px 4px 6px; }
.chips.is-scroll::-webkit-scrollbar { display: none; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 13px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: var(--surface-sunken);
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 560;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip.is-active, .chip[aria-pressed="true"] {
    color: var(--text);
    border-color: var(--accent-line);
    background: var(--accent-soft);
}
.chip.is-gold.is-active { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-text); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 650;
    background: var(--surface-hover);
    color: var(--text-2);
    white-space: nowrap;
}
.pill.is-ok { background: var(--ok-soft); color: var(--ok); }
.pill.is-warn, .pill.is-pace, .pill.is-warning { background: var(--warn-soft); color: var(--warn); }
.pill.is-danger, .pill.is-over, .pill.is-late, .pill.is-at-risk { background: var(--danger-soft); color: var(--danger); }
.pill.is-gold, .pill.is-done { background: var(--gold-soft); color: var(--gold-text); }
.pill.is-accent, .pill.is-on-track { background: var(--accent-soft); color: var(--accent); }

.seg {
    display: inline-flex;
    padding: 3px;
    border-radius: 13px;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    gap: 2px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
    border: 0;
    background: none;
    color: var(--text-2);
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 580;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s, color 0.18s;
}
.seg button[aria-pressed="true"], .seg button.is-active {
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 16%, var(--surface-solid));
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.35), inset 0 0 0 1px var(--accent-line);
}
.seg.is-block { display: flex; width: 100%; }
.seg.is-block button { flex: 1; }
.seg .is-expense[aria-pressed="true"] { color: var(--neg); }
.seg .is-income[aria-pressed="true"] { color: var(--pos); }
.seg .is-transfer[aria-pressed="true"] { color: var(--accent); }

/* ── Formularios ──────────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .is-wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 0.78rem; font-weight: 600; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.field > span small { font-weight: 450; color: var(--text-3); }
.field-hint { font-size: 0.74rem; color: var(--text-3); }
.input, .field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), .field select, .field textarea {
    width: 100%;
    height: 44px;
    padding: 0 13px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: var(--surface-sunken);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    -webkit-appearance: none;
    appearance: none;
}
.field textarea { height: auto; min-height: 80px; padding: 11px 13px; resize: vertical; line-height: 1.45; }
.field select {
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
.field select option { background: var(--surface-solid); color: var(--text); }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
    background: var(--surface-solid);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
/* Los campos dibujan su propio anillo de foco; el contorno global lo duplicaría. */
.input:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: none; }
/* Sin flechas nativas en los campos numéricos: Safari las pinta aunque el campo tenga estilo propio. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field-error { color: var(--danger); font-size: 0.76rem; }
.input-group { position: relative; display: flex; align-items: center; }
/* Solo los campos con símbolo delante dejan hueco para él. */
.input-group .prefix + input { padding-left: 34px !important; }
.input-group .prefix { position: absolute; left: 13px; color: var(--text-3); font-weight: 600; pointer-events: none; }
.input-group .suffix { position: absolute; right: 13px; color: var(--text-3); font-size: 0.82rem; pointer-events: none; }
.input-group input.has-suffix { padding-right: 44px !important; }

/*
 * Importe con su moneda: un solo control con el símbolo (o un selector de
 * moneda) pegado al número. El anillo de foco lo lleva el conjunto.
 */
.money-field {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: var(--surface-sunken);
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s, opacity 0.2s;
}
.money-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface-solid); }
.money-field input,
.field .money-field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]) {
    flex: 1;
    min-width: 0;
    width: auto;
    height: 100%;
    padding: 0 13px 0 6px;
    border: 0;
    border-radius: 0 12px 12px 0;
    background: transparent;
    box-shadow: none;
    color: var(--text);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    outline: none;
}
.money-field input:focus, .field .money-field input:focus { border: 0; box-shadow: none; background: transparent; }
.money-field input::placeholder { color: var(--text-3); }
.money-symbol { display: grid; place-items: center; padding-left: 13px; color: var(--text-3); font-weight: 600; }
.money-currency {
    flex: none;
    -webkit-appearance: none;
    appearance: none;
    height: 100%;
    margin: 0;
    padding: 0 26px 0 13px;
    border: 0;
    border-right: 1px solid var(--line);
    border-radius: 12px 0 0 12px;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 9px center;
    color: var(--text);
    font-weight: 650;
    font-size: 0.95rem;
    cursor: pointer;
}
.money-currency + input, .field .money-field .money-currency + input:not([type="checkbox"]) { padding-left: 12px; }
.money-currency:focus-visible { outline: none; background-color: var(--accent-soft); }
.money-currency option { background: var(--surface-solid); color: var(--text); }
.money-field :disabled { cursor: not-allowed; }

/* Casilla propia: la nativa de Safari no respeta el tema. */
.check-box {
    -webkit-appearance: none;
    appearance: none;
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border-radius: 6px;
    border: 1.5px solid var(--line-strong);
    background: var(--surface-solid);
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}
.check-box:checked {
    border-color: var(--accent);
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.check-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Fila de «marcar y escribir un importe» (primer uso). */
.quick-list { display: flex; flex-direction: column; gap: 8px; }
.quick-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(176px, 216px);
    align-items: center;
    gap: 14px;
    padding: 10px 10px 10px 14px;
    border-radius: 16px;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    transition: border-color 0.2s, background 0.2s;
}
.quick-row .money-field { background: var(--surface-solid); }
.quick-row.is-off { background: transparent; }
.quick-row.is-off .quick-check .cat-chip, .quick-row.is-off .quick-text { opacity: 0.5; }
.quick-row.is-off .money-field { opacity: 0.4; }
.quick-check { display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.quick-check .cat-chip { flex: none; }
.quick-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.25; }
.quick-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-text small { color: var(--text-3); font-size: 0.78rem; }
@media (max-width: 560px) {
    .quick-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px; }
}

/* Moneda principal: tres opciones con su símbolo. */
.currency-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.currency-seg b { font-weight: 700; color: var(--text-3); transition: color 0.18s; }
.currency-seg [aria-pressed="true"] b { color: var(--accent); }

/* Tipos de cambio (Ajustes). */
.fx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.fx-quote { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface-sunken); border: 1px solid var(--line); }
.fx-pair { font-size: 0.8rem; font-weight: 600; color: var(--text-2); }
.fx-quote .input { background: var(--surface-solid); }
.fx-foot { margin-top: 10px; align-items: flex-start; }
@media (max-width: 560px) { .fx-foot { flex-direction: column; } }

.check {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-sunken);
    cursor: pointer;
    font-size: 0.9rem;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .switch {
    position: relative;
    width: 42px;
    height: 26px;
    border-radius: 999px;
    background: var(--line-strong);
    flex-shrink: 0;
    transition: background 0.2s;
    margin-left: auto;
}
.check .switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.22s var(--spring);
}
.check input:checked + .switch { background: var(--accent); }
.check input:checked + .switch::after { transform: translateX(16px); }
.check input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.check-text small { color: var(--text-3); font-size: 0.76rem; }

/* Entrada de monto grande. */
.amount-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 12px 10px;
}
.amount-input .currency-toggle {
    border: 1px solid var(--line-strong);
    background: var(--surface-sunken);
    color: var(--text-2);
    border-radius: 12px;
    height: 40px;
    min-width: 44px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
}
.amount-input .currency-toggle.is-static { display: grid; place-items: center; cursor: default; opacity: 0.75; }
.amount-input input {
    width: 100%;
    max-width: 320px;
    border: 0;
    background: none;
    text-align: center;
    font-family: var(--font-display);
    font-size: clamp(2.3rem, 9vw, 3.1rem);
    font-weight: 300;
    letter-spacing: -0.04em;
    color: var(--text);
    padding: 0;
    caret-color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.amount-input input:focus { outline: none; box-shadow: none; }
.amount-input input::placeholder { color: var(--text-3); }
.amount-input.is-expense input { color: var(--text); }
.amount-input.is-income input { color: var(--pos); }
.amount-words { text-align: center; font-size: 0.78rem; color: var(--text-3); min-height: 1.2em; }

/* Selector de categorías. */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
}
.cat-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 10px 4px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: none;
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 560;
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
    transition: background 0.15s, border-color 0.15s;
}
.cat-option:hover { background: var(--surface-hover); }
.cat-option[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.cat-option .cat-chip { width: 42px; height: 42px; }
.cat-option span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Progreso ─────────────────────────────────────────────────────────────── */

.progress {
    position: relative;
    height: 9px;
    border-radius: 9px;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
    overflow: visible;
}
.progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    box-shadow: 0 0 12px -2px var(--accent-line);
    width: 0;
    transition: width 1s var(--ease-out);
}
.progress.is-gold .progress-fill {
    background: linear-gradient(90deg, var(--gold-lo), var(--gold) 45%, var(--gold-hi));
    box-shadow: 0 0 14px -2px rgba(220, 179, 92, 0.45);
}
.progress.is-ok .progress-fill {
    background: linear-gradient(90deg, #059669, #10b981 55%, #34d399);
    box-shadow: 0 0 14px -2px rgba(16, 185, 129, 0.45);
}
.progress.is-warning .progress-fill, .progress.is-pace .progress-fill {
    background: linear-gradient(90deg, #d97706, #f59e0b);
    box-shadow: 0 0 12px -2px rgba(245, 158, 11, 0.4);
}
.progress.is-over .progress-fill {
    background: linear-gradient(90deg, #e11d48, #f43f5e);
    box-shadow: 0 0 14px -2px rgba(244, 63, 94, 0.45);
}
.progress-pace {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    border-radius: 2px;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.7);
    opacity: 0.85;
    transform: translateX(-1px);
}
.progress.is-thin { height: 6px; }
.progress.is-thick { height: 14px; }

.ring { overflow: visible; }
.ring-track { stroke: var(--line-strong); }
.ring-fill {
    transition: stroke-dashoffset 1.2s var(--ease-out);
    animation: ring-in 1.2s var(--ease-out);
    filter: drop-shadow(0 0 8px rgba(220, 179, 92, 0.35));
}
@keyframes ring-in { from { stroke-dashoffset: var(--ring-c); } }
.ring-wrap { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; }
.ring-wrap > .ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 650; font-size: 0.85rem; }

/* ── Gráficas ─────────────────────────────────────────────────────────────── */

.chart { position: relative; width: 100%; min-height: 180px; }
.chart-svg { overflow: visible; touch-action: pan-y; }
.chart-svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.chart-svg .grid { stroke: var(--chart-grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart-svg .grid.is-zero { stroke: var(--chart-zero); }
.chart-svg .axis { fill: var(--chart-axis); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-svg .bar { transition: opacity 0.2s; }
.chart-svg .s-income { fill: var(--c-income); }
.chart-svg .s-expense { fill: var(--c-expense); }
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.s-net { stroke: var(--c-net); }
.chart-svg .line.s-gold { stroke: var(--c-gold); }
.chart-svg .line.s-income { stroke: var(--c-income); fill: none; }
.chart-svg .area.s-gold { fill: var(--c-gold); opacity: 0.1; }
.chart-svg .area.s-income { fill: var(--c-income); opacity: 0.1; }
.chart-svg .dot { stroke: var(--surface-solid); stroke-width: 2; }
.chart-svg .dot.s-net { fill: var(--c-net); }
.chart-svg .dot.s-gold { fill: var(--c-gold); }
.chart-svg .hover-band { fill: var(--chart-band); transition: x 0.12s var(--ease); }
.chart-svg .crosshair { stroke: var(--text-3); stroke-width: 1; }
.chart-tip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    min-width: 170px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s, transform 0.12s var(--ease);
    font-size: 0.8rem;
}
.chart-tip.is-visible { opacity: 1; }
.chart-tip-title { font-size: 0.72rem; color: var(--text-3); margin-bottom: 6px; font-weight: 600; text-transform: capitalize; }
.chart-tip-row { display: grid; grid-template-columns: 14px auto 1fr; align-items: center; gap: 8px; padding: 2px 0; }
.chart-tip-row b { font-variant-numeric: tabular-nums; font-weight: 650; }
.chart-tip-row span:last-child { color: var(--text-2); }
.chart-key { width: 12px; height: 3px; border-radius: 3px; display: inline-block; }
.chart-key.s-income { background: var(--c-income); }
.chart-key.s-expense { background: var(--c-expense); }
.chart-key.s-net { background: var(--c-net); }
.chart-key.s-gold { background: var(--c-gold); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.78rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.is-line { width: 14px; height: 3px; border-radius: 3px; }
.legend .s-income { background: var(--c-income); }
.legend .s-expense { background: var(--c-expense); }
.legend .s-net { background: var(--c-net); }
.legend .s-gold { background: var(--c-gold); }

.spark polyline { fill: none; stroke: var(--text-3); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--accent); stroke: var(--surface-solid); stroke-width: 2; }

.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 7px;
    padding: 9px 8px;
    border-radius: 12px;
    color: inherit;
}
a.hbar:hover { background: var(--surface-hover); color: inherit; }
.hbar-label { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 0.88rem; font-weight: 540; }
.hbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label small { color: var(--text-3); font-size: 0.74rem; font-weight: 450; white-space: nowrap; }
.hbar-value { font-weight: 620; font-size: 0.88rem; text-align: right; }
.hbar-track { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 6px; background: var(--c-income); transform-origin: left; animation: bar-grow 0.9s var(--ease-out) both; }
.hbars.is-gold .hbar-fill { background: linear-gradient(90deg, var(--gold-lo), var(--gold)); }
.hbars.is-expense .hbar-fill { background: var(--c-expense); }
@keyframes bar-grow { from { transform: scaleX(0); } }

.heatmap-grid {
    display: grid;
    grid-template-rows: repeat(7, 14px);
    grid-auto-columns: 14px;
    grid-auto-flow: column;
    gap: 3px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.heat-cell { width: 14px; height: 14px; border-radius: 4px; border: 0; padding: 0; background: var(--heat-0); cursor: pointer; display: inline-block; }
.heat-cell.l1 { background: var(--heat-1); }
.heat-cell.l2 { background: var(--heat-2); }
.heat-cell.l3 { background: var(--heat-3); }
.heat-cell.l4 { background: var(--heat-4); }
.heat-cell:hover, .heat-cell:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.heatmap-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 0.72rem; color: var(--text-3); }
.heatmap-legend span:first-child { margin-right: 4px; }
.heatmap-legend span:last-child { margin-left: 4px; }
.heatmap-legend .heat-cell { cursor: default; width: 11px; height: 11px; }

/* ── Tablas ───────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .is-num { text-align: right; }
.table tbody tr:hover td { background: var(--surface-hover); }

/* ── Hojas y diálogos ─────────────────────────────────────────────────────── */

#overlays { position: relative; z-index: 100; }
.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(1, 3, 8, 0);
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
    transition: background 0.22s var(--ease), backdrop-filter 0.22s;
}
.overlay.is-open { background: rgba(1, 3, 8, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
:root[data-theme="light"] .overlay.is-open { background: rgba(40, 32, 18, 0.28); }
.overlay.is-leaving { background: rgba(1, 3, 8, 0); }
.sheet {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: min(88dvh, 860px);
    border-radius: 26px;
    background: var(--surface-solid);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-pop);
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.22s var(--ease), transform 0.28s var(--ease-out);
    overflow: hidden;
}
.overlay.is-open .sheet { opacity: 1; transform: none; }
.overlay.is-leaving .sheet { opacity: 0; transform: translateY(10px) scale(0.985); }
.sheet-sm { max-width: 440px; }
.sheet-md { max-width: 580px; }
.sheet-lg { max-width: 780px; }
.sheet-xl { max-width: 1040px; }
.sheet-grab { display: none; justify-content: center; padding: 10px 0 0; }
.sheet-grab span { width: 40px; height: 5px; border-radius: 5px; background: var(--line-strong); }
.sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 12px;
    touch-action: none;
}
.sheet-head h2 { font-size: 1.22rem; letter-spacing: -0.025em; }
.sheet-head .eyebrow { margin-bottom: 4px; }
.sheet-body { padding: 4px 22px 22px; overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { padding: 14px 22px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-solid); }
.sheet-actions { position: sticky; bottom: -22px; display: flex; gap: 10px; padding: 14px 0 4px; margin-top: 6px; background: linear-gradient(180deg, transparent, var(--surface-solid) 30%); }
.sheet-actions .btn { flex: 1; }
@media (max-width: 760px) {
    .overlay { align-items: flex-end; padding: 0; }
    .sheet, .sheet-sm, .sheet-md, .sheet-lg, .sheet-xl {
        max-width: none;
        max-height: calc(100dvh - var(--safe-t) - 18px);
        border-radius: 26px 26px 0 0;
        border-bottom: 0;
        transform: translateY(100%);
        transition: transform 0.34s var(--ease-out), opacity 0.2s;
        opacity: 1;
    }
    .overlay.is-open .sheet { transform: none; }
    .overlay.is-leaving .sheet { transform: translateY(100%); opacity: 1; }
    .sheet-grab { display: flex; }
    .sheet-head { padding: 10px 18px 10px; }
    .sheet-body { padding: 4px 18px calc(22px + var(--safe-b)); }
    .sheet-actions { bottom: calc(-22px - var(--safe-b)); padding-bottom: calc(4px + var(--safe-b)); }
}

.confirm-body { color: var(--text-2); margin-bottom: 18px; line-height: 1.55; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.confirm-actions .btn { min-width: 120px; }
@media (max-width: 760px) { .confirm-actions .btn { flex: 1; } }

.action-list { display: flex; flex-direction: column; gap: 4px; }
.action-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 12px;
    border-radius: 14px;
    border: 0;
    background: none;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 540;
}
.action-item:hover { background: var(--surface-hover); }
.action-item.is-danger { color: var(--danger); }
.action-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-hover); }
.action-label { flex: 1; display: flex; flex-direction: column; }
.action-label small { color: var(--text-3); font-weight: 450; font-size: 0.76rem; }
.action-chevron { color: var(--text-3); }

/* ── Avisos ───────────────────────────────────────────────────────────────── */

#toasts {
    position: fixed;
    z-index: 200;
    left: 50%;
    bottom: calc(24px + var(--safe-b));
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: min(92vw, 460px);
}
@media (max-width: 760px) { #toasts { bottom: calc(var(--tabbar-h) + var(--safe-b) + 22px); } }
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px 11px 14px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow);
    font-size: 0.88rem;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    transition: opacity 0.22s, transform 0.3s var(--spring);
    max-width: 100%;
}
.toast.is-in { opacity: 1; transform: none; }
.toast-icon { display: grid; place-items: center; color: var(--accent); }
.toast.is-success .toast-icon { color: var(--ok); }
.toast.is-error .toast-icon { color: var(--danger); }
.toast.is-gold { border-color: var(--gold-line); }
.toast.is-gold .toast-icon { color: var(--gold); }
.toast-text { flex: 1; min-width: 0; }
.toast-action { border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 0.8rem; padding: 6px 10px; border-radius: 10px; cursor: pointer; }

/* ── Estados vacíos y carga ───────────────────────────────────────────────── */

.empty {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 36px 20px;
    overflow: hidden;
}
.empty .guilloche { width: 120px; height: 120px; color: var(--gold); opacity: 0.5; margin-bottom: 6px; }
.empty h3 { font-size: 1.05rem; }
.empty p { color: var(--text-2); max-width: 360px; font-size: 0.9rem; }
.empty .btn { margin-top: 8px; }


.splash {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--bg);
    z-index: 300;
    transition: opacity 0.4s var(--ease);
}
.splash.is-gone { opacity: 0; pointer-events: none; }
.splash-mark { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.splash-mark .guilloche { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--gold); opacity: 0.55; animation: spin 18s linear infinite; }
.splash-mark b {
    position: relative;
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 200;
    background: linear-gradient(160deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: breathe 2.4s var(--ease) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { opacity: 0.55; transform: scale(0.96); } }

/* ── Medallones de insignias ──────────────────────────────────────────────── */

.medallion {
    position: relative;
    width: var(--size, 88px);
    height: var(--size, 88px);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    --m-hi: var(--gold-hi);
    --m-mid: var(--gold);
    --m-lo: var(--gold-lo);
}
.medallion.is-silver { --m-hi: #f4f6fa; --m-mid: #b9c2d0; --m-lo: #6f7a8c; }
.medallion.is-bronze { --m-hi: #f6c8a0; --m-mid: #c07a45; --m-lo: #7a4520; }
.medallion-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.medallion-disc { fill: color-mix(in srgb, var(--m-mid) 92%, black); }
.medallion-ticks { stroke: var(--m-hi); stroke-width: 0.9; opacity: 0.65; }
.medallion-inner { fill: none; stroke: var(--m-hi); stroke-width: 0.8; opacity: 0.8; }
.medallion::before {
    content: "";
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, var(--m-hi), var(--m-mid) 52%, var(--m-lo) 100%);
    box-shadow: inset 0 -3px 8px rgba(0, 0, 0, 0.35), inset 0 2px 3px rgba(255, 255, 255, 0.4), 0 10px 22px -10px var(--m-mid);
}
.medallion-rosette { position: absolute; inset: 14%; color: var(--m-lo); opacity: 0.55; }
.medallion-rosette .guilloche { width: 100%; height: 100%; }
.medallion-icon {
    position: relative;
    width: 44%;
    height: 44%;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 35% 30%, var(--m-hi), var(--m-mid));
    color: color-mix(in srgb, var(--m-lo) 80%, black);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
}
.medallion-icon .i { width: 55%; height: 55%; }
.medallion.is-locked { filter: grayscale(1) brightness(0.55) contrast(0.9); opacity: 0.55; }
:root[data-theme="light"] .medallion.is-locked { filter: grayscale(1) brightness(1.05) contrast(0.7); opacity: 0.5; }

/* ── Paleta de comandos ───────────────────────────────────────────────────── */

.palette-input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 52px;
    border-radius: 14px;
    border: 1px solid var(--line-strong);
    background: var(--surface-sunken);
}
.palette-input input { flex: 1; border: 0; background: none; height: 100%; font-size: 1rem; }
.palette-input input:focus { outline: none; }
.palette-results { margin-top: 12px; display: flex; flex-direction: column; gap: 2px; max-height: 52dvh; overflow-y: auto; }
.palette-group { padding: 12px 10px 6px; font-size: 0.68rem; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 12px;
    border: 0;
    background: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-size: 0.92rem;
}
.palette-item[aria-selected="true"], .palette-item:hover { background: var(--accent-soft); }
.palette-item .muted { margin-left: auto; font-size: 0.8rem; }

/* ── Calendario ───────────────────────────────────────────────────────────── */

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.calendar-head { font-size: 0.68rem; text-align: center; color: var(--text-3); font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; padding-bottom: 4px; }
.calendar-day {
    min-height: 86px;
    border-radius: 14px;
    padding: 8px;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    font-size: 0.72rem;
}
.calendar-day.is-out { opacity: 0.35; }
.calendar-day.is-today { border-color: var(--accent-line); box-shadow: inset 0 0 0 1px var(--accent-line); }
.calendar-day b { font-size: 0.82rem; font-weight: 650; color: var(--text-2); }
.calendar-day.is-today b { color: var(--accent); }
.cal-event {
    display: block;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--danger-soft);
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 560;
    border: 0;
    text-align: left;
    cursor: pointer;
    font-size: 0.7rem;
}
.cal-event.is-income { background: var(--ok-soft); }
.cal-event.is-paid { opacity: 0.5; text-decoration: line-through; }
@media (max-width: 760px) {
    .calendar { gap: 3px; }
    .calendar-day { min-height: 54px; padding: 5px; border-radius: 10px; }
    .cal-event { font-size: 0; padding: 0; height: 6px; border-radius: 3px; }
}

/* ── Acceso y primer uso ──────────────────────────────────────────────────── */

.auth {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth-art {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px;
    background:
        radial-gradient(90% 70% at 10% 0%, rgba(41, 151, 255, 0.2), transparent 60%),
        radial-gradient(80% 70% at 100% 100%, rgba(212, 175, 55, 0.22), transparent 60%),
        linear-gradient(160deg, #0c1830, #050a15 70%);
    color: #eef1f7;
    border-right: 1px solid var(--line);
    isolation: isolate;
}
.auth-art .guilloche { position: absolute; width: 780px; height: 780px; right: -260px; bottom: -220px; color: var(--gold); opacity: 0.2; z-index: -1; }
.auth-art .brand { color: #eef1f7; padding: 0; }
.auth-art .brand-text small { color: rgba(238, 241, 247, 0.55); }
.auth-quote h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(2rem, 3.4vw, 3rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    max-width: 14ch;
}
.auth-quote h2 em { font-style: italic; background: linear-gradient(160deg, var(--gold-hi), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-quote p { margin-top: 16px; color: rgba(238, 241, 247, 0.68); max-width: 42ch; font-size: 1rem; }
.auth-points { display: grid; gap: 12px; color: rgba(238, 241, 247, 0.78); font-size: 0.9rem; }
.auth-points li { display: flex; gap: 10px; align-items: center; list-style: none; }
.auth-points ul { margin: 0; padding: 0; display: grid; gap: 12px; }
.auth-points .i { color: var(--gold); }
.auth-panel { display: grid; place-items: center; padding: 40px 24px calc(40px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.9rem; }
.auth-card > p { color: var(--text-2); margin: 8px 0 24px; }
.auth-foot { margin-top: 18px; font-size: 0.86rem; color: var(--text-2); text-align: center; }
.auth-note { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-sunken); border: 1px solid var(--line); font-size: 0.84rem; color: var(--text-2); }
.auth-note.is-error { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.auth-note.is-ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.auth-mobile-brand { display: none; }
@media (max-width: 900px) {
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-art { display: none; }
    .auth-mobile-brand { display: flex; justify-content: center; margin-bottom: 28px; }
    .auth-panel { align-items: start; padding-top: calc(56px + var(--safe-t)); }
}

.steps { display: flex; gap: 6px; }
.steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--line-strong); }
.steps span.is-done { background: linear-gradient(90deg, var(--gold-lo), var(--gold)); }

.kpi-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv small { color: var(--text-3); font-size: 0.74rem; }
.kv b { font-weight: 600; }

.callout {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--surface-sunken);
    border: 1px solid var(--line);
    font-size: 0.88rem;
    color: var(--text-2);
    align-items: flex-start;
}
.callout .i { color: var(--accent); margin-top: 2px; }
.callout.is-gold { background: var(--gold-soft); border-color: var(--gold-line); color: var(--text); }
.callout.is-gold .i { color: var(--gold); }
.callout.is-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--text); }
.callout.is-warn .i { color: var(--warn); }
.callout.is-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--text); }
.callout.is-ok .i { color: var(--ok); }
.callout b { color: var(--text); }

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px;
    border-radius: 18px;
    border: 1.5px dashed var(--line-strong);
    background: var(--surface-sunken);
    color: var(--text-2);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 0.88rem;
}
.upload-zone:hover, .upload-zone.is-drag { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.upload-zone .i { color: var(--accent); }
.upload-zone input { display: none; }
.upload-progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.upload-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

/* ── Bloqueo con PIN ──────────────────────────────────────────────────────── */

.lock-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: grid;
    place-items: center;
    padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
    background: radial-gradient(900px 600px at 50% 0%, var(--glow-1), transparent 60%), var(--bg);
    transition: opacity 0.3s var(--ease);
}
.lock-screen.is-gone { opacity: 0; }
.lock-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; width: 100%; max-width: 320px; }
.lock-inner h2 { font-size: 1.3rem; }
.lock-inner.is-error .pin-dots { animation: shake 0.35s; }
.pin-dots { display: flex; gap: 12px; margin: 8px 0 14px; }
.pin-dots span { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--text-3); transition: background 0.15s, border-color 0.15s; }
.pin-dots span.is-on { background: var(--gold); border-color: var(--gold); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.pin-pad button { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 1.6rem; font-weight: 300; cursor: pointer; display: grid; place-items: center; transition: background 0.12s; }
.pin-pad button:active { background: var(--accent-soft); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
