:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #f1ede7;
  --text: #1f1c19;
  --muted: #6d665e;
  --border: #e4ded6;
  --primary: #d9480f;
  --primary-hover: #b93c0b;
  --primary-soft: #fdebe3;
  --success: #2b8a3e;
  --warning: #b86e00;
  --chart-bar: #d9480f;
  --danger: #c92a2a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151311;
    --surface: #1f1c19;
    --surface-2: #2a2622;
    --text: #f2eee9;
    --muted: #a59d93;
    --border: #36312c;
    --primary: #ff7a3d;
    --primary-hover: #ff9463;
    --primary-soft: #3a2419;
    --success: #51cf66;
    --warning: #ffb84d;
    --chart-bar: #e8612a;
    --danger: #ff6b6b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem clamp(1rem, 4vw, 2.5rem);
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); display: flex; gap: .5rem; align-items: center; min-width: 0; white-space: nowrap; }
.topbar { flex-wrap: wrap; row-gap: .5rem; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--primary); color: #fff; transition: background .15s, opacity .15s;
}
.btn:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--surface-2); }
.btn-sm { padding: .35rem .7rem; font-size: .875rem; border-radius: 8px; }
.btn-block { width: 100%; }

.input, select.input {
  width: 100%; padding: .65rem .85rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: .9rem; }
.badge {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); text-transform: capitalize;
}
.badge-super { background: var(--primary-soft); color: var(--primary); }
.badge-paid { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.badge-pending { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.badge-online { background: color-mix(in srgb, #5f3dc4 16%, transparent); color: #7048e8; text-transform: none; }
.badge-cancelled { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }

/* ---------- Lander ---------- */
.hero { text-align: center; padding: clamp(3rem, 12vh, 7rem) 0 2rem; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
.search {
  display: flex; gap: .5rem; max-width: 560px; margin: 1.5rem auto 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .4rem; box-shadow: var(--shadow);
}
.search .input { border: 0; font-size: 1.05rem; }
.search .input:focus { outline: none; }
.results { max-width: 720px; margin: 0 auto; display: grid; gap: 1rem; }

.order-card header { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.order-items { list-style: none; padding: 0; margin: 0; border-top: 1px dashed var(--border); }
.order-items li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.order-total { display: flex; justify-content: space-between; font-weight: 700; padding-top: .6rem; }

/* ---------- Login ---------- */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 1.5rem 1rem; }
.auth-card { width: 100%; max-width: 400px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 2.75rem; }
.pw-toggle {
  position: absolute; top: 50%; right: .4rem; transform: translateY(-50%);
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem;
  background: none; border: 0; border-radius: 8px; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.error-text { color: var(--danger); font-size: .9rem; min-height: 1.3em; margin: 0 0 .5rem; }

/* ---------- Bento ---------- */
.bento { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: minmax(170px, auto); gap: 1rem; }
.bento-card {
  position: relative; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow);
  padding: 1.5rem; display: flex; flex-direction: column; justify-content: space-between;
  text-decoration: none; transition: transform .15s, border-color .15s;
}
.bento-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.bento-card.primary { grid-column: span 2; grid-row: span 2; background: var(--primary); color: #fff; border-color: var(--primary); }
.bento-card.primary .muted { color: rgba(255,255,255,.85); }
.bento-icon { font-size: 2rem; }
.bento-card.primary .bento-icon { font-size: 3rem; }
.bento-card h2 { font-size: 1.35rem; margin-top: .75rem; }
.bento-card.locked { opacity: .55; cursor: not-allowed; }
.bento-card.locked:hover { transform: none; border-color: var(--border); }
.lock-tag { position: absolute; top: 1rem; right: 1rem; }
.bento-card.wide { grid-column: span 3; }

@media (max-width: 760px) {
  .bento { grid-template-columns: 1fr 1fr; }
  .bento-card.primary { grid-column: span 2; grid-row: span 1; }
  .bento-card.wide { grid-column: span 2; }
}
@media (max-width: 460px) {
  .bento { grid-template-columns: 1fr; }
  .bento-card.primary, .bento-card.wide { grid-column: span 1; }
}

/* ---------- Usage report ---------- */
.chips-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chips-row .chip { padding: .4rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: .875rem; cursor: pointer; }
.chips-row .chip:hover { border-color: var(--primary); }
.chips-row .chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.usage-grid { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: .75rem; align-items: end; }
.usage-grid .field { margin: 0; }
.usage-actions { display: flex; gap: .5rem; }
@media (max-width: 760px) {
  .usage-grid { grid-template-columns: 1fr 1fr; }
  .usage-actions { grid-column: 1 / -1; }
  .usage-actions .btn { flex: 1; }
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  background: var(--surface); border-radius: 20px; width: 100%; max-width: 560px;
  max-height: calc(100vh - 2rem); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: .75rem; }
.icon-btn { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .25rem; }

@supports (height: 100dvh) {
  .modal { max-height: calc(100dvh - 2rem); }
}
@media (max-width: 560px) {
  .modal-backdrop { padding: .75rem; }
  .modal { border-radius: 16px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 1rem; padding-right: 1rem; }
}


/* ---------- New bill modal ---------- */
/* Desktop / tablet: compact layout. Mobile (<=560px): app-style layout below. */
.bill-head { position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border); }
.bill-head h2 { margin: 0; text-align: center; }
.bill-head .link-btn { justify-self: start; }
.bill-head .icon-btn { justify-self: end; }

/* Thin sliding bar under the header while the menu refreshes. */
.load-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; overflow: hidden; background: var(--primary-soft); }
.load-bar::before { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--primary); animation: load-slide 1.1s ease-in-out infinite; }
@keyframes load-slide { from { left: -40%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .load-bar::before { animation-duration: 3s; } }

.stepper { list-style: none; display: flex; gap: .4rem; margin: 0 0 1.25rem; padding: 0; }
.stepper li { position: relative; flex: 1; height: 5px; border-radius: 5px; background: var(--surface-2); }
.stepper li.done, .stepper li.active { background: var(--primary); }
.stepper li > * { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.search-field { margin-bottom: .5rem; }
.search-field svg { display: none; }
.chips { display: none; }

.menu-pick { display: grid; gap: .5rem; }
.menu-cat { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: .75rem 0 .1rem; }
.item-card { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 12px; }
.item-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.item-cat { display: none; }
.item-price { color: var(--muted); }
.item-offer { color: var(--success); font-size: .8rem; font-weight: 600; }
.bill .thumb { display: none; }

.thumb { position: relative; flex-shrink: 0; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 1.5rem; font-weight: 800; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-sm { width: 36px; height: 36px; border-radius: 8px; font-size: .95rem; }

.qty { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.qty button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.qty button:disabled { opacity: .45; cursor: default; }
.qty span { min-width: 1.5rem; text-align: center; font-weight: 700; }

.bill-foot { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); }
.cart-bar { flex: 1; display: flex; align-items: center; gap: .75rem; min-width: 0; }
.cart-summary { display: flex; align-items: baseline; gap: .6rem; min-width: 0; }
.cart-icon { display: none; }
.cart-count { color: var(--muted); }
.cart-total { font-weight: 700; white-space: nowrap; }
.btn-next { margin-left: auto; }
.link-btn { display: inline-flex; align-items: center; justify-content: center; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.link-btn:hover { background: var(--surface-2); }
.link-btn svg { display: none; }

@media (max-width: 560px) {
  /* Anchored to the top and shortened by the keyboard, so the cart bar and
     Next button stay just above it instead of being buried under it. The
     backdrop is opaque, so the strip the keyboard leaves behind is plain
     surface rather than the dashboard showing through. */
  .bill-backdrop { padding: 0; align-items: flex-start; background: var(--surface); }
  .bill {
    max-width: none; max-height: none; border-radius: 0; overflow: hidden;
    height: calc(100% - var(--kb, 0px));
    transition: height .15s ease;
  }
  .bill .modal-body { padding: 1.1rem 1rem; }

  .bill-head { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; padding: .8rem 1rem; background: var(--primary); color: #fff; border-bottom: 0; }
  .bill-head h2 { font-size: 1.2rem; text-align: center; }
  .bill-head .icon-btn { color: #fff; font-size: 1.9rem; }
  .bill-head .link-btn { color: #fff; }
  .bill-head .link-btn:hover { background: rgba(255, 255, 255, .15); }
  .bill-head .load-bar { background: rgba(255, 255, 255, .25); }
  .bill-head .load-bar::before { background: #fff; }

  .step-title { display: none; }
  .stepper { gap: 0; }
  .stepper li { height: auto; background: none; display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center; font-size: .75rem; line-height: 1.25; color: var(--muted); }
  .stepper li.done, .stepper li.active { background: none; }
  .stepper li > * { position: relative; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
  .stepper li + li::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 3px; background: var(--border); }
  .stepper li.done::before, .stepper li.active::before { background: var(--primary); }
  .stepper .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); color: var(--muted); }
  .stepper li.done .dot { background: var(--muted); color: var(--surface); }
  .stepper li.active .dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
  .stepper li.active { color: var(--primary); font-weight: 700; }

  .search-field { position: relative; margin-bottom: .75rem; }
  .search-field svg { display: block; position: absolute; left: .95rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
  .search-field .input { padding-left: 2.7rem; border-radius: 999px; }

  .chips { display: flex; gap: .5rem; overflow-x: auto; margin-bottom: .85rem; padding-bottom: .15rem; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; padding: .45rem 1.05rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
  .chip.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

  .menu-pick { gap: .6rem; }
  .menu-cat { display: none; }
  .item-card { gap: .8rem; padding: .6rem; border-radius: 14px; }
  .bill .thumb { display: grid; width: 56px; height: 56px; }
  .item-card.selected .thumb { background: var(--surface); }
  .item-info { line-height: 1.35; }
  .item-cat { display: block; color: var(--muted); font-size: .85rem; }
  .item-price { color: var(--primary); font-weight: 700; }

  .qty { gap: .5rem; }
  .qty button { width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--surface-2); font-size: 1.25rem; }
  .qty button.plus { background: var(--primary); color: #fff; }

  .bill-foot { display: block; padding: 0; border-top: 0; }
  .cart-bar { padding: .8rem 1rem; gap: .6rem; background: var(--primary); color: #fff; border-radius: 18px 18px 0 0; }
  .cart-summary { align-items: center; gap: 1rem; }
  .cart-icon { display: grid; position: relative; place-items: center; }
  .cart-badge { position: absolute; top: -9px; right: -11px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; background: #fff; color: var(--primary); font-size: .75rem; font-weight: 800; }
  .cart-count { color: inherit; font-size: .85rem; opacity: .9; }
  .cart-total { font-size: 1.1rem; font-weight: 800; }
  .btn-next { background: #fff; color: var(--primary); padding: .65rem 1.15rem; border-radius: 12px; font-size: 1rem; }
  .btn-next:hover { background: var(--primary-soft); }
  .link-btn { gap: .3rem; padding: .4rem .55rem; border: 0; border-radius: 8px; color: var(--primary); }
  .link-btn svg { display: block; }
}

.pay { text-align: center; }
.qr-box { display: inline-block; padding: 12px; background: #fff; border-radius: 12px; margin: 1rem 0; border: 1px solid var(--border); }
.pay-amount { font-size: 2rem; font-weight: 800; }

/* ---------- Payment method / bill saved ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 1rem 0; }
.seg button { padding: .7rem .5rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.seg button:hover { border-color: var(--primary); }
.seg button[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.done-icon { width: 64px; height: 64px; margin: .5rem auto 1rem; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; font-weight: 800; background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.done-icon.pending { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.done-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1rem; }
.done-actions .btn-block { grid-column: 1 / -1; }

/* ---------- Awaiting payment (dashboard) ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 2rem 0 .75rem; }
.section-head h2 { margin: 0; font-size: 1.2rem; }
.pending-list { display: grid; gap: .6rem; }
.pending-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .8rem 1rem; }
.pending-row .grow { flex: 1; min-width: 10rem; }
.pending-row .amt { font-weight: 800; }

.qr-warn { margin-top: .4rem; max-width: 200px; font-size: .75rem; font-weight: 600; color: #c92a2a; }

/* ---------- Settings / staff / audit / account ---------- */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; align-items: end; }
.form-grid-2 .field { margin: 0; }
.form-grid-2 .span-all { grid-column: 1 / -1; }
.hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
.narrow { max-width: 480px; }
td.wrap { white-space: normal; min-width: 16rem; }
@media (max-width: 560px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* ---------- Shift (dashboard) ---------- */
.shift-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .9rem 1.1rem; margin-bottom: 1rem; }
.shift-bar .grow { flex: 1; min-width: 12rem; }
.shift-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-right: .4rem; }
.shift-bar.open .shift-dot { background: var(--success); }
.summary-list { list-style: none; margin: 0; padding: 0; }
.summary-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px dashed var(--border); }
.summary-list li.strong { font-weight: 700; }
.diff-short { color: var(--danger); font-weight: 700; }
.diff-over { color: var(--warning); font-weight: 700; }
.diff-ok { color: var(--success); font-weight: 700; }

/* ---------- Sales ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin: 1rem 0; }
.kpi { padding: 1rem; }
.kpi-label { font-size: .75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.6rem; font-weight: 800; line-height: 1.2; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .85rem; color: var(--muted); }
.panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; }
.panels .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .panels { grid-template-columns: minmax(0, 1fr); } }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel-title h2 { font-size: 1.05rem; margin: 0; }
.chart-note { font-size: .75rem; color: var(--muted); }
.bars {
  position: relative; display: flex; align-items: stretch; gap: 2px; height: 180px;
  border-bottom: 1px solid var(--border);
  background-image: linear-gradient(to top, color-mix(in srgb, var(--border) 55%, transparent) 1px, transparent 1px);
  background-size: 100% 25%;
}
.bars, .bar-axis { justify-content: center; }
.bar-col { flex: 1; min-width: 0; max-width: 56px; display: flex; align-items: flex-end; outline: none; }
.bar-axis span { max-width: 56px; }
.bar { width: 100%; background: var(--chart-bar); border-radius: 4px 4px 0 0; }
.bar-col:hover .bar, .bar-col:focus-visible .bar { background: var(--primary-hover); }
.bar-axis { display: flex; gap: 2px; margin-top: .3rem; font-size: .7rem; color: var(--muted); }
.bar-axis span { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 6px));
  padding: .35rem .55rem; border-radius: 8px; background: var(--text); color: var(--bg);
  font-size: .8rem; white-space: nowrap; box-shadow: var(--shadow);
}
.share-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .75rem; padding: .5rem 0; border-bottom: 1px dashed var(--border); }
.share-row:last-child { border-bottom: 0; }
.share-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.share-fill { height: 100%; border-radius: 3px; background: var(--chart-bar); }
details.table-view { margin-top: .75rem; }
details.table-view summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
details.table-view .table-wrap { margin-top: .5rem; max-height: 280px; overflow: auto; }
.bento-card.span-2 { grid-column: span 2; }
@media (max-width: 460px) { .bento-card.span-2 { grid-column: span 1; } }

/* ---------- Stock ---------- */
.stock-warn {
  display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; margin-left: .2rem; padding: 0;
  border: 0; border-radius: 50%; font-size: .9rem; line-height: 1; cursor: pointer; vertical-align: middle;
  background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger);
}
.stock-warn.low { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); }
.stock-info { margin-top: .35rem; padding: .45rem .6rem; border-radius: 8px; font-size: .82rem; line-height: 1.4; color: var(--text); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.stock-info.low { background: color-mix(in srgb, var(--warning) 13%, transparent); }
.item-card { flex-wrap: wrap; }
.item-card > .stock-info { flex-basis: 100%; margin-top: 0; }
.stock-note { font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
.low-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.low-chip { padding: .35rem .75rem; border-radius: 999px; font-size: .875rem; background: color-mix(in srgb, var(--warning) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); }
.low-chip.out { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* ---------- Kitchen display ---------- */
.kds-clock { font-weight: 700; font-variant-numeric: tabular-nums; }
.live-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; background: var(--muted); }
.live-dot.on { background: var(--success); }
.kds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; padding: 1rem clamp(1rem, 2vw, 1.5rem); }
.kds-col { background: var(--surface-2); border-radius: var(--radius); padding: .75rem; min-height: 60vh; }
.kds-col h2 { display: flex; justify-content: space-between; align-items: center; font-size: 1.05rem; margin: .25rem .25rem .75rem; }
.kds-list { display: grid; gap: .75rem; }
.kds-card { background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: .8rem .9rem; box-shadow: var(--shadow); }
.kds-card.late { border-color: var(--warning); }
.kds-card.very-late { border-color: var(--danger); }
.kds-card.fresh { animation: kds-flash 1.2s ease-out 3; }
@keyframes kds-flash { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent); } to { box-shadow: 0 0 0 14px transparent; } }
.kds-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.kds-id { font-size: 1.3rem; font-weight: 800; }
.kds-age { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.kds-card.late .kds-age { color: var(--warning); }
.kds-card.very-late .kds-age { color: var(--danger); }
.kds-items { list-style: none; margin: .6rem 0 .8rem; padding: 0; font-size: 1.15rem; line-height: 1.35; }
.kds-items li { display: flex; gap: .6rem; padding: .15rem 0; }
.kds-items .q { min-width: 2.3rem; font-weight: 800; }
.kds-actions { display: flex; gap: .5rem; }
.kds-actions .btn { padding: .75rem 1rem; font-size: 1rem; }
.kds-actions .btn:not(.btn-ghost) { flex: 1; }
.kds.simple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kds-card.done { box-shadow: none; opacity: .75; }
.kds-served { padding: 0 clamp(1rem, 2vw, 1.5rem) 2rem; }
.kds-served summary { cursor: pointer; }
/* One below the other (kitchen layout toggle). */
.kds.stacked { grid-template-columns: minmax(0, 1fr); }
.kds.stacked .kds-col { min-height: 0; }
/* Side by side on a narrow screen: columns keep a usable width and scroll sideways. */
@media (max-width: 900px) {
  .kds:not(.stacked) { grid-template-columns: repeat(3, minmax(230px, 1fr)); overflow-x: auto; scroll-snap-type: x proximity; }
  .kds.simple:not(.stacked) { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
  .kds:not(.stacked) .kds-col { scroll-snap-align: start; }
  .kds-col { min-height: 0; }
}
/* Floating "+ New order" (kitchen screen), kept above the phone bottom bar. */
.fab {
  position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 30;
  display: inline-flex; align-items: center; gap: .4rem; padding: .7rem 1.1rem;
  border: 0; border-radius: 999px; background: var(--primary); color: #fff;
  font: inherit; font-weight: 700; box-shadow: var(--shadow); cursor: pointer;
}
.fab:hover { filter: brightness(1.05); }
@media (max-width: 900px) { body.has-bottom-nav .fab { bottom: calc(5rem + env(safe-area-inset-bottom)); } }
/* Room so the button never covers the last card. */
body:has(.fab) main { padding-bottom: 4.5rem; }
.view-toggle { display: inline-flex; gap: .25rem; }
.view-toggle .btn { display: inline-grid; place-items: center; }
.view-toggle [aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
@media (prefers-reduced-motion: reduce) { .kds-card.fresh { animation: none; } }

/* ---------- Home page ---------- */
.ld-nav { display: flex; gap: .15rem; }
.ld-nav a { color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; padding: .4rem .6rem; border-radius: 8px; }
.ld-nav a:hover { background: var(--surface-2); }
@media (max-width: 680px) { .ld-nav { display: none; } }

.ld-hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(135deg, #6f2405 0%, #d9480f 55%, #f08c00 100%); background-size: cover; background-position: center; }
.ld-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.6)); }
.ld-hero-inner { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: clamp(3rem, 10vh, 6rem) clamp(1rem, 4vw, 2.5rem) clamp(3.5rem, 9vh, 5rem); }
.ld-hero h1 { font-size: clamp(2.3rem, 6.5vw, 3.8rem); margin: .8rem 0 .5rem; letter-spacing: -.02em; text-shadow: 0 2px 18px rgba(0,0,0,.25); }
.ld-tagline { font-size: clamp(1.05rem, 2.4vw, 1.3rem); max-width: 40rem; margin: 0 0 1.6rem; opacity: .95; }
.ld-open { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .85rem; border-radius: 999px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); font-weight: 600; font-size: .9rem; }
.ld-open .dot { width: 9px; height: 9px; border-radius: 50%; background: #8ce99a; animation: ld-pulse 2s infinite; }
.ld-open.closed .dot { background: #ffa8a8; animation: none; }
@keyframes ld-pulse { 0% { box-shadow: 0 0 0 0 rgba(140,233,154,.75); } 70% { box-shadow: 0 0 0 10px rgba(140,233,154,0); } 100% { box-shadow: 0 0 0 0 rgba(140,233,154,0); } }
.ld-cta { display: flex; flex-wrap: wrap; gap: .6rem; }
.ld-cta .btn { padding: .8rem 1.25rem; font-size: 1rem; border-radius: 12px; }
.btn-wa { background: #1f8f4e; color: #fff; }
.btn-wa:hover { background: #19773f; }
.btn-light { background: #fff; color: #1f1c19; }
.btn-light:hover { background: #f1ede7; }
.btn-glass { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }
.btn-glass:hover { background: rgba(255,255,255,.26); }

.ld-section { max-width: 1100px; margin: 0 auto; padding: 3.25rem clamp(1rem, 4vw, 2.5rem) 0; scroll-margin-top: 4rem; }
.ld-section > header { display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ld-section h2 { font-size: clamp(1.45rem, 3vw, 1.95rem); margin: 0; }
.ld-eyebrow { color: var(--primary); font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .3rem; }
@keyframes ld-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.ld-favs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: .9rem; overflow-x: auto; padding: .25rem .1rem .75rem; scroll-snap-type: x mandatory; }
.ld-favs > * { scroll-snap-align: start; }
.ld-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.ld-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s ease; min-width: 0; }
.ld-card:hover { transform: translateY(-3px); }
.ld-img { position: relative; aspect-ratio: 4 / 3; max-width: 100%; display: grid; place-items: center; overflow: hidden; background: var(--primary-soft); color: var(--primary); font-size: 2.6rem; font-weight: 800; }
.ld-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ld-tag { position: absolute; top: .6rem; left: .6rem; z-index: 1; padding: .2rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; background: rgba(0,0,0,.68); color: #fff; }
.ld-tag.hot { background: #d9480f; }
.ld-tag.low { background: #b86e00; }
.ld-body { padding: .75rem .85rem .85rem; display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.ld-name { font-weight: 700; }
.ld-cat { color: var(--muted); font-size: .8rem; }
.ld-meta { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: auto; padding-top: .4rem; }
.ld-price { font-weight: 800; color: var(--primary); }
.ld-card.sold-out .ld-img, .ld-card.sold-out .ld-name { opacity: .55; }
.ld-add { border: 0; border-radius: 999px; padding: .4rem .85rem; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; background: var(--primary); color: #fff; white-space: nowrap; }
.ld-add:hover { background: var(--primary-hover); }
.ld-add.in { background: var(--success); }
.ld-add:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
@media (max-width: 560px) {
  .ld-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .ld-menu .ld-body { padding: .55rem .6rem .65rem; }
  .ld-menu .ld-meta { flex-direction: column; align-items: stretch; gap: .35rem; }
  .ld-menu .ld-add { width: 100%; }
  .ld-favs { grid-auto-columns: minmax(170px, 46%); }
  .ld-img { font-size: 2rem; }
}
.ld-menu-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.ld-menu-tools .input { max-width: 260px; }

.ld-visit { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 760px) { .ld-visit { grid-template-columns: minmax(0, 1fr); } }
.ld-visit .card p { margin: .2rem 0 .8rem; }
.ld-hours { width: 100%; border-collapse: collapse; }
.ld-hours td { padding: .45rem .2rem; border-bottom: 1px dashed var(--border); white-space: nowrap; background: none; }
.ld-hours td:last-child { text-align: right; }
.ld-hours tr.today td { font-weight: 800; color: var(--primary); }

.ld-basket { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: .75rem; width: min(calc(100vw - 2rem), 540px); padding: .6rem .65rem .6rem 1rem; border-radius: 16px; background: var(--text); color: var(--bg); box-shadow: 0 10px 30px rgba(0,0,0,.3); animation: ld-in .3s ease-out; }
.ld-basket .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ld-basket .icon-btn { color: var(--bg); opacity: .7; }
.ld-footer { text-align: center; color: var(--muted); padding: 3rem 1rem 7rem; font-size: .85rem; }

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.shown { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .ld-open .dot, .ld-basket { animation: none; }
  .ld-card:hover { transform: none; }
}

.hours-grid { display: grid; gap: .45rem; }
.hours-row { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem; align-items: center; }
.hours-row label { display: flex; gap: .3rem; align-items: center; font-weight: 400; font-size: .875rem; }

/* ---------- Receipt (print only, 58mm) ---------- */
#receipt-print { display: none; }
@media print {
  @page { margin: 0; }
  body { background: #fff !important; min-height: 0; }
  body > *:not(#receipt-print) { display: none !important; }
  #receipt-print { display: block; width: 58mm; padding: 2mm 3mm; color: #000; font: 11px/1.35 "Courier New", monospace; }
  #receipt-print hr { border: 0; border-top: 1px dashed #000; margin: 1.5mm 0; }
  #receipt-print .rc-center { text-align: center; }
  #receipt-print .rc-shop { font-size: 14px; font-weight: 700; }
  #receipt-print .rc-row { display: flex; justify-content: space-between; gap: 2mm; }
  #receipt-print .rc-item { font-weight: 700; }
  #receipt-print .rc-total { font-size: 13px; font-weight: 700; }
}

/* ---------- Tables ---------- */
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.toolbar .input { max-width: 320px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.row-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; gap: 1rem; }

.form-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .75rem; align-items: end; }
.form-grid .field { margin: 0; }
.form-grid .wide { grid-column: span 2; }
.check-field label { display: flex; align-items: center; gap: .4rem; padding-block: .65rem; }
.form-actions { grid-column: 1 / -1; display: flex; gap: .5rem; }
.name-cell { display: flex; align-items: center; gap: .6rem; }

.recipe-list { display: grid; gap: .5rem; }
.recipe-row { display: grid; grid-template-columns: minmax(0, 1fr) 9rem auto; gap: .5rem; align-items: center; }
.qty-unit { display: flex; align-items: center; gap: .4rem; }
.qty-unit span { min-width: 1.8rem; font-size: .9rem; }
@media (max-width: 460px) {
  .recipe-row { grid-template-columns: minmax(0, 1fr) auto; }
  .recipe-row .qty-unit { grid-column: 1; grid-row: 2; }
  .recipe-row .icon-btn { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: span 2; } }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* ---------- Toast ---------- */
#toast-box { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: .5rem; width: min(92vw, 380px); }
.toast { padding: .75rem 1rem; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-weight: 500; }
.toast-error { background: var(--danger); color: #fff; }
.toast-success { background: var(--success); color: #fff; }

/* ---------- Waiting for approval (pending.html) ---------- */
.wait-card { width: 100%; max-width: 420px; text-align: center; padding: 2rem 1.5rem; }
.wait-card h1 { margin: .75rem 0 .5rem; font-size: 1.5rem; }
.wait-dot {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 50%;
  background: var(--primary-soft); border: 3px solid var(--primary);
  animation: wait-pulse 1.8s ease-in-out infinite;
}
@keyframes wait-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(.88); opacity: .55; }
}
@media (prefers-reduced-motion: reduce) { .wait-dot { animation: none; } }
.wait-refresh { margin-top: 1.5rem; font-size: 1.05rem; padding-block: .9rem; }
.wait-hint { margin: .75rem 0 0; font-size: .85rem; }

/* ---------- Sign-ins waiting for approval (dashboard, toast) ---------- */
.approve-bar { display: grid; gap: .6rem; padding: .9rem 1.1rem; margin-bottom: 1rem; border-left: 4px solid var(--primary); }
.approve-bar h3 { margin: 0; font-size: 1rem; }
.approve-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.approve-row .grow { flex: 1; min-width: 11rem; }
.approve-row .muted { font-size: .85rem; }
.toast-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.toast-actions .btn { flex: 1; padding: .35rem .6rem; font-size: .85rem; }

/* ---------- Login hours (staff) ---------- */
.hours-cell { display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.badge-waiting { background: var(--primary-soft); color: var(--primary); }
.time-range { display: flex; align-items: center; gap: .4rem; }
.time-range .input { padding-inline: .5rem; }
.time-range span { color: var(--muted); }

/* ---------- Toast action buttons (dark background) ---------- */
.toast-actions .btn-ghost { color: var(--bg); border-color: rgba(255, 255, 255, .45); }
.toast-actions .btn-ghost:hover { background: rgba(255, 255, 255, .14); }
.toast-error .toast-actions .btn-ghost,
.toast-success .toast-actions .btn-ghost { color: #fff; }

/* ---------- Profile avatar ---------- */
.avatar-btn {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--primary); color: #fff; font: inherit; font-weight: 700; line-height: 1;
  transition: transform .15s, box-shadow .15s;
}
.avatar-btn:hover { transform: scale(1.05); box-shadow: 0 0 0 3px var(--primary-soft); }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1.2rem; cursor: default; }
.avatar-lg:hover { transform: none; box-shadow: none; }

/* ---------- Side drawer ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .45);
  opacity: 0; transition: opacity .2s;
}
.drawer-backdrop.open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(86vw, 320px); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0, 0, 0, .18);
  transform: translateX(100%); transition: transform .22s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1rem; border-bottom: 1px solid var(--border); }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.drawer-close { flex: none; }
.drawer-close svg { width: 20px; height: 20px; }
.drawer-nav { flex: 1; overflow-y: auto; padding: .5rem; display: grid; gap: .15rem; align-content: start; }
.drawer-item {
  display: flex; align-items: center; gap: .85rem; width: 100%;
  padding: .75rem .8rem; border: 0; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--text); font: inherit; font-size: .98rem; text-align: left;
}
.drawer-item:hover { background: var(--surface-2); }
.drawer-item.current { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.drawer-icon { display: grid; place-items: center; width: 22px; height: 22px; flex: none; }
.drawer-icon svg { width: 22px; height: 22px; }
.drawer-logout { margin: .5rem; width: auto; color: var(--danger); border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; padding-top: .9rem; }

/* ---------- Bottom bar (phones and tablets) ---------- */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  /* The bar replaces the bento grid, the way a phone app works. New bill
     stays on the home page, since it is the one thing done all day. */
  .bento { grid-template-columns: 1fr; grid-auto-rows: auto; gap: 0; }
  .bento-card:not(.primary) { display: none; }
  .bento-card.primary { grid-column: 1; grid-row: auto; }
  .topbar-right > a[href="dashboard.html"] { display: none; }

  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; justify-content: space-around; align-items: stretch;
    background: var(--surface); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 16px rgba(0, 0, 0, .07);
  }
  .bottom-item {
    flex: 1; display: grid; justify-items: center; gap: .2rem;
    padding: .55rem .25rem .6rem; border: 0; background: transparent; cursor: pointer;
    color: var(--muted); font: inherit; font-size: .7rem; line-height: 1;
  }
  .bottom-item:active { background: var(--surface-2); }
  .bottom-icon { display: grid; place-items: center; width: 24px; height: 24px; }
  .bottom-icon svg { width: 24px; height: 24px; }
  .bottom-item.current { color: var(--primary); }
  .bottom-item.current .bottom-icon { background: var(--primary-soft); border-radius: 999px; width: 44px; }
  .bottom-label { white-space: nowrap; }

  body.has-bottom-nav { padding-bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
  body.has-bottom-nav #toast-box { bottom: calc(5rem + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop { transition: none; }
}

/* Top bar buttons shrink to their icon on narrow screens. */
@media (max-width: 620px) {
  .topbar-right .btn-text { display: none; }
  .topbar-right .btn-sm { padding: .35rem .55rem; }
}

/* Checkboxes and radios follow the brand colour. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* A link-styled button with nothing to link to (e.g. WhatsApp with no number). */
.btn.is-disabled, .btn[aria-disabled="true"] {
  opacity: .45; cursor: not-allowed; pointer-events: none;
}

/* ---------- In-app confirm / prompt (App.confirm, App.prompt) ---------- */
.dialog-backdrop { z-index: 70; }
.modal.dialog { max-width: 420px; }
.dialog .modal-head h3 { margin: 0; font-size: 1.1rem; }
.dialog-msg { margin: 0; white-space: pre-line; line-height: 1.5; color: var(--muted); }
.dialog .input { margin-top: 1rem; }
.dialog .modal-foot { justify-content: flex-end; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger); filter: brightness(.92); }
@media (max-width: 560px) {
  /* Bottom sheet on phones, like the rest of the app. */
  .dialog-backdrop { align-items: flex-end; padding: 0; }
  .modal.dialog { max-width: none; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .dialog .modal-foot .btn { flex: 1; }
}
@media (max-width: 560px) {
  .dialog-backdrop { padding-bottom: var(--kb, 0px); }
}
.dialog .btn:focus-visible, .dialog .btn:focus { outline: 3px solid var(--primary-soft); outline-offset: 1px; }

/* ---------- Coupon (payment step) ---------- */
.pay-was { margin-top: .15rem; font-size: .9rem; color: var(--success); font-weight: 600; }
.pay-was s { color: var(--muted); font-weight: 400; }
.coupon-box { margin: 1rem 0 0; text-align: left; }
.coupon-row { display: flex; gap: .5rem; }
.coupon-row .input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .04em; }
.coupon-row .input::placeholder { text-transform: none; letter-spacing: 0; }
.coupon-applied {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-radius: 12px;
  border: 1px dashed var(--success); background: color-mix(in srgb, var(--success) 10%, transparent);
}
.coupon-applied .grow { flex: 1; min-width: 0; }
.coupon-desc { color: var(--muted); }
.coupon-msg { margin: .4rem 0 0; font-size: .875rem; color: var(--danger); }
.order-items .discount-line { color: var(--success); font-weight: 600; }
.order-items .discount-line s { font-weight: 400; }

/* ---------- Coupons page ---------- */
.seg-inline { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding-block: .5rem; }
.seg-inline label { display: flex; align-items: center; gap: .4rem; font-weight: 400; }
.pick-box { border: 1px solid var(--border); border-radius: 12px; padding: .75rem; background: var(--surface-2); }
.pick-box h4 { margin: 0 0 .5rem; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pick-box + .pick-box { margin-top: .75rem; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .25rem .75rem; max-height: 16rem; overflow: auto; }
.pick-grid label { display: flex; align-items: center; gap: .4rem; font-weight: 400; font-size: .9rem; padding: .2rem 0; }
.pick-grid .muted { font-size: .8rem; }
.pick-box .input { margin-bottom: .5rem; }
.coupon-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; letter-spacing: .04em; }
.coupon-code::placeholder { font-family: inherit; font-weight: 400; letter-spacing: 0; text-transform: none; }
td .sub { font-size: .8rem; color: var(--muted); }

/* ---------- Investments page ---------- */
/* Item box: type to search, pick from the list or add a new name. */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 16rem; overflow: auto; margin: 0; padding: .25rem; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.combo-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .55rem .75rem; border-radius: 8px; cursor: pointer; }
.combo-list li .muted { font-size: .85rem; }
.combo-list li[aria-selected="true"] { background: var(--primary-soft); }
.combo-list .combo-new { color: var(--primary); font-weight: 600; }
.combo-list .combo-empty { color: var(--muted); cursor: default; }
.cat-tag { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.cat-ingredients { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.cat-maintenance { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }

/* ---------- Online order page (order.html) ---------- */
.op { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: 7rem; background: var(--bg); }
.op-head {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 5.5rem 1fr 5.5rem; align-items: center;
  gap: .5rem; padding: .75rem 1rem; background: var(--primary); color: #fff;
}
.op-head h1 { margin: 0; font-size: 1.15rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-back { justify-self: start; display: inline-flex; align-items: center; gap: .25rem; padding: .35rem .5rem; border: 0; border-radius: 8px; background: none; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.op-back:hover { background: rgba(255, 255, 255, .15); }
.op-back.off { visibility: hidden; }
.op-open { justify-self: end; font-size: .75rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; background: rgba(255, 255, 255, .2); white-space: nowrap; }
.op-open.closed { background: rgba(0, 0, 0, .25); }
.op-body { padding: 1rem; }
.op-banner { display: flex; gap: .6rem; align-items: center; padding: .75rem .9rem; border-radius: 12px; margin-bottom: .9rem; background: var(--surface-2); border: 1px solid var(--border); }
.op-banner.warn { background: color-mix(in srgb, var(--warning) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); }
.op-banner.good { background: color-mix(in srgb, var(--success) 12%, var(--surface)); border-color: color-mix(in srgb, var(--success) 40%, var(--border)); }
.op-banner .grow { flex: 1; min-width: 0; }

.op-steps { display: flex; gap: .35rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.op-steps li { flex: 1; height: 5px; border-radius: 5px; background: var(--border); }
.op-steps li.on { background: var(--primary); }

.op-tools { position: sticky; top: 3.4rem; z-index: 10; margin: 0 -1rem .5rem; padding: .5rem 1rem; background: var(--bg); }
.op-search { width: 100%; padding: .7rem 1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.op-chips { display: flex; gap: .45rem; overflow-x: auto; padding-top: .55rem; scrollbar-width: none; }
.op-chips::-webkit-scrollbar { display: none; }
.op-chip { flex-shrink: 0; padding: .4rem 1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; }
.op-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }

.op-cat { font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 1.1rem 0 .5rem; }
.op-list { display: grid; gap: .6rem; }
.op-item { display: flex; align-items: center; gap: .85rem; padding: .7rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.op-item.in { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.op-item.out { opacity: .55; }
.op-thumb { position: relative; flex-shrink: 0; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 1.6rem; font-weight: 800; }
.op-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.op-info { flex: 1; min-width: 0; }
.op-name { font-weight: 700; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.op-price { font-weight: 800; margin-top: .15rem; }
.op-note { font-size: .8rem; color: var(--success); font-weight: 600; }
.op-tag { font-size: .75rem; font-weight: 700; color: var(--warning); }
.op-add { padding: .5rem 1.1rem; border-radius: 10px; border: 1.5px solid var(--primary); background: var(--surface); color: var(--primary); font: inherit; font-weight: 800; cursor: pointer; }
.op-add:disabled { border-color: var(--border); color: var(--muted); cursor: default; }
.op-qty { display: inline-flex; align-items: center; border-radius: 10px; background: var(--primary); color: #fff; }
.op-qty button { width: 2.3rem; height: 2.3rem; border: 0; background: none; color: inherit; font-size: 1.25rem; font-weight: 800; cursor: pointer; }
.op-qty span { min-width: 1.4rem; text-align: center; font-weight: 800; }

.op-card { padding: 1rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); margin-bottom: .9rem; }
.op-card h2 { font-size: 1.1rem; }
.op-lines { list-style: none; margin: 0; padding: 0; }
.op-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; }
.op-lines li.total { border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .6rem; font-weight: 800; font-size: 1.1rem; }
.op-lines li.off { color: var(--success); font-weight: 600; }
.op-lines s { color: var(--muted); margin-right: .35rem; }
.op-loyal { display: flex; gap: .7rem; align-items: flex-start; }
.op-loyal .ico { font-size: 1.6rem; line-height: 1; }
.op-dots { display: flex; gap: .3rem; margin-top: .5rem; flex-wrap: wrap; }
.op-dots span { width: 1.4rem; height: 1.4rem; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 800; background: var(--surface-2); color: var(--muted); }
.op-dots span.done { background: var(--primary); color: #fff; }
.op-dots span.now { box-shadow: 0 0 0 2px var(--primary); color: var(--primary); }
.op-dots span.gift { background: color-mix(in srgb, var(--success) 20%, var(--surface)); color: var(--success); }
.op-coupon { display: flex; gap: .5rem; }
.op-coupon .input { flex: 1; text-transform: uppercase; }
.op-msg { margin: .5rem 0 0; font-size: .9rem; color: var(--danger); }
.op-msg.info { color: var(--muted); }

.op-bar {
  position: fixed; left: 50%; bottom: 0; z-index: 30; transform: translateX(-50%); width: min(100%, 640px);
  display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom));
  background: var(--primary); color: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 20px rgba(0, 0, 0, .15);
}
.op-bar .grow { flex: 1; min-width: 0; }
.op-bar .count { font-size: .85rem; opacity: .9; }
.op-bar .sum { font-size: 1.15rem; font-weight: 800; }
.op-next { padding: .75rem 1.3rem; border: 0; border-radius: 12px; background: #fff; color: var(--primary); font: inherit; font-weight: 800; font-size: 1rem; cursor: pointer; }
.op-next:disabled { opacity: .6; cursor: default; }

.op-status { text-align: center; padding: 1.5rem 1rem; }
.op-status .big { font-size: 3rem; font-weight: 900; line-height: 1; margin: .4rem 0; }
.op-status .emoji { font-size: 3rem; }
.op-track { list-style: none; display: flex; justify-content: space-between; margin: 1.5rem 0 .5rem; padding: 0; position: relative; }
.op-track::before { content: ""; position: absolute; top: 15px; left: 12%; right: 12%; height: 3px; background: var(--border); }
.op-track li { position: relative; flex: 1; display: grid; justify-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); }
.op-track .d { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 2px solid var(--border); font-weight: 800; }
.op-track li.done .d { background: var(--primary); border-color: var(--primary); color: #fff; }
.op-track li.now { color: var(--primary); font-weight: 800; }
.op-track li.now .d { border-color: var(--primary); color: var(--primary); animation: op-pulse 1.4s ease-in-out infinite; }
@keyframes op-pulse { 50% { box-shadow: 0 0 0 6px var(--primary-soft); } }
.op-spin { width: 42px; height: 42px; margin: 1rem auto; border-radius: 50%; border: 4px solid var(--primary-soft); border-top-color: var(--primary); animation: op-rot 1s linear infinite; }
@keyframes op-rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .op-track li.now .d, .op-spin { animation: none; } }
