/* Tarde Postnovillada. Paleta y letras del manual de CIFRA (portal-cifra/src/index.css). */

:root {
  --bg: #F6F1E6;
  --surface: #FBF8F0;
  --surface-1: #EDE6D6;
  --border: #E7DCC3;
  --text: #221C12;
  --text-2: #6B5E48;
  --verde: #1E9D63;
  --verde-texto: #17603D;
  --verde-cifra: #3ECF8E;
  --verde-profundo: #15392A;
  --rojo: #C2543C;
  --rojo-texto: #AE4229;
  --pendiente: #7A5F1E;
  --pendiente-fondo: #F3E9CE;
  --dorado: #C9A84C;
  --dorado-dato: #E8A04A;
  --crema: #F4EEE1;
  --sombra: 0 1px 2px rgba(34, 28, 18, .06), 0 6px 20px -12px rgba(34, 28, 18, .25);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radio: 14px;
  --nav-alto: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14110C;
    --surface: #221C13;
    --surface-1: #1A1510;
    --border: #34291A;
    --text: #F4EEE1;
    --text-2: #C4B59A;
    --verde-texto: #3ECF8E;
    --rojo-texto: #D4705A;
    --pendiente: #E0C572;
    --pendiente-fondo: #322612;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3 { font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; font-weight: 700; }
.oculto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--verde); outline-offset: 2px; border-radius: 6px; }

.cargando { padding: 40vh 16px 0; text-align: center; color: var(--text-2); }

/* ---------- entrada ---------- */
.entrada {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: radial-gradient(120% 70% at 50% 0%, #1d4a36 0%, var(--verde-profundo) 55%, #0f271d 100%);
  color: var(--crema);
}
.entrada-caja { width: 100%; max-width: 360px; }
.entrada .sobre { color: var(--dorado); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .75rem; }
.entrada h1 { font-size: 2.2rem; line-height: 1.05; margin: 8px 0 6px; }
.entrada .lema { color: #C9D8CE; margin-bottom: 28px; }
.entrada label { display: block; font-size: .85rem; color: #C9D8CE; margin: 14px 0 6px; }
.entrada input {
  width: 100%; height: 52px; border-radius: 12px; border: 1px solid #2E5A45;
  background: rgba(255, 255, 255, .06); padding: 0 14px; color: var(--crema); font-size: 1.05rem;
}
.entrada input.pin { font-family: 'JetBrains Mono', monospace; letter-spacing: .5em; font-size: 1.5rem; text-align: center; }
.entrada input::placeholder { color: #8FA99A; letter-spacing: normal; }
.entrada .error { color: #FFB4A2; min-height: 1.4em; margin-top: 10px; font-size: .9rem; }
.entrada button {
  width: 100%; height: 52px; margin-top: 18px; border: 0; border-radius: 12px;
  background: var(--verde-cifra); color: #0B2419; font-weight: 700; font-size: 1.05rem;
  transition: transform .12s var(--ease-out), filter .2s;
}
.entrada button:active { transform: scale(.98); }
.entrada button[disabled] { filter: saturate(.3) brightness(.8); }

/* ---------- armazón ---------- */
.cabecera {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
}
.cab-in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cabecera .sobre { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--pendiente); }
.cabecera h1 { font-size: 1.2rem; line-height: 1.15; }
.quien {
  flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: .82rem; color: var(--text-2); max-width: 44vw;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 36px;
}
.sync { font-size: .72rem; color: var(--text-2); display: block; text-align: right; margin-top: 2px; }

.vista {
  max-width: 760px; margin: 0 auto;
  padding: 16px 16px calc(var(--nav-alto) + env(safe-area-inset-bottom) + 28px);
  display: grid; gap: 14px;
}

.pestanas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.pestanas button {
  height: var(--nav-alto); border: 0; background: none; color: var(--text-2);
  display: grid; place-items: center; align-content: center; gap: 3px; font-size: .72rem; font-weight: 600;
  transition: color .2s;
}
.pestanas svg { width: 22px; height: 22px; }
.pestanas button[aria-current="page"] { color: var(--verde-texto); }
.pestanas button[aria-current="page"] svg { stroke-width: 2.2; }
@media (min-width: 900px) {
  .pestanas { top: 0; bottom: auto; left: auto; right: 16px; width: auto; background: none; border: 0; backdrop-filter: none; grid-template-columns: repeat(5, auto); gap: 4px; padding-top: 12px; }
  .pestanas button { height: 40px; grid-auto-flow: column; padding: 0 12px; border-radius: 999px; font-size: .85rem; }
  .pestanas button[aria-current="page"] { background: var(--surface-1); }
  .cab-in { max-width: none; padding-right: 520px; }
  .vista { padding-bottom: 48px; }
}

/* ---------- tarjetas ---------- */
.tarjeta {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio);
  padding: 18px 16px; box-shadow: var(--sombra); min-width: 0;
}
.tarjeta > h2 + .ayuda, .tarjeta > h2 + p { margin-top: 4px; }
.ayuda { color: var(--text-2); font-size: .86rem; }
.destacado { font-weight: 600; margin-top: 10px; }
.etq { font-size: .75rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }

/* ---------- héroe: el equilibrio ---------- */
.heroe {
  background: radial-gradient(130% 90% at 0% 0%, #1f5140 0%, var(--verde-profundo) 60%);
  color: var(--crema); border-radius: 18px; padding: 20px 18px 18px; box-shadow: var(--sombra);
}
.heroe .etq { color: var(--dorado); }
.heroe-cifra { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.heroe-cifra .mono { font-size: clamp(3.2rem, 15vw, 4.6rem); line-height: .95; color: var(--verde-cifra); letter-spacing: -0.03em; }
.heroe-ud { font-family: 'Space Grotesk', sans-serif; font-size: 1.3rem; font-weight: 500; color: #C9D8CE; }
.heroe-sub { margin-top: 8px; color: #C9D8CE; font-size: .95rem; }
.heroe-sub strong { color: var(--crema); font-weight: 600; }
.heroe-nota { margin-top: 14px; font-size: .92rem; color: var(--crema); }
.heroe-nota.malo { color: #FFB4A2; }

.regla { margin-top: 18px; }
.regla-pista { position: relative; height: 14px; border-radius: 999px; background: rgba(62, 207, 142, .28); overflow: visible; }
.regla-rojo { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px 0 0 999px; background: rgba(194, 84, 60, .85); transition: width .35s var(--ease-out); }
.regla-banda { position: absolute; top: -6px; bottom: -6px; border: 1.5px dashed rgba(244, 238, 225, .75); border-radius: 8px; transition: left .35s var(--ease-out), width .35s var(--ease-out); }
.regla-marca { position: absolute; top: -9px; width: 3px; height: 32px; margin-left: -1.5px; border-radius: 2px; background: var(--crema); box-shadow: 0 0 0 3px rgba(21, 57, 42, .8); transition: left .2s var(--ease-out); }
.regla-ejes { position: relative; height: 18px; margin-top: 12px; font-size: .72rem; color: #A9C0B2; font-family: 'JetBrains Mono', monospace; }
.regla-ejes span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.regla-ejes span:first-child { transform: none; }
.regla-ejes span:last-child { transform: translateX(-100%); }
.regla-leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: .78rem; color: #C9D8CE; }
.regla-leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ley-rojo { background: rgba(194, 84, 60, .85); }
.ley-verde { background: rgba(62, 207, 142, .5); }
.ley-banda { border: 1.5px dashed rgba(244, 238, 225, .75); }

/* ---------- simulador ---------- */
.control { margin-top: 16px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 12px; }
.control > label, .control legend { font-weight: 600; font-size: .92rem; }
.control output { font-size: 1.25rem; }
.control input[type="range"], .control .ayuda { grid-column: 1 / -1; }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--verde) var(--p, 50%), var(--surface-1) var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-1); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--verde); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--verde); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--verde); }
.segmentos { border: 0; padding: 0; margin-inline: 0; }
.segmentos legend { padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.seg { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--surface-1); padding: 4px; border-radius: 12px; }
.seg button { height: 40px; border: 0; border-radius: 9px; background: none; font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--text-2); transition: background .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* ---------- cuentas (listas de importes) ---------- */
.cuenta { margin: 16px 0 0; display: grid; }
.cuenta .fila { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.cuenta .fila:first-child { border-top: 0; }
.cuenta dt { color: var(--text-2); font-size: .92rem; }
.cuenta dt small { display: block; font-size: .78rem; }
.cuenta dd { margin: 0; font-size: 1rem; white-space: nowrap; }
.cuenta .sub dt { padding-left: 12px; font-size: .85rem; }
.cuenta .sub dd { font-size: .88rem; color: var(--text-2); }
.cuenta .total { border-top: 2px solid var(--text); margin-top: 2px; padding-top: 12px; }
.cuenta .total dt { color: var(--text); font-weight: 700; font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; }
.cuenta .total dd { font-size: 1.55rem; }
.pos { color: var(--verde-texto); }
.neg { color: var(--rojo-texto); }

.barra-reparto { margin-top: 14px; }
.barra-reparto .pista { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-1); }
.barra-reparto .pista > span { height: 100%; transition: width .35s var(--ease-out); }
.br-genero { background: var(--dorado); }
.br-fijos { background: #8C7A5B; }
.br-gana { background: var(--verde); }
.br-pierde { background: var(--rojo); }
.barra-reparto .ley { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: .8rem; color: var(--text-2); }
.barra-reparto .ley i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- recursos (¿llega lo pedido?) ---------- */
.recursos { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 12px; }
.recursos li { display: grid; gap: 5px; }
.recursos .cab { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; }
.recursos .cab b { font-weight: 600; }
.recursos .cab span { color: var(--text-2); font-size: .82rem; text-align: right; }
.medidor { height: 8px; border-radius: 999px; background: var(--surface-1); overflow: hidden; }
.medidor > span { display: block; height: 100%; border-radius: 999px; background: var(--verde); transition: width .35s var(--ease-out); }
.recursos li.corto .medidor > span { background: var(--rojo); }
.recursos li.justo .medidor > span { background: var(--dorado-dato); }
.recursos li.sinpedir .cab b::after { content: 'sin pedir'; margin-left: 8px; font-size: .7rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--pendiente-fondo); color: var(--pendiente); vertical-align: 1px; }

/* ---------- tabla de sensibilidad ---------- */
.tabla-scroll { overflow-x: auto; margin: 14px -4px 0; padding: 0 4px; }
table.sens { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: .9rem; }
.sens th { font-weight: 600; color: var(--text-2); font-size: .78rem; padding: 4px; text-align: center; }
.sens th[scope="row"] { text-align: left; white-space: nowrap; }
.sens td { text-align: center; padding: 9px 4px; border-radius: 8px; background: var(--surface-1); font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.sens td.bien { background: color-mix(in srgb, var(--verde) 16%, var(--surface)); color: var(--verde-texto); }
.sens td.justo { background: var(--pendiente-fondo); color: var(--pendiente); }
.sens td.mal { background: color-mix(in srgb, var(--rojo) 16%, var(--surface)); color: var(--rojo-texto); }
.sens td.actual { outline: 2px solid var(--text); outline-offset: -2px; }

/* ---------- gastos y género ---------- */
.resumen-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.resumen-mini div { background: var(--surface-1); border-radius: 12px; padding: 10px; min-width: 0; }
.resumen-mini dt { font-size: .74rem; color: var(--text-2); }
.resumen-mini dd { margin: 2px 0 0; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 600; transition: transform .12s var(--ease-out), background .2s;
}
.boton:active { transform: scale(.98); }
.boton.primario { background: var(--verde-profundo); color: var(--crema); border-color: var(--verde-profundo); }
.boton.ancho { width: 100%; }
.boton.peligro { color: var(--rojo-texto); border-color: color-mix(in srgb, var(--rojo) 40%, var(--border)); }
.boton.peligro.confirmar { background: var(--rojo); color: #fff; border-color: var(--rojo); }
.boton[disabled] { opacity: .55; }

.grupo { display: grid; gap: 6px; }
.grupo-cab { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px; }
.grupo-cab h3 { font-size: .95rem; }
.grupo-cab span { font-size: .9rem; color: var(--text-2); }
.lista { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.lista > li { display: flex; align-items: stretch; border-top: 1px solid var(--border); }
.lista > li:first-child { border-top: 0; }
.fila-boton {
  flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border: 0; background: none; text-align: left; min-height: 56px;
}
.fila-boton:active { background: var(--surface-1); }
.fila-boton .izq { min-width: 0; }
.fila-boton .izq b { display: block; font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; }
.fila-boton .izq small { display: block; color: var(--text-2); font-size: .8rem; margin-top: 1px; }
.fila-boton .der { text-align: right; flex: none; }
.fila-boton .der .mono { display: block; font-size: 1rem; }
.fila-boton .der small { display: block; color: var(--text-2); font-size: .76rem; }
.fila-fija { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; min-height: 52px; color: var(--text-2); }
.fila-fija b { font-weight: 500; font-size: .92rem; color: var(--text); }
.fila-fija small { display: block; font-size: .78rem; }
.fila-fija .mono { white-space: nowrap; }

.chip {
  flex: none; align-self: center; margin-right: 10px; border: 0; border-radius: 999px; padding: 6px 10px;
  font-size: .76rem; font-weight: 700; min-height: 32px; min-width: 84px;
}
.chip.ok { background: color-mix(in srgb, var(--verde) 18%, var(--surface)); color: var(--verde-texto); }
.chip.pend { background: var(--pendiente-fondo); color: var(--pendiente); }
.marca {
  display: inline-block; font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-left: 6px;
  vertical-align: 1px; letter-spacing: .02em; font-family: 'Inter', sans-serif;
}
.marca.est { background: color-mix(in srgb, var(--dorado-dato) 22%, var(--surface)); color: var(--pendiente); }
.marca.dato { background: color-mix(in srgb, var(--verde) 16%, var(--surface)); color: var(--verde-texto); }
.marca.fac { background: var(--surface-1); color: var(--text-2); }

.historial { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; font-size: .88rem; }
.historial li { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.historial time { color: var(--text-2); font-size: .78rem; white-space: nowrap; font-family: 'JetBrains Mono', monospace; padding-top: 1px; }

.aviso-caja { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--pendiente-fondo); color: var(--pendiente); font-size: .88rem; }
.aviso-caja b { font-weight: 700; }

/* ---------- formularios ---------- */
.campo { display: grid; gap: 6px; margin-top: 12px; }
.campo > span { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.campo input, .campo select, .campo textarea {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg); padding: 10px 12px; font-size: 1rem;
}
.campo textarea { min-height: 72px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--verde); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde) 25%, transparent); }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 44px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--verde); }
.pista-campo { font-size: .78rem; color: var(--text-2); }

.fila-ajuste { display: grid; grid-template-columns: 1fr 108px; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.fila-ajuste:first-of-type { border-top: 0; }
.fila-ajuste label { font-size: .92rem; }
.fila-ajuste label small { display: block; color: var(--text-2); font-size: .78rem; }
.fila-ajuste input { width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); padding: 8px 10px; text-align: right; font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.fila-carta { display: grid; grid-template-columns: 1fr 84px 70px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border); }
.fila-carta:first-of-type { border-top: 0; }
.fila-carta input { width: 100%; min-height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); padding: 6px 8px; text-align: right; font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.cab-carta { display: grid; grid-template-columns: 1fr 84px 70px; gap: 8px; font-size: .74rem; color: var(--text-2); margin-top: 12px; text-align: right; }
.cab-carta span:first-child { text-align: left; }
.fila-mix { display: grid; grid-template-columns: 1fr 64px; gap: 4px 10px; align-items: center; padding: 6px 0; }
.fila-mix label { font-size: .9rem; }
.fila-mix output { text-align: right; font-size: .95rem; }
.fila-mix input { grid-column: 1 / -1; height: 30px; }

.tabla-calc { width: 100%; border-collapse: collapse; font-size: .86rem; margin-top: 12px; }
.tabla-calc th, .tabla-calc td { padding: 8px 4px; border-top: 1px solid var(--border); text-align: right; white-space: nowrap; }
.tabla-calc th:first-child, .tabla-calc td:first-child { text-align: left; white-space: normal; }
.tabla-calc thead th { border-top: 0; color: var(--text-2); font-weight: 600; font-size: .76rem; }
.tabla-calc td { font-family: 'JetBrains Mono', monospace; font-weight: 500; }
.tabla-calc td:first-child { font-family: 'Inter', sans-serif; }
.pasos { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 10px; font-size: .92rem; }
.pasos b { font-family: 'JetBrains Mono', monospace; }

.barra-guardar {
  position: sticky; bottom: calc(var(--nav-alto) + env(safe-area-inset-bottom) + 10px); z-index: 4;
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--verde-profundo); color: var(--crema); padding: 10px 10px 10px 16px; border-radius: 14px; box-shadow: var(--sombra);
}
.barra-guardar p { font-size: .88rem; }
.barra-guardar .boton { min-height: 42px; }
.barra-guardar .boton.primario { background: var(--verde-cifra); color: #0B2419; border-color: var(--verde-cifra); }
@media (min-width: 900px) { .barra-guardar { bottom: 16px; } }

/* ---------- hoja (diálogo) ---------- */
dialog.hoja {
  width: min(560px, 100%); max-width: 100%; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .3);
}
dialog.hoja[open] { animation: sube .28s var(--ease-out); }
dialog.hoja::backdrop { background: rgba(20, 17, 12, .45); animation: aparece .2s ease-out; }
@media (min-width: 640px) { dialog.hoja { margin: auto; border-radius: 20px; } }
.hoja-form { padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.hoja-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 4px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.hoja-cab h2 { font-size: 1.15rem; }
.cerrar { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-1); font-size: 1.3rem; line-height: 1; }
.hoja-pie { display: flex; gap: 10px; justify-content: space-between; margin-top: 20px; }
.hoja-pie .primario { flex: 1; }
.hoja .error { color: var(--rojo-texto); font-size: .88rem; margin-top: 10px; min-height: 1.2em; }

/* ---------- aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-alto) + env(safe-area-inset-bottom) + 14px); z-index: 20;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem; font-weight: 500;
  box-shadow: var(--sombra); transition: opacity .2s, transform .25s var(--ease-out); max-width: calc(100% - 32px);
}
.toast.ver { opacity: 1; transform: translate(-50%, 0); }
.toast.mal { background: var(--rojo); color: #fff; }

/* ---------- entrada de los números (norma del portal: crecen desde su base, sin rebote) ---------- */
@keyframes crece-ancho { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sube { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.crece-ancho { transform-origin: left center; animation: crece-ancho .6s var(--ease-out) both; }
.entra { animation: entra .35s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- lo que deja cada consumición ---------- */
.lista-deja { list-style: none; margin: 12px 0 0; padding: 0; display: grid; }
.lista-deja li { padding: 11px 0; border-top: 1px solid var(--border); display: grid; gap: 3px; }
.lista-deja li:first-child { border-top: 0; }
.ld-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ld-cab b { font-weight: 600; }
.ld-num { font-size: .86rem; color: var(--text); }
.ld-num b { font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.ld-des { font-size: .78rem; color: var(--text-2); }
.barra-guardar[hidden] { display: none; }
