/* ==========================================================================
   CookQueue — styles
   Delivery-app aesthetic: white canvas, bold type, rounded cards, one hot
   brand color, and data-driven accent colors (calories, macros, cooks).
   ========================================================================== */

:root {
  --brand: #FF4F1F;
  --brand-dark: #E23D0E;
  --brand-tint: #FFF1EC;
  --ink: #191919;
  --ink-2: #4A4A4A;
  --muted: #6F6F6F;
  --muted-2: #B9B9B9;
  --line: #EBEBEB;
  --bg: #FFFFFF;
  --bg-2: #F6F6F6;
  --ok: #0E9F6E;
  --ok-tint: #E8F7F1;
  --warn: #C2410C;
  --warn-tint: #FFF4E5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 1px rgba(0,0,0,.04);
  --shadow: 0 6px 24px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.18);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --topbar-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
body.modal-open, body.drawer-open { overflow: hidden; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ok { color: var(--ok); font-weight: 700; }
.warn { color: var(--warn); font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 700; font-size: 15px;
  text-decoration: none; transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { background: var(--bg-2); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: #ECECEC; }
.btn-small { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg-2);
  display: inline-grid; place-items: center; font-size: 14px; flex: none;
}
.icon-btn:hover { background: #E8E8E8; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 20px; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: none; }
.logo-mark { color: var(--brand); display: grid; }
.logo-word { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.logo-word b { color: var(--brand); }
.location-pill {
  display: flex; align-items: center; gap: 6px; border: 0; background: transparent;
  padding: 8px 12px; border-radius: 999px; font-size: 14px; white-space: nowrap; flex: none;
}
.location-pill:hover { background: var(--bg-2); }
.search {
  flex: 1; display: flex; align-items: center; gap: 10px; background: var(--bg-2);
  border-radius: 999px; padding: 0 16px; height: 44px; color: var(--muted); min-width: 0;
}
.search:focus-within { box-shadow: 0 0 0 2px var(--ink); background: #fff; }
.search input { border: 0; background: transparent; outline: 0; font: inherit; color: var(--ink); width: 100%; min-width: 0; }
.plan-btn {
  position: relative; display: flex; align-items: center; gap: 8px; flex: none;
  background: var(--ink); color: #fff; border: 0; border-radius: 999px; padding: 11px 18px; font-weight: 700;
}
.plan-btn:hover { background: #333; }
.plan-count {
  background: var(--brand); color: #fff; border-radius: 999px; min-width: 22px; height: 22px;
  display: inline-grid; place-items: center; font-size: 12px; padding: 0 6px;
}
.plan-count[hidden] { display: none; }

/* ---------- Home: promo ---------- */
#app { padding-top: 24px; padding-bottom: 48px; outline: none; min-height: 70vh; }
.promo {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: center;
  background: linear-gradient(120deg, #FFF1EC 0%, #FFE3D6 55%, #FFD3C0 100%);
  border-radius: 24px; padding: 40px; overflow: hidden; position: relative;
}
.promo-kicker { display: inline-block; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-dark); margin-bottom: 10px; }
.promo h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -0.03em; }
.promo h1 span { color: var(--brand); }
.promo p { margin-top: 12px; color: var(--ink-2); max-width: 52ch; font-size: 16px; }
.promo-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.promo-art { position: relative; height: 220px; }
.promo-bento {
  position: absolute; inset: 20px 30px 20px 40px; background: #1C1C1E; border-radius: 28px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 46px; transform: rotate(-6deg);
}
.promo-stat {
  position: absolute; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; top: 0; right: 0; transform: rotate(3deg);
}
.promo-stat b { font-size: 18px; }
.promo-stat small { color: var(--muted); font-size: 12px; }
.promo-stat--2 { top: auto; right: auto; bottom: 0; left: 10px; transform: rotate(-2deg); }
.promo-stat--2 b { color: var(--ok); }

/* ---------- Home: categories & filters ---------- */
.category-rail {
  display: flex; gap: 8px; overflow-x: auto; padding: 22px 2px 8px; scrollbar-width: none;
}
.category-rail::-webkit-scrollbar { display: none; }
.category {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: 0; background: transparent; padding: 6px 10px; border-radius: 14px; font-size: 13px; font-weight: 600; min-width: 84px;
}
.category-icon {
  width: 60px; height: 60px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center;
  font-size: 28px; transition: transform .15s ease, background .15s ease;
}
.category:hover .category-icon { transform: translateY(-2px); }
.category.is-on .category-icon { background: var(--brand-tint); box-shadow: inset 0 0 0 2px var(--brand); }
.category.is-on { color: var(--brand-dark); }

.filter-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0 4px; flex-wrap: wrap; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 0; background: var(--bg-2); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 13px;
}
.pill:hover { background: #ECECEC; }
.pill.is-on { background: var(--ink); color: #fff; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sort select {
  font: inherit; font-weight: 700; color: var(--ink); border: 0; background: var(--bg-2);
  border-radius: 999px; padding: 8px 12px;
}

.section { margin-top: 20px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 24px; font-weight: 800; }

/* ---------- Recipe cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 24px 20px; }
.card { text-decoration: none; display: flex; flex-direction: column; gap: 10px; border-radius: var(--radius); }
.card-media { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
.card-media img, .hero-img img { color: transparent; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .35s ease, transform .5s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card-chip {
  position: absolute; left: 10px; top: 10px; background: #fff; border-radius: 999px; padding: 5px 10px;
  font-size: 12px; font-weight: 700; box-shadow: var(--shadow-sm);
}
.kcal-pill {
  display: inline-block; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800;
}
.card-media .kcal-pill { position: absolute; right: 10px; bottom: 10px; box-shadow: var(--shadow-sm); }
.card-body { display: flex; flex-direction: column; gap: 4px; padding: 0 2px; }
.card-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-title { font-size: 16px; font-weight: 700; }
.rating {
  flex: none; background: var(--bg-2); border-radius: 999px; padding: 2px 8px; font-size: 13px; font-weight: 700;
}
.rating small { color: var(--muted); font-weight: 500; }
.rating--lg { font-size: 15px; padding: 4px 12px; }
.card-meta { color: var(--muted); font-size: 13px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; background: var(--bg-2); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.tag--spicy { background: #FFECEC; color: #B91C1C; }
.tag--mild { background: var(--ok-tint); color: var(--ok); }
.tag-label { margin-right: 2px; }
.peppers { display: inline-flex; gap: 1px; }
.pepper { font-size: 12px; filter: grayscale(1); opacity: .28; }
.pepper.is-on { filter: none; opacity: 1; }

.card--skeleton .card-media { aspect-ratio: 4/3; }
.card--skeleton .line { height: 14px; border-radius: 6px; margin-top: 6px; }
.card--skeleton .line.short { width: 60%; }
.shimmer { background: linear-gradient(90deg, #F2F2F2 25%, #E8E8E8 37%, #F2F2F2 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.empty { grid-column: 1 / -1; text-align: center; padding: 48px 20px; background: var(--bg-2); border-radius: var(--radius); }
.empty > span { font-size: 48px; display: block; }
.empty h3 { margin-top: 8px; font-size: 18px; }
.empty p { color: var(--muted); margin: 6px 0 16px; }
.empty--drawer { background: transparent; }

/* ---------- Recipe page: hero ---------- */
.back-link { display: inline-block; font-weight: 700; text-decoration: none; margin-bottom: 14px; padding: 6px 12px 6px 0; }
.back-link:hover { color: var(--brand); }

.hero {
  position: relative; display: grid; grid-template-columns: 1fr; gap: 10px;
  grid-template-areas: "photo";
}
.hero-img { grid-area: photo; margin: 0; position: relative; border-radius: 20px; overflow: hidden; background: #F4EBDD; aspect-ratio: 2 / 1; max-height: 460px; width: 100%; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-img figcaption {
  position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.62); color: #fff;
  font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; backdrop-filter: blur(6px);
}
.hero-corner { position: absolute; top: 16px; z-index: 2; }
.hero-corner--left { left: 16px; }
.hero-corner--right { right: 16px; }

/* Time badge (top-left) */
.time-card {
  display: flex; align-items: stretch; gap: 16px; background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-radius: 18px; padding: 14px 18px; box-shadow: var(--shadow);
}
.time-stat { display: flex; flex-direction: column; }
.time-label { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.time-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.time-value.is-over { color: var(--warn); }
.time-sub { font-size: 12px; color: var(--muted); }
.time-divider { width: 1px; background: var(--line); }

/* Nutrition badge (top-right) */
.nutri-card {
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-radius: 18px; padding: 10px;
  box-shadow: var(--shadow); width: 248px;
}
.kcal-badge {
  display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; padding: 10px 12px;
  transition: background .3s ease, color .3s ease;
}
.kcal-num { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.kcal-unit { font-size: 11px; font-weight: 700; line-height: 1.15; text-transform: uppercase; letter-spacing: .04em; opacity: .9; }
.kcal-scale { position: relative; height: 5px; border-radius: 999px; margin: 8px 4px 6px; }
.kcal-marker {
  position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; background: #fff;
  border: 2.5px solid var(--ink); transform: translate(-50%, -50%);
}
.macro-list { list-style: none; margin: 0; padding: 2px 4px 0; display: flex; justify-content: space-between; gap: 4px; }
.macro { font-size: 11px; color: var(--ink-2); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.macro b { color: var(--macro); font-size: 13px; font-weight: 800; }
.macro-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--macro); }

/* ---------- Recipe header ---------- */
.recipe-head { padding: 22px 0 8px; max-width: 820px; }
.recipe-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.recipe-head h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; letter-spacing: -0.03em; }
.tagline { color: var(--ink-2); font-size: 16px; margin-top: 4px; }
.recipe-head .tag-row { margin-top: 12px; }
.recipe-head .tag { font-size: 13px; padding: 5px 12px; }
.recipe-head .pepper { font-size: 14px; }
.description { margin-top: 14px; color: var(--ink-2); }
.source { margin-top: 8px; font-size: 13px; color: var(--muted); }
.source a { color: var(--brand-dark); font-weight: 700; }
.notice {
  margin-top: 20px; background: var(--warn-tint); color: #7C2D12; border-radius: 14px; padding: 12px 16px; font-size: 14px;
}
.appliance-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; }
.appliance-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-weight: 600; font-size: 13px;
}
.appliance-chip::before, .appliance-dot {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--app, var(--muted-2)); flex: none; display: inline-block;
}
[data-appliance="oven"]       { --app: #E4572E; }
[data-appliance="stovetop"]   { --app: #F4A259; }
[data-appliance="instantPot"] { --app: #4F7CAC; }
[data-appliance="airFryer"]   { --app: #5B8E7D; }
[data-appliance="microwave"]  { --app: #8E7DBE; }
[data-appliance="creami"]     { --app: #D1495B; }
[data-appliance="freezer"]    { --app: #64B6F7; }
.rules { margin-top: 14px; font-size: 13px; }
.rules summary { cursor: pointer; font-weight: 700; display: inline-block; padding: 5px 12px; border-radius: 999px; list-style: none; }
.rules summary::-webkit-details-marker { display: none; }
.rules.is-ok summary { background: var(--ok-tint); color: var(--ok); }
.rules.is-bad summary { background: var(--warn-tint); color: var(--warn); }
.rules ul { list-style: none; padding: 10px 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.rules li.bad { color: var(--warn); font-weight: 700; }
.rules li.ok { color: var(--ink-2); }

/* ---------- Recipe layout ---------- */
.recipe-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; margin-top: 18px; align-items: start; }
.recipe-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.recipe-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 22px; }
.panel h2 { font-size: 20px; font-weight: 800; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head .muted { font-size: 13px; margin-top: 2px; }
.subhead { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; margin: 20px 0 10px; }

/* ---------- Ingredients ---------- */
.ing-group { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; margin: 16px 0 4px; }
.ing-group small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.ing:last-child { border-bottom: 0; }
.ing-amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.ing-name { font-weight: 600; }
.ing-name small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.ing--pantry .ing-amt, .ing--pantry .ing-name { font-weight: 500; color: var(--ink-2); }
.ing-pkg {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; border-radius: 999px;
  padding: 4px 10px; white-space: nowrap;
}
.ing-pkg.is-ok { background: var(--ok-tint); color: var(--ok); }
.ing-pkg.is-open { background: var(--warn-tint); color: var(--warn); }
.pkg-meter { display: inline-flex; gap: 2px; }
.pkg-meter i {
  width: 8px; height: 12px; border-radius: 2px; border: 1.5px solid currentColor;
  background: linear-gradient(to top, currentColor var(--fill), transparent var(--fill));
}
.pkg-meter em { font-style: normal; }

/* ---------- Scaler / order panel ---------- */
.order-panel { box-shadow: var(--shadow); border: 0; }
.order-panel h2 { margin-bottom: 14px; }
.stepper {
  display: flex; align-items: center; justify-content: space-between; background: var(--bg-2);
  border-radius: 999px; padding: 6px;
}
.stepper button {
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: #fff; font-size: 24px; font-weight: 600;
  box-shadow: var(--shadow-sm); display: grid; place-items: center;
}
.stepper button:hover:not(:disabled) { background: var(--ink); color: #fff; }
.stepper-value { display: flex; align-items: baseline; gap: 6px; }
.stepper-value b { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stepper-value span { color: var(--muted); font-weight: 600; }
.optimal { margin-top: 16px; }
.optimal-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.optimal-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  border: 1.5px solid var(--ok); color: var(--ok); background: #fff; border-radius: 999px; padding: 6px 12px;
  font-weight: 700; font-size: 13px;
}
.chip::before { content: '♻ '; }
.chip:hover { background: var(--ok-tint); }
.chip.is-on { background: var(--ok); color: #fff; }
.batch-status { margin-top: 14px; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.batch-status b { font-size: 14px; }
.batch-status.is-ok { background: var(--ok-tint); color: #075E42; }
.batch-status.is-warn { background: var(--warn-tint); color: #7C2D12; }
.batch-status .btn { align-self: flex-start; margin-top: 6px; }
.batch-totals, .plan-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; text-align: center;
}
.batch-totals div, .plan-summary div { background: var(--bg-2); border-radius: 12px; padding: 10px 6px; display: flex; flex-direction: column; }
.batch-totals b, .plan-summary b { font-size: 17px; font-weight: 800; }
.batch-totals span, .plan-summary span { font-size: 11px; color: var(--muted); font-weight: 600; }
.shop-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.shop-list li { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.shop-list li span { font-weight: 800; min-width: 30px; }
.shop-list li small { color: var(--muted); width: 100%; padding-left: 36px; margin-top: -2px; }
.shop-list li.is-open span { color: var(--warn); }
.shop-list li.is-open::after { content: 'partial'; font-size: 11px; color: var(--warn); font-weight: 700; margin-left: auto; }
.btn-order { margin-top: 18px; justify-content: space-between; padding: 15px 22px; border-radius: 14px; font-size: 16px; }
.btn-order span:last-child { opacity: .85; font-weight: 600; }

/* ---------- Timeline controls & stats ---------- */
.timeline-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 4px; }
.segmented button {
  border: 0; background: transparent; border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px; letter-spacing: -2px;
}
.segmented button span { letter-spacing: 0; }
.segmented button.is-on { background: #fff; box-shadow: var(--shadow-sm); }
.timeline-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--bg-2); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat b { font-size: 20px; font-weight: 800; }
.stat--good { background: var(--ok-tint); }
.stat--good b { color: var(--ok); }
.loads { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.load { height: 6px; background: #E4E4E4; border-radius: 999px; overflow: hidden; }
.load i { display: block; height: 100%; border-radius: 999px; transition: width .3s ease; }
.warn-line { grid-column: 1 / -1; background: var(--warn-tint); color: var(--warn); font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 10px; }

/* ---------- Gantt ---------- */
.gantt-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px 6px; }
.gantt { min-width: 640px; display: flex; flex-direction: column; gap: 6px; }
.gantt-row { display: grid; grid-template-columns: 124px minmax(0, 1fr); align-items: center; gap: 10px; }
.lane-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; min-width: 0; }
.lane-label > span:last-child { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.lane-label small { font-weight: 500; color: var(--muted); font-size: 11px; }
.gantt-row--passive .lane-label { font-weight: 600; color: var(--ink-2); font-size: 12px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 800; flex: none;
}
.gantt-axis { position: relative; height: 20px; border-bottom: 1px solid var(--line); }
.tick { position: absolute; bottom: 3px; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tick:first-child { transform: none; }
.tick--break { color: #3B82F6; font-weight: 700; bottom: 3px; background: #fff; padding: 0 4px; }
.lane-track {
  position: relative; height: 42px; border-radius: 10px;
  background: repeating-linear-gradient(90deg, var(--bg-2) 0 1px, transparent 1px 100%) , #FAFAFA;
  background-size: 10% 100%, auto;
}
.gantt-row--passive .lane-track { height: 30px; }
.bar {
  position: absolute; top: 5px; bottom: 5px; border-radius: 8px; padding: 0 8px; display: flex; align-items: center;
  font-size: 12px; font-weight: 700; overflow: hidden; border: 0; text-align: left; min-width: 6px;
  transition: filter .15s ease, box-shadow .15s ease, transform .15s ease;
}
.bar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar--active { background: var(--c); color: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--c) 40%, transparent); }
.bar--active:hover:not([aria-disabled="true"]) { filter: brightness(1.08); transform: translateY(-1px); }
.bar--active[aria-disabled="true"] { cursor: default; }
.bar--active.is-pinned { box-shadow: 0 0 0 2px #fff inset, 0 2px 6px color-mix(in srgb, var(--c) 40%, transparent); }
.bar--passive {
  top: 4px; bottom: 4px; color: var(--ink-2); font-weight: 600;
  background: repeating-linear-gradient(-45deg, #EDEDED 0 6px, #F7F7F7 6px 12px);
  border: 1.5px dashed #C9C9C9; cursor: default;
}
.bar.is-hot { box-shadow: 0 0 0 3px var(--ink); z-index: 2; }
.gantt-break {
  position: absolute; top: 0; bottom: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 5px, rgba(59,130,246,.18) 5px 7px);
  border-left: 2px dotted #3B82F6; border-right: 2px dotted #3B82F6;
}
.gantt-divider { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.gantt-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.gantt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-active { background: linear-gradient(90deg, #00A3A3 33%, #7B5CFF 33% 66%, #FF6B2C 66%); }
.lg-passive { background: repeating-linear-gradient(-45deg, #DADADA 0 3px, #F3F3F3 3px 6px); border: 1px dashed #BBB; }
.lg-break { background: repeating-linear-gradient(90deg, transparent 0 2px, rgba(59,130,246,.45) 2px 4px); border: 1px dotted #3B82F6; }

/* ---------- Step list ---------- */
.step-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.step {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: start;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); border-left: 4px solid var(--c);
  transition: box-shadow .15s ease, background .15s ease;
}
.step.is-hot { background: #FCFCFC; box-shadow: var(--shadow); }
.step--passive { background: #FAFAFA; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center;
  font-weight: 800; font-size: 12px;
}
.step-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.step-head h4 { font-size: 15px; font-weight: 700; }
.step-time { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.step-dur { font-size: 12px; font-weight: 700; background: var(--bg-2); border-radius: 999px; padding: 1px 8px; }
.step-body p { font-size: 14px; color: var(--ink-2); margin-top: 3px; }
.step-assign { display: flex; gap: 4px; }
.assign-btn {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--c); background: #fff; color: var(--c);
  font-weight: 800; font-size: 12px; display: grid; place-items: center; padding: 0;
}
.assign-btn.is-on { background: var(--c); color: #fff; }
.handsoff-chip { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--bg-2); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }

/* ---------- Storage ---------- */
.storage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.storage-grid div { background: var(--bg-2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.storage-grid b { font-size: 15px; }
.storage-grid span { font-size: 12px; color: var(--muted); }
.notes { margin: 12px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Drawer (prep plan) ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: #fff; z-index: 61;
  transform: translateX(100%); transition: transform .25s ease, visibility .25s; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  visibility: hidden;
}
body.drawer-open .drawer { transform: none; visibility: visible; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 20px; font-weight: 800; }
.drawer-body { overflow-y: auto; padding: 16px 20px 28px; flex: 1; }
.drawer-body > .btn { margin-top: 20px; }
.plan-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan-item { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.plan-item img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.plan-item a { font-weight: 700; text-decoration: none; display: block; line-height: 1.25; }
.plan-item a:hover { color: var(--brand); }

/* ---------- Modal (generator) ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70; animation: fade .2s ease; }
.modal {
  position: fixed; z-index: 71; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  background: #fff; border-radius: 24px; padding: 28px; box-shadow: var(--shadow-lg); animation: pop .22s ease;
}
.modal h2 { font-size: 24px; font-weight: 800; }
.modal > form > .muted { margin: 6px 0 18px; font-size: 14px; }
.modal-x { position: absolute; top: 16px; right: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal label { font-size: 13px; font-weight: 700; display: flex; flex-direction: column; gap: 6px; }
.modal select {
  font: inherit; font-weight: 600; font-size: 14px; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.diet { border: 0; padding: 0; margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.diet legend { font-size: 13px; font-weight: 700; margin-bottom: 8px; padding: 0; }
.modal .check { flex-direction: row; align-items: center; gap: 0; }
.check input { position: absolute; opacity: 0; }
.check span { background: var(--bg-2); border-radius: 999px; padding: 7px 14px; font-weight: 600; cursor: pointer; }
.check input:checked + span { background: var(--ink); color: #fff; }
.check input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); }
.modal .range { margin: 16px 0 20px; }
.range output { font-weight: 600; }
.range input { accent-color: var(--brand); }
.gen-loading { text-align: center; padding: 40px 0 24px; }
.gen-loading p { font-weight: 700; margin-top: 12px; }
.pan { font-size: 56px; display: inline-block; animation: flip 1s ease-in-out infinite; }
@keyframes flip { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg) translateY(-6px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 14px; font-size: 14px; box-shadow: var(--shadow-lg); z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; max-width: calc(100% - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 24px 20px 40px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; }

/* ---------- Account (sign-in) ---------- */
.account { position: relative; flex: none; }
.account-btn {
  display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; white-space: nowrap;
}
.account-btn:hover { background: var(--bg-2); }
.account-btn.is-in { padding: 5px 14px 5px 5px; }
.account-btn img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 6px; min-width: 210px; display: flex; flex-direction: column; z-index: 50;
}
.account-menu[hidden] { display: none; }
.account-menu a, .account-menu button {
  text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; text-decoration: none;
}
.account-menu a:hover, .account-menu button:hover { background: var(--bg-2); }

/* ---------- Community bits ---------- */
.rating--new { background: var(--ok-tint); color: var(--ok); }
.card-author { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.byline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 2px; font-size: 14px; color: var(--ink-2); }
.byline > span { margin-right: 4px; }
.btn-danger { color: #B42318; }
.btn-danger:hover:not(:disabled) { background: #FDECEC; }
.linkish { border: 0; background: none; padding: 0; color: var(--brand-dark); font-weight: 700; text-decoration: underline; font-size: inherit; }
.mine .section-head { align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.mine h1 { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.mine .notice a { color: var(--brand-dark); font-weight: 700; }
.mine-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.mine-item {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.mine-item img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.mine-item a:not(.btn) { font-weight: 700; text-decoration: none; display: block; }
.mine-item a:not(.btn):hover { color: var(--brand); }
.mine-tools { display: flex; gap: 8px; }
.modal--small { width: min(440px, calc(100% - 32px)); }
.modal form > .btn { margin-top: 14px; }
.modal form > .btn + .btn { margin-top: 8px; }
.modal .field { margin-top: 16px; }

/* ---------- Recipe editor ---------- */
.editor-head { margin: 8px 0 20px; }
.editor-head h1 { font-size: clamp(24px, 4vw, 32px); font-weight: 800; margin-bottom: 6px; }
.editor-head p { max-width: 760px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.editor-form { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.editor-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.ed-section h2, .editor-side h2 { font-size: 19px; font-weight: 800; margin-bottom: 12px; }
.ed-section h2 small { font-size: 13px; font-weight: 600; margin-left: 6px; }
.ed-section > .muted.small { margin: -6px 0 12px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 700; }
.field-hint { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea, .ed-import textarea {
  font: inherit; font-size: 15px; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; width: 100%; min-width: 0;
}
.field textarea, .ed-import textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .ed-import textarea:focus { border-color: var(--ink); outline: 0; }
.field input.field-input--invalid { border-color: var(--warn); }
.field input.field-input--invalid:focus { border-color: var(--warn); }
.field input.shake { animation: shake .32s linear; }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.field-grid--3 { grid-template-columns: repeat(3, 1fr); }
.field-grid--ing { grid-template-columns: 2fr 1fr 1fr 1fr; }
.field-grid--ing .field:last-child { grid-column: 1 / -1; }
.field-grid--pkg { grid-template-columns: 1fr 2fr; }
.field-grid--step { grid-template-columns: 1fr 2fr 2fr; }
.tag-picks, .deps { border: 0; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag-picks legend { margin-bottom: 8px; padding: 0; }
.deps .field-label { width: 100%; }
.check { display: inline-flex; position: relative; }
.check--sm span { font-size: 13px; padding: 5px 12px; }
.inline-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); margin: 0 0 12px; }
.inline-check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
.ed-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ed-row { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 2px; background: #FCFCFC; }
.ed-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ed-row-tools { display: flex; gap: 6px; }
.photo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.photo-preview {
  width: 160px; aspect-ratio: 4 / 3; border-radius: 12px; background: var(--bg-2); display: grid; place-items: center;
  font-size: 34px; overflow: hidden; flex: none;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.photo-actions label.btn { cursor: pointer; }
.ed-import summary { font-weight: 700; cursor: pointer; }
.ed-import textarea { margin: 12px 0 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.ed-import .field-hint { display: block; margin-top: 8px; }
.ed-checks { list-style: none; margin: 10px 0 16px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ed-checks .ok { color: var(--ok); font-weight: 600; }
.ed-checks .bad { color: var(--warn); font-weight: 600; }
.editor-side .muted.small { margin-top: 8px; }

/* ---------- Barcodes ---------- */
.barcode-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.barcode-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; font-weight: 700;
  background: var(--bg-2); border-radius: 8px; padding: 6px 10px; letter-spacing: .04em;
}
.bc-note:empty { display: none; }
.bc-note { width: 100%; color: var(--warn); font-weight: 600; }
.bc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.bc-actions label.btn { cursor: pointer; }
.bc-type { display: flex; align-items: flex-end; gap: 8px; }
.bc-type .field { flex: 1; margin-bottom: 0; }
.bc-type .btn { margin-bottom: 2px; }
.bc-msg { display: block; margin-top: 10px; min-height: 1em; }
.bc-camera { position: relative; margin-top: 14px; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.bc-camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.bc-aim { position: absolute; left: 12%; right: 12%; top: 38%; bottom: 38%; border: 3px solid rgba(255,255,255,.85); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0,0,0,.25); }
.bc-found { display: flex; flex-direction: column; gap: 2px; background: var(--bg-2); border-radius: 12px; padding: 12px 14px; margin: 8px 0 12px; }
.bc-result .btn + .btn { margin-top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .recipe-layout { grid-template-columns: minmax(0, 1fr); }
  .recipe-side { position: static; order: -1; }
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .editor-side { position: static; }
  .timeline-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  :root { --topbar-h: 112px; }
  .container, .topbar-inner { padding-left: 16px; padding-right: 16px; }
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; row-gap: 10px; }
  .location-pill { display: none; }
  .logo { margin-right: auto; }
  .search { order: 3; flex-basis: 100%; }
  .plan-btn { padding: 9px 14px; }
  .promo { grid-template-columns: 1fr; padding: 26px 22px; }
  .promo-art { display: none; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .pill { flex: none; }

  .hero { grid-template-columns: 1fr 1fr; grid-template-areas: "time nutri" "photo photo"; gap: 10px 8px; align-items: start; }
  .hero-img { aspect-ratio: 4 / 3; }
  .hero-corner { position: static; }
  .hero-corner--left { grid-area: time; }
  .hero-corner--right { grid-area: nutri; justify-self: end; }
  .time-card { flex-direction: column; gap: 8px; padding: 12px 14px; box-shadow: none; border: 1px solid var(--line); height: 100%; }
  .time-divider { width: 100%; height: 1px; }
  .time-value { font-size: 22px; }
  .nutri-card { width: 100%; box-shadow: none; border: 1px solid var(--line); }
  .kcal-num { font-size: 26px; }
  .hero-img { border-radius: 14px; }
  .hero-img figcaption { font-size: 10px; left: 8px; bottom: 8px; white-space: nowrap; }

  .panel { padding: 16px; border-radius: 16px; }
  .ing { grid-template-columns: 70px minmax(0, 1fr); }
  .ing-pkg { grid-column: 2; justify-self: start; white-space: normal; }
  .step { grid-template-columns: 26px minmax(0, 1fr); }
  .step-assign, .handsoff-chip { grid-column: 2; justify-self: start; }
  .form-grid { grid-template-columns: 1fr; }
  .account-label { display: none; }
  .account-btn, .account-btn.is-in { padding: 6px; }
  .field-grid, .field-grid--3, .field-grid--pkg, .field-grid--step { grid-template-columns: 1fr 1fr; }
  .field-grid--ing { grid-template-columns: 1fr 1fr; }
  .field-grid--ing .field:first-child, .field-grid--step .field:not(:first-child) { grid-column: 1 / -1; }
  .field-grid--step .field:first-child { grid-column: 1 / -1; }
  .mine-item { grid-template-columns: 56px minmax(0, 1fr); }
  .mine-item img { width: 56px; height: 56px; }
  .mine-tools { grid-column: 1 / -1; }
  .storage-grid { grid-template-columns: 1fr 1fr; }
  .storage-grid div:last-child { grid-column: 1 / -1; }
  .recipe-title-row { flex-direction: column; gap: 8px; }
}

@media (max-width: 420px) {
  .plan-btn-label { display: none; }
  .macro-list { flex-wrap: wrap; }
  .timeline-stats { grid-template-columns: 1fr 1fr; }
}

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

@media print {
  .topbar, .footer, .recipe-side, .timeline-controls, .step-assign, .back-link { display: none !important; }
  .recipe-layout { grid-template-columns: 1fr; }
}
