/* ============ Fluxo — hoja de estilos ============ */

/* Tipografía auto-hospedada (Fontsource): IBM Plex Sans para texto de interfaz,
   JetBrains Mono como voz protagonista para cifras, marca y títulos numéricos —
   nace del mundo de terminales/estados de cuenta, no de la serif genérica de moda. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/ibm-plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/ibm-plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/ibm-plex-sans-700.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/jetbrains-mono-600.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/jetbrains-mono-700.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/jetbrains-mono-800.woff2") format("woff2"); }

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

:focus-visible { outline: 2px solid var(--brand-2, #22d3ee); outline-offset: 2px; border-radius: 4px; }
.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 999;
  padding: 10px 16px; background: var(--brand); color: #fff; border-radius: 10px;
  font-size: 13px; font-weight: 600; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 12px; }

:root {
  --bg:         #0b0f1a;
  --bg-2:       #0f1524;
  --surface:    rgba(255,255,255,.045);
  --surface-2:  rgba(255,255,255,.075);
  --stroke:     rgba(255,255,255,.09);
  --stroke-2:   rgba(255,255,255,.16);
  --text:       #e9edf7;
  --text-2:     #9aa5bd;
  --text-3:     #6b7691;

  --brand:      #6c8cff;
  --brand-2:    #22d3ee;
  --mint:       #34e0a1;
  --rose:       #ff6b8a;
  --amber:      #ffb84d;
  --violet:     #b388ff;

  --pos: var(--mint);
  --neg: var(--rose);

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;

  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --sidebar-w: 244px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

[data-theme="light"] {
  --bg:        #eef1f8;
  --bg-2:      #e5eaf5;
  --surface:   rgba(255,255,255,.78);
  --surface-2: rgba(255,255,255,.95);
  --stroke:    rgba(16,24,48,.09);
  --stroke-2:  rgba(16,24,48,.18);
  --text:      #131a2b;
  --text-2:    #55617c;
  --text-3:    #838fa8;
  --brand:     #4361ee;
  --mint:      #0eab73;
  --rose:      #e63f63;
  --amber:     #d98613;
  --violet:    #7c4dff;
  --shadow: 0 14px 40px rgba(20,30,60,.13);
}

html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- fondo animado --- */
.aurora { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.aurora span {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .34;
  animation: drift 26s ease-in-out infinite alternate;
}
.aurora span:nth-child(1){ width:46vw; height:46vw; left:-10vw; top:-14vw; background:var(--brand); }
.aurora span:nth-child(2){ width:38vw; height:38vw; right:-8vw; top:6vw;  background:var(--violet); animation-delay:-9s; }
.aurora span:nth-child(3){ width:42vw; height:42vw; left:26vw; bottom:-22vw; background:var(--brand-2); animation-delay:-16s; opacity:.22; }
@keyframes drift { to { transform: translate3d(6vw, 5vh, 0) scale(1.18); } }
[data-theme="light"] .aurora span { opacity: .28; }

/* ============ Sidebar ============ */
.sidebar {
  position: relative; z-index: 3;
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  height: 100vh; height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 14px 20px max(14px, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border-right: 1px solid var(--stroke);
  backdrop-filter: blur(22px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center; font-size: 20px;
  border-radius: 13px; color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--violet));
  box-shadow: 0 8px 22px rgba(108,140,255,.42);
}
.brand-text strong { display: block; font-family: var(--mono); font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.brand-text small { color: var(--text-3); font-size: 11px; letter-spacing: .4px; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--text-2);
  font: inherit; font-size: 13.5px; text-align: left; width: 100%;
  transition: .18s;
}
.nav-item .ni { width: 20px; text-align: center; opacity: .8; font-size: 14px; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  color: #fff; background: linear-gradient(100deg, var(--brand), var(--violet));
  box-shadow: 0 8px 20px rgba(108,140,255,.32);
}
[data-theme="light"] .nav-item.active { color: #fff; }

.sidebar-foot { padding: 4px; }
.health-mini {
  border-radius: var(--r); padding: 14px; border: 1px solid var(--stroke);
  background: var(--surface); text-align: center;
}
.health-mini .hm-score { font-family: var(--mono); font-size: 30px; font-weight: 700; line-height: 1; }
.health-mini .hm-label { font-size: 11px; color: var(--text-3); margin-top: 6px; letter-spacing: .4px; }

/* ============ Main ============ */
.main { position: relative; z-index: 2; flex: 1; height: 100vh; height: 100dvh; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) max(26px, env(safe-area-inset-right)) 18px 26px;
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 21px; letter-spacing: -.2px; }
.topbar-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.month-picker {
  display: flex; align-items: center; gap: 2px;
  background: var(--surface); border: 1px solid var(--stroke); border-radius: 12px; padding: 3px;
}
.month-label {
  background: none; border: 0; color: var(--text); font: inherit; font-size: 13px;
  padding: 5px 12px; cursor: pointer; border-radius: 9px; min-width: 128px;
}
/* solo la primera letra en mayúscula: "Julio de 2026", no "Julio De 2026" */
.month-label::first-letter, .cap::first-letter { text-transform: uppercase; }
.month-label:hover { background: var(--surface-2); }

.views { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 24px 26px max(60px, calc(env(safe-area-inset-bottom) + 24px)); }
.view { animation: rise .38s cubic-bezier(.2,.8,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ============ Botones / controles ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 9px 15px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--stroke-2); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; transition: .16s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  border: 0; color: #fff;
  background: linear-gradient(100deg, var(--brand), var(--violet));
  box-shadow: 0 8px 20px rgba(108,140,255,.34);
}
.btn.ghost { background: transparent; }
.btn.danger { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, transparent); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 9px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 11px; cursor: pointer; font-size: 15px;
  border: 1px solid var(--stroke); background: var(--surface); color: var(--text-2);
  transition: .16s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

input, select, textarea {
  width: 100%; padding: 10px 12px; font: inherit;
  /* 16px mínimo: iOS Safari hace zoom automático al enfocar inputs con fuente menor */
  font-size: 16px;
  color: var(--text); background: var(--surface); border: 1px solid var(--stroke); border-radius: 11px;
  transition: .16s; outline: none;
}
@media (min-width: 640px) { input, select, textarea { font-size: 13.5px; } }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
select option { background: var(--bg-2); color: var(--text); }
label.field { display: block; }
label.field > span { display: block; font-size: 11.5px; color: var(--text-3); margin-bottom: 6px; letter-spacing: .3px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--stroke); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: none; color: var(--text-2); font: inherit; font-size: 12.5px;
  padding: 7px 14px; border-radius: 9px; cursor: pointer; transition: .16s;
}
.seg button.active { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); }
.seg.pos button.active { background: color-mix(in srgb, var(--mint) 24%, transparent); color: var(--mint); }
.seg.neg button.active { background: color-mix(in srgb, var(--rose) 24%, transparent); color: var(--rose); }

/* ============ Cards / grid ============ */
.grid { display: grid; gap: 16px; }
/* auto-fit: las columnas se reacomodan solas según el ancho disponible */
.g-4 { grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.g-2-1 { grid-template-columns: 1.55fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 1.55fr; }
.span-2 { grid-column: span 2; }

.card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--stroke);
  border-radius: var(--r-lg); padding: 20px;
  backdrop-filter: blur(18px);
}
.card.pad-sm { padding: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -.1px; }
.card-head p { margin: 3px 0 0; font-size: 12px; color: var(--text-3); }

/* KPI */
.kpi { position: relative; }
.kpi::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent, var(--brand));
}
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi .k-label { font-size: 11.5px; color: var(--text-3); letter-spacing: .5px; text-transform: uppercase; }
.kpi .k-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 14px;
  background: color-mix(in srgb, var(--accent, var(--brand)) 18%, transparent);
  color: var(--accent, var(--brand));
}
.kpi .k-value { font-family: var(--mono); font-size: 26px; font-weight: 700; margin: 12px 0 4px; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }

.delta { font-weight: 600; font-size: 12px; padding: 2px 7px; border-radius: 7px; }
.delta.up { color: var(--mint); background: color-mix(in srgb, var(--mint) 15%, transparent); }
.delta.down { color: var(--rose); background: color-mix(in srgb, var(--rose) 15%, transparent); }
.delta.flat { color: var(--text-3); background: var(--surface-2); }

.money { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--mint); }
.neg { color: var(--rose); }
.muted { color: var(--text-3); }
.tiny { font-size: 11.5px; }

/* ============ Tabla ============ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-3); font-weight: 600; padding: 0 12px 10px; white-space: nowrap;
}
.table td { padding: 11px 12px; border-top: 1px solid var(--stroke); vertical-align: middle; }
.table tbody tr { transition: .14s; }
.table tbody tr:hover { background: var(--surface); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: .16s; }
tr:hover .row-actions { opacity: 1; }
.mini-btn {
  border: 1px solid var(--stroke); background: var(--surface); color: var(--text-2);
  width: 27px; height: 27px; border-radius: 8px; cursor: pointer; font-size: 12px; transition: .14s;
}
.mini-btn:hover { color: var(--text); background: var(--surface-2); }
.mini-btn.del:hover { color: var(--rose); border-color: var(--rose); }

.cat-cell { display: flex; align-items: center; gap: 10px; }
.cat-dot {
  width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center;
  font-size: 14px; flex: 0 0 auto;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; border: 1px solid var(--stroke);
  background: var(--surface); color: var(--text-2); white-space: nowrap;
}

/* ============ Barras de progreso ============ */
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; transition: width .7s cubic-bezier(.2,.8,.3,1); }
.bar.lg { height: 11px; }

/* ============ Tarjetas de crédito ============ */
.cc {
  position: relative; aspect-ratio: 1.6 / 1; border-radius: 20px; padding: 20px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer; transition: .25s cubic-bezier(.2,.8,.3,1);
  border: 1px solid rgba(255,255,255,.16);
}
.cc:hover { transform: translateY(-5px) rotate(-.5deg); }
.cc::after {
  content: ""; position: absolute; width: 200%; height: 200%; top: -120%; left: -40%;
  background: radial-gradient(circle, rgba(255,255,255,.28), transparent 62%);
  pointer-events: none;
}
.cc .cc-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.cc .cc-type { font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; opacity: .85; }
.cc .cc-name { font-size: 15px; font-weight: 600; margin-top: 3px; }
.cc .cc-num { font-family: var(--mono); font-size: 15px; letter-spacing: 2.5px; opacity: .9; position: relative; z-index: 1; }
.cc .cc-bot { display: flex; justify-content: space-between; align-items: flex-end; position: relative; z-index: 1; }
.cc .cc-bal { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.cc .cc-lbl { font-size: 10px; opacity: .8; letter-spacing: .8px; text-transform: uppercase; }
.cc .cc-bar { height: 5px; background: rgba(255,255,255,.28); border-radius: 999px; margin-top: 10px; overflow: hidden; position: relative; z-index: 1; }
.cc .cc-bar > i { display: block; height: 100%; background: #fff; border-radius: 999px; }

/* ============ Metas ============ */
.goal { display: flex; gap: 18px; align-items: center; }
.goal-info { flex: 1; min-width: 0; }
.goal-info h4 { margin: 0 0 4px; font-size: 14.5px; }

/* ============ Misc ============ */
.empty { text-align: center; padding: 46px 20px; color: var(--text-3); }
.empty .e-icon { font-size: 34px; opacity: .5; margin-bottom: 12px; }
.empty h4 { margin: 0 0 6px; color: var(--text-2); font-size: 15px; }
.empty p { margin: 0 0 18px; font-size: 13px; max-width: 380px; margin-inline: auto; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 160px; }

.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.legend-item i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.legend-item b { color: var(--text); font-variant-numeric: tabular-nums; }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  border-top: 1px solid var(--stroke);
}
.list-row:first-child { border-top: 0; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-size: 13.5px; }
.list-row .lr-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.insight {
  display: flex; gap: 12px; padding: 13px; border-radius: 14px;
  border: 1px solid var(--stroke); background: var(--surface); margin-bottom: 10px;
}
.insight .in-ico { font-size: 17px; flex: 0 0 auto; width: 22px; text-align: center; }
.insight .in-txt { font-size: 12.8px; line-height: 1.55; color: var(--text-2); }
.insight .in-txt b { color: var(--text); }
.insight.warn { border-color: color-mix(in srgb, var(--amber) 45%, transparent); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.insight.bad  { border-color: color-mix(in srgb, var(--rose) 45%, transparent);  background: color-mix(in srgb, var(--rose) 8%, transparent); }
.insight.good { border-color: color-mix(in srgb, var(--mint) 45%, transparent);  background: color-mix(in srgb, var(--mint) 8%, transparent); }

/* SVG charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--text-3); }
.chart .grid-line { stroke: var(--stroke); stroke-width: 1; }
.chart .bar-rect { transition: opacity .16s; cursor: pointer; }
.chart .bar-rect:hover { opacity: .78; }
.arc { transition: transform .2s; transform-origin: center; cursor: pointer; }
.arc:hover { opacity: .82; }
.heat-cell { cursor: pointer; transition: .14s; }
.heat-cell:hover { stroke: var(--text); stroke-width: 1.5; }

.tooltip {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--stroke-2);
  padding: 8px 11px; border-radius: 10px; font-size: 12px; box-shadow: var(--shadow);
  white-space: nowrap; transform: translate(-50%, -125%); line-height: 1.5;
}
.tooltip b { font-variant-numeric: tabular-nums; }

/* ============ Modal ============ */
/* flex, no grid: centrar un hijo de ancho dinámico (min(560px, calc(100vw - 40px)))
   dentro de una celda de grid con auto-sizing es ambiguo entre navegadores y puede
   descentrar el modal; flexbox resuelve esto de forma predecible */
.modal-root { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; }
/* el atributo [hidden] debe ganarle al display:grid de arriba */
.modal-root[hidden], .tooltip[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,8,16,.62); backdrop-filter: blur(5px); }
.modal {
  /* calc(100vw - 40px) en vez de 100%: dentro de un grid con place-items:center
     el porcentaje se resuelve contra la celda de contenido, no contra el viewport,
     y puede desbordar en pantallas angostas */
  position: relative; width: min(560px, calc(100vw - 40px)); max-height: 88vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--stroke-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow); animation: pop .28s cubic-bezier(.2,.9,.3,1);
}
.modal.wide { width: min(760px, calc(100vw - 40px)); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--stroke); position: sticky; top: 0;
  background: var(--bg-2); z-index: 2; border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 22px; }

/* ============ Tutorial ============ */
.tutorial-dots { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 20px; }
.tutorial-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--stroke-2); transition: .25s; }
.tutorial-dot.active { width: 20px; border-radius: 4px; background: linear-gradient(100deg, var(--brand), var(--violet)); }

/* ============ Tour guiado (spotlight sobre la interfaz real) ============ */
.tour-root { position: fixed; inset: 0; z-index: 180; }
.tour-blocker { position: fixed; inset: 0; z-index: 179; background: transparent; }
.tour-highlight {
  position: fixed; z-index: 180; border-radius: 14px; opacity: 0;
  box-shadow: 0 0 0 9999px rgba(5, 8, 16, .74), 0 0 0 3px var(--brand), 0 0 34px rgba(108, 140, 255, .5);
  transition: top .4s cubic-bezier(.2, .8, .3, 1), left .4s cubic-bezier(.2, .8, .3, 1),
              width .4s cubic-bezier(.2, .8, .3, 1), height .4s cubic-bezier(.2, .8, .3, 1), opacity .3s;
  pointer-events: none;
}
[data-theme="light"] .tour-highlight { box-shadow: 0 0 0 9999px rgba(20, 26, 46, .5), 0 0 0 3px var(--brand), 0 0 34px rgba(67, 97, 238, .35); }
.tour-callout {
  position: fixed; z-index: 181; width: min(320px, calc(100vw - 32px));
  background: var(--bg-2); border: 1px solid var(--stroke-2); border-radius: 18px;
  padding: 18px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: top .4s cubic-bezier(.2, .8, .3, 1), left .4s cubic-bezier(.2, .8, .3, 1), opacity .25s;
}
.tour-callout.visible { opacity: 1; pointer-events: auto; }
.tour-callout.wide { width: min(400px, calc(100vw - 32px)); }
.tour-callout .tc-icon { font-size: 34px; margin-bottom: 10px; }
.tour-callout.wide .tc-icon { font-size: 42px; text-align: center; }
.tour-callout h3 { margin: 0 0 8px; font-size: 15.5px; }
.tour-callout.wide h3 { font-size: 17px; text-align: center; }
.tour-callout p { margin: 0; font-size: 13px; line-height: 1.65; color: var(--text-2); }
.tour-callout.wide p { text-align: center; max-width: 340px; margin-inline: auto; }
.tour-callout .tc-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 16px; }

.tour-chart-anim { width: 130px; height: 60px; display: block; margin: 0 auto 16px; overflow: visible; }
.tour-chart-anim rect { transform-box: fill-box; transform-origin: center bottom; animation: tourBarGrow .6s cubic-bezier(.2, .8, .3, 1) both; }
.tour-chart-anim rect:nth-child(1) { fill: var(--brand); animation-delay: .05s; }
.tour-chart-anim rect:nth-child(2) { fill: var(--brand-2); animation-delay: .15s; }
.tour-chart-anim rect:nth-child(3) { fill: var(--mint); animation-delay: .25s; }
.tour-chart-anim rect:nth-child(4) { fill: var(--violet); animation-delay: .35s; }
@keyframes tourBarGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
  .tour-chart-anim rect { animation: none; transform: scaleY(1); }
}

/* ============ Toasts ============ */
.toasts { position: fixed; bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px)); right: max(22px, env(safe-area-inset-right)); z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--bg-2); border: 1px solid var(--stroke-2); border-left: 3px solid var(--brand);
  border-radius: 12px; box-shadow: var(--shadow); font-size: 13px; min-width: 240px;
  animation: slideIn .3s cubic-bezier(.2,.9,.3,1);
}
.toast.ok { border-left-color: var(--mint); }
.toast.err { border-left-color: var(--rose); }
.toast.out { animation: slideOut .3s forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(40px); } }

/* ============ Scrollbars ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--stroke-2); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ============ Responsive ============ */
.only-mobile { display: none; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 4; }

@media (max-width: 1180px) {
  .g-2-1, .g-1-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}
@media (max-width: 860px) {
  .only-mobile { display: grid; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 5; transform: translateX(-100%); transition: transform .3s cubic-bezier(.2,.8,.3,1); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .views { padding: 18px 14px max(60px, calc(env(safe-area-inset-bottom) + 18px)); }
  .topbar { padding: max(14px, env(safe-area-inset-top)) 14px 14px; flex-wrap: wrap; }
  .topbar-title h1 { font-size: 18px; }
  .g-4, .g-3, .g-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .month-label { min-width: 100px; font-size: 12px; }
  .btn.primary span + * { display: none; }
}

/* =========================================================================
   SaaS — cuenta, plan, sincronización (saas-hostinger/auth.js)
   ========================================================================= */

/* --- Mini widget de cuenta en el sidebar --- */
.acct-mini { border-radius: var(--r); padding: 10px 12px; border: 1px solid var(--stroke); background: var(--surface); margin-bottom: 8px; }
.acct-mini-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acct-plan-badge {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
}
.acct-plan-badge.pro { color: #fff; background: linear-gradient(100deg, var(--brand), var(--violet)); }
.acct-mini-btn {
  width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--stroke); background: transparent; color: var(--text-2); font: inherit;
}
.acct-mini-btn:hover { background: var(--surface-2); color: var(--text); }
.acct-mini-email { margin-top: 6px; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Menú flotante de cuenta --- */
.acct-menu {
  position: fixed; z-index: 190; left: 14px; bottom: 92px; width: 220px;
  background: var(--bg-2); border: 1px solid var(--stroke-2); border-radius: var(--r);
  box-shadow: var(--shadow); overflow: hidden; padding: 6px;
}
.acct-menu[hidden] { display: none; }
.acct-menu-item {
  display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px;
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.acct-menu-item:hover { background: var(--surface-2); }
.acct-menu-item[hidden] { display: none; }

/* --- Secciones de pago bloqueadas en el nav --- */
.nav-item.nav-locked { opacity: .55; }
.nav-item.nav-locked .nav-lock { margin-left: auto; font-size: 11px; opacity: .8; }
.nav-item.nav-locked.is-pro { opacity: 1; }
.nav-item.nav-locked.is-pro .nav-lock { display: none; }

/* --- Formulario de autenticación (modal, dos columnas en pantallas anchas) --- */
.modal.auth-modal { width: min(700px, calc(100vw - 40px)); }
.modal.auth-modal .modal-head { border-bottom: 0; padding-bottom: 4px; }
.modal.auth-modal .modal-body { padding: 0; }
.auth-grid { display: grid; grid-template-columns: .82fr 1.18fr; }
.auth-side {
  position: relative; overflow: hidden; padding: 26px 24px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--brand) 16%, transparent), color-mix(in srgb, var(--violet) 12%, transparent));
  border-right: 1px solid var(--stroke); border-radius: 0 0 0 var(--r-lg);
  display: flex; flex-direction: column; justify-content: space-between; min-height: 300px;
}
.auth-side-mark {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #fff; font-size: 16px;
  background: linear-gradient(140deg, var(--brand), var(--violet)); box-shadow: 0 8px 22px rgba(108,140,255,.42);
}
.auth-side-line { font-size: 13px; line-height: 1.6; color: var(--text-2); margin: 18px 0 0; }
.auth-side .ledger-ticker { position: absolute; inset: auto -20px -14px -20px; opacity: .22; gap: 14px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 70%, transparent); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 70%, transparent); }
.auth-side .ledger-row { font-size: 12px; animation-duration: 30s; }
@media (max-width: 640px) { .auth-grid { grid-template-columns: 1fr; } .auth-side { display: none; } }

.auth-switch { display: flex; gap: 4px; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--stroke); border-radius: 12px; padding: 4px; }
.auth-switch-btn { flex: 1; padding: 9px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; transition: .16s; }
.auth-switch-btn.active { background: linear-gradient(100deg, var(--brand), var(--violet)); color: #fff; }
.auth-main { padding: 26px 28px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field-icon { position: relative; display: block; }
.field-icon .fi-glyph { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .6; pointer-events: none; }
.field-icon input { padding-left: 36px; }
.field-icon input[type="password"] { padding-right: 76px; }
.fi-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 11.5px; font-weight: 600;
  padding: 6px 8px; cursor: pointer; border-radius: 7px;
}
.fi-toggle:hover { background: var(--surface-2); color: var(--text); }
.field-hint { margin: -8px 0 0; font-size: 11.5px; color: var(--text-3); }
.form-error { margin: 0; font-size: 12.5px; color: var(--rose); }
.form-error[hidden] { display: none; }
.auth-submit { margin-top: 4px; }

/* --- Modal de upgrade / MODO DEMO --- */
.upgrade-price { margin: 0 0 14px; font-size: 15px; }
.upgrade-price strong { font-family: var(--mono); font-size: 26px; }
.upgrade-list { margin: 0 0 16px; padding-left: 18px; font-size: 13.5px; color: var(--text-2); line-height: 1.9; }
.demo-note {
  margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.5;
  background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
}
.fake-card { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.fake-card input { font-family: var(--mono); opacity: .7; cursor: not-allowed; }
.fake-card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* --- Página de cuenta (cuenta.html) --- */
.acct-card { max-width: 560px; margin: 0 auto 18px; }
.acct-card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--stroke); font-size: 13.5px; }
.acct-card-row:last-of-type { border-bottom: 0; }
.acct-history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.acct-history li { padding-bottom: 8px; border-bottom: 1px solid var(--stroke); }
.acct-history li:last-child { border-bottom: 0; }

/* =========================================================================
   Marketing — landing, precios, páginas legales (index.html, cuenta.html,
   privacidad.html, terminos.html)
   ========================================================================= */

/* body{display:flex} de arriba es para el layout sidebar+main de la app real;
   las páginas de marketing (sin sidebar) necesitan flujo normal en columna,
   si no header/hero/footer terminan uno al lado del otro. */
body.marketing { display: block; overflow-x: clip; }
.mkt-header {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px max(20px, env(safe-area-inset-right)) 16px max(20px, env(safe-area-inset-left));
  backdrop-filter: blur(18px); background: linear-gradient(180deg, var(--bg) 60%, transparent);
  border-bottom: 1px solid var(--stroke);
}
.mkt-brand { display: flex; align-items: center; gap: 10px; }
.mkt-brand .brand-mark {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: #fff; font-size: 15px;
  background: linear-gradient(140deg, var(--brand), var(--violet)); box-shadow: 0 8px 22px rgba(108,140,255,.42);
}
.mkt-brand strong { font-family: var(--mono); font-size: 16px; }
.mkt-nav { display: flex; align-items: center; gap: 8px; }
.mkt-nav a.btn { text-decoration: none; }
@media (max-width: 640px) { .mkt-nav .btn.ghost { display: none; } }

.mkt-main { position: relative; z-index: 2; max-width: 1080px; margin: 0 auto; padding: 0 20px 80px; }

/* Eyebrow: etiqueta mono+regla que antecede la afirmación central de cada
   bloque (hero, cada grupo de features, precios) — mismo device reutilizado
   a propósito, nunca decorativo suelto. */
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase; color: var(--brand-2);
  margin: 0 0 16px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--brand-2); opacity: .8; }
.section-head .eyebrow, .feat-group .eyebrow { justify-content: center; }
.feat-group:not(.feat-group-pro) .eyebrow, .feat-group.feat-group-pro .eyebrow { justify-content: flex-start; }

.hero { position: relative; padding: 76px 0 40px; overflow: clip; }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.08fr .92fr; gap: 56px; align-items: center; text-align: left; }
.hero-copy .eyebrow { justify-content: flex-start; }
.hero h1 { font-size: clamp(32px, 4.6vw, 50px); line-height: 1.08; letter-spacing: -1px; margin: 0 0 18px; }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 16px; color: var(--text-2); max-width: 480px; margin: 0 0 30px; line-height: 1.6; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-cta .btn { padding: 12px 22px; font-size: 14px; }

/* --- Ficha en vivo del hero: mismo lenguaje visual (.card/.money/.pos/.neg)
   que el dashboard real, no una captura de pantalla ni una maqueta aparte. --- */
.hero-ledger { padding: 22px; animation: rise .5s cubic-bezier(.2,.8,.3,1) both; }
.hero-ledger-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.hero-ledger-total { font-family: var(--mono); font-size: 32px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 16px; }
.hero-ledger-total small { font-size: 16px; font-weight: 500; color: var(--text-3); }
.hero-ledger-list { list-style: none; margin: 0; padding: 14px 0 0; border-top: 1px solid var(--stroke); display: flex; flex-direction: column; gap: 11px; }
.hero-ledger-list li { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.hero-ledger-list .money { font-size: 13px; font-weight: 600; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-copy .eyebrow { justify-content: center; }
  .hero p.lead { margin-left: auto; margin-right: auto; }
  .hero-cta { justify-content: center; }
  .hero-ledger { max-width: 380px; margin: 0 auto; }
}

/* --- Firma visual: cinta de movimientos reales del producto, deriva del
   nombre "Fluxo" (flujo) y de la voz mono ya usada para cifras en toda la
   app — no es decoración genérica, es el mecanismo del producto en sí. --- */
.ledger-ticker {
  position: absolute; inset: 8% 0; z-index: 0; display: flex; flex-direction: column;
  gap: 26px; opacity: .16; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
.ledger-row { display: flex; gap: 44px; white-space: nowrap; width: max-content; font-family: var(--mono); font-size: 14px; letter-spacing: .2px; animation: ledgerDrift 42s linear infinite; }
.ledger-row.rev { animation-direction: reverse; animation-duration: 54s; }
.ledger-row span { color: var(--text-3); }
.ledger-row .pos, .ledger-row .neg { font-weight: 600; }
@keyframes ledgerDrift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (max-width: 640px) { .ledger-ticker { display: none; } }

.hero-shot {
  margin: 56px auto 0; max-width: 920px; border-radius: var(--r-lg); border: 1px solid var(--stroke-2);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden; padding: 8px;
}
.hero-shot img { display: block; width: 100%; border-radius: calc(var(--r-lg) - 6px); }

.feat-section { margin: 88px 0; display: flex; flex-direction: column; gap: 48px; }
.feat-group-pro { padding-top: 44px; border-top: 1px solid var(--stroke); }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .feat-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .feat-grid { grid-template-columns: 1fr; } }
.feat-card { text-align: left; }
.feat-card .fc-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; font-size: 17px; margin-bottom: 12px; background: var(--surface-2); }
.feat-card h3 { margin: 0 0 6px; font-size: 14.5px; }
.feat-card p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.feat-card.is-pro { border-color: color-mix(in srgb, var(--violet) 35%, var(--stroke)); }
.feat-card.is-pro .fc-icon { background: color-mix(in srgb, var(--violet) 20%, var(--surface-2)); }

.section-head { text-align: center; max-width: 520px; margin: 0 auto 36px; }
.section-head .eyebrow { justify-content: center; }
.section-head h2 { font-size: clamp(24px, 3.4vw, 32px); margin: 0 0 10px; letter-spacing: -.4px; }
.section-head p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.6; }

.pricing-wrap { margin: 80px 0; }
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 680px; margin: 0 auto; }
@media (max-width: 640px) { .pricing-grid { grid-template-columns: 1fr; } }
.pricing-card { padding: 26px; text-align: left; }
.pricing-card.featured { border-color: color-mix(in srgb, var(--brand) 45%, var(--stroke-2)); box-shadow: 0 20px 50px rgba(108,140,255,.16); }
.pricing-card .pc-plan { font-size: 13px; color: var(--text-2); margin: 0 0 6px; }
.pricing-card .pc-price { font-family: var(--mono); font-size: 34px; font-weight: 700; margin: 0 0 4px; }
.pricing-card .pc-price small { font-family: var(--font); font-size: 13px; font-weight: 400; color: var(--text-3); }
.pricing-card .pc-sub { font-size: 12px; color: var(--text-3); margin: 0 0 18px; }
.pricing-card ul { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--text-2); }
.pricing-card ul li::before { content: "✓ "; color: var(--mint); font-weight: 700; }
.pricing-legal { text-align: center; font-size: 11.5px; color: var(--text-3); margin-top: 18px; line-height: 1.7; }

.mkt-footer { border-top: 1px solid var(--stroke); padding: 30px 20px max(30px, env(safe-area-inset-bottom)); text-align: center; }
.mkt-footer nav { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.mkt-footer nav a { font-size: 12.5px; color: var(--text-2); text-decoration: none; }
.mkt-footer nav a:hover { color: var(--text); }
.mkt-footer p { margin: 0; font-size: 11.5px; color: var(--text-3); }

/* --- Páginas legales --- */
.legal-main { position: relative; z-index: 2; max-width: 720px; margin: 0 auto; padding: 48px 20px 80px; }
.legal-main h1 { font-size: 28px; margin: 0 0 6px; }
.legal-main .legal-updated { color: var(--text-3); font-size: 12.5px; margin: 0 0 32px; }
.legal-main h2 { font-size: 17px; margin: 32px 0 10px; }
.legal-main p, .legal-main li { font-size: 13.5px; line-height: 1.75; color: var(--text-2); }
.legal-main ul { padding-left: 20px; }

@media (prefers-reduced-motion: reduce) {
  .hero-shot, .feat-card, .pricing-card, .hero-ledger { animation: none; }
  .ledger-row { animation: none; }
}
