:root {
  --bg: #F4F5F2; --card: #FFFFFF; --ink: #16181D; --ink2: #3D4149; --muted: #555A63; --line: #E2E4DF;
  --accent: #0E5E46; --accent-ink: #FFFFFF; --accent-soft: #DCEDE5; --bar: #B9D8CB;
  --warn: #9A3D09; --warn-bg: #FDEBDD; --warn-dot: #B4470B;
  --info: #1D4ED8; --info-bg: #E3EEFB; --gray-bg: #EFEFEA;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111412; --card: #1A1E1C; --ink: #EEF0EC; --ink2: #CDD1CB; --muted: #A3A9A4; --line: #2C322F;
    --accent: #3FA67F; --accent-ink: #08130E; --accent-soft: #1D3A2F; --bar: #2F5F4C;
    --warn: #F3A26B; --warn-bg: #3A2215; --warn-dot: #E07B3C;
    --info: #8DB1FF; --info-bg: #1B2740; --gray-bg: #242926;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body, p { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
[hidden] { display: none !important; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.vista { flex: 1; padding: calc(16px + env(safe-area-inset-top)) 16px 96px; display: flex; flex-direction: column; gap: 16px; }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cabecera .sub { font-size: 13px; color: var(--muted); }
.sub { color: var(--muted); font-size: 13px; }

.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 22px; background: var(--card); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink); cursor: pointer; flex-shrink: 0;
}
.badge-num {
  position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--warn-dot); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.volver { width: 44px; height: 44px; margin-left: -10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.hero { background: var(--accent); color: var(--accent-ink); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.hero .monto { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.hero .suave { font-size: 13px; opacity: .85; }
.barra { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; background: rgba(255,255,255,.2); }
.barra span:nth-child(1) { background: var(--accent-ink); }
.barra span:nth-child(2) { background: #9FD3BF; }
.barra span:nth-child(3) { background: #F6B27A; }
.tres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 12px; }
.tres b { display: block; font-size: 14px; }

.fila {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  display: flex; gap: 12px; align-items: center; color: var(--ink); min-height: 60px;
}
.fila .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.fila .t1 { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila .t2 { font-size: 12px; color: var(--muted); }
.fila .monto { font-size: 14px; font-weight: 600; white-space: nowrap; }
.ico { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--gray-bg); color: var(--ink2); }
.ico.warn, .t2.warn { color: var(--warn); } .ico.warn { background: var(--warn-bg); }
.ico.info, .t2.info { color: var(--info); } .ico.info { background: var(--info-bg); }
.ico.ok { background: var(--accent-soft); color: var(--accent); }
.lista { display: flex; flex-direction: column; gap: 8px; }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--gray-bg); color: var(--ink2); white-space: nowrap; }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.ok { background: var(--accent-soft); color: var(--accent); }

.caja { display: flex; align-items: flex-end; gap: 10px; height: 96px; }
.caja > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.caja .v { font-size: 10px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.caja .b { width: 100%; border-radius: 6px 6px 2px 2px; background: var(--bar); min-height: 2px; }
.caja > div:first-child .b { background: var(--accent); }
.caja-et { display: flex; gap: 10px; } .caja-et span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }

.acciones { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.btn {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font-weight: 600; font-size: 14px; padding: 10px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.chico { min-height: 36px; padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn.grande { min-height: 64px; flex-direction: column; font-size: 12px; gap: 4px; }
.btn:disabled { opacity: .55; cursor: default; }

.timeline { display: flex; flex-direction: column; }
.paso { display: flex; gap: 12px; }
.paso .eje { display: flex; flex-direction: column; align-items: center; width: 14px; }
.paso .punto { width: 12px; height: 12px; border-radius: 6px; margin-top: 4px; flex-shrink: 0; background: var(--accent); }
.paso .punto.ahora { background: var(--warn-dot); box-shadow: 0 0 0 4px var(--warn-bg); }
.paso .punto.prox { background: var(--card); border: 2px solid var(--muted); }
.paso .punto.omit { background: var(--muted); }
.paso .linea { flex: 1; width: 2px; background: var(--line); }
.paso:last-child .linea { visibility: hidden; }
.paso .cuerpo { flex: 1; padding-bottom: 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.paso .cab { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.paso .cab span:last-child { font-size: 11px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.paso .det { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.factura { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.factura:first-of-type { border-top: 0; padding-top: 0; }
.factura .linea1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.factura .botones { display: flex; gap: 8px; flex-wrap: wrap; }

label.campo { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink2); font-weight: 500; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=search] {
  min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--card); font-size: 16px; width: 100%;
}
input:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.interruptor { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.interruptor input { width: 48px; height: 28px; accent-color: var(--accent); }
details.card summary { cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; display: flex; justify-content: space-between; }
details.card summary::after { content: '+'; color: var(--muted); }
details.card[open] summary::after { content: '–'; }

.aviso-banda { background: var(--info-bg); color: var(--info); border-radius: 12px; padding: 12px 14px; font-size: 13px; }
.aviso-banda.warn { background: var(--warn-bg); color: var(--warn); }
.msg { font-size: 13px; } .msg:empty { display: none; }
.msg.err { color: var(--warn); } .msg.ok { color: var(--accent); }
.vacio { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.grupo { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 -4px; }
.punto-aviso { width: 10px; height: 10px; border-radius: 5px; margin-top: 5px; flex-shrink: 0; background: var(--muted); }
.punto-aviso.warn { background: var(--warn-dot); } .punto-aviso.info { background: var(--info); } .punto-aviso.ok { background: var(--accent); }
.fila.aviso { align-items: flex-start; }
.fila.aviso .t2 { color: var(--ink2); font-size: 13px; }
.fila.no-leido { border-color: var(--accent); }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
nav.tabs .in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
nav.tabs a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; min-height: 48px; font-size: 11px; color: var(--muted); position: relative; }
nav.tabs a.activo { color: var(--accent); font-weight: 600; }
nav.tabs .badge-num { top: 0; right: calc(50% - 22px); }

/* Páginas sueltas (entrar, pagar) */
.pagina { max-width: 520px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.marca img { width: 32px; height: 32px; border-radius: 8px; }
