/* jeepao_ night desk: dark wood desk, cream paper tickets, rust numbers, brass accents */
:root {
  --desk: #120d0b; --desk-2: #1c1410; --desk-line: rgba(242, 237, 228, .12);
  --cream: #F2EDE4; --paper: #EFE6D6; --paper-2: #E4D8C3; --paper-line: rgba(26, 20, 16, .14);
  --ink: #1A1410; --ink-2: #5A4A3C; --on-desk-2: rgba(242, 237, 228, .64);
  --amber: #E0A867; --gold: #D9AE5F; --rust: #9A4A2A; --rust-2: #7E3A20; --ok: #56713A; --danger: #A23A2A;
  --thai: "Kanit", "Leelawadee UI", "Thonburi", Tahoma, sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, Consolas, monospace;
  --serif: "Cormorant Garamond", Georgia, serif;
  --r: 14px; --tab-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--desk);
  /* wood grain, drawn in CSS so there is nothing extra to download */
  background-image:
    repeating-linear-gradient(92deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 9px),
    radial-gradient(120% 60% at 50% -10%, #3a2618 0%, transparent 60%);
  color: var(--cream); font: 16px/1.5 var(--thai);
  display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, .btn { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* header */
.top { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; }
.logo { width: 52px; height: auto; flex: none; opacity: .95; }
.ttl { min-width: 0; flex: 1; }
/* outside the LINE app: a way to add LINE jeepao_ (bot, My List sync) */
.line-chip { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px;
  background: var(--amber); color: var(--ink); font: 700 14px/1 var(--mono); text-decoration: none; }
.kicker { margin: 0; font: 700 11px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.kicker.dark { color: var(--rust); font: 500 13px/1.4 var(--thai); letter-spacing: 0; text-transform: none; }
.top h1 { margin: 2px 0 0; font: 500 17px/1.3 var(--thai); color: var(--cream); }

/* tabs */
main { flex: 1; min-height: 0; position: relative; }
.tab { display: none; height: 100%; overflow: auto; padding: 4px 16px calc(var(--tab-h) + var(--safe-b) + 24px); overscroll-behavior: contain; }
.tab.on { display: block; }
#tab-map { padding: 0 12px calc(var(--tab-h) + var(--safe-b) + 12px); overflow: hidden; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  height: calc(var(--tab-h) + var(--safe-b)); padding: 0 8px var(--safe-b);
  background: rgba(18, 13, 11, .94); border-top: 1px solid var(--desk-line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tabbar button {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--on-desk-2); font-size: 13px; transition: color .2s;
}
.tabbar button[aria-selected="true"] { color: var(--cream); }
.tabbar button[aria-selected="true"]::before {
  content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold);
}
.badge {
  position: absolute; top: 8px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--rust); color: var(--cream); font: 700 11px/20px var(--mono); text-align: center;
}

/* paper surfaces */
.paper { background: var(--cream); color: var(--ink); border-radius: var(--r); box-shadow: 0 10px 30px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .4); }
.mapwrap { position: relative; height: 100%; overflow: hidden; }
.map { width: 100%; height: 100%; touch-action: none; overflow: hidden; }
.map svg { width: 100%; height: 100%; display: block; }
.map .booth { cursor: pointer; }
.zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 8px; }
.round {
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--paper-line); background: var(--ink); color: var(--cream); box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}
.round:active, .btn:active { transform: scale(.96); }
.round.soft { background: var(--paper-2); color: var(--ink); box-shadow: none; }
.hint { position: absolute; left: 12px; right: 64px; bottom: 10px; margin: 0; font-size: 13px; color: var(--ink-2); pointer-events: none; }

/* search */
.search {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px;
  background: var(--cream); color: var(--ink); border-radius: var(--r); box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 16px; color: var(--ink); }
.search input::placeholder { color: var(--ink-2); opacity: .8; }

/* ticket rows */
.rows { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.rows li {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 10px 10px 10px 14px;
  background: var(--paper); color: var(--ink); border-radius: 12px;
}
/* the punched notches of a ticket */
.rows li::before, .rows li::after, .ticket::before, .ticket::after {
  content: ""; position: absolute; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--desk);
}
.rows li::before, .ticket::before { left: -7px; }
.rows li::after, .ticket::after { right: -7px; }
.rows .num { flex: none; width: 30px; font: 700 15px/1 var(--mono); color: var(--rust); }
.rows li.done .num { color: var(--ok); }
.rows .t { flex: 1; min-width: 0; border-left: 1.5px dashed var(--paper-line); padding-left: 12px; }
.rows .t b { display: block; font-weight: 500; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.rows .t small { display: block; margin-top: 2px; font: 13px/1.4 var(--mono); color: var(--ink-2); }
.rows .t small .z { font-family: var(--thai); }
.rows li.done .t b { color: var(--ink-2); text-decoration: line-through; text-decoration-color: rgba(26, 20, 16, .35); }
.rows .act { display: flex; gap: 6px; flex: none; }
.chk, .more, .add {
  width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border-radius: 12px;
  border: 1.5px solid var(--paper-line); background: transparent; color: var(--ink); transition: background .15s, color .15s;
}
.chk.on { background: var(--ok); border-color: var(--ok); color: var(--cream); }
.add { width: auto; padding: 0 12px; gap: 4px; display: inline-flex; align-items: center; font-size: 14px; font-weight: 500; }
.add.on { background: var(--rust); border-color: var(--rust); color: var(--cream); }
.rows .empty { justify-content: center; text-align: center; color: var(--on-desk-2); background: transparent; border: 1.5px dashed var(--desk-line); min-height: 120px; }
.rows .empty::before, .rows .empty::after { display: none; }
.rows .empty b { display: block; color: var(--cream); font-weight: 500; }

/* plan tab */
.label { margin: 8px 0 8px; font-size: 14px; color: var(--on-desk-2); }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chips button {
  height: 44px; padding: 0 4px; border-radius: 22px; border: 1px solid var(--desk-line); background: var(--desk-2);
  color: var(--cream); font: 700 12px/1.1 var(--mono); letter-spacing: .04em;
}
.chips button[aria-checked="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.planhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.summary { margin: 0; font-size: 14px; color: var(--on-desk-2); }
.summary b { color: var(--cream); font-weight: 500; }
.planbar {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b)); z-index: 15; display: flex; gap: 10px;
  padding: 12px 16px; background: linear-gradient(transparent, var(--desk) 35%);
}
#tab-plan:not(.on) .planbar { display: none; }
#tab-plan { padding-bottom: calc(var(--tab-h) + var(--safe-b) + 92px); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: 24px; border: 1px solid transparent; font-weight: 500; font-size: 16px; text-decoration: none; white-space: nowrap;
  transition: transform .15s ease, background .2s;
}
.btn.primary { flex: 1; background: var(--amber); color: var(--ink); box-shadow: 0 6px 18px rgba(224, 168, 103, .25); }
.btn.ghost { min-height: 44px; padding: 0 14px; background: transparent; border-color: var(--desk-line); color: var(--cream); font-size: 15px; }
.btn.ghost-light { background: var(--desk-2); border-color: var(--desk-line); color: var(--cream); }
button:disabled { opacity: .4; cursor: default; }

/* booth sheet: a ticket that slides up over the map */
.sheet { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); z-index: 18; padding: 0 12px; animation: up .22s ease-out; }
.ticket { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--paper); color: var(--ink); border-radius: 16px; box-shadow: 0 -6px 30px rgba(0, 0, 0, .5); }
.ticket-main { padding: 0 6px; }
.ticket .name { margin: 4px 0 0; font-size: 19px; font-weight: 600; line-height: 1.3; }
.ticket .code { margin: 6px 0 0; font: 700 22px/1 var(--mono); color: var(--rust); letter-spacing: .04em; }
.ticket-actions { display: flex; gap: 10px; align-items: center; padding-top: 12px; border-top: 1.5px dashed var(--paper-line); }
.ticket-actions .btn.primary { box-shadow: none; }
.ticket-actions .btn.primary.remove { background: var(--paper-2); color: var(--ink); }
@keyframes up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* modals */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(10, 7, 5, .62); animation: fade .2s ease-out; }
.modal.sheetlike { align-items: end; padding: 0 12px calc(12px + var(--safe-b)); }
.modal-body { width: 100%; max-width: 560px; max-height: 100%; overflow: auto; padding: 14px; background: var(--paper); color: var(--ink); border-radius: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head .name, .actionsheet .name { margin: 0; font-size: 17px; font-weight: 600; }
.modal-body img { width: 100%; display: block; border-radius: 10px; }
.modal-body .muted { margin: 10px 2px; font-size: 13px; color: var(--ink-2); }
.row2 { display: flex; gap: 10px; }
.row2 .btn.ghost { color: var(--ink); border-color: var(--paper-line); }
.actionsheet { width: 100%; max-width: 560px; padding: 14px; background: var(--paper); color: var(--ink); border-radius: 18px; display: flex; flex-direction: column; gap: 2px; animation: up .22s ease-out; }
.actionsheet .name { padding: 4px 6px 10px; border-bottom: 1.5px dashed var(--paper-line); margin-bottom: 4px; }
.actionsheet button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 8px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font-size: 16px; }
.actionsheet button:active { background: var(--paper-2); }
.actionsheet button:disabled { opacity: .35; }
.actionsheet .danger { color: var(--danger); }
.actionsheet .cancel { justify-content: center; margin-top: 6px; background: var(--paper-2); font-weight: 500; }
@keyframes fade { from { opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 84px); transform: translateX(-50%); z-index: 40;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 22px; background: var(--cream); color: var(--ink);
  font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); animation: fade .2s ease-out;
}
[hidden] { display: none !important; }
@media (min-width: 720px) {
  .tab { max-width: 640px; margin: 0 auto; }
  #tab-map { max-width: none; }
  .planbar { max-width: 640px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
