/* Concepto: libro de caja de una noche en el parque. Banda verde botella con una guirnalda
   que se apaga a medida que se acaba el dinero; el resto es una herramienta clara, pensada
   primero para el teléfono. */
:root {
  color-scheme: light;
  --bg: #F1F5F0; --surface: #FFFFFF; --sunken: #E7EDE6; --line: #D8E0D8;
  --ink: #14231C; --ink2: #47584F; --ink3: #66766D;
  --night: #0F3327; --night2: #184636; --night-ink: #F3F7F0; --night-ink2: #B4CBBD;
  --bulb: #FFC24A; --bulb-off: #2F5B4A; --wire: #5F8573;
  --cta: #0F3327; --cta-ink: #FFFFFF;
  --in: #0E7453; --in-bg: #DDF2E8;
  --gasto: #B92F27; --gasto-bg: #FBE4E1;
  --salida: #2A5CA6; --salida-bg: #E1EAF8;
  --warn: #805200; --warn-bg: #FFEFC9; --warn-line: #E5B650;
  --crit: #B92F27;
  --bar: #2B7A5E; --track: #E2E9E2;
  --st-alm: #0B8A62; --st-par: #C98A0E; --st-dan: #B92F27;
  --display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --body: "Hanken Grotesk", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0B1411; --surface: #141F1A; --sunken: #1A2822; --line: #293830;
  --ink: #E9F0EB; --ink2: #AFBFB6; --ink3: #8B9C92;
  --night: #123A2D; --night2: #1A4A39; --night-ink: #F3F7F0; --night-ink2: #B4CBBD;
  --bulb: #FFC24A; --bulb-off: #2F5B4A; --wire: #5F8573;
  --cta: #FFC24A; --cta-ink: #1B1503;
  --in: #56CDA4; --in-bg: #12352A;
  --gasto: #FF9186; --gasto-bg: #3C1B18;
  --salida: #93B8F4; --salida-bg: #1A2B45;
  --warn: #FFD27A; --warn-bg: #352809; --warn-line: #7C5E1C;
  --crit: #FF9186;
  --bar: #56CDA4; --track: #24332C;
  --st-alm: #34AC84; --st-par: #BD8A1C; --st-dan: #DB3F52;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #0B1411; --surface: #141F1A; --sunken: #1A2822; --line: #293830;
  --ink: #E9F0EB; --ink2: #AFBFB6; --ink3: #8B9C92;
  --night: #123A2D; --night2: #1A4A39; --night-ink: #F3F7F0; --night-ink2: #B4CBBD;
  --bulb: #FFC24A; --bulb-off: #2F5B4A; --wire: #5F8573;
  --cta: #FFC24A; --cta-ink: #1B1503;
  --in: #56CDA4; --in-bg: #12352A;
  --gasto: #FF9186; --gasto-bg: #3C1B18;
  --salida: #93B8F4; --salida-bg: #1A2B45;
  --warn: #FFD27A; --warn-bg: #352809; --warn-line: #7C5E1C;
  --crit: #FF9186;
  --bar: #56CDA4; --track: #24332C;
  --st-alm: #34AC84; --st-par: #BD8A1C; --st-dan: #DB3F52;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
input[type=date] { min-width: 0; max-width: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.45 var(--body); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; line-height: 1.15; }
h2 { font-size: 1.1rem; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--in); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .86em; }
small { font-size: .84rem; color: var(--ink3); }

/* Armazón */
.app { min-height: 100dvh; }
.rail { display: none; }
.main { padding-block: 12px 104px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
.inner { max-width: 1120px; margin: 0 auto; display: grid; gap: 18px; }
.top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: end; justify-content: space-between; }
.top > div { min-width: 0; }
.eyebrow { font-size: .8rem; color: var(--ink3); font-weight: 500; }
.edition { display: flex; flex-direction: column; gap: 2px; font-size: .78rem; color: var(--ink3); }
select, input[type=text], input[type=date], input[type=search], input[type=tel], textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; min-height: 42px;
}
.edition select { font-weight: 600; color: var(--ink); min-width: 176px; }

/* Barra inferior (teléfono) */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); }
.tab { display: grid; justify-items: center; gap: 2px; background: none; border: 0; padding: 5px 0; font-size: .68rem; font-weight: 500; color: var(--ink3); min-width: 0; }
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tab-add { justify-self: center; width: 50px; height: 50px; border-radius: 50%; background: var(--cta); color: var(--cta-ink); border: 0; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 4px 12px rgba(10, 40, 30, .3); }
.tab-add svg { width: 26px; height: 26px; }

/* Banda principal */
.hero { background: var(--night); color: var(--night-ink); border-radius: 18px; overflow: hidden; display: grid; }
.garland { display: block; width: 100%; height: auto; }
.garland .glow { fill: var(--bulb); opacity: .22; }
.garland .on { fill: var(--bulb); }
.garland .off { fill: var(--bulb-off); }
.garland .cap { fill: var(--wire); }
.garland path { fill: none; stroke: var(--wire); stroke-width: 1.5; }
.garland .last { animation: twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .garland .last { animation: none; } * { transition: none !important; } }
.hero-body { padding: 6px 20px 20px; display: grid; gap: 16px; }
.hero-label { font-size: .86rem; color: var(--night-ink2); font-weight: 500; }
.hero-num { font: 700 clamp(2.3rem, 9vw, 3.5rem)/1.05 var(--display); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.hero-num span { font-size: .5em; font-weight: 500; letter-spacing: 0; margin-right: .15em; color: var(--night-ink2); }
.hero-cap { font-size: .86rem; color: var(--night-ink2); max-width: 46ch; margin-top: 4px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--night2); padding-top: 14px; }
.hero-stats dt { font-size: .8rem; color: var(--night-ink2); }
.hero-stats dd { margin: 2px 0 0; font: 700 clamp(.98rem, 3.6vw, 1.3rem)/1.15 var(--display); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
dl { margin: 0; }

/* Aviso de soportes */
.alert { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); border-radius: 14px; padding: 14px 16px; display: grid; gap: 10px; }
.alert-head { display: flex; gap: 10px; align-items: flex-start; }
.alert-head svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.alert h2 { font-size: 1rem; }
.alert p { margin: 2px 0 0; font-size: .88rem; }
.alert-list { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }
.alert-list button { width: 100%; display: flex; gap: 10px; justify-content: space-between; align-items: center; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--warn-line); border-radius: 9px; padding: 9px 12px; min-height: 44px; }
.alert-list b { font-weight: 600; min-width: 0; }
.alert-list span { white-space: nowrap; font-weight: 600; }

.cols { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.link { background: none; border: 0; padding: 0; color: var(--ink2); font-weight: 600; font-size: .86rem; text-decoration: underline; text-underline-offset: 3px; }

/* Presupuesto */
.budget { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
.budget li { display: grid; gap: 5px; }
.b-line { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; align-items: baseline; flex-wrap: wrap; }
.b-line b { font-weight: 600; }
.b-line span { color: var(--ink2); font-size: .84rem; }
.track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; display: block; }
.fill { display: block; height: 100%; background: var(--bar); border-radius: 4px; }
.fill.over { background: var(--crit); }
.state { justify-self: start; display: inline-flex; gap: 4px; align-items: center; font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.state svg { width: 12px; height: 12px; }
.state.over { background: var(--gasto-bg); color: var(--crit); }
.state.near, .state.miss { background: var(--warn-bg); color: var(--warn); }
.state.ok { color: var(--in); padding-inline: 0; }

/* Movimientos */
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 5px; white-space: nowrap; }
.tag.entrada { background: var(--in-bg); color: var(--in); }
.tag.gasto { background: var(--gasto-bg); color: var(--gasto); }
.tag.salida { background: var(--salida-bg); color: var(--salida); }
.rows { display: grid; list-style: none; margin: 0; padding: 0; }
.rows li + li { border-top: 1px solid var(--line); }
.row { width: 100%; background: none; border: 0; padding: 10px 2px; display: grid; gap: 2px 12px; text-align: left; align-items: center;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  grid-template-areas: "t d a" "t m s"; }
.row:hover { background: var(--sunken); }
.r-thumb { grid-area: t; width: 46px; height: 60px; border-radius: 6px; overflow: hidden; position: relative; background: var(--sunken); display: block; }
.r-thumb svg, .r-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.r-count { position: absolute; right: 2px; bottom: 2px; background: rgba(8, 20, 15, .82); color: #fff; font-size: .65rem; font-weight: 700; padding: 0 4px; border-radius: 4px; }
.r-miss { display: grid; place-items: center; border: 1.5px dashed var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.r-miss svg { width: 20px; height: 20px; }
.r-desc { grid-area: d; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.r-meta { grid-area: m; display: flex; flex-wrap: wrap; gap: 3px 7px; align-items: center; font-size: .82rem; color: var(--ink3); min-width: 0; }
.r-amt { grid-area: a; font: 700 1rem/1.2 var(--display); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.r-amt.plus { color: var(--in); }
.r-stat { grid-area: s; justify-self: end; }
.toolbar { display: grid; gap: 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.chip { flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; min-height: 36px; font-size: .86rem; font-weight: 600; color: var(--ink2); }
.chip span { font-weight: 500; color: var(--ink3); margin-left: 3px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[aria-pressed="true"] span { color: inherit; }
.chip.warn { border-color: var(--warn-line); color: var(--warn); }
.chip.warn[aria-pressed="true"] { background: var(--warn-bg); color: var(--warn); }
.sumline { font-size: .88rem; color: var(--ink2); }
.empty { padding: 28px 8px; text-align: center; color: var(--ink2); }

/* Galería */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; }
.tile { background: none; border: 0; padding: 0; text-align: left; display: grid; gap: 6px; align-content: start; min-width: 0; }
.tile-img { display: block; aspect-ratio: 3 / 4; max-width: 100%; border-radius: 9px; overflow: hidden; background: var(--sunken); }
.tile-img svg, .tile-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile:hover .tile-img { outline: 2px solid var(--bar); outline-offset: 1px; }
.tile-miss { border: 2px dashed var(--warn-line); background: var(--warn-bg); color: var(--warn); display: grid; place-content: center; justify-items: center; gap: 6px; font-weight: 700; font-size: .86rem; padding: 10px; text-align: center; }
.tile-miss svg { width: 26px; height: 26px; }
.tile b { font: 700 .95rem/1.2 var(--display); font-variant-numeric: tabular-nums; display: block; }
.tile small { display: block; overflow-wrap: anywhere; }

/* Tablas de reporte */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-size: .78rem; font-weight: 600; color: var(--ink3); padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 1px solid var(--ink3); border-bottom: 0; }
.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 10px; }
th.r { text-align: right; }
.td-bar { min-width: 110px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; gap: 7px; align-items: center; justify-content: center; border-radius: 10px; padding: 10px 14px; min-height: 44px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: center; cursor: pointer; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.main-btn { background: var(--cta); color: var(--cta-ink); border-color: var(--cta); font-weight: 700; }
.btn.warn-btn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); font-weight: 700; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.close-note { display: flex; gap: 12px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.close-note p { margin: 0; flex: 1 1 260px; color: var(--ink2); font-size: .9rem; }

/* Formulario */
.form { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.f { display: grid; gap: 4px; min-width: 0; align-content: start; }
.f.wide { grid-column: 1 / -1; }
label, .lab { font-size: .84rem; font-weight: 600; color: var(--ink2); }
.hint { font-size: .78rem; color: var(--ink3); }
.err { font-size: .8rem; color: var(--crit); font-weight: 600; }
.money { position: relative; }
.money span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--ink3); }
.money input { padding-left: 46px; font: 700 1.3rem var(--display); font-variant-numeric: tabular-nums; min-height: 52px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--sunken); padding: 4px; border-radius: 11px; }
.seg button { background: none; border: 0; border-radius: 8px; padding: 9px 4px; font-weight: 600; color: var(--ink2); min-height: 42px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(10, 30, 20, .18); }
.drop { display: grid; justify-items: center; gap: 6px; text-align: center; border: 2px dashed var(--line); border-radius: 12px; padding: 22px 14px; background: var(--bg); cursor: pointer; color: var(--ink2); }
.drop svg { width: 30px; height: 30px; }
.drop b { color: var(--ink); font-size: 1rem; }
.drop.over { border-color: var(--bar); background: var(--sunken); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
input.vh:focus-visible + .drop, input.vh:focus-visible + .btn { outline: 2px solid var(--in); outline-offset: 2px; }
.prevs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.prev { position: relative; aspect-ratio: 3 / 4; max-width: 100%; border-radius: 8px; overflow: hidden; background: var(--sunken); }
.prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prev button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(8, 20, 15, .78); color: #fff; font-weight: 700; line-height: 1; }
.rule { display: flex; gap: 8px; font-size: .84rem; padding: 10px 12px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); }
.rule.good { background: var(--in-bg); color: var(--in); }
.rule svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* Detalle */
.sheet { position: fixed; inset: 0; z-index: 40; display: grid; }
.scrim { position: absolute; inset: 0; background: rgba(5, 18, 12, .55); border: 0; padding: 0; cursor: default; }
.pane { position: relative; justify-self: end; width: min(560px, 100%); height: 100%; overflow-y: auto; background: var(--surface); display: grid; gap: 16px; align-content: start;
  padding: calc(14px + env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); }
.pane-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; }
.x svg { width: 18px; height: 18px; }
.d-amt { font: 700 2.1rem/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.d-amt.plus { color: var(--in); }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.shot { background: none; border: 0; padding: 0; display: grid; gap: 4px; text-align: left; min-width: 0; }
.shot > span:first-child { display: block; aspect-ratio: 3 / 4; max-width: 100%; border-radius: 9px; overflow: hidden; background: var(--sunken); }
.shot svg, .shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.facts { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 8px 16px; font-size: .92rem; }
.facts dt { color: var(--ink3); }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.zoom { position: fixed; inset: 0; z-index: 60; background: rgba(4, 12, 9, .94); display: grid; place-items: center; padding: 16px; border: 0; width: 100%; cursor: zoom-out; }
.zoom svg, .zoom img { max-width: min(560px, 100%); max-height: 92dvh; width: auto; height: 92dvh; border-radius: 8px; object-fit: contain; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; width: max-content; max-width: calc(100% - 32px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; font-weight: 600; text-align: center; }

/* Inventario */
.tag.entra { background: var(--in-bg); color: var(--in); }
.tag.sale { background: var(--salida-bg); color: var(--salida); }
.tag.vuelve { background: var(--sunken); color: var(--ink2); }
.tag.baja { background: var(--gasto-bg); color: var(--gasto); }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.item { width: 100%; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; display: grid; gap: 8px; text-align: left; align-content: start; }
.item:hover { border-color: var(--bar); }
.i-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.i-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.i-name small { display: block; font-weight: 400; }
.i-num { text-align: right; white-space: nowrap; }
.i-num b { font: 700 1.35rem/1.1 var(--display); font-variant-numeric: tabular-nums; display: block; }
.stack { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
.stack span { display: block; min-width: 4px; }
.stack .alm, .legend .alm { background: var(--st-alm); }
.stack .par, .legend .par { background: var(--st-par); }
.stack .dan, .legend .dan { background: var(--st-dan); }
.legend { display: flex; flex-wrap: wrap; gap: 3px 12px; font-size: .82rem; color: var(--ink2); font-variant-numeric: tabular-nums; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.seg.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 340px; }
.mini { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }
.mini button { width: 100%; display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; background: none; border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; min-height: 44px; text-align: left; }
.mini button:hover { background: var(--sunken); }
.mini b { font-weight: 600; }
.counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.counts dd { margin: 0; font: 700 1.6rem/1.1 var(--display); font-variant-numeric: tabular-nums; }
.counts dt { font-size: .8rem; color: var(--ink3); }

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
  .tabs { display: none; }
  .rail { display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100dvh; background: var(--night); color: var(--night-ink); padding: 22px 14px; }
  .brand { display: grid; gap: 2px; padding-inline: 8px; }
  .brand b { font: 700 1.2rem/1.1 var(--display); }
  .brand span { font-size: .8rem; color: var(--night-ink2); }
  .rail nav { display: grid; gap: 3px; }
  .rail-link { display: flex; gap: 10px; align-items: center; background: none; border: 0; color: var(--night-ink2); padding: 10px; border-radius: 9px; font-weight: 500; text-align: left; }
  .rail-link svg { width: 20px; height: 20px; }
  .rail-link:hover { background: var(--night2); color: var(--night-ink); }
  .rail-link[aria-current="page"] { background: var(--night2); color: var(--night-ink); font-weight: 700; }
  .rail-add { background: var(--bulb); color: #1B1503; border: 0; border-radius: 10px; padding: 11px; font-weight: 700; display: flex; gap: 8px; align-items: center; justify-content: center; }
  .rail-add svg { width: 19px; height: 19px; }
  .rail-foot { margin-top: auto; padding-inline: 8px; font-size: .78rem; color: var(--night-ink2); font-family: var(--mono); overflow-wrap: anywhere; }
  .rail :focus-visible { outline-color: var(--bulb); }
  .main { padding-block: 22px 40px; padding-left: max(32px, env(safe-area-inset-left, 0px)); padding-right: max(32px, env(safe-area-inset-right, 0px)); }
  .toast { bottom: 28px; }
  h1 { font-size: 2rem; }
  .hero-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: end; padding: 6px 28px 26px; }
  .hero-stats { border-top: 0; padding-top: 0; }
  .form { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .row { grid-template-columns: 46px minmax(0, 1fr) 150px 150px; grid-template-areas: "t d s a" "t m s a"; }
  .r-stat { justify-self: center; }
}
@media (min-width: 1160px) {
  .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
}

/* App real: acceso, avisos y ajustes */
img { max-width: 100%; }
.acceso { min-height: 100dvh; display: grid; place-items: center; padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); background: var(--night); color: var(--night-ink); }
.acceso-caja { width: min(420px, 100%); display: grid; gap: 16px; }
.acceso-caja .garland { margin-bottom: 4px; }
.acceso-marca b { font: 700 1.9rem/1.1 var(--display); letter-spacing: -.02em; display: block; }
.acceso-marca span { color: var(--night-ink2); font-size: .92rem; }
.acceso form { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 18px; display: grid; gap: 14px; }
.acceso h1 { font-size: 1.25rem; }
.acceso p { margin: 0; color: var(--ink2); font-size: .9rem; }
.form-err { background: var(--gasto-bg); color: var(--crit); padding: 9px 12px; border-radius: 9px; font-size: .88rem; font-weight: 600; }
.btn.ancho { width: 100%; }
input[type=password], input[type=tel], input[type=number] { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; min-height: 42px; }
.cuenta-btn { display: inline-flex; gap: 7px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; min-height: 42px; padding: 7px 11px; font-weight: 600; max-width: 180px; }
.cuenta-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cuenta-btn svg { width: 18px; height: 18px; flex: none; }
.top-der { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.aviso-ed { display: flex; gap: 8px; font-size: .88rem; padding: 9px 12px; border-radius: 9px; background: var(--sunken); color: var(--ink2); }
.aviso-ed svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.guia { display: grid; gap: 10px; }
.guia p { margin: 0; color: var(--ink2); }
.anulada { opacity: .62; }
.anulada .r-desc, .anulada .r-amt { text-decoration: line-through; }
.state.anul { background: var(--sunken); color: var(--ink2); }
.nota-anul { background: var(--sunken); border-radius: 10px; padding: 10px 12px; font-size: .9rem; color: var(--ink2); }
.nota-anul b { color: var(--ink); }
.dialogo { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding-block: 16px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); overflow-y: auto; }
.dialogo .scrim { position: fixed; }
.dialogo form { position: relative; width: min(460px, 100%); background: var(--surface); border-radius: 16px; padding: 18px; display: grid; gap: 13px; }
.dialogo h2 { font-size: 1.15rem; }
.dialogo p { margin: 0; color: var(--ink2); font-size: .9rem; }
.dlg-acciones { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.btn.peligro { background: var(--crit); color: var(--surface); border-color: var(--crit); font-weight: 700; }
.clave-temp { font: 500 1.2rem var(--mono); background: var(--sunken); padding: 10px 12px; border-radius: 9px; text-align: center; overflow-wrap: anywhere; }
.celda-input { max-width: 150px; text-align: right; font-variant-numeric: tabular-nums; }
.personas { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.personas li { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.personas .btns { gap: 6px; }
.personas .btn { min-height: 38px; padding: 6px 10px; font-size: .86rem; }
.bita { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.bita small { display: block; }
.fila-sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.subiendo { opacity: .65; pointer-events: none; }
.carga { display: grid; place-items: center; min-height: 40vh; color: var(--ink2); }
.imp-mov { break-inside: avoid; border-top: 1px solid var(--line); padding-block: 14px; display: grid; gap: 8px; }
.imp-mov h3 { font-size: 1rem; }
.imp-fotos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.imp-fotos img { width: 100%; max-height: 520px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
@media print {
  .rail, .tabs, .no-print, #toast-root { display: none !important; }
  .app { display: block; }
  .main { padding: 0 !important; }
  body { background: #fff; color: #000; }
}
