/* Mega Sport · Sistema de gestión. Sistema visual copiado de referencia/demo/css/app.css sin cambiar valores;
   al final, la sección «Agregados del sistema» con lo que el demo no tiene. */
/* Origen: demo
   Estilo: "libro contable" claro. La interfaz va en tinta; el rojo de la marca solo en el logo
   y en el dato principal de cada pantalla. Botón principal casi negro.
   Rejilla: 12 columnas, un solo hueco de 16px. Canvas fluido con 28px de margen. */

@font-face { font-family: "Archivo"; src: url("/vendor/archivo/archivo-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("/vendor/archivo/archivo-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("/vendor/archivo/archivo-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("/vendor/archivo/archivo-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("/vendor/archivo/archivo-latin-ext-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0100-024F; }

:root {
  --ground: #f4f3f1;   --surface: #ffffff;  --raised: #f4f4f3;  --active: #e9e8e6;
  --border: #e6e5e3;   --rule: #f0efed;     --control: #cfcfcd;
  --text: #141414;     --muted: #5c5c5a;    --faint: #6b6b69;
  --accent: #d7141a;   /* rojo Mega Sport: el dato principal */
  --primary: #1a1a1a;  --primary-ink: #ffffff;
  --positive: #247b50; --negative: #b3261e; --warning: #92400e;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fff6dc;  --pill-warning-ink: #7a3b06;
  --pill-neutral-bg: #ececea;  --pill-neutral-ink: #3a3a38;
  --chart-1: var(--accent); --chart-2: #9a9a98; --chart-3: #6b6b69; --chart-muted: #c9c9c7;
  --chart-mark: var(--text); --chart-span: 0.06; --chart-track: #e6e5e3;
  --grid: #ebeae8; --axis-ink: var(--muted); --ink: var(--text);

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-title: 24px; --fs-section: 16px; --fs-kpi: 24px; --fs-lead: 32px; --fs-body: 14px; --fs-small: 12px;

  --sidebar-width: 236px;
  --pad: 28px; --gap: 16px; --card-pad: 20px;
  --radius-card: 8px; --radius-control: 6px;
  --control-height: 34px; --row-height: 46px; --nav-row: 32px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 120ms; --t-hover: 150ms; --t-ui: 200ms;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5 8 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: var(--fs-body)/20px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
.num, table, .kpi-value, .money { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); line-height: 16px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- inicio de sesión ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100svh; }
.login-brand { background: #000; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; }
.login-brand img { width: min(520px, 100%); margin-top: 18vh; }
.login-brand p { color: #b4b4b4; max-width: 44ch; font-size: 15px; line-height: 24px; }
.login-form { display: grid; place-items: center; padding: 32px 24px; background: var(--surface); }
.login-form form { width: min(380px, 100%); display: grid; gap: 16px; }
.login-form h1 { font-size: var(--fs-title); line-height: 1.2; font-weight: 600; }
.demo-users { display: grid; gap: 8px; margin-top: 8px; }
.demo-user { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); cursor: pointer; text-align: left; transition: border-color var(--t-hover) ease, background-color var(--t-hover) ease; }
.demo-user:hover { border-color: var(--control); background: var(--raised); }
.demo-user .who { flex: 1; min-width: 0; }
.demo-user .who b { display: block; font-weight: 500; }

/* ---------- caparazón: barra lateral + lienzo ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100svh; }
.sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 2px; padding: 20px 12px 16px; overflow: auto; border-right: 1px solid var(--border); }
.brand { display: block; padding: 0 8px 4px; }
.brand img { width: 168px; height: auto; }
.scope { margin: 14px 8px 6px; padding: 8px 10px; border-radius: var(--radius-control); background: var(--surface); border: 1px solid var(--border); }
.scope b { display: block; font-weight: 500; }
.group-label { margin: 18px 8px 6px; font-size: var(--fs-small); color: var(--faint); }
.nav-item { display: flex; align-items: center; gap: 10px; height: var(--nav-row); padding: 0 8px; border-radius: 6px; color: var(--muted); transition: background-color var(--t-hover) ease, color var(--t-hover) ease; }
.nav-item svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--text); }
.nav-item .count { margin-left: auto; font-size: var(--fs-small); color: var(--text); font-variant-numeric: tabular-nums; }
.sidebar .bottom { margin-top: auto; padding-top: 12px; display: grid; gap: 2px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 8px; }
.avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #3a3a38; }
.demo-note { margin: 4px 8px 0; color: var(--faint); font-size: var(--fs-small); line-height: 16px; }
.canvas { min-width: 0; padding: 32px var(--pad) 48px; }
.topbar { display: none; }

/* ---------- título y filtros ---------- */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.title-row h1 { font-size: var(--fs-title); line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.title-row .sub { margin-top: 4px; color: var(--muted); }
.title-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: var(--gap); flex-wrap: wrap; }
.filters .spacer { flex: 1; }
.stamp { color: var(--faint); font-size: var(--fs-small); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); font-size: var(--fs-small); font-weight: 500; white-space: nowrap; flex: none; }

/* ---------- paneles y rejilla ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.grid.top { align-items: start; }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c5 { grid-column: span 5; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--card-pad); min-width: 0; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel h2 { font-size: var(--fs-section); line-height: 1.3; font-weight: 600; }
.panel .meta { color: var(--faint); font-size: var(--fs-small); }
.panel.flush { padding: 0; }
.panel.flush > header { padding: 16px var(--card-pad) 0; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.chart-head h3 { font-size: var(--fs-body); font-weight: 500; }
.chart { position: relative; min-width: 0; }
.card-link { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; color: var(--text); font-weight: 500; cursor: pointer; text-underline-offset: 3px; white-space: nowrap; }
.card-link::after { content: ""; width: 12px; height: 12px; flex: none; background: currentColor; -webkit-mask: var(--chevron) center / 12px no-repeat; mask: var(--chevron) center / 12px no-repeat; }
.card-link:hover { text-decoration: underline; }
.rows { display: grid; }
.row { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--rule); }
.row .grow { flex: 1; min-width: 0; }
.row .sub { display: block; color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.row .val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* KPIs: una franja dividida, etiqueta sobre valor */
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.kpi { padding: 16px var(--card-pad); min-width: 0; }
.kpi + .kpi { border-left: 1px solid var(--border); }
.kpi-label { color: var(--muted); }
.kpi-value { margin-top: 6px; font-size: var(--fs-kpi); line-height: 1.15; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.kpi-value small { font-size: 0.55em; color: var(--muted); font-weight: 400; margin-left: 2px; }
.kpi.lead .kpi-value { font-size: var(--fs-lead); font-weight: 600; }
.delta { margin-top: 4px; font-size: var(--fs-small); color: var(--muted); }
.delta .good { color: var(--positive); } .delta .bad { color: var(--negative); }
.kpis[role="tablist"] .kpi { position: relative; cursor: pointer; border-radius: 0; }
.kpis[role="tablist"] .kpi[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; }
th { height: 38px; padding: 0 12px; text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: calc((var(--row-height) - 20px) / 2) 12px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
th:first-child, td:first-child { padding-left: var(--card-pad); }
th:last-child, td:last-child { padding-right: var(--card-pad); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--raised); }
tbody tr[aria-selected="true"] td { background: var(--active); }
th.n, td.n { text-align: right; }
td .sub { display: block; font-size: var(--fs-small); line-height: 16px; color: var(--muted); }
td.dash, .dash { color: var(--faint); }
.code { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--card-pad); border-top: 1px solid var(--border); }
.pager .btns { display: flex; gap: 8px; }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-small); font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; flex: none; }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); flex: none; vertical-align: -1px; }

/* ---------- controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-height); padding: 0 14px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out), opacity var(--t-hover) ease; }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.btn.primary:hover { background: #333; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--negative); border-color: #e7b9b4; }
.btn.big { height: 52px; font-size: 16px; padding: 0 20px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.field { display: grid; gap: 8px; min-width: 0; }
.field > label, .field > .label { font-weight: 500; }
.field .hint { color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.input, select.input, textarea.input { height: 38px; width: 100%; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
textarea.input { height: auto; padding: 8px 12px; resize: vertical; }
.input.sm, select.input.sm { height: var(--control-height); width: auto; }
.input:focus { outline: 2px solid var(--text); outline-offset: -1px; }
.input::placeholder { color: var(--faint); }
.input.num { text-align: right; }
.fields { display: grid; gap: 16px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button { position: relative; padding: 10px 0; color: var(--muted); background: none; border: 0; cursor: pointer; white-space: nowrap; transition: color var(--t-hover) ease; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }
.segmented { display: inline-flex; width: max-content; max-width: 100%; padding: 2px; border-radius: 8px; background: var(--active); }
.segmented button { height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--text); }
.switch { appearance: none; width: 32px; height: 20px; border-radius: 999px; background: var(--control); position: relative; cursor: pointer; flex: none; transition: background-color var(--t-ui) ease; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--t-ui) var(--ease-out); }
.switch:checked { background: var(--text); } .switch:checked::after { transform: translateX(12px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--control); border-radius: 999px; background: var(--surface); cursor: pointer; white-space: nowrap; transition: background-color var(--t-hover) ease, border-color var(--t-hover) ease; }
.chip:hover { background: var(--raised); }
.chip[aria-pressed="true"] { border-color: var(--text); background: var(--active); }
.empty { display: grid; place-items: center; min-height: 96px; padding: 16px; border: 1px dashed var(--control); border-radius: var(--radius-control); color: var(--muted); text-align: center; }
.notice { padding: 10px 14px; border: 1px solid #f3d38a; background: var(--pill-warning-bg); color: var(--pill-warning-ink); border-radius: var(--radius-control); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- caja (punto de venta) ---------- */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: var(--gap); align-items: start; }
.scan { position: relative; }
.scan .input { height: 52px; font-size: 17px; padding-left: 48px; border-color: var(--text); }
.scan svg { position: absolute; left: 16px; top: 16px; width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.5; }
.scan-hint { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--muted); font-size: var(--fs-small); flex-wrap: wrap; }
.results .row { cursor: pointer; padding: 10px var(--card-pad); margin: 0 calc(var(--card-pad) * -1); }
.results .row:hover { background: var(--raised); }
.results .row .val b { font-weight: 600; }
.ticket { position: sticky; top: 24px; display: flex; flex-direction: column; max-height: calc(100svh - 48px); padding: 0; }
.ticket > header { padding: 16px var(--card-pad) 0; margin-bottom: 8px; }
.ticket .lines { overflow: auto; padding: 0 var(--card-pad); flex: 1; min-height: 120px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 0; }
.line + .line { border-top: 1px solid var(--rule); }
.line .name { font-weight: 500; }
.line .ctrl { display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; }
.line .ctrl .spacer { flex: 1; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--control); border-radius: var(--radius-control); height: 32px; }
.stepper button { width: 32px; height: 30px; border: 0; background: none; cursor: pointer; font-size: 16px; }
.stepper input { width: 42px; height: 30px; border: 0; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); text-align: center; font-variant-numeric: tabular-nums; }
.price-select { height: 32px; border: 1px solid var(--control); border-radius: var(--radius-control); padding: 0 8px; background: var(--surface); }
.remove { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.remove:hover { color: var(--text); background: var(--raised); }
.pay { padding: 16px var(--card-pad) var(--card-pad); border-top: 1px solid var(--border); display: grid; gap: 12px; }
.total { display: flex; align-items: baseline; justify-content: space-between; }
.total .money { font-size: var(--fs-lead); font-weight: 600; letter-spacing: -0.01em; }
.total .money small { font-size: 16px; font-weight: 500; color: var(--muted); margin-right: 4px; }
.change { display: flex; justify-content: space-between; color: var(--muted); }
.change b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.cash-closed { display: grid; gap: 16px; max-width: 420px; }

/* ---------- curva de tallas (colores × tallas) ---------- */
.curve { border-collapse: separate; border-spacing: 0; width: 100%; }
.curve th, .curve td { border: 0; padding: 0; height: auto; }
.curve th { font-size: var(--fs-small); color: var(--muted); text-align: center; padding: 0 0 8px; }
.curve th.col-color { text-align: left; }
.curve td.color { white-space: nowrap; padding: 4px 12px 4px 0; }
.curve td.cell { padding: 3px; text-align: center; }
.cell-box { display: grid; place-items: center; height: 38px; border-radius: 6px; background: var(--raised); font-variant-numeric: tabular-nums; font-weight: 500; }
.cell-box.low { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.cell-box.zero { color: var(--faint); font-weight: 400; }
.cell-box.none { background: transparent; border: 1px dashed var(--border); color: var(--faint); font-weight: 400; }
.curve .dim { opacity: .3; }
.curve td.tot { text-align: right; padding-left: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }

/* rejilla del registro múltiple */
.grid-input { width: 100%; height: 40px; border: 1px solid var(--control); border-radius: 6px; text-align: center; font-variant-numeric: tabular-nums; background: var(--surface); }
.grid-input.exists { border-style: dashed; }
.grid-input.filled { border-color: var(--text); background: #fafafa; font-weight: 600; }
.cell-note { display: block; font-size: 11px; line-height: 14px; color: var(--muted); margin-top: 2px; }
.step-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.step-title h2 { font-size: var(--fs-section); font-weight: 600; }
.summary-strip { position: sticky; bottom: 0; z-index: 5; margin-top: var(--gap); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px var(--card-pad); display: flex; align-items: center; gap: 28px; flex-wrap: wrap; box-shadow: 0 -2px 10px rgba(0,0,0,.04); }
.summary-strip .fig { display: grid; }
.summary-strip .fig b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary-strip .spacer { flex: 1; }

/* ---------- ventanas, panel lateral y avisos ---------- */
dialog { border: 0; padding: 0; border-radius: 12px; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); max-height: calc(100svh - 48px); box-shadow: 0 24px 64px rgba(0,0,0,.22); }
dialog.wide { width: min(880px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(20,20,20,.45); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px 0; }
dialog .dlg-head h2 { font-size: 18px; font-weight: 600; }
dialog .dlg-body { padding: 16px 22px; display: grid; gap: 16px; overflow: auto; max-height: calc(100svh - 190px); }
dialog .dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
dialog .dlg-foot .left { margin-right: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: 30; display: flex; flex-direction: column; transform: translateX(100%); visibility: hidden; transition: transform var(--t-ui) var(--ease-out), visibility 0s linear var(--t-ui); }
.drawer.open { transform: none; visibility: visible; box-shadow: -16px 0 48px rgba(0,0,0,.12); transition: transform var(--t-ui) var(--ease-out); }
.drawer .dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px 12px; }
.drawer .dlg-body { padding: 4px 24px 24px; overflow: auto; display: grid; gap: 20px; align-content: start; }
.x { width: 32px; height: 32px; border: 0; border-radius: 6px; background: none; cursor: pointer; font-size: 20px; line-height: 1; color: var(--muted); flex: none; }
.x:hover { background: var(--raised); color: var(--text); }
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; }
.toast { background: #1a1a1a; color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: min(520px, calc(100vw - 32px)); animation: rise var(--t-ui) var(--ease-out); }
.toast.error { background: var(--negative); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ticket de 58 mm (vista previa e impresión) */
.receipt { width: 58mm; padding: 4mm 3mm; background: #fff; color: #000; font: 11px/1.35 var(--font); font-variant-numeric: tabular-nums; border: 1px solid var(--border); margin: 0 auto; }
.receipt .c { text-align: center; }
.receipt .logo { width: 40mm; margin: 0 auto 2mm; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 2mm 0; }
.receipt .ln { display: flex; justify-content: space-between; gap: 6px; }
.receipt .ln span:last-child { white-space: nowrap; }
.receipt .item { margin-bottom: 1.5mm; }
.receipt .big { font-size: 14px; font-weight: 700; }
.receipt .anulada { border: 1.5px solid #000; text-align: center; font-weight: 700; padding: 1mm; margin: 2mm 0; }
/* etiqueta adhesiva */
.label-sheet { display: flex; flex-wrap: wrap; gap: 12px; }
.lbl { width: 40mm; height: 40mm; padding: 2mm 2.2mm 1.6mm; background: #fff; color: #000; border: 1px solid var(--border); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; row-gap: 0.6mm; font: 9px/1.2 var(--font); overflow: hidden; }
.lbl.s5025 { width: 50mm; height: 25mm; padding: 1.2mm 2mm 1mm; row-gap: 0.2mm; }
.lbl.s4030 { width: 40mm; height: 30mm; }
.lbl.s5030 { width: 50mm; height: 30mm; }
.lbl .top { display: flex; justify-content: space-between; gap: 4px; font-weight: 700; font-size: 10px; }
.lbl.s4040 .top { font-size: 11px; }
.lbl.s4040 .top .tl { font-size: 13px; }
.lbl .mid { display: flex; justify-content: space-between; gap: 4px; }
.lbl.s4040 .mid b { font-size: 11px; }
.lbl svg { width: 100%; height: 100%; min-height: 0; }
.lbl .dist { text-align: center; font-size: 7.5px; line-height: 1.1; letter-spacing: 0.02em; }
.lbl.s5025 .dist { font-size: 6.5px; }
#print-root { display: none; }
@page e4040 { size: 40mm 40mm; margin: 0; }
@page e5025 { size: 50mm 25mm; margin: 0; }
@page e4030 { size: 40mm 30mm; margin: 0; }
@page e5030 { size: 50mm 30mm; margin: 0; }
@page hoja { size: A4; margin: 14mm; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .receipt, #print-root .lbl { border: 0; margin: 0; page-break-after: always; break-after: page; }
  #print-root .lbl.s4040 { page: e4040; } #print-root .lbl.s5025 { page: e5025; } #print-root .lbl.s4030 { page: e4030; } #print-root .lbl.s5030 { page: e5030; }
  #print-root .print-sheet { page: hoja; }
}

/* ---------- tienda pública ---------- */
.shop-head { background: #000; color: #fff; }
.shop-head .in { max-width: 1200px; margin: 0 auto; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.shop-head img { width: 180px; }
.shop { max-width: 1200px; margin: 0 auto; padding: 28px 24px 64px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--gap); }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
.pcard .pic { background: var(--raised); aspect-ratio: 4 / 3; display: grid; place-items: center; }
.pcard .pic svg { width: 62%; height: 78%; }
.pcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pcard h3 { font-size: 15px; font-weight: 600; }
.sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.sizes button { min-width: 40px; height: 32px; padding: 0 8px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); cursor: pointer; }
.sizes button[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: #fff; }
.sizes button[disabled] { color: var(--faint); text-decoration: line-through; cursor: not-allowed; background: var(--raised); }
.colors { display: flex; gap: 6px; flex-wrap: wrap; }
.colors button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); cursor: pointer; padding: 0; }
.colors button[aria-pressed="true"] { outline: 2px solid var(--text); outline-offset: 2px; }



/* ---------- caja: fila de búsqueda y visor de cámara ---------- */
.scan-row { display: flex; gap: 8px; align-items: stretch; }
.scan-row .grow { flex: 1; min-width: 0; }
.line .name .sub { display: block; margin-top: 2px; }
.viewfinder { position: relative; height: 260px; border-radius: var(--radius-card); background: #1b1b1b; overflow: hidden; }
.viewfinder .frame { position: absolute; inset: 70px 60px; border: 2px solid rgba(255,255,255,.85); border-radius: 10px; }
.viewfinder .laser { position: absolute; left: 70px; right: 70px; top: 50%; height: 2px; background: var(--accent); animation: scanline 1.6s ease-in-out infinite alternate; }
@keyframes scanline { from { transform: translateY(-40px); } to { transform: translateY(40px); } }


/* ---------- piezas de pantallas ---------- */
.stack { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
.kv .row { min-height: 40px; }
.lead-row { border-top: 1px solid var(--border) !important; padding-top: 14px; }
.lead-fig { font-size: var(--fs-lead); line-height: 1.1; font-weight: 600; color: var(--accent); letter-spacing: -0.01em; }
.close-form { display: grid; gap: 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.close-form h3, .h3 { font-size: var(--fs-body); font-weight: 600; margin-bottom: 8px; }
.close-form h3 { margin: 0; }
.diff { height: 38px; display: flex; align-items: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.diff.ok { color: var(--positive); } .diff.bad { color: var(--negative); } .diff.warn { color: var(--warning); }
.sm-btn { height: 28px; padding: 0 8px; font-size: var(--fs-small); }
.input.search { width: 240px; }
.color-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.nm { font-weight: 500; }
td.nowrap { white-space: nowrap; }
.subgroup { margin: 16px 0 8px; color: var(--muted); }
.low-txt { color: var(--warning); }
.warn-txt { color: var(--warning); }
button.cell-box { width: 100%; border: 0; cursor: pointer; font: inherit; font-weight: 500; color: inherit; transition: outline-color var(--t-hover) ease; }
button.cell-box:hover { outline: 1px solid var(--text); }
.curve-key { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cell-box.key { display: inline-grid; width: 28px; height: 22px; font-size: 12px; }
.stock-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-card); }
.stock-trio div { padding: 12px 16px; display: grid; gap: 2px; }
.stock-trio div + div { border-left: 1px solid var(--border); }
.stock-trio b { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.with-add { display: flex; gap: 8px; }
.with-add .input { flex: 1; min-width: 0; }
.big-check { margin: 18px 0 12px; }
.grid-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.grid-tools .spacer { flex: 1; }
.inline-fill { display: inline-flex; align-items: center; gap: 8px; }
.inline-fill .input { width: 64px; }
.fill-row { display: block; margin-top: 2px; }
.fill-row .sm-btn { margin-left: -8px; }
.curve td.cell .cell-note { text-align: center; }
.chip.add { border-style: dashed; }
.mt { margin-top: 20px; }


.read-card { display: grid; gap: 16px; margin-top: 16px; padding: 16px; border-radius: var(--radius-card); background: var(--raised); }
.read-head { display: flex; align-items: center; gap: 12px; }
.read-head b { font-size: 16px; font-weight: 600; }
.read-head .sub { display: block; color: var(--muted); font-size: var(--fs-small); }
.big-input { height: 52px; font-size: 22px; font-weight: 600; }
.effect { min-height: 52px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-variant-numeric: tabular-nums; }
.effect b { font-weight: 600; }

.note-box { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-control); background: var(--raised); }

.table-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px var(--card-pad); border-bottom: 1px solid var(--border); }
.table-head b { font-weight: 600; }
.who-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
tr.void td { color: var(--muted); }
tr.void td.n { text-decoration: line-through; }

.legend-slot { display: flex; gap: 12px; color: var(--muted); font-size: var(--fs-small); }
.chart-note { margin-top: 10px; }

.kpis.five { grid-auto-flow: row; grid-template-columns: 1.35fr repeat(4, minmax(0, 1fr)); }

.logo-box { display: grid; place-items: center; padding: 20px; border-radius: var(--radius-control); background: var(--raised); }
.logo-box img { width: min(300px, 100%); }
.role-list { display: grid; gap: 14px; margin-bottom: 16px; }
.role-list p { color: var(--muted); margin-top: 2px; }
.tag.lg { height: 30px; padding: 0 12px; font-size: var(--fs-body); font-weight: 400; border-radius: 6px; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 16px; }
.color-item { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.color-item .swatch { width: 16px; height: 16px; }
label.row { cursor: pointer; }

.shop-body { background: var(--ground); }
.shop-head .cart-btn { background: #fff; color: #111; border-color: transparent; }
.shop-head .cart-btn b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; display: inline-grid; place-items: center; font-size: 12px; }
.shop-main { min-width: 0; }
.shop-intro { margin-bottom: 20px; }
.shop-intro h1 { font-size: 32px; line-height: 1.1; font-weight: 600; letter-spacing: -0.015em; }
.shop-intro p { margin-top: 8px; color: var(--muted); font-size: 16px; line-height: 24px; max-width: 60ch; }
.pcard .price { margin-top: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pcard .add-btn { width: 100%; margin-top: auto; }
.pcard .add-btn:not([disabled]) { background: var(--primary); color: #fff; border-color: transparent; }
.shop-cart { position: sticky; top: 24px; display: grid; gap: 14px; }
.shop-cart > header { margin-bottom: 0; }
.cart-total { padding-top: 12px; border-top: 1px solid var(--border); }
.cart-total .money { font-size: 22px; }
.shop-foot { background: #000; color: #fff; }
.shop-foot .in { max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.shop-foot .muted { color: #a8a8a8; }
@media (max-width: 1100px) { .shop-cart { position: static; } }

/* ---------- piezas del menú ---------- */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-close { display: none; }
.scope span { display: block; }
.user-row .grow { flex: 1; min-width: 0; display: grid; }
.who-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--text); color: #fff; display: inline-grid; place-items: center; font-weight: 500; }
@media (max-width: 1100px) { .side-close { display: inline-block; } }

/* ---------- personal y asistencia ---------- */
.punch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-card); }
.punch > div { padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.punch > div + div { border-left: 1px solid var(--border); }
.punch b { font-size: 26px; line-height: 1.15; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.punch b.dash { font-weight: 400; color: var(--faint); }
.punch .sub { color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.from-device { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-small); }
.from-device svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.task-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.task-btn { display: grid; gap: 4px; align-content: start; text-align: left; padding: 16px; min-height: 104px; border: 1px solid var(--control); border-radius: var(--radius-card); background: var(--surface); cursor: pointer; transition: background-color var(--t-hover) ease, border-color var(--t-hover) ease; }
.task-btn:hover { background: var(--raised); border-color: var(--text); }
.task-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.task-btn b { font-size: 16px; font-weight: 600; }
.task-btn span { color: var(--muted); font-size: var(--fs-small); line-height: 16px; }
.task-btn.main { background: var(--primary); color: #fff; border-color: transparent; }
.task-btn.main span { color: #c9c9c7; }
.task-btn.main:hover { background: #333; }
.install-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-card); background: var(--surface); border: 1px dashed var(--control); }
.install-card img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.install-card .grow { flex: 1; min-width: 0; display: grid; gap: 4px; }
.install-card ol { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: var(--fs-small); line-height: 18px; }
.photo-thumb { width: 44px; height: 44px; border-radius: 6px; flex: none; background: repeating-linear-gradient(135deg, #e9e8e6 0 6px, #f4f4f3 6px 12px); border: 1px solid var(--border); display: grid; place-items: center; }
.photo-thumb svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.photo-drop { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px dashed var(--control); border-radius: var(--radius-control); background: var(--surface); }
.photo-drop.ok { border-style: solid; border-color: var(--text); }
.lines-list .row .val b { font-weight: 600; }

/* calendario del mes: personas × días */
.cal-wrap { overflow-x: auto; padding: 0 var(--card-pad) var(--card-pad); }
.cal { border-collapse: separate; border-spacing: 2px; width: max-content; min-width: 100%; }
.cal th, .cal td { border: 0; padding: 0; height: auto; vertical-align: middle; }
.cal th { font-size: 11px; line-height: 13px; color: var(--muted); text-align: center; font-weight: 400; padding-bottom: 6px; }
.cal th.we { color: var(--faint); }
.cal th.today { color: var(--text); font-weight: 600; }
.cal td.who { padding-right: 12px; white-space: nowrap; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.cal td.tot { padding-left: 10px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); font-size: var(--fs-small); }
.cal td.tot b { color: var(--text); font-weight: 500; font-size: var(--fs-body); }
.d { display: grid; place-items: center; width: 23px; height: 30px; vertical-align: middle; border-radius: 4px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--raised); color: var(--faint); border: 0; padding: 0; cursor: pointer; }
.d:hover { outline: 1px solid var(--text); }
.d.ok { background: #e6e5e3; color: transparent; }
.d.late { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.d.abs { background: var(--accent); color: #fff; }
.d.leave { background: var(--surface); color: var(--muted); border: 1px solid var(--control); }
.d.hol { background: repeating-linear-gradient(135deg, #f0efed 0 4px, #fafaf9 4px 8px); color: var(--muted); }
.d.off { background: transparent; color: var(--faint); cursor: default; }
.d.off:hover { outline: 0; }
.d.miss { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.d.live { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--text); color: var(--text); }
.d.none { background: transparent; color: var(--faint); cursor: default; }
.cal-key { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 12px var(--card-pad) 0; color: var(--muted); font-size: var(--fs-small); }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.cal-key .d { width: 18px; height: 18px; font-size: 10px; cursor: default; }
.cal-key .d:hover { outline: 0; }
.sched td.t { white-space: nowrap; }
.sched .tag { height: 24px; }
.sched .tag.off { background: transparent; color: var(--faint); border: 1px dashed var(--control); }
.rule-box { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--radius-control); background: var(--raised); }
.rule-box .ln { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rule-box b { font-variant-numeric: tabular-nums; }
.inline-calc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-calc .input { width: 96px; text-align: center; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; list-style: decimal; }
.steps li { padding-left: 4px; }
.mono-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--raised); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--positive); margin-right: 6px; vertical-align: 1px; }

/* ---------- pedidos: curva por entregar, edición y adelanto ---------- */
.curve-block + .curve-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--rule); }
.curve-block .h3 { margin-bottom: 10px; }
.curve-block .curve { width: auto; }
.curve-block .curve td.color { min-width: 160px; }
.curve-block .curve td.cell { width: 60px; }
.curve-block .curve th { min-width: 60px; }
.curve-block .curve td.tot { min-width: 70px; }
.cell-box.blank { background: transparent; border: 1px dashed var(--rule); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sec-head .h3 { margin: 0; }
.wa-msg { padding: 12px 14px; border-radius: 10px 10px 10px 2px; background: var(--raised); border: 1px solid var(--border); line-height: 20px; }
.edit-list { display: grid; gap: 10px; }
.edit-line { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px 12px 12px; display: grid; gap: 8px; }
.el-top { display: flex; align-items: center; gap: 8px; }
.el-top .grow { flex: 1; font-weight: 600; }
.el-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; align-items: end; }
.el-grid .field { gap: 4px; }
.el-grid .input.sm { width: 100%; }
.el-grid .stepper { height: 34px; }
.el-grid .stepper input { width: 40px; }
.print-sheet { font: 11pt/1.35 var(--font); color: #000; }
.print-sheet .ps-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.print-sheet .ps-head img { width: 34mm; }
.print-sheet h1 { font-size: 16pt; margin: 0; }
.print-sheet h2 { font-size: 12pt; margin: 14px 0 6px; }
.print-sheet p { margin: 2px 0 0; color: #333; }
.print-sheet .curve { width: auto; border-collapse: collapse; }
.print-sheet .curve th, .print-sheet .curve td { border: 1px solid #999; padding: 3px 8px; text-align: center; }
.print-sheet .curve td.color { text-align: left; }
.print-sheet .cell-box { display: inline; background: none; height: auto; font-weight: 600; }
.print-sheet .cell-box.none { border: 0; }
.print-sheet .swatch { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-sheet .cell-box.blank { border: 0; }
@media (max-width: 860px) { .el-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .curve-block .curve td.color { min-width: 104px; } .curve-block .curve td.cell, .curve-block .curve th { width: 44px; min-width: 44px; } }

.pedido-banner { padding: 10px 12px; margin: 0 var(--card-pad) 8px; border-radius: var(--radius-control); background: var(--raised); border-left: 3px solid var(--accent); display: grid; gap: 2px; }
.pedido-banner .sub { color: var(--muted); font-size: var(--fs-small); }
.cli-box { display: grid; gap: 4px; padding: 10px var(--card-pad) 2px; border-top: 1px solid var(--rule); margin-top: 8px; }
#cam-venta { display: grid; gap: 14px; }
.cli-box .input { max-width: 170px; }
.cli-box #cli-nom { max-width: 100%; }
.cli-res { align-self: center; min-width: 0; }
dialog.wide { width: min(680px, calc(100vw - 32px)); }
.el-top .segmented { margin-left: auto; }
.el-top .grow { display: grid; }

/* ---------- conteos ---------- */
.bar { display: block; width: 110px; height: 4px; margin: 6px 0 0 auto; border-radius: 2px; background: var(--raised); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text); }
tr.sel td { background: var(--raised); }
.neg-txt { color: var(--accent); }
.role-pick { display: flex; flex-wrap: wrap; gap: 6px; }
label.chip { cursor: pointer; gap: 6px; }
label.chip input { accent-color: var(--text); margin: 0; }
.kpis.flat { box-shadow: none; border: 1px solid var(--border); }
.count-card { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--text); border-radius: var(--radius-card); background: var(--surface); }
.count-card .big-num { font-size: 56px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.count-card .ctrls { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 8px; }
.count-card .ctrls .btn { height: 52px; font-size: 18px; justify-content: center; }
.blind { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--radius-control); background: var(--raised); color: var(--muted); font-size: var(--fs-small); }
.blind svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; }

/* ---------- fotos de la tienda ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.photo-slot { display: grid; gap: 6px; }
.photo-slot .pic { aspect-ratio: 1; border-radius: var(--radius-control); background: var(--raised); display: grid; place-items: center; position: relative; overflow: hidden; }
.photo-slot .pic svg { width: 72%; height: 72%; }
.photo-slot .badge { position: absolute; left: 6px; bottom: 6px; font-size: 11px; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,.92); }
.photo-slot .up { width: 100%; height: 100%; border: 1.5px dashed var(--control); border-radius: var(--radius-control); background: var(--surface); display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--muted); cursor: pointer; font: inherit; }
.photo-slot .up:hover { border-color: var(--text); color: var(--text); }
.photo-slot .up svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.photo-slot .cap { display: flex; align-items: center; gap: 6px; font-size: var(--fs-small); min-width: 0; }
.photo-slot .cap .link-sm { margin-left: auto; border: 0; background: none; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }

/* ---------- teléfono y tableta ---------- */
.menu-toggle { display: none; }
@media (max-width: 1180px) {
  .pos-layout { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1180px) {
  .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.five .kpi + .kpi { border-left: 0; }
  .kpis.five .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpis.five .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  .kpis.five .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 40; background: var(--surface); transform: translateX(-100%); transition: transform var(--t-ui) var(--ease-out); border: 0; }
  .sidebar.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .topbar img { height: 26px; width: auto; }
  .topbar .spacer { flex: 1; }
  .menu-toggle { display: inline-flex; }
  .canvas { padding: 20px 20px 40px; }
  .c8, .c7, .c6, .c5, .c4 { grid-column: span 12; }
  .c3 { grid-column: span 6; }
  .pos-layout { grid-template-columns: minmax(0, 1fr); }
  .ticket { position: static; max-height: none; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: 28px 24px; }
  .login-brand img { margin-top: 8px; width: min(320px, 80%); }
  .shop { grid-template-columns: minmax(0, 1fr); }
}
.show-sm, .sub.show-sm { display: none; }
@media (max-width: 860px) {
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; border-left: 0; }
  .kpis[role="tablist"] .kpi[aria-selected="true"] { background: var(--active); }
  .kpis[role="tablist"] .kpi[aria-selected="true"]::after { content: none; }
  .title-row { flex-wrap: wrap; align-items: flex-start; }
  .fields.two, .fields.four { grid-template-columns: minmax(0, 1fr); }
  .c3 { grid-column: span 12; }
  .canvas { padding: 16px 16px 40px; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .sub.show-sm { display: block; }
  .who-cell { white-space: normal; }
  .summary-strip { gap: 16px; }
  .login-brand p { display: none; }
}
@media (max-width: 480px) {
  .segmented { display: flex; width: 100%; }
  .segmented { overflow-x: auto; }
  .segmented button { flex: 1 0 auto; padding: 0 8px; }
  .btn.big { width: 100%; }
  .scan-row .btn.big { width: auto; }
  .task-btns { grid-template-columns: minmax(0, 1fr); }
  .task-btn { min-height: 0; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; }
  .task-btn svg { grid-row: span 2; margin: 0; }
  .punch b { font-size: 20px; }
  .punch > div { padding: 12px; }
  .kpi { padding: 14px 14px; }
  .kpi-value { font-size: 20px; }
  .kpi.lead .kpi-value { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; } }

/* =====================================================================
   Agregados del sistema (no están en el demo)
   ===================================================================== */
/* La guardia oculta la página hasta comprobar la sesión y el rol */
body[data-roles]:not(.lista) { visibility: hidden; }
html { -webkit-text-size-adjust: 100%; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
dialog, .drawer { overscroll-behavior: contain; }

/* Esqueleto de carga */
.esqueleto { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--raised) 0%, var(--active) 50%, var(--raised) 100%); background-size: 200% 100%; animation: brillo 1.2s linear infinite; }
.esqueleto.linea { height: 14px; margin: 10px 0; }
.esqueleto.bloque { height: 96px; }
@keyframes brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Franja «Sin conexión» */
.sin-conexion { position: fixed; left: 0; right: 0; top: 0; z-index: 60; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--warning); color: #fff; text-align: center; font-weight: 500; font-size: 14px; }
.sin-conexion[hidden] { display: none; }

/* Pantalla de estado completa (error al cargar el perfil, en construcción) */
.estado-pagina { display: grid; place-items: center; min-height: 60svh; text-align: center; gap: 12px; padding: 24px; }
.estado-pagina h2 { font-size: 18px; font-weight: 600; }
.estado-pagina .btn-row { justify-content: center; }
.login-form .error { color: var(--negative); font-size: 14px; min-height: 20px; }
.login-form .aviso-ok { color: var(--muted); font-size: 14px; }

/* Celular: zonas seguras, toque de 44 px, campos de 16 px (iOS no amplía) */
.topbar { padding-top: env(safe-area-inset-top); }
.toast-wrap { bottom: max(20px, env(safe-area-inset-bottom)); }
@media (max-width: 860px) {
  input, select, textarea, .input { font-size: 16px; }
  .btn, .nav-item, .x, .sm-btn { min-height: 44px; }
  .x { min-width: 44px; }
  .canvas { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: max(48px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .esqueleto { animation: none; } }
button.nav-item { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }

/* Caja (F1-E1) */
.results .row.sel { background: var(--active); }
.barra-cobro { display: none; }
@media (max-width: 860px) {
  .barra-cobro { display: flex; position: sticky; bottom: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 12px;
    margin: 16px calc(-1 * max(16px, env(safe-area-inset-left))) 0; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); }
  .barra-cobro .money { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .ticket { position: static; max-height: none; }
}
[hidden] { display: none !important; }
.barra-cobro.oculta { visibility: hidden; }

/* Inventario y curva (F1-E3) */
.swatch.sin-color { background: repeating-linear-gradient(45deg, var(--raised), var(--raised) 3px, var(--border) 3px, var(--border) 6px); }
.curve-block + .curve-block { margin-top: 24px; }
.curva-scroll { overflow-x: auto; }
.curva-scroll .curve td.color { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tot-col { display: block; text-align: center; color: var(--muted); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
th.ordenable { cursor: pointer; user-select: none; }
th.ordenable[aria-sort="ascending"]::after { content: " ↑"; } th.ordenable[aria-sort="descending"]::after { content: " ↓"; }
.pie-totales { display: flex; gap: 20px; flex-wrap: wrap; padding: 12px var(--card-pad); border-top: 1px solid var(--border); color: var(--muted); }
.pie-totales b { color: var(--text); font-variant-numeric: tabular-nums; }
.filters .input, .filters select { max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.filters select.input { flex: 0 1 220px; }
@media (max-width: 860px) { .filters select.input { flex: 1 1 140px; } .filters .search { flex: 1 1 100%; } }
.line.con-error { background: var(--pill-negative-bg); margin: 0 calc(var(--card-pad) * -1); padding-left: var(--card-pad); padding-right: var(--card-pad); }
details.panel > summary { cursor: pointer; list-style: revert; }
/* F2-E1 · catálogos: sub-pestañas desplazables y filas como tarjetas en celular */
.segmented.seg-scroll { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.segmented.seg-scroll button { flex: none; }
.tabla-cat .c-ley { display: none; }
.tabla-cat .input { width: 150px; }
@media (max-width: 900px) {
  .tabla-cat thead { display: none; }
  .tabla-cat .c-ley { display: inline; }
  .tabla-cat, .tabla-cat tbody { display: block; }
  .tabla-cat tr { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .tabla-cat td { display: flex; align-items: center; gap: 10px; padding: 0; border: 0; grid-column: 1 / -1; text-align: left; }
  .tabla-cat td.c-cod { grid-column: 1; }
  .tabla-cat td.c-act { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .tabla-cat td[data-l]::before { content: attr(data-l); flex: 0 0 84px; color: var(--muted); font-size: 13px; }
  .tabla-cat td .input { flex: 1; min-width: 0; width: auto !important; }
}
th.num, td.num { text-align: right; }
.nowrap { white-space: nowrap; }
.actions > :empty { display: none; }
.kpis .lead-fig { font-size: clamp(20px, 6vw, var(--fs-lead)); }

/* ---------- gráficos (F2-E3) ---------- */
.grafico { position: relative; min-width: 0; }
.grafico-svg { display: block; overflow: visible; font-variant-numeric: tabular-nums; }
.grafico-vacio { display: grid; place-items: center; min-height: 120px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius-control); padding: 16px; text-align: center; }
.grafico-tabla { margin-top: 8px; }
.grafico-tabla summary { cursor: pointer; color: var(--muted); font-size: var(--fs-small); }
.grafico-tabla table { margin-top: 6px; }
.chart-legend { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend.col { flex-direction: column; margin: 0; gap: 6px; font-size: 13px; color: var(--text); }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.grafico-lienzo.dona { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.barras-h { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.barras-h li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.barras-h .bh-et { min-width: 0; overflow-wrap: anywhere; }
.barras-h .bh-val { font-variant-numeric: tabular-nums; white-space: nowrap; }
.barras-h .bh-barra { grid-column: 1 / -1; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.barras-h .bh-barra i { display: block; height: 100%; background: var(--chart-muted); }
.barras-h .bh-barra i.uno { background: var(--chart-1); }
.barras-h + .btn { margin-top: 12px; }
.var-pos { color: var(--positive, #1a7f37); }
.var-neg { color: var(--negative); }
.periodo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: var(--gap); }
.periodo-fechas { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.periodo-nota { color: var(--negative); }
.periodo-nota:empty { display: none; }
.kpis.seis { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.seis .kpi + .kpi { border-left: 0; }
.kpis.seis .kpi:not(:nth-child(3n + 1)) { border-left: 1px solid var(--border); }
.kpis.seis .kpi:nth-child(n + 4) { border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .kpis.seis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.seis .kpi { border-left: 0 !important; border-top: 0 !important; }
  .kpis.seis .kpi:nth-child(2n) { border-left: 1px solid var(--border) !important; }
  .kpis.seis .kpi:nth-child(n + 3) { border-top: 1px solid var(--border) !important; }
  .kpis .kpi-value { font-size: clamp(15px, 4.6vw, var(--fs-kpi)); }
}
a.kpi { color: inherit; text-decoration: none; }
a.kpi:hover .kpi-label { text-decoration: underline; }
@media (max-width: 420px) {
  .kpis .kpi { padding: 12px; }
  .kpis .kpi-value { white-space: normal; }
  .kpis .kpi.lead .kpi-value.lead-fig { font-size: clamp(16px, 5vw, 24px); }
}
.barras-h .bh-et .sub { display: block; }

/* ---------- escáner con cámara (F3-E1) ---------- */
.escaner { margin-top: 12px; border-radius: var(--radius-card); background: #111; color: #fff; overflow: hidden; }
.esc-visor { position: relative; aspect-ratio: 16 / 9; max-height: 320px; background: #000; }
.esc-visor video { width: 100%; height: 100%; object-fit: cover; display: block; }
.esc-franja { position: absolute; left: 10%; right: 10%; top: 35%; height: 30%; border: 2px solid rgba(255,255,255,.85); border-radius: 10px; transition: border-color 120ms; }
.esc-franja::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: var(--accent); }
.esc-franja.ok { border-color: #34c759; box-shadow: 0 0 0 4px rgba(52,199,89,.35); }
.esc-franja.error { border-color: #ff3b30; box-shadow: 0 0 0 4px rgba(255,59,48,.35); }
.esc-guia { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: 14px; text-shadow: 0 1px 2px #000; margin: 0; }
.esc-error { padding: 20px; background: var(--surface); color: var(--text); }
.esc-error h3 { margin: 0 0 6px; font-size: 16px; }
.esc-error p { margin: 0; }
.esc-pie { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #1b1b1b; flex-wrap: wrap; }
.esc-pie .esc-ultimo { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.esc-pie .btn { min-height: 44px; }
@media (max-width: 760px) {
  .escaner:not([hidden]) { position: fixed; inset: 0; z-index: 60; margin: 0; border-radius: 0; display: flex; flex-direction: column; height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
  .escaner .esc-visor { flex: 1; aspect-ratio: auto; max-height: none; }
  .escaner .esc-error { flex: 1; }
  body.escaneando { overflow: hidden; }
}
.busca-cam { display: inline-flex; gap: 4px; align-items: stretch; min-width: 0; }
.btn.sm-icono { height: var(--control-height); width: 36px; padding: 0; justify-content: center; }
@media (max-width: 760px) { .btn.sm-icono { height: 44px; width: 44px; } }
.esc-visor video { position: absolute; inset: 0; }
.esc-pie .btn, .esc-pie .btn.primary { background: #fff; color: #141414; border-color: #fff; }
.esc-pie .btn[aria-pressed="true"] { background: #ffd60a; border-color: #ffd60a; }
.esc-franja { box-shadow: 0 0 0 9999px rgba(0,0,0,.38); }
.esc-franja.ok { box-shadow: 0 0 0 4px rgba(52,199,89,.6), 0 0 0 9999px rgba(0,0,0,.38); }
.esc-franja.error { box-shadow: 0 0 0 4px rgba(255,59,48,.6), 0 0 0 9999px rgba(0,0,0,.38); }
.esc-visor { overflow: hidden; }

/* ---------- fotos de la tienda (F3-E4) ---------- */
.photo-slot .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot .pic { aspect-ratio: 4 / 5; }
.photo-slot .up.sobre { position: absolute; inset: 0; border: 0; background: transparent; }
.photo-slot .up.sobre:hover { background: rgba(0,0,0,.08); }
.photo-slot .up[disabled] { cursor: not-allowed; opacity: .7; }
.photo-slot .cap .nombre { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-slot .cap .link-sm + .link-sm { margin-left: 8px; }
.photo-slot .cap .link-sm[disabled] { opacity: .5; }
#sub .falta { color: var(--accent); }
.dlg-foto .foto-previa { display: grid; place-items: center; background: var(--raised); border-radius: var(--radius-control); padding: 8px; }
.dlg-foto .foto-previa img { max-height: 50dvh; width: auto; aspect-ratio: 4 / 5; object-fit: contain; border-radius: 4px; }
.dlg-foto .foto-origen { flex-wrap: wrap; }
.dlg-foto .foto-origen .btn { min-height: 44px; }
.dlg-foto .error { color: var(--negative); }
.dlg-foto .error:empty { display: none; }
.photo-slot .acciones-foto { display: flex; gap: 12px; font-size: var(--fs-small); }
.photo-slot .acciones-foto .link-sm { border: 0; background: none; padding: 6px 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; min-height: 32px; }

/* ---------- pedidos (F3-E5) ---------- */
.drawer.ancho { width: min(760px, 100vw); }
#estados .cuenta { font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums; }
.cliente { overflow-wrap: anywhere; }
.cab-pedido { display: grid; gap: 4px; }
.cab-pedido .cliente { font-size: 18px; font-weight: 600; line-height: 1.25; }
.cab-pedido a { color: var(--text); text-decoration: underline; width: max-content; }
.cab-pedido .nota { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.linea-tiempo { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.linea-tiempo li { border-top: 3px solid var(--border); padding-top: 6px; display: grid; gap: 2px; color: var(--muted); font-size: 13px; }
.linea-tiempo li.si { border-color: var(--text); color: var(--text); }
h3.paso { display: flex; align-items: center; gap: 10px; font-size: 15px; margin-bottom: 10px; }
h3.paso span { width: 24px; height: 24px; border-radius: 50%; background: var(--text); color: #fff; display: grid; place-items: center; font-size: 13px; flex: none; }
h3.paso.hecho span { background: var(--positive); }
.previa-wa { white-space: pre-wrap; font: inherit; background: #e7f6e7; border-radius: 8px; padding: 10px 12px; margin: 10px 0; overflow-wrap: anywhere; }
.lineas-pedido td .sub { display: block; }
.lineas-pedido tr.sin-stock td { background: var(--pill-negative-bg); }
.neg { color: var(--negative); }
.saldo { color: var(--accent); font-size: 22px; }
.total-saldo { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.cab-curva { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.cab-curva .btn-row { margin: 0; flex-wrap: wrap; }
@media (max-width: 640px) { .linea-tiempo { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.drawer .dlg-body { grid-template-columns: minmax(0, 1fr); }
.drawer .dlg-body > * { min-width: 0; }
.lineas-pedido td.n { white-space: nowrap; }
.drawer #cj-t .pill { vertical-align: middle; }
