/* ---------------------------------------------------------------- tokens -- */
:root {
  --bg: #14100e;
  --bg-2: #1d1815;
  --bg-3: #272019;
  --line: #382e26;
  --ink: #f3ece4;
  --ink-2: #b7a695;
  --brand: #c98a4b;
  --brand-2: #8a5a2b;
  --ok: #4f9d69;
  --warn: #d8a13a;
  --danger: #c8553d;
  --radius: 12px;
  --tap: 48px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body.modal-open { overflow: hidden; }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: var(--tap); padding: 0 1em;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-3); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #1a1208; font-weight: 650; }
.btn.primary:hover { background: #d89a5c; }
.btn.ghost { background: transparent; }
.btn.danger { color: #f0a293; border-color: #5c3229; }
.btn.danger:hover { background: rgba(200, 85, 61, .15); }
.btn.big { min-height: 60px; font-size: 1.05rem; padding: 0 1.6em; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; }

.chip {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .35em .75em; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line);
  font-size: .85rem; color: var(--ink-2); cursor: pointer;
}
.chip.ok { color: #a9dfba; border-color: #2f5a3e; }
.chip.warn { color: #f0cf92; border-color: #6a5426; }
.badge {
  background: var(--brand); color: #1a1208; border-radius: 999px;
  padding: 0 .5em; font-size: .8rem; font-weight: 700;
}

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button {
  min-height: 40px; padding: 0 .9em; border: 0; background: transparent;
  color: var(--ink-2); cursor: pointer;
}
.seg button.on { background: var(--brand); color: #1a1208; font-weight: 650; }

input[type=text], input[type=search], input[type=tel], input[type=number],
input[type=password], input[type=date], select {
  min-height: var(--tap); width: 100%; padding: 0 .8em;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
}
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=color] { min-height: var(--tap); width: 80px; background: none; border: 1px solid var(--line); border-radius: var(--radius); }
label.field { display: grid; gap: .35em; margin-bottom: .9em; }
label.field > span { color: var(--ink-2); font-size: .85rem; }
label.check { display: inline-flex; align-items: center; gap: .5em; margin: .2em .8em .6em 0; cursor: pointer; }
label.check input { width: 20px; height: 20px; }
.hint { color: var(--ink-2); font-size: .9rem; max-width: 70ch; }
.error { color: #f0a293; background: rgba(200, 85, 61, .12); border: 1px solid #5c3229;
         border-radius: var(--radius); padding: .6em .8em; margin: .5em 0; }
.empty { color: var(--ink-2); padding: 1.2em; text-align: center; }
.empty.big { font-size: 1.4rem; padding: 3em; }
.sub { display: block; color: var(--ink-2); font-size: .85rem; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: .5em; vertical-align: middle; }

/* ----------------------------------------------------------------- topbar -- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1em;
  padding: .6em 1em; background: var(--bg-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; }
.shop { font-size: 1.05rem; letter-spacing: .02em; }
.who { color: var(--ink-2); font-size: .9rem; }
.range { display: flex; gap: .4em; flex-wrap: wrap; align-items: center; }
.range input { width: auto; min-width: 150px; }

/* ------------------------------------------------------------------- till -- */
.pos { display: grid; grid-template-columns: 1fr 380px; height: calc(100vh - 61px); }
.menu { display: flex; flex-direction: column; min-width: 0; }
.menu-head { padding: .8em 1em; display: grid; gap: .6em; border-bottom: 1px solid var(--line); }
.cats { display: flex; gap: .5em; overflow-x: auto; padding-bottom: .2em; }
.cat {
  min-height: 42px; padding: 0 1em; white-space: nowrap; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2);
}
.cat.on { background: var(--cat, var(--brand)); border-color: transparent; color: #fff; font-weight: 600; }

.grid {
  flex: 1; overflow-y: auto; padding: 1em;
  display: grid; gap: .8em;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-content: start;
}
.tile {
  position: relative; min-height: 96px; padding: .8em; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between; gap: .4em;
  background: var(--bg-2); color: var(--ink);
  border: 1px solid var(--line); border-left: 4px solid var(--cat, var(--brand)); border-radius: var(--radius);
}
.tile:hover { background: var(--bg-3); }
.tile:active { transform: translateY(1px); }
.tile.out { opacity: .4; }
.tile-name { font-weight: 600; line-height: 1.25; }
.tile-price { color: var(--brand); font-variant-numeric: tabular-nums; }
.tile-stock { font-size: .75rem; color: var(--ink-2); }

.cart { display: flex; flex-direction: column; background: var(--bg-2); border-left: 1px solid var(--line); min-width: 0; }
.cart-head { display: grid; gap: .5em; padding: .8em; border-bottom: 1px solid var(--line); }
.cart-head .seg { width: 100%; }
.cart-head .seg button { flex: 1; }
.cart-meta { display: flex; align-items: center; gap: .6em; padding: .5em .8em; flex-wrap: wrap; }
.order-ref { margin-left: auto; color: var(--brand); font-size: .85rem; }

.lines { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 0 .5em; }
.line { padding: .6em; border-bottom: 1px solid var(--line); }
.line-main { display: flex; justify-content: space-between; gap: .8em; }
.line-name { font-weight: 600; }
.line-mods, .line-note { display: block; color: var(--ink-2); font-size: .82rem; }
.line-total { font-variant-numeric: tabular-nums; white-space: nowrap; }
.line-qty { display: flex; align-items: center; gap: .5em; margin-top: .5em; }
.q {
  min-width: 38px; min-height: 38px; border-radius: 8px; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--ink);
}
.q.del { margin-left: auto; padding: 0 .7em; color: var(--ink-2); }
.q.del:hover { color: #f0a293; }

.totals { padding: .8em; border-top: 1px solid var(--line); display: grid; gap: .35em; }
.totals .row { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.totals .muted { color: var(--ink-2); font-size: .9rem; }
.totals .grand { font-size: 1.3rem; font-weight: 700; padding-top: .3em; border-top: 1px dashed var(--line); }
.cart-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5em; padding: .8em; }
.cart-actions .big { grid-column: span 2; }

/* ----------------------------------------------------------------- modals -- */
.modal {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center; padding: 1em;
}
.sheet {
  width: min(680px, 100%); max-height: 92vh; display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.sheet.narrow { width: min(420px, 100%); }
.sheet > header, .sheet > footer {
  display: flex; align-items: center; gap: .6em; padding: .8em 1em;
}
.sheet > header { border-bottom: 1px solid var(--line); }
.sheet > header h2 { margin: 0; flex: 1; }
.sheet > footer { border-top: 1px solid var(--line); flex-wrap: wrap; }
.sheet > footer .btn:last-child { margin-left: auto; }
.sheet-body { padding: 1em; overflow-y: auto; }
.x { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--ink-2); cursor: pointer; }

.mod-group { margin-bottom: 1.1em; }
.mod-group h3 { color: var(--ink-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; }
.mod-options { display: flex; flex-wrap: wrap; gap: .5em; }
.mod {
  display: flex; flex-direction: column; align-items: flex-start; gap: .1em;
  min-height: 52px; padding: .5em .9em; cursor: pointer;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
}
.mod em { font-style: normal; color: var(--brand); font-size: .8rem; }
.mod.on { background: var(--brand); border-color: var(--brand); color: #1a1208; }
.mod.on em { color: #3a2a10; }
.note-field { display: flex; align-items: center; gap: .5em; flex: 1; color: var(--ink-2); font-size: .85rem; }
.qty-field { display: flex; align-items: center; gap: .6em; }

.pay .due { font-size: 1.1rem; margin-bottom: .8em; }
.pay .due b { font-size: 1.6rem; color: var(--brand); }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em; }
.pay-methods label { display: grid; gap: .3em; color: var(--ink-2); font-size: .85rem; }
.quick { display: flex; flex-wrap: wrap; gap: .5em; margin: .8em 0; }
.pay-summary { display: flex; gap: 2em; padding-top: .6em; border-top: 1px dashed var(--line); }
.pay-summary span { color: var(--ink-2); font-size: .85rem; display: block; }
.pay-summary b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.points-box { margin-top: .8em; display: grid; gap: .3em; }
.points-box span { color: var(--ink-2); font-size: .85rem; }

.list { list-style: none; margin: .6em 0 0; padding: 0; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: .8em;
  padding: .7em; border-bottom: 1px solid var(--line);
}
.row-actions { display: flex; gap: .4em; flex-wrap: wrap; }
.form-row { display: flex; gap: .5em; flex-wrap: wrap; align-items: center; }
.form-row input { flex: 1; min-width: 140px; }
.kv { display: flex; justify-content: space-between; padding: .35em 0; border-bottom: 1px solid var(--line); }

/* -------------------------------------------------------------------- KDS -- */
.tickets {
  display: grid; gap: 1em; padding: 1em; align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.ticket {
  display: flex; flex-direction: column;
  background: var(--bg-2); border: 1px solid var(--line);
  border-top: 5px solid var(--ok); border-radius: var(--radius); overflow: hidden;
}
.ticket.warm { border-top-color: var(--warn); }
.ticket.late { border-top-color: var(--danger); }
.ticket.ready { opacity: .75; }
.ticket > header { display: flex; align-items: center; gap: .6em; padding: .7em .9em; background: var(--bg-3); }
.ticket > header b { font-size: 1.2rem; }
.ticket .type { color: var(--ink-2); text-transform: capitalize; }
.ticket .unpaid {
  padding: .1em .5em; border-radius: 999px; font-size: .75rem; text-transform: uppercase;
  letter-spacing: .06em; background: rgba(216, 161, 58, .18); color: var(--warn);
}
.ticket .age { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ticket-items { list-style: none; margin: 0; padding: 0; flex: 1; }
.ti { display: flex; gap: .7em; padding: .7em .9em; border-bottom: 1px solid var(--line); cursor: pointer; }
.ti:hover { background: var(--bg-3); }
.ti-qty { font-weight: 700; color: var(--brand); }
.ti-body { flex: 1; }
.ti-name { font-size: 1.05rem; }
.ti-mods, .ti-note { display: block; color: var(--ink-2); font-size: .9rem; }
.ti-note { color: var(--warn); }
.ti-state { color: var(--ok); font-size: 1.2rem; }
.ti.preparing { background: rgba(216, 161, 58, .08); }
.ti.done { opacity: .45; text-decoration: line-through; }
.ticket > footer { display: flex; gap: .5em; padding: .7em .9em; }
.ticket > footer .cust { margin-right: auto; color: var(--ink-2); align-self: center; }

/* ------------------------------------------------------- admin & reports -- */
.admin, .report { padding: 1em; max-width: 1200px; margin: 0 auto; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1em; margin-bottom: .8em; flex-wrap: wrap; }
table.data { width: 100%; border-collapse: collapse; margin-top: .5em; }
table.data th, table.data td { text-align: left; padding: .6em .5em; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { color: var(--ink-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
table.data tr.low td { background: rgba(216, 161, 58, .08); }
table.data tr.voided td { opacity: .5; text-decoration: line-through; }
table.data input.small { width: 90px; display: inline-block; margin-right: .4em; }
table.data select { width: auto; display: inline-block; }
.card-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1em;
  padding: .8em; margin-bottom: .5em; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap;
}
.checks { display: flex; flex-wrap: wrap; gap: .4em; }
.opt-rows { display: grid; gap: .5em; }
.opt-row { display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
.opt-row input[type=text] { flex: 1; min-width: 120px; }
.settings { max-width: 480px; }

.stats { display: grid; gap: .8em; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 1em; }
.stat { padding: .9em; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-label { display: block; color: var(--ink-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.card { padding: 1em; margin-bottom: 1em; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.bars { display: grid; gap: .45em; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: .8em; align-items: center; }
.bar-label { color: var(--ink-2); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg-3); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.bar-value { font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------------------ login -- */
.login-page { display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #2a211a, var(--bg) 60%); }
.pinpad { width: min(340px, 92vw); text-align: center; }
.brand .mark { color: var(--brand); font-size: 2rem; }
.brand h1 { margin: .2em 0 0; }
.brand p { color: var(--ink-2); margin: 0 0 1.4em; }
.pin-display { text-align: center; letter-spacing: .4em; font-size: 1.3rem; margin-bottom: .8em; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6em; }
.key {
  min-height: 62px; font-size: 1.3rem; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
}
.key:active { transform: translateY(1px); }
.key.go { background: var(--brand); border-color: var(--brand); color: #1a1208; font-size: 1rem; font-weight: 650; }

/* ----------------------------------------------------------------- toast -- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40;
  padding: .8em 1.2em; background: var(--ok); color: #06210f; font-weight: 600;
  border-radius: 999px; box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.toast.error { background: var(--danger); color: #2a0d07; }

/* --------------------------------------------------------------- receipt -- */
.receipt-page { background: #2a231d; padding: 2em 1em; }
.plain { padding: 2em 1em; }
.card.narrow, .plain .card { width: min(560px, 100%); margin: 0 auto; padding: 1.4em;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.log { color: var(--ink-2); font-size: .9rem; }
.warn { color: var(--warn); }
.receipt {
  width: 80mm; max-width: 100%; margin: 0 auto; padding: 12px 14px;
  background: #fff; color: #111; font-family: "Courier New", monospace; font-size: 12px; line-height: 1.4;
}
.r-head { text-align: center; border-bottom: 1px dashed #999; padding-bottom: 8px; }
.r-head h1 { font-size: 15px; margin: 0 0 4px; letter-spacing: .08em; text-transform: uppercase; }
.r-head p { margin: 0; font-size: 11px; }
.r-meta { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px dashed #999; font-size: 11px; }
.void-stamp { font-weight: 700; letter-spacing: .2em; border: 1px solid #111; padding: 2px 4px; text-align: center; }
.r-items, .r-totals { width: 100%; border-collapse: collapse; }
.r-items td { padding: 3px 0; vertical-align: top; }
.r-items .q { width: 26px; }
.r-items small { display: block; color: #444; font-size: 10px; }
.r-items .a, .r-totals .a { text-align: right; white-space: nowrap; }
.r-totals { border-top: 1px dashed #999; margin-top: 6px; padding-top: 6px; }
.r-totals td { padding: 2px 0; }
.r-totals .grand td { font-size: 14px; font-weight: 700; border-top: 1px solid #111; padding-top: 4px; }
.r-loyalty, .r-foot { text-align: center; margin: 8px 0 0; font-size: 11px; }
.r-foot.small { color: #666; font-size: 10px; }
.r-actions { display: flex; gap: .5em; justify-content: center; margin-top: 14px; }
.r-actions .btn { min-height: 40px; }

@media print {
  .no-print, .topbar { display: none !important; }
  body { background: #fff; }
  .receipt { width: auto; padding: 0; }
  .report, .card, .stat { background: #fff !important; color: #000 !important; border-color: #ccc !important; }
  .stat-label, .bar-label, .bar-value, .hint, .sub { color: #444 !important; }
}

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; height: auto; }
  .cart { border-left: 0; border-top: 1px solid var(--line); position: sticky; bottom: 0; }
  .lines { max-height: 34vh; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .pay-methods { grid-template-columns: 1fr; }
}
