/* RUES Gimnasios · interfaz
   Paleta: tinta azul marino RUES, superficie fría, acento azul RUES.
   Tipografía: Archivo (eje de anchura) — condensada para cifras y nombres, normal para lectura. */

@font-face { font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-wdth-normal.woff2) format("woff2-variations"), url(fonts/archivo-latin-wdth-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Archivo"; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-ext-wdth-normal.woff2) format("woff2-variations"), url(fonts/archivo-latin-ext-wdth-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  color-scheme: light;
  --ink: #12263a;
  --ink-2: #44566a;
  --ink-3: #6b7b8c;
  --bg: #f3f6f9;
  --panel: #ffffff;
  --sunken: #eaeff4;
  --line: #dce3ea;
  --line-strong: #c4cfda;
  --brand: #0a6fae;
  --brand-hover: #085b8f;
  --brand-soft: #e3f1fa;
  --brand-ink: #ffffff;
  --rail: #12263a;
  --rail-ink: #b9c8d8;
  --rail-active: #ffffff;
  --ok: #13795b;     --ok-soft: #e2f4ec;
  --warn: #a35808;   --warn-soft: #fdf0dc;
  --bad: #b8321a;    --bad-soft: #fbe7e2;
  --muted-soft: #eceff3;
  --chart-a: #1a8fd1;
  --chart-b: #d97a1f;
  --grid: #e6ebf0;
  --shadow: 0 1px 2px rgba(18, 38, 58, .06), 0 8px 24px -12px rgba(18, 38, 58, .18);
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t-fast: 120ms; --t-med: 200ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "tnum" 1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e8eef4; --ink-2: #b2c0cd; --ink-3: #8797a7;
    --bg: #0d1720; --panel: #14212d; --sunken: #0f1b25; --line: #243444; --line-strong: #33475a;
    --brand: #3a9ad8; --brand-hover: #59acdf; --brand-soft: #12324a; --brand-ink: #06121c;
    --rail: #0a131b; --rail-ink: #8fa2b4;
    --ok: #4cc79b; --ok-soft: #10332a; --warn: #e9a14d; --warn-soft: #3a2a12; --bad: #f07c63; --bad-soft: #3d1d17; --muted-soft: #1c2b38;
    --chart-a: #3a9ad8; --chart-b: #c97a28; --grid: #1f2e3c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eef4; --ink-2: #b2c0cd; --ink-3: #8797a7;
  --bg: #0d1720; --panel: #14212d; --sunken: #0f1b25; --line: #243444; --line-strong: #33475a;
  --brand: #3a9ad8; --brand-hover: #59acdf; --brand-soft: #12324a; --brand-ink: #06121c;
  --rail: #0a131b; --rail-ink: #8fa2b4;
  --ok: #4cc79b; --ok-soft: #10332a; --warn: #e9a14d; --warn-soft: #3a2a12; --bad: #f07c63; --bad-soft: #3d1d17; --muted-soft: #1c2b38;
  --chart-a: #3a9ad8; --chart-b: #c97a28; --grid: #1f2e3c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -14px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
code { font-size: .9em; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.ico { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.ico-sm { width: 16px; height: 16px; }
.ico-lg { width: 28px; height: 28px; }
.muted { color: var(--ink-3); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.cond { font-stretch: 78%; }

/* ───────── Shell ───────── */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 20px 14px; overflow-y: auto; }
.rail-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; color: #fff; }
.rail-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; overflow: hidden; flex: none; color: #fff; }
.rail-logo img { width: 100%; height: 100%; object-fit: cover; }
.rail-brand strong { display: block; font-size: 15px; font-stretch: 85%; line-height: 1.2; }
.rail-brand small { color: var(--rail-ink); font-size: 12px; }
.rail-group { margin-top: 14px; }
.rail-group > span { display: block; font-size: 12px; color: #7f93a7; padding: 0 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px; border-radius: 8px; color: var(--rail-ink); font-weight: 500; text-decoration: none; transition: background var(--t-fast), color var(--t-fast); }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-link[aria-current="page"] { background: rgba(58,154,216,.18); color: var(--rail-active); box-shadow: inset 3px 0 0 #3a9ad8; }
.nav-link .count { margin-left: auto; font-size: 12px; background: rgba(233,161,77,.18); color: #f3b56a; border-radius: 99px; padding: 1px 8px; }
.rail-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.rail-user { display: flex; align-items: center; gap: 10px; padding: 8px; }
.rail-user strong { color: #fff; font-size: 14px; display: block; line-height: 1.2; }
.rail-user small { font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 32px 64px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-stretch: 82%; letter-spacing: -.01em; }
.page-head p { color: var(--ink-3); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 14px; margin-bottom: 8px; }

/* ───────── Botones ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background var(--t-fast), border-color var(--t-fast); }
.btn:hover { background: var(--sunken); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--sunken); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 16px; }
.btn-icon { width: 40px; padding: 0; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.btn-group button { border: 0; background: var(--panel); padding: 0 12px; min-height: 36px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.btn-group button + button { border-left: 1px solid var(--line); }
.btn-group button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ───────── Paneles ───────── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; }
.panel-head p { font-size: 13px; color: var(--ink-3); }
.panel-body { padding: 20px; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* Tira de indicadores: un solo bloque con divisiones, la cifra manda. */
.kpis { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.kpi { padding: 18px 20px; border-left: 1px solid var(--line); min-width: 0; color: inherit; text-decoration: none; display: block; }
.kpi:first-child { border-left: 0; }
a.kpi:hover { text-decoration: none; }
.kpi-label { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 34px; font-weight: 700; font-stretch: 72%; line-height: 1.1; margin-top: 6px; letter-spacing: -.01em; }
.kpi-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.kpi-hero .kpi-value { font-size: 44px; }
.kpi .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.kpis-fin { margin-top: 16px; }

/* ───────── Badges de estado ───────── */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--muted-soft); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--brand-soft); color: var(--brand); }
.b-plain::before { display: none; }

/* ───────── Tablas ───────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 13px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
@media (hover: hover) { .table tr.clickable:hover td { background: var(--sunken); } a.kpi:hover { background: var(--sunken); } }
.table tr.void td { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 50%, transparent); }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.amount-in { color: var(--ok); }
.amount-out { color: var(--bad); }

/* Lista de personas (móvil y paneles) */
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-text { min-width: 0; }
.person-text strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-text small { color: var(--ink-3); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; overflow: hidden; font-stretch: 85%; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 88px; height: 88px; font-size: 28px; border-radius: 16px; }
.avatar-xl { width: 132px; height: 132px; font-size: 42px; border-radius: 20px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list > li > .grow { flex: 1; min-width: 0; }
.list a.item { display: flex; align-items: center; gap: 12px; color: inherit; flex: 1; min-width: 0; text-decoration: none; }

/* ───────── Formularios ───────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { font-size: 12px; color: var(--ink-3); }
.field .err { color: var(--bad); font-size: 12px; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--panel); color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 0; border-color: var(--brand); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: 15px; margin-bottom: 12px; padding: 0; }
.input-prefix { position: relative; }
.input-prefix > .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-prefix > input { padding-left: 40px !important; }
.money-input { position: relative; }
.money-input::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.money-input input { padding-left: 26px !important; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { flex: 0 1 180px; }
.filters .field.grow { flex: 1 1 240px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { white-space: nowrap; flex: none; border: 1px solid var(--line-strong); background: var(--panel); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2); min-height: 32px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg label { border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 10px; text-align: center; cursor: pointer; font-weight: 600; font-size: 14px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ───────── Panel lateral (slide-over) ───────── */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(9, 20, 31, .45); z-index: 50; opacity: 0; transition: opacity var(--t-med) var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--panel); z-index: 51; display: flex; flex-direction: column; box-shadow: -20px 0 50px -20px rgba(0,0,0,.35); transform: translateX(24px); opacity: 0; transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease); }
.drawer.open { transform: none; opacity: 1; }
.drawer-backdrop.open { opacity: 1; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; flex: 1; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--panel); }
.drawer-wide { width: min(760px, 100vw); }

/* Resumen de cobro dentro de formularios */
.summary { background: var(--sunken); border-radius: var(--r-sm); padding: 14px 16px; font-size: 14px; }
.summary .line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.summary .total { font-weight: 700; font-size: 18px; border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 8px; }

/* ───────── Avisos ───────── */
.toast-zone { position: fixed; z-index: 80; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; font-size: 14px; pointer-events: auto; animation: toast-in var(--t-med) var(--ease); }
.toast.error { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.notice { padding: 12px 16px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 16px; background: var(--brand-soft); color: var(--ink); }
.notice-error { background: var(--bad-soft); color: var(--bad); }
.notice-ok { background: var(--ok-soft); color: var(--ok); }
.notice-warn { background: var(--warn-soft); color: var(--warn); }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .ico { width: 36px; height: 36px; color: var(--line-strong); margin-bottom: 10px; }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.skeleton { background: var(--line); animation: sk 1.1s ease-in-out infinite alternate; border-radius: 6px; height: 16px; }
@keyframes sk { from { opacity: .45; } to { opacity: 1; } }
.loading-page { display: grid; gap: 14px; }

/* ───────── Gráfica ───────── */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-3); font-size: 12px; }
.chart .bar-a { fill: var(--chart-a); }
.chart .bar-b { fill: var(--chart-b); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + g rect, .chart g.col:hover rect.bar { opacity: 1; }
.chart g.col:hover .hover-bg { fill: var(--sunken); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 13px; padding: 8px 10px; border-radius: 6px; box-shadow: var(--shadow); white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); z-index: 5; }
.tooltip b { display: block; margin-bottom: 2px; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 80px; }
.mini-bars span { flex: 1; background: var(--chart-a); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.mini-axis { display: flex; gap: 3px; font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.mini-axis span { flex: 1; text-align: center; }

/* ───────── Acceso (recepción) ───────── */
.access { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
.access-search { padding: 24px; }
.access-search .big-input input { min-height: 60px; font-size: 20px; padding-left: 48px !important; }
.access-search .big-input .ico { width: 24px; height: 24px; left: 14px; }
.access-hint { font-size: 13px; color: var(--ink-3); margin-top: 10px; }
.results { margin-top: 12px; }
.result-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; }
.result-btn:hover, .result-btn:focus-visible { background: var(--sunken); }
.verdict { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--panel); min-height: 380px; display: flex; flex-direction: column; }
.verdict-band { padding: 18px 24px; display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; font-stretch: 75%; letter-spacing: .01em; color: #fff; }
.verdict-band .ico { width: 30px; height: 30px; }
.v-ok .verdict-band { background: var(--ok); }
.v-warn .verdict-band { background: var(--warn); }
.v-bad .verdict-band { background: var(--bad); }
.v-idle .verdict-band { background: var(--sunken); color: var(--ink-3); }
.verdict-body { padding: 24px; display: flex; gap: 22px; align-items: flex-start; flex: 1; }
.verdict-name { font-size: 40px; font-weight: 800; font-stretch: 70%; line-height: 1; letter-spacing: -.01em; }
.verdict-meta { color: var(--ink-3); margin-top: 6px; }
.verdict-days { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; }
.verdict-days strong { font-size: 56px; font-weight: 800; font-stretch: 65%; line-height: .9; }
.verdict-reasons { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.verdict-reasons li { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.verdict-actions { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.verdict-idle { flex: 1; display: grid; place-items: center; text-align: center; color: var(--ink-3); padding: 40px; }
.verdict-idle .ico { width: 64px; height: 64px; color: var(--line-strong); margin: 0 auto 12px; }
.scanner { position: relative; border-radius: var(--r-md); overflow: hidden; background: #000; aspect-ratio: 4/3; margin-top: 14px; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 16px; }

/* Línea de vigencia en la ficha */
.coverage { margin-top: 14px; }
.coverage-track { position: relative; height: 10px; background: var(--sunken); border-radius: 99px; overflow: hidden; }
.coverage-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; background: var(--ok); }
.coverage.warn .coverage-fill { background: var(--warn); }
.coverage.bad .coverage-fill { background: var(--bad); width: 100% !important; opacity: .35; }
.coverage-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 6px; }

.profile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; align-items: start; padding: 24px; }
.profile h1 { font-size: 30px; font-stretch: 78%; }
.profile .facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: 14px; margin-top: 8px; }
.profile .facts span { display: inline-flex; align-items: center; gap: 6px; }
.membership-now { border-left: 1px solid var(--line); padding-left: 20px; min-width: 260px; }
.membership-now .plan { font-size: 20px; font-weight: 700; font-stretch: 85%; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 24px 0 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--brand); }

/* Punto de venta */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.product { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); padding: 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-height: 96px; }
.product:hover { border-color: var(--brand); }
.product:disabled { opacity: .5; cursor: not-allowed; }
.product strong { font-size: 14px; }
.product .price { font-weight: 700; font-size: 18px; font-stretch: 80%; margin-top: auto; }
.cart-line { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-sm); }
.qty button { border: 0; background: none; width: 32px; height: 32px; cursor: pointer; display: grid; place-items: center; }
.qty span { min-width: 26px; text-align: center; font-weight: 600; }

/* Permisos */
.perm-group { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.perm-group h4 { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; font-weight: 600; }
.perm-group .check { padding: 4px 0; }
.perm-group .check small { color: var(--warn); font-size: 12px; }

/* Credencial */
.credential { width: 340px; max-width: 100%; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); margin: 0 auto; }
.credential-top { background: var(--rail); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.credential-body { padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.credential-body .qr svg, .credential-body .qr img { width: 128px; height: 128px; }

/* Barra inferior móvil y hoja "Más" */
.bottom-nav { display: none; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--panel); border-radius: 18px 18px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 80dvh; overflow-y: auto; transform: translateY(16px); opacity: 0; transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease); }
.sheet.open { transform: none; opacity: 1; }
.sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet .nav-link { color: var(--ink); min-height: 48px; }
.sheet .nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand); box-shadow: none; }

/* ───────── Login ───────── */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.login-side { background: var(--rail); color: #dbe6f0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-side h1 { font-size: clamp(40px, 5vw, 68px); font-weight: 800; font-stretch: 62%; line-height: .95; color: #fff; letter-spacing: -.01em; max-width: 12ch; }
.login-side p { max-width: 40ch; margin-top: 18px; color: #9fb3c6; font-size: 16px; }
.login-side .plates { position: absolute; right: -80px; bottom: -80px; width: 420px; height: 420px; opacity: .9; }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; font-stretch: 85%; margin-bottom: 6px; }

.standalone { background: var(--bg); }
.standalone-main { max-width: 760px; margin: 0 auto; padding: 40px 20px 80px; }
.standalone-main h1 { font-size: 30px; font-stretch: 80%; margin-bottom: 16px; }
.standalone-main h2 { font-size: 20px; margin: 32px 0 12px; }
.standalone-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--brand); margin-bottom: 24px; }

/* ───────── Responsivo ───────── */
@media (max-width: 1100px) {
  .split, .access { grid-template-columns: minmax(0, 1fr); }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .kpis { --n: 2 !important; }
  .kpi:nth-child(odd) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--rail); color: #fff; position: sticky; top: 0; z-index: 30; min-height: 56px; }
  .topbar strong { font-stretch: 85%; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .rail-logo { width: 32px; height: 32px; border-radius: 8px; }
  .topbar .btn-ghost { color: #fff; }
  .content { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-head { align-items: flex-start; margin-bottom: 18px; }
  .page-head h1 { font-size: 26px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--panel); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; font-size: 11px; font-weight: 600; color: var(--ink-3); border: 0; background: none; text-decoration: none; cursor: pointer; }
  .bottom-nav [aria-current="page"] { color: var(--brand); }
  .bottom-nav .ico { width: 24px; height: 24px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .profile { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 14px; }
  .profile-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-actions .btn { white-space: normal; text-align: center; line-height: 1.2; padding: 6px 10px; }
  .profile > * { min-width: 0; }
  .profile-actions .btn { width: 100%; }
  .profile .membership-now { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; min-width: 0; }
  .profile h1 { font-size: 24px; }
  .avatar-lg { width: 64px; height: 64px; font-size: 22px; }
  .verdict-body { flex-direction: column; align-items: center; text-align: center; }
  .verdict-days { justify-content: center; }
  .verdict-name { font-size: 34px; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-side { padding: 28px 20px 32px; min-height: 0; }
  .login-side h1 { font-size: 44px; }
  .login-side .plates { width: 220px; height: 220px; right: -50px; bottom: -60px; opacity: .5; }
  .login-side .hide-sm { display: none; }
  .kpi { padding: 14px 16px; }
  .kpi-value { font-size: 28px; }
  .kpi-hero .kpi-value { font-size: 32px; }
  .panel-head, .panel-body { padding-left: 16px; padding-right: 16px; }
  .list > li { padding: 12px 16px; }
  .drawer { width: 100vw; }
  .filters .field { flex: 1 1 140px; }
  .filters .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .filters .field:has(.chips) { flex-basis: 100%; min-width: 0; }
  .kpis-fin .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* Tablas: se vuelven tarjetas apiladas */
  .table.stackable thead { display: none; }
  .table.stackable, .table.stackable tbody, .table.stackable tr, .table.stackable td { display: block; width: 100%; }
  .table.stackable tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.stackable td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.stackable td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; text-align: left; flex: none; }
  .table.stackable td.primary { text-align: left; padding-bottom: 6px; }
  .table.stackable td.primary::before { display: none; }
  .table.stackable td.hide-sm { display: none; }
  .table.stackable tfoot tr { border-top: 1px solid var(--line-strong); }
}
@media (max-width: 420px) {
  .kpi { padding: 12px 14px; }
  .kpi-value, .kpi-hero .kpi-value { font-size: 26px; }
  .kpi-sub { font-size: 12px; }
}
@media (pointer: coarse) {
  .btn-sm, .chip, .btn-group button, .qty button { min-height: 44px; }
  .btn-sm.btn-icon, .qty button { min-width: 44px; }
  .check input { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@media print {
  .rail, .topbar, .bottom-nav, .page-head .actions, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
