:root {
  --bg: #141115;
  --bg-soft: #1b171c;
  --card: #211c22;
  --card-2: #282229;
  --ink: #f5f1ea;
  --muted: #a79f96;
  --accent: #d84b35;
  --accent-dark: #b93a26;
  --accent-soft: rgba(216, 75, 53, .14);
  --ok: #4caf7d;
  --warn: #e2a63d;
  --line: rgba(245, 241, 234, .09);
  --radius: 16px;
  --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .25);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 40% at 85% -10%, rgba(216, 75, 53, .12), transparent 70%),
    radial-gradient(50% 35% at 0% 100%, rgba(216, 75, 53, .06), transparent 70%);
}
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
[hidden] { display: none !important; }
input, select, textarea { font: inherit; color: var(--ink); }
img { display: block; max-width: 100%; }
a { color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, #e2573f, var(--accent-dark)); color: #fff; font-weight: 700;
  padding: 13px 20px; border-radius: 13px; width: 100%;
  box-shadow: 0 4px 14px rgba(216, 75, 53, .3);
  transition: filter .15s, transform .05s;
}
.btn:active { transform: scale(.985); }
.btn:hover { filter: brightness(1.06); }
.btn.secondary { background: var(--card-2); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--accent); font-weight: 600; width: auto; padding: 8px 12px; box-shadow: none; }
.btn:disabled { opacity: .5; pointer-events: none; }
.badge { display: inline-block; background: var(--card-2); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.price { font-variant-numeric: tabular-nums; font-weight: 600; }
.logo { height: 60px; width: auto; }
.logo.big { height: 120px; }
.status-wrap > .logo { height: 90px; margin: 0 auto 14px; }

/* ---------- customer menu ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(180deg, var(--bg) 82%, transparent);
  padding: 12px 16px 0;
}
.app-header .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.table-chip {
  background: var(--accent); color: #fff; border-radius: 999px; padding: 6px 14px;
  font-size: 13px; font-weight: 800; white-space: nowrap; letter-spacing: .02em;
  box-shadow: 0 3px 10px rgba(216, 75, 53, .35);
}
.searchwrap { padding: 10px 0 2px; }
.searchwrap input {
  width: 100%; padding: 11px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 14.5px;
}
.searchwrap input:focus { outline: none; border-color: var(--accent); }
.search-cat { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.mm-badge {
  display: inline-block; background: var(--accent-soft); color: #ff9c88; border: 1px solid var(--accent);
  border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 700; vertical-align: 2px; margin-left: 6px;
}
.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 10px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  white-space: nowrap; padding: 8px 15px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted);
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.menu-wrap { padding: 4px 16px 120px; max-width: 640px; margin: 0 auto; }
.section-title { font-size: 22px; font-weight: 800; margin: 20px 2px 2px; letter-spacing: .02em; text-transform: uppercase; }
.section-tag { color: var(--muted); font-size: 14px; margin: 0 2px 14px; }
.menu-heading { font-size: 22px; font-weight: 800; text-align: center; margin: 16px 0 16px; letter-spacing: .04em; text-transform: uppercase; }

/* category landing grid */
.back-btn {
  width: 40px; height: 40px; border-radius: 999px; background: var(--card-2);
  border: 1px solid var(--line); font-size: 24px; line-height: 1; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  padding-bottom: 4px;
}
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cat-card {
  position: relative; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  aspect-ratio: 4 / 3; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.cat-card img { width: 100%; height: 100%; object-fit: cover; }
.cat-card .cat-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; text-align: center;
  padding: 12px 10px; background: linear-gradient(transparent 30%, rgba(10, 7, 10, .88));
}
.cat-card .cat-name { font-weight: 800; font-size: 15.5px; text-transform: uppercase; letter-spacing: .03em; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.cat-card .cat-tag { font-size: 11.5px; color: #cfc8bf; margin-top: 2px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.cat-card.noimg { background: radial-gradient(80% 80% at 50% 20%, #322830, var(--card)); }
.cat-card.noimg::before {
  content: ""; position: absolute; inset: 0;
  background: url('/static/favicon.png') center 30%/56px no-repeat; opacity: .16;
}

/* reserved image slots (placeholders until photos are added) */
.thumb.placeholder, .hero-img.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(70% 70% at 50% 40%, #2d252c, var(--card-2));
  border: 1px dashed rgba(245, 241, 234, .14);
}
.thumb.placeholder { width: 86px; height: 86px; border-radius: 12px; flex-shrink: 0; }
.thumb.placeholder img { width: 38px; height: 38px; opacity: .25; }
.hero-img.placeholder { height: 150px; }
.hero-img.placeholder img { width: 64px; height: 64px; opacity: .25; }
.item-card {
  display: flex; gap: 12px; background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line); box-shadow: var(--shadow); padding: 12px; margin-bottom: 10px; cursor: pointer;
}
.item-card .info { flex: 1; min-width: 0; }
.item-card h3 { font-size: 15px; margin-bottom: 3px; }
.item-card p.desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card .price { margin-top: 6px; font-size: 14px; color: #f0c9b1; }
.item-card .thumb { width: 86px; height: 86px; border-radius: 12px; object-fit: cover; flex-shrink: 0; background: var(--card-2); }
.item-card .addbtn {
  position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 19px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .4);
}
.item-card .thumbwrap { position: relative; flex-shrink: 0; }
.item-card.soldout { opacity: .5; cursor: default; }
.item-card.soldout .thumb, .item-card.soldout .thumb.placeholder { filter: grayscale(1); }
.oos-badge {
  display: inline-block; background: #4a2626; color: #ff9c88; border-radius: 999px;
  padding: 2px 9px; font-size: 11px; font-weight: 700; vertical-align: 2px; margin-left: 6px;
}

/* bottom cart bar */
.cart-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 40%);
  max-width: 640px; margin: 0 auto;
}
.cart-bar .btn { display: flex; justify-content: space-between; padding: 15px 20px; }

/* sheets & modals */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(8, 5, 8, .6); z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .2s; backdrop-filter: blur(2px);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; max-width: 640px; margin: 0 auto;
  background: var(--bg-soft); border: 1px solid var(--line); border-bottom: none;
  border-radius: 22px 22px 0 0; max-height: 92dvh;
  display: flex; flex-direction: column;
  transform: translateY(105%); transition: transform .25s cubic-bezier(.3,.9,.3,1);
}
.sheet.open { transform: translateY(0); }
.sheet .sheet-head { padding: 16px 18px 8px; display: flex; justify-content: space-between; align-items: center; }
.sheet .sheet-head h2 { font-size: 18px; }
.sheet .sheet-body { overflow-y: auto; padding: 4px 18px 12px; }
.sheet .sheet-foot { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.x-btn { width: 32px; height: 32px; border-radius: 999px; background: var(--card-2); font-size: 15px; display: flex; align-items: center; justify-content: center; }

.hero-img { width: 100%; height: 190px; object-fit: cover; border-radius: 14px; margin-bottom: 12px; }
.opt-group { margin: 14px 0; }
.opt-group h4 { font-size: 14px; margin-bottom: 8px; }
.opt-group h4 .req { color: var(--warn); font-size: 12px; margin-left: 6px; }
.opt-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 2px;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.opt-row:last-child { border-bottom: none; }
.opt-row input { width: 18px; height: 18px; accent-color: var(--accent); }
.opt-row .price { margin-left: auto; color: var(--muted); font-weight: 500; }
.qty-stepper { display: flex; align-items: center; gap: 14px; }
.qty-stepper button { width: 38px; height: 38px; border-radius: 11px; background: var(--card-2); border: 1px solid var(--line); font-size: 20px; font-weight: 600; }
.qty-stepper span { font-size: 17px; font-weight: 700; min-width: 24px; text-align: center; }
textarea.note {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  font-size: 14px; resize: none; background: var(--card);
}

/* cart lines */
.cart-line { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cart-line .l-info { flex: 1; }
.cart-line .mods { color: var(--muted); font-size: 12.5px; }
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totals-row.grand { font-size: 17px; font-weight: 700; padding-top: 10px; }

/* tip picker */
.tip-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.tip-row .tip {
  flex: 1; text-align: center; padding: 11px 0; border-radius: 11px;
  border: 1.5px solid var(--line); font-weight: 600; font-size: 14px; background: var(--card);
}
.tip-row .tip.active { border-color: var(--accent); background: var(--accent-soft); color: #ff9c88; }

#card-container { margin: 14px 0 4px; min-height: 90px; }
.pay-error { color: #ff8a7a; font-size: 13.5px; margin-top: 8px; min-height: 18px; }

/* status page */
.status-wrap { max-width: 480px; margin: 0 auto; padding: 34px 20px; text-align: center; }
.status-wrap .logo { margin: 0 auto 18px; }
.status-wrap .big { font-size: 52px; margin: 8px 0; }
.status-steps { text-align: left; margin: 26px auto 10px; max-width: 300px; }
.status-step { display: flex; gap: 12px; align-items: center; padding: 9px 0; color: var(--muted); font-weight: 600; }
.status-step .dot { width: 14px; height: 14px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); flex-shrink: 0; }
.status-step.done { color: var(--ink); }
.status-step.done .dot { background: var(--ok); border-color: var(--ok); }
.status-step.now { color: #ff9c88; }
.status-step.now .dot { background: var(--accent); border-color: var(--accent); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(216, 75, 53, .22); } }

.waiter-fab {
  position: fixed; right: 14px; bottom: 86px; z-index: 35;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 999px; padding: 10px 15px; font-size: 13px; font-weight: 700;
}
.waiter-fab.active { background: var(--accent-soft); border-color: var(--accent); color: #ff9c88; }

/* ---------- KDS ---------- */
.kds { background: #100e11; color: #f2efe9; min-height: 100dvh; }
.kds header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; border-bottom: 1px solid #292430; position: sticky; top: 0; background: #100e11; z-index: 5;
}
.kds header .brand { display: flex; align-items: center; gap: 14px; }
.kds header .brand img { height: 40px; }
.kds header h1 { font-size: 19px; text-transform: uppercase; letter-spacing: .07em; }
.kds .grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px; padding: 16px;
}
.ticket {
  background: #1e1a20; border-radius: 14px; overflow: hidden;
  border: 1px solid #2b2530; border-top: 5px solid var(--warn); display: flex; flex-direction: column;
}
.ticket.NEW { border-top-color: #e05c41; }
.ticket.PREPARING { border-top-color: var(--warn); }
.ticket.READY { border-top-color: var(--ok); }
.ticket .t-head { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px 6px; }
.ticket .t-head .table { font-size: 22px; font-weight: 800; }
.ticket .t-head .meta { text-align: right; font-size: 12px; color: #a39b8d; }
.ticket ul { list-style: none; padding: 4px 14px 10px; flex: 1; }
.ticket li { padding: 7px 0; border-bottom: 1px dashed #363040; font-size: 15px; }
.ticket li:last-child { border-bottom: none; }
.ticket li .qty { font-weight: 800; color: var(--warn); margin-right: 8px; }
.ticket li .mods, .ticket li .note { display: block; font-size: 12.5px; color: #b0a898; padding-left: 26px; }
.ticket li .note { color: #e0b568; }
.ticket .t-actions { display: flex; border-top: 1px solid #2b2530; }
.ticket .t-actions button { flex: 1; padding: 13px 0; font-weight: 700; font-size: 14px; color: #f2efe9; }
.ticket .t-actions button + button { border-left: 1px solid #2b2530; }
.ticket .t-actions .primary { background: var(--ok); color: #08130d; }
.ticket .t-actions .print { flex: 0 0 54px; }
.kds .empty { grid-column: 1/-1; text-align: center; padding: 80px 0; color: #6f695f; font-size: 17px; }
.waiter-toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 90;
  background: var(--accent); color: #fff; font-weight: 800; padding: 14px 26px;
  border-radius: 13px; font-size: 17px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
}

/* ---------- admin ---------- */
.admin { max-width: 860px; margin: 0 auto; padding: 24px 18px 80px; }
.admin .head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.admin h1 { font-size: 22px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 16px; margin-bottom: 12px; }
.panel .hint { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field input[type=text], .field input[type=number], .field input[type=password], .field input[type=url] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg-soft);
}
.route-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.route-row { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px; font-size: 13.5px; background: var(--bg-soft); }
.route-row select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font-size: 13px; background: var(--card-2); }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.qr-cell { text-align: center; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; color: #222; }
.qr-cell .t { font-weight: 800; margin-bottom: 6px; }
.qr-cell img, .qr-cell canvas { margin: 0 auto; width: 100%; height: auto; }
.orders-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.orders-table th, .orders-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.pill { border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; background: var(--card-2); }
.pill.PLACED { background: #4a2c17; color: #f2b48a; }
.pill.IN_PROGRESS { background: #46390f; color: #ecd28a; }
.pill.PARTLY_READY, .pill.READY { background: #16382a; color: #7fd6ab; }
.pill.COMPLETED { background: #2c2830; color: #a9a2ad; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar .btn { width: auto; padding: 10px 16px; font-size: 14px; }

/* receipt print (80mm) — print stays black-on-white */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; left: 0; top: 0; width: 72mm; font-family: 'Courier New', monospace; color: #000; background: #fff; }
}
#print-area { display: none; }
@media print { #print-area { display: block; } }
#print-area .r-head { text-align: center; font-weight: 700; font-size: 15px; padding-bottom: 6px; border-bottom: 1px dashed #000; }
#print-area .r-brand { text-align: center; font-weight: 800; font-size: 13px; letter-spacing: .06em; padding-bottom: 2px; }
#print-area .r-table { font-size: 26px; font-weight: 800; text-align: center; margin: 8px 0; }
#print-area ul { list-style: none; padding: 6px 0; }
#print-area li { font-size: 14px; padding: 4px 0; }
#print-area li .m { display: block; font-size: 12px; padding-left: 14px; }
#print-area .r-foot { border-top: 1px dashed #000; margin-top: 8px; padding-top: 6px; font-size: 11px; text-align: center; }

/* landing */
.landing { max-width: 520px; margin: 0 auto; padding: 46px 22px; text-align: center; }
.landing .logo.big { margin: 0 auto 10px; }
.landing h1 { margin-bottom: 6px; font-size: 20px; }
.landing p { color: var(--muted); margin-bottom: 26px; }
.landing a.tile {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 12px; text-decoration: none; color: var(--ink); font-weight: 700; text-align: left;
}
.landing a.tile span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 3px; }
