/* ==========================================================================
   Recept design system — implemented from Recept.dc.html (Claude Design)
   Loads after pico.min.css; owns the palette, typography, and components.
   ========================================================================== */

/* ---- Tokens ---- */

:root,
[data-theme="light"] {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #1c1a17;
  --muted: #736d64;
  --border: rgba(28, 26, 23, .10);
  --chip: #f1ede6;
  --accent: oklch(0.55 0.115 40);
  --accent-strong: oklch(0.47 0.115 40);
  --accent-fg: #ffffff;
  --sel: rgba(168, 69, 44, .15);
  --crossed: #bcb6ab;
  --del: #b23a2c;
  --ins: #3d7a4f;
}

[data-theme="dark"] {
  --bg: #15130e;
  --surface: #201d16;
  --text: #ece7dd;
  --muted: #a49c8d;
  --border: rgba(236, 231, 221, .12);
  --chip: #2a2620;
  --accent: oklch(0.72 0.11 46);
  --accent-strong: oklch(0.79 0.11 46);
  --accent-fg: #15130e;
  --sel: rgba(215, 140, 110, .22);
  --crossed: #5c574d;
  --del: #e08b7a;
  --ins: #86c29a;
}

/* Map Pico v2 variables onto the design tokens so every page follows
   the palette. */
:root,
[data-theme="light"],
[data-theme="dark"] {
  --pico-background-color: var(--bg);
  --pico-color: var(--text);
  --pico-text-selection-color: var(--sel);
  --pico-muted-color: var(--muted);
  --pico-muted-border-color: var(--border);
  --pico-border-color: var(--border);
  --pico-card-background-color: var(--surface);
  --pico-card-border-color: var(--border);
  --pico-card-sectioning-background-color: var(--surface);
  --pico-primary: var(--accent);
  --pico-primary-background: var(--accent);
  --pico-primary-border: var(--accent);
  --pico-primary-hover: var(--accent-strong);
  --pico-primary-hover-background: var(--accent-strong);
  --pico-primary-hover-border: var(--accent-strong);
  --pico-primary-inverse: var(--accent-fg);
  --pico-primary-focus: var(--sel);
  --pico-primary-underline: var(--sel);
  --pico-secondary: var(--muted);
  --pico-secondary-background: var(--chip);
  --pico-secondary-border: var(--border);
  --pico-secondary-hover: var(--text);
  --pico-secondary-hover-background: var(--chip);
  --pico-secondary-inverse: var(--text);
  --pico-form-element-background-color: var(--surface);
  --pico-form-element-border-color: var(--border);
  --pico-form-element-active-background-color: var(--surface);
  --pico-form-element-active-border-color: var(--accent);
  --pico-form-element-focus-color: var(--sel);
  --pico-form-element-placeholder-color: var(--muted);
  --pico-h1-color: var(--text);
  --pico-h2-color: var(--text);
  --pico-h3-color: var(--text);
  --pico-h4-color: var(--text);
  --pico-border-radius: 11px;
  --pico-font-size: 106%;
}

/* ---- Base ---- */

html { height: 100%; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

h1, h2, h3, h4,
.brand strong {
  font-family: 'Spectral', Georgia, serif;
  font-weight: 600;
  letter-spacing: -.01em;
}

a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
::selection { background: var(--sel); }

main.container,
section.container {
  max-width: 1080px;
}

/* ---- Nav ---- */

nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  padding: 8px 18px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-rule { display: none; }

.nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nav-center {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: center;
  min-width: 0;
}

/* Calendar toolbar rendered inside the nav on desktop */
.nav-cal-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.nav-cal-toolbar .cal-title h1 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
}
.nav-cal-toolbar .cal-controls { flex-wrap: nowrap; }
@media (max-width: 860px) {
  .nav-cal-toolbar { display: none; }
}
@media (min-width: 861px) {
  .cal-toolbar.cal-toolbar-inline { display: none !important; }
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: end;
}

.nav-menu { position: relative; }
.nav-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 215px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.nav-dropdown[hidden] { display: none; }
.nav-dropdown a,
.nav-dropdown button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  margin: 0;
  border: none;
  border-radius: 9px;
  background: none;
  box-shadow: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.3;
}
.nav-dropdown a:hover,
.nav-dropdown button:hover {
  background: var(--chip);
  color: var(--text);
}
.nav-dropdown svg { color: var(--muted); flex: none; }
.nav-dropdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 4px;
}

nav.site-nav ul { margin: 0; padding: 0; }
nav.site-nav li { list-style: none; padding: 0; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand svg { display: block; }
.brand svg { width: 22px; height: 22px; }
.brand strong {
  font-size: 19px;
  letter-spacing: -.01em;
}

.nav-icons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  background: none;
  border: none;
  padding: 9px;
  margin: 0;
  width: auto;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .15s, color .15s;
  line-height: 0;
  box-shadow: none;
}
.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--chip);
  color: var(--text);
}
a.icon-btn { text-decoration: none; }
a.icon-btn:hover { color: var(--text); }

.site-rule {
  height: 1px;
  background: var(--border);
  width: 100%;
}

#content-div {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 28px 80px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
#content-div > * { width: 100%; }

/* The calendar behaves like an app screen: full-bleed and full-height */
#content-div:has(.cal-page) {
  max-width: none;
  padding: 12px 16px 16px;
}
.cal-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---- Buttons & chips ---- */

.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  margin: 0;
  padding: 11px 22px;
  border-radius: 11px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.35;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  transition: background .15s, border-color .15s;
}
.btn-accent:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-fg);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  margin: 0;
  padding: 11px 22px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.35;
  cursor: pointer;
  text-decoration: none;
  box-shadow: none;
  transition: color .15s, border-color .15s;
}
.btn-ghost:hover {
  border-color: var(--text);
  color: var(--text);
}
.btn-ghost.accent-hover:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm { padding: 10px 18px; font-size: 14px; }
.btn-xs { padding: 8px 15px; font-size: 13px; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.chip,
.keyword {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* Bare article wrapper — pages that lay themselves out */
.plain {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

/* ---- Home ---- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 22px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  display: block;
  margin: 0;
}
.search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-wrap input[type="search"] {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  margin: 0;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--sel);
}

.fav-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  margin: 0;
  width: auto;
}
.fav-filter:hover { border-color: var(--accent); }
.fav-filter svg { fill: none; }
.fav-filter.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
}
.fav-filter.active svg { fill: currentColor; }

.recipes-add {
  height: 40px;
  padding: 0 15px;
  font-size: 14px;
  border-radius: 11px;
  flex: none;
}
.recipes-bar .icon-btn { flex: none; }

@media (max-width: 640px) {
  .fav-filter-text { display: none; }
  .fav-filter { padding: 0 12px; }
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 26px 22px;
}

.recipe-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  background:
    repeating-linear-gradient(135deg, var(--chip) 0 13px, transparent 13px 26px),
    var(--surface);
  display: block;
}
.card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-media .photo-placeholder {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font: 500 10px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .16em;
  color: var(--muted);
  opacity: .55;
}

.card-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  color: var(--muted);
  padding: 0;
  margin: 0;
  line-height: 0;
  z-index: 2;
  transition: color .15s, transform .15s;
}
.card-fav:hover { transform: scale(1.08); color: var(--accent); }
.card-fav.is-favorite { color: var(--accent); }
.card-fav.is-favorite svg { fill: currentColor; }

.private-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--muted);
  z-index: 2;
}

.card-title {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 0 0 5px;
}
.recipe-card .card-title a { color: var(--text); text-decoration: none; }
.recipe-card .card-title a:hover { color: var(--accent); }

.card-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-meta .dot { opacity: .5; }

/* ---- Recipe detail ---- */

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 26px;
  text-decoration: none;
}
.detail-back:hover { color: var(--text); }

.recipe-detail {
  max-width: 900px;
  margin: 0 auto;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 40px;
  align-items: start;
}
.detail-hero h1 {
  font-size: 40px;
  line-height: 1.08;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.detail-hero .lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--text);
  opacity: .9;
  margin: 0 0 18px;
}
.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}

.detail-media {
  aspect-ratio: 4 / 3;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    repeating-linear-gradient(135deg, var(--chip) 0 15px, transparent 15px 30px),
    var(--surface);
  position: relative;
}
.detail-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-media .photo-placeholder {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font: 500 11px/1 ui-monospace, Menlo, monospace;
  letter-spacing: .16em;
  color: var(--muted);
  opacity: .55;
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

/* Heart button next to the recipe title (favorite_button.html) */
.favorite-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin: 6px 0 0;
  border-radius: 9px;
  color: var(--muted);
  line-height: 0;
  width: auto;
  transition: color .15s, transform .15s;
}
.favorite-btn:hover {
  color: var(--accent);
  transform: scale(1.08);
}
.favorite-btn.is-favorite { color: var(--accent); }

.detail-body {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 48px;
  margin-top: 44px;
}
.detail-body h3 {
  font-size: 24px;
  margin: 0 0 4px;
}
.detail-body .hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 16px;
}

.ingredients ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ingredients li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 9px 4px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 15.5px;
  transition: opacity .15s;
}
.ingredients li.crossed-out {
  opacity: .45;
  text-decoration: line-through;
  text-decoration-color: var(--crossed);
  color: inherit;
}

.steps { margin-top: 0; }
.steps h3 { margin-bottom: 16px; }
.steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}
.steps ol > li {
  counter-increment: step;
  display: flex;
  gap: 16px;
  padding: 0 0 20px;
  position: relative;
  margin: 0;
}
.steps ol > li::before {
  content: counter(step);
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-family: 'Spectral', Georgia, serif;
  font-weight: 600;
  font-size: 15px;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.steps p { margin: 0 0 12px; line-height: 1.55; }

.detail-footer {
  display: flex;
  gap: 12px;
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  background: none;
}

/* ---- Weekly menu ---- */

.menu-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 0 30px;
}
.menu-header h1 {
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin: 0 0 4px;
}
.menu-header .dates {
  color: var(--muted);
  margin: 0;
  font-size: 15px;
}

.menu-days {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
}
.menu-day {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  padding: 18px 22px;
  align-items: start;
}
.menu-day + .menu-day { border-top: 1px solid var(--border); }
.menu-day .day-name {
  font-family: 'Spectral', Georgia, serif;
  font-weight: 600;
  font-size: 17px;
  padding-top: 2px;
}
.menu-day .meals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.meal-slot .slot-label {
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.meal-slot .slot-value { font-size: 15px; }
.meal-slot .slot-value a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.meal-slot .slot-value a:hover { color: var(--accent-strong); }
.slot-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: 6px;
  vertical-align: middle;
}
.slot-actions a {
  color: var(--muted);
  opacity: .55;
  line-height: 0;
}
.slot-actions a:hover { opacity: 1; color: var(--text); }
.meal-slot .add-meal-link {
  color: var(--muted);
  opacity: .4;
  line-height: 0;
  display: inline-block;
}
.meal-slot .add-meal-link:hover { opacity: .9; color: var(--accent); }
.meal-slot .add-meal-link svg { stroke: currentColor; }

.shopping-card {
  margin-top: 28px;
  padding: 24px 26px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.shopping-card .shopping-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.shopping-card h3 {
  font-size: 22px;
  margin: 0;
}
.shopping-card .shopping-list-content {
  background: none;
  padding: 0;
  margin: 0;
}
.shopping-card .shopping-list-content h2,
.shopping-card .shopping-list-content h3:not(:first-child) {
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 18px 0 8px;
}
.shopping-card .shopping-list-content ul {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
}
.shopping-card .shopping-list-content li {
  padding: 4px 0;
  margin: 0;
  font-size: 14.5px;
  color: var(--text);
  opacity: .88;
}

.menu-footer {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  background: none;
}

/* Weekly menu list */
.weekly-menu-list h1 {
  font-size: 38px;
  letter-spacing: -.02em;
}

/* ---- Responsive ---- */

@media (max-width: 860px) {
  .detail-hero,
  .detail-body {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .menu-day {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .menu-day .meals {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  nav.site-nav { padding: 14px 18px; }
  #content-div { padding: 28px 18px 72px; }
  .home-header h1, .menu-header h1 { font-size: 30px; }
  .detail-hero h1 { font-size: 30px; }
}

/* ---- Form helpers (kept from the old custom.css) ---- */

:root {
  --pico-form-element-spacing-vertical: 0.2rem;
  --pico-card-box-shadow: none;
}

input[type="date"]::-webkit-inner-spin-button { display: none; }

@media (min-width: 600px) {
  .is-mobile { display: none; }
}

.formset {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
}

form.adjust > input { display: block; }

/* ---- Chat ---- */

:root { --chat-w: 570px; }

/* Corner triangle that opens the aside. Sits flush in the bottom-right so it
   reads as a page-fold rather than a floating action button. Sized to carry
   the chat glyph: the icon has to clear the hypotenuse (x + y >= size), hence
   the offset from centre rather than plain centring. */
.chat-toggle {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: 60;
  width: 64px;
  height: 64px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: var(--accent);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  color: var(--accent-fg);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: .9;
  transition: opacity .18s ease, right .22s ease;
}
.chat-toggle:hover { opacity: 1; }
.chat-toggle svg {
  display: block;
  transform: translate(14px, 14px);
}
.chat-open .chat-toggle { right: var(--chat-w); opacity: 1; }

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

/* The aside itself. Always in the DOM; slides in on .chat-open. */
.chat-aside {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  width: var(--chat-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .22s ease, visibility .22s;
}
.chat-open .chat-aside {
  transform: none;
  visibility: visible;
}
/* Overlay mode floats above the page; column mode reserves space instead
   (see the body padding rule below), so the shadow would be noise there. */
[data-chat-mode="overlay"] .chat-aside {
  box-shadow: -18px 0 40px rgba(0, 0, 0, .13);
}
[data-chat-mode="column"].chat-open body {
  padding-right: var(--chat-w);
}
body { transition: padding-right .22s ease; }

.chat-aside-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 10px 16px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.chat-aside-title {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
#chat_mode_btn[aria-pressed="true"] { color: var(--accent); }

.chat-aside-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.chat-panel-error { padding: 16px; color: var(--muted); }

/* Session picker: a dropdown over the conversation, so opening the list never
   pushes the messages around. */
.chat-sessions {
  flex: none;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.chat-sessions-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 9px 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
}
.chat-sessions-btn:hover { background: var(--chip); }
.chat-sessions-current {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  color: var(--text);
}
.chat-sessions-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.chat-sessions-menu {
  position: absolute;
  left: 10px;
  right: 10px;
  top: calc(100% + 6px);
  z-index: 100;
  padding: 6px 10px 10px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .14);
}
.chat-sessions-menu[hidden] { display: none; }
.chat-sessions-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.5rem;
  list-style: none;
}

.session-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.session-list > li { padding: 0; margin: 0; }
.session-list > li > a { padding: 0; margin: 0; }
.session-list > li > a > form > button { padding: 0; margin: 0; }

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.5rem;
  border-radius: 0.35rem;
  margin-bottom: 0;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.session-item:hover { background-color: var(--chip); }
.session-item.active { background-color: var(--sel); }

.session-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.session-delete {
  opacity: 0;
  padding: 0.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
}
.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { color: var(--del); }

.new-chat-btn {
  width: 100%;
  margin-bottom: 1rem;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  max-width: 80%;
  word-wrap: break-word;
}

.message-user {
  background-color: var(--accent);
  color: var(--accent-fg);
  align-self: flex-end;
  border-bottom-right-radius: 0.25rem;
}

.message-assistant {
  background-color: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 0.25rem;
}
.message-assistant p { margin-bottom: 0.5rem; }
.message-assistant p:last-child { margin-bottom: 0; }
.message-assistant ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}
.message-assistant li { margin-bottom: 0.25rem; }

/* Weekly menu suggestion inside chat */
.weekly-menu-suggestion {
  background: var(--bg);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 0.5rem 0;
}
.weekly-menu-suggestion h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
  color: var(--accent);
}
.weekly-menu-suggestion .menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.weekly-menu-suggestion .menu-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}
.weekly-menu-suggestion .menu-list li:last-child { border-bottom: none; }
.weekly-menu-suggestion .menu-list li strong {
  min-width: 70px;
  color: var(--muted);
}
.weekly-menu-suggestion .menu-list li a { color: var(--accent); }

.chat-input-container {
  padding: 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.chat-input-form {
  display: flex;
  gap: 0.5rem;
}
.chat-input-form input {
  flex: 1;
  margin-bottom: 0;
}
.chat-input-form button {
  margin-bottom: 0;
  width: auto;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-input-form button svg { display: block; }

.typing-indicator {
  display: none;
  padding: 0.75rem 1rem;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  border-bottom-left-radius: 0.25rem;
  align-self: flex-start;
}
.typing-indicator.show { display: block; }
.typing-indicator span { animation: blink 1.4s infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.error-message {
  color: var(--del);
  padding: 0.5rem 1rem;
  background-color: var(--sel);
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

.success-message {
  color: var(--ins);
  padding: 0.5rem 1rem;
  background-color: var(--chip);
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}
.success-message a {
  color: var(--accent);
  font-weight: bold;
}

.confirm-message {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background-color: var(--chip);
  border-radius: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}
.confirm-buttons {
  display: flex;
  gap: 0.5rem;
}
.confirm-buttons button {
  padding: 0.35rem 0.9rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}
.confirm-buttons .confirm-yes {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.menu-notes {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.quick-action-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 1rem;
  background-color: var(--accent);
  color: var(--accent-fg);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.quick-action-btn:hover { opacity: 0.9; }
.quick-action-btn.secondary {
  background-color: var(--chip);
  color: var(--text);
}

.mic-btn.recording {
  background-color: var(--del);
  border-color: var(--del);
  animation: pulse 1.5s infinite;
}
.mic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mic-btn.unsupported { display: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Narrow screens: the aside always covers the page -- a 380px column beside
   a phone-width layout leaves nothing readable. Column mode is ignored here,
   so the body padding rule must not apply either. */
@media (max-width: 860px) {
  :root { --chat-w: 100%; }
  [data-chat-mode="column"].chat-open body { padding-right: 0; }
  .chat-open .chat-toggle { display: none; }
  #chat_mode_btn { display: none; }
  .chat-aside { border-left: none; }
}

/* ---- Calendar (planering) ---- */

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.cal-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.cal-title h1 {
  font-size: 21px;
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
}
.cal-sub {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.cal-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cal-seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.cal-seg a {
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.cal-seg a:hover { color: var(--text); }
.cal-seg a.active {
  background: var(--accent);
  color: var(--accent-fg);
}

.cal-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.cal-nav .icon-btn { padding: 6px; }
.cal-nav .btn-ghost { padding: 5px 11px; font-size: 12.5px; }

.cal-error {
  color: var(--del);
  font-size: 13px;
}

/* Month grid */
.cal-month {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.cal-head,
.cal-row {
  display: grid;
  grid-template-columns: 44px repeat(7, 1fr);
}
.cal-head {
  border-bottom: 1px solid var(--border);
}
.cal-head > div {
  padding: 10px 8px;
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}
.cal-row {
  flex: 1;
  border-bottom: 1px solid var(--border);
}
.cal-row:last-child { border-bottom: none; }

.cal-weeknum-col {
  border-right: 1px solid var(--border);
}
.cal-weeknum {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
  text-decoration: none;
}
.cal-weeknum:hover { color: var(--accent); }

.cal-cell {
  min-height: 96px;
  padding: 6px 7px;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.cal-cell:last-child { border-right: none; }
.cal-cell.out { background: var(--bg); }
.cal-cell.out .cal-daynum { opacity: .4; }
.cal-cell.today .cal-daynum {
  background: var(--accent);
  color: var(--accent-fg);
}

.cal-daynum {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 4px;
}
.cal-daynum:hover { background: var(--chip); color: var(--text); }

.cal-item {
  font-size: 12.5px;
  line-height: 1.35;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-item a { color: inherit; text-decoration: none; }
.cal-item a:hover { color: var(--accent); }

.cal-meal {
  color: var(--text);
  padding-left: 8px;
  border-left: 2px solid var(--accent);
}
.cal-event {
  color: var(--muted);
  padding-left: 8px;
  border-left: 2px solid var(--crossed);
}
.cal-time {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--muted);
}

/* Chore item: checkbox + hover edit action */
.chore-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
}
.chore-actions {
  display: inline-flex;
  opacity: 0;
  transition: opacity .15s;
  line-height: 0;
}
.chore-item:hover .chore-actions { opacity: 1; }
.chore-actions a {
  color: var(--muted);
  padding: 2px;
}
.chore-actions a:hover { color: var(--text); }
.cal-month .chore-actions { display: none; }

/* Chore checkbox (shared by month and week views) */
.chore-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  padding: 1px 0;
  margin: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  max-width: 100%;
  width: auto;
  line-height: 1.35;
}
.chore-box {
  flex: none;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid var(--muted);
  display: grid;
  place-items: center;
  color: var(--accent-fg);
  transition: background .15s, border-color .15s;
}
.chore-check:hover .chore-box { border-color: var(--accent); }
.chore-check.done .chore-box {
  background: var(--accent);
  border-color: var(--accent);
}
.chore-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chore-check.done .chore-label {
  text-decoration: line-through;
  text-decoration-color: var(--crossed);
  color: var(--muted);
}

/* Week view — day columns split into labeled category rows.
   Gridlines via 1px gaps over a border-colored backdrop; meal rows get
   a light accent tint, today's column a stronger one (from the design). */
.cal-week-wrap {
  flex: 1;
  min-height: calc(100vh - 170px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}
.cal-week-grid {
  --food-tint: color-mix(in srgb, var(--accent) 4%, var(--surface));
  --food-tint-today: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --day-tint-today: color-mix(in srgb, var(--accent) 7%, var(--surface));
  --head-tint-today: color-mix(in srgb, var(--accent) 12%, var(--surface));
  flex: 1;
  display: grid;
  grid-template-columns: 92px repeat(7, minmax(0, 1fr));
  /* head, 4 meal rows, Att göra, then Övrigt takes the rest */
  grid-template-rows: auto repeat(4, auto) auto minmax(60px, 1fr);
  gap: 1px;
  background: var(--border);
}
.cal-week-grid.has-school {
  grid-template-rows: auto repeat(5, auto) auto minmax(60px, 1fr);
}

.cwm-corner { background: var(--surface); min-width: 0; }
.cwm-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 12px 12px 10px;
  background: var(--surface);
  min-width: 0;
  cursor: pointer;
}
.cwm-head.today { background: var(--head-tint-today); }
.cwm-head.today .cal-day-date { color: var(--accent); }

.cwm-label {
  padding: 10px 11px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  text-align: right;
  background: var(--surface);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  min-width: 0;
}
.cwm-label.food {
  background: var(--food-tint);
  color: var(--accent);
  align-items: center;
}
.cwm-label.chores { color: var(--accent); }

.cwm-cell {
  padding: 9px 10px;
  background: var(--surface);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cwm-cell.today { background: var(--day-tint-today); }
.cwm-cell.food { background: var(--food-tint); }
.cwm-cell.food.today { background: var(--food-tint-today); }
.cwm-meal {
  min-height: 56px;
  cursor: pointer;
  transition: background .12s;
}
.cwm-meal:hover { background: var(--chip); }
.cwm-plus {
  margin: auto;
  color: var(--muted);
  opacity: .28;
  line-height: 0;
}
.cwm-chores { min-height: 60px; padding: 10px; gap: 8px; }
.cwm-other { padding: 10px; gap: 7px; }

/* Övrigt pills: events tinted, notes quiet */
.cwm-pill {
  align-self: flex-start;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 12.5px;
  line-height: 1.35;
  overflow-wrap: break-word;
}
.cwm-pill.event {
  background: var(--sel);
  color: var(--text);
  font-weight: 500;
}
.cwm-pill.note {
  background: var(--chip);
  color: var(--muted);
}
.cwm-pill.note .note-delete-form button { opacity: .6; }
.cwm-pill.note:hover .note-delete-form button { opacity: 1; }

/* Multi-day bands stretch across the Övrigt row */
.cal-week-grid .cal-span { margin: 0 -10px; }
.cal-week-grid .cal-span.start { margin-left: 0; }
.cal-week-grid .cal-span.end { margin-right: 0; }

.cal-day-name {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cal-day-date {
  font-family: 'Spectral', Georgia, serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 1;
}
.cal-week-grid .cal-item {
  white-space: normal;
  font-size: 13.5px;
  line-height: 1.35;
  margin: 0;
}
.cal-item-label {
  display: block;
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1px;
}
.cal-week-grid .cal-meal {
  border-left: none;
  padding-left: 0;
}
.cal-week-grid .chore-check {
  font-size: 13px;
  white-space: normal;
}
.cal-week-grid .chore-check .chore-label { white-space: normal; }

/* Small form inside a dropdown (save week as template) */
.nav-dropdown .dropdown-form {
  padding: 8px 12px 6px;
  margin: 0;
}
.dropdown-form-label {
  display: block;
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.dropdown-form-row {
  display: flex;
  gap: 8px;
}
.dropdown-form-row input,
.dropdown-form-row select {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 6px 10px;
  font-size: 13.5px;
  height: auto;
}
.nav-dropdown .dropdown-form-row .btn-accent {
  width: auto;
  flex: none;
  justify-content: center;
  padding: 6px 13px;
  font-size: 13px;
  background: var(--accent);
  color: var(--accent-fg);
}
.nav-dropdown .dropdown-form-row .btn-accent:hover {
  background: var(--accent-strong);
}
/* Chore schedule chips on the chores page */
.chore-schedule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 8px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 12.5px;
}
.chore-schedule a {
  color: inherit;
  text-decoration: none;
}
.chore-schedule a:hover { color: var(--accent); }
.chore-schedule-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  margin: 0;
  width: auto;
  font-size: 14px;
  line-height: 1;
}
.chore-schedule-remove:hover { color: var(--del); }

.dn-short { display: none; }

@media (max-width: 860px) {
  /* Full-bleed calendar on mobile */
  #content-div:has(.cal-page) {
    padding: 8px 0 0;
  }
  .cal-toolbar {
    padding: 0 10px;
    margin-bottom: 8px;
  }
  .cal-month {
    border-left: none;
    border-right: none;
    border-radius: 0;
  }
  .shopping-card {
    margin-left: 10px;
    margin-right: 10px;
  }

  /* Week view keeps 7 columns, like a phone calendar app */
  .cal-week-grid { grid-template-columns: 36px repeat(7, minmax(0, 1fr)); }
  .cal-week-wrap { border-left: none; border-right: none; border-radius: 0; }
  .cwm-head {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 2px 5px;
  }
  .cwm-label { font-size: 8px; letter-spacing: .05em; padding: 8px 4px; }
  .cwm-cell { padding: 5px 4px; gap: 4px; }
  .cwm-meal { min-height: 38px; }
  .cwm-chores, .cwm-other { min-height: 30px; padding: 5px 4px; }
  .cwm-pill { font-size: 10px; padding: 2px 6px; }
  .cal-week-grid .cal-span { margin: 0 -4px; min-height: 13px; font-size: 9px; padding: 1px 5px; }
  .cal-week-grid .cal-span.start { margin-left: 0; }
  .cal-week-grid .cal-span.end { margin-right: 0; }
  .cwm-plus svg { width: 12px; height: 12px; }
  .cal-day-name { font-size: 9px; letter-spacing: .05em; }
  .dn-full { display: none; }
  .dn-short { display: inline; }
  .cal-day-date { font-size: 14px; }

  .cal-week-grid .cal-item {
    font-size: 10px;
    line-height: 1.25;
    padding-left: 4px;
    overflow-wrap: break-word;
  }
  .cal-item-label { font-size: 8px; letter-spacing: .04em; margin-bottom: 0; }
  .slot-actions a { padding: 2px; margin: 0; line-height: 0; }
  .slot-actions svg { width: 11px; height: 11px; }
  .cal-week-grid .chore-actions { opacity: 1; }
  .chore-actions a { padding: 3px; margin: 0; }
  .chore-actions svg { width: 11px; height: 11px; }
  .note-delete-form button { opacity: .8; padding: 2px 6px; font-size: 13px; }
  .cal-week-grid .chore-check { font-size: 10px; gap: 4px; }
  .cal-week-grid .chore-check .chore-box { width: 11px; height: 11px; border-radius: 3px; }
  .cal-head, .cal-row { grid-template-columns: repeat(7, 1fr); }
  .cal-weeknum-col { display: none; }
  .cal-cell { min-height: 72px; padding: 5px; }
  /* Month cells collapse items to colored dots on small screens; the
     week view stays the interactive surface */
  .cal-cell .cal-item {
    display: inline-block;
    width: 6px;
    height: 6px;
    padding: 0;
    margin: 0 2px 2px 0;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    overflow: hidden;
  }
  .cal-cell .cal-item > * { display: none; }
  .cal-cell .cal-event { background: var(--crossed); }
  .cal-cell .cal-chore-line { background: var(--muted); }

  /* Week column items: compact but readable rows */
  .cal-week-grid .chore-item {
    flex-wrap: wrap;
    gap: 2px 4px;
    align-items: flex-start;
  }
  .cal-week-grid .chore-check { white-space: normal; }
  .cal-week-grid .chore-check .chore-label {
    white-space: normal;
    overflow-wrap: break-word;
  }
  .cal-week-grid .cal-note { padding-right: 14px; }
}

/* ---- "Lägg till" modal ---- */

.js-day { cursor: pointer; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.modal-backdrop[hidden] { display: none; }

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
  padding: 14px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.modal-head h3 {
  font-size: 19px;
  margin: 0;
}
#add_modal_date { text-transform: lowercase; }

.modal-seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.modal-seg[hidden] { display: none; }
.modal-seg button {
  flex: 1;
  padding: 8px 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.modal-seg button:hover { color: var(--text); }
.modal-seg button.active {
  background: var(--accent);
  color: var(--accent-fg);
}

.modal-panel form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
}
.modal-panel select,
.modal-panel input[type="text"] {
  margin: 0;
  padding: 8px 11px;
  font-size: 14px;
  height: auto;
}
.modal-panel .btn-accent {
  justify-content: center;
  padding: 9px 0;
  font-size: 14px;
  width: 100%;
  background: var(--accent);
  color: var(--accent-fg);
}
.modal-panel .btn-accent:hover { background: var(--accent-strong); }
.modal-hint {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

/* Notes ("annat") in the calendar */
.cal-note {
  color: var(--text);
  padding-left: 8px;
  border-left: 2px solid var(--ins);
}
.note-delete-form {
  display: inline;
  margin: 0;
}
.note-delete-form button {
  background: none;
  border: none;
  padding: 0 3px;
  margin: 0;
  width: auto;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity .15s;
}
.cal-note:hover .note-delete-form button { opacity: .8; }
.note-delete-form button:hover { color: var(--del); opacity: 1; }

@media (max-width: 860px) {
}

/* Assignee (DRI) tag on meals and chores */
.assignee {
  display: inline-block;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: 1px;
  white-space: nowrap;
}

/* Multi-day events: one continuous tinted bar across the covered days.
   Bars bleed through the cell padding so only the 1px cell border
   interrupts them; rounded only at the true start and end. */
.cal-span {
  display: block;
  flex: none;
  min-height: 20px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--text);
  background: var(--sel);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-span.spacer {
  background: transparent;
  pointer-events: none;
}
.cal-month .cal-span { margin: 2px -7px; }
.cal-span.start {
  border-start-start-radius: 7px;
  border-end-start-radius: 7px;
}
.cal-month .cal-span.start { margin-left: 0; }
.cal-span.end {
  border-start-end-radius: 7px;
  border-end-end-radius: 7px;
}
.cal-month .cal-span.end { margin-right: 0; }

/* Edit forms opened inside the generic form modal */
.modal-card-form {
  position: relative;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px;
}
.modal-card-form .modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}
#form_modal_body article {
  max-width: none !important;
  margin: 0 !important;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}
#form_modal_body article header h1 {
  font-size: 21px;
  margin: 0 0 4px;
  padding-right: 36px;
}

/* ---- Shopping list traceability ---- */

/* The shopping list is the diagram — let it use the whole window rather than
   the 1080px reading column the rest of the app sits in. */
#content-div:has(.trace-page) {
  max-width: none;
  padding: 24px 24px 48px;
}
.trace-page { width: 100%; }
.trace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.trace-header h1 { margin: 0 0 2px; }
.trace-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.trace-actions .btn-ghost, .trace-actions .btn-accent { margin: 0; width: auto; }
.trace-empty { color: var(--muted); }
.trace-note { color: var(--muted); font-size: 12px; margin: 0 0 8px; padding: 0 9px; }

.trace-group { margin-bottom: 14px; }
.trace-group-head {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 7px 9px 5px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3px;
  cursor: pointer;
  list-style: none;
  border-radius: 8px 8px 0 0;
}
.trace-group-head::-webkit-details-marker { display: none; }
.trace-group-head::after { display: none; }
.trace-group-head:hover { background: var(--chip); }
.trace-group-head > span { display: grid; gap: 1px; min-width: 0; }
.trace-group-head .trace-title { font-weight: 600; }
.trace-caret {
  flex: none;
  margin-top: 4px;
  color: var(--muted);
  transition: transform .15s ease;
}
.trace-group[open] .trace-caret { transform: rotate(90deg); }
.trace-focus .trace-group-head { opacity: .32; }
.trace-focus .trace-group-head.trace-on,
.trace-focus .trace-group[open] .trace-group-head { opacity: 1; }
.trace-focus .trace-group-head.trace-on { background: var(--chip); }

#product-preview {
  position: fixed;
  z-index: 200;
  display: none;
  gap: 12px;
  width: 280px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
  pointer-events: none;
}
#product-preview img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  flex: none;
  background: var(--bg);
  border-radius: 8px;
}
#product-preview .pp-body { display: grid; gap: 2px; align-content: start; min-width: 0; }
#product-preview .pp-name { font-size: 14px; line-height: 1.25; }
#product-preview .pp-meta { font-size: 11px; color: var(--muted); }
#product-preview .pp-price { font-size: 14px; color: var(--accent); margin-top: 2px; }
#product-preview .pp-link { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Confirmed present on the Willys list, traced back to the recipe line. */
.trace-item.in-list {
  border-left: 2px solid var(--ins);
  padding-left: 7px;
  background: color-mix(in srgb, var(--ins) 9%, transparent);
}
.trace-item.in-list .trace-title { color: var(--ins); font-weight: 500; }
.trace-focus .trace-item.in-list.trace-on { background: var(--chip); }

/* Pantry staples: shown, but a question rather than a purchase. */
.trace-base .trace-title { color: var(--muted); }
.base-ask {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 0 8px;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  vertical-align: 1px;
}
.base-ask input { margin: 0; width: 12px; height: 12px; }
.trace-base:has(.base-toggle:checked) .trace-title { color: var(--text); }

.wl-edit {
  display: none;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.trace-item:hover .wl-edit, .wl-edit:focus-within { display: flex; }
.wl-edit button {
  width: 20px; height: 20px; padding: 0; margin: 0;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface); color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer;
}
.wl-edit button:hover { color: var(--text); border-color: var(--muted); }
.wl-edit button.wl-del:hover { color: var(--del); border-color: var(--del); }
.wl-edit button:disabled { opacity: .4; cursor: wait; }
.wl-qty { font-size: 12px; color: var(--muted); min-width: 14px; text-align: center; }

.trace-flag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: -2px;
  color: var(--muted);
  cursor: help;
}
.trace-flag svg { display: block; }
.trace-flag.sev-warning { color: var(--del); }
.trace-item.flagged { background: color-mix(in srgb, var(--chip) 70%, transparent); }
.trace-flag-count {
  margin-left: 8px;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--del);
}

.trace-aisle {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 9px 3px;
}
.trace-col > .trace-aisle:first-of-type { padding-top: 2px; }
.trace-focus #product-preview {
  position: fixed;
  z-index: 200;
  display: none;
  gap: 12px;
  width: 280px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
  pointer-events: none;
}
#product-preview img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  flex: none;
  background: var(--bg);
  border-radius: 8px;
}
#product-preview .pp-body { display: grid; gap: 2px; align-content: start; min-width: 0; }
#product-preview .pp-name { font-size: 14px; line-height: 1.25; }
#product-preview .pp-meta { font-size: 11px; color: var(--muted); }
#product-preview .pp-price { font-size: 14px; color: var(--accent); margin-top: 2px; }
#product-preview .pp-link { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Confirmed present on the Willys list, traced back to the recipe line. */
.trace-item.in-list {
  border-left: 2px solid var(--ins);
  padding-left: 7px;
  background: color-mix(in srgb, var(--ins) 9%, transparent);
}
.trace-item.in-list .trace-title { color: var(--ins); font-weight: 500; }
.trace-focus .trace-item.in-list.trace-on { background: var(--chip); }

/* Pantry staples: shown, but a question rather than a purchase. */
.trace-base .trace-title { color: var(--muted); }
.base-ask {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 0 8px;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  vertical-align: 1px;
}
.base-ask input { margin: 0; width: 12px; height: 12px; }
.trace-base:has(.base-toggle:checked) .trace-title { color: var(--text); }

.wl-edit {
  display: none;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.trace-item:hover .wl-edit, .wl-edit:focus-within { display: flex; }
.wl-edit button {
  width: 20px; height: 20px; padding: 0; margin: 0;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface); color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer;
}
.wl-edit button:hover { color: var(--text); border-color: var(--muted); }
.wl-edit button.wl-del:hover { color: var(--del); border-color: var(--del); }
.wl-edit button:disabled { opacity: .4; cursor: wait; }
.wl-qty { font-size: 12px; color: var(--muted); min-width: 14px; text-align: center; }

.trace-flag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: -2px;
  color: var(--muted);
  cursor: help;
}
.trace-flag svg { display: block; }
.trace-flag.sev-warning { color: var(--del); }
.trace-item.flagged { background: color-mix(in srgb, var(--chip) 70%, transparent); }
.trace-flag-count {
  margin-left: 8px;
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--del);
}

.trace-aisle { opacity: .32; }

.trace-stale {
  font-size: 12px;
  color: var(--del);
  margin: 0 0 8px;
  padding: 0 9px;
}
.trace-line { margin-left: 10px; }

.trace-pick label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  cursor: pointer;
}
.trace-pick label > span { display: grid; gap: 1px; }
.trace-pick input { margin: 2px 0 0; flex: none; }

#trace-cart-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 0 9px;
}
#trace-cart-actions .btn-accent { margin: 0; width: auto; }

.trace {
  display: grid;
  grid-template-columns: 1fr 90px 1fr 90px 1fr;
  gap: 0;
  margin-top: 16px;
  align-items: start;
}
.trace-col { min-width: 0; }
.trace-col h4 {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.trace-item {
  display: grid;
  gap: 1px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.trace-title { font-size: 13px; line-height: 1.3; }
.trace-meta { font-size: 11px; color: var(--muted); }
.trace-qty { color: var(--muted); }
.trace-item-muted .trace-title { color: var(--muted); }
.trace-cart-empty { font-size: 13px; color: var(--muted); padding: 7px 9px; }

/* The gutters. Each SVG stretches to the tallest neighbouring column so the
   curve endpoints line up with the rows either side. */
.trace-links {
  width: 100%;
  height: 100%;
  min-height: 100%;
  align-self: stretch;
  overflow: visible;
}
.trace-links path {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.5;
  transition: stroke .12s ease, opacity .12s ease;
}

/* Focus mode: everything not on the hovered chain recedes. */
.trace-focus .trace-item { opacity: .32; }
.trace-focus .trace-item.trace-on {
  opacity: 1;
  background: var(--chip);
  border-color: var(--border);
}
.trace-focus .trace-links path { opacity: .18; }
.trace-focus .trace-links path.trace-on {
  opacity: 1;
  stroke: var(--accent);
  stroke-width: 2;
}

@media (max-width: 860px) {
  /* Curves between stacked columns would be meaningless, so the diagram
     degrades to three plain lists. */
  .trace { grid-template-columns: 1fr; gap: 18px; }
  .trace-links { display: none; }
}

/* ---- Willys cart ---- */

.willys-card { margin-top: 20px; }
.willys-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.willys-head h3 { font-size: 17px; margin: 0 0 3px; }
.willys-sub { color: var(--muted); font-size: 13px; margin: 0; }
.willys-note { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.willys-error { color: var(--del); font-size: 14px; margin: 12px 0 0; }
.willys-ok { color: var(--ins); font-size: 14px; margin: 12px 0 0; }

.willys-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}
.willys-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
}
.willys-list li + li { border-top: 1px solid var(--border); }
.willys-list input[type="checkbox"] { margin: 2px 0 0; flex: none; }
.willys-item {
  display: grid;
  gap: 1px;
  cursor: pointer;
  margin: 0;
}
.willys-name { font-size: 14px; }
.willys-meta { font-size: 12px; color: var(--muted); }
.willys-wanted { font-size: 12px; color: var(--crossed); }

.willys-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}
.willys-actions .btn-accent { margin: 0; width: auto; }
.willys-total { color: var(--muted); font-size: 13px; }

/* ---- Family members ---- */

.member-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.member-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}
.member-list li + li { border-top: 1px solid var(--border); }
.member-avatar {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--chip);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.member-name { flex: 1; }
.member-you {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--chip);
  border-radius: 999px;
  padding: 2px 8px;
}
.member-empty { color: var(--muted); font-size: 14px; }

/* ---- Chat panel refinements ---- */

.new-chat-btn {
  width: 100%;
  justify-content: center;
  margin: 10px 0;
}
.chat-input-container {
  background: var(--surface);
}

/* One step down from the page throughout the panel: it is a sidebar, and the
   default body size reads oversized in a 570px column. */
.chat-aside { font-size: 14px; }
.chat-aside .message { font-size: 14px; }
.chat-aside .chat-input-form input { font-size: 14px; }
.chat-aside .session-title,
.chat-aside .chat-sessions-empty { font-size: 13px; }
.chat-aside .chat-sessions-btn { font-size: 12px; }
.chat-aside .quick-action-btn { font-size: 13px; }
.chat-aside .menu-notes { font-size: 13px; }
.chat-aside .message-assistant ul { padding-left: 1.1rem; }

/* Weekly menu proposal, laid out like a menu template (day rows, meal-type
   slots) rather than a flat list -- same visual language as /menu-templates,
   compressed to fit the panel. */
.weekly-menu-suggestion .menu-days-proposal {
  border-radius: 12px;
  margin: 2px 0 10px;
}
.menu-days-proposal .menu-day {
  grid-template-columns: 74px 1fr;
  gap: 12px;
  padding: 10px 12px;
}
.menu-days-proposal .day-name {
  font-size: 14px;
  padding-top: 1px;
}
.menu-days-proposal .meals {
  grid-template-columns: repeat(var(--slot-cols, 1), minmax(0, 1fr));
  gap: 10px;
}
.menu-days-proposal .slot-label {
  font-size: 10px;
  margin-bottom: 2px;
}
.menu-days-proposal .slot-value { font-size: 13px; }
.menu-days-proposal .slot-empty { color: var(--crossed); }
.menu-days-proposal .meal-qty { color: var(--muted); }

/* Plus beside a suggestion: opens the normal add-meal dialog, prefilled. */
.slot-add {
  width: auto;
  margin: 0 0 0 5px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  opacity: .45;
  line-height: 0;
  vertical-align: -2px;
  cursor: pointer;
}
.slot-add:hover { opacity: 1; color: var(--accent); background: transparent; }
.slot-add svg { display: inline-block; }

/* A single-column proposal has no need for the meal-type label on every row. */
.menu-days-proposal[style*="--slot-cols:1"] .slot-label { display: none; }

@media (max-width: 860px) {
  .menu-days-proposal .menu-day { grid-template-columns: 1fr; gap: 4px; }
  .menu-days-proposal .meals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.chat-input-form input {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  padding: 10px 18px;
  height: auto;
  font-size: 15px;
}
.chat-input-form button {
  width: 42px;
  height: 42px;
  flex: none;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
#send-btn {
  background: var(--accent);
  color: var(--accent-fg);
}
#send-btn:hover { background: var(--accent-strong); }
#mic-btn {
  background: var(--chip);
  color: var(--muted);
}
#mic-btn:hover { color: var(--text); }

/* Mobile: multi-day spans stay thin connected bars */
@media (max-width: 860px) {
  .cal-span {
    min-height: 6px;
    padding: 0;
    font-size: 0;
  }
  .cal-month .cal-span { margin: 2px -5px; }
  .cal-month .cal-span.start { margin-left: 0; }
  .cal-month .cal-span.end { margin-right: 0; }
}

/* "Visa kopplad kalender" toggle */
html.hide-external .cal-event,
html.hide-external .cal-span { display: none !important; }
.menu-check {
  flex: none;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--muted);
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  color: var(--accent-fg);
}
.menu-check.on {
  background: var(--accent);
  border-color: var(--accent);
}

/* School lunch from skolmaten.se */
.cal-school {
  color: var(--muted);
  padding-left: 8px;
  border-left: 2px dotted var(--muted);
}
.cal-school-dish { margin-bottom: 2px; }
.cal-school-dish:last-child { margin-bottom: 0; }
html.hide-school .cal-school { display: none !important; }

/* Keep-screen-on switch on the recipe page */
.keep-screen-on-field {
  margin: 14px 0 0;
  padding: 0;
  border: none;
}
.keep-screen-on-field label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}

/* Collection add/edit formset rows */
.formset-heading {
  font-family: inherit;
  font-size: 12px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 20px 0 10px;
}
.formset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.formset-row select {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.formset-row input[type="number"] {
  width: 76px;
  flex: none;
  margin: 0;
}
.formset-delete {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--muted);
  cursor: pointer;
}
.formset-delete input[type="checkbox"] { margin: 0; }
.formset-delete:has(input:checked) { color: var(--del); }
.formset-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 20px;
}

/* ---- Recipe add/edit form ---- */

.recipe-form { max-width: 860px; margin: 0 auto; }
.recipe-form .menu-header { margin-bottom: 20px; }

.recipe-form-top {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.recipe-form-title { flex: 1; min-width: 240px; }
.recipe-form-visibility {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.recipe-form-visibility select { margin: 0; width: auto; padding: 8px 34px 8px 12px; height: auto; font-size: 14px; }

.recipe-form-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 720px) {
  .recipe-form-columns { grid-template-columns: 1fr; }
}
.recipe-form-columns small,
.recipe-form label > small:not(.error) {
  color: var(--muted);
}

/* Keyword chips (CheckboxSelectMultiple) */
.kw-choices > div,
.kw-choices div[id] {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.kw-choices label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.kw-choices label:hover { border-color: var(--accent); }
.kw-choices input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.kw-choices label:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.recipe-form-keywords { margin: 4px 0 20px; }
.recipe-form-image { margin: 0 0 8px; }
.recipe-form-preview {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

/* Recipe detail top bar: back link left, action icons right */
.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 26px;
}
.detail-topbar .detail-back { margin: 0; }
.detail-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Paired form fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
}

/* Meal quantity multiplier */
.meal-qty {
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.form-row-3 { grid-template-columns: 1fr 1fr 84px; }
@media (max-width: 560px) {
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}
.modal-qty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}
.modal-qty input {
  width: 76px;
  flex: none;
  margin: 0;
  padding: 6px 10px;
  height: auto;
  font-size: 14px;
}

/* Shopping list indicator in the week controls */
.cal-shop-indicator {
  position: relative;
  color: var(--accent);
}
.cal-shop-indicator .stale-dot {
  position: absolute;
  top: 5px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--del);
  border: 2px solid var(--bg);
  box-sizing: content-box;
}

.stale-notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--sel);
  color: var(--text);
  font-size: 14px;
}
