:root {
  --bg: #f6f4f1; --card: #ffffff; --text: #1b1a18; --muted: #8a857d; --line: #e8e4de;
  --accent: #f0643a; --accent-soft: #fdebe4; --accent-text: #ffffff;
  --ok: #2c9e66; --ok-soft: #e1f4ea; --warn: #d98a12; --warn-soft: #fbf0d9; --bad: #d8453f;
  --chip: #efebe5; --shadow: 0 10px 30px rgba(40,30,20,.10); --shadow-sm: 0 2px 8px rgba(40,30,20,.08);
  --glass: rgba(255,255,255,.72); --glass-line: rgba(255,255,255,.5);
  --r: 22px; --r-sm: 14px; --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f0e0d; --card: #1a1917; --text: #f4f1ec; --muted: #8f8a82; --line: #2a2825;
  --accent: #ff7a50; --accent-soft: #3a2118; --accent-text: #1a0e08;
  --ok: #46c284; --ok-soft: #14291f; --warn: #f0b14a; --warn-soft: #33270f; --bad: #ff6b64;
  --chip: #26241f; --shadow: 0 10px 30px rgba(0,0,0,.45); --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --glass: rgba(26,25,23,.72); --glass-line: rgba(255,255,255,.08);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
body { transition: background-color .35s ease, color .35s ease; }
#app { height: 100%; display: flex; flex-direction: column; position: relative; overflow: hidden; }
#screens { flex: 1; min-height: 0; position: relative; }
.screen { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: calc(var(--safe-t) + 16px) 16px calc(var(--tab-h) + var(--safe-b) + 28px);
  opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .25s ease, transform .35s cubic-bezier(.2,.8,.2,1); -webkit-overflow-scrolling: touch; }
.screen.active { opacity: 1; pointer-events: auto; transform: none; }
h1 { font-size: 30px; line-height: 1.08; letter-spacing: -.025em; margin: 6px 0 4px; font-weight: 750; }
h2 { font-size: 20px; letter-spacing: -.018em; margin: 22px 0 10px; font-weight: 700; }
h3 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -.005em; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 12px; }

/* material tab bar */
.material { background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%); }
#tabbar { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding: 6px 8px var(--safe-b);
  display: flex; border-top: 1px solid var(--glass-line); z-index: 20; }
#tabbar[hidden] { display: none; }
#tabbar button { flex: 1; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: 600 10.5px/1 inherit; letter-spacing: .01em; padding: 4px 0; transition: color .2s, transform .12s; }
#tabbar button:active { transform: scale(.92); }
#tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tabbar button.on { color: var(--accent); }
#tabbar button .dot { position: absolute; margin: -22px -22px 0 0; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 16px; padding: 14px 18px; font: 650 16px/1.1 inherit; color: var(--text);
  background: var(--chip); transition: transform .12s ease, opacity .2s, background .2s; cursor: pointer; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-text); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); padding: 8px 10px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; box-shadow: none; }
.btn.small { padding: 9px 13px; font-size: 14px; border-radius: 12px; }
.btn.danger { color: var(--bad); }

/* cards and lists */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }
.pad { padding: 16px; }
.list { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; }
.list > .item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; position: relative; }
.list > .item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 15px; }
.tag { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.tag.ok { background: var(--ok-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.acc { background: var(--accent-soft); color: var(--accent); }
.banner { border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; margin: 0 0 14px; background: var(--accent-soft); color: var(--text); }
.banner.ok { background: var(--ok-soft); } .banner.warn { background: var(--warn-soft); } .banner.bad { background: color-mix(in srgb, var(--bad) 14%, var(--card)); }

/* dish rows */
.dish { display: flex; gap: 12px; padding: 12px; align-items: center; }
.dish img, .thumb { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; flex: none; background: var(--chip); }
.dish .t { font-weight: 620; font-size: 15px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.dish.ok { background: linear-gradient(0deg, var(--ok-soft), var(--ok-soft)), var(--card); }
.dish .acts { display: flex; gap: 8px; margin-top: 9px; }
.slot { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.person { display: flex; align-items: center; gap: 10px; margin: 20px 2px 10px; }
.person h2 { margin: 0; }
.stack-gap > * + * { margin-top: 10px; }

/* swipe */
#screen-swipe { padding: 0; overflow: hidden; }
.sw-head { position: absolute; top: 0; left: 0; right: 0; padding: calc(var(--safe-t) + 14px) 16px 8px; display: flex; align-items: center; justify-content: space-between; z-index: 5; }
.sw-stage { position: absolute; left: 14px; right: 14px; top: calc(var(--safe-t) + 62px); bottom: calc(var(--tab-h) + var(--safe-b) + 104px); touch-action: none; }
.sw-card { position: absolute; inset: 0; background: var(--card); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; will-change: transform; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }
.sw-card .pic { flex: 1; min-height: 0; background: var(--chip) center/cover no-repeat; position: relative; }
.sw-card .info { padding: 14px 18px 18px; }
.sw-card .t { font-size: 19px; font-weight: 700; letter-spacing: -.012em; line-height: 1.2; }
.sw-card .meta { color: var(--muted); font-size: 14px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }
.sw-card .price { color: var(--text); font-weight: 700; }
.stamp { position: absolute; top: 22px; padding: 6px 14px; border: 3px solid; border-radius: 12px; font-weight: 800; font-size: 24px; letter-spacing: .04em; opacity: 0; transform: rotate(-10deg); }
.stamp.yes { left: 20px; color: var(--ok); border-color: var(--ok); } .stamp.no { right: 20px; color: var(--bad); border-color: var(--bad); transform: rotate(10deg); }
.sw-actions { position: absolute; left: 0; right: 0; bottom: calc(var(--tab-h) + var(--safe-b) + 18px); display: flex; justify-content: center; gap: 22px; z-index: 5; }
.round { width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; transition: transform .12s; }
.round:active { transform: scale(.9); } .round svg { width: 30px; height: 30px; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.round.no svg { stroke: var(--bad); } .round.yes svg { stroke: var(--ok); } .round.undo { width: 48px; height: 48px; align-self: center; } .round.undo svg { width: 22px; height: 22px; stroke: var(--muted); }
.sw-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 30px; color: var(--muted); }
.progress { height: 6px; border-radius: 6px; background: var(--chip); overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .4s cubic-bezier(.2,.8,.2,1); }

/* chips, segmented, stepper, inputs */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 0; background: var(--chip); color: var(--text); border-radius: 99px; padding: 9px 14px; font: 600 14px/1 inherit; transition: background .2s, color .2s, transform .12s; }
.chip:active { transform: scale(.95); } .chip.on { background: var(--accent); color: var(--accent-text); }
.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: none; padding: 7px 10px; border-radius: 10px; font: 600 14px/1 inherit; color: var(--muted); transition: all .2s; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.step { display: inline-flex; align-items: center; gap: 2px; background: var(--chip); border-radius: 12px; }
.step button { width: 34px; height: 34px; border: 0; background: none; font-size: 20px; color: var(--text); } .step b { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
input[type=text], input[type=number], input[type=date], input[type=search] { width: 100%; border: 1.5px solid var(--line); background: var(--card); color: var(--text); border-radius: 14px; padding: 12px 14px; font: inherit; outline: none; transition: border-color .2s; }
input:focus { border-color: var(--accent); }
.code { font: 750 30px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .18em; text-align: center; padding: 16px; background: var(--accent-soft); border-radius: 18px; color: var(--accent); }

/* sheet */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .25s; z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 86%; overflow-y: auto; background: var(--card); border-radius: 28px 28px 0 0; padding: 10px 18px calc(24px + var(--safe-b)); z-index: 41; transform: translateY(100%); transition: transform .42s cubic-bezier(.2,.9,.25,1); box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.scrim.on { opacity: 1; } .sheet.on { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 14px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; opacity: 0; transition: all .3s cubic-bezier(.2,.9,.25,1); z-index: 60; max-width: 88%; text-align: center; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); } .empty .big { font-size: 46px; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, var(--chip), var(--card), var(--chip)); background-size: 200% 100%; animation: sh 1.3s linear infinite; border-radius: 16px; height: 90px; margin-bottom: 10px; }
@keyframes sh { to { background-position: -200% 0; } }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--chip); border-top-color: var(--accent); animation: sp .8s linear infinite; margin: 40px auto; } @keyframes sp { to { transform: rotate(360deg); } }
.kbd { font: 600 12px ui-monospace, monospace; background: var(--chip); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
details summary { cursor: pointer; font-weight: 650; padding: 4px 0; }
@media (prefers-reduced-motion: reduce) { * { transition-duration: .01ms !important; animation-duration: .01ms !important; } .screen { transform: none; } }
@media (prefers-reduced-transparency: reduce) { .material { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (min-width: 700px) { #app { max-width: 520px; margin: 0 auto; box-shadow: 0 0 60px rgba(0,0,0,.12); } body { background: color-mix(in srgb, var(--bg) 92%, #000); } }
