/* OnDuhGo POS — same six colours and one typeface as onduhgo.com.
   Espresso #4A2A18 · Cream #F7E7C6 · Coral #E38361 · Tan #C89B6C · Ink #2B2118 · Paper #FFFBF2
   Coral is never text on a light ground (2.24:1). */

:root {
  --espresso: #4A2A18; --cream: #F7E7C6; --coral: #E38361; --tan: #C89B6C; --ink: #2B2118; --paper: #FFFBF2;
  --bg: var(--cream); --card: var(--paper); --text: var(--ink); --soft: rgba(43, 33, 24, .72);
  --primary: var(--espresso); --on-primary: var(--cream);
  --line: rgba(74, 42, 24, .18); --field: rgba(74, 42, 24, .6); --tint: rgba(200, 155, 108, .22);
  --price: var(--espresso); --ticket: var(--paper); --ticket-text: var(--ink);
  --r-lg: 18px; --r-md: 12px; --r-sm: 8px;
  --font: "Baloo 2", "Segoe UI", sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--ink); --card: var(--espresso); --text: var(--cream); --soft: rgba(247, 231, 198, .74);
    --primary: var(--cream); --on-primary: var(--espresso);
    --line: rgba(200, 155, 108, .28); --field: rgba(200, 155, 108, .7); --tint: rgba(200, 155, 108, .16);
    --price: var(--coral); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--ink); --card: var(--espresso); --text: var(--cream); --soft: rgba(247, 231, 198, .74);
  --primary: var(--cream); --on-primary: var(--espresso);
  --line: rgba(200, 155, 108, .28); --field: rgba(200, 155, 108, .7); --tint: rgba(200, 155, 108, .16);
  --price: var(--coral); color-scheme: dark;
}

*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6; font-weight: 400;
  -webkit-tap-highlight-color: transparent;
}
em, i { font-style: normal; font-weight: 600; }
h1, h2, h3 { font-weight: 800; line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.soft { color: var(--soft); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; line-height: 1.4; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }

/* ---------- shell ---------- */
.app { display: grid; min-height: 100vh; grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.wordmark {
  display: block; height: 34px; aspect-ratio: 2959 / 2187; flex: none;
  background: url(logo-espresso.png) center / contain no-repeat;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .wordmark { background-image: url(logo-cream.png); } }
:root[data-theme="dark"] .wordmark { background-image: url(logo-cream.png); }
.top .where { font-weight: 600; font-size: 14px; color: var(--soft); }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tan); display: inline-block; }
.sync-dot.off { background: transparent; border: 2px solid var(--coral); }
.main { padding: 16px; padding-bottom: 96px; min-width: 0; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav button {
  border: 0; background: none; padding: 8px 2px 7px; display: grid; justify-items: center; gap: 1px;
  font-size: 12.5px; font-weight: 600; color: var(--soft); position: relative;
}
.nav button svg { width: 24px; height: 24px; }
.nav button[aria-current="page"] { color: var(--text); }
.nav button[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--coral); }
.nav .badge { position: absolute; top: 4px; left: calc(50% + 8px); }

@media (min-width: 900px) {
  .app { grid-template-columns: 92px 1fr; grid-template-rows: auto 1fr; }
  .top { grid-column: 1 / -1; }
  .nav { position: sticky; top: 58px; bottom: auto; height: calc(100vh - 58px); grid-template-columns: 1fr; grid-auto-rows: 72px; align-content: start; border-top: 0; border-right: 1px solid var(--line); padding-top: 8px; }
  .nav button[aria-current="page"]::before { top: 18%; bottom: 18%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .main { padding: 20px 24px 40px; }
}

/* ---------- controls ---------- */
.btn {
  border: 1.5px solid var(--field); background: transparent; border-radius: var(--r-md); padding: 9px 16px;
  font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.go { background: var(--coral); color: var(--ink); border-color: var(--coral); font-weight: 700; }
.btn.quiet { border-color: transparent; }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
label.field { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
label.field .hint { font-weight: 400; color: var(--soft); font-size: 12.5px; line-height: 1.4; }
input, select, textarea {
  width: 100%; min-height: 44px; border: 1.5px solid var(--field); border-radius: var(--r-sm);
  background: var(--card); padding: 8px 12px; font-size: 16px;
}
textarea { min-height: 80px; line-height: 1.5; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--espresso); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1.5px solid var(--field); background: transparent; border-radius: 999px; padding: 5px 14px;
  font-weight: 600; font-size: 14.5px; white-space: nowrap; min-height: 38px;
}
.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.seg { display: inline-flex; border: 1.5px solid var(--field); border-radius: var(--r-md); overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 12px; font-weight: 600; font-size: 14px; min-height: 38px; }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.card.flat { border-radius: var(--r-md); padding: 12px 14px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 22px 0 10px; }
.section-head:first-child { margin-top: 0; }
.list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); overflow: hidden; }
.list > .li { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--line); min-height: 56px; }
.list > .li:first-child { border-top: 0; }
.list > button.li { width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; }
.li .t { font-weight: 600; line-height: 1.3; }
.li .s { font-size: 13.5px; color: var(--soft); line-height: 1.35; }
.empty { padding: 28px 16px; text-align: center; color: var(--soft); }
.empty strong { color: var(--text); display: block; font-size: 17px; margin-bottom: 4px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 700; font-size: 13px; color: var(--soft); white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 1.5px solid var(--field); }

/* status marks: shape carries meaning, colour stays in the palette */
.pip { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tan); flex: none; }
.pip.low { background: var(--coral); }
.pip.out { background: transparent; border: 2.5px solid var(--coral); }
.pip.none { background: transparent; border: 2px dashed var(--tan); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--tint); white-space: nowrap; }
.tag.warn { background: transparent; border: 1.5px solid var(--coral); }
.badge { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: var(--ink); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.diet { width: 14px; height: 14px; border: 1.5px solid currentColor; display: inline-grid; place-items: center; border-radius: 2px; flex: none; }
.diet::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.diet.veg { color: var(--tan); }
.diet.nonveg { color: var(--text); }
.diet.nonveg::after { width: 0; height: 0; border-radius: 0; background: none; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid currentColor; }

/* ---------- billing ---------- */
.bill-layout { display: grid; gap: 16px; }
@media (min-width: 900px) { .bill-layout { grid-template-columns: 1fr 380px; align-items: start; } }
.menu-tools { display: grid; gap: 10px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 53px); z-index: 5; background: var(--bg); padding: 4px 0 10px; }
@media (min-width: 900px) { .menu-tools { top: 58px; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile {
  position: relative; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-md);
  padding: 10px 12px 9px; min-height: 96px; display: grid; align-content: space-between; gap: 6px;
}
.tile:active { transform: scale(.98); }
.tile .nm { font-weight: 600; line-height: 1.25; font-size: 15px; }
.tile .pr { font-weight: 700; color: var(--price); }
.tile .mk { font-size: 12px; color: var(--soft); line-height: 1.2; }
.tile .q { position: absolute; top: -7px; right: -7px; min-width: 26px; height: 26px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-weight: 700; display: grid; place-items: center; font-size: 14px; padding: 0 6px; }
.tile.off { opacity: .5; }
.tile.off .nm::after { content: " · sold out"; font-weight: 400; font-size: 12px; }

/* the ticket: the one bold thing — it is the paper that prints */
.ticket {
  background: var(--ticket); color: var(--ticket-text); border-radius: var(--r-md) var(--r-md) 0 0;
  padding: 16px 16px 26px; position: relative; box-shadow: 0 1px 0 rgba(74, 42, 24, .12);
  --zig: 12px;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--zig)) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) var(--zig) repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - var(--zig)) no-repeat, conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) var(--zig) repeat-x;
}
.ticket { --soft: rgba(43, 33, 24, .72); --text: var(--ink); --price: var(--espresso); }
.ticket .t-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; border-bottom: 1.5px dashed rgba(74, 42, 24, .45); padding-bottom: 8px; margin-bottom: 6px; }
.ticket .t-head h2 { font-size: 19px; }
.ticket .lines { display: grid; }
.tl { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 0; border-bottom: 1px dotted rgba(74, 42, 24, .3); }
.tl .nm { font-weight: 600; line-height: 1.25; }
.tl .note { grid-column: 1 / -1; font-size: 13px; color: rgba(43, 33, 24, .72); }
.tl .ctl { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid rgba(74, 42, 24, .6); border-radius: 999px; }
.stepper button { width: 34px; height: 32px; border: 0; background: none; font-size: 20px; font-weight: 600; line-height: 1; color: var(--ink); }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; }
.ticket .linkish { border: 0; background: none; padding: 4px 6px; font-size: 13px; font-weight: 600; color: var(--espresso); text-decoration: underline; text-underline-offset: 3px; }
.sums { display: grid; gap: 2px; margin-top: 10px; font-size: 14.5px; }
.sums .r { display: flex; justify-content: space-between; }
.sums .total { font-size: 30px; font-weight: 800; line-height: 1.1; padding-top: 8px; margin-top: 6px; border-top: 1.5px dashed rgba(74, 42, 24, .45); color: var(--espresso); }
.ticket input, .ticket select { background: var(--paper); border-color: rgba(74, 42, 24, .6); color: var(--ink); }
.ticket .btn { color: var(--ink); border-color: rgba(74, 42, 24, .6); }
.ticket .btn.primary { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }
.ticket .btn.go { background: var(--coral); color: var(--ink); border-color: var(--coral); }
.ticket .chip { color: var(--ink); border-color: rgba(74, 42, 24, .6); }
.ticket .chip[aria-pressed="true"] { background: var(--espresso); color: var(--cream); border-color: var(--espresso); }
.paygrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.paygrid .btn { min-height: 52px; font-size: 16px; }
.ticket-col { position: sticky; top: 74px; }
.ticket-bar { display: none; }
@media (max-width: 899px) {
  .ticket-col { display: none; }
  .ticket-col.open { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(43, 33, 24, .55); padding: calc(env(safe-area-inset-top, 0px) + 36px) 10px 0; overflow-y: auto; }
  .ticket-col.open .ticket { min-height: 60vh; }
  .ticket-bar {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 68px); z-index: 25;
    background: var(--espresso); color: var(--cream); border-radius: var(--r-md); padding: 10px 14px; align-items: center; gap: 12px;
    border: 0; font-weight: 700; min-height: 56px; box-shadow: 0 6px 20px rgba(43, 33, 24, .3);
  }
  :root[data-theme="dark"] .ticket-bar { background: var(--cream); color: var(--espresso); }
  .ticket-bar .amt { margin-left: auto; font-size: 20px; }
}
@media (max-width: 899px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ticket-bar { background: var(--cream); color: var(--espresso); } }

/* ---------- today ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.stat .v { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: 13.5px; color: var(--soft); }
.flowbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--tint); }
.flowbar i { display: block; height: 100%; }
.grid2 { display: grid; gap: 16px; }
@media (min-width: 1000px) { .grid2 { grid-template-columns: 1fr 1fr; align-items: start; } }

/* ---------- sheets / dialogs ---------- */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(43, 33, 24, .55); display: grid; align-items: end; justify-items: center; }
@media (min-width: 700px) { .scrim { align-items: center; padding: 24px; } }
.sheet {
  background: var(--bg); color: var(--text); width: 100%; max-width: 680px; max-height: calc(100vh - 40px); overflow-y: auto;
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
}
.sheet.wide { max-width: 980px; }
@media (min-width: 700px) { .sheet { border-radius: var(--r-lg); padding: 22px 24px; } }
.sheet .sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 14px; }
.sheet .x { border: 0; background: none; width: 40px; height: 40px; font-size: 26px; line-height: 1; margin: -8px -8px 0 0; }
.sheet .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.formgrid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .formgrid.two { grid-template-columns: 1fr 1fr; } .formgrid.three { grid-template-columns: 1fr 1fr 1fr; } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 140px); z-index: 99;
  background: var(--espresso); color: var(--cream); padding: 10px 18px; border-radius: 999px; font-weight: 600; max-width: calc(100% - 32px);
  box-shadow: 0 6px 20px rgba(43, 33, 24, .35);
}
.toast.bad { background: var(--coral); color: var(--ink); }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.banner { border: 1.5px solid var(--coral); border-radius: var(--r-md); padding: 10px 14px; display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } .tile:active { transform: none; } }

/* ---------- sign-in ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .card { max-width: 420px; width: 100%; padding: 28px 24px; display: grid; gap: 16px; justify-items: center; text-align: center; }
.gate .wordmark { height: 132px; }
.tagline { font-weight: 700; letter-spacing: .14em; font-size: 13px; color: var(--soft); }

/* ---------- print (thermal) ---------- */
#print { display: none; }
@media print {
  @page { margin: 0; }
  body * { visibility: hidden !important; }
  body { background: #fff !important; }
  #print, #print * { visibility: visible !important; }
  #print { display: block; position: absolute; left: 0; top: 0; color: #000; font-family: var(--font); font-size: 12px; line-height: 1.35; padding: 2mm 3mm 6mm; }
  #print.w58 { width: 58mm; }
  #print.w80 { width: 80mm; font-size: 13px; }
  #print .c { text-align: center; }
  #print .wm { display: block; margin: 0 auto 1mm; width: 46%; }
  #print h4 { margin: 1mm 0; font-size: 1.25em; font-weight: 800; text-align: center; }
  #print hr { border: 0; border-top: 1px dashed #000; margin: 1.5mm 0; }
  #print table { width: 100%; font-size: 1em; }
  #print td, #print th { padding: .4mm 0; border: 0; color: #000; }
  #print .big { font-size: 1.6em; font-weight: 800; }
  #print .kot-line { font-size: 1.35em; font-weight: 700; }
}

/* Item master */
.li-main { border: 0; background: none; padding: 0; color: inherit; font: inherit; min-width: 0; cursor: pointer; }
.li-main:focus-visible { outline: 2px solid var(--coral); outline-offset: 4px; border-radius: 4px; }
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--tint); border: 1.5px solid var(--field); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--field); transition: transform .15s, background .15s; }
.switch input:checked + span { background: var(--primary); border-color: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--on-primary); }
.switch input:focus-visible + span { outline: 2px solid var(--coral); outline-offset: 2px; }
.seg button[aria-pressed="true"] .soft { color: inherit; opacity: .75; }
