/* ==========================================================================
   Sakura Latte House · POS
   Pensado para tablet de 10.1" (≈1280×800 en horizontal). Responsive.
   Cambia los colores de la marca aquí:
   ========================================================================== */
:root {
  --blossom: #F195AC;        /* rosa del logo */
  --blossom-deep: #B24A6D;   /* rosa para texto y acentos legibles */
  --petal: #FDEDF2;          /* fondo rosado */
  --paper: #FFFBFC;          /* superficies */
  --matcha: #54833F;         /* verde: acciones de cobro */
  --matcha-deep: #3F6A2E;
  --matcha-soft: #E8F1E1;
  --ink: #3D2A31;            /* texto principal */
  --ink-soft: #7A636C;       /* texto secundario */
  --line: #F1D9E1;
  --danger: #B3261E;
  --danger-soft: #FBEAEA;
  --warn: #9A6200;
  --warn-soft: #FFF1D6;
  --surface: #fff;           /* tarjetas, botones y campos */
  --on-accent: #fff;         /* texto sobre rosa o tinta */
  --go-disabled: #C9D6C1;
  --go-disabled-ink: #F4F8F1;

  --r-lg: 28px;
  --r-md: 18px;
  --r-sm: 12px;
  --shadow: 0 1px 0 rgba(61, 42, 49, .04), 0 8px 24px -12px rgba(178, 74, 109, .28);

  --font-ui: "Quicksand", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-brand: "Fraunces", Georgia, "Times New Roman", serif;

  /* tintes por categoría */
  --c0: #F195AC; --c1: #7FA86A; --c2: #C9A27E; --c3: #A99AD6; --c4: #F0B27A; --c5: #7FB4C9;
  color-scheme: light;
}

/* Modo noche (se activa con el botón de luna; se recuerda en la tablet) */
:root[data-theme="dark"] {
  --blossom: #E98AA3;
  --blossom-deep: #F4A6BA;
  --petal: #1C1417;
  --paper: #261C20;
  --surface: #30242A;
  --matcha: #4E7C3A;
  --matcha-deep: #A5D38D;
  --matcha-soft: #243320;
  --ink: #F6E9EE;
  --ink-soft: #BFA7B0;
  --line: #45343B;
  --danger: #FF8A80;
  --danger-soft: #3A1F20;
  --warn: #F2C063;
  --warn-soft: #3A2E17;
  --on-accent: #1C1417;
  --go-disabled: #2E3A29;
  --go-disabled-ink: #6F7D68;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 8px 24px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  background: var(--petal);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
input { -webkit-user-select: text; user-select: text; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--blossom-deep); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-soft); font-weight: 500; margin: 0; }

/* ---------- botones base ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  font-weight: 700; font-size: 16px; transition: background-color .15s, transform .08s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-block { width: 100%; }
.btn-lg { min-height: 60px; font-size: 18px; }
.btn-go { background: var(--matcha); color: #fff; }
.btn-go:active:not(:disabled) { filter: brightness(.88); }
.btn-go:disabled { background: var(--go-disabled); color: var(--go-disabled-ink); }
.btn-primary { background: var(--blossom-deep); color: var(--on-accent); }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:active { background: var(--petal); }
.btn-icon { width: 48px; min-height: 48px; padding: 0; border-radius: 50%; color: var(--ink-soft); }
.btn-icon:active { background: var(--petal); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.link-btn { color: var(--blossom-deep); font-weight: 700; padding: 10px 4px; min-height: 44px; }
.link-btn:disabled { color: var(--ink-soft); opacity: .5; }
.link-btn.danger { color: var(--danger); }

.field { display: grid; gap: 6px; }
.field-label { font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.field input, .field select {
  height: 56px; padding: 0 18px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface); font-size: 18px; font-weight: 600;
  color: var(--ink); font-family: inherit;
}
.field select { cursor: pointer; }
.field input:focus, .field select:focus { outline: none; border-color: var(--blossom); box-shadow: 0 0 0 4px rgba(241, 149, 172, .25); }
.form-error { color: var(--danger); margin: 0; font-weight: 700; }

/* ---------- teclados ---------- */
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button {
  height: 64px; border-radius: var(--r-md); background: var(--surface); border: 1.5px solid var(--line);
  font-size: 26px; font-weight: 700; font-family: var(--font-ui);
  display: flex; align-items: center; justify-content: center;
}
.keypad button:active { background: var(--petal); border-color: var(--blossom); }
.keypad .k-soft { background: transparent; font-size: 15px; color: var(--ink-soft); }
.keypad svg { width: 28px; height: 28px; }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login { display: grid; grid-template-columns: 1fr minmax(420px, 44%); min-height: 100dvh; }
.login-brand { display: grid; place-items: center; padding: 40px; background: var(--paper); }
.login-logo { width: min(440px, 80%); height: auto; }
.login-panel { display: grid; place-items: center; padding: 28px 40px; }
.login-panel form { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.login-title { font-family: var(--font-brand); font-weight: 500; font-size: 34px; margin: 0; letter-spacing: -.01em; }
.login-msg { margin: -6px 0 0; padding: 12px 16px; border-radius: var(--r-sm); background: var(--matcha-soft); color: var(--matcha-deep); }
.login-msg.is-error { background: var(--danger-soft); color: var(--danger); }

.shift-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border: 0; margin: 0; padding: 0; }
.shift-option input { position: absolute; opacity: 0; pointer-events: none; }
.shift-card {
  display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 16px;
  border-radius: var(--r-md); background: var(--paper); border: 2px solid var(--line); font-weight: 700;
}
.shift-card svg { width: 26px; height: 26px; color: var(--blossom-deep); }
.shift-option input:checked + .shift-card { border-color: var(--blossom-deep); background: var(--surface); box-shadow: var(--shadow); }
.shift-option input:focus-visible + .shift-card { outline: 3px solid var(--blossom-deep); outline-offset: 2px; }

.pin-block { display: grid; gap: 12px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; padding: 4px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--blossom); transition: background-color .12s, transform .12s; }
.pin-dots i.on { background: var(--blossom); transform: scale(1.1); }

/* ==========================================================================
   POS
   ========================================================================== */
.pos-page { height: 100dvh; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }

/* ---------- barra superior ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1.5px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-flower { width: 38px; height: 38px; }
.brand-name { font-family: var(--font-brand); font-size: 28px; font-weight: 500; color: var(--blossom-deep); letter-spacing: -.01em; line-height: 1; }
.shift-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--petal); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw;
}
.shift-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.shift-manana { background: #F0B27A; }
.shift-tarde { background: #A99AD6; }
.demo-chip { padding: 6px 12px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.clock { font-family: var(--font-brand); font-size: 20px; color: var(--ink-soft); padding: 0 6px; font-variant-numeric: tabular-nums; }
.pending-chip { padding: 10px 14px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-weight: 700; min-height: 44px; }
.logout-form { margin: 0; }

/* ---------- distribución ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(330px, 34vw, 430px); min-height: 0; min-width: 0; }
.layout > * { min-width: 0; }

/* ---------- menú: categorías en riel vertical a la izquierda ---------- */
.menu {
  display: grid; min-height: 0;
  grid-template-columns: 176px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "cats head" "cats grid";
}
.cats {
  grid-area: cats; display: flex; flex-direction: column; gap: 6px;
  padding: 14px 10px 20px 14px; overflow-y: auto; scrollbar-width: none;
  border-right: 1.5px solid var(--line); background: var(--paper);
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; min-height: 56px; padding: 8px 12px; border-radius: var(--r-sm);
  font-weight: 700; text-align: left; line-height: 1.2;
  display: flex; align-items: center; gap: 10px; color: var(--ink);
}
.cat::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--tint); }
.cat:active { background: var(--petal); }
.cat.on { background: var(--ink); color: var(--on-accent); }
.menu-head { grid-area: head; display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.search { position: relative; flex: 1; max-width: 360px; }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--ink-soft); width: 20px; height: 20px; }
.search input {
  width: 100%; height: 48px; padding: 0 14px 0 42px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper); font-weight: 600;
}
.search input:focus { outline: none; border-color: var(--blossom); }
.menu-tools { flex: none; margin-left: auto; display: flex; gap: 8px; }
.btn-refresh { flex: none; background: var(--paper); border: 1.5px solid var(--line); }
.btn-custom { min-height: 48px; padding: 0 16px; }
.btn-custom svg { width: 20px; height: 20px; }
.custom-grid { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }
.grid-hint { grid-column: 1 / -1; margin: 0; color: var(--ink-soft); font-weight: 600; }
.grid.is-extras { grid-template-rows: auto; }  /* la fila del aviso no ocupa 112px */

.c0 { --tint: var(--c0); } .c1 { --tint: var(--c1); } .c2 { --tint: var(--c2); }
.c3 { --tint: var(--c3); } .c4 { --tint: var(--c4); } .c5 { --tint: var(--c5); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); grid-auto-rows: 112px;
  grid-area: grid; gap: 12px; padding: 6px 16px 20px; overflow-y: auto; align-content: start; overscroll-behavior: contain;
}
.product {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  padding: 14px 16px 12px 20px; border-radius: var(--r-md); background: var(--surface); text-align: left;
  box-shadow: var(--shadow); overflow: hidden; transition: transform .08s;
}
.product::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--tint); }
.product:active { transform: scale(.96); background: var(--petal); }
.product-name { font-size: 17px; font-weight: 700; line-height: 1.2; }
.product-price { font-family: var(--font-brand); font-size: 19px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.product-count {
  position: absolute; bottom: 12px; right: 12px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px;
  background: var(--blossom-deep); color: var(--on-accent); font-size: 14px; display: grid; place-items: center; z-index: 2;
}
/* producto con foto: la imagen cubre la tarjeta y el texto va encima */
.product.has-img { justify-content: flex-end; gap: 2px; color: #fff; }
.product.has-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(28, 14, 20, .82), rgba(28, 14, 20, .05) 70%); }
.product.has-img::before { z-index: 2; }
.product > span:not(.product-count) { position: relative; z-index: 1; }
.product-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.product.has-img .product-price { color: rgba(255, 255, 255, .88); }
.product.has-img .product-name { text-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.grid-empty { grid-column: 1 / -1; color: var(--ink-soft); padding: 24px 4px; font-weight: 500; }

/* ---------- ticket ---------- */
.ticket {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); min-height: 0;
  background: var(--paper); border-left: 1.5px solid var(--line);
}
.ticket-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 4px; }
.ticket-head h2 { font-family: var(--font-brand); font-weight: 500; font-size: 26px; margin: 0; }
.cart { list-style: none; margin: 0; padding: 4px 12px; overflow-y: auto; overscroll-behavior: contain; }
.cart-empty { display: grid; place-items: center; align-content: center; gap: 10px; padding: 20px 40px; text-align: center; color: var(--ink-soft); font-weight: 500; }
.cart-empty img { width: 72px; opacity: .45; }
.cart-empty p { margin: 0; max-width: 22ch; }

.line {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "info info" "step total";
  gap: 6px 10px; padding: 12px 8px; border-bottom: 1.5px dashed var(--line); align-items: center;
}
.line.bump { animation: bump .35s ease-out; }
@keyframes bump { 0% { background: var(--petal); } 100% { background: transparent; } }
.line-info { grid-area: info; text-align: left; display: grid; gap: 2px; padding: 2px 4px; border-radius: 8px; }
.line-info:active { background: var(--petal); }
.line-name { font-weight: 700; font-size: 17px; }
.line-sub { font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.line-total { grid-area: total; font-family: var(--font-brand); font-size: 18px; font-variant-numeric: tabular-nums; }

.stepper { display: inline-flex; align-items: center; background: var(--petal); border-radius: 999px; padding: 4px; }
.stepper button { width: 48px; height: 48px; border-radius: 50%; font-size: 24px; font-weight: 700; color: var(--blossom-deep); }
.stepper button:active:not(:disabled) { background: var(--surface); }
.stepper button:disabled { opacity: .35; }
.stepper output { min-width: 40px; text-align: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper-sm { grid-area: step; justify-self: start; padding: 2px; }
.stepper-sm button { width: 42px; height: 42px; font-size: 22px; }
.stepper-sm output { min-width: 30px; font-size: 17px; }

.ticket-foot { padding: 12px 20px; padding-bottom: max(16px, env(safe-area-inset-bottom)); border-top: 1.5px solid var(--line); display: grid; gap: 12px; }
.discounts { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.seg { display: flex; flex: 1; max-width: 300px; min-width: 0; background: var(--petal); border-radius: 999px; padding: 3px; }
.seg button { flex: 1 1 auto; height: 40px; padding: 0 6px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink-soft); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(61, 42, 49, .12); }
.totals { margin: 0; display: grid; gap: 4px; }
.totals div { display: flex; justify-content: space-between; }
.totals dt { color: var(--ink-soft); }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.totals .grand { align-items: baseline; padding-top: 4px; }
.totals .grand dt { color: var(--ink); font-size: 18px; }
.totals .grand dd { font-family: var(--font-brand); font-size: 36px; font-weight: 600; letter-spacing: -.01em; }
.btn-charge { min-height: 68px; font-size: 20px; border-radius: var(--r-md); }

/* ==========================================================================
   DIÁLOGOS
   ========================================================================== */
dialog.sheet {
  border: 0; padding: 0; border-radius: var(--r-lg); background: var(--paper); color: var(--ink);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  box-shadow: 0 30px 80px -20px rgba(61, 42, 49, .45);
}
dialog.sheet-wide { width: min(900px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(61, 42, 49, .42); }
dialog[open] { animation: rise .2s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.sheet-body { padding: 22px 26px 26px; display: grid; gap: 18px; margin: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sheet-head h3 { font-family: var(--font-brand); font-weight: 500; font-size: 28px; margin: 0; }
.sheet-foot { display: flex; gap: 12px; justify-content: space-between; }
.sheet-foot .btn { flex: 1; min-height: 56px; }
.qty-row { display: flex; align-items: center; justify-content: space-between; }

.extras { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.extra {
  display: grid; gap: 2px; text-align: left; padding: 12px 14px; min-height: 60px; border-radius: var(--r-sm);
  background: var(--surface); border: 2px solid var(--line);
}
.extra small { color: var(--ink-soft); font-weight: 600; }
.extra[aria-pressed="true"] { border-color: var(--matcha); background: var(--matcha-soft); }

/* ---------- cobro ---------- */
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
#payDlg.is-card .pay-grid { grid-template-columns: 1fr; }
.pay-left { display: grid; gap: 14px; align-content: start; }
.pay-total-label { margin: 0; color: var(--ink-soft); }
.pay-total { margin: -10px 0 4px; font-family: var(--font-brand); font-size: 56px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.methods button {
  height: 56px; border-radius: var(--r-sm); background: var(--surface); border: 2px solid var(--line); font-weight: 700; font-size: 15px;
}
.methods button.on { border-color: var(--matcha); background: var(--matcha-soft); color: var(--matcha-deep); }
.cash-info { display: grid; gap: 8px; padding: 14px 16px; background: var(--surface); border-radius: var(--r-md); border: 1.5px solid var(--line); }
.cash-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cash-line strong { font-family: var(--font-brand); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cash-line.change strong { font-size: 34px; color: var(--matcha-deep); }
.cash-line.short strong { color: var(--danger); font-size: 22px; }
.pay-right { display: grid; gap: 10px; align-content: start; }
.quick { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.quick-btn:first-child { background: var(--matcha-soft); color: var(--matcha-deep); }
.quick-btn { height: 52px; border-radius: var(--r-sm); background: var(--petal); font-weight: 700; font-size: 17px; }
.quick-btn:active { background: var(--blossom); color: var(--on-accent); }
.keypad-cash button { height: 58px; }

/* ---------- cortesía ---------- */
#payDlg.is-courtesy .pay-grid { grid-template-columns: 1fr; }
#payDlg.is-courtesy .methods { display: none; }
.courtesy-note { margin: 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--petal); font-weight: 600; }
.courtesy-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.courtesy-pick button {
  min-height: 88px; border-radius: var(--r-md); background: var(--surface); border: 2px solid var(--line);
  font-family: var(--font-brand); font-size: 26px; font-weight: 500;
}
.courtesy-pick button:active, .courtesy-pick button.on { border-color: var(--blossom-deep); background: var(--petal); }

/* ---------- botón de tema ---------- */
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }

/* ---------- venta lista ---------- */
.done { text-align: center; justify-items: center; }
.done-flower { width: 76px; animation: spin-in .6s cubic-bezier(.2, .8, .2, 1.2); }
@keyframes spin-in { from { transform: rotate(-72deg) scale(.4); opacity: 0; } }
.done h3 { font-family: var(--font-brand); font-weight: 500; font-size: 28px; margin: 0; }
.done-change-label { margin: 0 0 -14px; color: var(--ink-soft); }
.done-change { margin: 0; font-family: var(--font-brand); font-size: 64px; font-weight: 600; color: var(--matcha-deep); font-variant-numeric: tabular-nums; }

/* ---------- ventas del turno ---------- */
.recent { display: grid; max-height: 62dvh; overflow-y: auto; }
.recent-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 4px; border-bottom: 1.5px dashed var(--line); }
.recent-main { display: grid; gap: 4px; min-width: 0; }
.recent-sum { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.recent-right { display: grid; justify-items: end; gap: 2px; flex: none; }
.recent-right strong { font-family: var(--font-brand); font-size: 20px; font-variant-numeric: tabular-nums; }
.recent-row.is-cancelled .recent-sum, .recent-row.is-cancelled strong { text-decoration: line-through; color: var(--ink-soft); }
.tag { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--petal); color: var(--ink-soft); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- cerrar turno ---------- */
.close-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.summary { display: grid; gap: 16px; align-content: start; }
.sum-total { display: grid; gap: 2px; }
.sum-total strong { font-family: var(--font-brand); font-size: 48px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.sum-list { margin: 0; display: grid; }
.sum-list div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1.5px dashed var(--line); }
.sum-list dt { color: var(--ink-soft); }
.sum-list dd { margin: 0; font-variant-numeric: tabular-nums; }
.close-form { display: grid; gap: 14px; align-content: start; }
.cash-line.diff { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface); border: 1.5px solid var(--line); }
.cash-line.diff strong { font-size: 18px; }
.cash-line.diff.ok { border-color: var(--matcha); } .cash-line.diff.ok strong { color: var(--matcha-deep); }
.cash-line.diff.short { border-color: var(--danger); } .cash-line.diff.short strong { color: var(--danger); }
.cash-line.diff.over { border-color: #E3B55C; } .cash-line.diff.over strong { color: var(--warn); }

/* ---------- aviso flotante ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; translate: -50% 20px; opacity: 0; pointer-events: none;
  padding: 14px 22px; border-radius: 999px; background: var(--ink); color: var(--on-accent); font-weight: 700;
  transition: opacity .2s, translate .2s; z-index: 50; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; translate: -50% 0; }
.toast.is-error { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .toast.is-error { color: var(--on-accent); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
/* Tablet 10.1" con densidad alta (≈960×600 CSS) */
@media (max-width: 1100px) {
  .menu { grid-template-columns: 150px minmax(0, 1fr); }
  .discounts { display: grid; gap: 6px; justify-content: stretch; }
  .seg { max-width: none; }
  .btn-ghost { padding: 0 14px; font-size: 15px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: 104px; }
  .shift-chip { max-width: 24vw; }
}
@media (max-height: 640px) and (orientation: landscape) {
  .topbar { padding-block: 4px; }
  .clock { display: none; }
  .ticket-foot { gap: 8px; padding-block: 8px; }
  .totals .grand dd { font-size: 30px; }
  .btn-charge { min-height: 58px; }
  .keypad-cash button { height: 50px; }
  .pay-total { font-size: 46px; }
  .login-brand { padding: 20px; }
  .login-panel form { gap: 12px; }
  .keypad button { height: 54px; }
}

/* Vertical / pantallas angostas: el ticket pasa abajo */
@media (orientation: portrait), (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(260px, 44%); }
  .ticket { border-left: 0; border-top: 1.5px solid var(--line); grid-template-rows: auto 1fr auto; }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 20px 0; background: transparent; }
  .login-logo { width: min(260px, 60%); }
  .login-panel { place-items: start center; }
  .shift-chip { display: none; }
  .menu { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "head" "cats" "grid"; }
  .cats { flex-direction: row; overflow-x: auto; overflow-y: visible; border-right: 0; background: transparent; padding: 0 16px 8px; }
  .cat { min-height: 48px; border-radius: 999px; background: var(--paper); border: 1.5px solid var(--line); white-space: nowrap; }
  .cat.on { border-color: var(--ink); }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding-inline: 10px; }
  .brand-name, .clock { display: none; }
  .btn-ghost { min-height: 44px; padding: 0 12px; font-size: 14px; }
  .pay-grid, .close-grid { grid-template-columns: 1fr; }
  .btn-custom span { display: none; }
  .btn-custom { width: 48px; padding: 0; }
  .pay-total { font-size: 44px; }
  .sheet-body { padding: 18px; }
  .discounts > span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
