/* =====================================================================
   Punto de venta · Dulcería — estilos
   Fuentes incluidas en /vendor (funcionan sin internet):
   Atkinson Hyperlegible Next (lectura rápida en caja) y Bricolage Grotesque.
   ===================================================================== */
@font-face { font-family: 'Atkinson'; src: url(../vendor/atkinson-hyperlegible-next-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url(../vendor/atkinson-hyperlegible-next-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url(../vendor/atkinson-hyperlegible-next-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Bricolage'; src: url(../vendor/bricolage-grotesque-latin-wdth-normal.woff2) format('woff2-variations'); font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; }
/* Cifras: los números y el signo de pesos salen de Bricolage (cero sin diagonal, más fáciles de leer en precios). */
@font-face { font-family: 'Cifras'; src: url(../vendor/bricolage-grotesque-latin-wdth-normal.woff2) format('woff2-variations'); font-weight: 200 800; font-stretch: 75% 100%; font-display: swap; unicode-range: U+0024, U+0030-0039; }

:root {
  --canvas: #ecf1ea;
  --surface: #ffffff;
  --surface-2: #f5f8f3;
  --ink: #18291f;
  --ink-2: #4c5e54;
  --ink-3: #7a8a80;
  --line: #d3ddd0;
  --line-2: #e6ece3;
  --clover: #1c7a4a;
  --clover-hover: #156439;
  --clover-deep: #0e4a2e;
  --clover-tint: #e1f0e6;
  --pink: #c9246a;
  --pink-tint: #fbe5ee;
  --marigold: #e39a0c;
  --marigold-tint: #fcf0d6;
  --marigold-ink: #7a4b00;
  --red: #b8392b;
  --red-tint: #f9e2de;
  --focus: #1f6fd1;
  --display: 'Bricolage', 'Segoe UI', system-ui, sans-serif;
  --text: 'Cifras', 'Atkinson', 'Segoe UI', system-ui, sans-serif;
  --r-panel: 12px;
  --r-ctl: 9px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 16px/1.4 var(--text);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--clover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.num, .table td.r, .table th.r { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13.5px; }
.strong { font-weight: 700; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ico { flex: none; display: block; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 92px 1fr; height: 100vh; }
.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 8px 12px;
  overflow-y: auto;
}
.rail-brand { display: grid; place-items: center; padding: 6px 0 12px; }
.rail-brand svg { width: 40px; height: 40px; }
.rail-link {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 2px 8px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none;
  font-size: 12.5px; font-weight: 600; line-height: 1.1; text-align: center;
  border: 0; background: none; cursor: pointer; width: 100%;
}
.rail-link:hover { background: var(--surface-2); color: var(--ink); }
.rail-link[aria-current='page'] { background: var(--clover-tint); color: var(--clover-deep); }
.rail-sep { flex: 1; min-height: 12px; }
.rail-user { font-size: 12px; }
.rail-user .avatar { width: 34px; height: 34px; font-size: 14px; }
.main { min-width: 0; overflow: auto; height: 100vh; }

.screen { padding: 20px 26px 40px; max-width: 1440px; }
.screen-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; min-height: 44px; }
.screen-head h1 {
  font-family: var(--display); font-weight: 700; font-stretch: 86%;
  font-size: 28px; line-height: 1.05; letter-spacing: -0.01em; margin: 0;
}
.screen-head .sub { color: var(--ink-2); font-size: 15px; }
h2.section {
  font-family: var(--display); font-weight: 700; font-stretch: 88%;
  font-size: 19px; margin: 0 0 10px;
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.panel-pad { padding: 16px 18px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15.5px; cursor: pointer; white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: #b8c6b4; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--clover); border-color: var(--clover); color: #fff; }
.btn-primary:hover { background: var(--clover-hover); border-color: var(--clover-hover); }
.btn-danger { color: var(--red); border-color: #e7c3bd; }
.btn-danger:hover { background: var(--red-tint); border-color: #dca79f; }
.btn-danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-lg { min-height: 56px; font-size: 18px; padding: 0 22px; border-radius: 11px; }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: 14px; border-radius: 8px; }
.btn-icon { padding: 0; width: 42px; }
.btn-sm.btn-icon { width: 34px; }
.btn .kbd, .kbd {
  font: 600 12px/1 var(--text); padding: 3px 6px; border-radius: 5px;
  border: 1px solid currentColor; opacity: .7;
}

/* ---------- Formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); }
.field .err { font-size: 13.5px; color: var(--red); font-weight: 600; }
.input {
  width: 100%; min-height: 42px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--r-ctl); background: #fff;
}
textarea.input { min-height: 76px; resize: vertical; }
select.input { padding-right: 30px; }
.input:focus { outline: none; border-color: var(--clover); box-shadow: 0 0 0 3px rgba(28, 122, 74, .18); }
.input.big { font-size: 22px; min-height: 54px; font-variant-numeric: tabular-nums; }
.input.money { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--clover); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 3px; background: var(--surface-2); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; font-weight: 600; cursor: pointer; color: var(--ink-2); display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; flex: none; }
.seg button[aria-pressed='true'] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 50, 30, .15); }

/* ---------- Pestañas ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 14px 11px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
  display: inline-flex; gap: 8px; align-items: center;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected='true'] { color: var(--clover-deep); border-bottom-color: var(--clover); }

/* ---------- Tablas ---------- */
.table-wrap { overflow: auto; border-radius: var(--r-panel); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  text-align: left; font-weight: 600; color: var(--ink-2); font-size: 13.5px;
  padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table th.r, .table td.r { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #f3f7f1; }
.table tr.dim td { color: var(--ink-3); }
.table td .sub { display: block; font-size: 13px; color: var(--ink-3); }

/* ---------- Etiquetas ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.tag.ok { background: var(--clover-tint); color: var(--clover-deep); }
.tag.warn { background: var(--marigold-tint); color: var(--marigold-ink); }
.tag.bad { background: var(--red-tint); color: var(--red); }
.tag.offer { background: var(--pink-tint); color: var(--pink); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 17px; background: var(--clover-tint); color: var(--clover-deep); flex: none;
}

/* ---------- Avisos ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.notice.warn { background: var(--marigold-tint); border-color: #f0d498; color: var(--marigold-ink); }
.notice.bad { background: var(--red-tint); border-color: #eab8b0; color: #7d2318; }
.notice.ok { background: var(--clover-tint); border-color: #bfdcc8; color: var(--clover-deep); }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty .ico { margin: 0 auto 10px; color: var(--ink-3); }

/* ---------- Modales ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(13, 38, 25, .42);
  display: grid; place-items: center; z-index: 60; padding: 16px;
  animation: fade .12s ease-out;
}
.modal {
  background: #fff; border-radius: 14px; width: min(560px, 100%);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(10, 40, 24, .28);
  animation: pop .14s ease-out;
}
.modal.wide { width: min(860px, 100%); }
.modal.xwide { width: min(1100px, 100%); }
.modal.narrow { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 8px; }
.modal-head h2 { font-family: var(--display); font-weight: 700; font-stretch: 88%; font-size: 22px; margin: 0; flex: 1; }
.modal-body { padding: 8px 18px 18px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.975); } }

/* ---------- Notificaciones ---------- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px;
  font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); display: flex; gap: 10px; align-items: center;
  max-width: min(560px, 92vw); animation: pop .14s ease-out;
}
.toast.ok { background: var(--clover-deep); }
.toast.bad { background: var(--red); }
.toast.warn { background: #5c3a00; }
.toast button { background: rgba(255, 255, 255, .16); border: 0; color: #fff; border-radius: 7px; padding: 5px 10px; font-weight: 700; cursor: pointer; }

/* ---------- Pantallas de entrada (configuración y acceso) ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; overflow: auto; height: 100vh; }
.gate-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; width: min(520px, 100%); padding: 28px 30px 26px; }
.gate-card.wide { width: min(760px, 100%); }
.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.gate-brand svg { width: 46px; height: 46px; }
.gate-brand .name { font-family: var(--display); font-weight: 800; font-stretch: 82%; font-size: 26px; line-height: 1; }
.gate h1 { font-family: var(--display); font-weight: 700; font-stretch: 86%; font-size: 26px; margin: 0 0 6px; }
.gate p { margin: 0 0 14px; color: var(--ink-2); }
.choice { display: flex; gap: 14px; align-items: flex-start; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; width: 100%; }
.choice:hover { border-color: var(--clover); background: #f7fbf8; }
.choice.on { border-color: var(--clover); background: #f4faf6; }
.choice input[type=radio] { margin-top: 4px; accent-color: var(--clover); flex: none; }
.choice strong { display: block; font-size: 17px; margin-bottom: 2px; }
.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.user-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.user-tile:hover { border-color: var(--clover); background: #f7fbf8; }
.user-tile .n { font-weight: 700; text-align: center; line-height: 1.2; }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 8px 0 16px; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-3); }
.pin-dots span.on { background: var(--clover); border-color: var(--clover); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.pinpad button { height: 60px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font: 600 24px var(--text); cursor: pointer; }
.pinpad button:hover { background: #e9f0e6; }
.pinpad button.alt { font-size: 15px; color: var(--ink-2); }

/* ---------- Búsqueda ---------- */
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-box .input { padding-left: 42px; }

/* ---------- Venta (caja) ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 384px; height: 100vh; }
.pos-main { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; min-width: 0; min-height: 0; }
.scan { display: flex; gap: 10px; position: relative; }
.scan-box { position: relative; flex: 1; }
.scan-box .ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.scan-box input { font-size: 20px; min-height: 58px; padding-left: 50px; border-width: 2px; border-color: #b9c8b5; border-radius: 12px; }
.scan-box input:focus { border-color: var(--clover); }
.scan-hint { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--ink-3); pointer-events: none; }
.results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: auto; max-height: 52vh;
  box-shadow: 0 18px 40px rgba(10, 40, 24, .18);
}
.result { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line-2); background: #fff; text-align: left; cursor: pointer; }
.result:last-child { border-bottom: 0; }
.result[aria-selected='true'], .result:hover { background: var(--clover-tint); }
.result .n { font-weight: 600; }
.result .c { font-size: 13px; color: var(--ink-3); }

.cart { flex: 1; min-height: 0; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--r-panel); }
.cart-head, .cart-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 156px 104px 112px 40px; gap: 10px; align-items: center;
  padding: 0 14px;
}
.cart-head { position: sticky; top: 0; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--ink-2); min-height: 40px; z-index: 1; }
.cart-row { min-height: 60px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.cart-row.sel { background: #f3faf5; box-shadow: inset 4px 0 0 var(--clover); }
.cart-row .n { font-weight: 600; font-size: 16.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.cart-row .d { font-size: 13px; color: var(--pink); font-weight: 600; }
.cart-row .imp { font-weight: 700; font-size: 17px; text-align: right; font-variant-numeric: tabular-nums; }
.cart-row .pr { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.qty { display: flex; align-items: center; gap: 4px; justify-content: center; }
.qty button { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; }
.qty button:hover { background: var(--surface-2); }
.qty .v { min-width: 48px; text-align: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.cart-empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--ink-2); padding: 30px; }
.cart-empty .big { font-family: var(--display); font-weight: 700; font-stretch: 86%; font-size: 24px; color: var(--ink); margin: 10px 0 6px; }
.keys { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 14px; font-size: 13.5px; color: var(--ink-3); }
.keys span { display: inline-flex; gap: 6px; align-items: center; }

.pos-side { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; padding: 16px; min-height: 0; }
.total-panel { background: var(--clover-deep); color: #fff; border-radius: 16px; padding: 14px 18px 16px; }
.total-panel .lbl { font-size: 15px; color: #b9e0c7; display: flex; justify-content: space-between; }
.total-panel .amount {
  font-family: var(--display); font-weight: 800; font-stretch: 76%;
  font-size: 68px; line-height: 1; letter-spacing: -0.015em; font-variant-numeric: tabular-nums;
  margin: 4px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: clip;
}
.total-panel .amount.long { font-size: 54px; }
.total-panel .meta { font-size: 15px; color: #cfe9d8; display: flex; gap: 12px; flex-wrap: wrap; }
.total-panel.done { background: var(--clover); }
.total-panel .change { font-family: var(--display); font-weight: 800; font-stretch: 76%; font-size: 48px; line-height: 1; font-variant-numeric: tabular-nums; }
.pay-btn { width: 100%; min-height: 64px; font-size: 21px; border-radius: 13px; }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fav-head { display: flex; justify-content: space-between; align-items: baseline; margin-top: 2px; }
.fav-head .label { font-size: 14px; }
.fav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; overflow: auto; min-height: 0; padding-bottom: 4px; align-content: start; }
.fav {
  border: 1px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; text-align: left;
  background: #fff; cursor: pointer; min-height: 78px; display: flex; flex-direction: column; position: relative;
}
.fav-auto { position: absolute; top: 11px; right: 6px; color: var(--ink-3); }
.fav .fav-auto + .n { padding-right: 20px; }
.fav:hover { border-color: var(--cat, var(--clover)); }
.fav .band { height: 7px; background: var(--cat, var(--clover)); }
.fav .n { padding: 6px 8px 0; font-size: 13.5px; font-weight: 600; line-height: 1.2; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fav .p { padding: 2px 8px 7px; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.open-cash { max-width: 440px; margin: 0 auto; }
.open-cash h2 { font-family: var(--display); font-weight: 700; font-stretch: 86%; font-size: 26px; margin: 8px 0 6px; }

.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pay-methods button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 11px; border: 2px solid var(--line); background: #fff; font-weight: 700; cursor: pointer; }
.pay-methods button[aria-pressed='true'] { border-color: var(--clover); background: var(--clover-tint); color: var(--clover-deep); }
.bills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bills button { min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 17px; cursor: pointer; font-variant-numeric: tabular-nums; }
.bills button:hover { background: #e7efe4; }
.pay-total { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; }
.pay-total .v { font-family: var(--display); font-weight: 800; font-stretch: 78%; font-size: 40px; font-variant-numeric: tabular-nums; line-height: 1; }
.change-line { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 2px; font-size: 18px; font-weight: 700; }
.change-line .v { font-family: var(--display); font-weight: 800; font-stretch: 78%; font-size: 34px; font-variant-numeric: tabular-nums; }
.change-line.short { color: var(--red); }

/* ---------- Indicadores ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px 16px; }
.kpi .k { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.kpi .v { font-weight: 600; font-size: 28px; line-height: 1.15; margin-top: 4px; }
.kpi .s { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }

/* Gráficas de una sola serie: columnas y barras horizontales */
.chart { position: relative; padding-left: 64px; }
.chart .grid { position: absolute; left: 64px; right: 0; top: 0; height: 170px; pointer-events: none; }
.chart .grid div { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-2); }
.chart .grid span { position: absolute; right: calc(100% + 8px); transform: translateY(-50%); font-size: 12px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cols { position: relative; display: flex; align-items: flex-end; height: 170px; }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; position: relative; outline-offset: -2px; }
.col .bar { width: calc(100% - 2px); max-width: 24px; background: var(--clover); border-radius: 4px 4px 0 0; min-height: 1px; }
.col.zero .bar { background: var(--line); }
.col:hover .bar, .col:focus .bar { background: #2a9a60; }
.col .tip {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 13px; white-space: nowrap; z-index: 5;
  pointer-events: none; text-align: center; line-height: 1.3;
}
.col .tip strong { display: block; font-size: 15px; }
.col:hover .tip, .col:focus .tip { display: block; }
.col .bar { position: relative; }
.col .cap { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.cols-x { display: flex; margin-top: 6px; }
.cols-x span { flex: 1; text-align: center; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: visible; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hrow { display: grid; grid-template-columns: minmax(110px, 180px) 1fr auto; gap: 4px 12px; align-items: center; }
.hbars .name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14.5px; }
.hbars .name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbars .track { height: 14px; }
.hbars .fill { height: 14px; background: var(--clover); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbars .val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; font-size: 14.5px; white-space: nowrap; }
details.tableview summary { cursor: pointer; color: var(--clover); font-weight: 600; font-size: 14px; margin-top: 10px; }

.sync-pill { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sync-pill .st { position: relative; }
.sync-pill .st .dot { position: absolute; right: -3px; top: -2px; border: 2px solid #fff; width: 11px; height: 11px; }
.spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.kv .total { font-weight: 800; font-size: 18px; }
.divider { border: 0; border-top: 1px solid var(--line-2); margin: 12px 0; }
.steps-list { margin: 0; padding-left: 20px; color: var(--ink-2); }
.steps-list li { margin: 4px 0; }
code.inline { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 14px; }

/* ---------- Impresión de tickets ---------- */
#print-area { display: none; }
@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block; }
  body.printing { background: #fff; overflow: visible; }
}
.tk {
  width: var(--tk-width, 48mm); padding: 0 var(--tk-pad, 1mm);
  font: 400 var(--tk-font, 12px)/1.28 Arial, Helvetica, sans-serif; color: #000; background: #fff;
}
.tk-h { text-align: center; margin-bottom: 1.5mm; }
.tk-name { font-weight: 700; font-size: 1.3em; line-height: 1.15; }
.tk-row { display: flex; justify-content: space-between; gap: 2mm; }
.tk-row span:first-child { min-width: 0; overflow-wrap: anywhere; }
.tk-row span:last-child { text-align: right; white-space: nowrap; }
.tk-sep { border-top: 1px dashed #000; margin: 1.5mm 0; }
.tk-item { margin-bottom: 1mm; }
.tk-desc { font-weight: 700; overflow-wrap: anywhere; }
.tk-total { font-weight: 700; font-size: 1.4em; margin: .5mm 0; }
.tk-strong { font-weight: 700; }
.tk-big { text-align: center; font-weight: 700; font-size: 1.15em; margin: 1mm 0; }
.tk-center { text-align: center; }
.tk-small { font-size: .9em; }
.tk-foot { text-align: center; margin-top: 1mm; }
.tk-season { text-align: center; font-weight: 700; font-size: 1.15em; margin-top: 1mm; }
/* Vista previa del ticket en Ajustes */
.ticket-paper { background: #fff; padding: 14px 10px 18px; width: max-content; margin: 0 auto; box-shadow: 0 1px 0 var(--line), 0 10px 26px rgba(10, 40, 24, .12); border-radius: 4px; }
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; width: 120px; }
.perm-table input { width: 20px; height: 20px; accent-color: var(--clover); }
.perm-table tr.grupo td { background: var(--surface-2); font-weight: 700; color: var(--ink-2); font-size: 13.5px; }
.md { display: flex; gap: 6px; }
.saludos { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.saludo { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.saludo:last-child { border-bottom: 0; }
.saludo.off .input { color: var(--ink-3); }
.grid-ticket { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
.md select { width: auto; min-height: 38px; padding: 4px 26px 4px 8px; }
.tk-ruler { font-family: 'Courier New', monospace; white-space: nowrap; overflow: hidden; }
.tk-sign { margin: 12mm 4mm 2mm; border-top: 1px solid #000; text-align: center; padding-top: 1mm; }
.tk-cut { break-after: page; page-break-after: always; height: 0; }

@media (max-width: 1180px) {
  .scan-hint { display: none; }
  .pos { grid-template-columns: minmax(0, 1fr) 330px; }
  .total-panel .amount { font-size: 56px; }
  .cart-head, .cart-row { grid-template-columns: minmax(0, 1fr) 140px 90px 100px 36px; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; }
  .rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; }
  .rail-brand, .rail-sep { display: none; }
  .rail-link { width: auto; min-width: 72px; }
  .main { height: auto; }
  .pos { grid-template-columns: 1fr; height: auto; }
  .pos-side { border-left: 0; border-top: 1px solid var(--line); }
  .cart { min-height: 260px; }
  .grid-2, .grid-3, .grid-ticket { grid-template-columns: 1fr; }
  .screen { padding: 16px; }
  .hrow { grid-template-columns: 1fr auto; }
  .hrow .track { grid-column: 1 / -1; order: 3; }
  .cart-head, .cart-row { grid-template-columns: minmax(0, 1fr) 128px 0 92px 34px; }
  .cart-head span:nth-child(3), .cart-row .pr { visibility: hidden; overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
