/* Recipe Goat theme — bright and cheerful to match the Twemoji icon
 * set: warm cream paper, vivid tangerine, sunny yellow, leaf green and
 * sky blue. Flat colors, big rounded corners, playful hover lifts.
 * Bootstrap still handles all layout and components; this file only
 * sets the palette, shapes and cheerful touches. */

:root {
  --goat-cream: #fff9f1;
  --goat-paper: #ffffff;
  --goat-sand: #ffe8c2;
  --goat-peach: #ffb74d;
  --goat-tang: #f76707;
  --goat-tang-deep: #e8590c;
  --goat-ink: #37474f;
  --goat-sun: #ffd43b;
  --goat-sun-deep: #fab005;
  --goat-sun-ink: #5c4800;
  --goat-leaf: #40c057;
  --goat-leaf-deep: #2f9e44;
  --goat-leaf-bright: #d3f9d8;
  --goat-berry: #ff6b6b;
  --goat-sky: #4dabf7;
  --goat-sky-ink: #0b3d5c;
}

/* Reserve scrollbar space so the header doesn't shift on pages tall
 * enough to scroll. */
html {
  scrollbar-gutter: stable;
}

body {
  background-color: var(--goat-cream);
  color: var(--goat-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: clip;
}

h1,
h2,
h3,
.card-title {
  color: var(--goat-ink);
  font-weight: 800;
  letter-spacing: -0.01em;
}

a {
  color: var(--goat-tang);
}

a:hover {
  color: var(--goat-tang-deep);
}

/* --- Navbar: light sandy bar, dark links, tangerine hover --- */
.navbar-goat {
  background-color: var(--goat-sand);
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.12);
}

.navbar-goat .navbar-brand,
.navbar-goat .nav-link {
  color: var(--goat-ink);
  font-weight: 700;
}

.navbar-goat .navbar-brand {
  margin-left: 2rem !important;
}

.navbar-goat .nav-link img {
  vertical-align: 0;
}

/* The badge sits outside the nav flow so the Shopping and Plan links keep
 * the same spacing as every other menu item. */
.navbar-goat .nav-link {
  position: relative;
}

.navbar-goat .cart-count-slot {
  display: inline;
}

.navbar-goat .cart-count-slot .badge {
  position: absolute;
  top: 0.125rem;
  right: -0.3rem;
  min-width: 1.4rem;
  font-size: 0.65rem;
}

/* Optional back arrow in the menu bar (per-page via navbar_back block):
 * absolute left so the brand keeps its slot; the offset aligns the arrow
 * with the container content while the brand's ms-4 keeps its position. */
.navbar-goat .navbar-back {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #000;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 0.75rem;
  background-color: transparent;
  -webkit-tap-highlight-color: transparent;
}

.navbar-goat .navbar-back:hover,
.navbar-goat .navbar-back:focus,
.navbar-goat .navbar-back:active {
  color: #000;
  text-decoration: none;
  background-color: transparent;
}

.navbar-goat .navbar-back:focus-visible {
  outline: 2px solid var(--goat-tang);
  outline-offset: 2px;
}

.navbar-goat .navbar-back img {
  display: block;
  width: 24px;
  height: 24px;
}

/* Profile photo on the right of the mobile menu bar; it links to Account. */
.navbar-goat .navbar-profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background-color: var(--goat-paper);
  text-decoration: none;
}

.navbar-goat .navbar-profile img {
  display: block;
  width: 2rem;
  height: 2rem;
  object-fit: cover;
  border-radius: 50%;
}

.navbar-goat .navbar-profile:focus-visible {
  outline: 2px solid var(--goat-tang);
  outline-offset: 2px;
}

.navbar-goat .navbar-profile:hover img,
.navbar-goat .navbar-profile:focus img {
  box-shadow: 0 0 0 2px var(--goat-tang);
}

.navbar-goat .nav-link:hover,
.navbar-goat .nav-link:focus {
  color: var(--goat-tang-deep);
}

/* --- Cards: white surface, peachy outline, big rounded corners --- */
.card {
  background-color: var(--goat-paper);
  border: 2px solid var(--goat-peach);
  border-radius: 1.25rem;
}

main .bg-light {
  background-color: var(--goat-sand) !important;
  border: 2px solid var(--goat-peach);
}

/* --- Recipe tiles: border brightens on hover --- */
#recent-list .card:hover,
#search-results .card:hover {
  border-color: var(--goat-tang);
}

/* --- Cook mode: highlight ingredients + amounts in the instructions --- */
.cook-body strong {
  font-weight: 800;
}

/* --- Cook mode: breathing room between instruction steps --- */
.cook-body ol li {
  margin-bottom: 0.25rem;
}

/* --- Recipe grid tiles: compact titles and tag pills --- */
#recent-list .card .fw-bold,
#search-results .card .fw-bold,
#favourites-list .card .fw-bold {
  font-size: 0.875rem;
}

.recent-recipes-card {
  position: relative;
}

/* Home section headings sit above their cards rather than on the border. */
main > .recent-card-title {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

/* Heading row with a trailing action, e.g. Recent recipes and View all. */
.home-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.home-section-heading .recent-card-title {
  margin-bottom: 0;
  font-weight: 700;
}

.home-view-all {
  background: none;
  border: 0;
  padding: 0;
  color: var(--goat-tang);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
}

.home-view-all:hover,
.home-view-all:focus {
  color: var(--goat-tang-deep);
  text-decoration: none;
}

a.home-view-all::after {
  content: "›";
  margin-left: 0.25rem;
}

/* Tags heading action: orange outline pill. */
.home-edit-tags {
  background: none;
  border: 2px solid var(--goat-tang);
  border-radius: 999px;
  color: var(--goat-tang);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 0.1rem 0.75rem;
  text-decoration: none;
}

.home-edit-tags:hover,
.home-edit-tags:focus {
  border-color: var(--goat-tang-deep);
  color: var(--goat-tang-deep);
  text-decoration: none;
}

/* The first section on the home page starts closer to the navbar. */
main > .home-section-heading:first-child {
  margin-top: 0.5rem;
}

/* app.js repaints the localStorage mirror before the network reply. Hide
 * the static skeleton shimmer until it does, while the hidden placeholders
 * keep the cards' height so the page does not collapse and jump. */
.has-recent-cache #recent-list .placeholder,
.has-recent-cache #favourites-list .placeholder {
  visibility: hidden;
}

#recent-list .card .card-body,
#search-results .card .card-body,
#favourites-list .card .card-body {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

#recent-list .card .badge,
#search-results .card .badge,
#favourites-list .card .badge {
  font-size: 0.65rem;
}

/* --- Small screens: larger readable text (Bootstrap scales in rem,
 * so lifting the root size grows body text, buttons and tiles too) --- */
@media (max-width: 576px) {
  html {
    font-size: 125%;
  }
}

#recent-list .card:hover,
#search-results .card:hover {
  border-color: var(--goat-tang);
}

/* --- Buttons: sunny primary, leafy success --- */
.btn-primary {
  background-color: var(--goat-sun);
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
  font-weight: 700;
  /* Bootstrap 5.3 derives every interactive state from these variables,
   * so override them all: no blue may survive in any state. */
  --bs-btn-bg: var(--goat-sun);
  --bs-btn-border-color: var(--goat-sun-deep);
  --bs-btn-color: var(--goat-sun-ink);
  --bs-btn-hover-bg: #ffe066;
  --bs-btn-hover-border-color: var(--goat-sun-deep);
  --bs-btn-hover-color: var(--goat-sun-ink);
  --bs-btn-focus-shadow-rgb: 250, 176, 5;
  --bs-btn-active-bg: var(--goat-sun-deep);
  --bs-btn-active-border-color: var(--goat-sun-deep);
  --bs-btn-active-color: var(--goat-sun-ink);
  --bs-btn-active-shadow: none;
  --bs-btn-disabled-bg: var(--goat-sun);
  --bs-btn-disabled-border-color: var(--goat-sun-deep);
  --bs-btn-disabled-color: var(--goat-sun-ink);
}

.btn-primary:hover {
  background-color: #ffe066;
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
}

.btn-primary:focus {
  background-color: #ffe066;
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
  box-shadow: 0 0 0 0.25rem rgba(250, 176, 5, 0.35);
}

.btn-primary:active,
.btn-primary.active,
.btn-primary:focus-visible {
  background-color: var(--goat-sun-deep);
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
}

.btn-primary:disabled {
  background-color: var(--goat-sun);
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
}

.btn-success {
  background-color: var(--goat-leaf);
  border-color: var(--goat-leaf-deep);
  font-weight: 700;
}

.btn-success:hover,
.btn-success:focus {
  background-color: #51cf66;
  border-color: var(--goat-leaf-deep);
}

/* --- Credit pack colours: sky blue for 200, sunny yellow for 500 --- */
.btn-credit-blue,
.btn-credit-yellow {
  font-weight: 700;
}

.btn-credit-blue {
  background-color: var(--goat-sky);
  border-color: #339af0;
  color: var(--goat-sky-ink);
  --bs-btn-bg: var(--goat-sky);
  --bs-btn-border-color: #339af0;
  --bs-btn-color: var(--goat-sky-ink);
  --bs-btn-hover-bg: #74c0fc;
  --bs-btn-hover-border-color: #339af0;
  --bs-btn-hover-color: var(--goat-sky-ink);
  --bs-btn-focus-shadow-rgb: 77, 171, 247;
  --bs-btn-active-bg: #339af0;
  --bs-btn-active-border-color: #1c7ed6;
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-shadow: none;
  --bs-btn-disabled-bg: var(--goat-sky);
  --bs-btn-disabled-border-color: #339af0;
  --bs-btn-disabled-color: var(--goat-sky-ink);
}

.btn-credit-yellow {
  background-color: var(--goat-sun);
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
  --bs-btn-bg: var(--goat-sun);
  --bs-btn-border-color: var(--goat-sun-deep);
  --bs-btn-color: var(--goat-sun-ink);
  --bs-btn-hover-bg: #ffe066;
  --bs-btn-hover-border-color: var(--goat-sun-deep);
  --bs-btn-hover-color: var(--goat-sun-ink);
  --bs-btn-focus-shadow-rgb: 250, 176, 5;
  --bs-btn-active-bg: var(--goat-sun-deep);
  --bs-btn-active-border-color: var(--goat-sun-deep);
  --bs-btn-active-color: var(--goat-sun-ink);
  --bs-btn-active-shadow: none;
  --bs-btn-disabled-bg: var(--goat-sun);
  --bs-btn-disabled-border-color: var(--goat-sun-deep);
  --bs-btn-disabled-color: var(--goat-sun-ink);
}

/* --- Profile credit packs: three equal-width buy buttons --- */
.credit-pack-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (max-width: 575.98px) {
  .credit-pack-options {
    grid-template-columns: 1fr;
  }
}

.btn-link {
  color: var(--goat-tang);
  font-weight: 600;
}

/* --- Outline buttons in theme tangerine: white surface, tangerine frame --- */
.btn.btn-outline-goat {
  background-color: #ffffff;
  border: 2px solid var(--goat-tang);
  color: var(--goat-tang-deep);
  font-weight: 700;
}

.btn.btn-outline-goat:hover,
.btn.btn-outline-goat:focus {
  background-color: var(--goat-tang);
  border-color: var(--goat-tang-deep);
  color: #ffffff;
}

/* --- Forms: sunny focus ring --- */
.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
  border-color: var(--goat-sun);
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(255, 212, 59, 0.35);
}

.form-select {
  accent-color: var(--goat-sun);
}

.form-select option:checked,
.form-select option:hover,
.form-select option:focus {
  background-color: var(--goat-sun);
  color: var(--goat-sun-ink);
}

.form-check-input:checked {
  background-color: var(--goat-leaf);
  border-color: var(--goat-leaf-deep);
}

/* --- Search tag filter modal: body scrolls, header/footer stay put --- */
#search-tags-modal .modal-content {
  max-height: calc(100vh - var(--bs-modal-margin) * 2);
  max-height: calc(100dvh - var(--bs-modal-margin) * 2);
  overflow: hidden;
}

#search-tags-modal .modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* --- Tag manager: bolder checkbox outlines when unchecked --- */
#tags-modal .form-check-input:not(:checked) {
  border-width: 2px;
}

/* Keep the recipe-tag modal on screen; its body scrolls above the footer. */
#tags-modal .modal-content {
  max-height: calc(100vh - var(--bs-modal-margin) * 2);
  max-height: calc(100dvh - var(--bs-modal-margin) * 2);
  overflow: hidden;
}

#tags-modal .modal-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* --- Tag library modal: keep controls visible while the tags scroll --- */
#library-modal .modal-content {
  max-height: calc(100vh - var(--bs-modal-margin) * 2);
  max-height: calc(100dvh - var(--bs-modal-margin) * 2);
}

#library-modal .modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#library-modal .library-modal-tags {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
}

/* --- Tag manager: colour square beside each library tag name --- */
.tag-color-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  background-color: var(--goat-peach);
  display: inline-block;
  flex-shrink: 0;
}

/* --- Search tag dropdown: bolder checkbox outlines when unchecked --- */
#search-tags .form-check-input:not(:checked) {
  border-width: 2px;
}

/* --- Feedback components in palette --- */
.progress-bar {
  background-color: var(--goat-leaf);
}

.alert-warning {
  border-width: 2px;
}

.badge.text-bg-secondary {
  background-color: var(--goat-sky) !important;
  color: var(--goat-sky-ink) !important;
}

/* --- Modals: rounded white with a tangerine frame --- */
.modal-content {
  background-color: var(--goat-paper);
  border: 3px solid var(--goat-tang);
  border-radius: 1.25rem;
}

.modal-header {
  border-bottom: 2px solid var(--goat-peach);
}

.modal-footer {
  border-top: 2px solid var(--goat-peach);
}

/* --- First-run setup modal: folder + starter-doc progress --- */
.progress-modal-content {
  overflow: hidden;
}

.progress-goat {
  animation: progress-goat-bob 1.6s ease-in-out infinite;
  filter: drop-shadow(0 0.35rem 0.5rem rgba(0, 0, 0, 0.18));
}

@keyframes progress-goat-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }

  50% {
    transform: translateY(-0.45rem) rotate(4deg);
  }
}

.progress-steps {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: 22rem;
  margin: 0 auto;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #8d6e63;
  font-size: 0.95rem;
  line-height: 1.3;
}

.progress-step.is-active {
  color: var(--goat-ink);
  font-weight: 700;
}

.progress-step-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--goat-peach);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
}

.progress-step.is-active .progress-step-icon {
  border-color: var(--goat-tang);
  border-right-color: transparent;
  animation: progress-step-spin 0.7s linear infinite;
}

.progress-step.is-done .progress-step-icon {
  border-color: var(--goat-leaf-deep);
  background-color: var(--goat-leaf-deep);
  color: #ffffff;
}

.progress-step.is-done .progress-step-icon::after {
  content: "✓";
}

@keyframes progress-step-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-goat {
    animation: none;
  }

  .progress-step.is-active .progress-step-icon {
    animation: none;
    border-right-color: var(--goat-tang);
  }
}

/* --- Floating add-recipe button: fixed circular plus, menu opens above --- */
.add-recipe-fab {
  position: fixed;
  right: 2.5rem;
  bottom: 2.5rem;
  /* Above the offcanvas backdrop (1040) so the button keeps its colour
   * while a sheet slides up, but below the sheet itself (1045), modals
   * and page content that should cover it. */
  z-index: 1042;
}

.add-recipe-fab-btn {
  /* Bootstrap's .btn resolves hover/active/focus colours from these
   * variables; without them the plain .btn falls back to transparent. */
  --bs-btn-bg: var(--goat-sun);
  --bs-btn-color: var(--goat-sun-ink);
  --bs-btn-border-color: var(--goat-sun-deep);
  --bs-btn-hover-bg: #ffe066;
  --bs-btn-hover-color: var(--goat-sun-ink);
  --bs-btn-hover-border-color: var(--goat-sun-deep);
  --bs-btn-active-bg: var(--goat-sun);
  --bs-btn-active-color: var(--goat-sun-ink);
  --bs-btn-active-border-color: var(--goat-sun-deep);
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 50%;
  border: 2px solid var(--goat-sun-deep);
  background-color: var(--goat-sun);
  color: var(--goat-sun-ink);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 0.25rem;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.25);
}

.add-recipe-fab-btn:hover,
.add-recipe-fab-btn:focus,
.add-recipe-fab-btn:active {
  background-color: #ffe066;
  color: var(--goat-sun-ink);
}

.add-recipe-fab-btn:active {
  background-color: var(--goat-sun);
}

.navbar-goat .nav-link[aria-current="page"] {
  color: var(--goat-tang-deep);
  font-weight: 800;
}

/* --- Mobile bottom tab bar: visible only below the md breakpoint
 * (paired with d-md-none in base.html) --- */
.mobile-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  display: flex;
  background-color: var(--goat-paper);
  border-top: 2px solid var(--goat-peach);
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-tabbar a {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.25rem;
  color: var(--goat-ink);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.mobile-tabbar a:hover,
.mobile-tabbar a:focus,
.mobile-tabbar a.active {
  color: var(--goat-tang-deep);
}

.mobile-tabbar #cart-count-mobile {
  margin-top: 0.15rem;
}

@media (max-width: 767.98px) {
  /* Keep page content and the add-recipe button clear of the tab bar. */
  body {
    padding-bottom: 4.5rem;
  }

  .add-recipe-fab {
    bottom: 5.5rem;
    right: 1.5rem;
  }
}

/* --- Dropdown menus: white surface, peachy frame, rounded like cards --- */
.dropdown-menu {
  background-color: var(--goat-paper);
  border: 2px solid var(--goat-peach);
  border-radius: 1rem;
}

.dropdown-item {
  color: var(--goat-ink);
  font-weight: 600;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--goat-sand);
  color: var(--goat-tang-deep);
}

/* Combo-box menus highlight on hover/focus. The selected option is marked
   with a check mark instead of a background colour. */
.combo-menu .dropdown-item:hover,
.combo-menu .dropdown-item:focus,
.combo-menu .dropdown-item.active:hover,
.combo-menu .dropdown-item.active:focus {
  background-color: #f5f5f5;
  color: var(--goat-ink);
}

.combo-menu .dropdown-item.active {
  background-color: transparent;
  color: var(--goat-ink);
}

/* Combo-box toggle field matches its menu: very light gray on hover/focus. */
.combo-toggle:hover,
.combo-toggle:focus,
.combo-toggle:focus-visible,
.combo-toggle.show {
  background-color: #f5f5f5;
  color: var(--goat-ink);
}

/* Combo-box toggles get the same sunny focus ring as form fields. */
.combo-toggle:focus,
.combo-toggle:focus-visible {
  border-color: var(--goat-sun);
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(255, 212, 59, 0.35);
}

/* Selected combo-box option shows a check mark on the right. */
.combo-item-label,
.plan-picker-label {
  overflow-wrap: anywhere;
}

.combo-check {
  flex: 0 0 auto;
  visibility: hidden;
}

.dropdown-item.active .combo-check,
.plan-picker-result.is-selected .combo-check {
  visibility: visible;
}

/* --- Popup menus: slightly larger item text --- */
.dropdown-menu .dropdown-item {
  font-size: 1.125rem;
}

/* --- Ghost round buttons: transparent until hovered --- */
.btn-ghost-round {
  background-color: transparent;
  border-color: transparent;
  color: var(--goat-ink);
}
.btn-ghost-round:hover,
.btn-ghost-round:focus {
  background-color: var(--goat-sand);
  border-color: var(--goat-peach);
  color: var(--goat-tang-deep);
}

/* --- Bottom sheets: grabber hint for swipe-to-dismiss --- */
.sheet-grabber {
  width: 3rem;
  height: 0.3rem;
  border-radius: 999px;
  background-color: var(--goat-peach);
  margin: 0.35rem auto 0.75rem;
}

/* A sheet too tall for the viewport scrolls normally; its grabber is the
   swipe-to-dismiss target. */
.offcanvas-swipe-grabber-only .sheet-grabber {
  touch-action: none;
}

/* --- Bottom sheets: rounded top corners to match the cards --- */
.offcanvas.offcanvas-bottom {
  border-top-left-radius: 1.25rem;
  border-top-right-radius: 1.25rem;
  border-top: 2px solid var(--goat-tang);
}

/* Fixed icon column so every option label starts at the same x, whatever
   the emoji or star glyph renders as. */
.sheet-option-icon {
  display: inline-block;
  width: 2rem;
  text-align: center;
}

/* --- View page pill buttons: light yellow sun tint --- */
.btn-sun-pill {
  background-color: #ffe066;
  border: 1px solid var(--goat-sun-deep);
  color: var(--goat-sun-ink);
  --bs-btn-focus-shadow-rgb: 247, 103, 7;
  --bs-btn-active-bg: var(--goat-tang);
  --bs-btn-active-border-color: var(--goat-tang-deep);
  --bs-btn-active-color: #ffffff;
  --bs-btn-active-shadow: none;
}

.btn-sun-pill:hover {
  background-color: var(--goat-sun);
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
}

.btn-sun-pill:focus {
  background-color: var(--goat-sun);
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
  box-shadow: 0 0 0 0.25rem rgba(247, 103, 7, 0.35);
}

.btn-sun-pill:active {
  background-color: var(--goat-tang);
  border-color: var(--goat-tang-deep);
  color: #ffffff;
}

/* --- Cook mode: full-screen overlay with an app-style bottom menu --- */
#cook-overlay {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background-color: var(--goat-cream);
  overflow-y: auto;
  padding: 1rem 1rem calc(7rem + env(safe-area-inset-bottom));
  touch-action: pan-y;
}

#cook-overlay-inner {
  max-width: 48rem;
  margin: 0 auto;
}

.cook-empty {
  margin-bottom: 0;
  color: #8d6e63;
}

#cook-views {
  overflow-x: hidden;
  touch-action: pan-y;
}

.cook-view.cook-view-enter-right {
  animation: cook-view-enter-right 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cook-view.cook-view-enter-left {
  animation: cook-view-enter-left 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes cook-view-enter-right {
  from {
    opacity: 0.35;
    transform: translateX(2rem);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes cook-view-enter-left {
  from {
    opacity: 0.35;
    transform: translateX(-2rem);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cook-view.cook-view-enter-left,
  .cook-view.cook-view-enter-right {
    animation: none;
  }
}

#cook-tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1046;
  background-color: var(--goat-paper);
  border-top: 2px solid var(--goat-peach);
  padding-bottom: env(safe-area-inset-bottom);
}

.cook-tabbar-inner {
  display: flex;
  align-items: stretch;
  max-width: 48rem;
  margin: 0 auto;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: 0.35rem;
}

.cook-tabbar-tabs {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
}

.cook-tab {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  min-width: 0;
  padding: 0.45rem 0.2rem;
  border: 0;
  background: transparent;
  color: var(--goat-ink);
  font-size: 0.7rem;
  font-weight: 700;
}

.cook-tab:focus-visible,
.cook-tab.active {
  color: var(--goat-tang-deep);
}

/* Sticky hover can leave the previously tapped tab highlighted on touch
 * screens, so only apply hover styling to devices with a real pointer. */
@media (hover: hover) and (pointer: fine) {
  .cook-tab:hover {
    color: var(--goat-tang-deep);
  }
}

.cook-tab:disabled {
  opacity: 0.45;
}

.cook-tab-icon {
  position: relative;
  display: inline-flex;
}

.cook-tab-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.35rem;
  width: 2rem;
  height: 2px;
  border-radius: 999px;
  background-color: transparent;
  transform: translateX(-50%);
  transition: background-color 0.15s ease;
}

.cook-tab.active .cook-tab-icon::after {
  background-color: var(--goat-tang);
}

.cook-tab-icon img {
  width: 32px;
  height: 32px;
}

.cook-tab-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.65rem;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.22rem;
  border-radius: 999px;
  background-color: var(--goat-tang);
  color: #ffffff;
  font-size: 0.65rem;
  line-height: 1.15rem;
  text-align: center;
}

.cook-tab-badge.is-done {
  background-color: var(--goat-leaf-deep);
  animation: cook-timer-flash 1s ease-in-out 3;
}

.cook-tab.cook-tab-attention {
  animation: cook-tab-attention 0.8s ease;
}

@keyframes cook-tab-attention {
  50% {
    background-color: var(--goat-sand);
  }
}

.cook-tabbar-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.6rem;
  border-left: 1px solid var(--goat-peach);
}

.cook-wake-toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.75rem;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.cook-wake-toggle .form-check-input {
  flex: 0 0 auto;
  margin: 0;
}

.cook-wake-label {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  white-space: nowrap;
}

.cook-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--goat-ink);
  font-size: 2.5rem;
  line-height: 1;
}

.cook-close-btn:hover,
.cook-close-btn:focus-visible {
  background-color: var(--goat-sand);
}

@media (max-width: 400px) {
  .cook-tabbar-tools {
    gap: 0.2rem;
    padding: 0 0.35rem;
  }

  .cook-wake-label {
    display: none;
  }
}

.cook-timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0 0.1rem;
  padding: 0 0.45rem;
  border: 2px solid var(--goat-peach);
  border-radius: 999px;
  background-color: var(--goat-sand);
  color: var(--goat-ink);
  font-size: 0.85em;
  font-weight: 800;
  line-height: 1.7;
  vertical-align: baseline;
  cursor: pointer;
}

.cook-timer-chip:hover,
.cook-timer-chip:focus-visible {
  background-color: var(--goat-sun);
  border-color: var(--goat-sun-deep);
}

.cook-timer-chip:active {
  transform: translateY(1px);
}

#cook-timer-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cook-timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 1rem;
  background-color: var(--goat-ink);
  color: #ffffff;
}

.cook-timer-info {
  min-width: 0;
}

.cook-timer-label {
  display: block;
  overflow: hidden;
  color: var(--goat-sand);
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cook-timer-time {
  display: block;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.15;
}

.cook-timer-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.cook-timer.is-done {
  background-color: var(--goat-leaf-deep);
  cursor: pointer;
  animation: cook-timer-flash 1s ease-in-out 3;
}

@keyframes cook-timer-flash {
  50% {
    background-color: var(--goat-leaf);
  }
}

@media (max-width: 575.98px) {
  .cook-timer {
    align-items: flex-start;
    flex-direction: column;
  }

  .cook-timer-actions {
    width: 100%;
  }
}

.cook-body ol {
  list-style-position: inside;
  padding-left: 0;
}

.cook-body ol li {
  cursor: pointer;
  padding: 0.5rem 0.9rem;
  border-radius: 1rem;
  border: 2px solid transparent;
  font-size: 1.15rem;
  line-height: 1.5;
}

.cook-body ul li {
  font-size: 1.15rem;
  line-height: 1.5;
}

.cook-body ul.cook-ingredients {
  list-style: none !important;
  padding-left: 0;
}

.cook-body ul.cook-ingredients > li {
  display: flex;
  align-items: flex-start;
  list-style: none;
  margin-bottom: 0.6rem;
}

.cook-body ul.cook-ingredients > li:last-child {
  margin-bottom: 0;
}

.cook-body ul.cook-ingredients .form-check-input {
  width: 1.25em;
  height: 1.25em;
  border: 2px solid var(--goat-ink);
  flex: 0 0 auto;
}

.cook-body ul.cook-ingredients .cook-ingredient-label {
  display: flex;
  align-items: flex-start;
  width: 100%;
  cursor: pointer;
}

#tags-modal-library {
  margin-left: 1rem;
}

#tags-modal .offcanvas-body {
  padding-bottom: 2rem;
}

.cook-body ul.cook-ingredients li.cook-ingredient-done {
  text-decoration: line-through;
}

/* --- Shopping list check-off rows --- */
#shopping-groups .list-group-item,
.shared-shopping-list .list-group-item {
  padding-left: 0;
}

#shopping-groups .shopping-item-check,
.shared-shopping-list .shopping-item-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
  cursor: pointer;
}

#shopping-groups .shopping-item-check .form-check-input,
.shared-shopping-list .shopping-item-check .form-check-input {
  width: 1.25em;
  height: 1.25em;
  margin-top: 0.1rem;
  border: 2px solid var(--goat-ink);
  flex: 0 0 auto;
}

#shopping-groups .shopping-item-text,
.shared-shopping-list .shopping-item-text {
  overflow-wrap: anywhere;
}

#shopping-groups .shopping-item-done {
  text-decoration: line-through;
  color: #8d6e63;
}

/* Shared links have no server-side state, so cross items out from the
 * checkbox itself rather than a JS-applied class. */
.shared-shopping-list .form-check-input:checked + .shopping-item-text {
  text-decoration: line-through;
  color: #8d6e63;
}

.shopping-list-card {
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.shopping-shared-icon {
  font-size: 1rem;
  line-height: 1;
  text-decoration: none;
}

.shopping-shared-icon-card {
  position: relative;
  z-index: 2;
}

.shopping-list-card:hover,
.shopping-list-card:focus-visible {
  border-color: var(--goat-tang);
  transform: translateY(-1px);
}

.cook-body h2,
.cook-body .cook-section-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: underline;
}

/* A little more air above the "Instructions" (and later) section titles. */
.cook-body h2:not(:first-child),
.cook-body .cook-section-title:not(:first-child) {
  margin-top: 1.5rem;
}

.cook-body ol li:hover {
  border-color: var(--goat-peach);
}

/* --- Public landing page (signed-out home): funky AI startup --- */
.landing-install-corner {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  z-index: 1;
}

.landing-hero {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-top: -1.5rem;
  margin-bottom: 2.5rem;
  padding: 4rem 1.5rem;
  background: linear-gradient(135deg, #ffd43b 0%, #ffa94d 45%, #ff8787 100%);
  border-radius: 0;
  border: none;
  position: relative;
  overflow: hidden;
}

.landing-badge {
  display: inline-block;
  background-color: #ffffff;
  border: 2px solid var(--goat-ink);
  border-radius: 999px;
  padding: 0.25rem 0.9rem;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--goat-ink);
}

/* Self-hosted OpenMoji icons inside badges and headings. */
.landing-badge-icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  margin-right: 0.2rem;
}

/* Hero logo: scales with the viewport and pulls in the SVG's own
 * whitespace so the wordmark sits snug against the goat. */
.landing-logo-img {
  --landing-logo: clamp(52px, 13vw, 80px);
  height: var(--landing-logo);
  width: auto;
  margin-left: calc(var(--landing-logo) * -0.45);
  margin-right: calc(var(--landing-logo) * -0.25);
}

.landing-cta {
  position: relative;
  overflow: hidden;
}

.landing-cta::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 45%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: skewX(-18deg);
  animation: landing-cta-shine 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes landing-cta-shine {
  0%,
  58% {
    left: -80%;
  }

  76%,
  100% {
    left: 130%;
  }
}

.landing-art {
  position: relative;
  max-width: 22rem;
  margin: 0 auto;
}

.landing-art-main {
  width: 100%;
  height: auto;
  display: block;
  /* OpenMoji art is square; reserving the ratio avoids a layout shift
   * while the SVG decodes. */
  aspect-ratio: 1;
  filter: drop-shadow(0 1rem 1rem rgba(0, 0, 0, 0.2));
}

.landing-art-float {
  position: absolute;
  height: auto;
  animation: goat-float 3.5s ease-in-out infinite;
}

.landing-art-float-1 {
  width: 4rem;
  top: 0;
  left: 0;
}

.landing-art-float-2 {
  width: 5rem;
  bottom: 8%;
  right: 0;
  animation-delay: 0.7s;
}

.landing-art-float-3 {
  width: 3.5rem;
  top: 22%;
  right: 10%;
  animation-delay: 1.4s;
}

@keyframes goat-float {
  0%,
  100% {
    transform: translateY(0) rotate(-5deg);
  }

  50% {
    transform: translateY(-0.8rem) rotate(5deg);
  }
}

/* --- Landing: upbeat feature cards --- */

#features .card {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

#features .card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background-color: var(--landing-accent, var(--goat-sun));
}

#features .col:nth-child(6n + 1) .card {
  --landing-accent: var(--goat-tang);
}

#features .col:nth-child(6n + 2) .card {
  --landing-accent: var(--goat-sun);
}

#features .col:nth-child(6n + 3) .card {
  --landing-accent: var(--goat-leaf);
}

#features .col:nth-child(6n + 4) .card {
  --landing-accent: var(--goat-sky);
}

#features .col:nth-child(6n + 5) .card {
  --landing-accent: var(--goat-berry);
}

#features .col:nth-child(6n) .card {
  --landing-accent: var(--goat-peach);
}

#features .card img {
  width: 4.5rem;
  height: 4.5rem;
  padding: 0.45rem;
  border-radius: 50%;
  background-color: var(--goat-cream);
  box-shadow: 0 0 0 2px var(--landing-accent, var(--goat-sun));
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (hover: hover) and (pointer: fine) {
  #features .card:hover {
    transform: translateY(-1px) rotate(-0.6deg);
    border-color: var(--landing-accent, var(--goat-sun));
    box-shadow: 0 14px 28px rgba(55, 71, 79, 0.16);
  }

  #features .col:nth-child(even) .card:hover {
    transform: translateY(-1px) rotate(0.6deg);
  }

  #features .card:hover img {
    transform: rotate(-8deg) scale(1.08);
  }
}

@keyframes landing-reveal {
  from {
    opacity: 0;
    translate: 0 2rem;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    #features .col,
    .landing-privacy {
      animation: landing-reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 22%;
    }
  }
}

.landing-privacy {
  background-color: var(--goat-paper);
  border: 2px solid var(--goat-peach);
  border-radius: 1.25rem;
  padding: 1.75rem;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.landing-privacy .col-md-3 img {
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (hover: hover) and (pointer: fine) {
  .landing-privacy:hover {
    transform: translateY(-1px);
    border-color: var(--goat-sun-deep);
    box-shadow: 0 14px 30px rgba(55, 71, 79, 0.14);
  }

  .landing-privacy:hover .col-md-3 img {
    transform: rotate(-6deg) scale(1.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing-art-float,
  .landing-cta::after {
    animation: none;
  }

  #features .card:hover,
  #features .card:hover img,
  .landing-privacy:hover,
  .landing-privacy:hover .col-md-3 img {
    transform: none;
  }
}

.cook-body ol li.cook-active {
  background-color: var(--goat-sun);
  border-color: var(--goat-sun-deep);
  color: var(--goat-sun-ink);
}

/* --- Recipe draft screen: plain-text body --- */
#recipe-editor {
  background-color: #ffffff;
  min-height: 16rem;
  height: auto;
  overflow-y: auto;
  padding: 0.75rem;
}

#recipe-editor:focus {
  border-color: var(--goat-sun);
  box-shadow: 0 0 0 0.25rem rgba(255, 212, 59, 0.35);
  outline: 0;
}

#recipe-editor:empty:before {
  content: "Type or paste recipe...";
  color: #868e96;
}

#recipe-preview {
  background-color: #ffffff;
  min-height: 16rem;
  max-height: min(40rem, 65vh);
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: var(--bs-border-radius, 0.375rem);
}

/* Draft screen: the card fills the viewport; the body scrolls between the
 * title and the action row, and the buttons stay inside the card. */
#edit-form {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 10rem);
  height: calc(100dvh - 10rem);
  min-height: 20rem;
}

.edit-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#recipe-editor,
#recipe-preview {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

#recipe-preview {
  max-height: none;
}

#recipe-editor {
  resize: none;
  font-family: var(--bs-font-monospace, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.95rem;
  line-height: 1.5;
  background-color: #ffffff;
}

.edit-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  background-color: var(--bs-body-bg, #fff);
  padding: 0.75rem 0 0;
}

@media (max-width: 767.98px) {
  #edit-form {
    /* Leave room for the fixed mobile tab bar. */
    height: calc(100vh - 14rem - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - 14rem - env(safe-area-inset-bottom, 0px));
  }
}

/* --- Shared recipe typography: cook mode and view render identically ---
 *
 * Cook mode and the recipe view both render sanitized recipe HTML, so they
 * share one rhythm class instead of per-container overrides (which kept
 * drifting apart). Vertical margins collapse rather than add, so a
 * heading after a paragraph measures the same as before — the heading's
 * own top margin only fills in where there was no gap (after another
 * heading or a blank separator). Google Docs can't receive CSS, so Docs
 * parity is handled structurally on the server (sanitize + tighten); this
 * block only has to keep the two in-app renderers in lockstep. Cook mode
 * keeps its own enlarged layout and is deliberately not included.
 */
.recipe-body p {
  margin-top: 0;
  margin-bottom: 0;
}

/* Blank-line separators (an otherwise empty <p> holding one <br>) show as
 * exactly one blank line. Normal paragraphs are marginless too: lines the
 * editor splits into separate <p>s stay tight until saving merges them. */
.recipe-body p:has(> br:only-child) {
  margin-top: 0;
  margin-bottom: 0;
}

.recipe-body h1:not(:first-child),
.recipe-body h2:not(:first-child),
.recipe-body h3:not(:first-child),
.recipe-body h4:not(:first-child) {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.recipe-body ul,
.recipe-body ol {
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.recipe-body ul:first-child,
.recipe-body ol:first-child {
  margin-top: 0;
}

/* Blank separators in cook mode (which keeps its own layout). */
.cook-body p:has(> br:only-child) {
  margin-top: 0;
  margin-bottom: 0;
}

/* Public help centre (/help): rendered Markdown articles and collapsible cards. */
.help-article h3,
.help-article h4,
.help-article h5 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.help-article ul,
.help-article ol {
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.help-article > :last-child {
  margin-bottom: 0;
}

.help-article pre {
  padding: 0.75rem;
  background: var(--bs-tertiary-bg);
  border-radius: 0.375rem;
}

details.card > summary {
  cursor: pointer;
}

/* FAQ question headings sit inside <summary>; keep them on the
 * disclosure marker's line. */
details.card > summary h3 {
  display: inline;
}

/* Meal planner (/home/plan): a seven-day grid with breakfast/lunch/dinner. */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.5rem;
}

.plan-day {
  min-width: 0;
  padding: 0.5rem;
  background: #fff;
  border: 2px solid var(--goat-peach);
  border-radius: 0.9rem;
}

.plan-day.is-today {
  border: 3px solid var(--goat-tang);
  box-shadow: 0 0 0 0.18rem rgba(247, 103, 7, 0.2);
}

.plan-day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem;
  padding: 0 0.25rem 0.4rem;
}

.plan-day-name {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8d6e63;
}

.plan-day-num {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.plan-day-slots {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.plan-slot-wrap {
  position: relative;
}

.plan-slot {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  width: 100%;
  min-height: 3.6rem;
  padding: 0.4rem 0.5rem;
  text-align: left;
  text-decoration: none;
  color: inherit;
  background: #fffdf8;
  border: 1px dashed #e0c9a6;
  border-radius: 0.6rem;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.plan-slot:hover,
.plan-slot:focus-visible {
  background: #fff8ec;
  border-color: #ffb74d;
}

.plan-slot.has-meal {
  background: var(--goat-leaf-bright);
  border-style: solid;
  cursor: grab;
}

.plan-slot.has-recipe {
  padding-right: 2rem;
}

.plan-slot-edit {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  color: #8d6e63;
  background: #fffdf8;
  border: 1px solid #e0c9a6;
  border-radius: 50%;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.plan-slot-edit:hover,
.plan-slot-edit:focus-visible {
  color: var(--goat-tang-deep);
  background: #fff8ec;
  border-color: #ffb74d;
}

.plan-slot.is-dragging {
  opacity: 0.4;
}

.plan-slot.is-drop-target {
  background: #e8f5e9;
  border-color: var(--goat-leaf);
  border-style: dashed;
  box-shadow: 0 0 0 0.18rem rgba(64, 192, 87, 0.22);
}

body.plan-dragging {
  user-select: none;
  touch-action: none;
}

body.plan-dragging .plan-slot {
  cursor: grabbing;
}

.plan-drag-ghost {
  position: fixed;
  z-index: 2100;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-width: 15rem;
  padding: 0.4rem 0.55rem;
  color: inherit;
  background: var(--goat-leaf-bright);
  border: 1px solid #ffb74d;
  border-radius: 0.6rem;
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.18);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 0.75rem));
}

.plan-slot-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #a1887f;
}

.plan-slot-meal {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.plan-slot-empty {
  font-weight: 500;
  color: #b0a49c;
}

.plan-picker-results {
  /* Reserve space for four recipe rows so the modal does not resize when
   * the recipes arrive (or while searching narrows the results). */
  height: 12.25rem;
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--goat-paper);
  border: 2px solid var(--goat-peach);
  border-radius: 0.75rem;
}

.plan-picker-result:last-child {
  margin-bottom: 0;
}

.plan-picker-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.35rem;
  text-align: left;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 0.5rem;
}

.plan-picker-result:hover,
.plan-picker-result:focus-visible {
  background: #f5f5f5;
  border-color: #eee;
  color: var(--goat-ink);
}

.plan-picker-result.is-selected,
.plan-picker-result.is-selected:hover,
.plan-picker-result.is-selected:focus-visible {
  background: #fff;
  border-color: #eee;
  color: var(--goat-ink);
}

@media (max-width: 767.98px) {
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .plan-day {
    padding: 0.6rem 0.75rem;
  }

  .plan-day-slots {
    flex-direction: row;
  }

  .plan-slot-wrap {
    flex: 1 1 0;
    min-width: 0;
  }

  .plan-slot {
    min-height: 3.2rem;
  }
}

/* --- In-app assistant chat --- */
.assistant-page {
  max-width: 920px;
}

.assistant-card {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 8.5rem);
  max-height: 960px;
  min-height: 24rem;
  overflow: hidden;
}

.assistant-chatbar {
  display: flex;
  flex: 0 0 auto;
  margin-left: auto;
}

.assistant-clear {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--goat-peach);
  border-radius: 999px;
  background: transparent;
  color: var(--goat-ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
}

.assistant-clear:hover {
  background: var(--goat-sand);
}

.assistant-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  padding: 1rem;
  background: var(--goat-cream);
  overscroll-behavior: contain;
}

.assistant-message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.assistant-message-user {
  align-self: flex-end;
  align-items: flex-end;
}

.assistant-message-assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.assistant-bubble {
  padding: 0.65rem 0.85rem;
  border-radius: 1rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.assistant-message-user .assistant-bubble {
  background: var(--goat-tang);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
  white-space: pre-wrap;
}

.assistant-message-assistant .assistant-bubble {
  background: var(--goat-paper);
  border: 1px solid var(--goat-peach);
  border-bottom-left-radius: 0.25rem;
}

.assistant-text > :last-child {
  margin-bottom: 0;
}

.assistant-text p,
.assistant-text ul,
.assistant-text ol,
.assistant-text pre {
  margin-bottom: 0.6rem;
}

.assistant-text ul,
.assistant-text ol {
  padding-left: 1.25rem;
}

.assistant-text pre {
  padding: 0.6rem;
  border-radius: 0.5rem;
  background: var(--goat-sand);
  white-space: pre-wrap;
}

.assistant-table-wrap,
.md-table-wrap {
  margin: 0.5rem 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.assistant-table,
.md-table {
  border-collapse: collapse;
  font-size: 0.84rem;
  min-width: 100%;
}

.assistant-table th,
.assistant-table td,
.md-table th,
.md-table td {
  border: 1px solid var(--goat-peach);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

.assistant-table th,
.md-table th {
  background: var(--goat-sand);
  font-weight: 800;
  white-space: nowrap;
}

.assistant-table tbody tr:nth-child(even) td,
.md-table tbody tr:nth-child(even) td {
  background: var(--goat-cream);
}

.recipe-body table {
  width: 100%;
  margin: 0.5rem 0;
  border-collapse: collapse;
}

.recipe-body th,
.recipe-body td {
  border: 1px solid var(--goat-peach);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}

.recipe-body th {
  background: var(--goat-sand);
  font-weight: 800;
}

.recipe-body tbody tr:nth-child(even) td {
  background: var(--goat-cream);
}

.convert-markdown {
  max-height: 32rem;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid var(--goat-peach);
  border-radius: 0.5rem;
  background: var(--goat-cream);
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.assistant-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.4rem 0.15rem;
}

.assistant-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--goat-peach);
  border-radius: 999px;
  background: var(--goat-paper);
  color: var(--goat-ink);
  font-size: 0.72rem;
  font-weight: 700;
}

.assistant-tool-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--goat-tang);
  animation: assistant-tool-pulse 1s ease-in-out infinite;
}

.assistant-tool-chip.is-done .assistant-tool-dot {
  background: var(--goat-leaf);
  animation: none;
}

.assistant-tool-chip.is-error .assistant-tool-dot {
  background: var(--goat-berry);
  animation: none;
}

.assistant-typing {
  align-items: center;
  display: inline-flex;
  gap: 0.3rem;
  min-height: 1rem;
  padding: 0.2rem 0;
}

.assistant-typing span {
  animation: assistant-typing-bounce 1.1s ease-in-out infinite;
  background: var(--goat-tang);
  border-radius: 50%;
  height: 0.45rem;
  width: 0.45rem;
}

.assistant-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.assistant-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

.assistant-usage {
  border-top: 1px solid var(--goat-peach);
  color: var(--goat-ink);
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 0.45rem;
  opacity: 0.7;
  padding-top: 0.35rem;
}

@keyframes assistant-typing-bounce {
  0%,
  60%,
  100% {
    opacity: 0.45;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-0.25rem);
  }
}

@keyframes assistant-tool-pulse {
  50% {
    opacity: 0.35;
  }
}

.assistant-empty {
  margin: auto;
  padding: 1rem;
  text-align: center;
}

.assistant-empty h1 {
  margin-top: 0.5rem;
}

.assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.assistant-suggestions .btn {
  border: 1px solid var(--goat-peach);
  background: var(--goat-paper);
}

.assistant-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border-top: 2px solid var(--goat-peach);
  background: var(--goat-paper);
}

.assistant-composer textarea {
  min-height: 2.5rem;
  max-height: 10rem;
  resize: none;
}

.assistant-send {
  align-items: center;
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 auto;
  height: 2.6rem;
  justify-content: center;
  padding: 0;
  width: 2.6rem;
}

.assistant-send svg {
  display: block;
}

.assistant-footer {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.9rem 0.25rem;
  background: var(--goat-paper);
}

.assistant-hint {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--goat-ink);
  opacity: 0.6;
  font-size: 0.7rem;
}

@media (max-width: 767.98px) {
  .assistant-body {
    padding-bottom: 0;
  }

  .assistant-page {
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
  }

  .assistant-card {
    height: calc(100dvh - 9rem);
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .assistant-message {
    max-width: 94%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-tool-dot {
    animation: none;
  }

  .assistant-typing span {
    animation: none;
    opacity: 0.7;
  }
}

/* --- Public shared shopping list --- */

.shared-shopping-page {
  max-width: 980px;
}

.shared-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.shared-brand a {
  color: var(--goat-ink);
  font-size: 1.25rem;
  font-weight: 800;
}

.shared-brand img {
  vertical-align: 0;
}

.shared-hero {
  position: relative;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  overflow: hidden;
  padding: 1.5rem;
  background: linear-gradient(135deg, #fff9f1 0%, #ffe8c2 100%);
  border: 2px solid var(--goat-peach);
  border-radius: 1.75rem;
  box-shadow: 0 6px 0 rgba(247, 103, 7, 0.1);
}

.shared-hero::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 50%;
}

.shared-hero::after {
  content: "";
  position: absolute;
  bottom: -35px;
  left: -30px;
  width: 90px;
  height: 90px;
  background: rgba(64, 192, 87, 0.1);
  border-radius: 50%;
}

.shared-hero-art {
  position: relative;
  z-index: 1;
  height: 132px;
}

.shared-art-basket {
  position: absolute;
  right: 4px;
  bottom: 0;
  filter: drop-shadow(0 5px 8px rgba(55, 71, 79, 0.12));
}

.shared-art-bit {
  position: absolute;
  filter: drop-shadow(0 2px 3px rgba(55, 71, 79, 0.12));
}

.shared-art-carrot {
  top: 18px;
  left: 14px;
  transform: rotate(-10deg);
}

.shared-art-tomato {
  bottom: 12px;
  left: 2px;
}

.shared-art-milk {
  top: 2px;
  left: 66px;
  transform: rotate(6deg);
}

.shared-art-sparkle {
  top: 0;
  right: 0;
}

.shared-hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.shared-eyebrow {
  margin: 0 0 0.2rem;
  color: var(--goat-tang-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.shared-title {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.shared-meta {
  margin: 0.55rem 0 0;
  color: var(--goat-ink);
  font-weight: 700;
  opacity: 0.7;
}

.shared-progress {
  position: sticky;
  top: 0.5rem;
  z-index: 5;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: rgba(255, 249, 241, 0.94);
  border: 2px solid var(--goat-peach);
  border-radius: 1.1rem;
  box-shadow: 0 4px 14px rgba(55, 71, 79, 0.1);
  backdrop-filter: blur(8px);
}

.shared-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.shared-progress-label {
  margin: 0;
  font-weight: 800;
}

.shared-reset {
  padding: 0;
  color: var(--goat-tang-deep);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: underline;
  background: none;
  border: 0;
}

.shared-progress-track {
  height: 0.7rem;
  margin-top: 0.55rem;
  overflow: hidden;
  background: var(--goat-sand);
  border-radius: 999px;
}

.shared-progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--goat-leaf), var(--goat-leaf-deep));
  border-radius: inherit;
  transition: width 0.22s ease;
}

.shared-done {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: #d3f9d8;
  border: 2px solid var(--goat-leaf);
  border-radius: 0.9rem;
}

.shared-done[hidden] {
  display: none;
}

.shared-done strong,
.shared-done span {
  display: block;
}

.shared-done span {
  color: var(--goat-ink);
  font-size: 0.85rem;
  opacity: 0.75;
}

.shared-aisles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1rem;
  align-items: start;
}

.shared-aisle {
  padding: 1rem 1.1rem 0.5rem;
  background: var(--goat-paper);
  border: 2px solid var(--goat-peach);
  border-radius: 1.25rem;
  box-shadow: 0 4px 0 rgba(247, 103, 7, 0.08);
  break-inside: avoid;
}

.shared-aisle-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.shared-aisle-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  background: var(--aisle-bg, var(--goat-sand));
  border-radius: 0.75rem;
}

.shared-aisle-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.shared-aisle-count {
  flex: 0 0 auto;
  min-width: 1.6rem;
  padding: 0.1rem 0.5rem;
  color: var(--goat-tang-deep);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  background: var(--goat-cream);
  border: 1px solid var(--goat-sand);
  border-radius: 999px;
}

.shared-items {
  padding: 0;
  margin: 0;
  list-style: none;
}

.shared-item {
  border-top: 1px dashed rgba(55, 71, 79, 0.12);
}

.shared-item-check {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-height: 44px;
  padding: 0.55rem 0;
  margin: 0;
  cursor: pointer;
}

.shared-item-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.shared-item-checkbox {
  position: relative;
  flex: 0 0 auto;
  width: 1.4rem;
  height: 1.4rem;
  margin-top: 0.05rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background: var(--goat-paper);
  border: 2px solid var(--goat-ink);
  border-radius: 0.45rem;
}

.shared-item-checkbox::after {
  content: "";
  position: absolute;
  top: 46%;
  left: 50%;
  width: 0.42rem;
  height: 0.75rem;
  border: solid var(--goat-paper);
  border-width: 0 2px 2px 0;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.shared-item-checkbox:checked {
  background: var(--goat-leaf);
  border-color: var(--goat-leaf);
}

.shared-item-checkbox:checked::after {
  opacity: 1;
}

.shared-item-checkbox:focus-visible {
  outline: 2px solid var(--goat-tang);
  outline-offset: 2px;
}

.shared-item-checkbox:checked ~ .shared-item-text {
  color: var(--goat-ink);
  text-decoration: line-through;
  opacity: 0.5;
}

.shared-empty {
  padding: 2.4rem 1.25rem;
  text-align: center;
  background: var(--goat-paper);
  border: 2px dashed var(--goat-peach);
  border-radius: 1.5rem;
}

.shared-empty-art {
  display: block;
  margin-bottom: 0.6rem;
  font-size: 2.4rem;
}

.shared-empty h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.shared-empty p {
  margin: 0;
  color: var(--goat-ink);
  opacity: 0.65;
}

.shared-footer {
  margin: 2rem 0 0;
  color: var(--goat-ink);
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.65;
}

.shared-footer a {
  color: var(--goat-tang-deep);
  font-weight: 700;
}

@media (max-width: 575.98px) {
  .shared-hero {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1.25rem;
    text-align: center;
  }

  .shared-hero-art {
    width: 210px;
    height: 104px;
    margin: 0 auto;
  }

  .shared-art-basket {
    right: 12px;
    width: 84px;
    height: 84px;
  }

  .shared-art-carrot {
    top: 6px;
    left: 18px;
  }

  .shared-art-tomato {
    bottom: 4px;
    left: 6px;
  }

  .shared-art-milk {
    top: -2px;
    left: 70px;
  }

  .shared-art-sparkle {
    top: -2px;
    right: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shared-progress-bar,
  .shared-item-text {
    transition: none;
  }
}
