/* =========================================================
   POS Cafetería — hoja de estilos
   Paleta: crema, espresso, terracota. Tipos: Fraunces + Figtree (locales).
   ========================================================= */
@font-face { font-family: "Fraunces"; src: url("../fonts/fraunces.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Figtree"; src: url("../fonts/figtree.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  --paper: #f4ede2;
  --paper-2: #ece2d3;
  --card: #fffaf2;
  --ink: #2a1c15;
  --ink-2: #5a4535;
  --muted: #8b7564;
  --line: #e2d5c2;
  --line-2: #d3c3ac;
  --accent: #b5522e;
  --accent-2: #9a4224;
  --accent-soft: #f6dccd;
  --on-accent: #fff7ec;
  --ok: #4d7548;
  --ok-soft: #dfe9d6;
  --warn: #a8701a;
  --warn-soft: #f6e6c4;
  --bad: #a3392a;
  --bad-soft: #f5d6cf;
  --shadow: 0 1px 0 rgba(42, 28, 21, .05), 0 6px 18px -10px rgba(42, 28, 21, .25);
  --radius: 14px;
  --radius-sm: 10px;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --topbar: 58px;
  color-scheme: light;
}
[data-theme="dark"] {
  --paper: #18110d;
  --paper-2: #211813;
  --card: #241a14;
  --ink: #f2e6d6;
  --ink-2: #d2c0aa;
  --muted: #a08b77;
  --line: #3a2b21;
  --line-2: #4b392c;
  --accent: #d9734a;
  --accent-2: #e88a63;
  --accent-soft: #4a2617;
  --on-accent: #1d120c;
  --ok: #8fbf86;
  --ok-soft: #22331f;
  --warn: #e0ac55;
  --warn-soft: #3a2b12;
  --bad: #ec8a78;
  --bad-soft: #43201a;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 22px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15.5px/1.45 var(--sans); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 650; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
a { color: var(--accent); text-underline-offset: 3px; }
code { font: .9em ui-monospace, Menlo, Consolas, monospace; background: var(--paper-2); padding: .1em .35em; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.neg { color: var(--bad); }
.inline { display: inline; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.eyebrow { font: 700 .72rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem; }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 46px; padding: 0 1.15rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink);
  font: 650 1rem/1 var(--sans); text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--bad); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-lg { min-height: 56px; font-size: 1.08rem; padding: 0 1.4rem; }
.btn-sm { min-height: 36px; padding: 0 .8rem; font-size: .9rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: .3rem .2rem; color: var(--accent); font: 600 .95rem var(--sans); cursor: pointer; }
.link-btn.danger { color: var(--bad); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid transparent; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; }
.icon-btn:hover { border-color: var(--line-2); }

input, select, textarea {
  width: 100%; min-height: 46px; padding: .6rem .8rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink); font: 500 1rem var(--sans);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); margin: 0; }
label { display: block; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
label > input, label > select, label > textarea { margin-top: .35rem; }
.form { display: grid; gap: 1rem; }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: .85rem; }
.form legend { font: 650 1.05rem var(--serif); color: var(--ink); margin-bottom: .6rem; padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 600; color: var(--ink); cursor: pointer; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; display: block; margin-top: .25rem; }

/* ---------- Avisos ---------- */
.flash, .banner { padding: .75rem 1rem; border-radius: var(--radius-sm); border: 1.5px solid; font-weight: 550; margin: 0 0 1rem; transition: opacity .6s; }
.flash.fade { opacity: 0; pointer-events: none; }
.flash-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.flash-warn, .banner-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.flash-bad, .banner-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.banner { margin: 0 0 .6rem; font-size: .92rem; }
.banner a { color: inherit; font-weight: 700; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar);
  display: flex; align-items: center; gap: 1.2rem; padding: 0 1rem;
  background: var(--ink); color: var(--paper);
}
[data-theme="dark"] .topbar { background: #0f0a07; border-bottom: 1px solid var(--line); color: var(--ink); }
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; flex: none; }
.brand-name { font: 650 1.12rem var(--serif); letter-spacing: -.01em; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mono {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font: 700 1.05rem var(--serif);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--on-accent) 25%, transparent);
}
.brand-mono-lg { width: 64px; height: 64px; font-size: 1.9rem; }
.brand-logo { height: 34px; width: auto; max-width: 90px; object-fit: contain; border-radius: 6px; background: var(--card); }
.mainnav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  color: color-mix(in srgb, currentColor 72%, transparent); text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: .5rem .75rem; border-radius: 8px; white-space: nowrap;
}
.topbar .mainnav a { color: rgba(244, 237, 226, .72); }
[data-theme="dark"] .topbar .mainnav a { color: var(--muted); }
.topbar .mainnav a:hover { color: var(--paper); background: rgba(255, 255, 255, .07); }
.topbar .mainnav a[aria-current="page"] { color: var(--paper); background: rgba(255, 255, 255, .1); box-shadow: inset 0 -2px 0 var(--accent); }
[data-theme="dark"] .topbar .mainnav a[aria-current="page"], [data-theme="dark"] .topbar .mainnav a:hover { color: var(--ink); }
.topbar-end { display: flex; align-items: center; gap: .6rem; flex: none; }
.topbar .icon-btn { color: inherit; }
.topbar .icon-btn:hover { border-color: rgba(255, 255, 255, .2); }
.topbar .link-btn { color: inherit; opacity: .8; }
.who { display: grid; line-height: 1.1; text-align: right; }
.who-name { font-weight: 650; font-size: .92rem; }
.who-role { font-size: .74rem; opacity: .65; }
.pill { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .7rem; border-radius: 999px; font: 650 .82rem var(--sans); text-decoration: none; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-ok { background: rgba(143, 191, 134, .16); color: #a9d39f; }
.pill-off { background: rgba(236, 138, 120, .16); color: #f2a493; }

/* ---------- Páginas de administración ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 1.6rem 1.2rem 4rem; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.section-head h1 { margin: 0; }
.section-head p { margin: .3rem 0 0; }
.section-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.panel { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 1.2rem; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .8rem; }
.panel-head h2 { margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 1.2rem; align-items: start; }
.cols-even { grid-template-columns: 1fr 1fr; }
.table-wrap { overflow-x: auto; margin: 0 -1.2rem; padding: 0 1.2rem; }
table.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: .55rem .6rem; border-bottom: 1.5px solid var(--line-2); white-space: nowrap; }
.table td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .act { text-align: right; white-space: nowrap; }
.table tr.is-off td { color: var(--muted); }
.table tfoot td { font-weight: 700; border-top: 1.5px solid var(--line-2); }
.tag { display: inline-block; padding: .15rem .5rem; border-radius: 6px; font: 700 .75rem var(--sans); letter-spacing: .02em; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; letter-spacing: .02em; }
.empty { text-align: center; padding: 3rem 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.stat { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat span { display: block; font: 700 .72rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat strong { display: block; font: 650 clamp(1.2rem, 1.9vw, 1.6rem)/1.15 var(--serif); white-space: nowrap; margin-top: .35rem; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); }
.stat-accent { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.stat-accent span, .stat-accent small { color: color-mix(in srgb, var(--paper) 65%, transparent); }
[data-theme="dark"] .stat-accent { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--ink); }
.filters { display: flex; gap: .7rem; align-items: end; flex-wrap: wrap; margin-bottom: 1.2rem; }
.filters label { min-width: 150px; }
.filters .btn { min-height: 46px; }
.bar { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }
.hbars { display: grid; gap: .55rem; }
.hbar { display: grid; grid-template-columns: minmax(96px, 1fr) 2fr minmax(118px, auto); gap: .7rem; align-items: center; font-size: .93rem; }
.hbar .bar { height: 12px; }
.hbar b { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 240px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; justify-content: flex-end; }
.chart .col i { display: block; width: 100%; max-width: 46px; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.chart .col em { font: 600 .72rem var(--sans); font-style: normal; color: var(--ink-2); white-space: nowrap; }
.chart .col small { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.ncf-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.ncf-card { background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: grid; gap: .45rem; position: relative; overflow: hidden; }
.ncf-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--line-2); }
.ncf-card.ok::before { background: var(--ok); }
.ncf-card.warn::before { background: var(--warn); }
.ncf-card.bad::before { background: var(--bad); }
.ncf-card .code { font: 700 1.35rem var(--serif); }
.ncf-card .name { color: var(--muted); font-weight: 600; font-size: .9rem; }
.ncf-card .next { font-size: .9rem; }
.ncf-card .alert { font-size: .85rem; font-weight: 650; }
.ncf-card.warn .alert { color: var(--warn); }
.ncf-card.bad .alert { color: var(--bad); }
.steps { padding-left: 1.2rem; display: grid; gap: .4rem; }
.cash-diff { font: 650 1.4rem var(--serif); }
.cash-diff.ok { color: var(--ok); }
.cash-diff.bad { color: var(--bad); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: .45rem 1rem; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.kv .sep { grid-column: 1 / -1; border-top: 1px dashed var(--line-2); margin: .2rem 0; }
.kv .big { font: 650 1.25rem var(--serif); }
.logo-row { display: flex; gap: 1rem; align-items: center; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.logo-preview { width: 120px; height: 80px; object-fit: contain; border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--paper); padding: 6px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: .4rem; }
input[type="color"] { padding: 4px; height: 46px; }

.denoms { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.denom { margin: 0; display: grid; gap: .25rem; font-size: .78rem; color: var(--muted); }
.denom b { color: var(--ink); font: 650 .95rem var(--serif); }
.denom input { margin: 0; min-height: 44px; text-align: center; }
.close-diff { display: grid; align-content: end; padding-bottom: .3rem; }
@media (max-width: 760px) { .denoms { grid-template-columns: repeat(3, 1fr); } }

.tabs-nav { display: flex; gap: .3rem; margin-bottom: 1.2rem; border-bottom: 1.5px solid var(--line); }
.tabs-nav a { padding: .7rem 1rem; text-decoration: none; color: var(--ink-2); font-weight: 650; border-bottom: 3px solid transparent; margin-bottom: -1.5px; }
.tabs-nav a[aria-current="page"] { color: var(--ink); border-color: var(--accent); }

/* ---------- Login / instalación ---------- */
body.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(1200px 500px at 110% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    repeating-linear-gradient(135deg, transparent 0 22px, color-mix(in srgb, var(--ink) 3%, transparent) 22px 23px),
    var(--paper);
}
.auth-card { width: 100%; max-width: 410px; background: var(--card); border: 1.5px solid var(--line); border-radius: 20px; padding: 2rem 1.8rem; box-shadow: 0 30px 60px -30px rgba(42, 28, 21, .35); }
.auth-card.install { max-width: 640px; }
.auth-hero { text-align: center; margin-bottom: 1.4rem; }
.auth-hero h1 { margin: .8rem 0 .1rem; font-size: 2rem; }
.auth-hero p { margin: 0; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-size: .75rem; }
.auth-logo { max-height: 80px; max-width: 180px; }
.auth-brand { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.3rem; }
.auth-brand h1 { margin: 0; font-size: 1.6rem; }
.auth-brand p { margin: .2rem 0 0; }
.auth-foot { text-align: center; margin: 1.2rem 0 0; }
.req { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .2rem; font-size: .92rem; }
.req .ok { color: var(--ok); }
.req .bad { color: var(--bad); font-weight: 700; }
textarea.code { font: .85rem ui-monospace, Menlo, monospace; }

/* =========================================================
   Pantalla de venta
   ========================================================= */
body.pos-body { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.pos { flex: 1; min-height: 0; display: grid; grid-template-columns: 176px minmax(0, 1fr) minmax(340px, 400px); }

/* Riel de categorías */
.rail { background: var(--paper-2); border-right: 1.5px solid var(--line); padding: .9rem .6rem; display: flex; flex-direction: column; gap: .3rem; overflow-y: auto; }
.rail-btn {
  display: flex; align-items: center; gap: .65rem; width: 100%; min-height: 54px; padding: .5rem .75rem;
  border: 0; border-radius: 12px; background: transparent; color: var(--ink-2);
  font: 650 1rem var(--sans); text-align: left; cursor: pointer;
}
.rail-btn:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.rail-btn[aria-current="true"] { background: var(--ink); color: var(--paper); }
[data-theme="dark"] .rail-btn[aria-current="true"] { background: var(--accent); color: var(--on-accent); }
.rail-swatch { width: 12px; height: 12px; border-radius: 4px; background: var(--c); flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 25%, transparent); }
.rail-btn[aria-current="true"] .rail-swatch { box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.rail-n { margin-left: auto; font-size: .78rem; opacity: .55; font-weight: 700; }

/* Menú */
.menu { min-width: 0; overflow-y: auto; padding: 1rem 1.2rem 2rem; }
.menu-head { display: flex; gap: .7rem; align-items: center; margin-bottom: .9rem; position: sticky; top: -1rem; z-index: 2; background: var(--paper); padding: 1rem 0 .4rem; margin-top: -1rem; }
.search { flex: 1; position: relative; display: block; }
.search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 2.4rem; min-height: 50px; border-radius: 12px; }
#btnTabs { min-height: 50px; white-space: nowrap; }
#btnTabs .count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; background: var(--paper-2); font-size: .82rem; }
#btnTabs.has .count { background: var(--accent); color: var(--on-accent); }
.menu-title { font-size: 1.5rem; margin: .4rem 0 .9rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.grid-empty { color: var(--muted); grid-column: 1 / -1; padding: 2rem 0; }
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: .8rem;
  min-height: 112px; padding: .9rem .9rem .8rem 1rem; text-align: left;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink);
  cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .08s;
  overflow: hidden; font-family: var(--sans);
}
.tile::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.tile:hover { border-color: var(--line-2); }
.tile:active { transform: scale(.98); }
.tile.in-cart { border-color: var(--accent); }
.tile-name { font-weight: 650; font-size: 1.02rem; line-height: 1.2; }
.tile-foot { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; }
.tile-price { font: 600 1.18rem var(--serif); font-variant-numeric: tabular-nums; }
.tile-price::before { content: "RD$ "; font: 600 .72rem var(--sans); color: var(--muted); letter-spacing: .04em; }
.tile-stock { font-size: .72rem; font-weight: 700; color: var(--warn); }
.tile-stock.out { color: var(--bad); }
.tile-n { position: absolute; top: 8px; right: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font: 750 .85rem/26px var(--sans); text-align: center; }
.tile.bump { animation: bump .25s ease; }
@keyframes bump { 50% { transform: scale(.96); } }
.alerts:empty { display: none; }

/* Ticket */
.ticket {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--card); border-left: 1.5px solid var(--line);
}
.ticket-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; padding: 1rem 1.1rem .8rem; border-bottom: 1.5px dashed var(--line-2); }
.ticket-head > div { flex: 1; min-width: 0; }
.ticket-head .eyebrow { margin-bottom: .35rem; }
.table-input { border: 0; background: transparent; padding: 0; min-height: 0; font: 650 1.4rem var(--serif); color: var(--ink); }
.table-input:focus { box-shadow: none; }
.table-input::placeholder { color: var(--line-2); }
.lines { list-style: none; margin: 0; padding: .4rem .5rem; overflow-y: auto; flex: 1; min-height: 0; }
.ticket-empty { flex: 1; padding: 1.4rem 1.2rem; color: var(--ink-2); }
.ticket-empty p { margin: 0 0 .4rem; }
.lines:not(:empty) + .ticket-empty { display: none; }
.line { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line-main { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: .6rem; padding: .75rem .6rem; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; border-radius: 10px; font-family: var(--sans); }
.line-main:hover { background: var(--paper); }
.line-qty { font: 700 1rem var(--sans); color: var(--accent); min-width: 2.1em; }
.line-text { flex: 1; min-width: 0; display: grid; gap: .15rem; }
.line-name { font-weight: 650; }
.line-sub { font-size: .82rem; color: var(--muted); }
.line-amt { font: 600 1.02rem var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.line-steps { display: flex; align-items: center; gap: 4px; padding: 0 .1rem 0 .2rem; }
.line-steps button { width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink); font: 700 1rem/1 var(--sans); cursor: pointer; }
.ticket-foot { border-top: 1.5px dashed var(--line-2); padding: .8rem 1.1rem 1rem; background: linear-gradient(var(--card), var(--paper) 140%); }
.adjust { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.chip { display: inline-flex; align-items: center; gap: .45rem; min-height: 38px; padding: 0 .8rem; border-radius: 99px; border: 1.5px solid var(--line-2); background: transparent; color: var(--ink-2); font: 650 .88rem var(--sans); cursor: pointer; }
.chip-on, .chip-toggle:has(input:checked) { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip-toggle input { width: 16px; height: 16px; }
.totals { margin: 0 0 .8rem; display: grid; gap: .2rem; }
.totals div { display: flex; justify-content: space-between; color: var(--ink-2); font-size: .95rem; }
.totals dt, .totals dd { margin: 0; }
.totals dd { font-variant-numeric: tabular-nums; }
.totals .grand { color: var(--ink); align-items: baseline; margin-top: .3rem; padding-top: .45rem; border-top: 1px solid var(--line); }
.totals .grand dt { font: 700 .78rem var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.totals .grand dd { font: 650 1.75rem var(--serif); }
.ticket-actions { display: grid; grid-template-columns: auto 1fr; gap: .6rem; }
.ticket-actions .btn-ghost { padding: 0 .9rem; white-space: nowrap; }
.ticket-actions .btn-primary { font-size: 1.1rem; white-space: nowrap; }
#payTotal { white-space: nowrap; }
.ticket-bar { display: none; }

/* Diálogos */
dialog.sheet {
  border: 0; padding: 0; border-radius: 20px; background: var(--card); color: var(--ink);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55);
}
dialog.sheet-sm { width: min(430px, calc(100vw - 24px)); }
dialog.sheet-lg { width: min(1000px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(26, 17, 12, .55); }
.sheet-inner { padding: 1.2rem 1.3rem 1.3rem; display: grid; gap: 1rem; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.sheet-head h2 { margin: 0; font-size: 1.45rem; }
.sheet-head form { margin: 0; }
.sheet-foot { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.sheet-foot .btn { flex: 1; }
.qty-row { display: grid; grid-template-columns: 64px 1fr 64px; gap: .6rem; }
.qty-row input { text-align: center; font: 650 1.6rem var(--serif); min-height: 64px; }
.qty-btn { min-height: 64px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--paper); color: var(--ink); font: 600 1.8rem/1 var(--sans); cursor: pointer; }
.mods-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; }
.mod { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; border: 1.5px solid var(--line-2); border-radius: 12px; cursor: pointer; color: var(--ink); min-height: 52px; }
.mod:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mod span { display: flex; flex-direction: column; font-weight: 600; }
.mod em { font-style: normal; font-size: .8rem; color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--paper-2); padding: 4px; border-radius: 12px; }
.seg label { margin: 0; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; min-height: 44px; border-radius: 9px; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.seg input:checked + span { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.quick { display: flex; gap: .5rem; }
.quick button, .cash-quick button { flex: 1; min-height: 46px; border-radius: 10px; border: 1.5px solid var(--line-2); background: var(--paper); color: var(--ink); font: 650 1rem var(--sans); cursor: pointer; }
.quick button:hover, .cash-quick button:hover { border-color: var(--accent); }
.tabs-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; max-height: 60vh; overflow-y: auto; }
.tabs-list li { display: flex; align-items: center; gap: .4rem; }
.tab-item { flex: 1; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: .1rem 1rem; text-align: left; padding: .8rem 1rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); cursor: pointer; font-family: var(--sans); }
.tab-item:hover { border-color: var(--accent); }
.tab-name { font: 650 1.1rem var(--serif); }
.tab-meta { grid-row: 2; font-size: .82rem; color: var(--muted); }
.tab-total { grid-row: 1 / 3; grid-column: 2; align-self: center; font: 650 1.1rem var(--serif); }
.empty-li { padding: 1rem; }

/* Cobro */
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.pay-left, .pay-right { display: grid; gap: .9rem; align-content: start; min-width: 0; }
.pay-left { border-right: 1.5px dashed var(--line-2); padding-right: 1.4rem; }
.ncf-types { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.ncf-opt { margin: 0; cursor: pointer; }
.ncf-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ncf-opt span { display: grid; gap: .05rem; padding: .65rem .8rem; border: 1.5px solid var(--line-2); border-radius: 12px; color: var(--ink); font-weight: 600; min-height: 64px; }
.ncf-opt b { font: 700 1.05rem var(--serif); color: var(--accent); }
.ncf-opt small { font-weight: 500; color: var(--muted); font-size: .76rem; }
.ncf-opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.ncf-opt.disabled span { opacity: .45; cursor: not-allowed; }
.customer-box { display: grid; gap: .6rem; padding: .8rem; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); }
.customer-box.required { border-color: var(--warn); }
.customer-current p { margin: 0; }
.req-text { color: var(--warn); font-weight: 650; }
.cust-chip { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 10px; background: var(--card); border: 1.5px solid var(--ok); }
.cust-chip span { display: grid; }
.cust-chip small { color: var(--muted); }
.cust-results { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; gap: .3rem; max-height: 170px; overflow-y: auto; }
.cust-results button { width: 100%; display: flex; justify-content: space-between; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); text-align: left; cursor: pointer; font: 500 .92rem var(--sans); }
.cust-results small { color: var(--muted); white-space: nowrap; }
.cust-new summary { cursor: pointer; font-weight: 650; color: var(--accent); padding: .2rem 0; }
.cust-new[open] { display: grid; gap: .6rem; }
.cust-new[open] summary { margin-bottom: .3rem; }
.totals-pay { margin: 0; }
.due { display: flex; justify-content: space-between; align-items: baseline; padding: .9rem 1rem; border-radius: 14px; background: var(--ink); color: var(--paper); }
[data-theme="dark"] .due { background: var(--accent-soft); color: var(--ink); }
.due span { font: 700 .75rem var(--sans); letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.due strong { font: 650 2rem var(--serif); font-variant-numeric: tabular-nums; }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.method { min-height: 54px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--paper); color: var(--ink); font: 650 1rem var(--sans); cursor: pointer; }
.method:hover { border-color: var(--accent); color: var(--accent); }
.pay-lines { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.pay-line { display: grid; grid-template-columns: 110px 1fr 1fr 40px; gap: .5rem; align-items: center; }
.pay-line input { min-height: 48px; font: 600 1.1rem var(--sans); }
.pay-line .pay-ref { font: 500 .92rem var(--sans); }
.pay-m { font-weight: 700; }
.cash-quick { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.cash-quick .eyebrow { width: 100%; margin: 0; }
.cash-quick button { flex: 1 0 70px; }
.pay-status { display: grid; gap: .3rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.pay-status div { display: flex; justify-content: space-between; font-size: 1rem; }
.pay-status strong { font-variant-numeric: tabular-nums; }
.pay-status .change { font: 650 1.35rem var(--serif); color: var(--ok); }
.pay-status .change span { font: 700 .9rem var(--sans); align-self: center; }
.pay-error { margin: 0; min-height: 1.2em; color: var(--bad); font-weight: 650; font-size: .92rem; }
.done { text-align: center; justify-items: center; }
.done-mark { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); font-size: 2.2rem; font-weight: 700; }
.done h2 { margin: 0; font-size: 1.7rem; }
.done p { margin: 0; }
.done-ncf { font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem; }
.done-change { font: 600 1.3rem var(--serif); }
.done .sheet-foot { width: 100%; }
.print-frame { position: fixed; width: 0; height: 0; border: 0; visibility: hidden; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100; background: var(--ink); color: var(--paper); padding: .75rem 1.1rem; border-radius: 12px; font-weight: 600; transition: .25s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-bad { background: var(--bad); color: #fff; }
.toast-warn { background: var(--warn); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .pos { grid-template-columns: 150px minmax(0, 1fr) 340px; }
  .who { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }
}
@media (max-width: 900px) {
  .cols, .cols-even { grid-template-columns: 1fr; }
  .pay-grid { grid-template-columns: 1fr; }
  .pay-left { border-right: 0; padding-right: 0; border-top: 1.5px dashed var(--line-2); padding-top: 1rem; }
  .pay-right { order: -1; }
  .brand-name { display: none; }
}
@media (max-width: 760px) {
  :root { --topbar: 54px; }
  .topbar { gap: .6rem; padding: 0 .6rem; }
  .pill { padding: .3rem .5rem; font-size: 0; gap: 0; }
  .pill .dot { width: 10px; height: 10px; }
  .pos { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1.5px solid var(--line); padding: .5rem; }
  .rail-btn { width: auto; min-height: 44px; white-space: nowrap; flex: none; }
  .rail-n { display: none; }
  .menu { padding: .8rem .8rem 90px; }
  .menu-head { top: -.8rem; margin-top: -.8rem; padding-top: .8rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .tile { min-height: 96px; }
  .ticket { position: fixed; inset: var(--topbar) 0 0 0; z-index: 15; transform: translateY(105%); transition: transform .25s ease; border-left: 0; }
  body.show-ticket .ticket { transform: none; }
  .ticket-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 16; align-items: center; justify-content: space-between; gap: .8rem;
    padding: .9rem 1rem calc(.9rem + env(safe-area-inset-bottom)); border: 0; background: var(--ink); color: var(--paper); font: 600 1rem var(--sans); cursor: pointer;
  }
  .ticket-bar #barTotal { font: 650 1.15rem var(--serif); }
  .ticket-bar-cta { background: var(--accent); color: var(--on-accent); padding: .45rem .8rem; border-radius: 9px; font-weight: 700; }
  body.show-ticket .ticket-bar-cta::after { content: " ↓"; }
  body.show-ticket .ticket { bottom: 64px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .wrap { padding: 1.1rem .8rem 3rem; }
  h1 { font-size: 1.5rem; }
  .pay-line { grid-template-columns: 1fr 1fr 40px; }
  .pay-line .pay-m { grid-column: 1 / -1; }
  .pay-line > span:empty { display: none; }
  dialog.sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92dvh; }
}
@media print {
  .topbar, .filters, .section-actions, .no-print { display: none !important; }
  body { background: #fff; }
  .panel, .stat { box-shadow: none; }
}
