:root {
  --bg: #f3f6f8; --surface: #ffffff; --text: #14232b; --muted: #5b6b75; --line: #d9e1e6;
  --brand: #0b6e8a; --brand-dark: #08566d; --ok: #19734a; --ok-bg: #e5f5ec;
  --warn: #8a5a00; --warn-bg: #fff3d6; --bad: #a12a2a; --bad-bg: #fde8e8; --info: #0b5c78; --info-bg: #e3f3f9;
  --go: #1a7f45; --go-dark: #146536; --on-brand: #ffffff; --bar: #0b6e8a;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --tap: 2.75rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #0e171c; --surface: #16232a; --text: #e6eef2; --muted: #93a5af; --line: #2a3b44;
    --brand: #36a8c9; --brand-dark: #5cc0dd; --ok: #5fd39a; --ok-bg: #123324;
    --warn: #f0c060; --warn-bg: #3a2c0a; --bad: #ff8f8f; --bad-bg: #3a1717; --info: #7cd0ea; --info-bg: #0f2c38;
    --go: #1a7f45; --go-dark: #22995a; --on-brand: #06222c; --bar: #0f3a49;
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
    --bg: #0e171c; --surface: #16232a; --text: #e6eef2; --muted: #93a5af; --line: #2a3b44;
    --brand: #36a8c9; --brand-dark: #5cc0dd; --ok: #5fd39a; --ok-bg: #123324;
    --warn: #f0c060; --warn-bg: #3a2c0a; --bad: #ff8f8f; --bad-bg: #3a1717; --info: #7cd0ea; --info-bg: #0f2c38;
    --go: #1a7f45; --go-dark: #22995a; --on-brand: #06222c; --bar: #0f3a49;
  color-scheme: dark;
}
:root[data-theme=light] { color-scheme: light; }
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); margin: 0 0 1rem; }
.small { font-size: .875rem; color: var(--muted); }
small { color: var(--muted); }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem 1rem; background: var(--bar); color: #fff; }
.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.1rem; }
.nav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.nav a { padding: .35rem 0; opacity: .92; }
.nav a:hover { opacity: 1; text-decoration: underline; }
.who { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.who-name { font-size: .875rem; opacity: .9; }

.page { max-width: 62rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem; margin: 0 0 1rem; }
.card.narrow { max-width: 26rem; margin: 2rem auto; }
.center { text-align: center; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

label { display: block; font-weight: 600; margin: .9rem 0 .3rem; }
input, select { width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .65rem .75rem; min-height: 2.9rem; }
input:focus, select:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
input[type=radio] { width: auto; min-height: 0; }
.pin-input, .code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.code-input { text-transform: uppercase; }
.pin-small { width: 7.5rem; min-height: 2.2rem; padding: .3rem .5rem; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; padding: 0; }
.group { border: 1px dashed var(--line); border-radius: 8px; padding: .25rem .9rem .9rem; margin-top: 1rem; }
.choices { display: grid; gap: .5rem; margin: .5rem 0 0; }
.choice { display: flex; align-items: center; gap: .75rem; margin: 0; font-weight: 500; padding: .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; min-height: 3rem; }
.choice:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .65rem 1rem; min-height: 2.9rem; }
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); margin-top: 1.1rem; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-block { display: flex; width: 100%; }
.btn-small { min-height: 2.2rem; padding: .3rem .7rem; font-size: .875rem; }
.btn-danger { color: var(--bad); }
.btn-quiet { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; min-height: 2.2rem; padding: .25rem .8rem; }

.flash, .banner { padding: .7rem 1rem; border-radius: 10px; margin: 0 0 1rem; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-bad, .banner-bad { background: var(--bad-bg); color: var(--bad); }
.banner-warn { background: var(--warn-bg); color: var(--warn); }
.banner-info { background: var(--info-bg); color: var(--info); }
.banner { border-radius: 0; margin: 0; text-align: center; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr.off td { color: var(--muted); }
.actions { white-space: nowrap; }
.actions form { margin: .15rem .25rem .15rem 0; }
form.inline { display: inline-flex; gap: .4rem; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; }

.pill { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.pill-completo { background: var(--ok-bg); color: var(--ok); }
.pill-advertencia { background: var(--warn-bg); color: var(--warn); }
.pill-solo_lectura, .pill-bloqueado { background: var(--bad-bg); color: var(--bad); }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.tile { display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; }
.tile:hover { border-color: var(--brand); }
.tile span { color: var(--muted); font-size: .9rem; }

.big-code { font: 700 2.4rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em; margin: 1rem 0; }
.steps { text-align: left; padding-left: 1.25rem; }

@media (max-width: 36rem) {
  .card.narrow { margin-top: 1rem; }
}

/* Catálogo */
.price-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); margin: .8rem 0; }
.price-grid label { margin-top: 0; }
.card.off { opacity: .7; }

.price-set { margin: 1rem 0 0; display: grid; gap: .5rem; }
.price-set legend { font-weight: 700; }
.price-set .muted { margin: .2rem 0 .3rem; font-size: .9rem; }
.price-opt { display: flex; align-items: center; justify-content: space-between; gap: .75rem; border: 1px solid var(--line); border-radius: 10px; padding: .45rem .75rem; background: var(--bg); }
.price-opt:has(input[type=checkbox]:checked) { border-color: var(--brand); }
.price-opt .check { display: flex; align-items: center; gap: .6rem; margin: 0; flex: 1; cursor: pointer; }
.price-opt input[type=checkbox] { width: 1.3rem; height: 1.3rem; min-height: 0; }
.price-opt .money { display: inline-flex; align-items: center; gap: .35rem; width: 9rem; font-weight: 700; }
.price-opt:not(:has(input[type=checkbox]:checked)) .money { opacity: .3; pointer-events: none; }

/* Formulario de usuarios: solo se muestra la parte que corresponde al rol elegido */
.user-form:has(#role option[value=admin]:checked) .group-pin { display: none; }
.user-form:not(:has(#role option[value=admin]:checked)) .group-admin { display: none; }

/* Inicio */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem 1rem; margin: 0 0 .75rem; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 700; font-size: 1.1rem; }
.facts dd.warn { color: var(--warn); }
.facts dd.bad { color: var(--bad); }
.grid + .grid { margin-top: 1rem; }
.grid .card { margin: 0; }
.theme-form { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; min-height: 2.8rem; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.small.center { text-align: center; margin-top: 1.5rem; }
.narrow-left { max-width: 30rem; }

/* Reportes */
.report-filter { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.report-filter > div { flex: 1 1 10rem; }
.report-filter label { margin-top: 0; }
a.chip { text-decoration: none; display: inline-flex; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.bars { display: grid; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: minmax(5rem, 11rem) 1fr auto 2.5rem; gap: .6rem; align-items: center; }
.bar-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row small { text-align: right; }
.bar-row progress { width: 100%; height: .9rem; accent-color: var(--brand); }
.diff-bad { color: var(--bad); font-weight: 700; }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.grid { margin-bottom: 1rem; }

/* Acceso por WhatsApp */
.btn-wa { background: var(--go); border-color: var(--go); color: #fff; }
.btn-wa:hover { background: var(--go-dark); border-color: var(--go-dark); color: #fff; }
.btn-xl { min-height: 3.6rem; font-size: 1.15rem; font-weight: 800; }
.access .big-code { letter-spacing: .3em; font-size: 3rem; }
.or { margin: 1.4rem 0 .4rem; color: var(--muted); font-size: .95rem; }
.link-text { word-break: break-all; opacity: .7; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.code-4 { font-size: 2.4rem; letter-spacing: .4em; text-align: center; text-transform: uppercase; font-weight: 800; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline-details { display: inline-block; } .inline-details > summary { cursor: pointer; display: inline-flex; padding: .3rem .6rem; }

/* ================= Encabezado responsivo ================= */
.top { position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.nav a { border-radius: 8px; padding: .35rem .6rem; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.18); opacity: 1; font-weight: 700; text-decoration: none; }
@media (max-width: 72rem) {
  .top { padding: .5rem .75rem 0; gap: .25rem .75rem; }
  .brand { order: 1; }
  .who { order: 2; }
  .who-name { display: none; }
  .who a.who-name { display: inline; }
  .nav { order: 3; flex: 1 0 100%; flex-wrap: nowrap; overflow-x: auto; gap: .25rem; padding-bottom: .45rem;
         scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
}

/* ================= Inicio: tablero ================= */
:root { --chart-1: #0880a6; --chart-2: #c26a00; --shadow: 0 1px 2px rgba(16,35,43,.06), 0 4px 16px rgba(16,35,43,.06); }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) { --chart-1: #2f9cbd; --chart-2: #c27f20; --shadow: 0 1px 2px rgba(0,0,0,.3); } }
:root[data-theme=dark] { --chart-1: #2f9cbd; --chart-2: #c27f20; --shadow: 0 1px 2px rgba(0,0,0,.3); }

.page-wide { max-width: 76rem; }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; } .span-8 { grid-column: span 8; } .span-12 { grid-column: span 12; }

.dash-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: .25rem; }
.dash-head h1 { font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.1rem); letter-spacing: -.01em; }
.dash-sub { margin: .1rem 0 0; color: var(--muted); font-size: .95rem; }
.quick { display: flex; flex-wrap: wrap; gap: .5rem; }
.qa { display: inline-flex; align-items: center; gap: .45rem; padding: .6rem 1rem; border-radius: 999px; border: 1px solid var(--line);
      background: var(--surface); color: var(--text); text-decoration: none; font-weight: 700; box-shadow: var(--shadow); min-height: 2.75rem; }
.qa:hover { border-color: var(--brand); }
.qa svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.qa-go { background: var(--go); border-color: var(--go); color: #fff; }
.qa-go:hover { background: var(--go-dark); border-color: var(--go-dark); }

.kpi, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 1.1rem 1.2rem; min-width: 0; }
.kpi { display: flex; flex-direction: column; gap: .2rem; color: var(--text); text-decoration: none; position: relative; overflow: hidden; }
.kpi-link:hover { border-color: var(--brand); }
.kpi-label { margin: 0; font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { margin: 0; font-size: clamp(1.55rem, 1.2rem + 1.2vw, 2.1rem); font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-foot { margin: auto 0 0; font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.pill { display: inline-flex; align-items: center; gap: .2rem; border-radius: 999px; padding: .05rem .5rem; font-weight: 800; font-size: .8rem; }
.pill-up { background: var(--ok-bg); color: var(--ok); }
.pill-down { background: var(--bad-bg); color: var(--bad); }
.board-mini { gap: .75rem; }
.board-mini b { color: var(--text); font-size: 1rem; }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-bottom: .6rem; }
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.panel-meta { margin: 0 0 .75rem; color: var(--muted); font-size: .9rem; }
.panel-head .panel-meta { margin: 0; }
.empty-note { color: var(--muted); margin: .5rem 0; }

/* Gráfica */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-base { stroke: var(--muted); stroke-opacity: .5; }
.ch-axis { fill: var(--muted); font-size: 12px; font-family: inherit; }
.ch-axis-today { fill: var(--text); font-weight: 700; }
.ch-val { fill: var(--text); font-size: 12px; font-weight: 700; font-family: inherit; }
.ch-bar { fill: var(--chart-1); opacity: .55; }
.ch-bar.ch-today { opacity: 1; }
.ch-hit { fill: transparent; }
.ch-col:hover .ch-bar { opacity: 1; }
.ch-col:hover .ch-hit { fill: var(--line); fill-opacity: .35; }
.as-table { margin-top: .5rem; font-size: .9rem; }
.as-table summary { cursor: pointer; color: var(--muted); }

/* Caja */
.status-tag { font-size: .8rem; font-weight: 800; border-radius: 999px; padding: .15rem .6rem; }
.shift-card.is-open .status-tag { background: var(--ok-bg); color: var(--ok); }
.shift-card.is-closed .status-tag { background: var(--bad-bg); color: var(--bad); }
.shift-card { display: flex; flex-direction: column; }
.shift-card .btn { margin-top: auto; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1rem; margin: 0 0 1rem; }
.mini-stats dt { color: var(--muted); font-size: .8rem; }
.mini-stats dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.btn-go { background: var(--go); border-color: var(--go); color: #fff; font-weight: 800; }
.btn-go:hover { background: var(--go-dark); border-color: var(--go-dark); }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* Servicios: barras horizontales */
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.hbars li { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; align-items: baseline; }
.hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hb-val { font-weight: 800; font-variant-numeric: tabular-nums; }
.hb-bar, .split-cash { grid-column: 1 / -1; width: 100%; height: .55rem; border: 0; border-radius: 999px; background: var(--line); -webkit-appearance: none; appearance: none; }
.hb-bar::-webkit-meter-bar, .split-cash::-webkit-meter-bar { background: var(--line); border: 0; border-radius: 999px; height: .55rem; }
.hb-bar::-webkit-meter-optimum-value { background: var(--chart-1); border-radius: 999px; }
.hb-bar::-moz-meter-bar { background: var(--chart-1); border-radius: 999px; }

/* Formas de pago */
.split { margin: .25rem 0 .9rem; }
.split-cash { height: 1rem; background: var(--chart-2); }
.split-cash::-webkit-meter-bar { background: var(--chart-2); height: 1rem; }
.split-cash::-webkit-meter-optimum-value { background: var(--chart-1); border-radius: 999px 0 0 999px; box-shadow: 2px 0 0 var(--surface); }
.split-cash::-moz-meter-bar { background: var(--chart-1); border-radius: 999px 0 0 999px; box-shadow: 2px 0 0 var(--surface); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.legend li { display: grid; grid-template-columns: auto 1fr auto 3rem; align-items: center; gap: .6rem; }
.legend b { font-variant-numeric: tabular-nums; }
.legend small { text-align: right; }
.sw { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; }
.sw-1 { background: var(--chart-1); } .sw-2 { background: var(--chart-2); }

/* Suscripción */
.sub-plan { font-size: 1.25rem; font-weight: 800; margin: 0 0 .2rem; }
.sub-days { margin: 0 0 .5rem; color: var(--muted); }
.sub-days b { font-size: 1.6rem; color: var(--text); }
.sub-days.warn b, .sub-days.warn { color: var(--warn); }
.sub-days.bad { color: var(--bad); font-weight: 800; }
.sub-card .small { margin: .2rem 0; }

/* Instalar */
.install-card h2 { margin: 0 0 .2rem; font-size: 1.05rem; }
.install-row { display: flex; gap: .9rem; align-items: center; margin-bottom: .6rem; }
.install-row img { border-radius: 14px; flex: none; box-shadow: var(--shadow); }
.install-row .small { margin: 0; }
.narrow-wrap { max-width: 26rem; margin: 0 auto 2rem; }
.install-login { margin-top: 0; }

.dash-foot { text-align: center; color: var(--muted); font-size: .85rem; margin: .5rem 0 0; }

/* Tableta */
@media (max-width: 64rem) {
  .dash { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .span-3 { grid-column: span 3; } .span-4, .span-5, .span-6 { grid-column: span 3; }
  .span-8 { grid-column: span 6; } .span-12 { grid-column: span 6; }
  .shift-card, .sub-card { grid-column: span 6; }
}
/* Celular */
@media (max-width: 40rem) {
  .page-wide { padding: 1rem .75rem 2.5rem; }
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .span-3 { grid-column: span 1; }
  .span-4, .span-5, .span-6, .span-8, .span-12, .shift-card, .sub-card { grid-column: span 2; }
  .panel-head { flex-wrap: wrap; }
  .kpi { padding: .85rem .9rem; border-radius: 14px; }
  .kpi-label { font-size: .72rem; }
  .kpi-foot { font-size: .78rem; }
  .board-mini { gap: .4rem; }
  .panel { padding: 1rem; border-radius: 14px; }
  .dash-head { align-items: flex-start; }
  .quick { width: 100%; display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .qa { justify-content: center; padding: .6rem .4rem; font-size: .85rem; flex-direction: column; gap: .2rem; border-radius: 14px; }
  .ch-axis, .ch-val { font-size: 22px; }
}

/* Encabezado más oscuro en tema oscuro (mejor contraste con el texto blanco) */
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .top { background: #0d4c5f; } }
:root[data-theme=dark] .top { background: #0d4c5f; }

/* Registro */
.signup { max-width: 34rem; margin: 1.5rem auto; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.plans { border: 0; padding: 0; margin: 1rem 0 .5rem; display: grid; gap: .5rem; }
.plans legend { font-weight: 700; margin-bottom: .4rem; }
.plan-opt { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "r n p" "r f f"; gap: .1rem .75rem; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; cursor: pointer; margin: 0; font-weight: 400; }
.plan-opt input { grid-area: r; width: 1.2rem; height: 1.2rem; min-height: 0; margin: 0; }
.plan-opt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.plan-name { grid-area: n; font-weight: 800; }
.plan-price { grid-area: p; font-weight: 800; }
.plan-price small { font-weight: 400; }
.plan-feat { grid-area: f; color: var(--muted); font-size: .85rem; }
.check-line { display: flex; gap: .6rem; align-items: center; font-weight: 400; margin: 1rem 0 .25rem; }
.check-line input { width: 1.2rem; height: 1.2rem; min-height: 0; }

/* Primeros pasos */
.onboarding { border-color: var(--brand); }
.ob-progress { display: block; margin: 0 0 .9rem; }
.ob-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.ob-steps a { display: flex; gap: .7rem; align-items: flex-start; height: 100%; padding: .8rem; border-radius: 12px; border: 1px solid var(--line);
  color: var(--text); text-decoration: none; background: var(--bg); flex-wrap: wrap; }
.ob-steps a:hover { border-color: var(--brand); }
.ob-num { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--line); }
.ob-text { display: grid; gap: .15rem; flex: 1; min-width: 8rem; }
.ob-text small { line-height: 1.35; }
.ob-steps .done .ob-num { background: var(--ok-bg); color: var(--ok); }
.ob-steps .done b { text-decoration: line-through; color: var(--muted); }
.ob-steps .next a { border-color: var(--go); box-shadow: 0 0 0 1px var(--go); }
.ob-steps .next .ob-num { background: var(--go); color: #fff; }
.ob-go { width: 100%; text-align: right; font-weight: 800; color: var(--go); font-size: .9rem; }
@media (max-width: 64rem) { .ob-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 40rem) { .ob-steps { grid-template-columns: 1fr; } }

/* Productos */
.section-title { margin: 2rem 0 .3rem; font-size: 1.3rem; }
.products-table td { vertical-align: top; }
.products-table .prod-name { width: 100%; min-width: 10rem; min-height: 2.5rem; margin: 0; }
.stock-cell { display: grid; gap: .4rem; justify-items: start; }
.stock-now { font-size: 1.05rem; }
.row-actions { display: flex; flex-direction: column; gap: .4rem; align-items: stretch; }
@media (max-width: 48rem) {
  .products-table thead { display: none; }
  .products-table, .products-table tbody, .products-table tr, .products-table td { display: block; width: 100%; }
  .products-table tr { border: 1px solid var(--line); border-radius: 12px; padding: .75rem; margin-bottom: .75rem; }
  .products-table td { border: 0; padding: .35rem 0; }
  .products-table td::before { content: attr(data-label); display: block; font-size: .78rem; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: .2rem; }
  .row-actions { flex-direction: row; flex-wrap: wrap; }
}
.money-in { display: inline-flex; align-items: center; gap: .25rem; font-weight: 700; }
.money-in input { width: 6rem; min-height: 2.5rem; }
.small-check { margin: 0; font-size: .85rem; gap: .35rem; }
.stock-low { color: var(--bad); font-weight: 800; }
.muted-inline { color: var(--muted); font-size: .9rem; }
.low-stock { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; background: var(--warn-bg); color: var(--warn); border-color: var(--warn); text-decoration: none; }
.low-stock .low-go { margin-left: auto; font-weight: 800; }

/* Sucursales */
.branch-bar { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; padding: .45rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); font-size: .95rem; }
.branch-bar label { margin: 0; font-weight: 700; }
.branch-bar select { width: auto; min-width: 10rem; margin: 0; }
.branch-list { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); margin-bottom: 1rem; }
.branch-card.is-current { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.branch-card.off { opacity: .7; }
.branch-head { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; flex-wrap: wrap; }
.branch-head h2 { margin: 0; }
.branch-tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.branch-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-start; }
.branch-form { display: grid; gap: .3rem; max-width: 28rem; }
.pill-info { background: var(--info-bg); color: var(--info); }
@media (max-width: 40rem) { .branch-bar { justify-content: flex-start; flex-wrap: wrap; } .branch-bar select { flex: 1; min-width: 0; } }
.bt-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.bt-list li { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 10px; }
.bt-list b { font-variant-numeric: tabular-nums; }
.bt-list small { grid-column: 1 / -1; color: var(--muted); }
.bt-list li.is-current { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
@media (max-width: 36rem) {
  .prod-new { grid-template-columns: 1fr; }
  .prod-new + .btn { width: 100%; }
}

/* ================= Pulido UX/UI: estados, foco, íconos, tablas y menú ================= */
::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); color: inherit; }
input, textarea { caret-color: var(--brand); }
input[type=checkbox], input[type=radio], progress, meter { accent-color: var(--brand); }
td, .kpi-value, .money-in input, .facts dd { font-variant-numeric: tabular-nums; }

/* Foco visible y uniforme en todo lo que se puede tocar */
:where(a, button, summary, select, input, textarea, .chip, .btn):focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
input:focus:not(:focus-visible), select:focus:not(:focus-visible) { outline: 2px solid var(--brand); outline-offset: 1px; }
.top :where(a, button):focus-visible { outline-color: #fff; }

/* Estados de botón: presionado y desactivado se distinguen */
.btn, .chip, .qa { transition: background-color .15s ease-out, border-color .15s ease-out, box-shadow .15s ease-out, transform .1s ease-out; }
.btn:active:not(:disabled), .chip:active:not(:disabled), .qa:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled=true], .chip:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--brand); border-color: var(--brand); }
summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }
.inline-details > summary { min-height: 2.2rem; }

/* Íconos de línea (reemplazan a los emoji) */
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.chip-ic { display: inline-flex; align-items: center; gap: .4rem; }
.ob-num .ic { width: 1.05rem; height: 1.05rem; stroke-width: 2.6; }
.low-stock .ic { width: 1.25rem; height: 1.25rem; }

/* Menú del panel en celular: se desliza de lado y avisa que hay más con un desvanecido */
@media (max-width: 72rem) {
  .nav { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 1rem, #000 calc(100% - 2rem), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 1rem, #000 calc(100% - 2rem), transparent);
         padding-left: .5rem; padding-right: 2rem; scroll-padding-inline: 1.5rem; scroll-snap-type: x proximity; }
  .nav a { min-height: var(--tap); display: inline-flex; align-items: center; scroll-snap-align: start; }
}

/* Tablas que en celular se vuelven tarjetas (Usuarios, Dispositivos) */
.pill { white-space: nowrap; }
@media (max-width: 48rem) {
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { border: 1px solid var(--line); border-radius: var(--r-md); padding: .4rem .9rem; margin-bottom: .75rem; background: var(--surface); }
  .table-stack td { border: 0; padding: .45rem 0; display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; align-items: center; }
  .table-stack td::before { content: attr(data-label); font-size: .8rem; font-weight: 700; color: var(--muted); }
  .table-stack td.cell-title { display: block; font-size: 1.1rem; font-weight: 700; padding-top: .6rem; }
  .table-stack td.cell-title::before { content: none; }
  .table-stack td.cell-wrap { overflow-wrap: anywhere; }
  .table-stack td.actions { display: flex; flex-wrap: wrap; gap: .5rem; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .75rem; }
  .table-stack td.actions::before { content: none; }
  .table-stack td select { width: 100%; }
  .table-wrap:has(.table-stack) { overflow: visible; }
  section.card:has(> .table-wrap > .table-stack) { background: transparent; border: 0; box-shadow: none; padding: 0; }
}

/* Plataforma multi-negocio */
.bitacora { white-space: pre-wrap; font-size: .85rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .75rem; margin: 0; max-height: 22rem; overflow: auto; }
.slug-in { display: flex; align-items: center; gap: .35rem; }
.slug-in input { flex: 1; min-width: 0; margin: 0; }
.slug-in span { color: var(--muted); font-weight: 600; white-space: nowrap; }
.ev-list, .rev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.ev-list li, .rev-list li { padding: .35rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.clave-unica { font-size: 1.3rem; font-weight: 800; letter-spacing: .06em; user-select: all; }
.facts-1 { grid-template-columns: 1fr; }
.big-link { font-size: 1.3rem; font-weight: 800; overflow-wrap: anywhere; }

/* Configuración de la plataforma */
.tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 2px solid var(--line); margin: 0 0 1.25rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; display: inline-flex; align-items: center; min-height: var(--tap); padding: .4rem .9rem; color: var(--muted); font-weight: 600;
          text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tabs a:hover { color: var(--text); background: var(--surface); }
.tabs a[aria-current=page] { color: var(--brand); border-bottom-color: var(--brand); background: var(--surface); }
.cfg-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); margin-bottom: 1rem; }
.cfg-grid > .card { margin: 0; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.form-actions > .btn { margin-top: 1.1rem; }
.input-short { max-width: 9rem; }
.notes { margin: 1rem 0 0; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; display: grid; gap: .3rem; }
.copy-row { display: flex; gap: .5rem; align-items: stretch; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.copy-row .btn { flex: none; gap: .35rem; }
.clabe { font-size: .95rem; letter-spacing: .03em; white-space: nowrap; }
.ejemplo td strong { font-size: 1.05rem; }
.restore { margin-top: 1rem; }
.restore pre { white-space: pre-wrap; font-size: .85rem; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .75rem; margin: .5rem 0 0; }
.filters { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); align-items: end; }
.filters label { margin-top: 0; }
.filters > div { margin-bottom: .75rem; }
.filters-actions { display: flex; gap: .5rem; }
.filters-actions .btn { margin-top: 0; }
.changes { margin-top: .4rem; }
.changes summary { min-height: 2rem; font-size: .875rem; color: var(--brand); }
.changes table { margin-top: .35rem; font-size: .875rem; background: var(--bg); border-radius: var(--r-sm); }
.changes th, .changes td { padding: .35rem .5rem; display: table-cell !important; }
.changes td::before { content: none !important; }
.changes .before { color: var(--bad); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.changes .after { color: var(--ok); font-weight: 600; }
.pager { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; }
.temp-pass { font-size: 1.3rem; font-weight: 800; letter-spacing: .06em; user-select: all; }
.banner-link { color: inherit; font-weight: 800; margin-left: .35rem; }
.pay-box { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.pay-account { border: 1px solid var(--line); border-radius: var(--r-md); padding: .9rem 1rem; background: var(--bg); }
.pay-account dl { margin: 0; display: grid; gap: .45rem; }
.pay-account dt { font-size: .8rem; color: var(--muted); font-weight: 700; }
.pay-account dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.pay-account .clabe { font-size: 1.15rem; }
.pay-online { display: grid; gap: .6rem; }
.pay-online form { margin: 0; }
.pay-online .btn { width: 100%; justify-content: space-between; margin: 0; }
.pay-amounts { margin: .25rem 0 0; }
@media (max-width: 48rem) {
  .changes table, .changes thead, .changes tbody, .changes tr { display: table !important; width: 100%; }
  .changes thead { display: table-header-group !important; }
  .changes tbody { display: table-row-group !important; }
  .changes tr { display: table-row !important; border: 0 !important; padding: 0 !important; margin: 0 !important; }
}
.h3 { font-size: 1rem; margin: 1.1rem 0 .5rem; }
.h3-top { margin-top: 0; display: flex; align-items: center; gap: .4rem; }
@media (max-width: 48rem) {
  .table-stack td > .pill { justify-self: start; }
  .table-stack td.cell-block { display: block; }
  .table-stack td.cell-block::before { display: block; margin-bottom: .2rem; }
  .copy-row { flex-wrap: wrap; }
  .copy-row input { flex-basis: 100%; }
  .copy-row .btn { width: 100%; }
}
.pay-online { margin-top: 1rem; }
.key-card { border-color: var(--warn); background: var(--warn-bg); }
.key-card h2 { display: flex; align-items: center; gap: .45rem; color: var(--warn); }
.key-card p { margin: 0 0 .75rem; }
.key-card form { margin: 0 0 .5rem; }
.key-card .btn { gap: .4rem; }
.key-result { max-width: 42rem; }
.key-result .copy-row input { font-size: .95rem; }
