/* ============================================================
   Finanzas WD — estilo HUD neón oscuro
   Fondo azul noche, neón cian / turquesa / verde, paneles de cristal.
   ============================================================ */
@font-face { font-family: 'Orbitron'; font-weight: 500; font-display: swap; src: url('/fonts/orbitron/orbitron-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Orbitron'; font-weight: 700; font-display: swap; src: url('/fonts/orbitron/orbitron-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 400; font-display: swap; src: url('/fonts/rajdhani/rajdhani-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 500; font-display: swap; src: url('/fonts/rajdhani/rajdhani-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 600; font-display: swap; src: url('/fonts/rajdhani/rajdhani-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 700; font-display: swap; src: url('/fonts/rajdhani/rajdhani-latin-700-normal.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --bg: #02060f;
  --bg-2: #061226;
  --glass: rgba(9, 26, 48, 0.46);
  --glass-strong: rgba(8, 22, 42, 0.82);
  --line: rgba(0, 229, 255, 0.22);
  --line-strong: rgba(0, 229, 255, 0.55);
  --cyan: #00e5ff;
  --teal: #19f5d0;
  --green: #39ff88;
  --pink: #ff4d8d;
  --amber: #ffc94d;
  --text: #d8f6ff;
  --muted: #7fa3b8;
  --dim: #3f5a6e;
  --glow-cyan: 0 0 6px rgba(0, 229, 255, .7), 0 0 18px rgba(0, 229, 255, .35);
  --glow-green: 0 0 6px rgba(57, 255, 136, .7), 0 0 18px rgba(57, 255, 136, .3);
  --radius: 14px;
  --font-hud: 'Orbitron', 'Segoe UI', sans-serif;
  --font: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  --nav-w: 230px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 15% -10%, rgba(0, 229, 255, .16), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 20%, rgba(25, 245, 208, .10), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 110%, rgba(57, 255, 136, .08), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Rejilla HUD y líneas de barrido */
body::before, body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
body::before {
  background-image:
    linear-gradient(rgba(0, 229, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 229, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 85%);
}
body::after {
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 3px);
}

a { color: var(--cyan); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pos { color: var(--green); text-shadow: 0 0 8px rgba(57, 255, 136, .45); }
.neg { color: var(--pink); text-shadow: 0 0 8px rgba(255, 77, 141, .45); }
.mono { font-family: var(--font-hud); letter-spacing: .04em; }

/* ---------- Estructura ---------- */
.app { position: relative; z-index: 1; min-height: 100%; display: flex; }
.nav {
  position: fixed; inset: 0 auto 0 0; width: var(--nav-w);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 6px;
  background: linear-gradient(180deg, rgba(4, 14, 30, .85), rgba(3, 10, 22, .7));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand img { width: 38px; height: 38px; filter: drop-shadow(0 0 8px rgba(0, 229, 255, .6)); }
.brand b { font-family: var(--font-hud); font-size: 15px; letter-spacing: .18em; color: var(--cyan); text-shadow: var(--glow-cyan); display: block; }
.brand small { font-size: 11px; letter-spacing: .3em; color: var(--muted); text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 14px;
  border: 1px solid transparent; transition: .2s;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { color: var(--text); background: rgba(0, 229, 255, .06); }
.nav a.active { color: var(--cyan); border-color: var(--line-strong); background: rgba(0, 229, 255, .09); box-shadow: inset 0 0 14px rgba(0, 229, 255, .15), var(--glow-cyan); text-shadow: 0 0 8px rgba(0, 229, 255, .6); }
.nav .spacer { flex: 1; }
.nav .sys { font-size: 12px; color: var(--dim); padding: 8px 12px; letter-spacing: .12em; font-family: var(--font-hud); }
.nav .sys .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: var(--glow-green); margin-right: 6px; animation: pulse 2s infinite; }

.main { flex: 1; margin-left: var(--nav-w); padding: 22px 28px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-family: var(--font-hud); font-size: 20px; letter-spacing: .2em; text-transform: uppercase; color: var(--text); }
.topbar h1 span { color: var(--cyan); text-shadow: var(--glow-cyan); }
.topbar .grow { flex: 1; }
.clock { font-family: var(--font-hud); font-size: 13px; color: var(--teal); letter-spacing: .14em; text-shadow: 0 0 8px rgba(25, 245, 208, .5); }

.month-picker { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--glass); }
.month-picker button { background: none; border: 0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--cyan); font-size: 18px; }
.month-picker button:hover { background: rgba(0, 229, 255, .12); }
.month-picker span { min-width: 140px; text-align: center; font-family: var(--font-hud); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }

/* ---------- Paneles de cristal ---------- */
.panel {
  position: relative; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 0 0 1px rgba(0, 229, 255, .04) inset, 0 10px 40px rgba(0, 0, 0, .45), 0 0 24px rgba(0, 229, 255, .06);
  min-width: 0;
}
/* Esquinas tipo visor */
.panel::before, .panel::after {
  content: ''; position: absolute; width: 16px; height: 16px; pointer-events: none;
  border: 2px solid var(--cyan); filter: drop-shadow(0 0 4px var(--cyan)); opacity: .85;
}
.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: var(--radius); }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: var(--radius); }
.panel h2 {
  margin: 0 0 14px; font-family: var(--font-hud); font-size: 12px; font-weight: 500; letter-spacing: .22em;
  text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px;
}
.panel h2::before { content: ''; width: 6px; height: 6px; background: var(--teal); box-shadow: 0 0 8px var(--teal); transform: rotate(45deg); }
.panel h2 .right { margin-left: auto; font-family: var(--font); letter-spacing: .04em; text-transform: none; font-size: 13px; }

.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; }
.dash { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-8 { grid-column: span 8; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; }
.span-12 { grid-column: span 12; } .span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; }

.kpi { padding: 16px 18px; }
.kpi .label { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-family: var(--font-hud); font-weight: 700; font-size: clamp(17px, 1.6vw, 24px); margin: 8px 0 4px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub { font-size: 13px; color: var(--muted); }
.kpi.c-cyan .value { color: var(--cyan); text-shadow: var(--glow-cyan); }
.kpi.c-green .value { color: var(--green); text-shadow: var(--glow-green); }
.kpi.c-teal .value { color: var(--teal); text-shadow: 0 0 6px rgba(25, 245, 208, .7), 0 0 18px rgba(25, 245, 208, .3); }
.kpi.c-pink .value { color: var(--pink); text-shadow: 0 0 6px rgba(255, 77, 141, .7), 0 0 18px rgba(255, 77, 141, .3); }
.kpi .bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .06); margin-top: 10px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; width: 0; background: currentColor; box-shadow: 0 0 10px currentColor; transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.kpi.c-cyan .bar { color: var(--cyan); } .kpi.c-green .bar { color: var(--green); } .kpi.c-pink .bar { color: var(--pink); } .kpi.c-teal .bar { color: var(--teal); }

/* ---------- Gráficos ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.chart .axis { stroke: rgba(0, 229, 255, .12); stroke-width: 1; }
.chart .grow-bar { transform-origin: bottom; transform-box: fill-box; animation: growUp .9s cubic-bezier(.2, .8, .2, 1) both; }
.chart .draw { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); animation: draw 1.4s ease-out forwards; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 8px currentColor; background: currentColor; }
.tip {
  position: fixed; pointer-events: none; z-index: 100; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: var(--glass-strong); border: 1px solid var(--line-strong); box-shadow: var(--glow-cyan); white-space: nowrap;
  backdrop-filter: blur(10px);
}
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-wrap svg { flex: none; }
.donut-list { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.donut-list div { display: flex; align-items: center; gap: 8px; }
.donut-list i { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 8px currentColor; background: currentColor; }
.donut-list span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-list b { font-weight: 600; font-family: var(--font-hud); font-size: 12px; }

/* Barras de progreso de ahorro */
.goal { margin-bottom: 14px; }
.goal .row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 6px; }
.goal .row b { font-family: var(--font-hud); font-size: 13px; font-weight: 500; }
.track { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(0, 229, 255, .12); overflow: hidden; }
.track i { display: block; height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--teal), var(--green)); box-shadow: 0 0 12px rgba(57, 255, 136, .6); transition: width 1.2s cubic-bezier(.2, .8, .2, 1); }

/* Listas */
.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid rgba(0, 229, 255, .08); }
.list .item:last-child { border-bottom: 0; }
.list .item .ico { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); color: var(--teal); font-family: var(--font-hud); font-size: 12px; background: rgba(0, 229, 255, .05); }
.list .item .txt { flex: 1; min-width: 0; }
.list .item .txt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .item .txt small { color: var(--muted); font-size: 13px; }
.list .item .amt { font-family: var(--font-hud); font-size: 13px; white-space: nowrap; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; font-size: 15px; }

/* Tablas de gestión */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; font-weight: 500; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 11px 10px; border-bottom: 1px solid rgba(0, 229, 255, .07); vertical-align: middle; }
table.data tr { transition: background .15s; }
table.data tbody tr:hover { background: rgba(0, 229, 255, .05); }
table.data tr.off td { opacity: .45; }
table.data td.num { font-family: var(--font-hud); font-size: 13px; text-align: right; white-space: nowrap; }
table.data th.num { text-align: right; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--teal); background: rgba(25, 245, 208, .06); white-space: nowrap; }
.actions { white-space: nowrap; text-align: right; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border-radius: 10px;
  padding: 10px 18px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 13px;
  background: rgba(0, 229, 255, .1); border: 1px solid var(--line-strong); color: var(--cyan); transition: .2s;
}
.btn:hover { background: rgba(0, 229, 255, .2); box-shadow: var(--glow-cyan); }
.btn.primary { background: linear-gradient(90deg, rgba(0, 229, 255, .25), rgba(57, 255, 136, .25)); color: #eafffb; border-color: var(--teal); text-shadow: 0 0 8px rgba(25, 245, 208, .8); }
.btn.danger { color: var(--pink); border-color: rgba(255, 77, 141, .5); background: rgba(255, 77, 141, .08); }
.btn.danger:hover { box-shadow: 0 0 6px rgba(255, 77, 141, .7), 0 0 18px rgba(255, 77, 141, .3); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--cyan); box-shadow: none; }
.btn.sm { padding: 6px 10px; font-size: 11px; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--cyan); border-color: var(--line); background: rgba(0, 229, 255, .06); }
.icon-btn.del:hover { color: var(--pink); border-color: rgba(255, 77, 141, .4); }
.icon-btn svg { width: 17px; height: 17px; }

.fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 30; width: 60px; height: 60px; border-radius: 50%;
  border: 1px solid var(--teal); background: radial-gradient(circle at 35% 30%, rgba(57, 255, 136, .45), rgba(0, 229, 255, .2) 60%, rgba(2, 6, 15, .9));
  color: #eafffb; font-size: 30px; cursor: pointer; box-shadow: 0 0 10px rgba(25, 245, 208, .7), 0 0 30px rgba(0, 229, 255, .4);
  animation: breathe 3s ease-in-out infinite; display: grid; place-items: center;
}
.fab svg { width: 28px; height: 28px; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  background: rgba(2, 10, 22, .7); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; outline: none;
  transition: border-color .2s, box-shadow .2s; width: 100%;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, .12), var(--glow-cyan); }
.field select option { background: #061226; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }
.form-err { color: var(--pink); min-height: 20px; font-size: 14px; margin-bottom: 8px; }

/* Modal */
dialog.modal {
  border: 1px solid var(--line-strong); border-radius: 16px; padding: 0; color: var(--text); width: min(520px, calc(100vw - 24px));
  background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--glow-cyan), 0 30px 80px rgba(0, 0, 0, .7);
}
dialog.modal::backdrop { background: rgba(1, 4, 10, .7); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: pop .25s cubic-bezier(.2, .8, .2, 1); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-family: var(--font-hud); font-size: 14px; letter-spacing: .2em; text-transform: uppercase; color: var(--cyan); text-shadow: var(--glow-cyan); }
.modal-body { padding: 18px 20px 6px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 18px; }

/* Pantalla de acceso */
.auth { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .panel { width: min(420px, 100%); padding: 30px 28px; }
.auth .logo { display: block; width: 84px; height: 84px; margin: 0 auto 10px; filter: drop-shadow(0 0 16px rgba(0, 229, 255, .7)); animation: float 5s ease-in-out infinite; }
.auth h1 { text-align: center; font-family: var(--font-hud); letter-spacing: .3em; font-size: 22px; margin: 0; color: var(--cyan); text-shadow: var(--glow-cyan); }
.auth p.sub { text-align: center; color: var(--muted); margin: 6px 0 24px; letter-spacing: .2em; font-size: 12px; text-transform: uppercase; }
.auth .btn { width: 100%; padding: 13px; }

/* Banner de instalación */
.install {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; width: min(560px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  background: var(--glass-strong); border: 1px solid var(--teal); box-shadow: 0 0 10px rgba(25, 245, 208, .5), 0 20px 60px rgba(0, 0, 0, .6);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); animation: slideUp .45s cubic-bezier(.2, .8, .2, 1);
}
.install img { width: 44px; height: 44px; flex: none; }
.install .txt { flex: 1; font-size: 14px; }
.install .txt b { display: block; font-family: var(--font-hud); font-size: 13px; letter-spacing: .12em; color: var(--teal); }

.toast {
  position: fixed; top: 18px; right: 18px; z-index: 120; padding: 12px 16px; border-radius: 10px; font-weight: 600;
  background: var(--glass-strong); border: 1px solid var(--green); color: var(--green); box-shadow: var(--glow-green);
  animation: slideIn .3s ease-out;
}
.toast.err { border-color: var(--pink); color: var(--pink); box-shadow: 0 0 10px rgba(255, 77, 141, .5); }

.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head .total { font-family: var(--font-hud); font-size: 14px; color: var(--teal); text-shadow: 0 0 8px rgba(25, 245, 208, .5); }
.section-head .grow { flex: 1; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.acct .big { font-family: var(--font-hud); font-size: 24px; font-weight: 700; color: var(--green); text-shadow: var(--glow-green); margin: 4px 0 2px; }
.acct .meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.acct .btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.acct .swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; box-shadow: 0 0 8px currentColor; background: currentColor; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 200; background: var(--bg); transition: opacity .5s; }
.boot .ring { width: 70px; height: 70px; border-radius: 50%; border: 2px solid rgba(0, 229, 255, .15); border-top-color: var(--cyan); box-shadow: var(--glow-cyan); animation: spin 1s linear infinite; }
.boot.done { opacity: 0; pointer-events: none; }

/* Animaciones */
@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes growUp { from { transform: scaleY(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes breathe { 50% { box-shadow: 0 0 16px rgba(25, 245, 208, .9), 0 0 44px rgba(0, 229, 255, .55); } }
@keyframes slideUp { from { transform: translate(-50%, 30px); opacity: 0; } }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }
.fade-in { animation: fadeIn .45s ease-out both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span-8, .span-4, .span-6, .span-5, .span-7 { grid-column: span 12; }
}
@media (max-width: 820px) {
  :root { --nav-w: 0px; }
  .nav {
    inset: auto 0 0 0; width: auto; height: 66px; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); justify-content: space-around; gap: 2px; height: auto;
  }
  .brand, .nav .spacer, .nav .sys { display: none; }
  .nav a { flex-direction: column; gap: 3px; font-size: 9.5px; padding: 6px 4px; flex: 1; letter-spacing: .04em; }
  .nav a.active { box-shadow: inset 0 0 14px rgba(0, 229, 255, .15); }
  .main { padding: 16px 14px 110px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpis .kpi:first-child { grid-column: span 2; }
  .grid.dash { gap: 14px; }
  .fab { bottom: 92px; right: 18px; width: 54px; height: 54px; }
  .install { bottom: 92px; }
  .topbar h1 { font-size: 16px; }
  .clock { display: none; }
  .month-picker span { min-width: 110px; font-size: 11px; }
  table.data .hide-sm { display: none; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.btn svg { width: 16px; height: 16px; flex: none; }
.acct h2::before { display: none; }
a.btn { text-decoration: none; }
.auth-link { text-align: center; margin: 14px 0 0; }
.auth-link .btn { width: auto; padding: 6px 10px; }

/* ============================================================
   Paleta de gráficos (la lee charts.js) y versión CLARA
   ============================================================ */
:root { --palette: #00e5ff, #19f5d0, #39ff88, #4d9fff, #b388ff, #ffc94d, #ff4d8d, #7dfcff, #9dff6a, #ff8a4d; --nav-bg: linear-gradient(180deg, rgba(4, 14, 30, .85), rgba(3, 10, 22, .7)); --input-bg: rgba(2, 10, 22, .7); --on-primary: #eafffb; }
.nav { background: var(--nav-bg); }
.field input, .field select, .field textarea { background: var(--input-bg); }
.field select option { background: var(--bg-2); }
.btn.primary, .fab { color: var(--on-primary); }
.chart .dot { fill: var(--bg); }
.chart-center-value { fill: var(--text); }
.chart-center-label { fill: var(--muted); }
.theme-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); color: var(--cyan); }
.theme-btn svg { width: 18px; height: 18px; }
.auth-theme { position: fixed; top: 16px; right: 16px; z-index: 5; }

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eaf1f8;
  --bg-2: #dbe7f2;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.95);
  --line: rgba(0, 120, 150, 0.2);
  --line-strong: rgba(0, 128, 160, 0.5);
  --cyan: #007f9e;
  --teal: #00957d;
  --green: #0b8f4d;
  --pink: #d02f6a;
  --amber: #b77b00;
  --text: #0a2033;
  --muted: #4a6579;
  --dim: #9bb0c1;
  --glow-cyan: 0 2px 10px rgba(0, 127, 158, .16);
  --glow-green: 0 2px 10px rgba(11, 143, 77, .16);
  --palette: #0091b3, #00a88c, #13a35a, #2f6fd6, #7b52d6, #c98a00, #d02f6a, #0bb5c9, #6aa312, #e0661f;
  --nav-bg: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(240, 246, 251, .88));
  --input-bg: rgba(255, 255, 255, .9);
  --on-primary: #053b35;
}
:root[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 80% 60% at 15% -10%, rgba(0, 170, 200, .16), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 20%, rgba(0, 190, 150, .10), transparent 60%),
    radial-gradient(ellipse 60% 50% at 50% 110%, rgba(20, 180, 90, .08), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
:root[data-theme="light"] body::before {
  background-image: linear-gradient(rgba(0, 110, 140, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 110, 140, .06) 1px, transparent 1px);
}
:root[data-theme="light"] body::after { display: none; }
:root[data-theme="light"] * { text-shadow: none !important; }
:root[data-theme="light"] .panel { box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 10px 30px rgba(20, 60, 90, .10); }
:root[data-theme="light"] .panel::before, :root[data-theme="light"] .panel::after { filter: none; }
:root[data-theme="light"] .btn.primary { background: linear-gradient(90deg, rgba(0, 170, 200, .18), rgba(20, 180, 90, .18)); }
:root[data-theme="light"] .fab { background: radial-gradient(circle at 35% 30%, #8ff0c0, #5fd8ea 60%, #2bb3c9); box-shadow: 0 6px 20px rgba(0, 127, 158, .35); animation: none; }
:root[data-theme="light"] dialog.modal::backdrop { background: rgba(20, 40, 60, .35); }
:root[data-theme="light"] .track i { box-shadow: none; }
:root[data-theme="light"] .kpi .bar i { box-shadow: none; }
:root[data-theme="light"] .brand img, :root[data-theme="light"] .auth .logo { filter: drop-shadow(0 4px 10px rgba(0, 100, 130, .25)); }
:root[data-theme="light"] .nav .sys .dot { box-shadow: none; }
:root[data-theme="light"] .boot { background: var(--bg); }

/* Observadores */
.viewer-badge { display: flex; align-items: center; gap: 10px; margin: 14px 4px 0; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--line-strong); color: var(--amber); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.viewer-badge svg { width: 20px; height: 20px; flex: none; }
.viewer-badge small { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; }
.perm-list { display: grid; gap: 8px; margin: 8px 0 10px; }
.check.perm { align-items: flex-start; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg); }
.check.perm span { display: flex; flex-direction: column; gap: 2px; }
.check.perm:has(input:checked) { border-color: var(--teal); box-shadow: var(--glow-cyan); }
.field-title { display: block; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.kpis.kpis-1 { grid-template-columns: minmax(0, 1fr); } .kpis.kpis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 820px) {
  .viewer-badge { display: none; }
  .kpis.kpis-3, .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Patrimonio neto: lo más grande y visible del panel */
.nw-hero { padding: 26px 28px; margin-bottom: 18px; border-color: var(--line-strong);
  background: radial-gradient(ellipse 60% 120% at 0% 0%, rgba(57, 255, 136, .12), transparent 60%), radial-gradient(ellipse 60% 120% at 100% 100%, rgba(0, 229, 255, .12), transparent 60%), var(--glass); }
.nw-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.nw-label { font-family: var(--font-hud); font-size: 13px; letter-spacing: .35em; text-transform: uppercase; color: var(--teal); }
.nw-value { font-family: var(--font-hud); font-weight: 700; font-size: clamp(38px, 6.2vw, 76px); line-height: 1.05; margin: 8px 0 6px;
  color: var(--green); text-shadow: 0 0 10px rgba(57, 255, 136, .75), 0 0 34px rgba(57, 255, 136, .35); letter-spacing: .01em; }
.nw-value.neg { color: var(--pink); }
.nw-delta { font-size: 15px; color: var(--muted); min-height: 20px; }
.nw-split { display: flex; gap: 28px; }
.nw-split div { display: flex; flex-direction: column; gap: 4px; }
.nw-split b { font-family: var(--font-hud); font-size: clamp(16px, 1.8vw, 22px); }
.nw-split span:not(.muted) { display: flex; flex-direction: column; gap: 4px; }
.nw-bar { display: flex; height: 10px; border-radius: 10px; overflow: hidden; margin: 18px 0 10px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.nw-bar i { display: block; height: 100%; width: 0; background: currentColor; box-shadow: 0 0 12px currentColor; transition: width 1.2s cubic-bezier(.2, .8, .2, 1); }
.nw-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; }
.nw-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: currentColor; box-shadow: 0 0 8px currentColor; }
.nw-legend b { font-family: var(--font-hud); font-size: 12px; font-weight: 500; }
.sect-title { margin: 0; font-family: var(--font-hud); font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.acct.liab { border-color: rgba(255, 77, 141, .35); }
.acct.liab .big { color: var(--pink); text-shadow: 0 0 8px rgba(255, 77, 141, .5); }
.acct .notes { white-space: pre-line; font-size: 12.5px; max-height: 92px; overflow: auto; }
:root[data-theme="light"] .nw-hero { background: radial-gradient(ellipse 60% 120% at 0% 0%, rgba(20, 180, 90, .10), transparent 60%), radial-gradient(ellipse 60% 120% at 100% 100%, rgba(0, 170, 200, .10), transparent 60%), var(--glass); }
:root[data-theme="light"] .nw-bar i, :root[data-theme="light"] .nw-legend i { box-shadow: none; }
@media (max-width: 820px) { .nw-hero { padding: 20px 18px; } .nw-split { width: 100%; justify-content: space-between; } }
.field input[type="color"] { height: 46px; padding: 4px 6px; cursor: pointer; }

/* Cierre mensual */
.nav a { position: relative; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--pink); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; box-shadow: 0 0 10px rgba(255, 77, 141, .7); }
@media (max-width: 820px) { .nav-badge { position: absolute; top: 2px; right: calc(50% - 22px); margin: 0; height: 17px; min-width: 17px; font-size: 10px; } }
.closing-banner { display: flex; align-items: center; gap: 16px; text-decoration: none; color: var(--text); margin-bottom: 18px; border-color: rgba(255, 201, 77, .5); }
.closing-banner.overdue { border-color: rgba(255, 77, 141, .6); box-shadow: 0 0 18px rgba(255, 77, 141, .2); }
.closing-banner .cb-icon { color: var(--amber); width: 40px; height: 40px; flex: none; display: grid; place-items: center; }
.closing-banner.overdue .cb-icon { color: var(--pink); }
.closing-banner .cb-icon svg { width: 30px; height: 30px; }
.closing-banner .cb-txt { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.closing-banner .cb-txt span { color: var(--muted); font-size: 14px; }
.cl-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.cl-month { display: flex; align-items: center; gap: 12px; }
.cl-title { font-family: var(--font-hud); font-size: clamp(20px, 3vw, 30px); color: var(--text); }
.cl-title::first-letter { text-transform: uppercase; }
.cl-progress { flex: 1; min-width: 220px; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
.cl-progress b { font-family: var(--font-hud); font-size: 22px; }
.cl-status { display: inline-block; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1px solid; margin-bottom: 10px; }
.cl-status.ok { color: var(--green); border-color: var(--green); }
.cl-status.pend { color: var(--amber); border-color: var(--amber); }
.cl-status.off { color: var(--muted); border-color: var(--line); }
.cl-card.pend { border-color: rgba(255, 201, 77, .45); }
.cl-stmt { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.cl-stmt > div { flex: 1; min-width: 160px; }
.cl-file { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-file svg { width: 14px; height: 14px; flex: none; }
.push-box h2 svg { width: 16px; height: 16px; }
.cl-others summary { cursor: pointer; padding: 4px 0; }
.cl-others .cards { margin-top: 14px; }

/* ---------- checklist del mes ---------- */
.ck-title { font-family: var(--font-hud); font-size: 15px; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); margin: 6px 0 12px; }
.ck-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.ck-hint { margin: -4px 0 8px; font-size: 13px; }
.ck-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ck-mark { flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 6px; border: 1.5px solid var(--amber); display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.ck-row.ok .ck-mark { border-color: var(--green); color: var(--green); box-shadow: 0 0 8px rgba(57, 255, 156, .35); }
.ck-row.skip .ck-mark { border-color: var(--line); color: var(--muted); }
.ck-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ck-row.skip .ck-txt b { color: var(--muted); }
.ck-result { font-size: 13px; }
.ck-result.ok { color: var(--green); }
.ck-result.skip { color: var(--muted); }
.ck-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ck-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 55%; }
@media (max-width: 560px) {
  .ck-row { flex-wrap: wrap; }
  .ck-acts { max-width: none; width: 100%; justify-content: flex-start; padding-left: 34px; }
}
.ck-result.bad { color: var(--pink); font-weight: 600; }
