/* The restaurant portal (/app/). Ported from spin-to-win's manage page (v1), which the owner approved:
   thermal-paper white, herb ink, parsley actions, sumac warnings. The receipt strips are the one loud element;
   everything else stays quiet. Loaded after /common/ui.css (login form, dialogs) and overrides it. */
:root {
  --paper: #f7f8f5;
  --surface: #ffffff;
  --thermal: #fdfdfb;
  --ink: #1d2b24;
  --ink-2: #4e5c54;
  --line: #d9ded7;
  --parsley: #2f7a3e;
  --parsley-dark: #235d2f;
  --parsley-tint: #e6f1e3;
  --lime: #8cc63f;
  --sumac: #a3343f;
  --sumac-tint: #f8e7e8;
  --saffron: #9a6a12;
  --saffron-tint: #fbf0d9;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --print: "Courier Prime", "Courier New", ui-monospace, monospace;
  --nav-h: 64px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.5 var(--font); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

h1 { font-size: 1.75rem; line-height: 1.15; font-weight: 800; margin: 0 0 .35rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; line-height: 1.25; font-weight: 800; margin: 2rem 0 .75rem; }
.lead { margin: 0 0 1.5rem; color: var(--ink-2); max-width: 34em; }
.quiet { color: var(--ink-2); }
.small { font-size: .9rem; }

/* header + navigation */
.bar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; padding-top: max(14px, env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--line); }
.home { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: inherit; text-decoration: none; font-weight: 800; }
.mark { width: 26px; height: 26px; border-radius: 50%; flex: none; border: 2px solid var(--ink);
  background: conic-gradient(var(--lime) 0 60deg, var(--surface) 0 120deg, var(--lime) 0 180deg, var(--ink) 0 240deg, var(--lime) 0 300deg, var(--surface) 0); }
.bar .lang { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 2px 6px; min-height: 40px; display: inline-flex; align-items: center; }
.bar .lang button { min-height: 34px; }
.bar .btn.small { min-height: 40px; padding: 6px 14px; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--nav-h);
  color: var(--ink-2); text-decoration: none; font-size: .8rem; font-weight: 600; }
.nav a[aria-current="page"] { color: var(--parsley-dark); }
.nav a[aria-current="page"] svg { background: var(--parsley-tint); }
.nav .ico { display: contents; }
.nav svg { width: 46px; height: 28px; padding: 2px 11px; border-radius: 999px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 720px; margin: 0 auto; padding: 28px 20px calc(var(--nav-h) + 48px); }

@media (min-width: 820px) {
  .nav { position: static; display: flex; justify-content: center; gap: 4px; border-top: 0; border-bottom: 1px solid var(--line);
    background: var(--paper); padding: 0 20px; }
  .nav a { flex-direction: row; gap: 8px; min-height: 52px; padding: 0 16px; font-size: .95rem; border-bottom: 3px solid transparent; }
  .nav a[aria-current="page"] { border-bottom-color: var(--parsley); }
  .nav a[aria-current="page"] svg { background: none; }
  .nav svg { width: 22px; height: 22px; padding: 0; }
  main { padding-bottom: 64px; }
}

/* the receipt strip: printed on thermal paper, torn at the bottom */
.receipt { position: relative; background: var(--thermal); font-family: var(--print); font-size: 1rem; line-height: 1.55;
  padding: 22px 24px 26px; margin: 0 0 36px; max-width: 440px;
  box-shadow: 0 0 0 1px var(--line), 0 18px 30px -24px rgba(29, 43, 36, .55); }
.receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background: linear-gradient(-45deg, transparent 7px, var(--thermal) 0) 0 0 / 14px 10px repeat-x,
              linear-gradient(45deg, transparent 7px, var(--thermal) 0) 0 0 / 14px 10px repeat-x;
  filter: drop-shadow(0 1px 0 var(--line)); }
.receipt .head { text-align: center; font-weight: 700; margin-bottom: 6px; }
.receipt .when { text-align: center; color: var(--ink-2); margin-bottom: 10px; }
.receipt .cut { border-top: 2px dashed #b9c0b7; margin: 12px 0; }
.rl { display: flex; align-items: baseline; gap: 8px; }
.rl .fill { flex: 1; border-bottom: 2px dotted #b9c0b7; transform: translateY(-.3em); min-width: 12px; }
.rl .v { font-weight: 700; white-space: nowrap; }
.rl.big { font-size: 1.3rem; margin: 6px 0; }
.rl.reached .v { color: var(--sumac); }
.receipt .foot { color: var(--ink-2); font-size: .85rem; line-height: 1.45; margin-top: 12px; }
.receipt .placeholder { color: var(--ink-2); }

/* segmented control (today / week / month) */
.seg { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 3px; margin-bottom: 20px; }
.seg button { white-space: nowrap; border: 0; background: none; border-radius: 999px; padding: 8px 16px; min-height: 40px; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

/* lists */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 14px 18px; border: 0;
  border-top: 1px solid var(--line); background: none; text-align: left; }
.row:first-child { border-top: 0; }
button.row:hover { background: #f2f5f0; }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 800; overflow-wrap: anywhere; }
.row .sub { color: var(--ink-2); font-size: .9rem; }
.row .odds { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .odds small { display: block; font-weight: 400; color: var(--ink-2); font-size: .85rem; }
.row .chev { color: #a9b1a8; font-size: 1.4rem; line-height: 1; }
.row.leftover { background: repeating-linear-gradient(-45deg, transparent 0 8px, #f3f5f1 8px 16px); }
.swatch { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 2px solid var(--ink); }
.flag { display: inline-block; font-size: .8rem; font-weight: 700; border-radius: 999px; padding: 1px 9px; margin-left: 6px; }
.flag.max { background: var(--sumac-tint); color: var(--sumac); }

.add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 56px; margin-top: 14px;
  border: 2px dashed #b7c0b5; border-radius: 18px; background: none; font-weight: 800; color: var(--parsley-dark); }
.add:hover { border-color: var(--parsley); background: var(--parsley-tint); }

.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line); }
.events li:first-child { border-top: 0; }
.events time { color: var(--ink-2); min-width: 4.2em; font-variant-numeric: tabular-nums; }
.notice { background: var(--saffron-tint); color: #5e410a; border-radius: 14px; padding: 12px 16px; margin: 0 0 20px; border: 0; display: block; }

/* forms */
.field { display: block; margin-bottom: 18px; }
.field > .label { display: block; font-weight: 800; margin-bottom: 6px; }
.field > .help { display: block; color: var(--ink-2); font-size: .9rem; margin-top: 6px; }
.field > .error { display: block; color: var(--sumac); font-size: .9rem; font-weight: 600; margin-top: 6px; }
.field > .error:empty, .field > .help:empty { display: none; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pair label { display: block; }
.pair .lang-name { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: 4px; }
input[type="text"] { width: 100%; min-height: 50px; padding: 10px 14px; border: 1.5px solid #c5ccc3; border-radius: 12px; background: var(--surface); }
input[type="text"]:focus { outline: none; border-color: var(--parsley); box-shadow: 0 0 0 3px var(--parsley-tint); }
input.invalid { border-color: var(--sumac); }
.money { position: relative; max-width: 180px; }
.money input { padding-right: 34px; }
.money span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stepper button { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 1.5px solid #c5ccc3; background: var(--surface); font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stepper button:hover { border-color: var(--parsley); color: var(--parsley-dark); }
.stepper input { width: 96px; text-align: center; font-size: 1.4rem; font-weight: 800; }
.stepper .of { color: var(--ink-2); }
.limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.limits label span { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: 4px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.check input { width: 24px; height: 24px; accent-color: var(--parsley); flex: none; }
.radio-list { display: grid; gap: 4px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); padding: 0; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--parsley); }
details.more { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
details.more > summary { min-height: 48px; display: flex; align-items: center; font-weight: 800; color: var(--parsley-dark); cursor: pointer; }
details.more[open] > summary { margin-bottom: 10px; }
.impact { background: var(--parsley-tint); color: var(--parsley-dark); border-radius: 12px; padding: 10px 14px; font-weight: 600; margin: 0 0 18px; }
.impact:empty { display: none; }

/* buttons */
.btn { min-height: 50px; padding: 10px 20px; border-radius: 999px; border: 1.5px solid #c5ccc3; background: var(--surface); font-weight: 800; }
.btn.primary { background: var(--parsley); border-color: var(--parsley); color: #fff; }
.btn.primary:hover { background: var(--parsley-dark); }
.btn.primary:disabled { background: #9fb8a4; border-color: #9fb8a4; cursor: not-allowed; }
.btn.danger { color: var(--sumac); border-color: #e3b9bd; }
.btn.danger.armed { background: var(--sumac); border-color: var(--sumac); color: #fff; }
.btn.link.delete { color: var(--sumac); }
.btn.link { border: 0; background: none; padding: 10px 4px; color: var(--parsley-dark); text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.actions .spacer { flex: 1; }

/* coupon checker */
.checker { display: flex; gap: 10px; }
.checker input { flex: 1; min-height: 60px; font: 700 1.5rem/1 var(--print); letter-spacing: .06em; }
.checker .btn { min-height: 60px; }
.result { margin-top: 18px; border-radius: 18px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--line); }
.result.good { border-left-color: var(--parsley); }
.result.bad { border-left-color: var(--sumac); }
.result.warn { border-left-color: var(--saffron); }
.result .status { font-size: 1.5rem; font-weight: 800; }
.result.good .status { color: var(--parsley-dark); }
.result.bad .status { color: var(--sumac); }
.result.warn .status { color: var(--saffron); }
.result .prize { font-size: 1.15rem; font-weight: 800; margin-top: 4px; }
.code { font-family: var(--print); font-weight: 700; letter-spacing: .04em; }

/* bottom sheet (phone) / dialog (computer) */
dialog#sheet { border: 0; padding: 0; width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; border-radius: 22px 22px 0 0;
  background: var(--paper); color: var(--ink); box-shadow: 0 -10px 40px rgba(29, 43, 36, .25); }
dialog#sheet::backdrop { background: rgba(29, 43, 36, .45); }
dialog#sheet[open] { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
.sheet-body { padding: 22px 20px 0; overflow-y: auto; max-height: 92dvh; }
.sheet-body h1 { font-size: 1.4rem; margin-bottom: 18px; }
.sheet-body > .actions { position: sticky; bottom: 0; background: var(--paper); margin: 22px -20px 0;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
dialog#sheet.wide { max-width: 980px; }
dialog#sheet iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #000; }
@media (min-width: 620px) {
  dialog#sheet { margin: auto; border-radius: 22px; }
}

/* toast with undo */
#note { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 30; transform: translate(-50%, 16px);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
#note.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#note.error { background: var(--sumac); }
#note button { border: 0; background: none; color: var(--lime); font-weight: 800; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 820px) { #note { bottom: 28px; } }

@media (max-width: 520px) {
  h1 { font-size: 1.5rem; }
  .pair { grid-template-columns: 1fr; }
  .limits { gap: 8px; }
  .checker { flex-direction: column; }
  .receipt { padding: 18px 18px 22px; font-size: .95rem; }
}

@media (max-width: 420px) {
  .seg button { padding: 8px 11px; font-size: .92rem; }
  .rl.big { font-size: 1.1rem; }
  .sheet-body > .actions .btn:not(.delete) { flex: 1; }
}

/* the prizes bill: one tappable line per prize, adding up like a receipt */
.receipt.bill { max-width: 540px; padding-left: 0; padding-right: 0; }
.bill .cut { margin: 10px 24px; }
.bill .foot { padding: 0 24px; }
.pline { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 10px 24px; border: 0; background: none;
  text-align: left; font: inherit; color: inherit; }
button.pline { cursor: pointer; }
button.pline:hover { background: #eef2eb; }
.pline .swatch { width: 16px; height: 16px; border-width: 1.5px; }
.pline .pname { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.pline .pmath { display: block; font-weight: 400; color: var(--ink-2); font-size: .92rem; }
.pline .pmax { display: inline-block; margin-left: .7em; }
.pline .pmax.hit { color: var(--sumac); font-weight: 700; }
.pline .ptotal { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pline.people .pname { font-weight: 400; }
.pline.people .ptotal { font-size: 1.2rem; }
.pline.sum { font-size: 1.25rem; min-height: 0; }
.pline.sum .pmath { font-size: .8rem; }
button.foot.nobody { display: block; width: 100%; border: 0; background: none; font: inherit; font-size: .85rem; color: var(--ink); text-align: left;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding-top: 4px; padding-bottom: 4px; }
.field > .help.warn { color: var(--saffron); font-weight: 600; }
.inline { display: flex; align-items: center; gap: 10px; }
.stepper select { min-height: 52px; border: 1.5px solid #c5ccc3; border-radius: 12px; padding: 0 12px; background: var(--surface); font-weight: 600; }
@media (max-width: 420px) {
  .pline { padding: 10px 16px; gap: 10px; }
  .bill .cut { margin: 10px 16px; }
  .bill .foot { padding: 0 16px; }
}
.money.small-in { max-width: 96px; }
.inline { flex-wrap: wrap; }
@media (max-width: 420px) { .stepper input { width: 76px; } .stepper button { width: 48px; height: 48px; } }
.receipt.mini { margin: 6px 0 8px; max-width: none; font-size: .92rem; }
.receipt .foot.warn, .bill .foot.warn { color: var(--saffron); font-weight: 700; }
.field > .help.strong { color: var(--parsley-dark); font-weight: 700; font-size: 1rem; }
.field .seg { margin-bottom: 4px; }

/* ---- fleet additions ---- */
.acting { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 20px; background: var(--saffron-tint); color: #5e410a;
  border-bottom: 1px solid #ead9b0; font-weight: 600; }
.acting .btn.small { min-height: 36px; padding: 4px 12px; }
.flag.warn { background: var(--saffron-tint); color: var(--saffron); }
.nav a { padding: 0 2px; text-align: center; }
@media (max-width: 380px) { .nav a { font-size: .72rem; } .nav svg { width: 40px; padding: 2px 8px; } }

/* their screens */
.screens { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.screen-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.sc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-head .quiet { margin-left: auto; }
.screen-card .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.screen-card .badges .flag { margin-left: 0; }
.screen-card .actions { margin-top: 14px; gap: 8px; }
.screen-card .btn.small { min-height: 40px; padding: 6px 14px; font-size: .92rem; }
.shot img { display: block; width: 100%; margin-top: 12px; border-radius: 12px; background: #000; aspect-ratio: 16 / 9; object-fit: contain; }
.dot { width: 11px; height: 11px; }
.dot.on { background: var(--parsley); }
.dot.off { background: var(--sumac); }

/* the last 30 days */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; max-width: 540px; padding: 10px 12px 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; }
.chart .day { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.chart .day span { display: block; width: 100%; min-height: 2px; background: var(--parsley); border-radius: 3px 3px 0 0; }
.chart .day:last-child span { background: var(--lime); }
.chart + .small { margin-top: 6px; }

/* settings */
.logo-box { display: grid; place-items: center; min-height: 110px; max-width: 360px; padding: 16px; border-radius: 14px; background: #0d0d0c; }
.logo-box img { max-width: 100%; max-height: 140px; }
.logo-box .quiet { color: rgba(255,255,255,.6); }
input[type="email"], input[type="password"], select { width: 100%; max-width: 460px; min-height: 50px; padding: 10px 14px; border: 1.5px solid #c5ccc3; border-radius: 12px; background: var(--surface); }
.addform { margin-top: 10px; }
dialog.confirm { border-radius: 18px; padding: 22px; max-width: 460px; }
.card.narrow { border-radius: 18px; }
.pair label { font-size: inherit; color: inherit; }
.pair input, .field input, .field select { font-size: 1rem; }
a.row { color: inherit; text-decoration: none; }
a.row:hover { background: #f2f5f0; }
