/* Fonts are served from /fonts so the app keeps working offline. All three are SIL Open Font License. */
@font-face { font-family: "Federant"; src: url("/fonts/federant.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Kalam"; src: url("/fonts/kalam-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

/* Themes. Picked in the Account tab and stored on the device (<html data-theme>).
   No data-theme = Auto: Mercat by day, Nit when the phone is in dark mode.
   Mercat: Boqueria ironwork green, glazed tile white, tomato-red price tags, a trencadís strip. */
:root, :root[data-theme="mercat"] {
  --bg: #F1F3EC;
  --surface: #FFFFFF;
  --surface-2: #E4E8DC;
  --text: #1B211D;
  --muted: #535C55;
  --border: #D3D6CA;
  --accent: #1E4A3B;
  --accent-ink: #F1F3EC;
  --accent-soft: #DCE7DF;
  --warn-bg: #FBEFC9;
  --warn-text: #6B4A07;
  --danger: #A12A22;
  --cta: #B8322A;
  --cta-ink: #FFFFFF;
  --heading: #1E4A3B;
  --price: #A12A22;
  --bar: #1E4A3B;
  --bar-ink: #F1F3EC;
  --bar-muted: #C9D3C8;
  --bar-active: #F2C14E;
  --bar-border: transparent;
  --sticker-bg: #E3A21A;
  --sticker-ink: #1B211D;
  --tag-bg: #FFFFFF;
  --tag-ink: #A12A22;
  --tag-size: .95rem;
  --tag-weight: 700;
  --new-size: 48px;
  --new-radius: 50%;
  --new-tilt: -10deg;
  --new-font-size: .95rem;
  --new-weight: 700;
  --tag-pad: 0 9px 0 13px;
  --tag-radius: 0;
  --tag-clip: polygon(8px 0, 100% 0, 100% 100%, 8px 100%, 0 50%);
  --tag-hole: block;
  --tag-tilt: -1.5deg;
  --tag-tilt-even: 1.2deg;
  --tag-shadow: drop-shadow(0 1px 0 rgb(27 33 29 / .3));
  --trencadis: block;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Federant", Georgia, serif;
  --font-hand: "Kalam", "Marker Felt", cursive;
  --display-weight: 400;
  --title-size: 1.6rem;
  --h2-size: 1.45rem;
  --hand-size: 1.05rem;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-chip: 4px;
  --shadow: none;
  color-scheme: light;
}

/* Nit: the same market after closing time. */
:root[data-theme="nit"] {
  --bg: #111714;
  --surface: #19211D;
  --surface-2: #222C27;
  --text: #ECEFE7;
  --muted: #A3ADA4;
  --border: #2E3A33;
  --accent: #8FC4A6;
  --accent-ink: #0F1A14;
  --accent-soft: #1F3329;
  --warn-bg: #3A2C10;
  --warn-text: #FCD99A;
  --danger: #F08A7E;
  --cta: #C8463A;
  --cta-ink: #FFFFFF;
  --heading: #BFDCC9;
  --price: #F2A196;
  --bar: #0D2219;
  --bar-ink: #ECEFE7;
  --bar-muted: #9DB3A6;
  --tag-bg: #26302B;
  --tag-ink: #F2A196;
  --tag-shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #111714;
    --surface: #19211D;
    --surface-2: #222C27;
    --text: #ECEFE7;
    --muted: #A3ADA4;
    --border: #2E3A33;
    --accent: #8FC4A6;
    --accent-ink: #0F1A14;
    --accent-soft: #1F3329;
    --warn-bg: #3A2C10;
    --warn-text: #FCD99A;
    --danger: #F08A7E;
    --cta: #C8463A;
    --cta-ink: #FFFFFF;
    --heading: #BFDCC9;
    --price: #F2A196;
    --bar: #0D2219;
    --bar-ink: #ECEFE7;
    --bar-muted: #9DB3A6;
    --tag-bg: #26302B;
    --tag-ink: #F2A196;
    --tag-shadow: none;
    color-scheme: dark;
  }
}

/* Clàssic: the original look (follows the phone's light/dark mode). */
:root[data-theme="classic"] {
  --bg: #fffaf5;
  --surface: #ffffff;
  --surface-2: #fff1e6;
  --text: #1f1712;
  --muted: #6f6259;
  --border: #eadfd6;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #ffedd5;
  --warn-bg: #fef3c7;
  --warn-text: #78350f;
  --danger: #b91c1c;
  --cta: #c2410c;
  --cta-ink: #ffffff;
  --heading: #1f1712;
  --price: #6f6259;
  --bar: #fffaf5;
  --bar-ink: #1f1712;
  --bar-muted: #6f6259;
  --bar-active: #c2410c;
  --bar-border: #eadfd6;
  --sticker-bg: #ffedd5;
  --sticker-ink: #c2410c;
  --tag-bg: #fff1e6;
  --tag-ink: #6f6259;
  --tag-size: .75rem;
  --tag-weight: 400;
  --new-size: auto;
  --new-radius: 99px;
  --new-tilt: 0deg;
  --new-font-size: .75rem;
  --new-weight: 600;
  --tag-pad: 1px 8px;
  --tag-radius: 99px;
  --tag-clip: none;
  --tag-hole: none;
  --tag-tilt: 0deg;
  --tag-tilt-even: 0deg;
  --tag-shadow: none;
  --trencadis: none;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
  --font-hand: var(--font-body);
  --display-weight: 650;
  --title-size: 1.15rem;
  --h2-size: 1.05rem;
  --hand-size: 1rem;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-chip: 99px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 4px 16px rgb(0 0 0 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="classic"] {
    --bg: #17120f;
    --surface: #211a16;
    --surface-2: #2b221d;
    --text: #f5ede6;
    --muted: #b3a59a;
    --border: #3a2f28;
    --accent: #f97316;
    --accent-ink: #1a0f08;
    --accent-soft: #3b2214;
    --warn-bg: #3a2c10;
    --warn-text: #fcd99a;
    --danger: #f87171;
    --cta: #f97316;
    --cta-ink: #1a0f08;
    --heading: #f5ede6;
    --price: #b3a59a;
    --bar: #17120f;
    --bar-ink: #f5ede6;
    --bar-muted: #b3a59a;
    --bar-active: #f97316;
    --bar-border: #3a2f28;
    --sticker-bg: #3b2214;
    --sticker-ink: #f97316;
    --tag-bg: #2b221d;
    --tag-ink: #b3a59a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

/* App shell: top bar, scrolling content, tab bar. Only <main> scrolls, so nothing relies on
   position: fixed at the bottom, which iOS home-screen apps can push off the screen. */
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-body);
  height: 100vh;
  height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: none; z-index: 5;
  background: var(--bar); color: var(--bar-ink);
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--bar-border);
}
/* Broken-tile mosaic under the top bar, like Gaudí's trencadís. */
.trencadis {
  display: var(--trencadis); flex: none; height: 22px;
  background: #CFCBBE url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='390' height='22' viewBox='0 0 390 22'%3E%3Cg stroke='%23CFCBBE' stroke-width='2' stroke-linejoin='round'%3E%3Cpolygon points='0,-1 29,0 23,8 0,9' fill='%23D9C27A'/%3E%3Cpolygon points='0,9 23,8 26,22 3,22' fill='%232A5DA8'/%3E%3Cpolygon points='26,0 45,1 47,12 26,8' fill='%23D9C27A'/%3E%3Cpolygon points='26,8 47,12 46,22 25,22' fill='%23E3A21A'/%3E%3Cpolygon points='45,1 71,2 77,11 47,12' fill='%23FFFFFF'/%3E%3Cpolygon points='47,12 77,11 73,22 43,22' fill='%232A5DA8'/%3E%3Cpolygon points='78,2 94,0 88,8 70,11' fill='%236F8A2E'/%3E%3Cpolygon points='70,11 88,8 95,22 77,22' fill='%232E7D6B'/%3E%3Cpolygon points='94,0 109,-1 109,14 88,8' fill='%23E07A2E'/%3E%3Cpolygon points='88,8 109,14 112,22 91,22' fill='%23B8322A'/%3E%3Cpolygon points='106,-1 146,1 138,12 112,14' fill='%23E07A2E'/%3E%3Cpolygon points='112,14 138,12 139,22 113,22' fill='%23E3A21A'/%3E%3Cpolygon points='143,1 159,0 163,8 141,12' fill='%23E07A2E'/%3E%3Cpolygon points='141,12 163,8 162,22 140,22' fill='%236F8A2E'/%3E%3Cpolygon points='157,0 185,-1 191,9 165,8' fill='%23D9C27A'/%3E%3Cpolygon points='165,8 191,9 184,22 158,22' fill='%23E07A2E'/%3E%3Cpolygon points='189,-1 223,0 221,13 187,9' fill='%232E7D6B'/%3E%3Cpolygon points='187,9 221,13 223,22 189,22' fill='%232A5DA8'/%3E%3Cpolygon points='225,0 242,1 236,13 219,13' fill='%23B8322A'/%3E%3Cpolygon points='219,13 236,13 242,22 225,22' fill='%23D9C27A'/%3E%3Cpolygon points='236,1 271,-1 271,12 242,13' fill='%236F8A2E'/%3E%3Cpolygon points='242,13 271,12 268,22 239,22' fill='%232E7D6B'/%3E%3Cpolygon points='268,-1 289,-1 297,8 274,12' fill='%23FFFFFF'/%3E%3Cpolygon points='274,12 297,8 290,22 267,22' fill='%232E7D6B'/%3E%3Cpolygon points='293,-1 313,-1 307,12 293,8' fill='%232A5DA8'/%3E%3Cpolygon points='293,8 307,12 310,22 296,22' fill='%232E7D6B'/%3E%3Cpolygon points='312,-1 329,0 327,12 308,12' fill='%23B8322A'/%3E%3Cpolygon points='308,12 327,12 330,22 311,22' fill='%23E07A2E'/%3E%3Cpolygon points='329,0 355,2 359,11 327,12' fill='%23FFFFFF'/%3E%3Cpolygon points='327,12 359,11 358,22 326,22' fill='%23B8322A'/%3E%3Cpolygon points='360,2 382,2 390,8 354,11' fill='%232A5DA8'/%3E%3Cpolygon points='354,11 390,8 389,22 353,22' fill='%23D9C27A'/%3E%3Cpolygon points='386,2 390,1 390,9 386,8' fill='%23E3A21A'/%3E%3Cpolygon points='386,8 390,9 390,22 386,22' fill='%232E7D6B'/%3E%3C/g%3E%3C/svg%3E") repeat-x left center / 390px 22px;
}
.topbar-inner { max-width: 608px; margin: 0 auto; display: flex; align-items: center; gap: 4px; min-height: 28px; }
.topbar h1 { margin: 0; flex: 1; min-width: 0; font: var(--display-weight) var(--title-size)/1.1 var(--font-display);
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.back {
  display: inline-flex; align-items: center; gap: 2px; flex: none;
  margin-left: -6px; padding: 4px 8px 4px 2px; border-radius: 8px;
  color: var(--bar-active); text-decoration: none; font-weight: 600;
}
.back[hidden] { display: none; }
.back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

main {
  flex: 1; min-height: 0; width: 100%;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 16px max(16px, calc((100% - 608px) / 2)) 24px;
}

h2 { font: var(--display-weight) var(--h2-size)/1.2 var(--font-display); color: var(--heading); margin: 24px 0 8px; }
h2:first-child { margin-top: 0; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: .9rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }

input[type="text"], input[type="url"], input[type="number"], textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
textarea { min-height: 140px; resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
/* Buttons never shrink below their label; in wrapping rows they move to the next line instead. */
.row > button.grow, .row > .btn.grow { min-width: max-content; }
.row.wrap { flex-wrap: wrap; align-items: stretch; }
.row.wrap > button, .row.wrap > .btn { min-height: 44px; }
.stack > * + * { margin-top: 12px; }

button, .btn {
  font: inherit; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
button.primary { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
button.danger { color: var(--danger); }
button.link { background: none; border: none; padding: 4px 0; color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
button.full { width: 100%; }
.icon-btn { padding: 6px 10px; min-width: 40px; }

.warning {
  background: var(--warn-bg); color: var(--warn-text);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: .9rem; margin-bottom: 12px;
}
.warning ul { margin: 0; padding-left: 18px; }

/* Recipe list */
.recipe-list { list-style: none; margin: 0; padding: 0; }
.recipe-list li + li { margin-top: 10px; }
.recipe-item {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; color: inherit; text-decoration: none; box-shadow: var(--shadow);
}
.recipe-item .title { font: var(--display-weight) calc(var(--h2-size) * .95)/1.15 var(--font-display); color: var(--heading); }
.recipe-item .meta { color: var(--muted); font-size: .85rem; }
.recipe-item .grow { flex: 1; min-width: 0; }
/* "New" is a round saffron sticker in Mercat and Nit, a pill in Classic. */
.pill.new {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: var(--new-size); height: var(--new-size); border-radius: var(--new-radius);
  font: var(--new-weight) var(--new-font-size) var(--font-hand); transform: rotate(var(--new-tilt));
}
.pill {
  font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-chip);
  background: var(--sticker-bg); color: var(--sticker-ink); white-space: nowrap;
}

/* Recipe detail */
.ingredients, .steps { margin: 0; padding: 0; }
.ingredients { list-style: none; }
.ingredients li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.ingredients li:last-child { border-bottom: none; }
.ingredients .group { font-weight: 650; color: var(--muted); font-size: .85rem; padding-top: 14px; border-bottom: none; }
.steps { padding-left: 22px; }
.steps li { margin-bottom: 10px; }
.steps li::marker { color: var(--cta); font-family: var(--font-display); font-weight: var(--display-weight); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper output { min-width: 2.5ch; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }

.edit-step { display: flex; gap: 8px; align-items: flex-start; }
.edit-step textarea { min-height: 64px; }
.edit-step .num { font-weight: 700; color: var(--accent); padding-top: 10px; min-width: 1.5ch; }

/* Shopping */
.shop-items { list-style: none; margin: 0; padding: 0; }
.shop-items li { border-bottom: 1px solid var(--border); }
.shop-items li:last-child { border-bottom: none; }
.shop-items label {
  display: flex; gap: 12px; align-items: center; margin: 0; padding: 12px 0;
  font-size: 1rem; font-weight: 400; color: var(--text); cursor: pointer;
}
.shop-items input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.shop-items .amount { color: var(--price); font: var(--tag-weight) var(--hand-size) var(--font-hand); font-variant-numeric: tabular-nums; margin-left: auto; text-align: right; }
.shop-items .done .name, .shop-items .done .amount { text-decoration: line-through; color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty svg { width: 48px; height: 48px; stroke: var(--muted); fill: none; stroke-width: 1.5; margin-bottom: 8px; }

/* Bottom tabs */
.tabs {
  flex: none; z-index: 10;
  display: flex; justify-content: center;
  background: var(--bar); border-top: 1px solid var(--bar-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  position: relative; flex: 1; max-width: 200px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; color: var(--bar-muted); text-decoration: none; font-size: .75rem; font-weight: 600;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.active { color: var(--bar-active); }
.badge {
  position: absolute; top: 4px; left: calc(50% + 6px);
  background: var(--sticker-bg); color: var(--sticker-ink); font-size: .7rem; font-weight: 700; line-height: 18px;
  min-width: 18px; padding: 0 5px; border-radius: 9px; text-align: center;
}

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 20;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: .9rem; max-width: calc(100% - 32px);
}

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
details pre { white-space: pre-wrap; font: inherit; font-size: .9rem; color: var(--muted); }
.ingredients .grow, .edit-step .grow { flex: 1; min-width: 0; }

/* ---------- cook mode ---------- */
body.cooking .tabs, body.cooking .topbar { display: none; }
body.cooking main { padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: 0; }

.cook { display: flex; flex-direction: column; gap: 12px; min-height: 100%; }
.cook-loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 64px 16px; color: var(--muted); }
.cook-title { font-weight: 650; line-height: 1.25; }
.cook-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.cook-progress span { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }

.cook-panel { flex: 1; }
.cook-heading { margin: 0 0 4px; font-size: 1.4rem; }
.cook-step-label { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .85rem; }
.cook-text { font-size: 1.35rem; line-height: 1.45; margin: 8px 0 16px; }
.cook-need { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.cook-need ul { margin: 4px 0 0; padding-left: 18px; }
.cook-tip { color: var(--muted); margin: 12px 0 0; }

.cook-timer {
  display: flex; gap: 12px; align-items: center;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px;
}
.cook-clock { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.cook-timer.running { border-color: var(--accent); background: var(--accent-soft); }
.cook-timer.done, .timer-chip.done { border-color: var(--danger); animation: timer-pulse 1s ease-in-out infinite; }
.cook-timer.done .cook-clock, .timer-chip.done b { color: var(--danger); }

.timer-tray { display: flex; flex-direction: column; gap: 6px; }
.timer-chip {
  display: flex; gap: 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px 4px 14px;
}
.timer-chip .link { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-chip b { font-variant-numeric: tabular-nums; }
.timer-chip button:not(.link) { padding: 4px 12px; }

.cook-nav { position: sticky; bottom: 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); background: var(--bg); }
.cook-nav button { padding-top: 14px; padding-bottom: 14px; }
.cook-done { text-align: center; padding: 24px 0; }

@keyframes timer-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .cook-timer.done, .timer-chip.done { animation: none; } }

/* ---------- list filters, tags, swipe actions ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 12px; border-radius: var(--radius-chip); font-size: .85rem; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* Tags look like the price cards on a market stall (in Mercat and Nit). */
.tags { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 6px; filter: var(--tag-shadow); }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font: var(--tag-weight) var(--tag-size)/1.5 var(--font-hand); padding: var(--tag-pad); border-radius: var(--tag-radius);
  background: var(--tag-bg); color: var(--tag-ink); clip-path: var(--tag-clip); transform: rotate(var(--tag-tilt));
}
.tag:nth-child(even) { transform: rotate(var(--tag-tilt-even)); }
.tag::before { content: ""; display: var(--tag-hole); width: 4px; height: 4px; border-radius: 50%; background: var(--border); }

.swipe { position: relative; border-radius: var(--radius); overflow: hidden; }
.swipe .recipe-item { position: relative; z-index: 1; transition: transform .2s ease; touch-action: pan-y; box-shadow: none; }
.swipe-actions { position: absolute; top: 0; right: 0; bottom: 0; display: flex; }
.swipe-actions button { border: none; border-radius: 0; width: 76px; padding: 0 4px; font-size: .85rem; white-space: normal; }
.swipe-actions [data-act="archive"] { background: var(--surface-2); }
.swipe-actions [data-act="tag"] { background: var(--accent-soft); color: var(--accent); }
.swipe-actions [data-act="delete"] { background: var(--danger); color: #fff; }
.swipe-hint { text-align: center; margin-top: 12px; font-size: .8rem; }
.mouse-only { display: none; }
@media (hover: hover) and (pointer: fine) { .touch-only { display: none; } .mouse-only { display: inline; } }
@media (prefers-reduced-motion: reduce) { .swipe .recipe-item { transition: none; } }

/* ---------- units switch ---------- */
.segmented { display: flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; margin-bottom: 12px; }
.card .segmented { margin-bottom: 0; }
.segmented button { flex: 1; border: none; background: none; padding: 6px 8px; border-radius: calc(var(--radius-sm) - 2px); font-size: .9rem; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- accounts ---------- */
body.signed-out .tabs { display: none; }
#auth-form { max-width: 420px; margin: 24px auto 0; }
#auth-form h2 { margin: 0; }
input[type="password"] {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
}
code { font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
