/* Plus Jakarta Sans: the installed font first, then the files from @fontsource/plus-jakarta-sans (served under
   /fonts/plus-jakarta-sans/), else the system font. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: local('Plus Jakarta Sans Medium'), local('PlusJakartaSans-Medium'), url('/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: local('Plus Jakarta Sans Bold'), local('PlusJakartaSans-Bold'), url('/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-weight: 800;
  font-style: normal;
  font-display: swap;
  src: local('Plus Jakarta Sans ExtraBold'), local('PlusJakartaSans-ExtraBold'), url('/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-800-normal.woff2') format('woff2');
}

/* Design tokens: light, photo-led, iOS-like. Every colour in this file comes from here. */
:root {
  color-scheme: light dark;
  --bg: #f3f6f2; /* page background (sage) */
  --surface: #ffffff; /* cards, lists, fields, chips */
  --surface-2: #e9efe8; /* controls, chips (a step darker than --bg, so they show on the page and on cards) */
  --ink: #15201a; /* text */
  --ink-2: #5b665f; /* secondary text, inactive icons */
  --line: #e4eae3; /* dividers, tracks */
  --accent: #2d6a4f; /* main action, links, active state */
  --accent-soft: #e4ece8; /* soft background for the active state */
  --highlight: #d8f3c4; /* chosen filter, secondary emphasis */
  --danger: #c2261a; /* delete, errors, badge */
  --tile: #ffffff; /* behind store product photos, which are shot on white */
  /* derived from the tokens above, so they follow light/dark */
  --hairline: var(--line);
  --glass: color-mix(in srgb, var(--surface) 72%, transparent);
  --scrim: color-mix(in srgb, var(--ink) 40%, transparent);
  --shadow: 0 8px 28px color-mix(in srgb, var(--ink) 14%, transparent), 0 1px 3px color-mix(in srgb, var(--ink) 8%, transparent);
  /* a lifted, floating thing: a dish being dragged, the dish's bottom sheet */
  --shadow-float: 0 16px 40px color-mix(in srgb, var(--ink) 22%, transparent), 0 2px 6px color-mix(in srgb, var(--ink) 10%, transparent);
  /* the page behind a bottom sheet: --ink (light) at 32 %, also in the dark theme */
  --sheet-scrim: rgba(21, 32, 26, 0.32);
  /* Shapes: softly rounded buttons (12px) and menus (16px), so text always fits inside, 20px for cards; a 4px grid
     with a 16px margin */
  --btn-radius: 12px;
  --menu-radius: 16px;
  --radius: 20px;
  /* Motion: one calm curve and two durations for every transition; page changes are quicker still */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 0.18s;
  --slow: 0.32s;
  --page: 0.16s;
  --page-out: 0.06s;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --gutter: 16px;
  --max: 1240px;
  --section: clamp(24px, 5vw, 64px);
  --tabbar: 64px;
}
@media (min-width: 860px) {
  :root {
    --gutter: clamp(24px, 5vw, 56px);
  }
}
/* Dark theme: theme.js sets data-theme from Indstillinger → Tema, or from the device's setting (Automatisk). */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1512;
  --surface: #18211c;
  --surface-2: #212b25;
  --ink: #eef3ef;
  --ink-2: #a3afa7;
  --line: #2a352f;
  --accent: #7cc59b;
  --accent-soft: #1e3a2c;
  --highlight: #2e4a22;
  --danger: #ff6b5e;
  --shadow: 0 8px 28px color-mix(in srgb, var(--bg) 70%, transparent);
  --shadow-float: 0 16px 40px color-mix(in srgb, var(--bg) 85%, transparent);
  --tile: #ffffff;
}
:root[data-theme='light'] {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* The app is never wider than the screen: nothing (the menu, the loading bar, a wide row) can make the whole view
     pan sideways or wobble. clip (not hidden) keeps position: sticky working. */
  overflow-x: clip;
  /* no sideways rubber band either */
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  /* text 15/500 in rem, so the browser's and iOS's larger text sizes scale everything */
  font: 500 0.9375rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  overflow-x: clip;
}

@media (min-width: 860px) {
  body {
    padding-bottom: 0;
  }
}

h1,
h2,
h3 {
  font-family: var(--sans);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
/* On a phone, a field with text under 16px makes iOS zoom in when it is tapped, and the zoomed page then reaches past
   the screen and can be dragged sideways. Fields are at least 16px there (1rem grows with larger text). */
@media (pointer: coarse) {
  input,
  textarea,
  select {
    font-size: max(1rem, 16px);
  }
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Top bar */
.topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 20;
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 76px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 800 1.375rem/1 var(--sans);
  color: var(--ink);
  text-decoration: none;
}
.brand svg {
  width: 32px;
  height: 32px;
}
/* Desktop: the same tabs as a pill row */
.topnav {
  display: none;
  gap: 4px;
  padding: 4px;
  border-radius: var(--btn-radius);
  background: var(--surface);
}
.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--btn-radius);
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 700;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.topnav a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent);
}
.topbar .spacer {
  flex: 1;
}
@media (min-width: 860px) {
  .topnav {
    display: flex;
  }
}

/* Glass menu (touch): a floating pill with up to 4 tabs, and a round search button beside it */
.tabbar {
  position: fixed;
  inset: auto 0 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: env(safe-area-inset-bottom);
  pointer-events: none;
}
.tabbar-tabs,
.tabbar-search {
  pointer-events: auto;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.tabbar-tabs {
  flex: 1;
  display: grid;
  /* minmax(0, …) and min-width: 0: the tabs share the width and shrink with it (also with larger text), so the pill
     never grows wider than the screen */
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  gap: 2px;
  padding: 4px;
  border-radius: var(--menu-radius);
}
.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  height: calc(var(--tabbar) - 10px);
  border-radius: var(--btn-radius);
  text-decoration: none;
  min-width: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabbar a svg {
  flex: none;
  width: 24px;
  height: 24px;
}
.tabbar a[aria-current='page'] {
  color: var(--accent);
  background: var(--accent-soft);
}
.tabbar .tabbar-search {
  flex: none;
  width: var(--tabbar);
  height: var(--tabbar);
  border-radius: var(--menu-radius);
  color: var(--ink);
}
@media (min-width: 860px) {
  .tabbar {
    display: none;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  /* a plain .btn is a visible button too: white with a line (the variants below give it its colour) */
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:active,
.icon-btn:active,
.chip:active,
.pill:active {
  transform: scale(0.97);
}
.btn:hover {
  background: var(--surface-2);
}
/* Secondary on a white surface (the hero): outlined in the accent, so it reads as a button in both themes */
.btn-hero {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--surface);
}
.btn-primary:hover {
  background: var(--accent);
}
.btn-primary:hover {
  opacity: 0.92;
}
/* Secondary: a --highlight pill */
.btn-quiet {
  background: var(--highlight);
  color: var(--ink);
  border-color: transparent;
}
.btn-quiet:hover {
  background: var(--highlight);
}
.btn-quiet:hover {
  opacity: 0.92;
}
.btn-link {
  background: none;
  border: 0;
  padding: 0;
  min-height: 44px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.btn-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.btn-danger {
  color: var(--danger);
}
.icon-btn {
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--btn-radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.icon-btn:hover {
  border-color: var(--accent);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Context menu: a "⋯" button whose actions open in a small panel below it */
.menu {
  position: relative;
  display: inline-block;
}
.menu > summary {
  list-style: none;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu[open] > summary {
  border-color: var(--ink);
}
.menu-list {
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  display: grid;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--menu-radius);
  box-shadow: var(--shadow);
}
.menu[open] > .menu-list {
  animation: menu-in var(--fast) var(--ease);
}
.menu-item {
  display: block;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
  background: none;
  color: var(--ink);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover {
  background: var(--surface-2);
}
.menu-item.btn-danger {
  color: var(--danger);
}

/* Hero (detail pattern): a big photo, the title on a white surface below it */
.hero {
  position: relative;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.hero-media {
  position: relative;
  margin-inline: calc(50% - 50vw);
  aspect-ratio: 4 / 3;
  /* the place of the photo is there before the photo is, so nothing jumps or flashes white */
  background: var(--surface-2);
}
.hero-media img,
.hero-media .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Detail pattern: a big photo, then a white surface that slides up over its lower edge */
.hero-copy {
  position: relative;
  z-index: 2;
  margin: -24px calc(var(--gutter) * -1) 0;
  padding: 24px var(--gutter) 32px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  max-width: 560px;
}
/* "← Tilbage" on a recipe: back to the place on the list it was opened from */
.back-link {
  display: inline-block;
  margin-bottom: 14px;
  font: 600 0.9rem/1.2 var(--sans);
  color: var(--ink);
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}
.eyebrow {
  display: block;
  font: 500 0.8125rem/1.3 var(--sans);
  color: var(--ink-2);
  margin-bottom: 4px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.12;
}
.hero p {
  margin: 18px 0 26px;
  max-width: 46ch;
  font-size: 1rem;
  color: var(--ink);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}
/* Stars 0–5 on a recipe and in "Jeres top" */
.hero-stars { margin: 14px 0 4px; }
.stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.stars .star {
  border: 0;
  background: none;
  padding: 2px;
  min-width: 44px;
  min-height: 44px;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink-2);
  cursor: pointer;
}
.stars .star.on { color: var(--accent); }
/* "Jeres top" (#/top): the recipes in the order Madro has learned */
.top-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.top-item {
  display: grid;
  grid-template-columns: 28px 56px 1fr auto;
  gap: 12px;
  align-items: center;
}
.top-rank { font-weight: 600; color: var(--ink-2); text-align: right; }
.top-media { display: block; width: 56px; height: 56px; overflow: hidden; }
.top-media img, .top-media .ph { width: 100%; height: 100%; object-fit: cover; font-size: 1.6rem; }
.top-copy { display: grid; gap: 2px; }
.top-copy a { color: var(--ink); text-decoration: none; }
@media (max-width: 600px) {
  .top-item { grid-template-columns: 24px 48px 1fr; }
  .top-item .stars { grid-column: 3; }
}
/* Minutes, persons and the price on one line, centred against each other (the price is a 44px tap target, so with the
   default stretch its text hung lower than the rest); on a narrow screen the price wraps onto its own line. */
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 500;
}

@media (min-width: 860px) {
  .hero-inner {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: end;
    min-height: min(100svh, 760px);
  }
  .hero-media {
    grid-column: 1 / -1;
    grid-row: 1;
    margin: 0 calc(50% - 50vw) 0 32%;
    aspect-ratio: auto;
    height: 100%;
    min-height: 560px;
  }
  .hero-media img,
  .hero-media .ph {
    border-radius: var(--radius);
  }
  .hero-copy {
    border-radius: var(--radius);
    padding: 32px;
    grid-column: 1 / span 2;
    grid-row: 1;
    margin: 0 0 clamp(24px, 6vh, 64px);
    max-width: 560px;
  }
}

/* Smaller page hero for plan and shopping */
.page-hero {
  background: var(--bg);
  padding: 92px 0 16px;
}
.page-hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
}
.page-hero .row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}
.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 600;
}
.week-nav .icon-btn {
  background: var(--surface);
  border-color: transparent;
}
.page-hero .sub {
  margin: 8px 0 0;
  color: var(--ink);
}

/* Content surface */
.section {
  padding-block: var(--section);
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.section-head h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
}

.subnav {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
  border-bottom: 1.5px solid var(--line);
}
.subnav a {
  padding: 10px 0;
  margin-bottom: -1.5px;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
}
.subnav a[aria-current='page'] {
  border-color: var(--accent);
}

.pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1) 28px;
  padding: 2px var(--gutter);
}
.pill {
  flex: none;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--btn-radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
.pill[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

.search {
  width: min(100%, 320px);
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--btn-radius);
  border: 1.5px solid var(--line);
  background: var(--surface);
}

/* Opskrifter med en vare (#/vare) */
.item-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.card-item .matched {
  margin-top: 4px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 36px 24px;
}
.card {
  display: block;
  text-decoration: none;
  color: inherit;
}
/* A long list of recipes: cards below the screen are not drawn until they are scrolled near, so the page (and the
   picture of it a page change takes) stays cheap. */
.grid > .card-wrap {
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}
.card .media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-2);
}
.card .media img,
.card .media .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.card:hover .media img {
  transform: scale(1.03);
}
.card h3 {
  margin-top: 14px;
  font-size: 1.2rem;
}
.meta {
  margin-top: 4px;
  font-size: 0.8125rem; /* meta 13/500 */
  color: var(--ink-2);
  font-weight: 500;
}

.ph {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  font: 800 clamp(3rem, 10vw, 7rem) / 1 var(--sans);
  color: var(--accent);
  user-select: none;
}

.empty {
  padding: 48px 24px;
  text-align: center;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-2);
}

/* Recipe detail */
.recipe-body {
  display: grid;
  gap: 48px;
}
@media (min-width: 900px) {
  .recipe-body {
    grid-template-columns: minmax(300px, 4fr) 7fr;
    align-items: start;
  }
  .ingredients {
    position: sticky;
    top: 24px;
  }
}
.ingredients {
  background: var(--surface-2);
  padding: 28px;
}
.ingredients h2,
.steps h2 {
  font-size: 1.5rem;
  margin-bottom: 18px;
}
.ingredients ul {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}
.ingredients li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.ingredients .qty {
  min-width: 76px;
  font-weight: 600;
  color: var(--ink);
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink);
}
.stepper .icon-btn {
  width: 36px;
  height: 36px;
}
.steps ol {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  max-width: 64ch;
}
.steps li::before {
  content: counter(step);
  font: 400 1.6rem/1 var(--sans);
  color: var(--accent);
}
.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin-top: 40px;
}
/* On the recipe page Rediger and ⋯ sit in a slim bar between the hero and the ingredients/steps, to the right. */
.recipe-toolbar .recipe-actions {
  justify-content: flex-end;
  margin: 0;
  padding-top: 16px;
  padding-bottom: 16px;
}
/* The menu opens downwards, over the ingredients, not up into the hero. */
.recipe-toolbar .menu-list {
  bottom: auto;
  top: calc(100% + 6px);
}
/* Buttons that do not depend on what the page shows ("Tilføj opskrift", "Hent fra butik") sit above the content. */
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin-bottom: 20px;
}

/* Products under Varer: a small picture before the name */
.product-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--surface);
  flex: none;
}
.product-img.ph {
  display: grid;
  place-items: center;
  background: var(--line);
  color: var(--ink);
  font-size: 0.9rem;
}
/* Mine varer: a tap on the picture uploads one of the household's own; without one, a small + shows it can */
.product-img-pick {
  position: relative;
  flex: none;
  display: block;
  cursor: pointer;
}
.product-img-pick.empty::after {
  content: '+';
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  font: 600 0.8rem/1 var(--sans);
}

/* Form */
.form {
  max-width: 760px;
  display: grid;
  gap: 22px;
}
.field {
  display: grid;
  gap: 6px;
}
.field > span {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}
.field small {
  color: var(--ink-2);
}
.input,
.form textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
}
.form textarea {
  min-height: 120px;
  resize: vertical;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.ing-row {
  display: grid;
  grid-template-columns: 80px 80px 1fr 44px;
  gap: 8px;
  align-items: center;
}
.ing-list {
  display: grid;
  gap: 8px;
}
.image-field {
  display: flex;
  gap: 16px;
  align-items: center;
}
.image-field .thumb {
  width: 96px;
  height: 72px;
  flex: none;
  overflow: hidden;
  background: var(--surface-2);
}
.image-field .thumb img,
.image-field .thumb .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  font-size: 2rem;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  padding-top: 8px;
}
.error {
  color: var(--danger);
  font-weight: 600;
}

/* Plan */
.days {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 12px;
}
/* A compact card per day: weekday and date, a round "+" (Tilføj ret) and one row per dish; the actions are in the
   dish's bottom sheet (.entry-sheet) */
.day {
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
  transition: box-shadow var(--fast) var(--ease);
}
.day.today {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
}
.day-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.day-head h3 {
  font-size: 1rem;
  font-weight: 800;
}
.day-head span {
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 500;
}
/* "+": a 32px circle in a 44px touch area */
.day-add {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -6px -6px -6px 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}
.day-add .ico {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
}
.day-add svg {
  width: 18px;
  height: 18px;
}
.entries {
  display: grid;
  gap: 10px;
}
.entry {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 14px;
  background: var(--surface);
  /* a long press lifts the dish: no text selection or callout from the phone meanwhile */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.entry-open {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.entry .media {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
}
.entry .media img,
.entry .media .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  font-size: 1.6rem;
}
.entry-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.entry-title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.entry-meta {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-more {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-2);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.entry-more:active,
.entry-open:active,
.day-add:active {
  opacity: 0.55;
}
/* Dragging a dish to another day (a long press, or the mouse): the row lifts and follows the finger, the day under it
   gets a ring; let go outside a day and it glides back */
.entry.dragging {
  opacity: 0.35;
}
.entry-ghost {
  position: fixed;
  z-index: 1000;
  pointer-events: none;
  padding: 6px;
  margin: -6px 0 0 -6px;
  box-sizing: content-box;
  box-shadow: var(--shadow-float);
  transform-origin: center;
  transition: transform var(--fast) var(--ease);
}
.entry-ghost:not(.returning) {
  transition: none;
}
.plan-dragging,
.plan-dragging * {
  cursor: grabbing !important;
  user-select: none;
  -webkit-user-select: none;
}
.day.drop-target {
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* The dish's bottom sheet: dims the page, holds Personer and the actions; swipe down, tap outside or Esc closes it */
dialog.entry-sheet {
  width: 100%;
  max-width: 520px;
  max-height: calc(100svh - env(safe-area-inset-top) - 24px);
  margin: auto auto 0;
  padding: 0;
  border-radius: 26px 26px 0 0;
  background: var(--bg);
  box-shadow: var(--shadow-float);
  overflow: auto;
  overscroll-behavior: contain;
  transition: transform var(--fast) var(--ease);
}
dialog.entry-sheet[open] {
  animation: sheet-up 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
dialog.entry-sheet::backdrop {
  background: var(--sheet-scrim);
}
dialog.entry-sheet:focus {
  outline: none;
}
.sheet-inner {
  display: grid;
  gap: 12px;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-grab {
  justify-self: center;
  width: 36px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  touch-action: none;
}
.sheet-top {
  display: flex;
  align-items: center;
  gap: 12px;
  touch-action: none;
}
.sheet-top .media {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  overflow: hidden;
}
.sheet-top .media img,
.sheet-top .media .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  font-size: 1.4rem;
}
.sheet-overline {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.sheet-top h2 {
  font-size: 1.0625rem;
  font-weight: 800;
}
.sheet-top h2 a {
  text-decoration: none;
}
.sheet-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 8px 8px 8px 16px;
  border-radius: 16px;
  background: var(--surface);
}
.sheet-label {
  display: grid;
  font-size: 0.9375rem;
}
.sheet-label strong {
  font-weight: 600;
}
.sheet-price {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
}
/* − n pers. +: a 40px pill; the buttons reach 44px with the space around them */
.sheet-stepper {
  display: inline-flex;
  align-items: center;
  height: 40px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.sheet-stepper button {
  width: 44px;
  height: 44px;
  margin: -2px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}
.sheet-count {
  min-width: 4.5em;
  text-align: center;
  font-size: 0.9375rem;
}
.sheet-actions {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
}
.sheet-actions li + li {
  border-top: 1px solid var(--line);
}
.sheet-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.sheet-action .ico {
  display: grid;
  color: var(--accent);
}
.sheet-action svg {
  width: 20px;
  height: 20px;
}
.sheet-action.danger,
.sheet-action.danger .ico {
  color: var(--danger);
}
.sheet-action:active,
.sheet-stepper button:active {
  background: var(--surface-2);
}

/* Shopping */
/* "I plejer at købe …": suggestions from earlier weeks above the list */
.usual { margin: 12px 0 20px; }
.usual h2 { font-size: 1rem; margin: 0 0 6px; }
.shop {
  display: grid;
  gap: 40px;
  max-width: 820px;
}
.add-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.select-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 1rem 0;
}
.shop h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}
.shop .aisle h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-2);
  margin: 18px 0 4px;
}
.items {
  list-style: none;
  margin: 0;
  padding: 0;
}
.item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.item input[type='checkbox'] {
  appearance: none;
  width: 28px;
  height: 28px;
  margin: 8px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.item input[type='checkbox']:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.item input[type='checkbox']:checked::after {
  content: '';
  width: 7px;
  height: 13px;
  border: solid var(--surface);
  border-width: 0 3px 3px 0;
  transform: translateY(-2px) rotate(45deg);
}
.item .name {
  font-weight: 500;
}
.item .qty {
  font-weight: 600;
  color: var(--ink);
  margin-right: 6px;
}
.item .src,
.items > li:not(.item) .src {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-2);
}
.item.done .name {
  text-decoration: line-through;
  color: var(--ink-2);
}
.item-actions {
  display: flex;
  gap: 4px;
}
/* Indkøb: the number to buy (+/-), the line's price and the list's total */
.item-actions {
  align-items: center;
  flex-wrap: wrap;
}
.qty-stepper {
  gap: 6px;
  margin-right: 6px;
}
.qty-stepper .icon-btn {
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
}
.qty-count {
  min-width: 1.6em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.line-price {
  min-width: 5.5em;
  margin-right: 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.price-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}
.shop-total {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
}
.chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--btn-radius);
  border: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover {
  border-color: var(--accent);
}
.summary {
  font-weight: 600;
  color: var(--ink);
}

/* Library: pages, hidden recipes and preview */
.library-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 16px;
}
/* Importér → Priser: items and recipes with a price per store */
.price-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
}
.price-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
/* Ny opskrift: "Hent opskrift fra et link, et billede eller en tekst" */
.import-box {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
  background: var(--surface);
}
.import-box > summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 32px;
}
.import-box .input,
.import-box textarea {
  flex: 1 1 240px;
  width: 100%;
}
/* ✕ at a store's price: mark the match as the wrong item */
.reject-match {
  margin-left: 4px;
  padding: 0 6px;
  min-width: 28px;
  min-height: 28px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
  cursor: pointer;
}
.reject-match:hover {
  border-color: var(--accent);
}
.price-pick {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.pager-page {
  min-width: 40px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--btn-radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
.pager-page[aria-current='page'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
  cursor: default;
}
.pager-gap {
  color: var(--ink);
}
.pager .btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.media-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.card.is-hidden .media {
  opacity: 0.55;
}
.preview-media img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}
.preview h3 {
  margin-top: 8px;
  font-size: 1.1rem;
}
.preview-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 4px;
}
.preview-list .qty {
  font-weight: 600;
}
.preview-missing {
  display: grid;
  gap: 8px;
  justify-items: start;
}

/* Indstillinger → Profiler */
.user-list {
  list-style: none;
  margin: 1rem 0 2rem;
  padding: 0;
  max-width: 760px;
}
.user-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.user-text .meta {
  margin-top: 0.15rem;
}

/* Todo */
.todo-wrap {
  max-width: 760px;
}
.todo-form {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}
.todos {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  gap: 2px;
}
.todo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.todo input[type='checkbox'] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  accent-color: var(--accent);
}
.todo-note {
  margin: 4px 0 0;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.todo-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.todo-images:empty {
  display: none;
}
.todo-images img {
  display: block;
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.todo-image {
  position: relative;
}
.todo-image .icon-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 26px;
  height: 26px;
  min-width: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--glass);
}
.todo-picker {
  display: grid;
  gap: 8px;
  justify-items: start;
}
.todo-attach[hidden] {
  display: none;
}
.todo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.todo-rank {
  color: var(--accent);
}
.todo-move {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
}
.todo-move:disabled {
  opacity: 0.3;
  cursor: default;
}
.todo.done strong {
  text-decoration: line-through;
  color: var(--ink);
}
.todo.editing {
  display: block;
}
.todo.editing .todo-form {
  margin: 0;
}
@media (max-width: 560px) {
  .todo {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .todo-actions {
    grid-column: 2;
  }
}

.build {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--line);
}
.build.running {
  border-color: var(--accent);
}
.build.built {
  border-color: var(--accent);
}
.build p {
  margin: 0 0 6px;
}
.build.bundle {
  margin: 0 0 16px;
  border-color: var(--accent);
}
.bundle-list {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}
.bundle-list li {
  padding: 4px 0;
}
.bundle-list label {
  cursor: pointer;
}
.build-log {
  max-height: 40vh;
  overflow: auto;
  padding: 10px;
  background: var(--surface-2);
  font-size: 0.8rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Dialog */
dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(80vh, 720px);
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: var(--scrim);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 12px;
}
.dialog-head h2 {
  font-size: 1.4rem;
}
.dialog-body {
  padding: 0 20px 20px;
  display: grid;
  gap: 12px;
}
.pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 50vh;
  overflow: auto;
}
.pick-list button,
.pick-list a {
  width: 100%;
  color: inherit;
  text-decoration: none;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
}
.pick-list .media {
  width: 56px;
  height: 56px;
  overflow: hidden;
}
.pick-list .media img,
.pick-list .media .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  font-size: 1.6rem;
}
.pick-list strong {
  font-family: var(--sans);
  font-weight: 400;
  color: var(--ink);
}
.day-picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.day-picks button {
  min-height: 56px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
}
.day-picks button:hover {
  border-color: var(--accent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  background: var(--ink);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: var(--btn-radius);
  box-shadow: var(--shadow);
  font-weight: 500;
  max-width: calc(100vw - 32px);
}
@media (min-width: 860px) {
  .toast {
    bottom: 24px;
  }
}

.hero.no-photo .hero-inner {
  min-height: 0;
  padding-block: 120px clamp(40px, 6vw, 72px);
}
.hero.no-photo .hero-copy {
  margin: 0;
  padding: 0;
  grid-column: 1 / -1;
}

.item .qty {
  white-space: nowrap;
}
@media (max-width: 599px) {
  .item {
    grid-template-columns: 44px 1fr;
    row-gap: 6px;
  }
  .item-actions {
    grid-column: 2;
  }
}

/* Indstillinger: Importér, AI and Log ud in a menu at the right of the top bar */
.settings-menu {
  margin-right: 16px;
}
.settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}
/* On desktop it is a white pill like the menu beside it, so it stays readable over the hero's photo */
@media (min-width: 860px) {
  .settings-btn {
    min-height: 44px;
    padding: 0 16px;
    border-radius: var(--btn-radius);
    background: var(--surface);
  }
  /* A page that starts without a hero (Todo, AI, Importér, Jeres top …) starts below the top bar, as the others do */
  #app > .section:first-child {
    padding-top: 92px;
  }
}
.settings-btn {
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
.settings-menu > summary {
  font-size: 1rem;
  letter-spacing: 0;
}
.settings-btn svg {
  width: 20px;
  height: 20px;
}
.settings-menu .menu-list {
  top: calc(100% + 6px);
  bottom: auto;
  min-width: 180px;
}
.settings-menu .menu-item[aria-current='page'] {
  color: var(--accent);
}
.settings-menu.current > summary {
  color: var(--accent);
}
.logged-out .topnav,
.logged-out .tabbar,
.logged-out .settings-menu {
  display: none;
}
.login {
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding-block: 120px 80px;
}
.login-form {
  margin-top: 24px;
  max-width: 380px;
}
.login .wrap {
  width: 100%;
}

.connect-form {
  display: grid;
  gap: 14px;
}
.store-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 8px 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.store-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 16px 0 28px;
}
.store-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.store-card h3 {
  margin: 0;
}
.store-card progress {
  width: 100%;
}
.store-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 4px;
}

.card-wrap {
  position: relative;
}
/* A dish with several recipes: the count sits on the photo, where the heart would be */
.dish-card {
  position: relative;
  display: block;
}
.dish-card .variants {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--glass);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.fav {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--glass);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.fav[aria-pressed='true'] {
  color: var(--accent);
}
.fav-slot .fav {
  position: static;
  width: 48px;
  height: 48px;
  margin-left: 12px;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 8px;
}
.added {
  color: var(--accent);
  font-weight: 600;
}

.ai-block {
  margin: 28px 0;
}
.ai-block h2 {
  margin-bottom: 8px;
}
.tag-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 4px;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.tag-name {
  min-width: 140px;
  font-weight: 600;
  color: var(--ink);
}

.tag-panel {
  padding-bottom: 0;
}
.chips {
  list-style: none;
  margin: 8px 0 14px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* A suggested tag (with ✓/×). Scoped to .chips, so the "Priser" chip buttons elsewhere keep the plain button look. */
.chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
  background: var(--surface-2);
  font-size: 1rem;
  cursor: default;
  color: var(--ink);
  font-weight: 500;
}
.chip-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}
.chip-btn:hover {
  background: var(--surface-2);
}
/* Suggested tags waiting for a decision: a clearly marked box, gone once all are decided. */
.tag-review {
  margin: 8px 0 14px;
  padding: 12px 16px 2px;
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: var(--btn-radius);
  background: var(--surface-2);
}
.tag-review .chips {
  margin-bottom: 10px;
}
.tag-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.tag-add .input {
  max-width: 260px;
}

.similar-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.similar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.similar-thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  overflow: hidden;
}
.similar-thumb > * {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.similar-text {
  flex: 1;
  min-width: 0;
}
.similar-text a,
.similar-title {
  font-weight: 600;
  color: var(--ink);
}

.dup-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--highlight);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
}
.cmp p {
  margin: 0 0 10px;
}
.cmp-block {
  margin: 14px 0;
}
.cmp-block h3 {
  margin-bottom: 4px;
}
.cmp-block ul {
  margin: 0;
  padding-left: 20px;
}

/* "Sammensæt madplan" */
.plan-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}
.tag-group {
  border: 0;
  margin: 0 0 12px;
  padding: 0;
}
.tag-group legend {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.tag-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  margin: 0 8px 8px 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--btn-radius);
  cursor: pointer;
}
.tag-pick:has(input:checked) {
  border-color: var(--accent);
}
.auto-plan-rules {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}
.auto-plan-rules .tag-pick {
  margin: 0;
}
.auto-plan-rules .meta {
  flex-basis: 100%;
  margin: 0;
}
.auto-plan .recipe-actions {
  margin-top: 16px;
}

.shop.beyond-plan { gap: 24px; max-width: 1040px; }
.goods-search { display: grid; gap: 12px; }
.goods-search .offer-cats { margin: 0; }
.finds:empty { display: none; }
.finds-head h2 { font-size: 1.25rem; font-weight: 800; }
.finds .store-finds:first-of-type { margin-top: 12px; }
.offer-cats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 0.75rem; }
.finds-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.finds .item.offer .src { color: var(--accent); }

/* Prices: history, deals, recipe price and the week's estimate against the budget */
.hero-meta .price-tag { color: inherit; font: inherit; padding: 0; min-height: 32px; line-height: 1.3; text-align: left; }
.hero-meta .price-tag .per-person { font-weight: 400; }
.plan-price .btn-link { font-size: 0.88rem; }
.plan-price.over { color: var(--danger); }
.price-history .item.offer .src { color: var(--accent); }
.price-history .price-points { display: block; opacity: 0.8; }

.cheapest-bar { margin: 0 0 1.5rem; }
.cheapest-bar > .btn { margin-bottom: 0.75rem; }
.store-totals { list-style: none; padding: 0; margin: 0 0 0.75rem; }
.store-totals li { padding: 0.35rem 0; }
.store-totals li.best strong { color: var(--accent); }
.best-line { font-weight: 600; }
.cheapest .plan h3 { margin: 1rem 0 0.25rem; font-size: 1rem; }

/* Count on Indkøb in the tab bar, page title for the mobile navigation bar */
.tabbar a {
  position: relative;
}
.badge {
  position: absolute;
  top: 6px;
  left: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: var(--surface);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.badge[hidden],
.nav-title {
  display: none;
}

/* "Dine favoritter": a row of cards that scrolls sideways */
.shelf {
  margin-bottom: 40px;
}
.shelf:empty {
  display: none;
}
.shelf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 14px;
}
.see-all {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.shelf-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(74%, 280px);
  gap: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1);
  padding: 2px var(--gutter) 10px;
}
.shelf-row::-webkit-scrollbar {
  display: none;
}
.shelf-row > * {
  scroll-snap-align: start;
}

/* Mobile first, iOS-like feel (under 860px). Desktop keeps the layout above.
   Translucent bars with safe areas, large titles, inset grouped lists on a warm
   grouped background, segmented control, bottom sheets and tap feedback. */
a,
button,
label,
summary {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active,
.icon-btn:active,
.pill:active,
.chip:active,
.chip-btn:active,
.pager-page:active,
.tabbar a:active,
.pick-list button:active,
.pick-list a:active,
.day-picks button:active {
  opacity: 0.55;
}

@media (max-width: 859px) {
  :root {
    --navbar: 52px;
    --tabbar: 64px;
    --tabbar-gap: max(10px, env(safe-area-inset-bottom));
    --gutter: 16px;
    --section: 24px;
  }
  body {
    background: var(--bg);
    padding-top: calc(var(--navbar) + env(safe-area-inset-top));
    padding-bottom: calc(var(--tabbar) + var(--tabbar-gap) + 20px);
  }
  .toast {
    bottom: calc(var(--tabbar) + var(--tabbar-gap) + 12px);
  }

  /* Navigation bar */
  .topbar {
    position: fixed;
    padding-top: env(safe-area-inset-top);
    background: var(--glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--hairline);
  }
  .topbar .wrap {
    height: var(--navbar);
    gap: 12px;
    padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
  }
  .brand {
    font-size: 1.15rem;
    gap: 8px;
  }
  .brand svg {
    width: 28px;
    height: 28px;
  }
  .settings-menu {
    margin-right: 4px;
  }
  .settings-btn {
    color: var(--accent);
  }
  .settings-label {
    display: none;
  }

  /* Centered page title; the brand shrinks to its logo */
  .topbar .wrap {
    position: relative;
  }
  .brand-name {
    display: none;
  }
  .nav-title {
    display: block;
    position: absolute;
    left: 50%;
    max-width: 55%;
    transform: translateX(-50%);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 700 1.0625rem/1 var(--sans);
    color: var(--ink);
    pointer-events: none;
  }
  .logged-out .nav-title {
    display: none;
  }

  /* Glass menu: floating above the home indicator, the search button beside the pill */
  .tabbar {
    inset: auto max(var(--gutter), env(safe-area-inset-right)) var(--tabbar-gap) max(var(--gutter), env(safe-area-inset-left));
    padding: 0;
    gap: 8px;
    user-select: none;
  }
  .tabbar a {
    transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease);
  }
  .tabbar .badge {
    top: 3px;
  }

  /* Large titles */
  .page-hero {
    padding: 16px 0 22px;
  }
  .page-hero h1,
  .section-head h1 {
    font-size: 2rem; /* title 32/800 */
  }
  .page-hero .row {
    align-items: start;
  }
  .hero-media::before {
    display: none;
  }
  .hero.no-photo .hero-inner {
    padding-block: 20px 32px;
  }
  .hero-copy {
    padding-bottom: 28px;
  }
  .section-head {
    margin-bottom: 16px;
  }
  .section-head h2 {
    font-size: 1.25rem; /* section 20/800 */
  }
  .search {
    width: 100%;
    border: 0;
    border-radius: var(--btn-radius);
    background: var(--surface);
  }
  input.search[type='search'] {
    padding-left: 40px;
    /* the icon's stroke is --ink-2 (a data URL cannot read variables) */
    background: var(--surface)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b665f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.3-4.3'/%3E%3C/svg%3E")
      no-repeat 14px 50% / 18px;
  }

  /* Filter chips: white pills, the chosen one in --highlight with a check mark */
  .pill {
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    background: var(--surface);
    color: var(--ink);
  }
  .pill[aria-pressed='true'] {
    background: var(--highlight);
    color: var(--ink);
  }
  .pill[aria-pressed='true']::before {
    content: '✓';
    margin-right: 6px;
    font-weight: 700;
  }

  /* Recipe cards: white, rounded, photo on top */
  .card-wrap > .card {
    height: 100%;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface);
  }
  .card-wrap > .card .media {
    border-radius: 0;
  }
  .card-wrap > .card h3 {
    margin: 12px 16px 0;
    font-size: 1.0625rem;
  }
  .card-wrap > .card .meta {
    margin: 4px 16px 16px;
  }
  .card-wrap .fav {
    box-shadow: var(--shadow);
  }
  .shelf-head {
    margin-top: 18px;
  }
  .shelf-head h2 {
    font-size: 1.25rem;
  }

  /* Segmented control */
  .subnav {
    gap: 0;
    padding: 4px;
    border: 0;
    border-radius: var(--btn-radius);
    background: var(--surface);
  }
  .subnav a {
    flex: 1;
    display: grid;
    place-items: center;
    min-height: 44px;
    margin: 0;
    padding: 4px 10px;
    border: 0;
    border-radius: var(--btn-radius);
    text-align: center;
    font-size: 0.875rem;
  }
  .subnav a[aria-current='page'] {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
  }

  /* Rounded surfaces */
  .card .media,
  .ingredients,
  .store-card,
  .empty,
  .build,
  .build-log,
  .preview-media img {
    border-radius: var(--radius);
  }
  .grid {
    gap: 24px 16px;
  }
  .empty,
  .store-card {
    border: 0;
    background: var(--surface);
  }
  .build {
    background: var(--surface);
    border-left-width: 4px;
  }
  .pick-list .media,
  .image-field .thumb {
    border-radius: 10px;
  }
  .input,
  .form textarea {
    border-radius: 10px;
    border-width: 1px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Inset grouped lists */
  .items,
  .todos,
  .tag-list,
  .similar-list,
  .bundle-list,
  .store-totals {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 0 16px;
    gap: 0;
  }
  .items:empty,
  .todos:empty {
    display: none;
  }
  .item,
  .todo,
  .tag-row,
  .similar-row {
    border-top: 1px solid var(--hairline);
    border-bottom: 0;
    padding-block: 12px;
    min-height: 52px;
  }
  .item:first-child,
  .todo:first-child,
  .tag-row:first-child,
  .similar-row:first-child {
    border-top: 0;
  }
  .item {
    grid-template-columns: 36px 1fr;
    column-gap: 10px;
  }
  .item input[type='checkbox'] {
    width: 24px;
    height: 24px;
    margin: 6px;
    border-radius: 50%;
  }
  .item input[type='checkbox']:checked::after {
    width: 6px;
    height: 11px;
    border-width: 0 2.5px 2.5px 0;
  }
  .shop {
    gap: 28px;
  }
  .shop .aisle h3 {
    margin: 18px 16px 6px;
    font: 500 0.8rem/1.2 var(--sans);
    color: var(--ink-2);
  }
  .items > li:not(.item),
  .bundle-list li,
  .store-totals li {
    padding: 10px 0;
    border-top: 0.5px solid var(--hairline);
  }
  .items > li:not(.item):first-child,
  .bundle-list li:first-child,
  .store-totals li:first-child {
    border-top: 0;
  }
  .todo input[type='checkbox'] {
    width: 24px;
    height: 24px;
  }

  /* Bottom sheet dialogs */
  dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100svh - env(safe-area-inset-top) - 24px);
    margin: auto 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: var(--shadow);
  }
  dialog[open] {
    animation: sheet-up 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .dialog-head {
    position: relative;
    padding: 22px 16px 10px;
  }
  .dialog-head::before {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    width: 36px;
    height: 5px;
    margin-left: -18px;
    border-radius: 3px;
    background: var(--line);
  }
  .dialog-head h2 {
    font-size: 1.2rem;
  }
  .dialog-head .icon-btn {
    width: 30px;
    height: 30px;
    border: 0;
    background: var(--surface-2);
    color: var(--ink-2);
  }
  .dialog-body {
    padding: 0 16px 20px;
  }
  .pick-list {
    max-height: 60svh;
  }

  /* Toast as a floating capsule */
  .toast {
    border-radius: var(--btn-radius);
    background: var(--ink);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    padding: 10px 18px;
    font-size: 0.92rem;
    text-align: center;
    box-shadow: var(--shadow);
  }

  /* Logged out there is no glass menu, so its room at the bottom goes too and the login page fits the screen */
  body.logged-out {
    padding-bottom: 0;
  }
  .login {
    min-height: calc(100svh - var(--navbar) - env(safe-area-inset-top));
    padding-block: 32px;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

/* Page transitions (SPA): the router swaps pages in a view transition (app.js): the old page fades out quickly and
   then the new one fades softly in; the top bar and the glass menu stay put. Browsers without view transitions get the same
   fade-in from .page-enter. Dialogs fade in, and a theme change cross-fades the colours. */
#app {
  view-transition-name: page;
  /* Belt and braces: the page itself clips what reaches past its width, so even a browser that lets the root scroll
     sideways (older iOS Safari ignores overflow on html/body) has nothing to show there. The bars are fixed and do
     not widen the page. */
  max-width: 100%;
  overflow-x: clip;
}
/* Short and snappy (--page): the browser holds taps while a transition runs, so a long one feels like lag. The page
   area does not stretch between the old and new page's size (the group's default animation), and the rest of the
   screen (root) changes at once instead of cross-fading. */
::view-transition-group(page),
::view-transition-group(topbar),
::view-transition-group(tabbar),
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}
/* The two pages never show at the same time: the old one is gone (--page-out) before the new one fades in, so
   content of the page one comes from never lies over the new one (also between the tabs of a page). */
::view-transition-old(page) {
  animation: page-out var(--page-out) linear both;
}
::view-transition-new(page) {
  animation: page-in var(--page) var(--ease) var(--page-out) both;
}
/* The bars are their own layers in a page change, drawn above the page, so it never slides over them; they do not
   change, so they do not animate. */
.topbar {
  view-transition-name: topbar;
}
.tabbar {
  view-transition-name: tabbar;
}
::view-transition-old(topbar),
::view-transition-old(tabbar) {
  display: none;
}
::view-transition-new(topbar),
::view-transition-new(tabbar) {
  animation: none;
}
.page-enter {
  animation: page-in var(--page) var(--ease) both;
}
/* A page still fetching its data: a thin bar runs along the top, so a tap answers at once (app.js setLoading).
   The bar is as wide as the screen and only a clipped part of it shows, so it never reaches past the edge (moving it
   with transform did, and the whole view could be dragged sideways). */
body.page-loading::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 3px;
  background: var(--accent);
  pointer-events: none;
  clip-path: inset(0 100% 0 0);
  animation: page-loading 0.9s var(--ease) infinite;
}
@keyframes page-loading {
  from {
    clip-path: inset(0 100% 0 0 round 3px);
  }
  50% {
    clip-path: inset(0 30% 0 30% round 3px);
  }
  to {
    clip-path: inset(0 0 0 100% round 3px);
  }
}
/* Skeleton: grey shapes where the page's content will be, while it is fetched (app.js skeletonView) */
.skeleton {
  display: block;
  border-radius: 10px;
  background: var(--surface-2);
  animation: skeleton-pulse 1.2s var(--ease) infinite alternate;
}
.skeleton-title {
  width: min(60%, 260px);
  height: 2.4rem;
}
.skeleton-line {
  width: min(80%, 360px);
  height: 1rem;
  margin-top: 12px;
}
.skeleton-line.short {
  width: min(40%, 180px);
}
.skeleton-media {
  aspect-ratio: 4 / 3;
  width: 100%;
}
.skeleton-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
}
.skeleton-card .skeleton-line {
  margin-top: 0;
}
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 20px;
}
@keyframes skeleton-pulse {
  to {
    opacity: 0.45;
  }
}
@media (min-width: 860px) {
  dialog[open] {
    animation: dialog-in var(--slow) var(--ease);
  }
}
dialog[open]::backdrop {
  animation: fade-in var(--slow) var(--ease);
}
html.theme-change,
html.theme-change *,
html.theme-change *::before,
html.theme-change *::after {
  transition: background-color var(--slow) var(--ease), color var(--slow) var(--ease), border-color var(--slow) var(--ease) !important;
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
@keyframes page-out {
  to {
    opacity: 0;
  }
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  dialog[open],
  dialog[open]::backdrop,
  dialog.entry-sheet[open],
  .menu[open] > .menu-list,
  .page-enter,
  body.page-loading::after,
  .skeleton,
  ::view-transition-old(page),
  ::view-transition-new(page) {
    animation: none;
  }
  /* the bar stands still, but still shows */
  body.page-loading::after {
    clip-path: inset(0 60% 0 0 round 3px);
  }
  .btn:active,
  .icon-btn:active,
  .chip:active,
  .pill:active {
    transform: none;
  }
}

/* Opskrift: afkrydsning af ingredienser, timere og madlavningstilstand ("Lav mad") */
.check-list li label { flex: 1; display: flex; gap: 12px; align-items: baseline; cursor: pointer; }
.check-list li input { flex: none; accent-color: var(--accent); }
.check-list li.done .qty,
.check-list li.done span { text-decoration: line-through; color: var(--ink-2); }
.timer-btn {
  font: inherit; font-size: .92em; display: inline-flex; align-items: center; gap: 4px; margin: 0 2px;
  padding: 1px 10px; border: 0; border-radius: 999px; background: var(--highlight); color: var(--ink); cursor: pointer;
}
.timer-btn.running { background: var(--accent); border-color: var(--accent); color: var(--surface); font-variant-numeric: tabular-nums; }
.cook-mode {
  position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  padding: calc(16px + env(safe-area-inset-top)) var(--gutter) calc(16px + env(safe-area-inset-bottom));
}
body.cooking { overflow: hidden; }
.cook-head { display: flex; align-items: center; gap: 12px; }
.cook-head h2 { flex: 1; margin: 0; font-family: var(--sans); font-size: 1.2rem; }
.cook-ingredients { max-height: 40vh; overflow: auto; margin: 12px 0 0; padding: 12px 16px; list-style: none; background: var(--surface-2); border-radius: 12px; }
.cook-ingredients li { padding: 6px 0; font-size: 1.15rem; }
.cook-body { flex: 1; overflow: auto; display: flex; flex-direction: column; justify-content: center; max-width: 900px; width: 100%; margin: 0 auto; }
.cook-count { color: var(--ink-2); margin: 0 0 12px; }
.cook-step { font-size: clamp(1.6rem, 4.5vw, 2.6rem); line-height: 1.35; margin: 0; }
.cook-step .timer-btn { font-size: .8em; padding: 2px 14px; }
.cook-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cook-nav { min-height: 64px; font-size: 1.25rem; }

/* Madplan: rester, dage uden madlavning, skabeloner */
.day-off { margin: 8px 0; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); font-weight: 600; }
.day-off-picks { display: flex; gap: 12px; margin: 0; font-size: .9rem; }
.template-list { list-style: none; padding: 0; margin: 0; }
.template-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.template-list li > span { flex: 1; }

/* Print: opskrift og madplan uden menu og knapper */
@media print {
  .topbar, .tabbar, .recipe-toolbar, .hero-actions, .hero-stars, .back-link, .stepper, .menu, .plan-tools, .week-nav,
  .entry-more, .day-add, .day-off-picks, .similar, .tag-panel, #toast, .toast, button, dialog { display: none !important; }
  .day .entry-open { display: flex !important; }
  body { background: none !important; padding: 0 !important; color: CanvasText; }
  .hero, .page-hero, .section { padding: 12px 0 !important; background: none !important; }
  .hero-media img { max-height: 6cm; width: auto; }
  .check-list li input { display: none; }
  .timer-btn { display: inline !important; border: 0; padding: 0; background: none; color: inherit; }
  .day, .entry { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ── Design pass (C) ──────────────────────────────────────────────────────────────────────────────────────────────
   Same look, tighter: the heart on the hero photo, a compact front-page hero and two recipe columns on a phone,
   tabs that stay on one line, quiet empty days on Madplan and the same large title on every page. */

/* The recipe's heart on its photo, as on the cards */
.hero-media > .fav-slot {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: var(--gutter);
}
.hero-media > .fav-slot .fav {
  margin: 0;
  box-shadow: var(--shadow);
}
@media (min-width: 860px) {
  .hero-media > .fav-slot {
    top: 96px; /* below the top bar, which lies over the photo */
  }
}

/* Pages without a hero (Todo, Jeres top, AI, Importér …) get the same large title as Madplan and Indkøb */
#app > .section:first-child > .wrap > .section-head h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
}

/* Madplan: an empty day is one quiet line, "Intet planlagt" and the two days off as small chips */
.day-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.day-empty-text {
  margin: 0 auto 0 0;
  color: var(--ink-2);
  font-size: 0.875rem;
}
.day-off-chip {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--btn-radius);
  background: var(--surface-2);
  color: var(--ink-2);
  font: 500 0.8125rem/1 var(--sans);
  cursor: pointer;
}
.day-off-chip:hover {
  color: var(--ink);
}

@media (max-width: 859px) {
  /* Front page: the photo and text fit on the first screen, with the list starting just below */
  /* a fixed height (not a max-height on an aspect ratio, which would make the photo narrower than the screen) */
  .hero-featured .hero-media {
    aspect-ratio: auto;
    height: min(38svh, 62.5vw);
  }
  .hero-featured .hero-copy p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 10px 0 18px;
  }
  .hero-featured .hero-copy {
    padding-bottom: 20px;
  }
  .hero-featured h1 {
    font-size: 1.75rem;
  }
  /* Recipe page: a shorter photo, so the title and buttons are on the first screen */
  .hero:not(.hero-featured) .hero-media {
    aspect-ratio: auto;
    height: min(34svh, 62.5vw);
  }
  /* the tags are a quiet single line (they are all listed under Tilføj tag) */
  .hero .eyebrow {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Two recipes side by side */
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 12px;
  }
  .grid > .card-wrap {
    contain-intrinsic-size: auto 230px;
  }
  .grid .card-wrap > .card h3,
  .grid .dish-card h3 {
    margin: 10px 12px 0;
    font-size: 0.9375rem;
    line-height: 1.25;
  }
  .grid .card-wrap > .card .meta,
  .grid .dish-card .meta {
    margin: 2px 12px 12px;
    font-size: 0.8125rem;
  }
  .grid .fav {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }
  .grid .dish-card .variants {
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  /* Tabs stay on one line */
  .subnav a {
    white-space: nowrap;
    padding-inline: 6px;
    font-size: 0.8125rem;
  }
}

/* Varer: store products as tiles. The photo sits on white (the stores shoot on white, also in the dark theme), the
   star where the heart sits on a recipe card. The price per kg/l is the one thing set loud: a shelf-edge label, the
   number people compare in the store; the package price stands quietly beside it. */
.store-finds {
  margin-top: 28px;
}
.store-finds > header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.store-finds > header h3 {
  font-size: 1.25rem;
  font-weight: 800;
}
.store-finds .chip {
  margin-top: 12px;
}
.store-finds .similar h4 {
  margin: 24px 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-2);
}
.similar .tile {
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
}
.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 14px;
}
.tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.tile-photo {
  position: relative;
  aspect-ratio: 1;
  background: var(--tile);
  display: grid;
  place-items: center;
}
.tile-photo {
  overflow: hidden;
}
/* The picture never sets the tile's height: it sits inside the square, 12 % from each edge. */
.tile-photo > img.product-img,
.tile-photo > .product-img-pick {
  position: absolute;
  inset: 12%;
  width: 76%;
  height: 76%;
}
.tile-photo .product-img {
  border-radius: 0;
  background: transparent;
}
.tile-photo .product-img.ph {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 1.4rem;
  font-weight: 800;
}
.tile-photo .product-img-pick {
  display: grid;
  /* fixed tracks, so the picture's 100 % is the square's, not the picture's own height (a tall bottle was cut off) */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
}
.tile-photo .product-img-pick .product-img:not(.ph) {
  width: 100%;
  height: 100%;
}
.tile-star {
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  font-size: 1.15rem;
  background: var(--surface-2);
}
.tile-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--surface);
  font-size: 0.75rem;
  font-weight: 700;
}
.tile-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px 0;
}
.tile-brand,
.tile-size {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
}
.tile-brand:empty {
  display: none;
}
.tile-name {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-offer,
.tile-deal {
  margin-top: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
}
.tile-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 0;
}
.unit-tag {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--highlight);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.pack {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.tile-price .pack:only-child {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
}
.tile-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 14px 14px;
}
.tile-add {
  width: 100%;
}
.tile-link {
  border: 0;
  padding: 2px 0;
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.tile-link:hover {
  text-decoration: underline;
}
.tile-link:focus-visible,
.tile-star:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 520px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .tile-body,
  .tile-price {
    padding-left: 12px;
    padding-right: 12px;
  }
  .tile-actions {
    padding: 10px 12px 12px;
  }
  .unit-tag {
    font-size: 0.95rem;
  }
  .tile-price {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* Indkøbsliste: the picture of a store product from Varer, on white like the tiles; a tap shows it large. */
.list-pic {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 3px;
  border: 0;
  border-radius: 10px;
  background: var(--tile);
  cursor: zoom-in;
}
.list-pic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.list-pic:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.big-picture {
  margin: 0;
  display: grid;
  gap: 12px;
  justify-items: center;
}
.big-picture img {
  width: min(78vw, 420px);
  aspect-ratio: 1;
  object-fit: contain;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--tile);
}
.big-picture figcaption {
  font-weight: 600;
  color: var(--ink-2);
}

/* Indkøb: the add field and its note as one block; the total and the whole-list actions in one panel, like the slip
   at the till: the amount large, the actions in one row under it. */
.shop {
  gap: 24px;
}
.add-block {
  display: grid;
  gap: 8px;
}
.add-block .meta {
  margin: 0;
}
.basket-panel {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
}
.basket-panel .shop-total {
  display: grid;
  gap: 2px;
}
.total-amount {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.total-missing {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-2);
}
.basket-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cheapest:empty {
  display: none;
}
/* A store product's picture sits in the name, before the text, so the row keeps its columns. */
.item .name.has-pic {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 12px;
  align-items: center;
}
.item .name.has-pic .list-pic {
  grid-row: span 2;
}
@media (max-width: 520px) {
  .basket-panel {
    padding: 16px;
  }
  .basket-actions .btn {
    flex: 1 1 auto;
  }
}

/* Opgaver: the count on Opgaver in the settings menu and a dot on the gear while a task waits for the household */
.menu-item .badge {
  position: static;
  display: inline-block;
  margin-left: 8px;
  vertical-align: 1px;
}
.settings-btn {
  position: relative;
}
.settings-dot {
  position: absolute;
  top: 4px;
  left: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg);
}
.settings-dot[hidden] {
  display: none;
}

/* Status as a word in a pill: green only when the agent waits for the household, light green when live */
.task-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  width: fit-content;
}
.task-pill.you {
  background: var(--accent);
  color: var(--surface);
}
.task-pill.live {
  background: var(--highlight);
  color: var(--ink);
}
.task-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
@keyframes task-pulse {
  50% {
    opacity: 0.25;
  }
}

/* The list: groups of cards */
.task-new {
  width: fit-content;
}
.task-group h2 {
  margin: 8px 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-2);
}
.task-card {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.task-card-title {
  font-size: 1.05rem;
}

/* One task: the thread is a work log along a line, not chat bubbles */
.task-page .back {
  font-weight: 600;
  text-decoration: none;
}
.task-title {
  margin: 8px 0 4px;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.task-log {
  position: relative;
  list-style: none;
  margin: 8px 0 0;
  padding: 0 0 0 22px;
}
.task-log::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}
.task-entry {
  position: relative;
  margin-bottom: 16px;
}
.task-entry::before {
  content: '';
  position: absolute;
  left: -21px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--ink-2);
  background: var(--bg);
}
.task-entry.agent::before {
  border-color: var(--accent);
  background: var(--accent);
}
.task-entry.system::before {
  border-color: var(--accent);
  background: var(--highlight);
}
.task-who {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-2);
}
.task-entry p {
  margin: 0;
  white-space: pre-wrap;
}
.task-card-msg,
.task-plan,
.task-system {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
}
.task-plan {
  border: 2px solid var(--accent);
}
.task-system {
  background: var(--highlight);
  font-weight: 600;
}
.task-card-msg.waiting {
  background: var(--surface-2);
  color: var(--ink-2);
}
.task-wait {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-2);
}
.task-fold {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}
.task-steps {
  list-style: none;
  margin: 0;
  padding: 6px 14px;
  border-radius: 16px;
  background: var(--surface);
  font-size: 0.9rem;
}
.task-steps li {
  padding: 6px 0;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}
.task-steps li:first-child {
  border-top: 0;
}
.task-steps li.now {
  color: var(--ink);
  font-weight: 700;
}
.task-steps li.now::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.task-budget,
.task-files {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
}
.task-files pre {
  margin: 8px 0 0;
  overflow-x: auto;
  font-size: 0.8rem;
}
/* The composer stays at the bottom of the screen, above the glass menu on a phone */
.task-composer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  margin: 0 calc(-1 * var(--gutter));
  padding: 10px var(--gutter) 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.task-composer textarea {
  min-height: 44px;
  resize: vertical;
}
.task-hint,
.task-actions {
  grid-column: 1 / -1;
  margin: 0;
}
.task-actions {
  display: flex;
  gap: 16px;
}
.task-actions:empty {
  display: none;
}
@media (max-width: 859px) {
  .task-composer {
    bottom: calc(var(--tabbar) + var(--tabbar-gap, 10px));
  }
}
/* The one live thing on the page pulses, unless the device asks for less motion */
@media (prefers-reduced-motion: no-preference) {
  .task-dot,
  .task-steps li.now::before {
    animation: task-pulse 1.4s ease-in-out infinite;
  }
}
