/* GK Kitchen Companion — warm, modern Indian family cookbook */
:root {
  --bg: #fbf7f0;
  --bg-2: #f5eee3;
  --card: #fffdf9;
  --ink: #2f2622;
  --ink-2: #5c4e46;
  --muted: #8a796e;
  --line: #ebdfd1;
  --terracotta: #c2603a;
  --terracotta-ink: #a24a27;
  --terracotta-soft: #f7e2d6;
  --green: #5b7d4b;
  --green-ink: #46663a;
  --green-soft: #e6eedf;
  --saffron: #d99a2b;
  --saffron-soft: #faedd3;
  --danger: #b6412c;
  --shadow: 0 1px 2px rgba(74, 52, 36, 0.06), 0 6px 18px rgba(74, 52, 36, 0.07);
  --shadow-lg: 0 10px 40px rgba(74, 52, 36, 0.16);
  --radius: 20px;
  --radius-sm: 12px;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Helvetica Neue', Arial, sans-serif;
  --nav-h: 68px;
  --c-kerala: #e4edd9;
  --c-karnataka: #f6e6cf;
  --c-south-indian: #f8e1d3;
  --c-north-indian: #f3dccb;
  --c-asian: #e0eaec;
  --c-international: #ebe3ef;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #1d1916; --bg-2: #26201c; --card: #2a2420; --ink: #f3ebe3; --ink-2: #d6c9bd; --muted: #a8988b; --line: #3d342e;
    --terracotta: #e07a52; --terracotta-ink: #f09670; --terracotta-soft: #4a2c20; --green: #8fb07d; --green-ink: #a9c898; --green-soft: #2c3626;
    --saffron: #e8b04d; --saffron-soft: #44361d; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    --c-kerala: #2e3a28; --c-karnataka: #3e3222; --c-south-indian: #40291f; --c-north-indian: #3d2b22; --c-asian: #24343a; --c-international: #352b3b;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #1d1916; --bg-2: #26201c; --card: #2a2420; --ink: #f3ebe3; --ink-2: #d6c9bd; --muted: #a8988b; --line: #3d342e;
  --terracotta: #e07a52; --terracotta-ink: #f09670; --terracotta-soft: #4a2c20; --green: #8fb07d; --green-ink: #a9c898; --green-soft: #2c3626;
  --saffron: #e8b04d; --saffron-soft: #44361d; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  --c-kerala: #2e3a28; --c-karnataka: #3e3222; --c-south-indian: #40291f; --c-north-indian: #3d2b22; --c-asian: #24343a; --c-international: #352b3b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
img { max-width: 100%; }
a { color: var(--terracotta-ink); }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 0.6em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; padding: 0 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.view { max-width: 760px; margin: 0 auto; padding-top: 18px; animation: fade 0.18s ease-out; }
.view.wide { max-width: 1100px; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 10px 4px; color: var(--ink-2); font-weight: 600; cursor: pointer; font-size: 1rem; }
.page-title { margin: 4px 0 4px; }
.page-sub { color: var(--muted); margin-bottom: 18px; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: space-around; align-items: stretch; background: color-mix(in srgb, var(--card) 94%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); z-index: 20;
}
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none;
  color: var(--muted); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.01em; min-width: 0;
}
.nav a .ico { font-size: 1.45rem; line-height: 1; filter: grayscale(0.4); opacity: 0.85; }
.nav a[aria-current='page'] { color: var(--terracotta-ink); }
.nav a[aria-current='page'] .ico { filter: none; opacity: 1; transform: translateY(-1px); }
.nav .brand { display: none; }

@media (min-width: 960px) {
  .nav {
    position: sticky; top: 0; height: 100vh; width: 230px; flex-direction: column; justify-content: flex-start; gap: 4px; padding: 22px 14px;
    border-top: 0; border-right: 1px solid var(--line); background: var(--bg-2);
  }
  .nav .brand { display: block; padding: 0 6px 16px; }
  .nav .brand img { display: block; width: 100%; height: auto; border-radius: 22px; }
  .nav a { flex: 0; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; font-size: 1rem; }
  .nav a[aria-current='page'] { background: var(--card); box-shadow: var(--shadow); }
  .main { padding-bottom: 40px; padding-left: 32px; padding-right: 32px; }
}

/* ---------- Generic UI ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.tiny { font-size: 0.78rem; }
.section { margin: 30px 0 12px; }
.section h2 { display: flex; align-items: center; gap: 8px; }
.section .sub { color: var(--muted); font-size: 0.93rem; margin-top: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 16px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-weight: 650; font-size: 1rem; cursor: pointer;
  text-decoration: none; transition: transform 0.06s ease, background 0.15s; -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--terracotta); border-color: var(--terracotta); color: #fff; }
.btn.primary:hover { background: var(--terracotta-ink); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.soft { background: var(--bg-2); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 0.92rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.icon { width: 52px; padding: 0; }
.btn.saved { color: var(--terracotta-ink); border-color: var(--terracotta); background: var(--terracotta-soft); }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 8px 4px; font-size: 0.88rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2);
  font-size: 0.85rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.chip.green { background: var(--green-soft); color: var(--green-ink); }
.chip.terra { background: var(--terracotta-soft); color: var(--terracotta-ink); }
.chip.saffron { background: var(--saffron-soft); color: #8a5c0d; }
:root[data-theme='dark'] .chip.saffron { color: var(--saffron); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .chip.saffron { color: var(--saffron); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  cursor: pointer; padding: 10px 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-weight: 600;
  font-size: 0.95rem; color: var(--ink-2); min-height: 44px; display: inline-flex; align-items: center; gap: 6px;
}
.pick[aria-pressed='true'] { background: var(--green); border-color: var(--green); color: #fff; }
.pick .x { font-size: 1.1em; line-height: 1; opacity: 0.8; }

.input, select.input, textarea.input {
  width: 100%; min-height: 52px; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-size: 1rem;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--saffron); outline: none; box-shadow: 0 0 0 3px var(--saffron-soft); }
label.field { display: block; font-weight: 650; margin-bottom: 6px; }
.field-help { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

.seg { display: inline-flex; background: var(--bg-2); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 10px 14px; border-radius: 10px; font-weight: 650; color: var(--ink-2); cursor: pointer; min-height: 42px; }
.seg button[aria-pressed='true'] { background: var(--card); color: var(--terracotta-ink); box-shadow: var(--shadow); }

.notice { padding: 14px 16px; border-radius: 16px; background: var(--saffron-soft); color: var(--ink); font-size: 0.93rem; }
.notice.green { background: var(--green-soft); }
.disclaimer { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }

/* ---------- Brand ---------- */
.brandbar { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.brandbar img { width: 40px; height: 40px; border-radius: 10px; box-shadow: var(--shadow); }
.brandbar span { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--green-ink); }
@media (min-width: 960px) { .brandbar { display: none; } }
.about-logo { width: 180px; max-width: 60%; height: auto; display: block; margin: 0 auto 10px; border-radius: 28px; }
/* GK Signatory: on phones, sit just above the bottom navigation bar (component itself unchanged). */
@media (max-width: 959px) { .gk-sig { bottom: calc(var(--nav-h) + max(10px, env(safe-area-inset-bottom))) !important; } }
@media print { .gk-sig { position: fixed; } }

/* ---------- Greeting ---------- */
.hello { padding: 8px 2px 4px; }
.hello .date { color: var(--muted); font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em; }
.hello h1 { font-size: clamp(1.7rem, 5.5vw, 2.3rem); margin: 4px 0 2px; }
.hello p { color: var(--ink-2); margin: 0; }

/* ---------- Plate illustration ---------- */
.art {
  position: relative; display: grid; place-items: center; overflow: hidden; background: var(--c-south-indian); border-radius: 18px; aspect-ratio: 1 / 1;
}
.art[data-cuisine='kerala'] { background: var(--c-kerala); }
.art[data-cuisine='karnataka'] { background: var(--c-karnataka); }
.art[data-cuisine='north-indian'] { background: var(--c-north-indian); }
.art[data-cuisine='asian'] { background: var(--c-asian); }
.art[data-cuisine='international'] { background: var(--c-international); }
.art::before {
  content: ''; position: absolute; width: 130%; height: 62%; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(160deg, #6f9a52, #4f7a3a); transform: rotate(-18deg); opacity: 0; transition: opacity 0.2s;
}
.art[data-cuisine='kerala']::before { opacity: 0.9; }
.art .plate {
  position: relative; width: 74%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 45%, #fffefb 0 55%, #f1e8dc 56% 64%, #fffaf3 65%);
  box-shadow: 0 8px 20px rgba(60, 40, 20, 0.18), inset 0 -3px 6px rgba(0, 0, 0, 0.05); display: grid; place-items: center;
}
.art .main-emoji { font-size: clamp(2.4rem, 9vw, 3.6rem); line-height: 1; filter: drop-shadow(0 3px 3px rgba(0,0,0,.12)); }
.art .side-emoji { position: absolute; font-size: clamp(1.1rem, 4vw, 1.6rem); background: #fffdf8; border-radius: 50%; width: 34%; aspect-ratio: 1; display: grid; place-items: center; box-shadow: 0 4px 10px rgba(60,40,20,.15); }
.art .side-emoji.s1 { right: 4%; bottom: 6%; }
.art .side-emoji.s2 { left: 4%; bottom: 8%; width: 28%; }
.art .side-emoji.s3 { right: 6%; top: 6%; width: 26%; }
.art.big { aspect-ratio: 16 / 9; border-radius: 0; }
.art.big .plate { width: auto; height: 80%; }
.art.big .main-emoji { font-size: clamp(3.5rem, 12vw, 5.5rem); }
.art.big .side-emoji { width: auto; height: 34%; }

/* ---------- Meal card ---------- */
.meal { overflow: hidden; }
.meal-head { display: grid; grid-template-columns: 112px 1fr; gap: 16px; padding: 16px 16px 6px; align-items: start; }
.meal-slot { font-size: 0.78rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em; color: var(--terracotta-ink); display: flex; gap: 6px; align-items: center; }
.meal-title { font-size: 1.3rem; margin: 4px 0 6px; }
.meal-title .plus { color: var(--muted); font-weight: 400; }
.meal-desc { color: var(--ink-2); font-size: 0.95rem; margin: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 0.88rem; font-weight: 600; margin-top: 8px; }
.meta span { display: inline-flex; gap: 4px; align-items: center; }
.meal-body { padding: 8px 16px 16px; }
.why { background: var(--bg-2); border-radius: 14px; padding: 12px 14px; font-size: 0.94rem; color: var(--ink-2); margin: 8px 0 10px; }
.why strong { color: var(--ink); display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.nutri-line { font-size: 0.86rem; color: var(--muted); margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.addon { margin-top: 10px; font-size: 0.92rem; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
.addon a { font-weight: 650; }
.plan-ahead { margin-top: 8px; font-size: 0.9rem; color: #8a5c0d; background: var(--saffron-soft); padding: 8px 12px; border-radius: 12px; }
:root[data-theme='dark'] .plan-ahead { color: var(--saffron); }
.meal-actions { display: grid; grid-template-columns: 1.4fr 1fr auto; gap: 8px; margin-top: 14px; }
.meal-foot { display: flex; justify-content: flex-end; }
@media (max-width: 420px) {
  .meal-head { grid-template-columns: 88px 1fr; gap: 12px; }
  .meal-actions { grid-template-columns: 1fr 1fr auto; }
  .meal-actions .btn { padding: 0 10px; font-size: 0.95rem; }
}
@media (min-width: 960px) {
  .meals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .meals-grid .meal-head { grid-template-columns: 1fr; }
  .meals-grid .meal-head .art { max-width: 100%; aspect-ratio: 16/10; }
  .meals-grid .meal-actions { grid-template-columns: 1fr 1fr auto; }
  .meals-grid .meal-actions .btn { padding: 0 10px; font-size: 0.92rem; }
}
.meals-grid > * + * { margin-top: 16px; }
@media (min-width: 960px) { .meals-grid > * + * { margin-top: 0; } }

/* ---------- Surprise ---------- */
.surprise { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 16px; align-items: center; background: linear-gradient(135deg, var(--saffron-soft), var(--terracotta-soft)); border: 0; }
.surprise .eyebrow { font-size: 0.78rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--terracotta-ink); }
.surprise h3 { font-size: 1.25rem; margin: 2px 0 4px; }
.surprise p { font-size: 0.93rem; color: var(--ink-2); margin: 0 0 10px; }

/* ---------- Recipe tiles ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; } }
.tile { display: block; text-decoration: none; color: inherit; overflow: hidden; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tile .art { border-radius: 0; aspect-ratio: 4 / 3; }
.tile .art .plate { width: 58%; }
.tile .art .main-emoji { font-size: 2.4rem; }
.tile .t-body { padding: 10px 12px 12px; }
.tile .t-name { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.tile .t-aka { font-size: 0.8rem; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-meta { font-size: 0.78rem; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.tile .fav { position: absolute; top: 8px; right: 8px; font-size: 1.1rem; }
.tile-wrap { position: relative; }
.diet-dot { display: inline-block; width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; vertical-align: -1px; }
.diet-dot::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: currentColor; }
.diet-veg { color: #2e8b3a; } .diet-egg { color: #d39b16; } .diet-fish { color: #2a7fa8; } .diet-chicken, .diet-mutton { color: #b33a2a; }

.scroller { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 12px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; flex: 0 0 160px; }
.cat-tile { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 4px; padding: 14px; min-height: 96px; border-radius: 18px; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 650; }
.cat-tile .ico { font-size: 1.7rem; }
.cat-tile .n { font-size: 0.78rem; color: var(--muted); font-weight: 600; }

/* ---------- Recipe detail ---------- */
.recipe-hero { overflow: hidden; }
.recipe-hero .info { padding: 18px; }
.recipe-hero h1 { font-size: clamp(1.7rem, 6vw, 2.3rem); }
.recipe-hero .aka { color: var(--muted); font-size: 1rem; margin: 2px 0 10px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 4px; }
.fact { background: var(--bg-2); border-radius: 14px; padding: 10px 8px; text-align: center; }
.fact b { display: block; font-size: 1.02rem; }
.fact span { font-size: 0.74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
@media (max-width: 400px) { .facts { grid-template-columns: repeat(2, 1fr); } }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; margin: 10px 0 6px; }
.tabs button { border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; min-height: 52px; font-weight: 650; cursor: pointer; color: var(--ink-2); padding: 4px; font-size: 0.85rem; min-width: 0; }
.tabs button .ti { display: block; font-size: 1.15rem; line-height: 1.2; }
@media (min-width: 600px) { .tabs button { font-size: 0.95rem; } .tabs button .ti { display: inline; margin-right: 4px; } }
.tabs button[aria-selected='true'] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ing-list { list-style: none; padding: 0; margin: 0; }
.ing-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px dashed var(--line); cursor: pointer; }
.ing-list li:last-child { border-bottom: 0; }
.ing-list .q { min-width: 92px; font-weight: 700; color: var(--terracotta-ink); font-size: 0.95rem; }
.ing-list .alt { display: block; font-size: 0.84rem; color: var(--muted); }
.ing-list li.done .n { text-decoration: line-through; color: var(--muted); }
.ing-list .opt { font-size: 0.75rem; background: var(--bg-2); padding: 1px 8px; border-radius: 999px; margin-left: 6px; color: var(--muted); font-weight: 600; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 4px 0 18px 52px; font-size: 1.05rem; cursor: pointer; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--terracotta-soft); color: var(--terracotta-ink); display: grid; place-items: center; font-weight: 750; }
.steps li.done { color: var(--muted); }
.steps li.done::before { content: '✓'; background: var(--green); color: #fff; }
.tip-list { padding-left: 1.2em; margin: 6px 0; }
.tip-list li { margin-bottom: 6px; }
.nutri-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.nutri-grid .fact b { font-size: 1.15rem; }
@media (max-width: 480px) { .nutri-grid { grid-template-columns: repeat(3, 1fr); } }
.bar { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.part-of { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.part-of a { flex: none; }
.cook-bar { position: sticky; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); z-index: 6; display: flex; gap: 8px; margin-top: 18px; }
@media (min-width: 960px) { .cook-bar { bottom: 16px; } }

/* ---------- Kitchen ---------- */
.ing-entry { display: flex; gap: 8px; }
.ing-entry .input { flex: 1; }
.selected-box { min-height: 64px; padding: 12px; border: 2px dashed var(--line); border-radius: 18px; background: var(--card); }
.match { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px; align-items: center; text-decoration: none; color: inherit; }
.match .art { border-radius: 14px; }
.match .art .plate { width: 76%; }
.match .art .main-emoji { font-size: 1.7rem; }
.match + .match { border-top: 1px solid var(--line); }
.match .name { font-weight: 700; }
.match .need { font-size: 0.86rem; color: var(--muted); }
.match .swap { font-size: 0.82rem; color: var(--green-ink); }
details.group { border-top: 1px solid var(--line); padding: 10px 0; }
details.group summary { cursor: pointer; font-weight: 700; padding: 6px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
details.group summary::-webkit-details-marker { display: none; }
details.group summary::after { content: '▾'; color: var(--muted); }
details.group[open] summary::after { content: '▴'; }
.voice.listening { background: var(--terracotta); color: #fff; border-color: var(--terracotta); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px var(--terracotta-soft); } }

/* ---------- Planner ---------- */
.day { padding: 14px; }
.day + .day { margin-top: 12px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.day-head h3 { font-size: 1.1rem; }
.day-head .today-pill { font-size: 0.75rem; background: var(--terracotta); color: #fff; border-radius: 999px; padding: 2px 10px; font-weight: 700; margin-left: 6px; }
.slot-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.slot-row:first-of-type { border-top: 0; }
.slot-row .em { font-size: 1.6rem; text-align: center; }
.slot-row .lbl { font-size: 0.72rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.slot-row a.name { font-weight: 650; color: var(--ink); text-decoration: none; line-height: 1.3; display: block; }
.slot-row .with { font-size: 0.86rem; color: var(--muted); }
@media (min-width: 960px) {
  .plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
  .plan-grid .day + .day { margin-top: 0; }
}

/* ---------- Shopping ---------- */
.shop-group { padding: 6px 16px 10px; }
.shop-group + .shop-group { margin-top: 12px; }
.shop-group h3 { padding: 10px 0 4px; display: flex; gap: 8px; align-items: center; font-size: 1.05rem; }
.shop-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px dashed var(--line); cursor: pointer; }
.shop-item input { width: 24px; height: 24px; accent-color: var(--green); margin-top: 2px; flex: none; }
.shop-item .n { font-weight: 650; }
.shop-item .u { font-size: 0.82rem; color: var(--muted); }
.shop-item.checked .n { text-decoration: line-through; color: var(--muted); }
.shop-item .pantry { font-size: 0.75rem; background: var(--green-soft); color: var(--green-ink); border-radius: 999px; padding: 1px 8px; font-weight: 700; margin-left: 6px; }

/* ---------- Insights ---------- */
.metric { padding: 14px 0; border-top: 1px solid var(--line); }
.metric:first-child { border-top: 0; }
.metric .spread { margin-bottom: 8px; }
.metric .lbl { font-weight: 650; display: flex; gap: 8px; align-items: center; }
.metric .val { color: var(--muted); font-weight: 650; font-size: 0.92rem; }
.cheer { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }

/* ---------- More / list menus ---------- */
.menu a, .menu button { display: flex; align-items: center; gap: 14px; padding: 16px; text-decoration: none; color: var(--ink); font-weight: 650; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; font-size: 1.02rem; }
.menu a + a, .menu a + button, .menu button + a { border-top: 1px solid var(--line); }
.menu .ico { font-size: 1.5rem; width: 36px; text-align: center; }
.menu .d { display: block; font-weight: 500; color: var(--muted); font-size: 0.86rem; }
.menu .chev { margin-left: auto; color: var(--muted); }

/* ---------- Sheet / dialog / toast ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(30, 20, 12, 0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s; }
.sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 26px 26px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); max-height: 88vh; overflow: auto; }
.sheet .grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 4px auto 14px; }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 26px; } }
.fb-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.fb-grid button { min-height: 72px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--bg); font-weight: 650; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 0.95rem; color: var(--ink); }
.fb-grid button .e { font-size: 1.6rem; }
.fb-grid button[aria-pressed='true'] { background: var(--green-soft); border-color: var(--green); }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 14px; font-weight: 600; z-index: 60; box-shadow: var(--shadow-lg); max-width: calc(100% - 32px); text-align: center; animation: fade 0.2s; }
@media (min-width: 960px) { .toast { bottom: 28px; } }

/* ---------- Ask / chat ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; }
.bubble { padding: 12px 16px; border-radius: 18px; max-width: 92%; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--terracotta); color: #fff; border-bottom-right-radius: 6px; }
.bubble.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble .src { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
.suggest-q { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Settings ---------- */
.member { padding: 14px 0; border-top: 1px solid var(--line); }
.member:first-child { border-top: 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; cursor: pointer; }
.switch input { appearance: none; width: 52px; height: 30px; border-radius: 99px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ''; position: absolute; width: 24px; height: 24px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: left 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { left: 25px; }
details.private { border: 1.5px dashed var(--line); border-radius: 18px; padding: 4px 16px; }
details.private summary { cursor: pointer; padding: 12px 0; font-weight: 700; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .big { font-size: 3rem; }
.welcome { display: flex; gap: 12px; align-items: flex-start; }
.welcome .e { font-size: 1.7rem; }

@media print {
  .nav, .cook-bar, .tabs, .no-print { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}
