/* Modo noche (por defecto) y modo día. Lo elige cada dispositivo con el ícono al pie del menú.
   La barra lateral usa --top, que es igual en ambos modos. */
:root {
  --brand: #ec3e02;
  --brand-text: #ffffff;
  --top: #0f0d0c;
  --top-text: #fafaf9;
  --radius: 14px;
}

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171412;
  --surface: #231f1c;
  --surface-2: #2b2623;
  --text: #f5f5f4;
  --muted: #a8a29e;
  --line: #3a3430;
  --ok: #4ade80;
  --ok-bg: #14321f;
  --warn: #fbbf24;
  --warn-bg: #3a2e0d;
  --bad: #f87171;
  --bad-bg: #401a1a;
  --info: #93c5fd;
  --info-bg: #1a2a4a;
  --toast-bad: #b91c1c;
  --shadow: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f6f5;
  --text: #1c1917;
  --muted: #6b645f;
  --line: #e4e1de;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --toast-bad: #b91c1c;
  --shadow: 0 1px 3px rgba(28, 25, 23, 0.08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1 { font-size: 1.5rem; line-height: 1.2; margin: 0; }
h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.boot, .empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty .btn { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.cap::first-letter { text-transform: uppercase; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cols { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.cols.three { grid-template-columns: 1fr 1fr 1fr; }

/* ---------- marco ---------- */

/* Menú lateral fijo en pantallas anchas; en celular y tablet vertical se abre con el botón ☰. */
.side {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 15; width: 248px;
  display: flex; flex-direction: column; gap: 20px; overflow-y: auto;
  padding: 18px 12px; padding-top: calc(18px + env(safe-area-inset-top));
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  background: var(--top); color: var(--top-text);
}
.brand { display: block; padding: 0 8px; }
.brand img { display: block; height: 40px; width: auto; aspect-ratio: 1286 / 380; }
.nav { display: flex; flex-direction: column; gap: 18px; flex: 1; }
.nav-title {
  padding: 0 8px 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: rgba(250, 250, 249, 0.5);
}
/* Cada módulo del menú se pliega tocando su título: el módulo va grande y en negritas; sus opciones,
   más chicas y sin negritas, para distinguirlos. */
.nav-section > summary.nav-module {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px;
  padding: 6px 8px; border-radius: 10px; cursor: pointer; list-style: none;
}
.nav-module strong { display: block; font-size: 1.25rem; font-weight: 800; line-height: 1.2; color: var(--top-text); }
.nav-section > summary::-webkit-details-marker { display: none; }
.nav-section + .nav-section { padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.nav-section > summary::after { content: "▾"; font-size: 0.9rem; color: rgba(250, 250, 249, 0.5); }
.nav-section:not([open]) > summary::after { content: "▸"; }
.nav-section > summary:hover { background: rgba(255, 255, 255, 0.08); }
.nav-group summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 40px;
  padding: 0 8px; border-radius: 10px; font-size: 0.95rem; font-weight: 600; cursor: pointer; list-style: none;
}
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: "▾"; color: rgba(250, 250, 249, 0.5); }
.nav-group:not([open]) summary::after { content: "▸"; }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-links a {
  display: flex; align-items: center; min-height: 38px; padding: 0 10px; border-radius: 10px;
  font-size: 0.92rem; font-weight: 400; color: rgba(250, 250, 249, 0.72);
}
.nav-links a:hover, .nav-group summary:hover { background: rgba(255, 255, 255, 0.08); }
.nav-links a.active { background: var(--brand); color: var(--brand-text); }
.nav-badge { margin-left: auto; }
.side-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.side .branch {
  display: block; width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 10px; border: 0;
  background: rgba(255, 255, 255, 0.12); color: var(--top-text); font-weight: 600;
}
.side .branch option { color: #1c1917; }
.who { display: flex; align-items: center; gap: 10px; padding: 0 4px; min-width: 0; }
.who .small { color: rgba(250, 250, 249, 0.6); }
.side-foot .btn { color: var(--top-text); border-color: rgba(255, 255, 255, 0.25); }
.side-actions { display: flex; gap: 8px; }
.side-actions .btn:first-child { flex: 1; }
.theme-btn { width: 40px; min-height: 36px; padding: 0; flex: none; }
.theme-btn svg { display: block; width: 18px; height: 18px; }
.side, .topbar { color-scheme: dark; }

.topbar, .scrim { display: none; }
.content { margin-left: 248px; }
.menu-btn {
  width: 44px; height: 44px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, 0.12);
  color: var(--top-text); font-size: 1.3rem; cursor: pointer;
}

@media (max-width: 899px) {
  .topbar {
    position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px;
    padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top));
    background: var(--top); color: var(--top-text);
  }
  .topbar .brand img { height: 30px; }
  .content { margin-left: 0; }
  .side { width: min(280px, 84vw); transform: translateX(-100%); transition: transform 0.2s ease; }
  .menu-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.5); }
  .menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 14; background: rgba(0, 0, 0, 0.5); }
}
@media (min-width: 900px) {
  .content .footer { left: 248px; }
}

main { max-width: 860px; margin: 0 auto; padding: 16px 16px 120px; }

/* ---------- piezas ---------- */

.card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.card.stack, .card.row { display: flex; }
button.card, a.card { cursor: pointer; }
button.card:active, a.card:active { background: var(--surface-2); }
.card.off { opacity: 0.55; }
.card > input { flex: 1; min-width: 160px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600; white-space: nowrap;
}
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.9rem; border-radius: 10px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: default; }
.link { background: none; border: 0; padding: 4px 0; color: var(--brand); font-weight: 600; cursor: pointer; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700;
  background: var(--line); color: var(--muted); white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }

.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ok); border-radius: 999px; transition: width 0.2s; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field .label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
}
textarea { resize: vertical; min-height: 0; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--brand); flex: none; }
input[type="date"] { width: auto; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.ticks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.tick { display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }

.avatar {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--brand); color: var(--brand-text); font-weight: 700;
}

.banner { padding: 10px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info); font-size: 0.9rem; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- acceso ---------- */

/* La foto (1080x1350) nunca se recorta ni se estira: en pantallas angostas ocupa el ancho
   completo arriba y el acceso se encima sobre su parte baja; en pantallas anchas va entera a
   la izquierda, a su proporcion, sin pasar de su tamano real. */
/* El fondo detras de la tarjeta de acceso es el naranja del logo. */
.entry { --entry-bg: #ec3e02; position: relative; min-height: 100vh; min-height: 100dvh; background: var(--entry-bg); }
.entry-photo { position: absolute; top: 0; left: 0; right: 0; }
.entry-photo img { display: block; width: 100%; height: auto; }
.entry-photo::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 45%;
  background: linear-gradient(transparent, var(--entry-bg));
}
.entry-panel { position: relative; max-width: 472px; margin: 0 auto; padding: 56vw 16px 32px; }
.entry-card { padding: 20px; gap: 16px; border-color: transparent; box-shadow: 0 12px 40px rgba(60, 14, 0, 0.35); }
.entry-intro { text-align: center; }
.entry-card .empty { padding: 16px; }
.logo { display: block; width: min(240px, 72%); height: auto; aspect-ratio: 1286 / 380; margin: 4px auto; }
.entry h2 { font-size: 1.1rem; text-transform: none; letter-spacing: 0; color: var(--text); }

@media (min-width: 800px) and (min-aspect-ratio: 1/1) {
  .entry { display: grid; grid-template-columns: auto minmax(380px, 1fr); align-items: center; }
  .entry-photo { position: sticky; height: 100vh; display: grid; place-items: center; background: #0b0a09; }
  .entry-photo img { width: auto; height: min(100vh, 1350px); max-width: calc(100vw - 380px); object-fit: contain; }
  .entry-photo::after { display: none; }
  .entry-panel { width: 100%; padding: 32px 24px; }
}
.tiles { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; min-height: 72px;
  justify-content: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  font-weight: 600; cursor: pointer;
}
.tile:active { border-color: var(--brand); }
.pin { text-align: center; font-size: 1.6rem; letter-spacing: 0.4em; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.key {
  min-height: 60px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 1.3rem; font-weight: 600; cursor: pointer;
}
.key:active { background: var(--line); }
.key.soft { font-size: 0.95rem; color: var(--muted); }
.key.go { font-size: 1rem; background: var(--brand); border-color: var(--brand); color: var(--brand-text); }

/* ---------- checklists ---------- */

.run { display: flex; flex-direction: column; gap: 8px; position: relative; cursor: pointer; }
.run:active { background: var(--surface-2); }
.run-title { display: flex; align-items: center; gap: 8px; }
.run-title .stretch { font-weight: 700; }
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.help-btn {
  position: relative; z-index: 1; flex: none; width: 30px; height: 30px; padding: 0; border-radius: 50%;
  border: 2px solid var(--brand); background: transparent; color: var(--brand);
  font-weight: 800; font-size: 1rem; line-height: 1; cursor: pointer;
}
.help-btn:hover { background: var(--brand); color: var(--brand-text); }
.overlay.help { cursor: default; align-items: end; background: rgba(0, 0, 0, 0.6); }
.sheet {
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
  padding: 18px; border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.help-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.help-media { display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: #000; flex: none; }
button.help-media { cursor: zoom-in; }
.help-media img { display: block; width: 100%; height: auto; }
video.help-media { max-height: 70vh; }
.media-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.media-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.media-tile > video, .media-tile > button:first-child {
  display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; background: #000; cursor: zoom-in;
}
.media-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-tile > video { object-fit: contain; cursor: default; }
@media (min-width: 600px) { .overlay.help { align-items: center; } }
.run-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card.start { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-style: dashed; }

.items { display: flex; flex-direction: column; padding: 6px 14px; }
.items h2 { padding: 10px 0 2px; }
.item { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.items h2 + .item, .items .item:first-child { border-top: 0; }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.item-title { font-weight: 600; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tpl { position: relative; }
.tpl .stretch { font-weight: 700; color: inherit; text-decoration: none; }
.tpl .btn { position: relative; z-index: 1; }
select.mini { width: auto; min-height: 36px; padding: 0 28px 0 10px; font-size: 0.85rem; border-radius: 10px; }
/* La matriz usa todo el ancho libre junto a la barra lateral. */
main:has(.matrix-wrap) { max-width: none; }
.matrix-wrap { padding: 0; overflow-x: auto; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; }
.matrix th, .matrix td { padding: 10px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; font-weight: 400; }
.matrix thead th { vertical-align: bottom; min-width: 120px; font-weight: 700; }
.matrix thead select.mini { margin-top: 6px; }
.matrix .first { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; min-width: 170px; max-width: 220px; border-right: 1px solid var(--line); }
.matrix tbody .first a { font-weight: 700; color: inherit; text-decoration: none; display: block; }
.matrix tbody .first select.mini { margin-top: 6px; max-width: 100%; }
.matrix tr.group th, .matrix tr.group td { background: var(--surface-2); padding: 6px 10px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.matrix tbody tr:last-child th, .matrix tbody tr:last-child td { border-bottom: 0; }
.cell { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: transparent; color: var(--brand-text); font-size: 1.2rem; font-weight: 800; cursor: pointer; }
.cell.on { background: var(--brand); border-color: var(--brand); }
.cell:disabled { opacity: 0.6; cursor: wait; }
.area-head { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 0.95rem; padding-top: 6px; }
.area-head .small { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.area-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: none; }
.steps summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 6px 0; }
.steps[open] summary { margin-bottom: 8px; }
.item.done .item-title { color: var(--muted); }

.box {
  flex: none; width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--surface-2); font-size: 1.4rem; font-weight: 700; color: var(--brand-text);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.box.ghost { width: 28px; height: 28px; border-radius: 50%; font-size: 0.9rem; margin: 8px; cursor: default; }
.box:disabled { cursor: default; }
.item.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.item.alert .box { background: var(--warn); border-color: var(--warn); color: #fff; }

.num-row { display: flex; align-items: center; gap: 8px; }
.num { width: 120px; font-size: 1.15rem; font-weight: 600; text-align: right; }
.item.alert .num { border-color: var(--bad); color: var(--bad); }
.unit { color: var(--muted); font-weight: 600; }
.warn-text { color: var(--bad); font-size: 0.9rem; font-weight: 600; }
.note { font-size: 0.95rem; }
.meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--muted); min-height: 20px; }

.photo { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.thumb { width: 64px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.88); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.overlay img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.overlay.zoom { z-index: 25; }

.footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; gap: 12px; justify-content: flex-end;
  padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.footer-progress { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.footer > .muted { flex: 1; }
.review { border-color: var(--info); }

/* ---------- panel ---------- */

.pct { font-size: 1.6rem; font-weight: 800; }
.pct.ok { color: var(--ok); }
.pct.warn { color: var(--warn); }
.pct.bad { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; }
.stat { display: flex; flex-direction: column; padding: 6px 2px; border-radius: 10px; background: var(--surface-2); }
/* Tarjetas que filtran (Tablero de compras). */
button.stat { border: 1px solid transparent; cursor: pointer; font: inherit; color: inherit; }
.stat.active { border-color: var(--brand); }
.stat b { font-size: 1.1rem; }
.stat span { font-size: 0.68rem; color: var(--muted); }
.stat.bad b { color: var(--bad); }
.stat.warn b { color: var(--warn); }
.stat.info b { color: var(--info); }
.trend { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.trend a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); border-radius: 8px; padding: 2px; }
.trend a.current { background: var(--surface-2); color: var(--text); font-weight: 700; }
.trend-bar { height: 44px; width: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.trend-bar i { display: block; width: 100%; border-radius: 6px 6px 0 0; background: var(--ok); }
.trend-bar i.warn { background: var(--warn); }
.trend-bar i.bad { background: var(--bad); }
.alert-row { border-left: 4px solid var(--warn); }

/* ---------- avisos ---------- */

#toasts { position: fixed; left: 0; right: 0; top: calc(12px + env(safe-area-inset-top)); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { padding: 10px 16px; border-radius: 12px; font-weight: 600; background: var(--toast-bad); color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); max-width: 480px; }
.toast.ok { background: #15803d; }
.toast.warn { background: #a16207; }

@media (max-width: 480px) {
  .cols.three { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.3rem; }
}

/* ---------- administración ---------- */
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.big { font-size: 1.35rem; }
.money.neg { color: var(--bad); }
.fin-view { min-width: 160px; }
.branch-fin { display: grid; gap: 8px 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.branch-fin .field:last-child:nth-child(4) { grid-column: 1 / -1; }
.code-input { text-transform: uppercase; }
input.swatch { padding: 2px; height: 44px; cursor: pointer; }
.cat-subs { display: flex; flex-direction: column; }
.cat-sub { padding: 8px 0; border-top: 1px solid var(--line); gap: 8px; }
.cat-sub:first-child { border-top: 0; }
.cat-sub.off { opacity: 0.5; }
.cat-sub .chip { margin-left: 6px; }
.cat-add input { flex: 1 1 180px; }
.left { text-align: left; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tabs a { flex: none; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 0.85rem; white-space: nowrap; }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: var(--brand-text); }
a.card.flow { color: inherit; text-decoration: none; }
.seg { display: flex; gap: 6px; }
.seg .btn { flex: 1; }
.right { text-align: right; }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
.left-chips { justify-content: flex-start; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.banner { background: var(--info-bg); color: var(--info); border-color: transparent; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.mini-input { width: auto; min-height: 36px; }
.part { padding: 10px; background: var(--surface-2); }
.mov .chip { margin-left: 4px; }
.warn-text { color: var(--warn); }
.period { gap: 6px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.er { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.er th, table.er td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.er th { font-size: 0.75rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.er .num { text-align: right; white-space: nowrap; }
table.er td:first-child { min-width: 150px; }
table.er.wide td:first-child, table.er.wide th:first-child { position: sticky; left: 0; background: var(--surface); min-width: 170px; }
table.er tr.sec td { font-size: 0.75rem; letter-spacing: 0.06em; color: var(--muted); padding-top: 14px; font-weight: 600; }
table.er tr.concept td:first-child { font-weight: 600; }
table.er tr.sub td { color: var(--muted); }
table.er tr.group td:first-child { font-style: italic; }
table.er .in1 { padding-left: 24px; }
table.er .in2 { padding-left: 40px; }
table.er tr.total td { font-weight: 700; background: var(--surface-2); }
table.er tr.subtotal td { font-weight: 800; }
table.er tr.clickable { cursor: pointer; }
table.er tr.clickable:hover td { background: var(--surface-2); }
table.er td.read { font-size: 0.8rem; min-width: 220px; }
table.er .chip { margin-left: 6px; }
.money.strong { font-weight: 800; }
.stages { display: flex; gap: 4px; flex-wrap: wrap; }
.stage { flex: 1 1 110px; text-align: center; padding: 6px 8px; border-radius: 999px; font-size: 0.78rem; background: var(--surface-2); color: var(--muted); }
.stage.done { background: var(--ok-bg); color: var(--ok); }
.stage.now { background: var(--brand); color: var(--brand-text); font-weight: 700; }
.rdo-sec > summary { cursor: pointer; font-weight: 700; padding: 2px 0 10px; }
.rdo-sec:not([open]) > summary { padding-bottom: 0; }
a.rdo-card { color: inherit; text-decoration: none; }
.denoms { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.denom { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--muted); }
.grow { flex: 1 1 180px; }
.amount-input { width: 120px; flex: 0 0 120px; }
.rdo-actions { position: sticky; bottom: 0; padding: 10px 0; background: var(--bg); border-top: 1px solid var(--line); }
.stats.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 520px) { .stats.four { grid-template-columns: repeat(2, 1fr); } }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
a.report-card { color: inherit; text-decoration: none; }
a.report-card:hover { border-color: var(--brand); }
table.er tr.alert-row td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.budget-line { padding: 4px 0; border-bottom: 1px solid var(--line); }
.update-banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30; display: flex; gap: 12px; align-items: center;
  padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--brand); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }

/* ---------- captura del corte: montos en una columna fija, alineados a la derecha ---------- */
.rdo-sec > summary { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.9rem; }
.hint { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.hint.italic { font-style: italic; }
.num-in { text-align: right; font-variant-numeric: tabular-nums; }
.cap { display: flex; flex-direction: column; }
.cap-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cap-row:last-child { border-bottom: 0; }
.cap-row.cap-head { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cap-row.cap-group .cap-label { font-weight: 600; }
.cap-row.sub .cap-label { padding-left: 24px; color: var(--muted); }
.cap-row.line { border-bottom: 0; padding: 4px 0; }
.cap-label { font-weight: 600; min-width: 0; }
.cap-row.sub .cap-label { font-weight: 400; }
.cap-value { text-align: right; }
.cap-sub { font-size: 0.68rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
/* Cantidad capturada en la columna derecha (foodtruck): casilla angosta + unidad. */
.qty-in { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.qty-in input { width: 96px; min-width: 0; min-height: 36px; text-align: right; }
table.er input.mini-input { width: 80px; text-align: right; }
.cap-value .money { font-size: 1rem; }
.cap-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.equation { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: flex-end; align-items: baseline; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.equation .money { font-size: 1.15rem; color: var(--text); margin-left: 6px; text-transform: none; }
.cap-pair { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.cap-pair.tips { grid-template-columns: repeat(auto-fit, minmax(160px, 220px)); align-items: end; }
.tips-diff { min-height: 44px; display: flex; align-items: center; }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 0 6px; }
.link-btn:hover { color: var(--bad); }
.subcard { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.fondo-head { gap: 12px; align-items: center; }
.fondo-input { width: 160px; }
.fondo-stats { gap: 6px 22px; font-size: 0.85rem; padding-top: 8px; }
.fondo-stats .muted { text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.04em; }
.denom-grid { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: 24px; align-items: start; margin-top: 8px; }
@media (max-width: 720px) { .denom-grid { grid-template-columns: 1fr; } }
table.cap-denoms { width: 100%; border-collapse: collapse; }
table.cap-denoms th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); text-align: left; padding: 4px 6px; }
table.cap-denoms td { padding: 4px 6px; border-top: 1px solid var(--line); }
table.cap-denoms .num { text-align: right; }
table.cap-denoms input.qty { width: 110px; min-height: 38px; }
table.cap-denoms tfoot td { font-weight: 700; }
.denom-side .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.big-total .money { font-size: 1.8rem; font-weight: 800; }
.denom-side .chip { align-self: flex-start; }
table.er.cuadre td.cont { width: 140px; }
table.er.cuadre td.cont input { width: 124px; min-height: 38px; }
table.er.cuadre .money.strong { font-weight: 800; }
.stat.kpi { text-align: left; padding: 10px 12px; }
.stat.kpi b { font-size: 1.25rem; }
.stat.kpi span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.kpis { gap: 10px; }
@media (max-width: 560px) { .cap-row { grid-template-columns: minmax(0, 1fr) 130px; } .stats.kpis { grid-template-columns: repeat(2, 1fr); } }
.cap-row.cap-total { border-bottom: 0; padding-top: 10px; }
.cap-row.cap-total .cap-label { font-weight: 400; }
.cap-value .equation { display: inline-flex; gap: 8px; }
.stack.tight { gap: 4px; }
.cap.top-line { border-top: 1px solid var(--line); padding-top: 4px; }
.fondo-stats { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.cap-label .hint { font-weight: 400; }
.cap-value .equation { flex-wrap: wrap; justify-content: flex-end; }
table.er.cuadre td { vertical-align: middle; }
table.er.cuadre td:first-child { min-width: 170px; }
table.er.cuadre td:first-child .muted { max-width: 260px; }
table.er.cuadre th, table.er.cuadre td { padding-left: 8px; padding-right: 8px; }
.cap-row.line .row { flex-wrap: nowrap; }
.cap-row.line .row select, .cap-row.line .row input { flex: 1 1 auto; width: auto; min-width: 0; }
/* Renglones con título y explicación: la casilla va a la altura del título, igual en todos. */
.cap-row.top { align-items: start; }
.cap-row.top .cap-label > .stack > span:first-child { min-height: 46px; display: flex; align-items: center; }
.abono-head { padding: 8px 0 4px; }

/* ---------- CEDIS ---------- */
.banner.warn { background: var(--warn-bg); color: var(--warn); }
a.card.banner { text-decoration: none; }
.cap-row.cedis-link { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.cap-row.cedis-link:last-child { border-bottom: 0; }
.cap-row.cedis-link:active { background: var(--surface-2); }
.cap-row.cedis-link.off { opacity: 0.55; }
.cap-row input.qty { width: 110px; text-align: right; }
.cap-row.line .row input[inputmode="decimal"] { min-width: 0; }
.cedis-line .row select, .cedis-line .row input { flex: 1 1 auto; width: auto; min-width: 0; }
.cedis-line .cap-label.stack { gap: 6px; }
@media (max-width: 560px) { .cap-row.cedis-line { grid-template-columns: minmax(0, 1fr) 84px; } }
details.cedis-price > summary { list-style: none; cursor: pointer; }
details.cedis-price > summary::-webkit-details-marker { display: none; }
details.cedis-price[open] > summary { border-bottom-style: dashed; }
.tile.cedis-tile { border-style: dashed; }
/* Qué ve cada persona de cada módulo (Equipo). */
.perm-grid { display: grid; gap: 0; }
.perm-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.perm-row:first-child { border-top: 0; }
.perm-row strong { font-size: 0.9rem; }
@media (max-width: 560px) { .perm-row { grid-template-columns: 1fr; } }
/* Requerimiento semanal: producto · existencia · requerimiento (dos columnas a la derecha). */
.cap-row.req-row { grid-template-columns: minmax(0, 1fr) 130px 140px; }
.cap-row.req-row input.qty { width: 100%; flex: 1; }
.cap-row.req-row > :not(:first-child) { text-align: right; }
.cap-row.req-row .qty-in { gap: 4px; }
.cap-row.req-row .unit { flex: none; min-width: 26px; text-align: left; font-size: 0.8rem; color: var(--muted); }
@media (max-width: 560px) { .cap-row.req-row { grid-template-columns: minmax(0, 1fr) 88px 94px; gap: 8px; } .cap-row.req-row .unit { min-width: 22px; } }
.center { text-align: center; }


/* Mantenimiento: semáforo de urgencia en el borde de cada reporte y en los botones elegidos. */
.maint { border-left: 4px solid var(--line); }
.maint-rojo { border-left-color: var(--bad); }
.maint-amarillo { border-left-color: var(--warn); }
.maint-verde { border-left-color: var(--ok); }
.choice .btn.primary.choice-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.choice .btn.primary.choice-warn { background: var(--warn); border-color: var(--warn); color: #1c1917; }
.choice .btn.primary.choice-ok { background: var(--ok); border-color: var(--ok); color: #1c1917; }

/* Compras por recoger: cada renglón del checklist con su casilla grande y la cantidad a un lado. */
.pick-line { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pick-line .tick { flex: 1; min-height: 40px; }
.pick-line .mini-input { width: 120px; }

/* Carga de gas: borde con el semáforo de cada sucursal. */
.gas { border-left: 4px solid var(--line); }
.gas-ok { border-left-color: var(--ok); }
.gas-warn { border-left-color: var(--warn); }
.gas-bad { border-left-color: var(--bad); }
/* Cambio de aceite: misma tarjeta con semáforo que gas; cada freidora en su renglón. */
.oil-fryer { padding: 6px 0; border-top: 1px solid var(--line); }
.oil-hist { padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.oil-hist:last-child { border-bottom: 0; }

/* iPhone acerca la pantalla al tocar un campo con letra menor de 16 px (auditoría UI-02): en pantallas táctiles todos
   los campos van a 16 px como mínimo, también los selectores chicos. */
@media (hover: none) and (pointer: coarse) {
  input, select, textarea, select.mini, .mini-input { font-size: max(16px, 1em); }
}

/* Primeros pasos en una instalación nueva (auditoría UI-05). */
.first-steps ol { margin: 0; padding-left: 1.2rem; display: grid; gap: 6px; }
.first-steps li.done { color: var(--muted); text-decoration: line-through; }
