/* ===================================================================
   Control de Ventas - estilos (mobile first, sin estilos en línea: CSP)
   Idea visual: el ticket de caja. Papel claro sobre fondo gris azulado,
   borde perforado en el acceso, importes en cifras tabulares.
   =================================================================== */
:root {
  --bg: #E6ECF2;
  --paper: #FFFFFF;
  --ink: #16202E;
  --muted: #5A6779;
  --line: #D3DBE5;
  --accent: #2748D9;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3E9FF;
  --warn-bg: #FFF4D6;
  --warn-ink: #7A5300;
  --danger-bg: #FDE6E3;
  --danger-ink: #9B1C12;
  --shadow: 0 1px 2px rgba(22, 32, 46, .08), 0 6px 18px rgba(22, 32, 46, .07);
  --radius: 14px;
  --font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --drawer-w: 288px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1520;
    --paper: #172131;
    --ink: #E8EDF4;
    --muted: #9BA8BA;
    --line: #26344A;
    --accent: #7D97FF;
    --accent-ink: #0E1520;
    --accent-soft: #223056;
    --warn-bg: #3B2F10;
    --warn-ink: #F5D58A;
    --danger-bg: #43201C;
    --danger-ink: #FFB4AA;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .3);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
.icon { flex: none; display: block; }
.muted { color: var(--muted); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: 0 1.25rem;
  border: 0; border-radius: 12px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--primary:active { transform: translateY(1px); }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .65; cursor: progress; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 12px;
  background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: var(--accent-soft); }

.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .4rem; }
.field__label { font-size: .875rem; font-weight: 600; }
.field__box {
  display: flex; align-items: center; gap: .6rem;
  min-height: 50px; padding: 0 .85rem;
  background: var(--bg); color: var(--muted);
  border: 1.5px solid var(--line); border-radius: 12px;
}
.field__box:focus-within { border-color: var(--accent); background: var(--paper); }
.field__box input {
  flex: 1; min-width: 0; height: 48px;
  border: 0; outline: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 1rem; /* 16px: iOS no hace zoom al enfocar */
}
.field__toggle {
  display: grid; place-items: center; width: 40px; height: 40px; margin-right: -.4rem;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.field__toggle[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

.alert {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .75rem .9rem; margin-bottom: 1rem;
  border-radius: 12px; font-size: .9375rem;
}
.alert .icon { margin-top: 2px; }
.form .alert { margin-bottom: 0; }
.alert--error   { background: var(--danger-bg); color: var(--danger-ink); }
.alert--warning { background: var(--warn-bg);   color: var(--warn-ink); }
.alert--success { background: var(--accent-soft); color: var(--accent); }

.chip {
  display: inline-block; margin-top: .6rem; padding: .15rem .65rem;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; font-size: .8125rem; font-weight: 650;
}

/* ---------- Acceso: el ticket ---------- */
.auth__wrap {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 1.25rem;
}
.ticket {
  position: relative;
  width: 100%; max-width: 400px;
  background: var(--paper);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.75rem;
  margin-bottom: 14px;
}
/* borde inferior en dientes de sierra, como un ticket arrancado */
.ticket::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 100%;
  height: 14px;
  background:
    linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 20px 14px repeat-x,
    linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 20px 14px repeat-x;
  filter: drop-shadow(0 3px 3px rgba(22, 32, 46, .06));
}
.ticket__head { display: flex; align-items: center; gap: .9rem; }
.ticket__head h1 { font-size: 1.375rem; }
.ticket__head p { color: var(--muted); font-size: .9375rem; }
.ticket__perf {
  margin: 1.25rem -1.5rem 1.4rem;
  border-top: 2px dashed var(--line);
  position: relative;
}
.ticket__perf::before, .ticket__perf::after {
  content: ""; position: absolute; top: -11px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--bg);
}
.ticket__perf::before { left: -10px; }
.ticket__perf::after  { right: -10px; }

.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand__mark {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
}
.brand__mark--lg { width: 52px; height: 52px; border-radius: 14px; }
.brand__name { font-weight: 700; letter-spacing: -.01em; }

/* ---------- App: barra superior y menú ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .5rem;
  height: 56px; padding: 0 .75rem;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.topbar__title { flex: 1; font-size: 1.0625rem; font-weight: 700; }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: .8125rem; font-weight: 700;
}

.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(10, 16, 26, .55); }
.scrim[hidden] { display: none; }

.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  width: min(var(--drawer-w), 86vw);
  display: flex; flex-direction: column;
  background: var(--paper); box-shadow: var(--shadow);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  visibility: hidden; transform: translateX(-100%);
  transition: transform .22s ease, visibility 0s linear .22s;
}
.drawer.is-open { visibility: visible; transform: none; transition: transform .22s ease; }
.drawer__head {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; padding: 0 .75rem 0 1rem; border-bottom: 1px solid var(--line);
}
.drawer__list { list-style: none; margin: 0; padding: .6rem; display: grid; gap: .15rem; flex: 1; overflow-y: auto; }
.drawer__foot { padding: .6rem; border-top: 1px solid var(--line); display: grid; gap: .15rem; }
.drawer__user { padding: .6rem .8rem 0; font-size: .875rem; font-weight: 600; }
.drawer__user span { color: var(--muted); font-weight: 400; }

.navlink {
  display: flex; align-items: center; gap: .85rem;
  width: 100%; min-height: 48px; padding: 0 .8rem;
  border: 0; border-radius: 12px; background: transparent;
  color: inherit; font: inherit; font-weight: 550; text-decoration: none; text-align: left; cursor: pointer;
}
.navlink:hover { background: var(--accent-soft); }
.navlink.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.page { padding: 1.25rem 1rem 2rem; max-width: 880px; margin: 0 auto; }

/* ---------- Inicio ---------- */
.hello { margin-bottom: 1.25rem; }
.hello h2 { font-size: 1.75rem; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: .75rem; }
.tile {
  display: flex; flex-direction: column; gap: .75rem;
  padding: 1rem; min-height: 124px;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none;
}
.tile:active { transform: translateY(1px); }
.tile__icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.tile__text { display: grid; gap: .15rem; }
.tile__text strong { font-size: 1rem; }
.tile__text small { color: var(--muted); font-size: .8125rem; line-height: 1.35; }

.tile--primary {
  flex-direction: row; align-items: center; gap: 1rem; min-height: 96px;
  background: var(--accent); color: var(--accent-ink);
}
.tile--primary .tile__icon { width: 56px; height: 56px; background: rgba(255, 255, 255, .18); color: inherit; }
.tile--primary .tile__text strong { font-size: 1.25rem; }
.tile--primary .tile__text small { color: inherit; opacity: .85; font-size: .9375rem; }

.empty { padding: 1.25rem; background: var(--paper); border-radius: var(--radius); color: var(--muted); }

/* ---------- Errores ---------- */
.errorbox { display: grid; gap: .75rem; justify-items: start; padding: 2rem 0; }
.errorbox__code { font-family: var(--mono); font-size: 3.5rem; font-weight: 700; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.errorbox h2 { font-size: 1.5rem; }
.auth .errorbox { background: var(--paper); border-radius: var(--radius); padding: 1.75rem; box-shadow: var(--shadow); max-width: 400px; }

/* Cifras de dinero alineadas (se usarán en POS y reportes) */
.num, .money { font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* ---------- Pantallas anchas: el menú queda fijo ---------- */
@media (min-width: 900px) {
  .topbar__menu, .drawer__close, .scrim { display: none !important; }
  .drawer { visibility: visible; transform: none; box-shadow: none; border-right: 1px solid var(--line); }
  .topbar, .page { margin-left: var(--drawer-w); }
  .topbar { padding-left: 1.25rem; }
  .page { margin-right: auto; max-width: 960px; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* =====================================================================
   FASE 2: listas, filtros, insignias y modales
   ===================================================================== */
.lead { margin-bottom: 1rem; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; min-height: 40px; }
.backlink { display: inline-flex; align-items: center; gap: .25rem; min-height: 40px; text-decoration: none; font-weight: 600; color: var(--accent); }
.btn--sm { min-height: 40px; padding: 0 .9rem; font-size: .9375rem; }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn--ghost:hover { background: var(--accent-soft); }
.btn--danger { background: var(--danger-ink); color: var(--paper); }
.icon-btn--danger { color: var(--danger-ink); }
.icon-btn--danger:hover { background: var(--danger-bg); }
.icon-btn[disabled] { opacity: .5; cursor: progress; }

/* Filtros */
.filters { display: grid; gap: .6rem; margin-bottom: 1rem; }
.filters__row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.searchbox { background: var(--paper); }
.searchbox input { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; }
.select {
  width: 100%; min-height: 50px; padding: 0 .85rem;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 12px; font: inherit; font-size: 1rem;
}
.select:focus { border-color: var(--accent); outline: 0; }
.check { display: flex; align-items: center; gap: .65rem; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.check--compact { min-height: 36px; font-size: .9375rem; }

/* Lista de filas */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.item {
  display: flex; align-items: center; gap: .8rem;
  padding: .8rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow);
}
.item.is-off { opacity: .6; }
.item__main { flex: 1; min-width: 0; display: grid; gap: .2rem; }
.item__title { font-size: 1rem; overflow-wrap: anywhere; }
.item__meta, .item__nums { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; font-size: .8125rem; color: var(--muted); }
.item__nums { font-size: .9375rem; color: var(--ink); }
.item__nums .money { font-weight: 700; }
.item__actions { display: flex; flex: none; }
.thumb {
  display: grid; place-items: center; flex: none; overflow: hidden;
  width: 52px; height: 52px; border-radius: 12px; background: var(--bg); color: var(--muted);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb--lg { width: 72px; height: 72px; }
.thumb [hidden] { display: none; }

/* Insignias */
.badge {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 700; white-space: nowrap;
}
.badge--warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge--danger { background: var(--danger-bg); color: var(--danger-ink); }
.badge--off { background: var(--bg); color: var(--muted); }
.chip--sm { margin-top: 0; font-size: .75rem; padding: .05rem .5rem; }

.tiles--one { grid-template-columns: 1fr; }
.tile--row { flex-direction: row; align-items: center; min-height: 80px; }
.tile--row .tile__text { flex: 1; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: 1.25rem; }

/* Modales: hoja inferior en móvil, centrado en pantallas anchas */
dialog.dlg {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: 100%; max-width: 520px; max-height: 100dvh;
  margin: auto auto 0; overflow: visible;
}
dialog.dlg::backdrop { background: rgba(10, 16, 26, .55); }
.sheet {
  background: var(--paper); color: var(--ink);
  border-radius: 20px 20px 0 0;
  padding: 1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom));
  max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain;
}
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.sheet__head h2 { font-size: 1.1875rem; }
.sheet__actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .4rem; }
@media (min-width: 600px) {
  dialog.dlg { margin: auto; }
  .sheet { border-radius: 20px; max-height: 90dvh; }
}
dialog.dlg[open] .sheet { animation: sheet-in .2s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* Formularios en modal */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.field__error { color: var(--danger-ink); font-size: .8125rem; }
.field__error:empty { display: none; }
.field.is-invalid .field__box, .field.is-invalid .select { border-color: var(--danger-ink); }
.hint { color: var(--muted); font-size: .8125rem; }
.form-error[hidden] { display: none; }
form:not(.is-edit) [data-only-edit] { display: none; }
form.is-edit [data-only-new] { display: none; }
.imgpick { display: flex; align-items: center; gap: .9rem; }
.filebtn { cursor: pointer; }
.filebtn input { display: none; }
.btn.is-loading { opacity: .65; cursor: progress; }

/* =====================================================================
   FASE 3: caja
   ===================================================================== */
.panel { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: .9rem; }
.panel__head { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }
.panel__head h2 { font-size: 1.25rem; }
.subtitle { font-size: .9375rem; font-weight: 700; margin: 1.1rem 0 .5rem; }
.subtitle--page { margin: 1.5rem 0 .6rem; font-size: 1rem; }
.panel .subtitle:first-child { margin-top: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); flex: none; }
.dot--on { background: #14A35F; box-shadow: 0 0 0 4px rgba(20, 163, 95, .2); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.kpi { display: grid; gap: .15rem; padding: .75rem .85rem; background: var(--bg); border-radius: 12px; }
.kpi__label { font-size: .75rem; color: var(--muted); font-weight: 600; }
.kpi__value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 1.125rem; font-weight: 700; overflow-wrap: anywhere; }
.kpi--accent { background: var(--accent-soft); }
.kpi--accent .kpi__value { color: var(--accent); }

.kv-list { list-style: none; margin: 0; padding: 0; display: grid; }
.kv-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.kv-list li:last-child { border-bottom: 0; }
.kv { margin: 0; display: grid; }
.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: .9375rem; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.kv__total dt { color: var(--ink); font-weight: 700; }
.kv__total dd { font-size: 1.0625rem; }
.note { margin-top: .6rem; font-size: .875rem; color: var(--muted); }

.actions { display: grid; gap: .6rem; margin-top: 1.25rem; }
@media (min-width: 480px) { .actions { grid-template-columns: 1fr 1fr; } }
.form--spaced { margin-top: 1rem; }
.callout { display: grid; gap: .15rem; padding: .85rem 1rem; background: var(--accent-soft); border-radius: 12px; }
.callout__value { font-family: var(--mono); font-size: 1.5rem; color: var(--accent); font-variant-numeric: tabular-nums; }

a.item { text-decoration: none; color: inherit; }
a.item:active { transform: translateY(1px); }

.status {
  display: flex; align-items: center; gap: .85rem; margin-bottom: .9rem; padding: .85rem 1rem;
  background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none;
}
.status__text { flex: 1; display: grid; }
.status__text small { color: var(--muted); font-size: .8125rem; }
.status--on { border-left: 4px solid #14A35F; }

/* =====================================================================
   FASE 4: punto de venta y ticket
   ===================================================================== */
.btn--lg { min-height: 54px; font-size: 1.0625rem; }
.sheet__actions--one { grid-template-columns: 1fr; }
.backlink--btn { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; margin-bottom: .6rem; }

.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem .9rem; margin-bottom: .8rem; border-radius: 12px; font-size: .9375rem; }
.banner--ok { background: var(--accent-soft); color: var(--accent); }
.banner--warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner[hidden] { display: none; }
.banner__link { font-weight: 700; color: inherit; }

.pos__tools { display: grid; grid-template-columns: 1fr auto; gap: .6rem; }
.pos__tools .searchbox { min-width: 0; }
.results { list-style: none; margin: .5rem 0 0; padding: .35rem; display: grid; gap: .15rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 46vh; overflow-y: auto; }
.results[hidden] { display: none; }
.results--inline { box-shadow: none; border: 1px solid var(--line); margin-top: .6rem; max-height: 50vh; }
.results__empty { padding: .8rem; color: var(--muted); text-align: center; }
.result { display: flex; align-items: center; gap: .75rem; width: 100%; min-height: 56px; padding: .5rem .7rem; text-align: left; background: transparent; color: inherit; border: 0; border-radius: 10px; font: inherit; cursor: pointer; }
.result:hover:not([disabled]) { background: var(--accent-soft); }
.result[disabled] { opacity: .5; cursor: not-allowed; }
.result__main, .result__side { display: grid; gap: .1rem; }
.result__main { flex: 1; min-width: 0; }
.result__side { text-align: right; justify-items: end; }
.result__main strong { overflow-wrap: anywhere; }

.cart { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.cartline { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "main del" "step sub"; gap: .5rem .75rem; align-items: center; padding: .75rem; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.cartline__main { grid-area: main; display: grid; gap: .1rem; min-width: 0; }
.cartline__name { overflow-wrap: anywhere; }
.cartline .icon-btn { grid-area: del; }
.stepper { grid-area: step; display: inline-flex; align-items: center; gap: .25rem; }
.stepper__btn { width: 44px; height: 44px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font-size: 1.25rem; font-weight: 700; cursor: pointer; }
.stepper__btn:active { transform: translateY(1px); }
.stepper__input { width: 64px; height: 44px; text-align: center; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: inherit; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cartline__sub { grid-area: sub; justify-self: end; font-weight: 700; }

.pos__bar { position: sticky; bottom: 0; z-index: 5; display: grid; gap: .6rem; margin: 1rem -1rem -2rem; padding: .85rem 1rem calc(.85rem + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(22, 32, 46, .08); }
.pos__total { display: flex; align-items: baseline; justify-content: space-between; }
.pos__total span { font-weight: 700; color: var(--muted); letter-spacing: .06em; }
.pos__total strong { font-size: 1.75rem; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .pos__bar { margin: 1rem 0 0; border-radius: var(--radius); } }

.grp-list { display: grid; gap: .5rem; margin-bottom: 1rem; }
.grp-list[hidden], #grpProducts[hidden] { display: none; }
.grp-btn { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 1rem; background: var(--bg); color: inherit; border: 0; border-radius: 12px; font: inherit; font-weight: 650; cursor: pointer; }
.grp-btn:hover { background: var(--accent-soft); }
.grp-btn__main { display: flex; align-items: center; gap: .75rem; min-width: 0; }

/* Miniatura chica pero visible (resultados de venta y grupos) */
.mini { display: grid; place-items: center; flex: none; overflow: hidden; width: 44px; height: 44px; border-radius: 10px; background: var(--bg); color: var(--muted); }
.mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini--head { width: 32px; height: 32px; border-radius: 8px; margin-right: .5rem; vertical-align: middle; display: inline-grid; }
.mini--head[hidden] { display: none; }
.sheet__head h2 { display: flex; align-items: center; }

.paylines { display: grid; gap: .5rem; margin-bottom: .6rem; }
.payline { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; align-items: center; }
.payline .icon-btn { grid-column: 1 / -1; justify-self: end; margin-top: -.25rem; }
.payline .field__box input { text-align: right; font-family: var(--mono); }
.summary { margin: .75rem 0; font-weight: 700; font-size: 1.0625rem; }
.summary--ok { color: #0B7A48; }
.summary--bad { color: var(--danger-ink); }
@media (prefers-color-scheme: dark) { .summary--ok { color: #5BE0A0; } }
.more { margin: .5rem 0 1rem; border: 1px dashed var(--line); border-radius: 12px; padding: .25rem .9rem; }
.more summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }

/* Ticket */
.receipt { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; max-width: 420px; margin: 0 auto 1rem; font-size: .9375rem; }
.receipt__head { text-align: center; display: grid; gap: .15rem; margin-bottom: .9rem; padding-bottom: .9rem; border-bottom: 2px dashed var(--line); }
.receipt__head h2 { font-size: 1.25rem; }
.receipt__table { width: 100%; border-collapse: collapse; margin-bottom: .6rem; }
.receipt__table th { text-align: left; font-size: .75rem; color: var(--muted); padding: .3rem 0; border-bottom: 1px solid var(--line); }
.receipt__table td { padding: .4rem 0; vertical-align: top; border-bottom: 1px dotted var(--line); }
.receipt__table .r { text-align: right; padding-left: .5rem; }
.receipt__thanks { text-align: center; margin-top: 1rem; color: var(--muted); }

@media print {
  @page { margin: 6mm; }
  body { background: #fff; color: #000; }
  .topbar, .drawer, .scrim, .no-print, dialog { display: none !important; }
  .page { margin: 0 !important; padding: 0 !important; max-width: none; }
  .receipt { box-shadow: none; max-width: none; padding: 0; background: #fff; color: #000; }
  .receipt .muted { color: #333; }
}

/* =====================================================================
   FASE 5: reportes
   ===================================================================== */
.tabs { display: flex; gap: .35rem; overflow-x: auto; margin: 0 -1rem 1rem; padding: 0 1rem .25rem; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs__item { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border-radius: 999px; background: var(--paper); color: inherit; text-decoration: none; font-weight: 600; box-shadow: var(--shadow); }
.tabs__item.is-active { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chipbtn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 .9rem; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); text-decoration: none; font-size: .9375rem; font-weight: 600; }
.chipbtn.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.filters--report .field__box input[type="date"] { flex: 1; min-width: 0; height: 48px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; }
.rangebar { margin: 0 0 .9rem; }
.panel__row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.panel__row .subtitle { margin: 0; }
.panel--totals .kv__total dd { font-size: 1.125rem; }

.kpis .kpi:first-child { grid-column: 1 / -1; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.bars li { display: grid; grid-template-columns: 3.6rem 1fr auto; align-items: center; gap: .6rem; }
.bars--pay li { grid-template-columns: 1fr auto; row-gap: .15rem; }
.bars--pay .bars__label { grid-column: 1; }
.bars--pay .bars__bar { grid-column: 1 / -1; grid-row: 2; }
.bars--pay .bars__value { grid-column: 2; grid-row: 1; }
.bars--pay .bars__meta { grid-column: 1 / -1; grid-row: 3; }
.bars__label { font-size: .8125rem; color: var(--muted); }
.bars--pay .bars__label { font-size: 1rem; color: var(--ink); font-weight: 600; }
.bars__bar { width: 100%; height: 10px; display: block; }
.bars__bg { fill: var(--bg); }
.bars__fg { fill: var(--accent); }
.bars__value { font-size: .875rem; font-weight: 700; text-align: right; }

.toplist { list-style: none; margin: 0; padding: 0; counter-reset: top; display: grid; }
.toplist li { counter-increment: top; display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.toplist li:last-child { border-bottom: 0; }
.toplist li > span:first-child::before { content: counter(top) ". "; color: var(--muted); font-family: var(--mono); }

.tablewrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: .9rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; min-width: 440px; }
.table th { text-align: left; font-size: .75rem; color: var(--muted); padding: .7rem .75rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .65rem .75rem; vertical-align: top; border-bottom: 1px dotted var(--line); }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; background: var(--bg); }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; white-space: nowrap; }
.prod-name { font-weight: 650; }

/* =====================================================================
   FASE 6: usuarios, tipos de usuario y permisos
   ===================================================================== */
.avatar--lg { width: 44px; height: 44px; font-size: 1rem; flex: none; }
.rol-title { font-size: 1.375rem; margin-bottom: .15rem; }
.matrix { min-width: 520px; }
.matrix th.c, .matrix td.c { text-align: center; white-space: nowrap; }
.matrix tbody th { text-align: left; font-size: .9375rem; font-weight: 650; color: var(--ink); white-space: nowrap; }
.matrix input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--accent); cursor: pointer; }
.matrix input[type="checkbox"][disabled] { cursor: not-allowed; opacity: .45; }
.legend { margin: .9rem 0 1.1rem; padding-left: 1.1rem; color: var(--muted); font-size: .875rem; display: grid; gap: .35rem; }
span.icon-btn { cursor: default; color: var(--muted); }
span.icon-btn:hover { background: transparent; }

/* =====================================================================
   FASE 7: configuración, revisión de seguridad y anulaciones
   ===================================================================== */
.btn--danger-ghost { color: var(--danger-ink); border-color: var(--danger-ink); }
.btn--danger-ghost:hover { background: var(--danger-bg); }
.panel__title { font-size: 1.125rem; margin-bottom: .25rem; }
.health { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .1rem; }
.health__item { display: flex; align-items: flex-start; gap: .75rem; padding: .65rem 0; border-bottom: 1px dashed var(--line); }
.health__item:last-child { border-bottom: 0; }
.health__item .badge { flex: none; min-width: 4.2rem; text-align: center; margin-top: .1rem; }
.health__item div { display: grid; gap: .1rem; }
.health__item small { font-size: .8125rem; line-height: 1.35; }
code { font-family: var(--mono); font-size: .875em; background: var(--bg); padding: .05rem .35rem; border-radius: 6px; }
.receipt__void { text-align: center; margin-top: .9rem; padding: .4rem; border: 2px solid var(--danger-ink); border-radius: 8px; color: var(--danger-ink); font-weight: 800; letter-spacing: .12em; }
.receipt__voidinfo { text-align: center; font-size: .8125rem; margin-top: .3rem; }
.anuladas { color: var(--warn-ink); }
