/* Master Pizza phone — same tokens as the Mac app (Theme.swift). */
:root {
  --basil: #0B4D2C;      /* text, main buttons */
  --leaf: #1F7A4D;       /* selected, links */
  --muted: #5E7A69;      /* secondary text */
  --mint: #E4F1E8;       /* highlights */
  --floor: #F3F7F4;      /* page behind cards */
  --line: #DCE8E0;
  --oven: #C2410C;       /* attention: late, below zero */
  --oven-soft: #FFF1E8;
  --red: #B42318;
  --red-soft: #FDECEA;
  --amber: #8A4B00;
  --amber-soft: #FFF4E0;
  --white: #FFFFFF;
  --radius: 14px;
  --rounded: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--floor); color: var(--basil); font: 15px/1.4 var(--body); }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 2px; }
.hidden, [hidden] { display: none !important; }

/* layout */
#app { min-height: 100vh; min-height: 100dvh; }
.screen { padding: 16px max(16px, env(safe-area-inset-right)) calc(var(--nav-h) + 96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  max-width: 720px; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(243,247,244,.92); backdrop-filter: blur(10px);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 10px; }
.topbar h1 { font: 700 24px/1.1 var(--rounded); margin: 0; flex: 1; }
.sync-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted);
  background: var(--white); border: 1px solid var(--line); border-radius: 99px; padding: 4px 9px; }
.sync-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); }
.sync-dot.off i { background: var(--oven); }
.sub { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }

/* bottom nav */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; background: var(--white);
  border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.nav button { flex: 1; border: 0; background: none; height: var(--nav-h); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); position: relative; }
.nav button svg { width: 22px; height: 22px; }
.nav button.on { color: var(--basil); }
.nav button.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--basil); }
.nav .count { position: absolute; top: 8px; left: calc(50% + 6px); background: var(--oven); color: #fff;
  font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* cards + text */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: 0 3px 8px rgba(11,77,44,.05); }
.section { display: flex; align-items: center; gap: 8px; font: 600 16px var(--rounded); margin: 0 0 10px; }
.section .n { font: 700 11px var(--body); background: var(--mint); border-radius: 99px; padding: 2px 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow, .list-row .grow { flex: 1; min-width: 0; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 3px 0; }
.kv b { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.empty { text-align: center; color: var(--muted); padding: 22px 8px; font-size: 13px; }
.empty b { display: block; color: var(--basil); font-size: 14px; margin-bottom: 3px; }

/* tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.tile .v { font: 700 22px var(--rounded); font-variant-numeric: tabular-nums; margin: 6px 0 2px; }
.tile .l { font-size: 12px; font-weight: 600; }
.tile .n { font-size: 11px; color: var(--muted); }
.tile.hot .v { color: var(--oven); }

/* buttons + chips */
.btn { border: 0; border-radius: 11px; padding: 11px 16px; min-height: 44px; font-weight: 600; background: var(--basil); color: #fff; }
.btn:active { background: var(--leaf); }
.btn:disabled { background: #9DB4A6; }
.btn.ghost { background: var(--white); color: var(--basil); border: 1px solid #B9D0C1; }
.btn.danger { background: var(--white); color: var(--red); border: 1px solid #EBC3BF; }
.btn.warn { background: var(--white); color: var(--oven); border: 1px solid #F0C6AE; }
.btn.block { width: 100%; }
.btn.sm { min-height: 44px; padding: 8px 14px; font-size: 13px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--white); border-radius: 99px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; min-height: 44px; color: var(--basil); }
.chip.on { background: var(--basil); border-color: var(--basil); color: #fff; }
.seg { display: flex; background: var(--mint); border-radius: 11px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 9px 4px; font-weight: 600; font-size: 13px; color: var(--basil); }
.seg button.on { background: var(--white); box-shadow: 0 1px 3px rgba(11,77,44,.12); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 3px 9px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-new { color: var(--oven); background: var(--oven-soft); }
.b-preparing { color: var(--amber); background: var(--amber-soft); }
.b-ready { color: var(--leaf); background: var(--mint); }
.b-completed { color: var(--muted); background: var(--floor); }
.b-cancelled { color: var(--red); background: var(--red-soft); }
.b-low { color: var(--amber); background: var(--amber-soft); }
.b-paid { color: var(--leaf); background: var(--mint); }
.b-unpaid { color: var(--red); background: var(--red-soft); }
.b-neg { color: var(--oven); background: var(--oven-soft); }
.b-ok { color: var(--leaf); background: var(--mint); }

/* forms */
label.field { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.field input, label.field select, label.field textarea { display: block; width: 100%; margin-top: 4px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: var(--white); color: var(--basil); }
.search { display: flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line);
  border-radius: 12px; padding: 0 12px; margin-bottom: 10px; }
.search input { flex: 1; border: 0; padding: 12px 0; font-size: 16px; background: none; outline: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 8px 0; }
.check input { width: 22px; height: 22px; accent-color: var(--basil); }
.error { color: var(--red); font-size: 13px; margin: 6px 0; }
.notice { background: var(--amber-soft); color: var(--amber); border-radius: 11px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }

/* menu items */
.item { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.item.in { border-color: var(--leaf); box-shadow: 0 0 0 1px var(--leaf) inset; }
.item .name { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.item .qty { background: var(--leaf); color: #fff; border-radius: 99px; font-size: 11px; min-width: 22px; height: 22px; display: grid; place-items: center; }
.prices { display: flex; gap: 8px; margin-top: 10px; }
.price { flex: 1; border: 0; border-radius: 10px; background: #EEF6F1; min-height: 46px; padding: 6px; color: var(--basil); }
.price small { display: block; font-size: 11px; color: var(--muted); }
.price b { font: 700 15px var(--rounded); }
.price.none { background: var(--red-soft); color: var(--red); font-size: 12px; display: grid; place-items: center; }

/* cart bar */
.cartbar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); z-index: 9;
  max-width: 696px; margin: 0 auto; background: var(--basil); color: #fff; border: 0; border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px; font-weight: 600; box-shadow: 0 8px 20px rgba(11,77,44,.25); }
.cartbar .grow { flex: 1; text-align: left; }

/* ticket — the signature element */
.ticket { background: var(--white); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; box-shadow: 0 4px 10px rgba(11,77,44,.06); overflow: hidden; }
.ticket.late { border-color: var(--oven); box-shadow: 0 0 0 1px var(--oven) inset; }
.ticket .top { padding: 14px 16px 10px; display: flex; justify-content: space-between; align-items: baseline; }
.ticket .no { font: 700 26px var(--rounded); }
.ticket .when { font-size: 12px; font-weight: 600; color: var(--muted); }
.ticket.late .when { color: var(--oven); }
.ticket .body { padding: 10px 16px; }
.ticket .foot { padding: 10px 16px 14px; display: flex; gap: 8px; }
.perf { position: relative; height: 14px; }
.perf::before { content: ""; position: absolute; left: 10px; right: 10px; top: 6px; border-top: 1.5px dashed var(--line); }
.perf::after { content: ""; position: absolute; left: -7px; right: -7px; top: 0; height: 14px;
  background: radial-gradient(circle at 7px 7px, var(--floor) 6.5px, transparent 7px) left/14px 14px no-repeat,
              radial-gradient(circle at 7px 7px, var(--floor) 6.5px, transparent 7px) right/14px 14px no-repeat; }
.sheet .perf::after { background: radial-gradient(circle at 7px 7px, #fff 0, transparent 0); }
.line { display: flex; gap: 8px; font-weight: 600; margin: 4px 0; }
.line .q { font-family: var(--rounded); min-width: 28px; }
.parts { color: var(--muted); font-size: 12px; margin: 0 0 6px 36px; }
.step { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.step i { width: 22px; height: 22px; border-radius: 50%; background: var(--basil); color: #fff; font: 700 12px var(--rounded); display: grid; place-items: center; font-style: normal; }
.types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.types button { border: 0; border-radius: 10px; background: var(--floor); padding: 10px 2px; font-size: 11px; font-weight: 600; color: var(--basil); min-height: 54px; }
.types button.on { background: var(--basil); color: #fff; }
.stepper { display: inline-flex; align-items: center; background: var(--floor); border-radius: 99px; }
.stepper button { border: 0; background: none; width: 44px; height: 44px; font-size: 18px; font-weight: 700; color: var(--basil); }
.stepper b { min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin: 6px 0 12px; }
.total b { font: 700 24px var(--rounded); }

/* shift checklist */
.progress { height: 6px; background: var(--mint); border-radius: 3px; margin: 2px 0 12px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--leaf); }
.shift { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; margin-bottom: 4px; background: rgba(243,247,244,.7); }
.shift.done { background: none; }
.shift .dot { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; font: 700 12px var(--rounded); flex: none; }
.shift.done .dot { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.shift.done .t { text-decoration: line-through; color: var(--muted); }
.shift .t { font-weight: 600; font-size: 14px; }

/* sheets */
.scrim { position: fixed; inset: 0; background: rgba(8,40,23,.35); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--white); border-radius: 18px 18px 0 0;
  max-height: 92vh; overflow-y: auto; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto;
  animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 10px; }
.sheet h2 { font: 700 21px var(--rounded); margin: 0 0 4px; }
.receipt { font: 12px/1.35 ui-monospace, Menlo, monospace; white-space: pre; background: var(--floor); border-radius: 10px; padding: 12px; overflow-x: auto; color: #000; }

/* login / connect */
.welcome { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.welcome .brand { background: var(--basil); color: #fff; padding: calc(36px + env(safe-area-inset-top)) 24px 28px; }
.welcome .brand h1 { font: 700 34px/1.1 var(--rounded); margin: 14px 0 4px; }
.welcome .brand p { margin: 0; opacity: .8; }
.logo { width: 48px; height: 48px; border-radius: 13px; background: rgba(255,255,255,.14); display: grid; place-items: center; }
.welcome form { padding: 22px 20px 40px; max-width: 480px; width: 100%; margin: 0 auto; }
.welcome h2 { font: 700 22px var(--rounded); margin: 0 0 4px; }
.linkbtn { border: 0; background: none; color: var(--leaf); font-weight: 600; font-size: 13px; padding: 10px 0; }
.toast { position: fixed; left: 16px; right: 16px; top: calc(12px + env(safe-area-inset-top)); z-index: 40; background: var(--basil); color: #fff;
  border-radius: 12px; padding: 12px 14px; font-size: 14px; box-shadow: 0 8px 20px rgba(0,0,0,.2); max-width: 680px; margin: 0 auto; }
.toast.bad { background: var(--red); }

@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
