:root {
    --bg: #f3f6fb;
    --surface: rgba(255, 255, 255, .92);
    --surface-solid: #ffffff;
    --surface-soft: #f8fafc;
    --text: #14213d;
    --muted: #6b7890;
    --line: #e5eaf2;
    --primary: #2457e6;
    --primary-dark: #173bb7;
    --primary-soft: #eaf0ff;
    --accent: #7c3aed;
    --success: #0f9f6e;
    --danger: #e4485f;
    --warning: #ed9b22;
    --shadow: 0 20px 60px rgba(28, 45, 85, .10);
    --shadow-soft: 0 10px 32px rgba(28, 45, 85, .08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --sidebar: #101a33;
    --sidebar-text: #edf3ff;
}

[data-theme="dark"] {
    --bg: #09101f;
    --surface: rgba(17, 27, 49, .92);
    --surface-solid: #111b31;
    --surface-soft: #15213b;
    --text: #edf3ff;
    --muted: #9baccc;
    --line: #24324f;
    --primary-soft: #182d66;
    --shadow: 0 20px 70px rgba(0, 0, 0, .28);
    --shadow-soft: 0 10px 35px rgba(0, 0, 0, .22);
    --sidebar: #0a1122;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background .25s ease, color .25s ease;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(36,87,230,.22); outline-offset: 2px; }

.ambient { position: fixed; pointer-events: none; filter: blur(5px); opacity: .55; z-index: -1; border-radius: 50%; }
.ambient-one { width: 430px; height: 430px; right: -160px; top: -150px; background: radial-gradient(circle, rgba(124,58,237,.22), transparent 70%); }
.ambient-two { width: 520px; height: 520px; left: 12%; bottom: -370px; background: radial-gradient(circle, rgba(36,87,230,.18), transparent 70%); }

.app-shell { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 30px; color: inherit; text-decoration: none; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: linear-gradient(135deg, #3972ff, #8a4df6); box-shadow: 0 12px 30px rgba(75,96,255,.32); }
.brand-mark svg { width: 29px; fill: white; }
.brand strong { display: block; letter-spacing: .12em; font-size: 18px; }
.brand small { display: block; margin-top: 3px; color: #9eacc8; font-size: 12px; }
.nav-list { display: grid; gap: 8px; }
.nav-item { width: 100%; border: 0; border-radius: 14px; padding: 13px 14px; background: transparent; color: #aab7d2; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; text-align: left; transition: .2s ease; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { color: white; background: linear-gradient(135deg, rgba(57,114,255,.30), rgba(138,77,246,.18)); box-shadow: inset 0 0 0 1px rgba(151,179,255,.18); }
.nav-icon { display: grid; place-items: center; font-size: 20px; }
.nav-badge { min-width: 23px; height: 23px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; background: #ff647c; color: white; font-size: 11px; font-weight: 800; }
.side-status { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: 15px; background: rgba(255,255,255,.055); }
.side-status small { display: block; color: #8797b8; font-size: 11px; }
.side-status strong { display: block; margin-top: 3px; font-size: 12px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #e9a23b; box-shadow: 0 0 0 5px rgba(233,162,59,.13); }
.status-dot.ok { background: #2bd39a; box-shadow: 0 0 0 5px rgba(43,211,154,.12); }
.status-dot.error { background: #ff6078; box-shadow: 0 0 0 5px rgba(255,96,120,.12); }

.main-content { min-width: 0; padding: 36px clamp(24px, 4vw, 58px) 48px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 7px; font-size: 11px; letter-spacing: .18em; color: var(--primary); font-weight: 850; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.035em; }
.top-date { margin: 0; color: var(--muted); }
.top-actions { display: flex; align-items: stretch; gap: 10px; }
.icon-button { width: 48px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--text); font-size: 21px; box-shadow: var(--shadow-soft); }
.clock-card { min-width: 132px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-soft); text-align: right; }
.clock-card span { display: block; font-weight: 850; font-variant-numeric: tabular-nums; }
.clock-card small { color: var(--muted); }

.summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-bottom: 28px; }
.summary-card { min-height: 126px; position: relative; overflow: hidden; padding: 23px 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); display: flex; justify-content: space-between; align-items: center; }
.summary-card.primary { color: white; border: 0; background: linear-gradient(135deg, #2457e6, #6f44dc); box-shadow: 0 18px 45px rgba(53,78,211,.28); }
.summary-card span:first-child { display: block; margin-bottom: 9px; color: var(--muted); font-size: 13px; }
.summary-card.primary span:first-child { color: rgba(255,255,255,.72); }
.summary-card strong { font-size: clamp(23px,3vw,33px); letter-spacing: -.04em; }
.summary-symbol { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--surface-soft); color: var(--primary); font-size: 25px; font-weight: 900; }
.primary .summary-symbol { color: white; background: rgba(255,255,255,.14); }

.module { display: none; animation: moduleIn .25s ease; }
.module.active { display: block; }
@keyframes moduleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 35px 0 18px; }
.section-heading h2 { margin-bottom: 7px; font-size: clamp(24px,3vw,34px); letter-spacing: -.03em; }
.section-heading p:last-child { margin-bottom: 0; color: var(--muted); max-width: 690px; }
.heading-actions { display: flex; gap: 10px; flex-shrink: 0; }

.panel { border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.panel-header { padding: 22px 24px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.panel-kicker { display: block; color: var(--primary); font-size: 10px; font-weight: 850; letter-spacing: .16em; margin-bottom: 6px; }
.panel h3 { margin: 0; font-size: 18px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; background: rgba(15,159,110,.10); color: var(--success); font-size: 12px; font-weight: 750; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(15,159,110,.12); }

.counter-layout, .adder-layout { display: grid; grid-template-columns: minmax(0,1fr) 285px; gap: 18px; align-items: stretch; }
.denomination-groups { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; padding: 24px; }
.denom-group { min-width: 0; }
.group-title { margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .14em; }
.denom-row { display: grid; grid-template-columns: 86px minmax(90px,1fr) 82px minmax(110px,1fr); gap: 11px; align-items: center; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.denom-row:last-child { border-bottom: 0; }
.denom-visual { width: 86px; height: 42px; display: grid; place-items: center; overflow: hidden; border-radius: 9px; background: var(--surface-soft); box-shadow: 0 5px 16px rgba(20,35,70,.10); }
.denom-visual img { display: block; width: 100%; height: 100%; object-fit: contain; }
.denom-visual.coin { width: 46px; height: 46px; margin-inline: auto; border-radius: 50%; background: transparent; box-shadow: none; }
.denom-info { min-width: 0; display: grid; gap: 2px; }
.denom-info small { color: var(--muted); font-size: 10px; font-weight: 650; }
.denom-value { font-weight: 800; }
.quantity-input { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); color: var(--text); text-align: center; font-weight: 760; }
.denom-subtotal { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.total-panel { min-height: 100%; padding: 28px 24px; border-radius: var(--radius-xl); background: linear-gradient(155deg, #121d38, #1d2e59); color: white; box-shadow: 0 20px 60px rgba(20,38,81,.25); display: flex; flex-direction: column; }
.total-label { color: #9fb0d2; font-size: 11px; font-weight: 850; letter-spacing: .14em; }
.total-panel > strong { margin-top: 15px; font-size: clamp(31px,4vw,46px); letter-spacing: -.055em; overflow-wrap: anywhere; }
.total-panel > p { color: #9fb0d2; font-size: 13px; }
.total-divider { height: 1px; margin: 18px 0; background: rgba(255,255,255,.12); }
.mini-summary { display: flex; justify-content: space-between; gap: 12px; margin: 7px 0; color: #b9c6df; font-size: 13px; }
.mini-summary strong { color: white; }
.total-panel .button { margin-top: auto; }

.button { min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 13px; font-weight: 780; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; box-shadow: 0 10px 25px rgba(59,75,220,.22); }
.button.ghost { border-color: var(--line); background: var(--surface); color: var(--text); }
.button.danger-soft { background: rgba(228,72,95,.10); color: var(--danger); }
.button.light { background: white; color: #14213d; }
.button.full { width: 100%; }

.adder-form { display: flex; gap: 13px; align-items: flex-end; padding: 24px; border-bottom: 1px solid var(--line); }
.field { display: grid; gap: 7px; }
.field.grow { flex: 1; }
.field > span { font-size: 12px; font-weight: 760; color: var(--muted); }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); color: var(--text); padding: 12px 13px; transition: border .15s ease, box-shadow .15s ease; }
.field textarea { resize: vertical; min-height: 115px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(36,87,230,.55); box-shadow: 0 0 0 4px rgba(36,87,230,.09); outline: 0; }
.amount-field { width: 190px; }
.money-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); overflow: hidden; }
.money-input b { padding-left: 13px; color: var(--primary); }
.money-input input { border: 0; box-shadow: none !important; padding-left: 7px; font-weight: 850; }
.add-button { min-width: 135px; }
.table-wrap { overflow-x: auto; padding: 0 24px 22px; }
.value-table { width: 100%; border-collapse: collapse; }
.value-table th, .value-table td { padding: 14px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.value-table th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.value-table th:nth-child(1), .value-table td:nth-child(1) { width: 44px; }
.value-table th:nth-child(3), .value-table td:nth-child(3) { text-align: right; font-weight: 800; }
.value-table th:nth-child(4), .value-table td:nth-child(4) { width: 50px; text-align: right; }
.empty-row td { padding: 40px 12px; text-align: center !important; color: var(--muted); font-weight: 500 !important; }
.row-delete { width: 34px; height: 34px; border: 0; border-radius: 10px; background: rgba(228,72,95,.10); color: var(--danger); font-size: 18px; }
.adder-total-panel { min-height: 290px; }


.payment-calculator { display: grid; gap: 11px; }
.payment-label { color: #b9c6df; font-size: 12px; font-weight: 780; }
.payment-input { display: flex; align-items: center; min-height: 52px; border: 1px solid rgba(255,255,255,.15); border-radius: 14px; background: rgba(255,255,255,.08); overflow: hidden; }
.payment-input b { padding-left: 15px; color: #a9bdff; font-size: 18px; }
.payment-input input { min-width: 0; width: 100%; padding: 12px 14px 12px 8px; border: 0; outline: 0; background: transparent; color: white; font-size: 21px; font-weight: 850; }
.payment-input input::placeholder { color: rgba(255,255,255,.42); }
.quick-payment { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.quick-payment button { min-height: 34px; padding: 6px 7px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(255,255,255,.07); color: #dbe5fb; font-size: 10px; font-weight: 780; }
.quick-payment button:hover { background: rgba(255,255,255,.14); }
.change-box { margin: 4px 0 18px; padding: 15px 16px; border-radius: 15px; border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.07); }
.change-box span { display: block; color: #b9c6df; font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.change-box strong { display: block; margin-top: 5px; font-size: 29px; letter-spacing: -.04em; }
.change-box small { display: block; margin-top: 4px; color: #9fb0d2; line-height: 1.35; }
.change-box.positive { border-color: rgba(43,211,154,.32); background: rgba(43,211,154,.10); }
.change-box.positive strong { color: #5ee8bb; }
.change-box.negative { border-color: rgba(255,96,120,.34); background: rgba(255,96,120,.10); }
.change-box.negative strong { color: #ff8da0; }

.notes-layout { display: grid; grid-template-columns: minmax(310px,.75fr) minmax(0,1.25fr); gap: 18px; align-items: start; }
.note-editor-panel { position: sticky; top: 25px; }
.note-form { display: grid; gap: 16px; padding: 22px 24px 25px; }
.form-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.hidden { display: none !important; }
.notes-list-panel { min-height: 520px; }
.notes-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 13px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.segmented { display: flex; padding: 4px; border-radius: 12px; background: var(--surface-soft); }
.segmented button { padding: 8px 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 760; }
.segmented button.active { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-soft); }
.notes-count { color: var(--muted); font-size: 12px; }
.notes-list { display: grid; gap: 12px; padding: 18px; }
.note-card { position: relative; padding: 17px 18px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface-soft); transition: .18s ease; }
.note-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.note-card.done { opacity: .64; }
.note-card.done h4 { text-decoration: line-through; }
.note-top { display: flex; align-items: flex-start; gap: 12px; }
.note-check { flex: 0 0 auto; width: 24px; height: 24px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface-solid); color: white; display: grid; place-items: center; }
.note-card.done .note-check { border-color: var(--success); background: var(--success); }
.note-main { min-width: 0; flex: 1; }
.note-main h4 { margin: 1px 0 6px; font-size: 15px; }
.note-main p { margin-bottom: 10px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { padding: 5px 8px; border-radius: 999px; background: var(--surface-solid); color: var(--muted); font-size: 10px; font-weight: 780; }
.chip.priority-alta { background: rgba(228,72,95,.11); color: var(--danger); }
.chip.priority-baja { background: rgba(15,159,110,.11); color: var(--success); }
.chip.overdue { background: rgba(237,155,34,.13); color: var(--warning); }
.note-actions { display: flex; gap: 5px; margin-left: auto; }
.note-action { width: 33px; height: 33px; border: 0; border-radius: 10px; background: var(--surface-solid); color: var(--muted); }
.note-action.delete { color: var(--danger); }
.empty-state { min-height: 320px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-state span { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 24px; }
.empty-state strong { margin-top: 13px; color: var(--text); }
.empty-state p { margin-top: 5px; }

.footer { padding: 38px 0 3px; color: var(--muted); text-align: center; font-size: 12px; }
.footer span { margin: 0 4px; }
.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast { padding: 14px 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); animation: toastIn .22s ease; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mobile-nav { display: none; }

@media (max-width: 1080px) {
    .app-shell { grid-template-columns: 210px minmax(0,1fr); }
    .counter-layout, .adder-layout { grid-template-columns: 1fr; }
    .total-panel { min-height: 260px; }
    .denomination-groups { gap: 14px; }
}

@media (max-width: 820px) {
    body { padding-bottom: 78px; }
    .app-shell { display: block; }
    .sidebar { display: none; }
    .main-content { padding: 22px 16px 35px; }
    .topbar { align-items: center; }
    .topbar h1 { font-size: 28px; }
    .top-date { font-size: 13px; }
    .clock-card { display: none; }
    .summary-grid { grid-template-columns: 1fr; gap: 10px; }
    .summary-card { min-height: 102px; }
    .section-heading { align-items: flex-start; flex-direction: column; }
    .heading-actions { width: 100%; }
    .heading-actions .button { flex: 1; }
    .denomination-groups { grid-template-columns: 1fr; }
    .denom-row { grid-template-columns: 78px minmax(80px,1fr) 72px minmax(92px,1fr); }
    .adder-form { align-items: stretch; flex-direction: column; }
    .amount-field { width: 100%; }
    .notes-layout { grid-template-columns: 1fr; }
    .note-editor-panel { position: static; }
    .mobile-nav { display: grid; grid-template-columns: repeat(3,1fr); position: fixed; left: 12px; right: 12px; bottom: 10px; z-index: 100; padding: 5px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--surface-solid) 92%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
    .mobile-nav button { border: 0; border-radius: 13px; background: transparent; color: var(--muted); padding: 8px 3px; font-size: 10px; font-weight: 760; }
    .mobile-nav button span { display: block; font-size: 19px; margin-bottom: 2px; }
    .mobile-nav button.active { background: var(--primary-soft); color: var(--primary); }
}

@media (max-width: 520px) {
    .top-actions { gap: 6px; }
    .icon-button { width: 43px; height: 43px; }
    .summary-card strong { font-size: 27px; }
    .panel, .total-panel { border-radius: 21px; }
    .panel-header { align-items: flex-start; flex-direction: column; }
    .denomination-groups { padding: 17px; }
    .denom-row { grid-template-columns: 66px minmax(68px,1fr) 64px minmax(78px,1fr); gap: 7px; font-size: 12px; }
    .denom-visual { width: 66px; height: 34px; border-radius: 7px; }
    .denom-visual.coin { width: 38px; height: 38px; }
    .denom-info small { display: none; }
    .denom-subtotal { font-size: 11px; }
    .quick-payment { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .quantity-input { padding-inline: 6px; }
    .adder-form, .note-form { padding: 18px; }
    .table-wrap { padding-inline: 12px; }
    .form-grid { grid-template-columns: 1fr; }
    .notes-toolbar { align-items: flex-start; flex-direction: column; }
    .segmented { width: 100%; }
    .segmented button { flex: 1; padding-inline: 5px; }
}

/* ===== NEXO 2.0 · Acceso multiusuario ===== */
.auth-page { min-height: 100vh; overflow-x: hidden; background: #0a1020; color: #f8fbff; }
.auth-page .ambient { position: fixed; pointer-events: none; }
.auth-shell { position: relative; z-index: 2; min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.08fr) minmax(420px,.92fr); }
.auth-hero { min-height: 100vh; padding: 44px clamp(32px,6vw,92px); display: flex; flex-direction: column; justify-content: space-between; background: radial-gradient(circle at 24% 26%,rgba(51,91,255,.22),transparent 35%), linear-gradient(145deg,rgba(8,15,33,.72),rgba(15,29,59,.48)); }
.auth-brand { color: white; width: max-content; }
.auth-brand small { color: #aab7d3; }
.auth-copy { max-width: 690px; margin: 70px 0; }
.auth-pill, .open-registration-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 31px; padding: 7px 11px; border: 1px solid rgba(117,148,255,.25); border-radius: 999px; background: rgba(54,93,226,.14); color: #aebeff; font-size: 10px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.auth-copy h1 { margin: 19px 0 18px; max-width: 780px; color: white; font-size: clamp(42px,5.1vw,74px); line-height: .98; letter-spacing: -.055em; }
.auth-copy > p { max-width: 630px; color: #b8c4dc; font-size: clamp(16px,1.5vw,20px); line-height: 1.6; }
.auth-benefits { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 36px; }
.auth-benefits > div { padding: 17px; border: 1px solid rgba(255,255,255,.09); border-radius: 17px; background: rgba(255,255,255,.045); backdrop-filter: blur(12px); }
.auth-benefits span { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 15px; border-radius: 12px; background: rgba(91,126,255,.16); color: #aebeff; font-size: 18px; }
.auth-benefits strong, .auth-benefits small { display: block; }
.auth-benefits strong { color: white; font-size: 13px; }
.auth-benefits small { margin-top: 4px; color: #9aa9c6; line-height: 1.4; }
.auth-foot { color: #71809f; font-size: 12px; }
.auth-card-wrap { min-height: 100vh; display: grid; place-items: center; padding: 34px; background: rgba(245,248,255,.97); color: #17213b; }
.auth-card { width: min(100%,540px); padding: 28px; border: 1px solid rgba(31,48,86,.09); border-radius: 27px; background: white; box-shadow: 0 30px 80px rgba(13,27,60,.18); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px; border-radius: 14px; background: #f0f3f9; }
.auth-tabs button { min-height: 42px; border: 0; border-radius: 11px; background: transparent; color: #66738c; font-weight: 800; }
.auth-tabs button.active { background: white; color: #1e49cc; box-shadow: 0 7px 18px rgba(28,48,93,.09); }
.auth-form { display: none; gap: 15px; margin-top: 26px; }
.auth-form.active, .setup-card .auth-form { display: grid; }
.auth-heading { margin-bottom: 5px; }
.auth-heading h2, .setup-card h1 { margin: 6px 0 7px; color: #17213b; font-size: 29px; letter-spacing: -.035em; }
.auth-heading > p:last-child, .auth-intro { color: #71809a; line-height: 1.5; }
.auth-form .field input, .auth-form .field select, .setup-card .field input { background: #f8f9fc; color: #17213b; }
.auth-form .field small, .setup-card .field small { margin-top: 6px; color: #8791a7; font-size: 11px; line-height: 1.4; }
.password-field { display: flex; align-items: center; border: 1px solid #dfe4ee; border-radius: 13px; background: #f8f9fc; overflow: hidden; }
.password-field input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.password-field button { width: 44px; height: 44px; border: 0; background: transparent; color: #68758f; font-size: 17px; }
.auth-password-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-submit { min-height: 50px; margin-top: 4px; }
.auth-help { color: #8791a7; text-align: center; font-size: 11px; line-height: 1.45; }
.form-alert { margin-top: 18px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.form-alert.error { border: 1px solid rgba(218,57,82,.18); background: rgba(218,57,82,.08); color: #b4233c; }
.form-alert.success { border: 1px solid rgba(15,159,110,.18); background: rgba(15,159,110,.08); color: #087d56; }
.honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.setup-shell { position: relative; z-index: 2; min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.setup-card { width: min(100%,590px); padding: 31px; border-radius: 27px; background: white; color: #17213b; box-shadow: 0 30px 90px rgba(0,0,0,.34); }
.setup-card .auth-brand { color: #17213b; margin-bottom: 34px; }
.setup-card .auth-brand small { color: #74819b; }
.setup-note { margin: 18px 0 0; color: #8791a7; text-align: center; font-size: 11px; }
.setup-success { text-align: center; }
.setup-success > span { display: grid; place-items: center; width: 68px; height: 68px; margin: 8px auto 17px; border-radius: 22px; background: rgba(15,159,110,.12); color: #0f9f6e; font-size: 30px; font-weight: 900; }
.setup-success p { margin: 0 0 23px; color: #71809a; line-height: 1.55; }

/* Cuenta y sesión */
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: rgba(255,255,255,.055); }
.sidebar-user > div { min-width: 0; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { color: #f8fbff; font-size: 12px; }
.sidebar-user small { margin-top: 2px; color: #899ab8; font-size: 10px; }
.user-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: linear-gradient(135deg,#2f63f0,#693dd4); color: white; font-weight: 900; box-shadow: 0 8px 20px rgba(54,90,210,.25); }
.user-avatar.small { width: 34px; height: 34px; border-radius: 11px; }
.user-chip { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 6px 11px 6px 7px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-soft); }
.user-chip > span:last-child { display: grid; text-align: left; }
.user-chip strong { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.user-chip small { margin-top: 1px; color: var(--muted); font-size: 9px; }
.logout-button { color: var(--danger); }
.admin-mini { margin-left: auto; padding: 3px 5px; border-radius: 6px; background: rgba(133,103,255,.16); color: #ae9cff; font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.privacy-banner { display: flex; align-items: center; gap: 13px; margin-bottom: 17px; padding: 14px 16px; border: 1px solid rgba(36,87,230,.15); border-radius: 16px; background: rgba(36,87,230,.055); }
.privacy-banner > span { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 13px; background: var(--primary-soft); }
.privacy-banner strong, .privacy-banner p { display: block; }
.privacy-banner p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* Administración de usuarios */
.open-registration-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #31c98b; box-shadow: 0 0 0 4px rgba(49,201,139,.12); }
.admin-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 17px; }
.admin-summary article { min-height: 104px; padding: 20px; border: 1px solid var(--line); border-radius: 19px; background: var(--surface-solid); box-shadow: var(--shadow-soft); }
.admin-summary span, .admin-summary strong { display: block; }
.admin-summary span { color: var(--muted); font-size: 11px; font-weight: 780; text-transform: uppercase; letter-spacing: .08em; }
.admin-summary strong { margin-top: 8px; color: var(--text); font-size: 31px; letter-spacing: -.04em; }
.admin-panel { overflow: hidden; }
.admin-toolbar { display: flex; justify-content: space-between; gap: 13px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.admin-search { flex: 1; display: flex; align-items: center; max-width: 560px; min-height: 44px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); overflow: hidden; }
.admin-search span { padding-left: 14px; color: var(--muted); font-size: 20px; }
.admin-search input { width: 100%; padding: 11px 13px 11px 9px; border: 0; outline: 0; background: transparent; color: var(--text); }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 14px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th { color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.admin-table tbody tr:hover { background: var(--surface-soft); }
.admin-user-cell { display: flex; align-items: center; gap: 11px; min-width: 260px; }
.table-avatar { width: 38px; height: 38px; border-radius: 12px; }
.admin-user-cell > div { min-width: 0; }
.admin-user-cell strong, .admin-user-cell small, .admin-user-cell em { display: block; }
.admin-user-cell strong { color: var(--text); font-size: 13px; }
.admin-user-cell small { max-width: 260px; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-cell em { width: max-content; margin-top: 5px; padding: 3px 6px; border-radius: 6px; background: rgba(100,72,220,.10); color: #6d4fd0; font-size: 8px; font-style: normal; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 820; }
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.status-badge.active { background: rgba(15,159,110,.10); color: #0f8e65; }
.status-badge.active::before { background: #16b67c; }
.status-badge.blocked { background: rgba(228,72,95,.10); color: #c7334a; }
.status-badge.blocked::before { background: #df4159; }
.admin-actions { display: flex; gap: 5px; }
.admin-actions button { display: grid; place-items: center; width: 33px; height: 33px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-solid); color: var(--muted); }
.admin-actions button:hover { transform: translateY(-1px); }
.admin-actions button.warn { color: var(--warning); }
.admin-actions button.success { color: var(--success); }
.admin-actions button.danger { color: var(--danger); }
.admin-privacy-note { display: flex; align-items: flex-start; gap: 11px; margin-top: 15px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); color: var(--muted); font-size: 12px; line-height: 1.5; }
.admin-privacy-note p { margin: 0; }
.muted { color: var(--muted); }

/* Modal */
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 20px; background: rgba(7,12,25,.67); backdrop-filter: blur(8px); }
.modal-card { width: min(100%,540px); max-height: calc(100vh - 40px); overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; background: var(--surface-solid); box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 22px 23px 18px; border-bottom: 1px solid var(--line); }
.modal-header h3 { margin-top: 4px; color: var(--text); font-size: 22px; }
.modal-close { width: 38px; height: 38px; border: 0; border-radius: 12px; background: var(--surface-soft); color: var(--muted); font-size: 23px; }
.modal-body { display: grid; gap: 15px; padding: 22px 23px 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }

@media (max-width: 1050px) {
    .auth-shell { grid-template-columns: 1fr 480px; }
    .auth-benefits { grid-template-columns: 1fr; max-width: 430px; }
    .auth-benefits > div { display: grid; grid-template-columns: 43px 1fr; align-items: center; column-gap: 10px; }
    .auth-benefits span { grid-row: span 2; margin: 0; }
}

@media (max-width: 820px) {
    .auth-shell { display: block; }
    .auth-hero { min-height: auto; padding: 28px 22px 38px; }
    .auth-copy { margin: 54px 0 20px; }
    .auth-copy h1 { font-size: 46px; }
    .auth-benefits { display: none; }
    .auth-foot { display: none; }
    .auth-card-wrap { min-height: auto; padding: 24px 16px 40px; }
    .auth-card { margin-top: -16px; }
    .user-chip { display: none; }
    .account-grid { grid-template-columns: 1fr; }
    .mobile-nav.four-items { grid-template-columns: repeat(4,1fr); }
    .mobile-nav.five-items { grid-template-columns: repeat(5,1fr); }
    .admin-summary { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 560px) {
    .auth-copy h1 { font-size: 39px; }
    .auth-copy > p { font-size: 15px; }
    .auth-card { padding: 20px; border-radius: 22px; }
    .auth-password-grid { grid-template-columns: 1fr; }
    .setup-shell { padding: 16px; }
    .setup-card { padding: 23px 19px; border-radius: 22px; }
    .privacy-banner { align-items: flex-start; }
    .admin-summary { grid-template-columns: 1fr; }
    .admin-summary article { min-height: 86px; }
    .admin-toolbar { align-items: stretch; flex-direction: column; }
    .admin-search { max-width: none; }
    .modal-backdrop { padding: 10px; }
    .modal-card { max-height: calc(100vh - 20px); border-radius: 20px; }
    .mobile-nav.five-items button { font-size: 8px; }
    .mobile-nav.five-items button span { font-size: 17px; }
}
.auth-page .ambient { z-index: 0; }
.sidebar-user + .side-status { margin-top: 10px; }

/* Historial privado del contador y el sumador */
.button.compact { min-height: 39px; padding: 8px 13px; font-size: 12px; }
.history-panel { margin-top: 18px; overflow: hidden; }
.history-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.history-header h3 { margin-top: 4px; color: var(--text); font-size: 20px; }
.history-header p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.history-list { display: grid; gap: 12px; padding: 18px; }
.history-empty { min-height: 118px; display: grid; place-items: center; align-content: center; gap: 5px; padding: 22px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.history-empty > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 20px; }
.history-empty strong { color: var(--text); }
.history-empty p { font-size: 12px; }
.history-empty.error { color: var(--danger); }
.history-empty.compact-empty { min-height: 70px; grid-column: 1 / -1; }
.history-card { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.history-card:hover { border-color: color-mix(in srgb, var(--primary) 24%, var(--line)); box-shadow: var(--shadow-soft); }
.history-card.expanded { border-color: color-mix(in srgb, var(--primary) 32%, var(--line)); background: var(--surface-solid); }
.history-card-main { display: grid; grid-template-columns: 46px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 16px 17px 12px; }
.history-icon { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white; font-size: 20px; font-weight: 900; box-shadow: 0 8px 18px rgba(55,75,210,.18); }
.history-card-copy { min-width: 0; }
.history-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.history-card-title > strong { max-width: 100%; overflow: hidden; color: var(--text); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.history-card-copy > span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.history-card-copy > p { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.history-result { padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 850; }
.history-result.positive { background: rgba(15,159,110,.11); color: var(--success); }
.history-result.negative { background: rgba(228,72,95,.11); color: var(--danger); }
.history-card-total { min-width: 125px; text-align: right; }
.history-card-total small, .history-card-total strong { display: block; }
.history-card-total small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.history-card-total strong { margin-top: 3px; color: var(--text); font-size: 21px; letter-spacing: -.03em; }
.history-card-actions { display: flex; justify-content: flex-end; gap: 6px; padding: 0 17px 13px; }
.history-action { min-height: 33px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-solid); color: var(--muted); font-size: 10px; font-weight: 800; }
.history-action:hover { transform: translateY(-1px); color: var(--text); }
.history-action.load { border-color: rgba(36,87,230,.18); background: var(--primary-soft); color: var(--primary); }
.history-action.delete { border-color: rgba(228,72,95,.14); background: rgba(228,72,95,.08); color: var(--danger); }
.history-card-details { padding: 0 17px 16px; animation: historyOpen .18s ease; }
@keyframes historyOpen { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.history-details-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.history-detail-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; padding: 7px 9px; border-radius: 10px; background: var(--surface-solid); }
.history-detail-row span { min-width: 0; display: flex; align-items: center; gap: 7px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.history-detail-row span i { flex: 0 0 auto; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 9px; font-style: normal; font-weight: 850; }
.history-detail-row strong { flex: 0 0 auto; color: var(--text); font-size: 11px; }
.history-payment-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px 18px; margin-top: 8px; padding: 11px 13px; border-radius: 13px; background: var(--navy); color: #c8d4ed; font-size: 11px; }
.history-payment-summary strong { margin-left: 4px; color: white; }
.history-save-card { width: min(100%,500px); }
.history-save-preview { padding: 17px 18px; border-radius: 17px; background: linear-gradient(135deg, var(--navy), #263b70); color: white; }
.history-save-preview span, .history-save-preview strong, .history-save-preview small { display: block; }
.history-save-preview span { color: #b8c6e2; font-size: 10px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.history-save-preview strong { margin-top: 5px; font-size: 30px; letter-spacing: -.04em; }
.history-save-preview small { margin-top: 5px; color: #aebdda; line-height: 1.45; }
.history-private-note { margin: 0; padding: 11px 13px; border-radius: 12px; background: var(--primary-soft); color: var(--muted); font-size: 11px; line-height: 1.45; }

@media (max-width: 820px) {
    .history-header { align-items: flex-start; }
    .history-card-main { grid-template-columns: 42px minmax(0,1fr); }
    .history-card-total { grid-column: 2; min-width: 0; text-align: left; }
    .history-card-actions { justify-content: stretch; }
    .history-action { flex: 1; }
    .history-details-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .history-header { flex-direction: column; padding: 17px; }
    .history-header .button { width: 100%; }
    .history-list { padding: 12px; }
    .history-card-main { padding: 14px 13px 10px; }
    .history-card-actions { flex-wrap: wrap; padding: 0 13px 12px; }
    .history-card-details { padding: 0 13px 13px; }
    .history-card-copy > p { white-space: normal; }
    .heading-actions { flex-wrap: wrap; }
    .heading-actions .button { min-width: calc(50% - 5px); }
}
