/* The app's kitchen theme (lib/main.dart): ink, cream, green, white cards. */
:root {
  --bg: #f8f6ef; --surface: #ffffff; --text: #233a31; --muted: #5d6b61;
  --accent: #3c624c; --on-accent: #ffffff; --accent-soft: #dce5d4;
  --line: #e4e1d6; --danger: #b3261e; --shadow: 0 8px 30px rgb(35 58 49 / 0.16);
  --orange: #bc5e36; --soon-bg: #ffe5b4; --soon-line: #e8bb6b; --note-bg: #e9ecdc; --cream: #efece2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141a16; --surface: #1e2621; --text: #e8ede9; --muted: #a3b0a7;
    --accent: #8fbf9f; --on-accent: #10251a; --accent-soft: #2a3a30;
    --line: #2f3a33; --danger: #f2b8b5; --shadow: 0 8px 30px rgb(0 0 0 / 0.5);
    --orange: #f0a07c; --soon-bg: #3a301f; --soon-line: #8a6a33; --note-bg: #26302a; --cream: #232b25;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
a { color: var(--accent); }

/* Solid, not blurred: a backdrop filter would trap the fixed tab bar inside it. */
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; }
.brand img { border-radius: 8px; }
.kitchen { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.bar .icon-button { margin-left: auto; }

main { max-width: 40rem; margin: 0 auto; padding: 24px 16px calc(150px + env(safe-area-inset-bottom)); }

/* Sections: the app's bottom navigation bar on phones, tabs in the header on
   wider screens. */
.tabs {
  position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; max-width: 9rem; display: grid; justify-items: center; gap: 2px; padding: 4px 0;
  color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600;
}
.tabs a svg { width: 56px; height: 30px; padding: 4px 16px; border-radius: 15px; }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"] svg { background: var(--accent-soft); }
@media (min-width: 760px) {
  .tabs { position: static; flex: none; padding: 0; gap: 4px; background: none; border: 0; }
  .tabs a { display: flex; align-items: center; gap: 6px; max-width: none; white-space: nowrap; padding: 8px 14px; border-radius: 999px; font-size: 0.9rem; }
  .tabs a svg { width: 20px; height: 20px; padding: 0; }
  .tabs a[aria-current="page"] { background: var(--accent-soft); }
  .tabs a[aria-current="page"] svg { background: none; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}
h1 { font-size: clamp(1.9rem, 6vw, 2.25rem); line-height: 1.12; letter-spacing: -0.04em; margin: 0; }
.muted { color: var(--muted); }
.center { display: grid; place-items: center; min-height: 50vh; }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.stack { display: grid; gap: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons and fields, after the app's filled style. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 22px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none;
}
.button.secondary { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.button.google { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); width: 100%; }
.button.danger { background: var(--danger); color: var(--surface); }
.button:disabled { opacity: 0.55; cursor: default; }
.text-button { background: none; border: 0; padding: 8px 4px; color: var(--accent); font-weight: 600; cursor: pointer; }
.text-button:disabled { opacity: 0.55; cursor: default; }
.icon-button {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text); cursor: pointer;
}
.icon-button:hover { background: var(--accent-soft); }
.icon-button:disabled { opacity: 0.5; cursor: default; background: none; }
.button.tonal { background: var(--accent-soft); color: var(--text); min-height: 44px; padding: 0 18px 0 14px; gap: 6px; }
.button.wide { width: 100%; margin-top: 16px; }
.button svg { width: 20px; height: 20px; }
.text-button.start { justify-self: start; padding-left: 0; }
.text-button.link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.text-button.link svg { width: 17px; height: 17px; }
:is(button, input, a, select, textarea):focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 0.85rem; color: var(--muted); }
input[type=email], input[type=password], input[type=text], input[type=search], input[type=url], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 52px; padding: 12px 16px; border: 0; border-radius: 16px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
textarea { resize: vertical; line-height: 1.5; }
select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat;
}
:is(input, select, textarea):focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.field small { font-size: 0.8rem; }
.field .error { color: var(--danger); }
small.muted { font-size: 0.8rem; }
input.code { font-size: 1.5rem; letter-spacing: 0.4em; font-family: ui-monospace, monospace; text-align: center; }

/* Sign-in */
.auth { display: grid; gap: 16px; max-width: 26rem; margin: 4vh auto 0; }
.auth h1 { font-size: 1.9rem; }
.auth p { margin: 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.links { display: flex; flex-wrap: wrap; justify-content: space-between; }
.message { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }

/* The list */
.list-head { display: flex; align-items: center; gap: 8px; }
.list-head h1 { flex: 1; }
.summary { margin: 10px 0 0; }
.sync { margin: -12px 0 12px; color: var(--muted); font-size: 0.85rem; }
.sync.offline { color: var(--danger); }
.add { display: flex; gap: 10px; margin: 18px 0 4px; }
.add input { flex: 1; }
.round {
  display: grid; place-items: center; width: 52px; height: 52px; flex: none; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); cursor: pointer;
}
.classification { margin: 10px 0 0; font-size: 0.8rem; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.classification .bar-progress { flex: 1; height: 4px; border-radius: 2px; background: var(--accent-soft); overflow: hidden; position: relative; }
.classification .bar-progress::after { content: ""; position: absolute; inset: 0 60% 0 0; background: var(--accent); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
#items { margin-top: 12px; }
.empty { padding: 32px 0; white-space: pre-line; }
.done { color: var(--accent); font-weight: 700; margin: 12px 0 4px; }
.eyebrow {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 22px 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 2px; text-transform: uppercase;
}
.eyebrow .text-button { font-size: 0.85rem; letter-spacing: 0; text-transform: none; display: inline-flex; align-items: center; gap: 4px; }
.eyebrow .text-button svg { width: 18px; height: 18px; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.item { display: flex; align-items: center; background: var(--surface); border-radius: 12px; min-height: 56px; }
.item label { flex: 1; display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 14px; cursor: pointer; min-width: 0; }
.item input[type=checkbox] { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); cursor: pointer; }
.food-icon { width: 42px; height: 42px; flex: none; object-fit: contain; }
.food-icon.placeholder { display: grid; place-items: center; color: var(--accent); }
.food-icon.placeholder svg { width: 23px; height: 23px; }
.item.checked .food-icon { opacity: 0.55; }
.item .text { display: grid; min-width: 0; }
.item .name { overflow-wrap: anywhere; }
.item.checked .name { text-decoration: line-through; color: var(--muted); }
.item .detail { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item.saving .name::after { content: " ·"; color: var(--muted); }

/* Menus and dialogs */
.menu {
  position: fixed; z-index: 20; min-width: 200px; padding: 6px 0; margin: 0; list-style: none;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
}
.menu button { display: block; width: 100%; padding: 12px 18px; border: 0; background: none; text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--accent-soft); outline: none; }
dialog {
  width: min(28rem, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 24px;
  background: var(--bg); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgb(0 0 0 / 0.4); }
dialog form { display: grid; gap: 14px; padding: 24px; }
dialog h2 { margin: 0; font-size: 1.4rem; }
dialog p { margin: 0; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
dialog .actions .button { min-height: 44px; padding: 0 18px; }
.choices { list-style: none; margin: 0 -8px; padding: 0; max-height: 55vh; overflow: auto; }
.choices button {
  display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 48px;
  padding: 0 12px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer;
}
.choices button:hover { background: var(--accent-soft); }
.choices svg { color: var(--accent); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }
.account-email { overflow-wrap: anywhere; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 16px; width: max-content; max-width: calc(100vw - 32px);
  padding: 12px 12px 12px 18px; border-radius: 12px; background: #233a31; color: #f8f6ef; box-shadow: var(--shadow);
}
.toast button { border: 0; background: none; color: #a8d5b5; font-weight: 700; cursor: pointer; padding: 6px 8px; }

/* Shared by the kitchen and recipe book */
.page h1 { flex: 1; }
.search { position: relative; display: block; margin-top: 16px; }
.search > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; }
.search input { padding-left: 46px; }
.search-row { display: flex; gap: 12px; align-items: end; }
.search-row .search { flex: 1; }
.search-row .select { width: 9rem; flex: none; }
.note { margin: 8px 0 0; font-size: 0.9rem; }
.spinner.small { width: 18px; height: 18px; border-width: 2px; display: inline-block; }

/* Kitchen */
.row-button {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 60px; padding: 8px 14px;
  border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer;
}
div.row-button { cursor: default; }
.row-button .text { display: grid; min-width: 0; }
.row-button .trailing { margin-left: auto; color: var(--muted); display: grid; }
.row-button .trailing svg { width: 20px; height: 20px; }
.item.soon { background: var(--soon-bg); box-shadow: inset 0 0 0 1px var(--soon-line); }
.date-row { display: flex; gap: 6px; align-items: center; }

/* Recipe book */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 12px -16px 0; padding: 2px 16px 4px; scrollbar-width: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border: 0; border-radius: 10px; background: transparent; box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer; font-size: 0.9rem; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); box-shadow: none; }
.chip svg { width: 18px; height: 18px; }
.chip:disabled { cursor: default; opacity: 0.7; }
.recipes { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.recipe-row { display: flex; align-items: center; background: var(--surface); border-radius: 18px; }
.recipe-row a { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; padding: 10px; color: inherit; text-decoration: none; border-radius: 18px; }
.recipe-row .text { display: grid; gap: 5px; min-width: 0; }
.recipe-row .title { font-weight: 700; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.recipe-row .detail { font-size: 0.75rem; color: var(--muted); }
.recipe-row .favorite { margin-right: 6px; }
.favorite { color: var(--accent); }
.favorite.on { color: var(--orange); }
.recipe-art { position: relative; width: 100%; height: 250px; border-radius: 24px; overflow: hidden; background: var(--cream); }
.recipe-art.thumb { width: 82px; height: 86px; flex: none; border-radius: 12px; }
.recipe-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.recipe-art .similar {
  position: absolute; left: 10px; bottom: 10px; padding: 4px 10px; border-radius: 999px;
  background: rgb(31 42 34 / 0.8); color: #fff; font-size: 12px; font-weight: 600;
}
.recipe-art.thumb .similar { display: none; }

/* One recipe */
.recipe-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -8px 0 12px; }
.back { display: inline-flex; align-items: center; gap: 6px; padding: 8px 8px 8px 0; color: var(--text); text-decoration: none; font-weight: 600; }
.actions-bar { display: flex; gap: 2px; }
.cover { position: relative; }
.photo-button { position: absolute; right: 12px; bottom: 12px; }
.recipe .eyebrow { margin: 20px 0 8px; }
.recipe h1 { font-size: clamp(1.9rem, 6vw, 2.4rem); overflow-wrap: anywhere; }
.recipe h2 { margin: 26px 0 10px; font-size: 1.3rem; }
.meta { margin: 12px 0 8px; }
.chip.flag.on { background: var(--accent-soft); box-shadow: none; }
.provenance { margin: 12px 0 0; padding: 14px; border-radius: 14px; background: var(--note-bg); }
.recipe .links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; }
.tonight { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; color: var(--accent); font-weight: 700; }
.notes { margin: 0; padding-left: 1.2rem; display: grid; gap: 10px; }
.section-head { display: flex; align-items: center; gap: 8px; margin-top: 24px; }
.section-head h2 { flex: 1; margin: 0 !important; }
.stepper { display: flex; align-items: center; }
.stepper span { min-width: 2ch; text-align: center; font-weight: 600; }
.scaled { display: grid; margin: 4px 0; }
.scaled p { margin: 0; color: var(--orange); font-size: 0.85rem; }
.ingredients, .checklist { list-style: none; margin: 8px 0 0; padding: 0; }
.ingredients li.ingredient { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ingredients li.group { margin: 14px 0 2px; font-weight: 700; }
.ingredients .text, .checklist .text { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.have { color: var(--accent); font-size: 0.9rem; }
.steps { margin: 0; padding-left: 1.6rem; display: grid; gap: 20px; }
.steps li { padding-left: 4px; }
.app-note { margin-top: 28px; font-size: 0.85rem; }
.checklist { max-height: 55vh; overflow: auto; margin: 0 -8px; }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; cursor: pointer; }
.checklist label:hover { background: var(--accent-soft); }
.checklist input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); }

/* Writing a recipe */
.edit-recipe h1 { margin-bottom: 20px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.end { justify-content: flex-end; margin-top: 8px; }
