* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0e0e13;
  --panel: #17171f;
  --line: #2a2a36;
  --text: #f2f2f5;
  --dim: #8a8a98;
  --drinks: #1d4ed8;
  --drinks-hi: #3b82f6;
  --bottles: #7e22ce;
  --bottles-hi: #a855f7;
  --go: #16a34a;
  --danger: #ef4444;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  user-select: none;
  touch-action: manipulation; /* kill double-tap zoom delay */
}

button { font-family: inherit; cursor: pointer; }

.layout {
  display: grid;
  grid-template-columns: 1fr minmax(360px, 420px);
  height: 100vh;
}

/* ================= Products ================= */
.products {
  padding: 14px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  align-content: start;
}

.cat-title {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  padding: 6px 2px 0;
}

.tile {
  position: relative;
  height: 130px;
  border: none;
  border-radius: 16px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.06s;
}
.tile.drinks  { background: linear-gradient(160deg, var(--drinks-hi), var(--drinks)); }
.tile.bottles { background: linear-gradient(160deg, var(--bottles-hi), var(--bottles)); }
.tile.packs   { background: linear-gradient(160deg, #f59e0b, #d97706); }
.tile:active { transform: scale(0.95); }
.tile.pop { animation: pop 0.18s; }
@keyframes pop { 40% { transform: scale(1.06); } }

.tile.in-cart { outline: 3px solid #fff6; outline-offset: -3px; }

.tile-name  { font-weight: 800; font-size: 1.2rem; text-align: center; padding: 0 8px; line-height: 1.15; }
.tile-price { font-size: 1.05rem; opacity: 0.9; font-weight: 600; }

.tile-badge {
  position: absolute;
  top: -8px; right: -8px;
  min-width: 34px; height: 34px;
  padding: 0 8px;
  border-radius: 17px;
  background: #fff;
  color: #111;
  font-size: 1.15rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px #0008;
}
.tile-badge[hidden] { display: none; }

/* ================= Sale panel ================= */
.sale {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 10px;
}

.total-display {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: #0a0a0f;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
}
.total-label { font-size: 1rem; font-weight: 700; color: var(--dim); letter-spacing: 0.1em; }
.total-amount {
  font-size: 3.2rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Cart lines */
.cart-items {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  min-height: 60px;
}
.cart-empty {
  color: var(--dim);
  text-align: center;
  padding: 28px 10px;
  font-size: 1rem;
}
.cart-item {
  display: grid;
  grid-template-columns: 48px 34px 48px 1fr auto 44px;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.ci-btn {
  height: 48px;
  border: none;
  border-radius: 10px;
  background: #262632;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}
.ci-btn:active { background: #3a3a4a; }
.ci-qty { text-align: center; font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.ci-name { font-weight: 600; font-size: 1.02rem; padding-left: 6px; }
.ci-mixers { display: block; color: var(--dim); font-weight: 500; font-size: 0.82rem; }
.ci-subtotal { font-variant-numeric: tabular-nums; font-weight: 700; }
.ci-remove { background: #2d1a1a; color: var(--danger); font-size: 1.1rem; height: 44px; }

/* Actions */
.action-row { display: flex; gap: 10px; }
.btn-undo, .btn-clear {
  flex: 1;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1d1d27;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}
.btn-clear { color: var(--danger); }
.btn-clear.armed { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-undo:disabled, .btn-clear:disabled { opacity: 0.35; cursor: default; }
.btn-undo:not(:disabled):active, .btn-clear:not(:disabled):active { background: #2c2c3a; }

.btn-print {
  height: 76px;
  border: none;
  border-radius: 14px;
  background: var(--go);
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}
.btn-print:disabled { background: #23232d; color: #555; cursor: default; }
.btn-print:not(:disabled):active { background: #15803d; transform: scale(0.98); }

.btn-reprint {
  height: 44px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: none;
  color: var(--dim);
  font-size: 0.9rem;
}

.btn-shift {
  height: 36px;
  border: none;
  background: none;
  color: #55556a;
  font-size: 0.82rem;
  text-decoration: underline;
}

/* Mixer picker */
.done-card.mixer-card { max-width: 520px; width: 92vw; align-items: stretch; }
.mixer-title, .mixer-sub { text-align: center; }
.mixer-title { font-size: 1.5rem; }
.mixer-sub { color: var(--dim); }
.mixer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
}
.mixer-btn {
  height: 64px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #1d1d27;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 700;
}
.mixer-btn.active { background: var(--bottles); border-color: var(--bottles-hi); }
.btn-mixer-add {
  flex: 2; height: 60px;
  border: none; border-radius: 12px;
  background: var(--go); color: #fff;
  font-size: 1.15rem; font-weight: 900;
}
.btn-mixer-add:disabled { background: #23232d; color: #555; }
.btn-mixer-add:not(:disabled):active { background: #15803d; }

/* Shift stats extras */
.shift-extra { display: flex; flex-direction: column; gap: 8px; }
.sx-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); margin-top: 4px; }
.sx-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.sx-tag { background: #1d1d27; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 0.9rem; }
.sx-tag b { color: #4ade80; }
.sx-hours { display: flex; align-items: flex-end; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.sx-hour { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 52px; }
.sx-bar { width: 26px; background: var(--drinks-hi); border-radius: 5px 5px 0 0; }
.sx-hl { font-size: 0.78rem; color: var(--dim); }
.sx-hv { font-size: 0.78rem; font-weight: 700; }

/* Shift close overlay */
.shift-card { max-width: 480px; width: 92vw; align-items: stretch; text-align: left; }
.shift-title { font-size: 1.4rem; text-align: center; }
.shift-meta { color: var(--dim); text-align: center; font-size: 0.92rem; }
.shift-table-wrap { max-height: 44vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.shift-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.shift-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.shift-table td:first-child { text-align: right; color: var(--dim); width: 56px; font-variant-numeric: tabular-nums; }
.shift-table td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.shift-total { font-size: 1.5rem; font-weight: 900; text-align: right; }
.shift-actions { display: flex; gap: 10px; }
.btn-shift-back {
  flex: 1; height: 56px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #1d1d27; color: var(--text);
  font-size: 1rem; font-weight: 700;
}
.btn-shift-close {
  flex: 2; height: 56px;
  border: none; border-radius: 12px;
  background: #b45309; color: #fff;
  font-size: 1rem; font-weight: 800;
}
.btn-shift-close:active { background: #92400e; }

/* ================= Done overlay ================= */
.done-overlay {
  position: fixed;
  inset: 0;
  background: #000c;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.done-overlay[hidden] { display: none; }
.done-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 44px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.done-check {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--go);
  color: #fff;
  font-size: 2.6rem;
  font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.done-text { font-size: 1.3rem; font-weight: 800; }
.done-sub { color: var(--dim); }
.btn-new-sale {
  margin-top: 8px;
  height: 64px;
  padding: 0 46px;
  border: none;
  border-radius: 14px;
  background: var(--go);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 900;
}
.btn-new-sale:active { background: #15803d; }

/* ================= Ticket (print only) ================= */
.ticket-print { display: none; }

@media print {
  body > .layout, .done-overlay { display: none !important; }
  body { background: #fff; color: #000; height: auto; overflow: visible; }
  .ticket-print {
    display: block;
    width: 72mm; /* 80mm thermal paper */
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: #000;
  }
  .t-club { font-size: 18px; font-weight: 800; text-align: center; }
  .t-meta { text-align: center; margin: 4px 0; }
  .t-line { display: flex; justify-content: space-between; }
  .t-total { font-weight: 800; font-size: 14px; }
  .t-voucher { text-align: center; margin-top: 8px; }
  .t-vname { font-size: 16px; font-weight: 800; margin: 4px 0 2px; }
  .t-vsub { font-size: 13px; font-weight: 700; }
  .t-vmeta { font-size: 10px; }
}

/* ================= Narrow screens ================= */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .sale { border-left: none; border-top: 1px solid var(--line); max-height: 52vh; }
  .tile { height: 110px; }
  .total-amount { font-size: 2.4rem; }
  .btn-print { height: 64px; }
}
