/* Recipe Box styles. Two styles (Midnight Kitchen, Market Fresh), each light and dark. */

:root { --strip-h: 32px; --nav-total: calc(62px + var(--strip-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { :root { --strip-h: 0px; --nav-total: 0px; } }

:root,
[data-style="midnight"][data-mode="dark"] {
  --ok: #7FD6A4; --ok-soft: #1E3027; --warn: #F2C46B; --warn-soft: #3A3020;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display-weight: 600;
  --bg: #121416;
  --surface: #1B1E21;
  --surface-2: #23272B;
  --sunk: #0E1012;
  --line: #2E3338;
  --line-soft: #262A2F;
  --ink: #ECEEEF;
  --ink-2: #C9CDD1;
  --muted: #A1A8AE;
  --accent: #FF7A59;
  --on-accent: #16110F;
  --accent-soft: #3A2620;
  --accent-ink: #FF9C82;
  --star: #FF7A59;
  --star-off: #4A5056;
  --note-bg: #23272B;
  --note-ink: #DADDE0;
  --note-label: #FF7A59;
  --photo-a: #3A2A24;
  --photo-b: #33251F;
  --danger: #FF8A80;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2);
  --book-shadow: 0 0 0 1px #2A2E33;
  color-scheme: dark;
}

[data-style="midnight"][data-mode="light"] {
  --ok: #1E6B42; --ok-soft: #E3F1E8; --warn: #8A5A00; --warn-soft: #FBF0DA;
  --bg: #F6F7F8;
  --surface: #FFFFFF;
  --surface-2: #F0F2F4;
  --sunk: #E9ECEF;
  --line: #DDE1E5;
  --line-soft: #ECEEF0;
  --ink: #15181B;
  --ink-2: #2E3439;
  --muted: #5E666D;
  --accent: #C2401F;
  --on-accent: #FFFFFF;
  --accent-soft: #FBE7E1;
  --accent-ink: #A3361A;
  --star: #E0603D;
  --star-off: #CDD2D7;
  --note-bg: #FFF3EE;
  --note-ink: #3D2219;
  --note-label: #A3361A;
  --photo-a: #F5DED5;
  --photo-b: #F9E9E2;
  --danger: #B3261E;
  --shadow: 0 8px 24px rgba(21, 24, 27, .07);
  --book-shadow: 0 10px 28px rgba(21, 24, 27, .10), 0 0 0 1px #E4E7EA;
  color-scheme: light;
}

[data-style="market"] {
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display-weight: 800;
  --radius: 12px;
  --radius-lg: 16px;
}

[data-style="market"][data-mode="light"] {
  --ok: #1F6B45; --ok-soft: #E3EFE6; --warn: #8A5A00; --warn-soft: #FBF0DA;
  --bg: #EEF2EF;
  --surface: #FFFFFF;
  --surface-2: #F4F7F5;
  --sunk: #E3E9E5;
  --line: #D9E1DC;
  --line-soft: #EAEFEC;
  --ink: #16201A;
  --ink-2: #26322A;
  --muted: #5A665E;
  --accent: #1F6B45;
  --on-accent: #FFFFFF;
  --accent-soft: #E3EFE6;
  --accent-ink: #1F5A3B;
  --star: #D69416;
  --star-off: #C4CCC6;
  --note-bg: #F4F1E4;
  --note-ink: #3B3417;
  --note-label: #6B5A17;
  --photo-a: #E3EFE6;
  --photo-b: #EAF3ED;
  --danger: #B3261E;
  --shadow: 0 8px 24px rgba(22, 32, 26, .07);
  --book-shadow: 0 10px 28px rgba(22, 32, 26, .12);
  color-scheme: light;
}

[data-style="market"][data-mode="dark"] {
  --ok: #5FC48C; --ok-soft: #1A2B22; --warn: #E9C46A; --warn-soft: #332B19;
  --bg: #0F1512;
  --surface: #18211C;
  --surface-2: #1F2A24;
  --sunk: #0B100D;
  --line: #2C3A31;
  --line-soft: #233029;
  --ink: #E8EEE9;
  --ink-2: #C9D4CC;
  --muted: #9AA89F;
  --accent: #5FC48C;
  --on-accent: #0F1512;
  --accent-soft: #1F3328;
  --accent-ink: #7FD6A4;
  --star: #F2C14E;
  --star-off: #3A4A40;
  --note-bg: #252A1C;
  --note-ink: #E6E2C8;
  --note-label: #E0C969;
  --photo-a: #25332B;
  --photo-b: #2B3B31;
  --danger: #FF8A80;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2);
  --book-shadow: 0 0 0 1px #2C3A31;
  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(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
svg { flex: none; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  height: 64px; padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: .01em; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.brand b { color: var(--accent); font-weight: inherit; }
.topnav { display: none; gap: 4px; }
.topnav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px; }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.main { max-width: 1240px; margin: 0 auto; padding: 16px 16px calc(var(--nav-total) + 40px); }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: calc(var(--strip-h) + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; justify-content: space-around; align-items: center;
  height: 62px;
  background: var(--surface); border-top: 1px solid var(--line-soft);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 60px; padding: 6px 4px; text-decoration: none;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.bottomnav a[aria-current="page"] { color: var(--accent-ink); }
.bottomnav .badge { position: absolute; transform: translate(12px, -4px); }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  .main { padding: 24px 24px 64px; }
}

/* ---------- buttons, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.icon { width: 44px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.search {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-soft); color: var(--muted);
}
.search input { border: 0; outline: none; background: transparent; width: 100%; color: var(--ink); min-height: 44px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600;
}
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.tried { background: var(--accent); color: var(--on-accent); }
.pill.want { border: 1px solid var(--accent); color: var(--accent-ink); }

.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }

.seg { display: inline-flex; padding: 4px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-soft); }
.seg button { min-height: 36px; padding: 0 14px; border: 0; border-radius: calc(var(--radius) - 3px); background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }

.stars { display: inline-flex; gap: 1px; color: var(--star); }
.stars button { padding: 2px; border: 0; background: none; color: inherit; line-height: 0; min-width: 28px; min-height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.stars .off { color: var(--star-off); }

h1, h2, h3 { margin: 0; line-height: 1.15; }
.page-title { font-size: 28px; font-weight: var(--display-weight); letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- library ---------- */
.lib-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.lib-tools { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.lib-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); color: inherit; text-decoration: none; box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
}
.card:hover { border-color: var(--line); }
.card .ph { aspect-ratio: 16 / 10; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.card-title { font-weight: 600; font-size: 16px; line-height: 1.3; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-foot { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.ph {
  background: repeating-linear-gradient(135deg, var(--photo-a) 0 12px, var(--photo-b) 12px 24px);
  background-size: cover; background-position: center; position: relative;
}
.ph img { width: 100%; height: 100%; object-fit: cover; }
.fav-dot { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center; }

@media (max-width: 599px) {
  .grid { grid-template-columns: 1fr; gap: 10px; }
  .card { flex-direction: row; align-items: stretch; }
  .card .ph { width: 96px; aspect-ratio: auto; min-height: 96px; flex: none; }
  .card .fav-dot { display: none; }
}

.empty {
  text-align: center; padding: 48px 20px; border: 1px dashed var(--line); border-radius: var(--radius-lg); color: var(--muted);
}
.empty h2 { color: var(--ink); font-size: 20px; margin-bottom: 8px; }

/* ---------- recipe view (cookbook) ---------- */
.recipe-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.recipe-bar .back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 600; min-height: 44px; }
.recipe-bar .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

.book { display: flex; flex-direction: column; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--book-shadow); background: var(--surface); }
.page { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.page-right { background: var(--surface); }
.hero { position: relative; margin: -20px -20px 0; min-height: 240px; display: flex; flex-direction: column; justify-content: flex-end; padding: 20px; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(10,11,12,.86) 100%); }
.hero > * { position: relative; z-index: 1; }
.hero .tag { background: rgba(255,255,255,.18); color: #fff; }
.hero h1 { color: #fff; font-size: 32px; font-weight: var(--display-weight); letter-spacing: -.02em; }
.hero .hero-meta { color: #E7E9EB; font-size: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero .stars .off { color: rgba(255,255,255,.35); }
.hero .stars { color: #FF9C82; }
[data-style="market"] .hero .stars { color: #F2C14E; }
.hero.no-photo { min-height: 0; padding-top: 28px; background: var(--surface-2); }
.hero.no-photo::after { display: none; }
.hero.no-photo h1, .hero.no-photo .hero-meta { color: var(--ink); }
.hero.no-photo .tag { background: var(--accent-soft); color: var(--accent-ink); }
.hero.no-photo .stars { color: var(--star); }
.hero.no-photo .stars .off { color: var(--star-off); }
.hero-img { position: absolute; inset: 0; z-index: 0 !important; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }

.desc { color: var(--ink-2); font-size: 15px; margin: 0; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); }
.facts > div { padding: 10px 12px; border-left: 1px solid var(--line); }
.facts > div:first-child { border-left: 0; }
.facts .k { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.facts .v { font-size: 16px; font-weight: 600; }

.serv { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; }
.stepper button { width: 44px; height: 42px; border: 0; background: none; font-size: 20px; color: var(--ink); }
.stepper button.plus { color: var(--accent-ink); }
.stepper output { min-width: 28px; text-align: center; font-weight: 700; font-size: 17px; }
.sec-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sec-title h2 { font-size: 18px; font-weight: 600; }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.ing-list li.sub { border: 0; padding: 12px 0 2px; font-weight: 600; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ing-list .amt { min-width: 76px; font-weight: 600; color: var(--accent-ink); }
.ing-list .nm { flex: 1; min-width: 0; }
.ing-list .have { font-size: 12px; color: var(--muted); }
.ing-list .add {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent;
  color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.ing-list .add[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { position: relative; padding: 0 0 20px 40px; margin-left: 12px; border-left: 1px solid var(--line); }
.steps li:last-child { border-left-color: transparent; }
.steps li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: -13px; top: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.steps li.sect { padding-left: 28px; border-left-color: transparent; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); padding-bottom: 12px; }
.steps li.sect::before { display: none; }
.steps p { margin: 0; color: var(--ink-2); line-height: 1.65; }
.timer-btn {
  display: inline-flex; align-items: center; gap: 6px; margin: 8px 8px 0 0; min-height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent-ink); font-size: 13px; font-weight: 600;
}
.note { padding: 16px 18px; border-radius: var(--radius); background: var(--note-bg); color: var(--note-ink); }
.note .k { font-size: 12px; font-weight: 700; color: var(--note-label); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.note p { margin: 0; white-space: pre-line; }
.source { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-soft); padding-top: 12px; }
.source a { color: var(--muted); word-break: break-all; }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; }
.photo-strip img { width: 110px; height: 110px; object-fit: cover; border-radius: var(--radius); flex: none; }
.cooklog { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }

@media (min-width: 1000px) {
  .book { flex-direction: row; min-height: 760px; }
  .page { width: 50%; padding: 30px 34px; }
  .page-left { border-right: 1px solid var(--line-soft); }
  .page-right { background: var(--surface-2); }
  [data-mode="dark"] .page-right { background: #181B1E; }
  [data-style="market"][data-mode="dark"] .page-right { background: #151D19; }
  [data-style="market"][data-mode="light"] .page-right { background: #FCFDFC; }
  .hero { margin: -30px -34px 0; min-height: 320px; padding: 26px 34px; }
  .hero h1 { font-size: 40px; }
  .ing-cols { columns: 1; }
}

/* ---------- forms (edit + import) ---------- */
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 860px; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.panel { min-width: 0; grid-template-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 18px; display: grid; gap: 14px; }
.panel h2 { font-size: 18px; font-weight: 600; }
.cat-group { display: grid; gap: 8px; }
.cat-group .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-tile { position: relative; width: 110px; height: 110px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .x { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: flex; align-items: center; justify-content: center; }
.photo-tile .cover { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--accent); color: var(--on-accent); }
.photo-add { width: 110px; height: 110px; border-radius: var(--radius); border: 1px dashed var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; background: transparent; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-total) + 8px); z-index: 5; display: flex; gap: 10px; justify-content: flex-end; padding: 12px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
@media (min-width: 900px) { .sticky-actions { bottom: 16px; } }

.queue { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.queue li { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line-soft); }
.queue .q-main { flex: 1 1 160px; min-width: 0; }
.queue .q-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue .q-url { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.status.ok { background: var(--accent); color: var(--on-accent); }
.status.review { border: 1px solid var(--accent); color: var(--accent-ink); }
.status.fail { border: 1px solid var(--danger); color: var(--danger); }
.status.wait { border: 1px solid var(--line); color: var(--muted); }
.info { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.info b { color: var(--ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- shopping list ---------- */
.list-wrap { max-width: 720px; }
.list-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.add-row { display: flex; gap: 8px; margin-bottom: 8px; }
.add-row .input { flex: 1; }
.aisle { margin: 18px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.items { list-style: none; margin: 0; padding: 0 14px; background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line-soft); }
.items li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.items li:last-child { border-bottom: 0; }
.items label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.items input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.items .it-name { font-weight: 500; }
.items .it-from { font-size: 12px; color: var(--muted); }
.items .it-qty { font-weight: 600; font-size: 14px; white-space: nowrap; }
.items li.done .it-name { text-decoration: line-through; color: var(--muted); }
.items .rm { width: 36px; height: 36px; border: 0; background: none; color: var(--muted); border-radius: 50%; }

/* ---------- planner ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; }
.week { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.day { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.day.today { border-color: var(--accent); }
.day-h { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.day-h span { font-size: 13px; color: var(--muted); font-weight: 500; }
.meal { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 14px; }
.meal a { color: var(--ink); text-decoration: none; flex: 1; min-width: 0; font-weight: 500; }
.meal .rm { border: 0; background: none; color: var(--muted); width: 28px; height: 28px; }
.meal .slot { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

/* ---------- dialog / sheet ---------- */
dialog.sheet {
  border: 0; padding: 0; width: min(560px, calc(100% - 24px)); max-height: 86vh; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
dialog.sheet::backdrop { background: rgba(0,0,0,.5); }
.sheet-in { padding: 20px; display: grid; gap: 14px; }
.sheet-h { display: flex; justify-content: space-between; align-items: center; }
.sheet-h h2 { font-size: 20px; font-weight: 600; }
.pick-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.pick-list button { text-align: left; min-height: 48px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--line-soft); background: var(--surface-2); color: var(--ink); }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-total) + 12px); z-index: 60;
  max-width: 640px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 10px 14px 16px; border-radius: var(--radius-lg);
  background: var(--ink); color: var(--bg); font-weight: 500; font-size: 15px; line-height: 1.4;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
  transform: translateY(0); opacity: 1; transition: transform .25s ease, opacity .25s ease;
}
.toast.out { transform: translateY(16px); opacity: 0; pointer-events: none; }
.toast .t-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.toast .t-msg { flex: 1; min-width: 0; }
.toast .t-x { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: inherit; opacity: .7; display: flex; align-items: center; justify-content: center; }
.toast .t-x:hover { opacity: 1; }
@media (min-width: 900px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- timers dock ---------- */
.timers { position: fixed; right: 16px; bottom: calc(var(--nav-total) + 20px); z-index: 40; display: grid; gap: 8px; }
@media (min-width: 900px) { .timers { bottom: 20px; } }
.timer-chip { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.timer-chip.ring { background: var(--accent); color: var(--on-accent); animation: pulse 1s infinite; }
.timer-chip button { border: 0; background: rgba(127,127,127,.25); color: inherit; border-radius: 999px; min-height: 32px; padding: 0 10px; font-weight: 600; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* ---------- cook mode ---------- */
.cook {
  position: fixed; inset: 0; z-index: 50; background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column;
}
.cook-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.cook-top h2 { font-size: 17px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cook-body { flex: 1; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 28px 20px; align-content: start; max-width: 860px; width: 100%; margin: 0 auto; }
/* filter */
.filter-btn .count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; }
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.chip .n { font-size: 12px; opacity: .7; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
dialog.filter-sheet { width: min(640px, calc(100% - 24px)); max-height: min(86vh, 760px); overflow: hidden; }
.filter-sheet .sheet-in { padding: 0; gap: 0; display: flex; flex-direction: column; max-height: min(86vh, 760px); }
.filter-sheet .sheet-h { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.filter-body { overflow: auto; padding: 8px 20px 16px; display: grid; gap: 4px; }
.filter-body section { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.filter-body section:last-child { border-bottom: 0; }
.f-h { margin: 0; font-size: 16px; font-weight: 600; }
.filter-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); }
.filter-foot .primary { flex: 1; max-width: 260px; }
@media (max-width: 599px) {
  dialog.filter-sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 88vh; }
  .filter-sheet .sheet-in { max-height: 88vh; }
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; color: var(--muted); }
.tag-list a { color: var(--muted); text-decoration: none; }
.tag-list a:hover { color: var(--accent-ink); }

.cook-ings-box {border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.cook-ings-box summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 0 16px; cursor: pointer; font-weight: 600; }
.cook-ings-box summary::-webkit-details-marker { display: none; }
.cook-ings-box .chev { transition: transform .15s; color: var(--muted); }
.cook-ings-box[open] .chev { transform: rotate(90deg); }
.cook-ings-box .cook-ings { padding: 0 16px 8px; }
.cook-ings-box .cook-ings li:last-child { border-bottom: 0; }
.cook-step-n { font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.cook-step { font-size: clamp(22px, 3.2vw, 34px); line-height: 1.45; font-weight: 400; margin: 10px 0 0; }
.cook-ings { list-style: none; margin: 0; padding: 0; font-size: 16px; }
.cook-ings li { padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.cook-ings b { color: var(--accent-ink); }
.cook-nav { display: flex; gap: 12px; padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); }
.cook-nav .btn { flex: 1; min-height: 56px; font-size: 17px; }
.progress { height: 4px; background: var(--line-soft); }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }

/* ---------- settings ---------- */
.set-wrap { max-width: 760px; display: grid; gap: 16px; }
.style-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.style-card { text-align: left; border-radius: var(--radius-lg); border: 2px solid var(--line); padding: 12px; background: var(--surface); color: var(--ink); display: grid; gap: 10px; }
.style-card[aria-pressed="true"] { border-color: var(--accent); }
.swatches { display: flex; gap: 6px; }
.swatches i { width: 28px; height: 28px; border-radius: 50%; display: block; border: 1px solid rgba(127,127,127,.3); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- scan ---------- */
.scan-picks { display: flex; flex-wrap: wrap; gap: 10px; }
.scan-picks .btn { flex: 1 1 180px; min-height: 52px; }
.scan-progress { display: grid; gap: 8px; }
.scan-progress .progress { height: 8px; border-radius: 999px; overflow: hidden; }

/* ---------- small screens: everything gets a clean, full-width layout ---------- */
.recipe-bar .fav-label { display: none; }
@media (max-width: 699px) { .recipe-bar .fav-label { display: inline; } }
@media (max-width: 699px) {
  .lib-head { flex-wrap: wrap; }
  .lib-head > .btn-row { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
  .lib-head > .btn-row .btn { width: 100%; }

  .lib-row > .seg { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lib-row > .seg button { padding: 0 6px; }
  .lib-row > .btn-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lib-row > .btn-row .btn, .lib-row > .btn-row .select { width: 100% !important; min-height: 44px; }

  .recipe-bar .actions { margin-left: 0; width: 100%; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .recipe-bar .actions > * { grid-column: span 3; }
  .recipe-bar .actions .btn { width: 100%; min-height: 44px; padding: 0 6px; gap: 5px; }
  .recipe-bar .actions [data-act="cook"] { grid-column: 1 / -1; order: -2; min-height: 50px; font-size: 16px; }
  .recipe-bar .actions [data-act="addAll"] { grid-column: span 8; order: -1; }
  .recipe-bar .actions [data-act="planIt"] { grid-column: span 4; order: -1; }

  .list-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .list-actions .btn { width: 100%; padding: 0 8px; }
  .list-actions [data-act="shareList"] { grid-column: 1 / -1; background: var(--accent); border-color: var(--accent); color: var(--on-accent); min-height: 46px; }

  .sticky-actions { flex-wrap: wrap; }
  .sticky-actions > * { flex: 1 1 auto; }
  .sticky-actions [data-act="deleteRecipe"] { flex-basis: 100%; order: 3; margin-right: 0 !important; }

  .week-nav { width: 100%; }
  .week-nav [data-d="0"] { flex: 1; }
  .page-title { font-size: 26px; }
  .page { padding: 18px 16px; }
  .hero { margin: -18px -16px 0; padding: 18px 16px; }
  .hero h1 { font-size: 28px; }
  .facts .v { font-size: 15px; }
  .ing-list .amt { min-width: 64px; }
}
@media (max-width: 380px) {
  .main { padding-left: 12px; padding-right: 12px; }
  .lib-row > .seg button { font-size: 13px; }
  .facts > div { padding: 8px; }
  .recipe-bar .actions > .btn:not([data-act="cook"]):not([data-act="addAll"]):not([data-act="planIt"]) { font-size: 13px; }
  .recipe-bar .actions > .btn:not([data-act="cook"]) svg { width: 15px; height: 15px; }
}
/* tablets: two-column cards, roomy book */
@media (min-width: 700px) and (max-width: 999px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 26px 28px; }
  .hero { margin: -26px -28px 0; padding: 24px 28px; min-height: 300px; }
}
@media (min-width: 1600px) {
  .main { max-width: 1440px; }
}

/* ---------- print ---------- */
.print-only { display: none; }
/* ---------- backup and sync ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.notice > svg { flex: 0 0 auto; margin-top: 1px; }
.notice b { color: var(--ink); font-weight: 600; }
.notice.is-ok { background: var(--ok-soft); }
.notice.is-ok > svg { color: var(--ok); }
.notice.is-warning { background: var(--warn-soft); }
.notice.is-warning > svg { color: var(--warn); }
.notice.is-info > svg { color: var(--accent-ink); }
.how-steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.how-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.lock-line { display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.lock-line svg { flex: 0 0 auto; margin-top: 2px; }
.pair-enter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.pair-field { display: grid; gap: 6px; flex: 1 1 220px; min-width: 0; }
.pair-input { text-transform: uppercase; letter-spacing: .12em; font-size: 18px; }
.pair-code { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); }
.pair-qr { background: #fff; padding: 10px; border-radius: 10px; line-height: 0; }
.pair-qr svg { display: block; width: 176px; height: 176px; }
.pair-code-copy { flex: 1 1 240px; display: grid; gap: 10px; min-width: 0; }
.pair-code-text { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: .14em; color: var(--ink); font-variant-numeric: tabular-nums; }
.device-list { list-style: none; margin: 0; padding: 0; }
.device-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.device-list li:last-child { border-bottom: 0; }
.device-icon { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-2); flex: 0 0 auto; }
.device-main { flex: 1 1 180px; display: grid; gap: 2px; min-width: 0; }
.device-name { font-weight: 600; overflow-wrap: anywhere; }
.device-actions { display: flex; gap: 4px; margin-left: auto; }
.device-actions .btn { min-height: 44px; }
.preview-list { margin: 0; display: grid; gap: 0; }
.preview-list div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.preview-list dt { color: var(--muted); }
.preview-list dd { margin: 0; font-weight: 600; text-align: right; }
/* The strip under the phone tabs */
.strip-wrap { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; height: calc(var(--strip-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); }
.backup-strip { width: 100%; height: var(--strip-h); display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border: 0; border-radius: 0; background: var(--accent-soft); color: var(--accent-ink); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.backup-strip svg { flex: 0 0 auto; }
.backup-strip.is-quiet { background: var(--surface-2); color: var(--muted); cursor: default; font-weight: 500; }
.backup-strip.is-warning { background: var(--warn-soft); color: var(--ink); }
.backup-strip.is-warning svg { color: var(--warn); }
.backup-strip-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-strip-more { flex: 0 0 auto; text-decoration: underline; }
/* The computer's version, in the top bar */
.side-wrap { display: none; min-width: 0; }
.side-status { display: inline-flex; align-items: center; gap: 7px; max-width: 300px; min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.side-status span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-status svg { flex: 0 0 auto; color: var(--ok); }
.side-status.is-warning { background: var(--warn-soft); color: var(--ink); }
.side-status.is-warning svg { color: var(--warn); }
@media (min-width: 900px) {
  .strip-wrap { display: none; }
  .side-wrap { display: flex; }
}
@media (min-width: 900px) and (max-width: 1179px) { .side-status { max-width: 44px; padding: 0; width: 44px; justify-content: center; } .side-status > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.more-btn .more-label { display: none; }
@media (min-width: 900px) { .more-btn { width: auto; padding: 0 12px; gap: 6px; } .more-btn .more-label { display: inline; } }
/* More page */
.more-list { display: grid; gap: 10px; }
.more-tile { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--line-soft); background: var(--surface); color: var(--ink); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.more-tile:hover { border-color: var(--line); }
.more-tile > span:nth-child(2) { flex: 1; display: grid; gap: 2px; min-width: 0; }
.more-t { font-weight: 600; font-size: 16px; }
.more-ic { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-ink); flex: 0 0 auto; }
.more-chev { color: var(--muted); flex: 0 0 auto; }

@media print {
  @page { margin: 14mm; }
  body { background: #fff !important; color: #111 !important; font-size: 11.5pt; }
  .topbar, .bottomnav, .strip-wrap, .side-wrap, .recipe-bar, .timers, .toast, .no-print, .ing-list .add, .timer-btn, .cooklog, .stepper button, .lib-tools { display: none !important; }
  .print-only { display: block; }
  .main { padding: 0; max-width: none; }
  .book { box-shadow: none !important; border-radius: 0; flex-direction: row; background: #fff !important; }
  .page { width: 50%; padding: 0 16px; background: #fff !important; }
  .page-left { border-right: 1px solid #ccc !important; }
  .hero { margin: 0 0 6px; min-height: 0; padding: 0; background: none !important; }
  .hero::after, .hero-img { display: none; }
  .hero h1, .hero .hero-meta { color: #111 !important; }
  .hero h1 { font-size: 24pt; }
  .hero .tag, .tag { background: none !important; border: 1px solid #999; color: #333 !important; }
  .hero .stars, .stars { color: #333 !important; }
  .print-photo { display: block; width: 100%; max-height: 60mm; object-fit: cover; border-radius: 4px; margin-bottom: 8px; }
  .facts, .facts > div { border-color: #bbb !important; }
  .ing-list .amt, .steps li::before, .note .k { color: #111 !important; }
  .steps li::before { border-color: #111 !important; background: #fff !important; }
  .steps li { border-left-color: #ccc; break-inside: avoid; }
  .steps p, .desc, .ing-list li { color: #111 !important; }
  .note { background: none !important; border: 1px solid #bbb; color: #111 !important; }
  .source, .source a { color: #444 !important; }
  .print-list .items { border: 0; padding: 0; columns: 2; }
  .print-list .items li { min-height: 0; padding: 4px 0; break-inside: avoid; border-color: #ddd; }
  .print-list .list-actions, .print-list .add-row, .print-list .rm, .print-list .seg { display: none !important; }
  .print-list input[type="checkbox"] { -webkit-appearance: none; appearance: none; width: 12pt; height: 12pt; border: 1px solid #333; border-radius: 2px; }
  a { color: #111 !important; text-decoration: none; }
}

/* ---------- swaps, nutrition, sharing ---------- */
.ing-list .swap { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--accent-ink); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; flex: 0 0 auto; }
.ing-list .swap:hover { border-color: var(--accent-ink); }
@media (max-width: 420px) { .ing-list .swap span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .ing-list .swap { width: 36px; padding: 0; justify-content: center; } }
.swap-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.nutri { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); display: grid; gap: 10px; }
.nutri .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: 8px; }
.nutri .est { font-size: 11px; letter-spacing: .02em; text-transform: none; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.nutri-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.nutri-grid .v { font-size: 20px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.nutri-grid .k2 { font-size: 12px; color: var(--muted); }
.nutri details summary { cursor: pointer; font-size: 13px; color: var(--accent-ink); min-height: 32px; display: flex; align-items: center; }
.nutri details p { margin: 6px 0 0; }
@media (max-width: 400px) { .nutri-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.share-picks { display: grid; gap: 8px; }
.share-pick { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.share-pick:hover { border-color: var(--accent); }
.share-pick > svg { color: var(--accent-ink); flex: 0 0 auto; }
.share-pick > span { display: grid; gap: 2px; }

/* ---------- what can I make ---------- */
.can-h { font-size: 18px; font-weight: 600; margin: 18px 0 8px; }
.can-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.can-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--surface); }
.can-ph { width: 64px; height: 64px; border-radius: var(--radius); background: var(--photo-a) center/cover no-repeat; flex: 0 0 auto; }
.can-main { flex: 1 1 200px; min-width: 0; display: grid; gap: 6px; }
.can-title { font-weight: 600; color: var(--ink); text-decoration: none; font-size: 16px; }
.can-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.can-bar span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
@media (max-width: 599px) { .can-row > .btn { width: 100%; } }

/* ---------- what's for dinner ---------- */
.dinner-sheet { width: min(560px, calc(100vw - 24px)); }
.dinner-card { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: var(--radius-lg); border: 1px solid var(--line); text-decoration: none; color: var(--ink); background: var(--surface-2); }
.dinner-ph { width: 96px; height: 96px; border-radius: var(--radius); background: var(--photo-a) center/cover no-repeat; flex: 0 0 auto; }
.dinner-body { display: grid; gap: 4px; min-width: 0; }
.dinner-title { font-size: 22px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
@media (max-width: 499px) { .dinner-actions { display: grid; grid-template-columns: 1fr 1fr; } .dinner-actions .primary { grid-column: 1 / -1; order: -1; } .dinner-ph { width: 72px; height: 72px; } }

/* ---------- print a cookbook ---------- */
.cb-wrap { max-width: 860px; margin: 0 auto; }
.cb-controls { display: grid; gap: 14px; margin-bottom: 16px; }
.cb-seg { flex-wrap: wrap; }
.cb-pick { display: grid; gap: 2px; max-height: 260px; overflow: auto; padding: 4px; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.cb-pick label { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px; cursor: pointer; }
.cb-pick input { width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }
.cb-preview-h { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 6px; }
.cookbook { display: grid; gap: 18px; }
.cookbook > section { background: #FFFDF9; color: #1F1A17; border-radius: 6px; box-shadow: 0 2px 14px rgba(0,0,0,.18); padding: 48px 52px; font-family: Georgia, "Times New Roman", serif; }
.cookbook h1, .cookbook h2, .cookbook h3 { font-family: var(--font); color: #1F1A17; }
.cb-cover, .cb-chapter { min-height: 520px; display: flex; align-items: center; justify-content: center; text-align: center; }
.cb-cover-in, .cb-chapter-in { display: grid; gap: 14px; justify-items: center; }
.cb-mark { width: 84px; height: 84px; border-radius: 50%; border: 2px solid #C2401F; color: #C2401F; display: flex; align-items: center; justify-content: center; }
.cb-cover-title { font-size: 46px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; overflow-wrap: anywhere; }
.cb-cover-sub { font-size: 20px; font-style: italic; color: #5A504A; margin: 0; }
.cb-cover-foot { font-size: 14px; color: #6B615A; letter-spacing: .1em; text-transform: uppercase; margin: 24px 0 0; font-family: var(--font); }
.cb-toc h2 { font-size: 30px; margin-bottom: 18px; }
.cb-toc-ch h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #A3361A; margin: 16px 0 6px; }
.cb-toc ol { list-style: none; margin: 0; padding: 0; }
.cb-toc li { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 16px; }
.cb-toc li span:first-child { min-width: 0; }
.cb-dots { flex: 1; border-bottom: 1px dotted #9A8F87; transform: translateY(-4px); min-width: 20px; }
.cb-toc li span:last-child { font-family: var(--font); font-size: 13px; color: #6B615A; white-space: nowrap; }
.cb-chapter h2 { font-size: 40px; }
.cb-chapter p { color: #6B615A; margin: 0; }
.cb-num { font-family: var(--font); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #A3361A; font-weight: 700; }
.cb-title { font-size: 32px; line-height: 1.15; margin: 6px 0 6px; overflow-wrap: anywhere; }
.cb-facts { font-family: var(--font); font-size: 13px; color: #6B615A; margin: 0 0 14px; }
.cb-photo { width: 100%; max-height: 300px; object-fit: cover; border-radius: 4px; margin-bottom: 14px; }
.cb-desc { font-style: italic; color: #4A413B; }
.cb-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 28px; }
.cb-cols h3, .cb-notes h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: #A3361A; margin: 0 0 8px; }
.cb-ings { list-style: none; margin: 0; padding: 0; }
.cb-ings li { padding: 5px 0; border-bottom: 1px solid #EDE6DF; font-size: 15px; }
.cb-ings li.sub { font-weight: 700; border: 0; padding-top: 10px; }
.cb-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: 15px; line-height: 1.55; }
.cb-notes { margin-top: 18px; padding: 12px 14px; background: #F5EFE8; border-radius: 4px; }
.cb-notes p { margin: 0; white-space: pre-wrap; }
@media (max-width: 640px) {
  .cookbook > section { padding: 28px 22px; }
  .cb-cols { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .cb-cover, .cb-chapter { min-height: 360px; }
  .cb-cover-title { font-size: 34px; }
}
@media print {
  html.printing-book .cb-controls { display: none !important; }
  html.printing-book .main { padding: 0 !important; max-width: none !important; }
  .cookbook { display: block; }
  .cookbook > section { box-shadow: none; border-radius: 0; padding: 0; background: #fff; break-after: page; page-break-after: always; }
  .cookbook > section:last-child { break-after: auto; page-break-after: auto; }
  .cb-cover, .cb-chapter { min-height: 240mm; }
  .cb-cols { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) !important; }
  .cb-ings li, .cb-steps li { break-inside: avoid; }
}

/* ---------- hands-free cook mode ---------- */
.cook-top .hands { gap: 6px; min-height: 40px; }
.cook-top .hands.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.hands-bar { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13.5px; font-weight: 600; text-align: center; }
.hands-bar svg { flex: 0 0 auto; }
@media (max-width: 420px) { .cook-top { gap: 8px; padding: 12px 12px; } .cook-top .hands span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .cook-top .hands { width: 44px; padding: 0; justify-content: center; } }

/* Picture card preview */
.card-preview { display: block; width: 100%; max-width: 360px; max-height: 56vh; object-fit: contain; margin: 0 auto; border-radius: 12px; border: 1px solid var(--line); }

/* Leftovers on the meal plan */
.meal.leftover { background: transparent; border: 1px dashed var(--line); }
.meal .meal-t { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.meal-left { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 0; min-height: 32px; border: 0; background: none; color: var(--accent-ink, var(--accent)); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.meal-left:hover { text-decoration: underline; }
.left-picks, .dinner-left { display: grid; gap: 8px; }
.left-picks .chips, .dinner-left .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.left-picks .chip, .dinner-left .chip { display: inline-flex; align-items: center; gap: 6px; }
.dinner-left { padding-top: 12px; border-top: 1px solid var(--line-soft, var(--line)); }

/* Add all to list: tick what you need */
.tick-list { list-style: none; margin: 0; padding: 0; display: grid; }
.tick-list li { border-bottom: 1px solid var(--line-soft, var(--line)); }
.tick-list li:last-child { border-bottom: 0; }
.tick { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0; cursor: pointer; }
.tick input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.tick > span { display: grid; gap: 2px; }
.tick.is-done { opacity: .6; cursor: default; }

/* Swaps: from the recipe, your own, common */
.swap-sec { display: grid; gap: 8px; }
.swap-list.mine li { display: flex; align-items: center; gap: 8px; }
.swap-list.mine li span { flex: 1; }
.swap-list .rm { border: 0; background: none; color: var(--muted); width: 36px; height: 36px; flex: none; }

.ing-list .swap.quiet { border-color: transparent; color: var(--muted); opacity: .7; }
.ing-list .swap.quiet:hover, .ing-list .swap.quiet:focus-visible { opacity: 1; border-color: var(--line); }
@media (min-width: 421px) { .ing-list .swap.quiet { width: 32px; padding: 0; justify-content: center; } }
.get-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* Flip and stir reminders */
.timer-wrap { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 8px 6px 0; }
.timer-wrap .timer-btn { margin: 0; }
.timer-note { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.timer-chip .bell { width: 36px; min-height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.timer-chip.nudge { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- cookbook designs ---------- */
.cb-designs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.cb-design { display: grid; gap: 6px; text-align: left; padding: 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; min-width: 0; }
.cb-design[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.cb-design-t { font-weight: 700; }
.cb-swatch { display: grid; gap: 6px; padding: 12px; border-radius: 6px; height: 86px; align-content: start; background: var(--cbp, #FFFDF9); color: var(--cbi, #1F1A17); border: 1px solid rgba(0,0,0,.08); }
.cb-sw-title { font: 700 22px/1 var(--cbh, Georgia, serif); }
.cb-sw-rule { height: 3px; width: 40%; background: var(--cba, #C2401F); border-radius: 2px; }
.cb-sw-lines { display: grid; gap: 4px; }
.cb-sw-lines i { display: block; height: 4px; border-radius: 2px; background: currentColor; opacity: .25; }
.cb-sw-lines i:nth-child(2) { width: 80%; } .cb-sw-lines i:nth-child(3) { width: 60%; }

/* Each design sets its paper, ink, accent and heading font */
.cb-d-classic { --cbp: #FFFDF9; --cbi: #1F1A17; --cba: #A3361A; --cbh: var(--font); --cbb: Georgia, "Times New Roman", serif; --cbsoft: #F5EFE8; --cbrule: #EDE6DF; }
.cb-d-farmhouse { --cbp: #F7F1E6; --cbi: #2B2A24; --cba: #4F6B52; --cbh: "Playfair Display", Georgia, serif; --cbb: Georgia, "Times New Roman", serif; --cbsoft: #ECE4D4; --cbrule: #DDD2BE; }
.cb-d-modern { --cbp: #FFFFFF; --cbi: #15181B; --cba: #C2401F; --cbh: "Manrope", system-ui, sans-serif; --cbb: "Manrope", system-ui, sans-serif; --cbsoft: #F1F3F5; --cbrule: #E4E7EA; }
.cb-d-minimal { --cbp: #FFFFFF; --cbi: #111111; --cba: #111111; --cbh: Georgia, "Times New Roman", serif; --cbb: Georgia, "Times New Roman", serif; --cbsoft: #FFFFFF; --cbrule: #DDDDDD; }

.cookbook > section { background: var(--cbp); color: var(--cbi); font-family: var(--cbb); }
.cookbook h1, .cookbook h2, .cookbook h3 { font-family: var(--cbh); color: var(--cbi); }
.cookbook .cb-num, .cookbook .cb-cols h3, .cookbook .cb-notes h3, .cookbook .cb-toc-ch h3 { color: var(--cba); }
.cookbook .cb-mark { border-color: var(--cba); color: var(--cba); }
.cookbook .cb-ings li { border-bottom-color: var(--cbrule); }
.cookbook .cb-notes { background: var(--cbsoft); }

/* Farmhouse: framed pages, centered titles */
.cb-d-farmhouse > section { outline: 1px solid var(--cba); outline-offset: -18px; }
.cb-d-farmhouse .cb-recipe { text-align: left; }
.cb-d-farmhouse .cb-num, .cb-d-farmhouse .cb-title, .cb-d-farmhouse .cb-facts { text-align: center; }
.cb-d-farmhouse .cb-title { font-weight: 600; font-size: 34px; }
.cb-d-farmhouse .cb-title::after { content: ""; display: block; width: 60px; height: 1px; background: var(--cba); margin: 12px auto 0; }
.cb-d-farmhouse .cb-cover-title { font-weight: 600; }
.cb-d-farmhouse .cb-cover-sub { font-family: "Playfair Display", Georgia, serif; }
.cb-d-farmhouse .cb-notes { border: 1px dashed var(--cba); background: transparent; }

/* Modern: color band, boxed ingredients, big type */
.cb-d-modern .cb-recipe { border-top: 14px solid var(--cba); }
.cb-d-modern .cb-cover { background: var(--cba); color: #fff; }
.cb-d-modern .cb-cover h1, .cb-d-modern .cb-cover p { color: #fff; }
.cb-d-modern .cb-cover .cb-mark { border-color: #fff; color: #fff; }
.cb-d-modern .cb-title { font-size: 36px; font-weight: 800; letter-spacing: -.02em; }
.cb-d-modern .cb-cols > div:first-child { background: var(--cbsoft); padding: 14px 16px; border-radius: 8px; align-self: start; }
.cb-d-modern .cb-ings li { border-bottom: 0; padding: 4px 0; }
.cb-d-modern .cb-steps { padding-left: 22px; }
.cb-d-modern .cb-steps li::marker { color: var(--cba); font-weight: 800; }
.cb-d-modern .cb-desc { font-style: normal; }

/* Minimal: no color, thin rules, small caps */
.cb-d-minimal .cb-num, .cb-d-minimal .cb-cols h3, .cb-d-minimal .cb-notes h3, .cb-d-minimal .cb-toc-ch h3 { font-variant: small-caps; text-transform: lowercase; letter-spacing: .1em; font-weight: 400; font-size: 15px; }
.cb-d-minimal .cb-title { font-weight: 400; font-size: 34px; border-bottom: 1px solid var(--cbi); padding-bottom: 10px; }
.cb-d-minimal .cb-cover-title { font-weight: 400; }
.cb-d-minimal .cb-mark { display: none; }
.cb-d-minimal .cb-notes { border-top: 1px solid var(--cbrule); border-radius: 0; padding: 12px 0 0; }
.cb-d-minimal .cb-photo { filter: grayscale(1); }

/* One column: ingredients above the method */
.cookbook.cb-l-one .cb-cols { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.cookbook.cb-l-one .cb-ings { columns: 2; column-gap: 28px; }
.cookbook.cb-l-one .cb-ings li { break-inside: avoid; }
@media (max-width: 640px) { .cookbook.cb-l-one .cb-ings { columns: 1; } }
@media print {
  .cookbook > section { background: var(--cbp) !important; }
  .cookbook.cb-l-one .cb-cols { grid-template-columns: minmax(0, 1fr) !important; }
  .cb-d-farmhouse > section { outline: 0; border: 1px solid var(--cba); padding: 14mm !important; }
  .cb-d-modern .cb-recipe { padding-top: 6mm !important; }
}

/* ---------- pop-ups: full width on phones, nothing wider than the screen ---------- */
dialog.sheet { overflow-x: hidden; overflow-y: auto; }
.sheet-in > * { min-width: 0; }
.sheet .btn-row { flex-wrap: wrap; }
.sheet .btn-row .btn { white-space: normal; }
.dinner-sheet .chips-scroll { flex-wrap: wrap; overflow-x: visible; }
@media (max-width: 640px) {
  dialog.sheet, dialog.sheet.dinner-sheet, dialog.filter-sheet {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh;
  }
  .sheet-in { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .filter-sheet .sheet-in { padding: 0; max-height: 92vh; }
  .dinner-card { padding: 10px; gap: 12px; }
  .dinner-title { font-size: 19px; }
}
/* Long chip labels (like a long recipe name) wrap inside pop-ups instead of pushing past the edge */
.sheet .chip { white-space: normal; max-width: 100%; text-align: left; padding-top: 6px; padding-bottom: 6px; line-height: 1.25; overflow-wrap: anywhere; }
.sheet .chips, .sheet .chips-scroll { min-width: 0; max-width: 100%; }
.timer-chip > span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .form-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .cb-designs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cb-swatch { height: 64px; padding: 8px; }
  .cb-design { padding: 8px; }
}

/* ---------- original link and video ---------- */
.origin { display: grid; gap: 10px; margin: 4px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.origin-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.origin-ic { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-ink, var(--accent)); flex: none; }
.origin-t { display: grid; min-width: 0; flex: 1 1 140px; }
.origin-t a { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.origin-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.video-frame.tall { aspect-ratio: 9 / 16; max-width: 340px; max-height: 72vh; margin: 0 auto; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 420px) { .origin-btns { width: 100%; } .origin-btns .btn { flex: 1; } }
@media print { .origin { border: 0; padding: 0; background: none; } .origin-ic { display: none; } }

/* Import list: messages wrap so they can always be read in full */
.queue .q-msg { font-size: 13px; color: var(--ink-2, var(--ink)); margin-top: 4px; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
.queue .status { white-space: normal; }
/* One Add screen: tabs wrap into a grid on phones instead of scrolling sideways */
.add-tabs button { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 560px) {
  .add-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; border-bottom: 0; overflow: visible; }
  .add-tabs button { justify-content: center; border: 1px solid var(--line); border-radius: var(--radius); white-space: normal; text-align: center; padding: 6px 8px; }
  .add-tabs button[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink, var(--ink)); }
}
.linkish { border: 0; background: none; padding: 0; min-height: 32px; color: var(--accent-ink, var(--accent)); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
