:root {
  --bg: #1a2027;
  --sidebar: #1e252c;
  --card: #222a32;
  --panel: #2a333c;
  --panel-hover: #313b45;
  --border: #323d48;
  --text: #f2f5f7;
  --text-2: #c9d2d9;
  --muted: #8d9aa6;
  --accent: #6dd3f5;
  --accent-hover: #8adcf8;
  --accent-ink: #0f2530;
  --accent-soft: rgba(109, 211, 245, 0.14);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.13);
  --danger: #f87171;
  --danger-hover: #fb8a8a;
  --danger-ink: #2a0b0b;
  --warn: #f5c26b;
  --warn-soft: rgba(245, 194, 107, 0.12);
  --warn-text: #f3d9a8;
  --btn-bg: rgba(42, 51, 60, 0.85);
  --border-strong: #415060;
  --input-bg: rgba(20, 26, 32, 0.75);
  --hairline: rgba(255, 255, 255, 0.06);
  --checkbox: #4a5866;
  --accent-line: rgba(109, 211, 245, 0.5);
  --overlay: rgba(20, 26, 32, 0.72);
  --overlay-line: rgba(255, 255, 255, 0.12);
  --overlay-text: #e8edf1;
  --bar-bg: #2a333c;
  --bar-border: #3c4955;
  --shadow: rgba(0, 0, 0, 0.4);
  --backdrop: rgba(8, 11, 14, 0.6);
  --hero-bg: linear-gradient(120deg, #222b34 0%, #1d2a33 100%);
  --hero-fade: 34, 42, 50; /* card colour as r, g, b for the photo fade */
  --hero-photo-opacity: 0.55;
  --thumb-bg: linear-gradient(135deg, #2c3a45, #23303a);
  --thumb-icon: #4f6070;
  --toast-bg: #f2f5f7;
  --toast-text: #12181d;
  --glow: none; /* neon */
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: var(--font-body);
  --radius-lg: 18px;
  --radius: 12px;
  --radius-sm: 9px;
  color-scheme: dark;
}

/* ---------- Themes (chosen on the Account page) ---------- */

/* Neon: electric pink and cyan on a deep night sky */
:root[data-theme="neon"] {
  --bg: #0a0614;
  --sidebar: #0f0920;
  --card: #140c2a;
  --panel: #1d1240;
  --panel-hover: #281a55;
  --border: #33206a;
  --text: #fbf7ff;
  --text-2: #dccfff;
  --muted: #9a89cf;
  --accent: #ff3ad2;
  --accent-hover: #ff6fe0;
  --accent-ink: #1a0016;
  --accent-soft: rgba(255, 58, 210, 0.16);
  --green: #3dffb4;
  --green-soft: rgba(61, 255, 180, 0.14);
  --danger: #ff5c7a;
  --danger-hover: #ff8098;
  --danger-ink: #24000a;
  --warn: #ffd23d;
  --warn-soft: rgba(255, 210, 61, 0.12);
  --warn-text: #ffe68f;
  --btn-bg: rgba(29, 18, 64, 0.85);
  --border-strong: #5a3aa8;
  --input-bg: rgba(8, 4, 20, 0.8);
  --hairline: rgba(160, 120, 255, 0.12);
  --checkbox: #5a3aa8;
  --accent-line: rgba(255, 58, 210, 0.6);
  --overlay: rgba(10, 6, 20, 0.7);
  --bar-bg: #1d1240;
  --bar-border: #5a3aa8;
  --shadow: rgba(255, 58, 210, 0.18);
  --backdrop: rgba(5, 2, 12, 0.7);
  --hero-bg:
    radial-gradient(circle at 12% 0%, rgba(255, 58, 210, 0.32), transparent 45%),
    radial-gradient(circle at 70% 120%, rgba(34, 238, 255, 0.28), transparent 50%),
    linear-gradient(120deg, #170c33 0%, #0e0824 100%);
  --hero-fade: 20, 12, 42;
  --hero-photo-opacity: 0.5;
  --thumb-bg: linear-gradient(135deg, #2a1660, #10304a);
  --thumb-icon: #8a6bff;
  --toast-bg: #22eeff;
  --toast-text: #04131a;
  --glow: 0 0 18px rgba(255, 58, 210, 0.55), 0 0 42px rgba(255, 58, 210, 0.25);
  --font-display: 'Space Grotesk', var(--font-body);
}
:root[data-theme="neon"] body {
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(34, 238, 255, 0.08), transparent 60%),
    radial-gradient(800px 600px at 0% 100%, rgba(255, 58, 210, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-theme="neon"] .hero h1 {
  background: linear-gradient(90deg, #ffffff 0%, #ff8ae6 45%, #5cf6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}
:root[data-theme="neon"] .btn-primary:not(.btn-saved) { background: linear-gradient(95deg, #ff3ad2, #a64dff); color: #fff; }
:root[data-theme="neon"] .btn-primary:not(.btn-saved):hover { background: linear-gradient(95deg, #ff6fe0, #b86dff); }
:root[data-theme="neon"] .nav-item.active { box-shadow: inset 3px 0 0 #22eeff; }
:root[data-theme="neon"] .nav-item.active svg { color: #22eeff; filter: drop-shadow(0 0 6px rgba(34, 238, 255, 0.8)); }
:root[data-theme="neon"] .card,
:root[data-theme="neon"] .hero,
:root[data-theme="neon"] .recipe-card { box-shadow: 0 0 0 1px rgba(166, 77, 255, 0.15), 0 10px 30px rgba(10, 0, 30, 0.5); }
:root[data-theme="neon"] .section-label,
:root[data-theme="neon"] .steps .num { color: #22eeff; }
:root[data-theme="neon"] .steps .num { background: rgba(34, 238, 255, 0.12); box-shadow: 0 0 10px rgba(34, 238, 255, 0.35); }
:root[data-theme="neon"] .status-dot { background: #3dffb4; box-shadow: 0 0 10px #3dffb4; }

/* Daylight: bright, clean and easy to read in a sunny kitchen */
:root[data-theme="daylight"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --sidebar: #ffffff;
  --card: #ffffff;
  --panel: #f2f5f8;
  --panel-hover: #e8edf2;
  --border: #e1e6ec;
  --text: #16202a;
  --text-2: #3a4652;
  --muted: #6b7682;
  --accent: #0b7fc0;
  --accent-hover: #096ca3;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 127, 192, 0.1);
  --green: #15803d;
  --green-soft: rgba(21, 128, 61, 0.1);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-ink: #ffffff;
  --warn: #b45309;
  --warn-soft: rgba(217, 119, 6, 0.1);
  --warn-text: #92400e;
  --btn-bg: #ffffff;
  --border-strong: #c5ced8;
  --input-bg: #ffffff;
  --hairline: rgba(15, 23, 42, 0.07);
  --checkbox: #b4bec9;
  --accent-line: rgba(11, 127, 192, 0.45);
  --overlay: rgba(255, 255, 255, 0.85);
  --overlay-line: rgba(15, 23, 42, 0.1);
  --overlay-text: #16202a;
  --bar-bg: #ffffff;
  --bar-border: #d6dde5;
  --shadow: rgba(15, 23, 42, 0.12);
  --backdrop: rgba(15, 23, 42, 0.35);
  --hero-bg: linear-gradient(120deg, #ffffff 0%, #eef4fa 100%);
  --hero-fade: 255, 255, 255;
  --hero-photo-opacity: 0.9;
  --thumb-bg: linear-gradient(135deg, #e7edf3, #dbe4ec);
  --thumb-icon: #9aa8b6;
  --toast-bg: #16202a;
  --toast-text: #ffffff;
}

/* Farmhouse: a vintage recipe box. Paper cards, red gingham, typewriter notes,
   tomato red and garden sage. */
:root[data-theme="farmhouse"] {
  color-scheme: light;
  --bg: #f4ead6;
  --sidebar: #f6efe0;
  --card: #fffcf3;
  --panel: #f7efdf;
  --panel-hover: #f0e4cc;
  --border: #e3d3b4;
  --text: #2f2a24;
  --text-2: #50463a;
  --muted: #85776a;
  --accent: #b8382a;
  --accent-hover: #9d2d21;
  --accent-ink: #fffcf3;
  --accent-soft: rgba(184, 56, 42, 0.09);
  --green: #5f7f4a;
  --green-soft: rgba(95, 127, 74, 0.14);
  --danger: #a3271b;
  --danger-hover: #861f15;
  --danger-ink: #fffcf3;
  --warn: #9a6a12;
  --warn-soft: rgba(196, 140, 30, 0.13);
  --warn-text: #7a520c;
  --btn-bg: #fffcf3;
  --border-strong: #c9b48d;
  --input-bg: #fffcf3;
  --hairline: rgba(70, 110, 170, 0.22); /* the blue ruled lines of an index card */
  --checkbox: #a08f73;
  --accent-line: rgba(184, 56, 42, 0.45);
  --overlay: rgba(255, 252, 243, 0.9);
  --overlay-line: rgba(47, 42, 36, 0.15);
  --overlay-text: #2f2a24;
  --bar-bg: #fffcf3;
  --bar-border: #d9c6a3;
  --shadow: rgba(90, 60, 25, 0.16);
  --backdrop: rgba(47, 42, 36, 0.4);
  --hero-bg: #fffcf3;
  --hero-fade: 255, 252, 243;
  --hero-photo-opacity: 0.95;
  --thumb-bg: linear-gradient(135deg, #f1e3c6, #e7d3ad);
  --thumb-icon: #b39b72;
  --toast-bg: #2f2a24;
  --toast-text: #fffcf3;
  --font-display: 'Fraunces', Georgia, serif;
  --font-note: 'Special Elite', 'Courier New', monospace;
  --radius-lg: 6px;
  --radius: 5px;
  --radius-sm: 4px;
  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .15 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --gingham:
    linear-gradient(90deg, rgba(184, 56, 42, 0.5) 50%, transparent 50%),
    linear-gradient(rgba(184, 56, 42, 0.5) 50%, transparent 50%);
}
:root[data-theme="farmhouse"] body { background: var(--paper), var(--bg); }

/* Paper index cards with a soft drop shadow */
:root[data-theme="farmhouse"] .card,
:root[data-theme="farmhouse"] .hero,
:root[data-theme="farmhouse"] .recipe-card,
:root[data-theme="farmhouse"] .login-card {
  background-image: var(--paper);
  box-shadow: 0 1px 0 rgba(90, 60, 25, 0.08), 0 8px 22px rgba(90, 60, 25, 0.1);
}
:root[data-theme="farmhouse"] .recipe-card:hover { transform: translateY(-3px) rotate(-0.4deg); }

/* Red gingham ribbon across the top of the big cards and the sign-in card */
:root[data-theme="farmhouse"] .hero,
:root[data-theme="farmhouse"] .login-card { padding-top: 52px; }
:root[data-theme="farmhouse"] .hero::before,
:root[data-theme="farmhouse"] .login-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 14px;
  background-color: #fffcf3;
  background-image: var(--gingham);
  background-size: 7px 7px;
  z-index: 2;
}
:root[data-theme="farmhouse"] .login-card { position: relative; overflow: hidden; }

/* Gingham tab behind the logo, kraft-paper sidebar edge */
:root[data-theme="farmhouse"] .sidebar { border-right: 1px dashed var(--border-strong); background-image: var(--paper); }
:root[data-theme="farmhouse"] .brand-logo {
  padding: 3px;
  background-color: #fffcf3;
  background-image: var(--gingham);
  background-size: 8px 8px;
  border-radius: 6px;
}

/* Typewriter notes */
:root[data-theme="farmhouse"] .section-label,
:root[data-theme="farmhouse"] .steps-hint,
:root[data-theme="farmhouse"] .pill,
:root[data-theme="farmhouse"] .site-name,
:root[data-theme="farmhouse"] .card-foot,
:root[data-theme="farmhouse"] .scale-hint,
:root[data-theme="farmhouse"] .request-meta,
:root[data-theme="farmhouse"] .feed-item small,
:root[data-theme="farmhouse"] .feed-item .when,
:root[data-theme="farmhouse"] .hero-sub,
:root[data-theme="farmhouse"] .page-head p,
:root[data-theme="farmhouse"] .steps .num,
:root[data-theme="farmhouse"] .btn-primary { font-family: var(--font-note); font-weight: 400; }
:root[data-theme="farmhouse"] .section-label { letter-spacing: 0.08em; text-transform: none; font-size: 14px; color: var(--accent); }
:root[data-theme="farmhouse"] .btn-primary { letter-spacing: 0.06em; font-size: 17px; }
:root[data-theme="farmhouse"] .pill { border: 1.5px solid currentColor; background: transparent; border-radius: 4px; transform: rotate(-1.5deg); }

/* Headings get a double rule underneath, like a printed recipe card */
:root[data-theme="farmhouse"] .card-head { padding-bottom: 10px; border-bottom: 3px double rgba(184, 56, 42, 0.55); }
:root[data-theme="farmhouse"] .card-head h2 { font-size: 20px; font-weight: 700; }
:root[data-theme="farmhouse"] .hero h1,
:root[data-theme="farmhouse"] .page-head h1 { font-weight: 700; letter-spacing: -0.015em; }

/* The ingredients card is an index card: blue ruled lines and a red margin */
:root[data-theme="farmhouse"] .ingredients-card { position: relative; padding-left: 44px; }
:root[data-theme="farmhouse"] .ingredients-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 28px;
  width: 1.5px;
  background: rgba(184, 56, 42, 0.45);
}
:root[data-theme="farmhouse"] .ingredients li { border-bottom: 1px solid var(--hairline); }
:root[data-theme="farmhouse"] .ingredients li:last-child { border-bottom: 1px solid var(--hairline); }
:root[data-theme="farmhouse"] .ingredients label { font-size: 15.5px; }

/* Step numbers inked in red */
:root[data-theme="farmhouse"] .steps .num { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); font-size: 15px; }
:root[data-theme="farmhouse"] .steps .done .num { border-color: var(--green); color: var(--green); }
:root[data-theme="farmhouse"] .scale button[aria-pressed="true"] { font-family: var(--font-note); }

/* Misty Mountain (id "forest"): fog, slate and soft white, with layered
   mountain ridges in the header. */
:root[data-theme="forest"] {
  color-scheme: light;
  --bg: #e3eaec;
  --sidebar: #2c3b43;
  --card: rgba(250, 252, 252, 0.86);
  --panel: #eef3f4;
  --panel-hover: #e2eaec;
  --border: #d3dee1;
  --text: #22313a;
  --text-2: #415560;
  --muted: #6f838c;
  --accent: #2f7068;
  --accent-hover: #255c55;
  --accent-ink: #f4fbfa;
  --accent-soft: rgba(47, 112, 104, 0.11);
  --green: #3b7d5a;
  --green-soft: rgba(59, 125, 90, 0.12);
  --danger: #b4423a;
  --danger-hover: #963630;
  --danger-ink: #ffffff;
  --warn: #9a6b20;
  --warn-soft: rgba(176, 128, 50, 0.12);
  --warn-text: #7c5517;
  --btn-bg: rgba(255, 255, 255, 0.7);
  --border-strong: #b7c6cb;
  --input-bg: rgba(255, 255, 255, 0.85);
  --hairline: rgba(34, 49, 58, 0.08);
  --checkbox: #9fb2b9;
  --accent-line: rgba(47, 112, 104, 0.45);
  --overlay: rgba(247, 250, 250, 0.85);
  --overlay-line: rgba(34, 49, 58, 0.12);
  --overlay-text: #22313a;
  --bar-bg: #f7fafa;
  --bar-border: #cbd8dc;
  --shadow: rgba(34, 49, 58, 0.14);
  --backdrop: rgba(34, 49, 58, 0.35);
  --hero-bg: linear-gradient(180deg, #f4f8f9 0%, #e1eaec 100%);
  --hero-fade: 244, 248, 249;
  --hero-photo-opacity: 0.85;
  --thumb-bg: linear-gradient(180deg, #dfe8ea, #c9d6da);
  --thumb-icon: #8ea3aa;
  --toast-bg: #2c3b43;
  --toast-text: #f4f8f9;
  --font-display: 'Josefin Sans', var(--font-body);
  --ridges: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 220' preserveAspectRatio='none'%3E%3Cpath d='M0 120 L120 70 L210 105 L330 40 L450 100 L560 60 L680 115 L800 50 L930 95 L1050 55 L1200 100 V220 H0Z' fill='%23d4e0e3' fill-opacity='.7'/%3E%3Cpath d='M0 160 L90 125 L200 150 L300 100 L420 145 L540 110 L640 150 L760 105 L880 145 L1000 115 L1110 140 L1200 120 V220 H0Z' fill='%23a9bec3' fill-opacity='.75'/%3E%3Cpath d='M0 195 L140 160 L260 185 L380 150 L520 190 L650 160 L790 192 L920 158 L1060 188 L1200 165 V220 H0Z' fill='%236a8a93' fill-opacity='.85'/%3E%3C/svg%3E");
}
/* Soft fog drifting across the page */
:root[data-theme="forest"] body {
  background:
    radial-gradient(1200px 380px at 20% 0%, rgba(255, 255, 255, 0.85), transparent 70%),
    radial-gradient(900px 300px at 90% 30%, rgba(255, 255, 255, 0.6), transparent 70%),
    linear-gradient(180deg, #e9eff1 0%, #dbe5e7 100%);
  background-attachment: fixed;
}
/* Frosted-glass cards */
:root[data-theme="forest"] .card,
:root[data-theme="forest"] .recipe-card {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(34, 49, 58, 0.07);
}
:root[data-theme="forest"] .recipe-card { background: rgba(250, 252, 252, 0.92); }

/* Mountain ridges along the bottom of the header, above the photo, below the text */
:root[data-theme="forest"] .hero { padding-bottom: 104px; }
:root[data-theme="forest"] .hero::before {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 92px;
  background: var(--ridges) bottom / 100% 100% no-repeat;
  pointer-events: none;
  z-index: 1;
}
:root[data-theme="forest"] .login-card { position: relative; overflow: hidden; padding-bottom: 70px; }
:root[data-theme="forest"] .login-card::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 60px;
  background: var(--ridges) bottom / 100% 100% no-repeat;
}
:root[data-theme="forest"] .login { background: linear-gradient(180deg, #eef3f4, #d3dfe2); }

/* Slate sidebar, like a mountain at dusk */
:root[data-theme="forest"] .sidebar {
  --text: #eef3f4;
  --text-2: #c3d1d6;
  --muted: #8ea4ac;
  --panel: rgba(255, 255, 255, 0.07);
  --panel-hover: rgba(255, 255, 255, 0.13);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.24);
  --accent: #8fd3c8;
  --accent-soft: rgba(143, 211, 200, 0.16);
  color: var(--text);
  border-right: 0;
  background: linear-gradient(180deg, #2c3b43 0%, #3a4f58 100%);
}

/* Calm, airy type */
:root[data-theme="forest"] .hero h1,
:root[data-theme="forest"] .page-head h1 { font-weight: 600; letter-spacing: 0.01em; }
:root[data-theme="forest"] .card-head h2 { font-weight: 600; letter-spacing: 0.02em; font-size: 18px; }
:root[data-theme="forest"] .section-label { letter-spacing: 0.14em; }
:root[data-theme="forest"] .btn-primary { letter-spacing: 0.1em; font-family: var(--font-display); font-weight: 700; }

/* Theme picker previews */
.tp-farmhouse .tp-side {
  background-image: linear-gradient(90deg, rgba(184, 56, 42, 0.5) 50%, transparent 50%), linear-gradient(rgba(184, 56, 42, 0.5) 50%, transparent 50%) !important;
  background-size: 8px 8px !important;
}
.tp-forest .tp-body {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 40' preserveAspectRatio='none'%3E%3Cpath d='M0 25 L20 12 L38 22 L58 8 L80 22 L100 12 L120 20 V40 H0Z' fill='%2394adb3'/%3E%3Cpath d='M0 34 L25 24 L50 33 L75 22 L100 32 L120 26 V40 H0Z' fill='%23557680'/%3E%3C/svg%3E") bottom / 100% 45% no-repeat;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- App shell ---------- */

.app {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
  align-content: start;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px 20px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  font-weight: 800;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.brand-logo { border-radius: 8px; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--panel-hover); color: var(--text); }
.nav-item.active svg { color: var(--accent); }

.nav-count {
  margin-left: auto;
  min-width: 24px;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.nav-item.active .nav-count { background: var(--accent-soft); color: var(--accent); }
.nav-count:empty { display: none; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.sidebar-foot .nav-item { width: 100%; background: none; border: 0; cursor: pointer; font-size: 14px; }
.sidebar-foot .nav-item:hover { background: var(--panel); }

.status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.status-card strong { display: block; font-size: 13px; }
.status-card small { display: block; color: var(--muted); font-size: 11.5px; }

.status-dot {
  width: 9px; height: 9px; flex: none;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.main {
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  outline: none;
  max-width: 1280px;
  width: 100%;
}

/* ---------- Building blocks ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h2 { margin: 0; font-size: 17px; font-weight: 800; }

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px 14px;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--green-soft);
  color: var(--green);
}
.pill svg { width: 14px; height: 14px; stroke-width: 2.4; }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-muted { background: transparent; color: var(--muted); padding-left: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--panel-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  height: 56px;
  padding: 0 34px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:not(:disabled):not(.btn-saved) { box-shadow: var(--glow); }
.btn-primary:disabled { opacity: 0.7; cursor: progress; }

.btn-saved { background: var(--green-soft); color: var(--green); cursor: default; }
.btn-saved:hover { background: var(--green-soft); }

.btn-danger:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.5); }

.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-error { color: var(--danger); font-weight: 600; font-size: 14px; margin: 10px 0 0; min-height: 1em; }
.form-error:empty { display: none; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  padding: 40px 36px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 14px;
  background: var(--hero-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.hero-bg {
  position: absolute;
  inset: 0 0 0 auto;
  width: 68%;
  height: 100%;
  object-fit: cover;
  opacity: var(--hero-photo-opacity);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 45%);
  mask-image: linear-gradient(to right, transparent 0%, #000 45%);
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(var(--hero-fade), 0.95) 0%, rgba(var(--hero-fade), 0.6) 45%, rgba(var(--hero-fade), 0.1) 100%);
  pointer-events: none;
}
.hero > *:not(.hero-bg) { position: relative; z-index: 1; }

.hero h1, .page-head h1, .login-card h1, .card-head h2, .dialog h2 { font-family: var(--font-display); }

.hero h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.01em;
  max-width: 720px;
}

.hero-sub {
  margin: 0;
  max-width: 620px;
  color: var(--text-2);
  font-size: 15.5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-btn.subtle { color: var(--muted); font-weight: 600; }
.link-btn.subtle:hover { color: var(--accent); }

/* ---------- Paste a recipe ---------- */

.paste-card h2 { display: flex; align-items: center; gap: 8px; }
.paste-card h2 svg { color: var(--accent); width: 19px; height: 19px; }
.text-hint.paste-reason { margin: -2px 0 12px; max-width: none; }
.paste-help { margin: -4px 0 14px; color: var(--text-2); font-size: 14px; max-width: 760px; }
.paste-card .notes-input { min-height: 200px; }
.paste-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.paste-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.paste-fields label em { color: var(--muted); font-weight: 600; font-style: normal; margin-left: 4px; }
.paste-fields input {
  height: 46px;
  padding: 0 14px;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 15px;
}
.paste-fields input::placeholder { color: var(--muted); }
.paste-fields input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.paste-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 16px; }
.paste-source { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }

.text-hint {
  margin: 0;
  max-width: 620px;
  padding: 8px 12px;
  border-left: 3px solid var(--warn);
  border-radius: 6px;
  background: var(--warn-soft);
  color: var(--warn-text);
  font-size: 13.5px;
}

.hero-actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.hero-actions .divider { width: 1px; height: 34px; background: var(--border); margin: 0 6px; }

.url-form { width: 100%; display: flex; gap: 12px; margin-top: 8px; max-width: 760px; flex-wrap: wrap; }

.url-input {
  flex: 1 1 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.url-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.url-input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 15.5px;
}
.url-input input::placeholder { color: var(--muted); }

/* ---------- Two-column dashboard rows ---------- */

.row {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}
.stack { display: flex; flex-direction: column; gap: 20px; }

/* "What's new"-style list */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.feed-item:hover { background: var(--panel); }
.feed-item .thumb { width: 56px; height: 56px; border-radius: 10px; }
.feed-item strong { display: block; font-size: 14.5px; }
.feed-item small { display: block; color: var(--muted); font-size: 12px; }
.feed-item .when { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.empty { color: var(--muted); padding: 8px 0 4px; }
.empty strong { display: block; color: var(--text-2); margin-bottom: 2px; }

/* "Your setup"-style key/value rows */
.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 14.5px;
  font-weight: 800;
}
.panel-title svg { color: var(--accent); width: 18px; height: 18px; }

.kv { margin: 0; display: grid; grid-template-columns: 1fr auto; row-gap: 6px; column-gap: 12px; font-size: 13.5px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 800; text-align: right; }

.panel-link {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 800;
  font-size: 14px;
  transition: background 0.15s;
}
.panel-link:hover { background: var(--panel-hover); }
.panel-link svg:first-child { color: var(--accent); }
.panel-link .chev { margin-left: auto; color: var(--muted); }

.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.steps-hint { color: var(--muted); font-size: 12.5px; font-weight: 600; }

/* ---------- Recipe guide ---------- */

.ingredients { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ingredients li { border-bottom: 1px solid var(--hairline); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients label {
  display: flex;
  gap: 12px;
  padding: 9px 2px;
  cursor: pointer;
  font-size: 14.5px;
  color: var(--text);
}
.ingredients input { position: absolute; opacity: 0; pointer-events: none; }
.ingredients .box {
  flex: none;
  width: 20px; height: 20px;
  margin-top: 1px;
  border: 1.8px solid var(--checkbox);
  border-radius: 6px;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}
.ingredients .box svg { width: 13px; height: 13px; stroke-width: 3; opacity: 0; color: var(--accent-ink); }
.ingredients input:checked + .box { background: var(--accent); border-color: var(--accent); }
.ingredients input:checked + .box svg { opacity: 1; }
.ingredients input:checked ~ span:last-child { color: var(--muted); text-decoration: line-through; }
.ingredients input:focus-visible + .box { box-shadow: 0 0 0 3px var(--accent-soft); }

.section-label {
  margin: 18px 0 6px;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.section-label:first-child { margin-top: 0; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.steps button {
  width: 100%;
  display: flex;
  gap: 16px;
  padding: 12px 12px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  transition: background 0.15s;
}
.steps button:hover { background: var(--panel); }
.steps .num {
  flex: none;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 13.5px;
}
.steps .done { color: var(--muted); }
.steps .done .num { background: var(--green-soft); color: var(--green); }

.recipe-row { grid-template-areas: 'main side'; }
.recipe-row > .main-col { grid-area: main; }
.recipe-row > .side { grid-area: side; }

/* ---------- Accounts, requests, people ---------- */

.mobile-only { display: none; }
a.status-card { color: inherit; transition: background 0.15s, border-color 0.15s; }
a.status-card:hover, a.status-card.active { background: var(--panel-hover); border-color: var(--border-strong); }

.btn-small { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-small svg { width: 16px; height: 16px; }
.btn-primary.btn-small { height: 36px; padding: 0 14px; font-size: 13px; letter-spacing: 0.02em; }
.btn-primary.btn-dialog { height: 46px; padding: 0 20px; font-size: 14px; letter-spacing: 0.02em; }

.panel-link.attention { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }

/* Request form (read-only home + My Requests) */
.request-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px; max-width: 980px; }
.request-form .url-input { flex: none; }
.request-form.compact { margin-top: 0; }
.request-form.compact .url-input, .request-form.compact .btn-primary { height: 50px; }

.request-list { display: flex; flex-direction: column; gap: 10px; }
.request-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--panel);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.request-card.status-added { border-left-color: var(--green); }
.request-card.status-dismissed { border-left-color: var(--checkbox); opacity: 0.8; }
.request-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.request-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.request-site { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; }
.request-site svg { width: 15px; height: 15px; color: var(--accent); }
.request-url { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-url:hover { color: var(--accent); }
.request-note { margin: 2px 0 0; color: var(--text-2); font-style: italic; }
.request-meta { margin: 0; color: var(--muted); font-size: 12.5px; }
.request-meta strong { color: var(--text-2); }
.request-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.request-mini { display: flex; flex-direction: column; }
.request-mini-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.request-mini-item:last-child { border-bottom: 0; }
.request-mini-item strong { display: block; font-size: 14px; }
.request-mini-item small { color: var(--muted); font-size: 12px; }

/* People */
.people-row { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
.people-list { display: flex; flex-direction: column; gap: 8px; }
.person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--panel);
  border-radius: var(--radius);
}
.avatar {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}
.person-main { min-width: 0; }
.person-main strong { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.person-main small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pending-pw { color: var(--warn); }
.person-actions { display: flex; gap: 8px; }

.role-badge { padding: 5px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.role-super { background: var(--warn-soft); color: var(--warn); }
.role-admin { background: var(--accent-soft); color: var(--accent); }
.role-reader { background: var(--panel-hover); color: var(--text-2); }

.role-select {
  height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d9aa6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  appearance: none;
  cursor: pointer;
}
.role-select.wide { height: 44px; font-size: 15px; background-color: var(--panel); border-color: transparent; }
.role-help { margin: -4px 0 0; color: var(--muted); font-size: 13px; }
.role-legend { margin: 0; font-size: 13px; }
.role-legend dt { font-weight: 800; color: var(--text); margin-top: 8px; }
.role-legend dt:first-child { margin-top: 0; }
.role-legend dd { margin: 2px 0 0; color: var(--text-2); }
.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1; }
.input-with-button .btn-small { height: 44px; }
.edit-fields.narrow { max-width: 420px; }
.share-password { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--panel); border-radius: var(--radius); }
.share-password code { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: 0.02em; color: var(--accent); }
.card-head h2 svg { color: var(--accent); width: 19px; height: 19px; vertical-align: -3px; margin-right: 6px; }

/* Choose-password screen */
.login-card .link-btn { margin-top: 2px; }
.login-card input + input { margin-top: 0; }

.version-note { margin: 4px 2px 0; color: var(--muted); font-size: 12px; }

/* Theme picker */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.theme-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.theme-tile:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.theme-tile[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-preview {
  display: flex;
  height: 92px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(127, 127, 127, 0.25);
}
.tp-side { width: 24%; }
.tp-body { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.tp-card { flex: 1; border-radius: 5px; padding: 7px; display: flex; flex-direction: column; justify-content: space-between; }
.tp-line { width: 70%; height: 6px; border-radius: 3px; opacity: 0.9; }
.tp-btn { width: 42%; height: 9px; border-radius: 3px; }
.tp-row { display: flex; gap: 6px; height: 18px; }
.tp-row span { flex: 1; border-radius: 4px; }
.theme-name { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.theme-name strong { font-size: 15px; }
.theme-check { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.theme-check svg { width: 14px; height: 14px; stroke-width: 3; }
.theme-tile small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }

/* ---------- Recipe size (½x / 1x / 2x / 3x) ---------- */

.scale {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--panel);
  border-radius: 10px;
}
.scale button {
  min-width: 42px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.scale button:hover { color: var(--text); background: var(--panel-hover); }
.scale button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.scale button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.scale-hint {
  margin: -6px 0 10px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
}

/* ---------- Edit a recipe ---------- */

.edit-fields { display: flex; flex-direction: column; gap: 12px; }
.edit-fields.two { display: grid; grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; font-weight: 700; color: var(--text-2); }
.field input {
  height: 44px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
}
.field input::placeholder { color: var(--muted); font-weight: 400; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .notes-input { min-height: 0; font-weight: 500; }
.edit-lines { min-height: 160px; line-height: 1.7; }
.edit-photo { display: flex; align-items: flex-end; gap: 12px; }
.edit-photo .thumb { width: 64px; height: 64px; border-radius: 10px; }
.edit-photo .field { flex: 1; }
.edit-help { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.edit-help code { padding: 1px 6px; border-radius: 5px; background: var(--panel); color: var(--text-2); }

/* ---------- Family notes ---------- */

.notes-card .card-head { margin-bottom: 12px; }
.notes-card h2 { display: flex; align-items: center; gap: 8px; }
.notes-card h2 svg { color: var(--accent); width: 19px; height: 19px; }

.notes-input {
  display: block;
  width: 100%;
  min-height: 84px;
  max-height: 60vh;
  padding: 12px 14px;
  resize: vertical;
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.notes-input::placeholder { color: var(--muted); }
.notes-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.notes-print { display: none; white-space: pre-wrap; }

/* ---------- Library ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 6px 2px 0;
}
.page-head h1 { margin: 0; font-size: 30px; font-weight: 800; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

.page-tools { display: flex; gap: 10px; flex: 0 1 440px; min-width: 0; }
.page-tools .btn { flex: none; }
.search {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.recipe-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.recipe-card:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: 0 12px 28px var(--shadow); }
.recipe-card:focus-within { border-color: var(--accent-line); }
.card-link { display: flex; flex-direction: column; height: 100%; outline: none; }
.card-link:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius-lg); }

/* Per-card delete button: shows on hover (always visible on touch screens) */
.card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--overlay-line);
  border-radius: 10px;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  color: var(--overlay-text);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.card-delete svg { width: 18px; height: 18px; }
.recipe-card:hover .card-delete,
.recipe-card:focus-within .card-delete,
.card-delete:focus-visible { opacity: 1; }
.card-delete:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (hover: none) { .card-delete { opacity: 1; } }

.has-notes { display: inline-flex; vertical-align: -3px; margin-right: 5px; color: var(--accent); }
.has-notes svg { width: 14px; height: 14px; }

/* Multi-select mode */
.grid.selecting .recipe-card { cursor: pointer; user-select: none; }
.grid.selecting .recipe-card:hover { transform: none; }
.select-check {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: var(--overlay);
  pointer-events: none;
}
.select-check svg { width: 16px; height: 16px; stroke-width: 3; color: var(--accent-ink); opacity: 0; }
.recipe-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.recipe-card.selected .thumb img { opacity: 0.6; }
.recipe-card.selected .select-check { background: var(--accent); border-color: var(--accent); }
.recipe-card.selected .select-check svg { opacity: 1; }

.select-bar {
  position: fixed;
  z-index: 8;
  left: calc(50% + 118px);
  bottom: 22px;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 18px;
  background: var(--bar-bg);
  border: 1px solid var(--bar-border);
  border-radius: 16px;
  box-shadow: 0 16px 40px var(--shadow);
}
.select-count { margin-right: auto; font-size: 14.5px; white-space: nowrap; }
body:has(.select-bar) .toast { bottom: 100px; }
.main:has(.select-bar) { padding-bottom: 120px; }

.btn-icon { width: 46px; padding: 0; }
.btn-delete { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.btn-delete:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-delete:disabled { opacity: 0.45; cursor: not-allowed; }

/* Confirm dialog */
.dialog {
  width: min(440px, calc(100% - 32px));
  padding: 24px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px var(--shadow);
}
.dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(2px); }
.dialog h2 { margin: 0 0 12px; font-size: 19px; }
.dialog .muted { color: var(--muted); font-size: 13.5px; margin: 12px 0 0; }
.dialog-list {
  margin: 0;
  padding: 10px 14px 10px 32px;
  background: var(--panel);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
}
.dialog-list li + li { margin-top: 4px; }
.dialog-list .muted { margin: 4px 0 0; list-style: none; margin-left: -18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.recipe-card .thumb { aspect-ratio: 4 / 3; width: 100%; border-radius: 0; }
.recipe-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; }
.recipe-card-body strong {
  font-size: 15px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.site-name {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Photo with a fallback when there is no image or it fails to load */
.thumb {
  position: relative;
  overflow: hidden;
  flex: none;
  background: var(--thumb-bg);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--thumb-icon);
}
.thumb .fallback svg { width: 40%; height: 40%; max-width: 48px; stroke-width: 1.4; }
.thumb img + .fallback { display: none; }
.thumb.broken img { display: none; }
.thumb.broken .fallback { display: grid; }

/* ---------- Login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 36px 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.login-card img { border-radius: 14px; }
.login-card h1 { margin: 4px 0 0; font-size: 24px; }
.login-card p { margin: 0; color: var(--text-2); }
.login-card input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 16px;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-card .btn-primary { width: 100%; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  padding: 12px 18px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-weight: 700;
  border-radius: 99px;
  box-shadow: 0 10px 30px var(--shadow);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Smaller screens ---------- */

@media (max-width: 1020px) {
  .row, .people-row { grid-template-columns: minmax(0, 1fr); }
  .recipe-row { grid-template-areas: 'side' 'main'; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    z-index: 5;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand { border: 0; padding: 0; margin-right: auto; }
  .brand span { display: none; }
  .nav { flex-direction: row; }
  .nav-item { padding: 8px 12px; gap: 8px; font-size: 14px; }
  .sidebar-foot { display: none; }
  .main { padding: 16px 16px 32px; gap: 16px; }
  .hero { padding: 28px 20px 24px; min-height: 0; }
  .hero-bg { width: 100%; opacity: 0.28; -webkit-mask-image: none; mask-image: none; }
  .hero-actions .divider { display: none; }
  .hero-actions .btn:not(.btn-primary) { flex: 1 1 auto; }
  .hero-actions .btn-primary, .url-form .btn-primary { width: 100%; }
  .card { padding: 18px 16px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .page-head h1 { font-size: 24px; }
  .page-tools { flex: 1 1 100%; }
  .mobile-only { display: flex; }
  .nav { gap: 2px; }
  .nav-item { padding: 8px 10px; }
  .nav-item span:not(.nav-count) { display: none; }
  .nav-item.active span:not(.nav-count) { display: inline; }
  .request-form { grid-template-columns: 1fr; }
  .request-card { flex-direction: column; align-items: stretch; }
  .request-actions { justify-content: flex-start; }
  .people-row { grid-template-columns: minmax(0, 1fr); }
  .person { grid-template-columns: auto minmax(0, 1fr) auto; }
  .person-actions { grid-column: 1 / -1; }
  .paste-fields { grid-template-columns: 1fr; }
  .edit-fields.two { grid-template-columns: 1fr 1fr; gap: 10px; }
  .paste-actions .btn-primary { width: 100%; }
  .select-bar { left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); padding-left: 14px; gap: 8px; }
  .select-bar .btn { height: 42px; padding: 0 12px; font-size: 13.5px; }
  .select-bar .btn-icon { width: 42px; padding: 0; }
  .select-count { font-size: 13.5px; }
  .hide-sm { display: none; }
  .card-delete { top: 8px; right: 8px; width: 34px; height: 34px; }
  .feed-item .when { display: none; }
}

@media (max-width: 380px) {
  .nav-item span:not(.nav-count),
  .nav-item.active span:not(.nav-count) { display: none; }
}

/* ---------- Print: just the recipe ---------- */

@media print {
  :root, :root[data-theme] { --hero-bg: none; --glow: none; --text: #000; --text-2: #222; --muted: #555; --border: #ccc; --card: #fff; --panel: #fff; --accent: #000; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .sidebar, .hero-actions, .hero-bg, .toast, .steps-hint, .card-foot, .notes-input { display: none !important; }
  .notes-print { display: block; }
  .scale { display: none; }
  .scale-hint { background: none; padding: 0; color: #000; }
  .notes-card.print-empty { display: none; }
  .app { display: block; }
  .main { padding: 0; }
  .hero { min-height: 0; padding: 0 0 12px; border: 0; background: none; }
  .hero::after { display: none; }
  .row { display: block; }
  .card { border: 0; padding: 12px 0; break-inside: avoid; }
  .steps button { padding: 6px 0; }
  .steps .num { border: 1px solid #000; background: none; color: #000; }
  .ingredients .box { border-color: #000; }
}
