:root {
  --bg-light: #F7F0E3;
  --bg: var(--bg-light);
  --bg-elev: rgba(255, 252, 247, .92);
  --ink: #2B2B2B;
  --muted: #6E675F;
  --line: rgba(43, 43, 43, .08);
  --tenant: #E8722A;
  --tenant-ink: #2B2B2B;
  --on-tenant: #fff;
  --accent: #E8722A;
  --sage: #6E8B74;
  --sage-soft: #E5F0E4;
  --gold: #E8B15A;
  --shadow: 0 20px 50px rgba(43, 43, 43, .08);
  --shadow-soft: 0 8px 24px rgba(43, 43, 43, .06);
  --radius: 26px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, "Noto Serif", serif;
  --safe-b: env(safe-area-inset-bottom);
  --safe-t: env(safe-area-inset-top);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #141311;
  --bg-elev: rgba(33, 30, 27, .92);
  --ink: #F7F0E3;
  --muted: #C9C0B2;
  --line: rgba(247, 240, 227, .12);
  --shadow: 0 20px 50px rgba(0, 0, 0, .4);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, .28);
  --sage-soft: #243028;
  color-scheme: dark;
}

html[data-brand="sealand"][data-theme="dark"] {
  --bg: #0E1A24;
  --bg-elev: rgba(18, 40, 56, .94);
  --ink: #F3FBFF;
  --muted: #C5D7E2;
  --line: rgba(228, 241, 247, .12);
}

html[data-brand="eastangus"][data-theme="dark"] {
  --bg: #161210;
  --bg-elev: rgba(36, 24, 22, .94);
  --ink: #F8F1E8;
  --muted: #D9C8C2;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--tenant) 16%, transparent), transparent 60%),
    var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
a { color: inherit; }

.app-loading { min-height: 100dvh; }

.shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
}

.sider {
  display: none;
}

.main {
  min-width: 0;
  padding-bottom: calc(96px + var(--safe-b));
}

.main-inner {
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding-top: calc(18px + var(--safe-t));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand-lockup { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.brand-lockup img.supplier-logo { height: 34px; width: auto; }
html[data-theme="dark"] .supplier-logo,
html[data-theme="dark"] .wordmark {
  background: #F7F0E3;
  border-radius: 12px;
  padding: 6px 10px;
}
.powered {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .01em;
}
.powered img { width: 16px; height: 16px; border-radius: 4px; }

.icon-btn, .btn, .choice, .nav-btn {
  border: 0;
  background: transparent;
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-soft);
  display: grid;
  place-items: center;
}
.icon-btn:active { transform: scale(.97); }

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.035em; margin: 0; }
h1 { font-size: clamp(32px, 5vw, 46px); line-height: 1.05; font-weight: 720; }
h2 { font-size: 22px; letter-spacing: -0.03em; }
.lede { color: var(--muted); font-size: 17px; margin: 8px 0 0; max-width: 38ch; }
.kicker {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tenant);
  margin: 0 0 6px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(16px);
}
.card + .card { margin-top: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
  transition: transform .35s cubic-bezier(.22, 1.15, .36, 1), background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--tenant); color: var(--on-tenant); width: 100%; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-sage { background: var(--sage); color: white; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn.small { min-height: 40px; border-radius: 12px; padding: 0 12px; width: auto; }

.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; color: var(--muted); }

.choice-grid { display: grid; gap: 10px; }
.choice {
  text-align: left;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 16px 15px;
  box-shadow: var(--shadow-soft);
  transition: transform .4s cubic-bezier(.22, 1.2, .36, 1), border-color .2s;
}
.choice:active { transform: scale(.985); }
.choice strong { display: block; font-size: 18px; letter-spacing: -0.02em; }
.choice span { display: block; color: var(--muted); margin-top: 2px; font-size: 14px; }
.choice.selected, .chip.on {
  border-color: color-mix(in srgb, var(--tenant) 70%, transparent);
  background: color-mix(in srgb, var(--tenant) 12%, var(--bg-elev));
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 15px;
}
.chip.on { color: var(--ink); }

.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elev);
  border-radius: 22px;
  padding: 8px;
  border: 1px solid var(--line);
}
.stepper button {
  width: 56px; height: 56px; border-radius: 16px; border: 0;
  background: color-mix(in srgb, var(--tenant) 14%, var(--bg));
  font-size: 28px;
}
.stepper b { font-size: 34px; letter-spacing: -0.04em; }

.progress {
  display: flex; gap: 5px; margin: 8px 0 18px;
}
.progress i {
  height: 4px; flex: 1; border-radius: 99px;
  background: var(--line);
}
.progress i.on { background: var(--tenant); }

.stocky-hero { width: 148px; height: auto; display: block; margin: 4px auto 8px; filter: drop-shadow(0 16px 20px rgba(43,43,43,.12)); }

.recipe-list { display: grid; gap: 12px; }
.recipe-card {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 12px;
  text-decoration: none;
  color: inherit;
  align-items: center;
}
.recipe-swatch {
  height: 92px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: white;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.recipe-card h3 { font-size: 18px; letter-spacing: -0.03em; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pill {
  font-size: 12px;
  font-weight: 650;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sage) 16%, transparent);
  color: var(--ink);
}
.pill.warn { background: color-mix(in srgb, var(--tenant) 18%, transparent); }
.reasons { margin: 8px 0 0; padding: 0; list-style: none; }
.reasons li { font-size: 14px; color: var(--muted); }
.reasons li::before { content: "· "; color: var(--tenant); }

.hero-recipe {
  border-radius: 30px;
  padding: 22px;
  color: white;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-recipe::after {
  content: "";
  position: absolute;
  width: 180px; height: 180px; border-radius: 50%;
  right: -40px; top: -50px;
  background: rgba(255,255,255,.12);
}
.safety {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--sage) 18%, var(--bg-elev));
  font-size: 14.5px;
}

.ingredient, .inv-item, .match-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.ingredient:last-child, .inv-item:last-child { border-bottom: 0; }
.check {
  width: 22px; height: 22px; border-radius: 7px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 35%, transparent);
  display: grid; place-items: center;
  background: transparent;
}
.check.on { background: var(--sage); border-color: var(--sage); color: white; }
.have { color: var(--sage); font-size: 13px; font-weight: 700; }
.miss { color: var(--muted); font-size: 13px; }

.qty {
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-radius: 12px; padding: 4px;
}
.qty button { width: 32px; height: 32px; border: 0; border-radius: 9px; background: var(--bg-elev); }

.loc {
  display: flex; gap: 6px;
}
.loc button { border-radius: 999px; border: 1px solid var(--line); background: transparent; padding: 6px 10px; font-size: 13px; }
.loc button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.search {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: 16px;
  min-height: 52px;
  padding: 0 16px;
  outline: none;
}
.search:focus, input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--tenant) 65%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tenant) 18%, transparent);
}

label.field, form label {
  display: grid; gap: 6px; font-size: 14px; font-weight: 650; margin-bottom: 12px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-radius: 14px;
  min-height: 48px;
  padding: 10px 12px;
}
textarea { min-height: 90px; resize: vertical; }
.hp { position: absolute; left: -9999px; }

.sheet {
  position: fixed; inset: auto 0 0 0;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -20px 60px rgba(0,0,0,.28);
  padding: 14px 16px calc(120px + var(--safe-b));
  z-index: 50;
  max-height: min(92dvh, 820px);
  overflow: auto;
}
.ocr-line {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.ocr-line input[type="checkbox"] { width: 22px; height: 22px; margin-top: 12px; }
.ocr-line input[type="text"], .ocr-line input:not([type]) { background: var(--bg-elev); }
body:has(.sheet) #global-tray { display: none; }
.grab { width: 42px; height: 5px; border-radius: 99px; background: var(--line); margin: 2px auto 12px; }
.scrim { position: fixed; inset: 0; background: rgba(20,16,12,.35); z-index: 25; }

.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  z-index: 20;
  padding: 6px;
}
.tabbar a {
  text-decoration: none;
  text-align: center;
  padding: 8px 4px 6px;
  border-radius: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
}
.tabbar a.on { background: color-mix(in srgb, var(--tenant) 16%, transparent); color: var(--ink); }
.tabbar svg { display: block; margin: 0 auto 2px; }

.global-tray {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(92px + var(--safe-b));
  z-index: 19;
  display: flex; gap: 8px; overflow: auto;
}
.timer-pill {
  background: var(--ink); color: var(--bg);
  border-radius: 999px; padding: 8px 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 14px;
  white-space: nowrap;
}
.timer-pill.done { background: var(--tenant); color: white; }

.cook {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding: calc(12px + var(--safe-t)) 18px calc(16px + var(--safe-b));
}
.cook-top, .cook-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cook-body { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.step-title { font-size: clamp(30px, 6vw, 48px); line-height: 1.05; margin: 8px 0; }
.step-body { font-size: 20px; line-height: 1.4; max-width: 38ch; }
.timer-card {
  margin-top: 22px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 28px;
  padding: 18px 18px 16px;
}
.timer-card .time { font-size: 64px; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1; }
.timer-tray { display: flex; gap: 8px; overflow: auto; padding: 8px 0; }
.cook-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 8px; }
.cheer {
  position: absolute; inset: 0;
  background: color-mix(in srgb, var(--bg) 94%, var(--tenant));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
}
.wake-hint { font-size: 13px; color: var(--muted); }

.banner { border-radius: 16px; padding: 12px 14px; margin: 0 0 12px; }
.banner-bad { background: #F8E0D8; color: #6E2418; }
.banner-good { background: var(--sage-soft); }
html[data-theme="dark"] .banner-bad { background: #4A241C; color: #FFD9CF; }

.toasts { position: fixed; top: calc(12px + var(--safe-t)); left: 12px; right: 12px; z-index: 60; display: grid; gap: 8px; }
.toast {
  background: var(--ink); color: var(--bg);
  border-radius: 16px; padding: 12px 14px;
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  box-shadow: var(--shadow);
}
.update-toast { animation: sheet .45s cubic-bezier(.22,1.1,.36,1); }

.install-card { display: flex; gap: 12px; align-items: center; }

.empty { text-align: center; padding: 12px 8px 20px; }
.empty img { width: 160px; }

.auth-card { max-width: 460px; margin: 12px auto; }
.dots { letter-spacing: .2em; }

.admin-body { background: var(--bg); }
.admin-wrap { width: min(880px, calc(100% - 28px)); margin: 24px auto 60px; }
.admin-top { margin-bottom: 16px; }
.wordmark { height: 42px; }
.admin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.admin-stats strong { display: block; font-size: 32px; letter-spacing: -0.04em; }
.admin-tenant-head, .color-row { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.color-row label { flex: 1; min-width: 120px; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: .08em; }
.form-card h1 { margin-bottom: 8px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; }

.offline { min-height: 100dvh; display: grid; place-items: center; text-align: center; padding: 24px; }
.offline button { margin-top: 12px; }

.catalog-hit { width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 12px 0; }
.price { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }

@media (min-width: 980px) {
  .shell { grid-template-columns: 280px 1fr; }
  .sider {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 28px 18px;
    position: sticky;
    top: 0;
    height: 100dvh;
  }
  .sider a.nav-link {
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--muted);
    font-weight: 650;
  }
  .sider a.nav-link.on { background: color-mix(in srgb, var(--tenant) 14%, transparent); color: var(--ink); }
  .sider .grow { flex: 1; }
  .tabbar { display: none; }
  .main { padding-bottom: 40px; }
  .global-tray { left: 300px; bottom: 20px; }
  .recipe-list.grid { grid-template-columns: 1fr 1fr; }
}

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

@keyframes rise-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sheet {
  from { opacity: 0; }
  to { opacity: 1; }
}
.rise { animation: rise-in .45s cubic-bezier(.22, 1.05, .36, 1) both; }
