/* ==========================================================================
   App Finanzas - diseño "Modernist": fondo claro, tinta oscura, un acento rojo,
   esquinas rectas, jerarquía por tamaño y peso tipográfico.
   ========================================================================== */

:root {
  --bg: #f3f2f2;
  --surface: #eae9e9;
  --ink: #201e1d;
  --muted: #605d5d;
  --line: #d7d3d3;
  --divider: color-mix(in srgb, #201e1d 40%, transparent);
  --accent: #ec3013;
  --accent-600: #dd2b0f;
  --accent-700: #ae1800;
  --accent-200: #ffe0d9;
  --positive: #1d6b43;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
a { color: var(--accent-700); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.neg { color: var(--accent-700); }
.pos { color: var(--positive); }

/* --- Contenedor --- */
.shell {
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  border-inline: 1px solid var(--line);
  padding-bottom: 32px;
}

/* --- Encabezado --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
}
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 10px;
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.chip {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid var(--divider);
  padding: 5px 10px;
  white-space: nowrap;
}
.tabs { display: flex; overflow-x: auto; border-top: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  min-width: 96px;
  min-height: 44px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-decoration: none;
  white-space: nowrap;
}
.tab:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.tab.is-active { background: var(--ink); color: var(--bg); font-weight: 800; }

/* --- Selector de mes --- */
.period {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.period h1 { font-size: 22px; }
.period-nav { display: flex; gap: 2px; }
.btn-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--divider);
  background: transparent;
  color: var(--ink);
  font: 600 13px/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
}
.btn-line:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.btn-line[aria-disabled="true"] { opacity: .35; pointer-events: none; }

/* --- Las tres respuestas --- */
.answers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 2px;
  background: var(--divider);
  border-bottom: 2px solid var(--ink);
}
.answer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 16px 16px;
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
}
.answer:hover { background: var(--surface); color: var(--ink); }
.answer .big { font-size: 32px; }
.answer .go { margin-top: auto; padding-top: 6px; font-size: 13px; font-weight: 600; color: var(--accent-700); }

.kicker { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.big { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.big .cur { font-size: .45em; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-right: 6px; }

/* --- Secciones de detalle --- */
.question { border-bottom: 2px solid var(--ink); scroll-margin-top: 110px; }
.question-head { padding: 22px 16px 16px; }
.question-head .big { margin-top: 8px; }
.verdict { margin-top: 12px; font-size: 16px; max-width: 640px; text-wrap: pretty; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr));
  gap: 2px;
  background: var(--divider);
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
}
.fact { background: var(--bg); padding: 14px 16px; }
.fact-label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fact-value { display: block; margin-top: 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.fact-note { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

.sub-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 20px 16px 6px; }
.sub-head h2 { font-size: 17px; }
.sub-head span { font-size: 12px; color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0 16px 12px; }
.rows li { padding: 12px 0; border-top: 1px solid var(--line); }
.row-main { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.row-name { flex: 1; min-width: 140px; font-size: 14px; font-weight: 600; }
.row-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row-value { font-size: 15px; font-weight: 800; }
.row-note { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.bar { height: 8px; margin-top: 8px; background: var(--line); }
.bar > span { display: block; height: 100%; background: var(--ink); }
.bar > span.hot { background: var(--accent); }

.more { padding: 4px 16px 18px; }
.empty { padding: 20px 16px 24px; color: var(--muted); max-width: 560px; }
.footnote { padding: 0 16px 20px; font-size: 12px; color: var(--muted); max-width: 640px; }

/* Cuenta de "¿cuánto me queda?" */
.ledger { list-style: none; margin: 0; padding: 0 16px; max-width: 640px; }
.ledger li { display: flex; align-items: baseline; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.ledger .label { flex: 1; font-size: 14px; font-weight: 600; }
.ledger .label small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.ledger .amount { font-size: 16px; font-weight: 800; }
.ledger li.total { border-top: 2px solid var(--ink); }
.ledger li.total .label { font-size: 16px; font-weight: 800; }
.ledger li.total .amount { font-size: 22px; }

.split { display: flex; height: 14px; margin: 14px 16px 0; max-width: 608px; background: var(--line); }
.split > span { display: block; height: 100%; }
.split .s-spend { background: var(--ink); }
.split .s-save { background: var(--positive); }
.split .s-left { background: color-mix(in srgb, var(--positive) 35%, var(--bg)); }
.split .s-over { background: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px 0; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }

.aside { margin: 18px 16px 20px; padding: 14px 16px; background: var(--surface); max-width: 640px; }
.aside h3 { font-size: 15px; margin-bottom: 8px; }
.aside p { font-size: 14px; }
.aside p + p { margin-top: 6px; }

@media (max-width: 575.98px) {
  .big { font-size: 36px; }
  .answer .big { font-size: 28px; }
  .period h1 { font-size: 18px; }
}

@media (max-width: 767.98px) {
  .answers { grid-template-columns: 1fr; }
  .answer { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 12px; padding: 14px 16px; }
  .answer .kicker { flex-basis: 100%; }
  .answer .go { display: none; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .period { flex-wrap: wrap; }
}

/* ==========================================================================
   Registrar
   ========================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.modes { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.mode {
  flex: 1 0 auto;
  min-height: 44px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  white-space: nowrap;
}
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.mode:has(input:checked) { background: var(--ink); color: var(--bg); font-weight: 800; }
.mode:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

.reg-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 16px 8px; }
.reg-head h1 { font-size: 26px; }
.steps { display: flex; gap: 4px; padding: 0 16px 16px; }
.steps span { flex: 1; height: 4px; background: var(--line); }
.steps span.now { background: var(--ink); }
.steps span.done { background: var(--accent); }

.step { border-top: 1px solid var(--line); padding: 20px 16px 24px; }
.js .step { display: none; }
.js .step.is-current { display: block; }
.step-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.amount-row { display: flex; align-items: flex-end; gap: 8px; margin: 10px 0 20px; max-width: 420px; }
.amount-cur { font-size: 20px; font-weight: 600; color: var(--muted); padding-bottom: 8px; }
.amount-input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 800 56px/1 var(--font);
  letter-spacing: -0.03em;
  padding: 0 0 4px;
  caret-color: var(--accent);
}
.amount-input::placeholder { color: var(--line); }
.amount-input:focus-visible { outline: none; border-bottom-color: var(--accent); }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  max-width: 420px;
  background: var(--divider);
  border: 1px solid var(--divider);
}
.keypad button {
  min-height: 56px;
  border: 0;
  background: var(--bg);
  color: var(--ink);
  font: 600 22px var(--font);
  cursor: pointer;
}
.keypad button:hover { background: var(--surface); }
.keypad button:active { background: var(--accent-200); }
@media (hover: hover) and (pointer: fine) { .keypad button { min-height: 48px; font-size: 18px; } }

.step-actions { display: flex; gap: 8px; margin-top: 16px; }
.step-error { margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--accent-700); }
.note { margin-top: 14px; font-size: 12px; color: var(--muted); max-width: 460px; }

.btn-solid {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 46px;
  padding: 12px 16px;
  border: 0;
  background: var(--accent);
  color: var(--bg);
  font: 800 15px/1.2 var(--font);
  cursor: pointer;
}
.btn-solid:hover { background: var(--accent-600); }
.btn-solid:active { background: var(--accent-700); }
.btn-solid:disabled { opacity: .5; cursor: progress; }
.btn-wide { width: 100%; max-width: 460px; }
.link-btn {
  background: transparent;
  border: 0;
  padding: 4px;
  font: 600 13px var(--font);
  color: var(--accent-700);
  cursor: pointer;
}
.link-btn:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr));
  gap: 2px;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--divider);
  background: var(--divider);
}
.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 62px;
  padding: 14px;
  background: var(--bg);
  cursor: pointer;
}
.choice > input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.choice:hover { background: var(--surface); }
.choice:has(> input:checked) { background: var(--accent-200); }
.choice:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.choice-name { font-size: 14px; font-weight: 600; line-height: 1.25; }
.choice-hint { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.choice-other { grid-column: span 2; }
@media (max-width: 575.98px) { .choice-other { grid-column: 1 / -1; } }

.field { display: block; }
.field > span { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 600; }
.field-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--divider);
  background: var(--bg);
  color: var(--ink);
  font: 400 14px var(--font);
}
.field-input:hover { border-color: color-mix(in srgb, var(--ink) 55%, transparent); }
.field-input:focus-visible { outline: none; border-color: var(--accent); }

.confirm-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.confirm-amount { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; }
.confirm-summary { font-size: 14px; font-weight: 600; color: var(--muted); }
.confirm-note { margin-top: 8px; font-size: 13px; }
.confirm-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 18px; }

.detail { margin-top: 18px; max-width: 700px; border: 1px solid var(--divider); }
.detail summary { padding: 12px 14px; font-size: 14px; font-weight: 600; cursor: pointer; list-style: none; }
.detail summary::-webkit-details-marker { display: none; }
.detail summary::before { content: "+ "; color: var(--accent-700); }
.detail[open] summary::before { content: "− "; }
.detail[open] summary { border-bottom: 1px solid var(--line); background: var(--surface); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 14px; padding: 14px; }
.seg { display: flex; gap: 2px; border: 1px solid var(--divider); background: var(--divider); }
.seg label { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 42px; background: var(--bg); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--bg); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.check { display: flex; align-items: center; gap: 10px; align-self: end; min-height: 44px; font-size: 13px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.recent { border-top: 2px solid var(--ink); }
.recent .sub-head a { font-size: 13px; font-weight: 600; }
.recent-row { display: flex; align-items: baseline; gap: 12px; }
.recent-date { flex: none; width: 44px; font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.recent-row .row-name { min-width: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(460px, calc(100% - 32px));
  padding: 14px 16px;
  background: var(--ink);
  color: var(--bg);
  transform: translateX(-50%);
  animation: pop .18s ease-out;
}
.toast span { flex: 1; font-size: 14px; font-weight: 600; }
.toast button { border: 0; background: transparent; color: var(--bg); padding: 8px; font-size: 15px; cursor: pointer; }
.toast button:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
.toast-error { background: var(--accent-700); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }


/* ==========================================================================
   Deudas
   ========================================================================== */
.big-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.big-note { font-size: 14px; font-weight: 600; color: var(--muted); padding-bottom: 5px; }
.aside-warn { border-left: 4px solid var(--accent); }
.small-text { font-size: 12px; margin-top: 6px; }

.account { scroll-margin-top: 110px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mini { border: 1px solid var(--divider); }
.mini[open] { flex-basis: 100%; }
.mini summary {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.mini summary::-webkit-details-marker { display: none; }
.mini summary:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.mini[open] summary { background: var(--ink); color: var(--bg); }
.mini-wide { max-width: 760px; }
.mini-wide summary { padding: 12px 16px; font-size: 14px; }
.inline-form { padding: 12px 14px 14px; }
.inline-form .detail-grid { padding: 10px 0 14px; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.btn-danger { border-color: var(--accent-700); color: var(--accent-700); }
.btn-danger:hover { background: var(--accent-200); color: var(--accent-700); }
select.field-input { appearance: auto; }

.movs { list-style: none; margin: 0; padding: 4px 14px 8px; }
.movs li { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.movs li:first-child { border-top: 0; }
.mov-name { flex: 1; min-width: 0; font-weight: 600; }
.mov-amount { font-weight: 800; }
.mov-del { margin: 0; }
.mov-del .link-btn { font-size: 12px; }

.simulator { background: var(--surface); }
.simulator .question-head h2 { font-size: 22px; margin-bottom: 6px; }
.sim-body { padding: 0 16px 22px; max-width: 640px; }
.sim-pay { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sim-pay label { font-size: 13px; font-weight: 600; }
.sim-pay output { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
#sim-range { width: 100%; height: 28px; margin-top: 10px; accent-color: var(--accent); cursor: pointer; }
.sim-scale { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
.sim-facts { margin-top: 16px; border: 1px solid var(--divider); }
.sim-facts .fact { background: var(--surface); }
.sim-advice { margin-top: 14px; font-size: 14px; text-wrap: pretty; }
.sim-order { margin: 12px 0 0; padding-left: 20px; }
.sim-order li { padding: 6px 0; border-top: 1px solid var(--line); }
.sim-order li .row-name { font-size: 14px; }
.sim-order li .row-meta { margin-left: 8px; }

@media (max-width: 767.98px) {
  /* Número impar de datos: el último ocupa toda la fila */
  .facts > .fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ==========================================================================
   Movimientos
   ========================================================================== */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px 8px; }
.toolbar .field-input { flex: 1 1 260px; }
.chips { display: flex; gap: 2px; flex-wrap: wrap; padding: 0 16px 14px; }
.chip-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--divider);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.chip-link:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.chip-link.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.totals { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; padding: 14px 16px; border-top: 1px solid var(--line); }
.total-cell { display: flex; flex-direction: column; gap: 2px; }
.total-value { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.total-net .total-value { font-size: 24px; }
.total-count { margin-left: auto; font-size: 12px; padding-bottom: 4px; }
.total-explain { flex-basis: 100%; margin: 0; font-size: 12px; }
.total-explain strong { color: var(--ink); }

.movements { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.movements > li { border-bottom: 1px solid var(--line); }
.movement summary { list-style: none; cursor: pointer; }
.movement summary::-webkit-details-marker { display: none; }
.movement-row { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; }
.movement-row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.movement[open] > .movement-row { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.movement-main { flex: 1; min-width: 0; }
.movement-title { display: block; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.movement-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.movement-edit { background: var(--surface); border-top: 1px solid var(--line); }
.movement-edit .inline-form { max-width: 820px; }

.tag {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag-accent { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.tag-ink { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.tag-soft { background: var(--line); border-color: var(--line); }
.tag-pos { border-color: var(--positive); color: var(--positive); }

.subfields { margin: 0 0 12px; padding: 10px 12px 0; border: 1px solid var(--line); }
.subfields legend { padding: 0 6px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.subfields .check { min-height: 36px; }
.form-actions { margin-top: 4px; }

.movements-foot { padding: 0 16px 20px; }
.deductible-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px 0; border-bottom: 2px solid var(--ink); font-size: 14px; font-weight: 600; }
.deductible-line strong { font-size: 18px; font-weight: 800; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; }

@media (max-width: 575.98px) {
  .movement-row { flex-wrap: wrap; row-gap: 4px; }
  .movement-main { flex-basis: calc(100% - 56px); }
  .movement-tags { order: 3; justify-content: flex-start; margin-left: 56px; flex: 1; }
  .movement-row .row-value { order: 4; }
}

/* Factura y suscripción: los campos aparecen al marcar la casilla o si ya tienen datos */
.subfields:not(.has-data):not(:has(.check input:checked)) .detail-grid { display: none; }
.subfields:not(.has-data):not(:has(.check input:checked)) { padding-bottom: 4px; }
.movement { scroll-margin-top: 110px; }

/* Ahorro */
.bar-goal { height: 10px; }
.bar-goal > span { background: var(--positive); }
.bar-goal > span.done { background: var(--positive); box-shadow: inset 0 0 0 2px color-mix(in srgb, #fff 35%, transparent); }
.sub-head a.small-text { font-weight: 600; margin-top: 0; }

/* Presupuestos */
.bar-budget { height: 10px; }
.bar-budget > span.warn { background: #b86b00; }
.budget-edit { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.budget-cat { flex: 1 1 180px; font-size: 14px; font-weight: 600; }
.budget-edit .field-input { flex: 0 1 140px; }
.budget-edit .check { min-height: 40px; }

/* Tendencia */
.trend-verdict { margin: 0 16px 14px; font-size: 15px; }
.trend { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 0 16px; }
.trend-col { display: flex; flex-direction: column; align-items: stretch; color: var(--ink); text-decoration: none; }
.trend-col:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 4%, transparent); }
.trend-bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding: 0 6%; border-bottom: 2px solid var(--ink); }
.trend-bars > span { flex: 1; min-height: 0; }
.trend-in { background: var(--ink); }
.trend-out { background: #ff9783; }
.trend-out.over { background: var(--accent); }
.trend-label { margin-top: 6px; font-size: 12px; font-weight: 600; text-align: center; text-transform: capitalize; }
.trend-left { font-size: 12px; font-weight: 800; text-align: center; }
.trend-col.is-current .trend-label { background: var(--ink); color: var(--bg); }
@media (max-width: 575.98px) {
  .trend { gap: 4px; }
  .trend-bars { height: 120px; }
  .trend-left { font-size: 11px; }
}

.row-meta.neg, .row-note.neg { color: var(--accent-700); }

/* Cuadrícula de opciones: líneas dibujadas por cada celda para no dejar huecos grises */
.choices { gap: 1px; padding: 1px; background: transparent; border: 0; }
.choice { box-shadow: 0 0 0 1px var(--divider); }
.choice:has(> input:checked) { z-index: 1; }

/* --- Acceso (login, verificación en dos pasos) --- */
.topbar-end { display: flex; align-items: center; gap: 10px; }
.logout { margin: 0; }
.auth-shell { max-width: 560px; }
.auth-box { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 28px 16px 36px; }
.auth-box h1 { font-size: 26px; }
.auth-lead { font-size: 15px; max-width: 460px; text-wrap: pretty; }
.auth-form { display: flex; flex-direction: column; align-items: stretch; gap: 14px; width: 100%; max-width: 380px; }
.auth-form .btn-solid { justify-content: center; }
.auth-otp { font: 800 24px/1 var(--font); letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.auth-msg { width: 100%; max-width: 460px; padding: 10px 12px; background: var(--surface); font-size: 14px; font-weight: 600; }
.auth-error { background: var(--accent-200); color: var(--accent-700); }
.auth-code { margin: 0; padding: 10px 12px; background: var(--surface); font: 600 15px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .05em; white-space: pre-wrap; word-break: break-all; }
.auth-steps { margin: 0; padding-left: 20px; max-width: 460px; font-size: 14px; }
.auth-steps li + li { margin-top: 6px; }
.auth-qr { padding: 12px; background: #fff; border: 1px solid var(--line); }
.auth-qr img, .auth-qr canvas { display: block; width: 220px; height: 220px; }
.auth-manual summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-700); }
.auth-manual[open] summary { margin-bottom: 8px; }
.auth-recovery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; width: 100%; max-width: 380px; margin: 0; padding: 0; list-style: none; }
.auth-recovery li { padding: 10px 12px; background: var(--surface); font: 600 16px ui-monospace, Consolas, monospace; text-align: center; }
