:root {
  --pine: #0e3a3b;
  --pine-deep: #092a2b;
  --pine-line: #2c5f5e;
  --on-pine: #e6f5ee;
  --on-pine-soft: #b4d9cb;
  --paper: #f0f7f1;
  --mint: #c9ecdc;
  --butter: #f7dd85;
  --salmon: #f5b9a2;
  --ink: #11302f;
  --ink-soft: #3b5553;
  --carbon: #41278c;
  --teal: #0f8f7b;
  --red: #b5231b;
  --sans: "Sarabun", system-ui, sans-serif;
  --head: "Chakra Petch", "Sarabun", sans-serif;
  --figure: "Courier Prime", "Courier New", monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --gap: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--pine-deep);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--carbon); color: #fff; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
:focus-visible { outline: 3px solid var(--carbon); outline-offset: 2px; }
.on-pine :focus-visible, .tabs :focus-visible, .topbar :focus-visible { outline-color: var(--butter); }
[hidden] { display: none !important; }

.stage { height: 100dvh; }
.pitch { display: none; }
.phone { position: relative; height: 100%; overflow: hidden; background: var(--pine); }
.shell { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: calc(10px + env(safe-area-inset-top)) 16px 6px;
  color: var(--on-pine);
}
.brand { font: 700 16px/1.2 var(--head); text-decoration: none; }
.topclock { font: 700 14px/1 var(--figure); color: var(--butter); font-variant-numeric: tabular-nums; }

main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 16px 28px;
  outline: none;
  scrollbar-width: none;
}
main::-webkit-scrollbar { display: none; }
.view { display: flex; flex-direction: column; gap: var(--gap); }
.title { font: 700 25px/1.25 var(--head); color: var(--on-pine); text-wrap: balance; }
.title b { color: var(--butter); font-weight: 700; }
.lead { color: var(--on-pine-soft); margin-top: -8px; }

.coupon {
  position: relative;
  background: var(--stock, var(--paper));
  border-radius: 7px;
  padding: 14px;
  box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .7);
}
.stock-mint { --stock: var(--mint); }
.stock-butter { --stock: var(--butter); }
.stock-salmon { --stock: var(--salmon); }
.stock-paper { --stock: var(--paper); }

.coupon-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.coupon-head h2, .coupon-head h3, .sect-head { font: 700 18px/1.25 var(--head); }
.coupon-tag { font-size: 13px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }

.tear {
  position: relative;
  height: 0;
  margin: 12px -14px;
  border-top: 2px dashed rgba(17, 48, 47, .38);
}
.tear::before, .tear::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pine);
}
.tear::before { left: -9px; }
.tear::after { right: -9px; }

.fig { font-family: var(--figure); color: var(--carbon); font-variant-numeric: tabular-nums; font-weight: 700; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s, color .15s, transform .15s var(--ease);
}
.btn:hover { background: var(--carbon); border-color: var(--carbon); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: rgba(17, 48, 47, .1); border-color: var(--ink); }
.btn.wide { width: 100%; }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-btn {
  align-self: flex-start;
  color: var(--on-pine);
  background: none;
  border: 0;
  padding: 10px 0;
  min-height: 44px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.duty-row { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); gap: 10px; }
.duty { padding: 12px; }
.duty-label { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink-soft); }
.duty-field {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin: 8px 0;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: #fff;
}
.step { height: 48px; border: 0; background: none; font-size: 24px; line-height: 1; font-weight: 700; display: grid; place-items: center; }
.step svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.step:hover:not(:disabled) { background: var(--mint); }
.step:disabled { opacity: .3; cursor: not-allowed; }
.duty-num { text-align: center; white-space: nowrap; border-inline: 2px solid var(--ink); height: 48px; line-height: 48px; }
.duty-num .fig { font-size: 34px; }
.duty-num small { font-weight: 700; font-size: 13px; margin-left: 2px; }
.duty-since { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.duty-since .fig { font-size: 14px; }

.who {
  display: block;
  width: 100%;
  color: var(--ink);
  text-decoration: none;
  padding: 12px;
  transition: transform .2s var(--ease);
}
.who:hover { transform: translateY(-2px); }
.who-top { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; line-height: 1.45; }
.avatar { flex: none; width: 36px; height: 36px; border: 2px solid var(--ink); border-radius: 4px; background: #fff; }
.who-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 6px; margin-top: 9px; font-size: 13px; }
.who-grid .fig { font-size: 14px; }

.need { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 14px; align-items: center; margin-top: 8px; }
.ring { position: relative; width: 136px; height: 136px; }
.ring svg { display: block; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--ink); stroke-width: 4; }
.ring-need { fill: none; stroke: var(--teal); stroke-width: 15; transition: stroke-dashoffset .8s var(--ease); }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring-text .fig { font-size: 28px; white-space: nowrap; }
.ring-text small { font-size: 12px; font-weight: 700; margin-top: 3px; }
.macros li { display: flex; align-items: baseline; gap: 6px; padding: 7px 0; border-bottom: 1.5px solid rgba(17, 48, 47, .4); font-weight: 600; }
.macros li span:first-child { flex: 1; }
.macros .fig { font-size: 18px; }
.macros li.is-low, .macros li.is-low .fig { color: var(--red); }
.ring-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.ring-key i { display: inline-block; width: 14px; height: 6px; margin-right: 5px; vertical-align: 2px; background: var(--ink); }
.ring-key i.need-key { background: var(--teal); height: 8px; vertical-align: 1px; }

.rec { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; margin-top: 2px; }
.pic { display: block; width: 100%; aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 5px; background: #fff; }
.rec-note { font-weight: 700; margin-bottom: 10px; }
.rec-name { font: 700 17px/1.25 var(--head); margin-bottom: 5px; }
.rec-store { font-size: 13px; color: #4a4314; font-weight: 600; margin-bottom: 6px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; font-size: 13px; font-weight: 600; }
.facts div { display: flex; justify-content: space-between; gap: 4px; border-bottom: 1.5px solid rgba(17, 48, 47, .35); }
.facts .fig { font-size: 14px; }
.facts .fact-wide { grid-column: 1 / -1; }
.facts .is-over, .facts .is-over .fig { color: var(--red); }
.why { margin-top: 10px; font-size: 14px; line-height: 1.45; }
.rec-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }

.sect-head { color: var(--on-pine); margin-top: 6px; }
.stores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stub {
  display: flex;
  flex-direction: column;
  border: 0;
  padding: 8px;
  text-align: left;
  transition: transform .2s var(--ease);
}
.stub:hover { transform: translateY(-3px); }
.stub .pic { margin-bottom: 7px; }
.stub-name { font-weight: 700; font-size: 13.5px; line-height: 1.25; }
.stub-state { margin-top: 3px; font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--ink-soft); }
.stub.is-open .stub-state { color: #0a6455; }
.stub.is-closed { --stock: #d7dfdb; }
.stub.is-closed .stub-state { color: var(--ink); }
.stub.is-closed .pic { filter: grayscale(1); }

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--pine-deep);
  border-top: 2px dashed var(--pine-line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px 7px;
  min-height: 58px;
  color: var(--on-pine-soft);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: color .15s;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { color: #fff; }
.tab[aria-current="page"] { color: var(--butter); font-weight: 700; }
.tab-badge {
  position: absolute;
  top: 5px;
  left: calc(50% + 7px);
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--salmon);
  color: var(--ink);
  font: 700 12px/18px var(--figure);
  text-align: center;
}

.ticket-no { font-size: 16px; }
.ticket-body { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; align-items: center; }
.ticket-name { font: 700 16px/1.25 var(--head); }
.ticket-meta { font-size: 13.5px; color: var(--ink-soft); font-weight: 500; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 14px; }
.steps li { font-size: 12px; font-weight: 600; line-height: 1.25; color: var(--ink-soft); padding-top: 7px; border-top: 4px solid rgba(17, 48, 47, .2); }
.steps li.done { border-color: var(--teal); color: var(--ink); }
.steps li.now { border-color: var(--carbon); color: var(--carbon); font-weight: 700; }
.ticket-actions { display: flex; gap: 8px; margin-top: 12px; }
.ticket-actions .btn:first-child { flex: 1; }
.has-stamp { overflow: hidden; }
.stamp {
  position: absolute;
  right: 12px;
  top: 40px;
  padding: 2px 10px;
  border: 3px solid currentColor;
  border-radius: 5px;
  color: var(--carbon);
  background: rgba(255, 255, 255, .2);
  font: 700 19px/1.3 var(--head);
  transform: rotate(-9deg);
  pointer-events: none;
}
.stamp.void { color: var(--red); }
.stamp.ready { color: #0a6455; }
.stamp.hit { animation: stamp .42s var(--ease) both; }
@keyframes stamp {
  0% { transform: rotate(-16deg) scale(2.1); opacity: 0; filter: blur(2px); }
  100% { transform: rotate(-9deg) scale(1); opacity: 1; filter: blur(0); }
}
.coupon.is-used { filter: saturate(.55); }
.empty { text-align: center; padding: 22px 14px; }
.empty h2 { font: 700 18px/1.3 var(--head); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

.line { position: relative; height: 44px; margin: 30px 4px 4px; }
.line-bar { position: absolute; left: 0; right: 0; top: 10px; height: 10px; background: rgba(17, 48, 47, .15); border-radius: 2px; }
.line-mark { position: absolute; top: 3px; width: 4px; height: 24px; margin-left: -2px; background: var(--carbon); }
.line-mark span { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); font: 700 12px/1 var(--figure); color: var(--carbon); white-space: nowrap; }
.line-scale { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.bars li { margin-top: 10px; }
.bars-top { display: flex; justify-content: space-between; font-weight: 600; }
.bars-top .fig { font-size: 14px; }
.bar { height: 10px; margin-top: 3px; background: rgba(17, 48, 47, .15); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--teal); transition: width .6s var(--ease); }
.bar i.is-limit { background: var(--carbon); }
.bar i.is-over { background: var(--red); }
.meals li { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1.5px solid rgba(17, 48, 47, .25); }
.meals li:last-child { border-bottom: 0; }
.meals .fig { font-size: 14px; white-space: nowrap; }
.meals span:nth-child(2) { flex: 1; font-weight: 600; }
.water { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.water .duty-field { width: 150px; margin: 0; flex: none; }
.water-head { font: 700 18px/1.25 var(--head); }
.foot-note { font-size: 13px; line-height: 1.5; color: var(--on-pine-soft); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.field.full { grid-column: 1 / -1; }
.field input, .field select {
  min-height: 44px;
  width: 100%;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: #fff;
  font-weight: 500;
  font-size: 16px;
}
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.opt span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: #fff;
  font-weight: 600;
}
.opt input:checked + span { background: var(--ink); color: #fff; }
.opt input:focus-visible + span { outline: 3px solid var(--carbon); outline-offset: 2px; }
.opts { display: grid; gap: 8px; margin-top: 6px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opts.three { grid-template-columns: repeat(3, 1fr); }
.opts .opt span { justify-content: center; text-align: center; line-height: 1.25; padding: 8px; height: 100%; }
.group-label { font-weight: 700; margin-top: 14px; }

.scrim { position: absolute; inset: 0; background: rgba(5, 25, 25, .65); z-index: 10; }
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  max-height: 88%;
  overflow-y: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--paper);
  border-radius: 12px 12px 0 0;
  animation: rise .36s var(--ease) both;
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.sheet-head h2 { font: 700 20px/1.25 var(--head); }
.sheet-close { flex: none; width: 44px; height: 44px; margin: -8px -8px 0 0; border: 0; background: none; display: grid; place-items: center; }
.sheet-close svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.sheet-sub { color: var(--ink-soft); margin-top: -6px; margin-bottom: 12px; font-size: 14px; }
.sheet-menu { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 12px; }
.after { margin-top: 12px; padding: 9px 11px; background: var(--mint); border-radius: 5px; font-weight: 600; font-size: 14px; }
.pay { margin-top: 14px; }
.menu-list li { border-bottom: 1.5px solid rgba(17, 48, 47, .25); }
.menu-list li:last-child { border-bottom: 0; }
.menu-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 2px;
  border: 0;
  background: none;
  text-align: left;
}
.menu-item:hover:not(:disabled) { background: var(--mint); }
.menu-item:disabled { cursor: not-allowed; }
.menu-item:disabled .pic { filter: grayscale(1); }
.menu-name { font-weight: 700; line-height: 1.3; display: block; }
.menu-note { font-size: 13px; color: var(--ink-soft); }
.menu-price { font-size: 15px; }

.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 74px;
  z-index: 20;
  padding: 11px 14px;
  border-radius: 5px;
  background: var(--butter);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .7);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .25s, transform .35s var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

@media (max-width: 359px) {
  .duty-row { grid-template-columns: 1fr; }
  .need { grid-template-columns: 1fr; justify-items: center; }
  .macros { width: 100%; }
  .stores { grid-template-columns: 1fr 1fr; }
  .rec { grid-template-columns: 96px minmax(0, 1fr); }
  .rec-actions { grid-template-columns: 1fr; }
}

@media (min-width: 900px) {
  .stage {
    display: grid;
    grid-template-columns: minmax(280px, 400px) 412px;
    gap: clamp(40px, 7vw, 110px);
    justify-content: center;
    align-items: center;
    padding: 24px;
  }
  .pitch { display: block; color: var(--on-pine); }
  .pitch-name { font: 700 clamp(44px, 4.6vw, 66px)/1.02 var(--head); color: var(--butter); }
  .pitch-line { margin-top: 14px; font-size: 20px; line-height: 1.45; }
  .pitch-note { margin-top: 20px; font-size: 14px; color: var(--on-pine-soft); }
  .phone {
    height: min(880px, calc(100dvh - 48px));
    border-radius: 26px;
    box-shadow: 0 0 0 8px #051c1d, 0 26px 50px -18px rgba(0, 0, 0, .85);
  }
  .topbar { padding-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
