/* What's for dinner. Phone first. Colours are tokens, redefined for dark. Urdu: the whole layout mirrors (logical
   properties everywhere: inline-start/end), with Noto Nastaliq Urdu larger and taller than Latin text. */
:root {
  --bg: #faf7f2; --surface: #ffffff; --surface-2: #f3eee6; --line: #e4dccf;
  --text: #2a2420; --muted: #6f655b; --faint: #9a8f84;
  --accent: #b5471b; --accent-ink: #ffffff; --accent-soft: #f8e6dc;
  --ok: #2f7a3e; --ok-soft: #e2f1e5; --warn: #8a5a00; --warn-soft: #fbf0d9; --bad: #b3261e; --bad-soft: #fbe3e1;
  --chip: #efe8dd;
  --shadow: 0 1px 2px rgba(60, 40, 20, .05), 0 8px 28px rgba(60, 40, 20, .07);
  --card-line: transparent;
  --scrim: rgba(20, 14, 8, .5);
  --radius: 22px;
  /* dishes without a photo: a colour per kind */
  --k-meat: #f6d9cf; --k-chicken: #fbe7c6; --k-fish: #d6e9f5; --k-veg: #dcefd6; --k-daal: #f7ecc0; --k-egg: #fdf3d3; --k-other: #ece6f5;
  --tabbar: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171412; --surface: #221e1b; --surface-2: #2b2622; --line: #3a332d;
    --text: #f1ebe4; --muted: #b8ab9e; --faint: #8b7f73;
    --accent: #f0875a; --accent-ink: #1d120c; --accent-soft: #3d2519;
    --ok: #7fd18f; --ok-soft: #1d3322; --warn: #f2c46b; --warn-soft: #3a2e15; --bad: #ff8a80; --bad-soft: #3d1c1a;
    --chip: #322b26; --shadow: 0 1px 2px rgba(0,0,0,.4); --scrim: rgba(0,0,0,.65);
    --card-line: var(--line);
    --k-meat: #4a2a22; --k-chicken: #4a3a1c; --k-fish: #1d3646; --k-veg: #23402a; --k-daal: #463c17; --k-egg: #4a4120; --k-other: #352d45;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171412; --surface: #221e1b; --surface-2: #2b2622; --line: #3a332d;
  --text: #f1ebe4; --muted: #b8ab9e; --faint: #8b7f73;
  --accent: #f0875a; --accent-ink: #1d120c; --accent-soft: #3d2519;
  --ok: #7fd18f; --ok-soft: #1d3322; --warn: #f2c46b; --warn-soft: #3a2e15; --bad: #ff8a80; --bad-soft: #3d1c1a;
  --chip: #322b26; --shadow: 0 1px 2px rgba(0,0,0,.4); --scrim: rgba(0,0,0,.65);
  --card-line: var(--line);
  --k-meat: #4a2a22; --k-chicken: #4a3a1c; --k-fish: #1d3646; --k-veg: #23402a; --k-daal: #463c17; --k-egg: #4a4120; --k-other: #352d45;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); min-height: 100vh; overflow-x: hidden; }
:lang(ur), [dir="rtl"] body { font-family: var(--font-ur), var(--font); }
[dir="rtl"] body { font-size: 18px; line-height: 2.1; }
[dir="rtl"] .latin, .latin { font-family: var(--font); line-height: 1.45; }
body.locked { overflow: hidden; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { line-height: 1.9; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 14px; } [dir="rtl"] .small { font-size: 15px; }
.hidden, [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Text fields: 16px or more on touch screens, or an iPhone zooms in (owner's rule). Zoom is never blocked. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select, [contenteditable="true"] { font-size: max(16px, 1em); }
}

/* ---- frame ---- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; display: flex; align-items: center; gap: 10px; min-height: 56px; }
.top h1 { font-size: 19px; font-weight: 750; letter-spacing: -.01em; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[dir="rtl"] .top h1 { font-size: 21px; letter-spacing: 0; }
.top.large h1 { font-size: 30px; letter-spacing: -.02em; }
[dir="rtl"] .top.large h1 { font-size: 28px; }
.top .back { border: 0; background: none; padding: 8px; margin-inline-start: -8px; color: var(--accent); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
[dir="rtl"] .top .back svg { transform: scaleX(-1); }
.env { font-size: 11px; font-weight: 700; letter-spacing: .04em; background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 2px 6px; font-family: var(--font); }
main { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px); }
.tabs { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  display: flex; padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--tabbar);
  color: var(--muted); text-decoration: none; font-size: 12px; position: relative; }
[dir="rtl"] .tabs a { font-size: 13px; line-height: 1.6; }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.tabs svg { width: 24px; height: 24px; padding: 3px 14px; box-sizing: content-box; border-radius: 999px; transition: background .2s; }
.tabs a[aria-current="page"] svg { background: var(--accent-soft); }
.badge { position: absolute; top: 6px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent);
  color: var(--accent-ink); font: 700 11px/18px var(--font); text-align: center; padding: 0 5px; }
@media (min-width: 900px) {
  .tabs { inset-inline: auto; inset-inline-start: 50%; transform: translateX(-50%); width: 640px; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; }
  [dir="rtl"] .tabs { transform: translateX(50%); }
}
.viewas { background: var(--warn-soft); color: var(--warn); padding: 8px 16px; display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; }

/* ---- pieces ---- */
.card { background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.label { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
[dir="rtl"] .label { text-transform: none; letter-spacing: 0; font-size: 15px; }
.dish-big { display: flex; gap: 14px; align-items: center; }
.dish-big .name { font-size: 24px; font-weight: 750; line-height: 1.2; letter-spacing: -.015em; }
[dir="rtl"] .dish-big .name { font-size: 26px; line-height: 1.9; }
.thumb { width: 72px; height: 72px; border-radius: 18px; background: var(--k-other); flex: none; display: grid; place-items: center; overflow: hidden; font-size: 34px; line-height: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.sm { width: 52px; height: 52px; border-radius: 14px; font-size: 26px; }
.k-meat { background: var(--k-meat); } .k-chicken { background: var(--k-chicken); } .k-fish { background: var(--k-fish); } .k-veg { background: var(--k-veg); }
.k-daal { background: var(--k-daal); } .k-egg { background: var(--k-egg); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--chip); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 550; color: var(--muted); }
[dir="rtl"] .chip { font-size: 14px; line-height: 1.8; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); } .chip.accent { background: var(--accent-soft); color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.notes { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin-top: 12px; white-space: pre-wrap; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 10px 20px; min-height: 46px; cursor: pointer; font-weight: 650;
  transition: transform .08s ease, background .15s, box-shadow .15s; -webkit-tap-highlight-color: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--text); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn:active:not(:disabled) { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active:not(:disabled) { transform: none; } }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.ghost { background: none; border-color: transparent; color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .item:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

input[type="text"], input[type="search"], input[type="time"], input[type="number"], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; min-height: 46px; }
textarea { min-height: 88px; resize: vertical; }
.field { margin-bottom: 14px; display: block; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; min-height: 40px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 8px 16px; border-radius: 999px; cursor: pointer; min-height: 38px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* the dish list */
.search { position: sticky; top: calc(env(safe-area-inset-top) + 57px); z-index: 10; background: var(--bg); padding: 4px 0 10px; }
.search input { padding-inline-start: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%239a8f84' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px center; }
[dir="rtl"] .search input { background-position: calc(100% - 12px) center; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--card-line); border-radius: 18px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(60, 40, 20, .05);
  text-align: start; width: 100%; cursor: pointer; color: var(--text); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; overflow-wrap: anywhere; }
.item .s { color: var(--muted); font-size: 14px; }
[dir="rtl"] .item .s { font-size: 15px; }
.item.chosen { border-color: var(--accent); background: var(--accent-soft); }
.item.meatless { opacity: .72; }
.stars { color: #d08a12; font-family: var(--font); white-space: nowrap; }

/* the week */
.day { display: flex; gap: 12px; align-items: center; }
.day .when { width: 74px; flex: none; font-weight: 700; }
.day .when small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.msg { max-width: 86%; background: var(--surface); border: 1px solid var(--card-line); border-radius: 20px; border-end-start-radius: 6px; padding: 9px 14px; align-self: flex-start; box-shadow: 0 1px 2px rgba(60, 40, 20, .06); }
.msg.mine { align-self: flex-end; background: var(--accent-soft); border-color: transparent; border-end-start-radius: 20px; border-end-end-radius: 6px; box-shadow: none; }
.msg .who { font-size: 13px; color: var(--muted); font-weight: 600; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--faint); margin-top: 4px; }
.msg .meta button { border: 0; background: none; color: var(--accent); font-size: 13px; padding: 4px 0; cursor: pointer; }
.msg.recipe .body { border-inline-start: 3px solid var(--accent); padding-inline-start: 8px; }
.composer { position: fixed; inset-inline: 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 25; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 12px; }
.composer .in { display: flex; gap: 8px; align-items: flex-end; max-width: 640px; margin: 0 auto; }
.composer textarea { min-height: 44px; max-height: 40vh; }
.composer .opts { max-width: 640px; margin: 0 auto 6px; }
main.with-composer { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 130px); }

/* the kitchen: big and clear */
.kitchen .dish-big .name { font-size: 30px; }
[dir="rtl"] .kitchen .dish-big .name { font-size: 34px; line-height: 1.9; }
.kitchen .thumb { width: 96px; height: 96px; }
.headcount { font-size: 22px; font-weight: 700; margin-top: 10px; }
.bigbtn { width: 100%; min-height: 80px; font-size: 24px; border-radius: 24px; margin-top: 12px; }
[dir="rtl"] .bigbtn { font-size: 28px; }

/* sheets and dialogs: the page behind doesn't scroll; a tap outside only closes */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 60; }
.sheet { position: fixed; z-index: 61; inset-inline: 0; bottom: 0; max-height: 88vh; overflow: auto; overscroll-behavior: contain; background: var(--surface);
  border-radius: 28px 28px 0 0; animation: up .22s cubic-bezier(.2, .8, .2, 1); padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 12px; }
@media (min-width: 700px) { .sheet { inset-inline: auto; inset-inline-start: 50%; transform: translateX(-50%); width: 520px; bottom: auto; top: 10vh; border-radius: 18px; }
  [dir="rtl"] .sheet { transform: translateX(50%); } }
.menu-item { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: none; padding: 12px 4px; text-align: start; cursor: pointer; border-radius: 10px; color: var(--text); text-decoration: none; }
.menu-item:hover { background: var(--surface-2); }
.menu-item small { display: block; color: var(--muted); }
.toast { position: fixed; inset-inline: 16px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); z-index: 90; max-width: 480px; margin: 0 auto;
  background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); }

/* the Tools button (testers and admins) */
.fab { position: fixed; z-index: 40; inset-inline-end: 16px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); width: 52px; height: 52px; border-radius: 50%;
  border: 0; background: var(--text); color: var(--bg); box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer; display: grid; place-items: center; }
.fab.lift { bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 132px); }
.fab .badge { top: -2px; inset-inline-start: auto; inset-inline-end: -2px; }

/* one-time tips: the page dims, a ring around the control, an arrow; only a tap closes */
.tip-ring { position: fixed; z-index: 80; border-radius: 50%; box-shadow: 0 0 0 4px #fff, 0 0 0 9999px rgba(10, 6, 2, .68); pointer-events: none; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px #fff, 0 0 0 9999px rgba(10, 6, 2, .68); } }
@media (prefers-reduced-motion: reduce) { .tip-ring { animation: none; } }
.tip-box { position: fixed; z-index: 81; inset-inline: 16px; max-width: 420px; margin: 0 auto; background: var(--surface); color: var(--text); border-radius: 16px; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.tip-arrow { position: fixed; z-index: 81; pointer-events: none; }
.push-nudge { position: fixed; z-index: 70; inset-inline: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px); max-width: 480px; margin: 0 auto; background: var(--surface);
  border-radius: 18px; padding: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.35); display: flex; gap: 12px; }
.pn-scrim { position: fixed; inset: 0; z-index: 69; background: var(--scrim); }
.pn-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.pn-body { flex: 1; } .pn-body h2 { font-size: 17px; } .pn-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.in-steps { margin: 6px 0; padding-inline-start: 20px; } .in-steps li { margin: 4px 0; }

/* sign-in and other one-card screens */
.hero { text-align: center; padding: 40px 8px 16px; }
.hero .logo { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto 16px; display: block; }
.google { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #747775; border-radius: 22px; padding: 10px 18px;
  min-height: 44px; font: 500 15px var(--font); text-decoration: none; }
.foot { text-align: center; margin-top: 24px; font-size: 14px; }
table.plain { width: 100%; border-collapse: collapse; font-size: 14px; }
table.plain td, table.plain th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 14px; }
.dash div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.dash b { display: block; font-size: 22px; font-family: var(--font); }
pre.json { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: var(--surface-2); padding: 10px; border-radius: 10px; max-height: 50vh; overflow: auto; direction: ltr; text-align: left; }
.copyframe { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.btn[aria-pressed="true"] { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.item .pickbtn { all: unset; display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; cursor: pointer; }
.item .pickbtn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 4px; border-radius: 8px; }
.fav { border: 0; background: none; font-size: 24px; line-height: 1; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; color: var(--faint); flex: none; font-family: var(--font); }
.fav[aria-pressed="true"] { color: #d23f4d; }
.item .t, .item .s { display: block; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.toast { border-radius: 999px; text-align: center; }
