:root {
  --accent: #008fff;
  --accent-soft: #a6d4ff;
  --inactive: #e9f2fb;
  --green: #2ea44f;
  --red: #ff6b6b;
  --warn: #ff6b6b;
  --muted: #486280;
  --soft-border: #dcecff;
  --soft-line: #f0f6ff;
  --text: #17324d;
  --text-soft: #5f7896;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --border: #dbe8f6;
  --border-strong: #c9dcee;
  --shadow-sm: 0 2px 8px rgba(15, 68, 120, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 68, 120, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --focus-ring: 0 0 0 3px rgba(0, 143, 255, 0.14);

  --page-bg-1: #f7fbff;
  --page-bg-2: #f3f8fd;
  --panel-bg: var(--surface);
  --panel-border: rgba(219, 232, 246, 0.9);
  --input-bg: #fff;
  --row-bg: #fff;
  --row-hover: #f7fbff;
  --card-soft: #fbfdff;
  --card-soft-2: #f8fbff;
  --footer-text: #666;
  --scroll-thumb: #c7d7ea;
  --scroll-thumb-hover: #a9c4e3;

  --mobile-header-h: 68px;
  --mobile-tabs-h: 64px;
  --mobile-shell-side: 12px;
}

/* ===== Custom Scrollbar ===== */

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

/* WebKit (Chrome, Edge, Safari) */
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

body.dark-mode {
  --text: #eef4fb;
  --text-soft: #a9b9cb;
  --muted: #9fb1c5;
  --surface: #1f252c;
  --surface-soft: #252d36;
  --border: #394552;
  --border-strong: #4a5868;
  --soft-border: #445261;
  --soft-line: #313b46;
  --inactive: #3a4654;

  --page-bg-1: #15191e;
  --page-bg-2: #1b2128;
  --panel-bg: #1f252c;
  --panel-border: #394552;
  --input-bg: #2a333d;
  --row-bg: #242c35;
  --row-hover: #2b3540;
  --card-soft: #252d36;
  --card-soft-2: #222a33;
  --footer-text: #9fb1c5;
  --scroll-thumb: #2f4a66;
  --scroll-thumb-hover: #3f6287;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.42);
  --focus-ring: 0 0 0 3px rgba(0, 143, 255, 0.22);
}

body.dark-mode .mini-add-btn:hover {
  background: #20496f !important;
  border-color: #3d78aa !important;
  color: #eef7ff !important;
}

/* Dark mode: dropdown options */
body.dark-mode select,
body.dark-mode select option {
  background: #2a333d !important;
  color: #eef4fb !important;
}

/* Dark mode: number input spinner area */
body.dark-mode input[type="number"] {
  background: #2a333d !important;
  color: #eef4fb !important;
  border-color: #394552 !important;
}

body.dark-mode input[type="number"]::-webkit-inner-spin-button,
body.dark-mode input[type="number"]::-webkit-outer-spin-button {
  filter: invert(1) brightness(1.2);
}

/* Dark mode: active/focused ingredient text input */
body.dark-mode .ing-name-input-wrap input,
body.dark-mode .ing-name-wrap input,
body.dark-mode input[type="text"],
body.dark-mode textarea {
  background: #2a333d !important;
  border-color: #394552 !important;
  color: #eef4fb !important;
}

body.dark-mode .ing-name-input-wrap input:focus,
body.dark-mode .ing-name-wrap input:focus,
body.dark-mode input[type="text"]:focus,
body.dark-mode textarea:focus {
  background: #2a333d !important;
  border-color: #2f5f8a !important;
  color: #eef4fb !important;
}

/* Dark mode: favourite button inside recipe editor */
body.dark-mode .fav-star-btn {
  background: #25303a !important;
  border-color: #425061 !important;
  color: #9fb1c5 !important;
}

body.dark-mode .fav-star-btn.active {
  background: #4a3518 !important;
  border-color: #8a6730 !important;
  color: #ffd36a !important;
}

body.dark-mode .fav-star-btn:hover {
  background: #60451f !important;
  border-color: #a67a36 !important;
  color: #ffe7a8 !important;
}

/* Dark mode: number spinner cleanup */
body.dark-mode input[type="number"]::-webkit-inner-spin-button,
body.dark-mode input[type="number"]::-webkit-outer-spin-button {
  background: transparent !important;
  opacity: 0.45;
  filter: invert(1) brightness(0.8);
}

/* Consistent number inputs: hide browser spinner controls in all modes */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

* {
  box-sizing: border-box;
}

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  margin: 0;
  padding: 18px;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    var(--page-bg-1) 0%,
    var(--page-bg-2) 100%
  );
  color: var(--text);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1440px;
  margin: 0 auto 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.header-actions .icon-btn {
  color: var(--text);
}

#headerDarkModeBtn {
  font-size: 18px;
}

html {
  scroll-behavior: auto;
}

.mobile-tabs {
  display: none;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(15, 68, 120, 0.08);
}

.mobile-tab {
  flex: 1;
  min-height: 46px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease,
    border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.mobile-tab:hover {
  background: rgba(0, 143, 255, 0.05);
  color: var(--text);
}

.mobile-tab:active {
  transform: scale(0.98);
}

.mobile-tab.active {
  background: linear-gradient(180deg, var(--accent) 0%, #0b85ea 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(0, 143, 255, 0.22);
}

body.dark-mode .mobile-tabs {
  background: rgba(31, 37, 44, 0.84);
  border-color: var(--border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

body.dark-mode .mobile-tab {
  color: var(--text-soft);
}

body.dark-mode .mobile-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

body.dark-mode .mobile-tab.active {
  background: linear-gradient(180deg, var(--accent) 0%, #0b85ea 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(0, 143, 255, 0.28);
}

body.dark-mode .icon-btn {
  background: linear-gradient(180deg, #2a333d 0%, #222a33 100%);
  border-color: var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 6px 18px rgba(0, 0, 0, 0.24);
}

body.dark-mode .icon-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #313b46 0%, #29323c 100%);
  border-color: var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 24px rgba(0, 0, 0, 0.3);
}

h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.3px;
  font-weight: 700;
  text-align: left;
}

.stage {
  display: flex;
  gap: 20px;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 1440px;
  height: calc(100vh - 80px);
  margin: 12px auto 0;
}

.col {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-md);
  min-width: 0;
  height: 100%;
}

.left-col {
  width: 320px;
  flex: 0 0 320px;
  padding-right: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.center-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  min-width: 0;
  overflow: hidden;
}

.right-col {
  width: 390px;
  flex: 0 0 390px;
  padding-right: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.right-col ul {
  padding-left: 18px;
  margin: 6px 0 10px;
}

.right-col ol {
  padding-left: 18px;
  margin: 6px 0 10px;
}

.panel h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
}

.panel-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--soft-line);
}

.panel-top h3 {
  margin: 0;
}

.panel-kicker {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  line-height: 1.15;
}

.panel-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-soft);
}

.section-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

.head-actions {
  display: flex;
  gap: 6px;
  width: 100%;
  flex-wrap: wrap;
  min-width: 0;
}

.left-panel-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a84a3;
  margin: 0 0 8px;
}

.left-subsection {
  padding-top: 4px;
}

.section-helper {
  margin-top: -2px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-soft);
}

.section-empty-msg {
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.4;
}

.btn.sm {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 11.5px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease,
    color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease,
    filter 0.16s ease;
  font-weight: 700;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(15, 68, 120, 0.04);
}

.head-actions .btn.sm {
  flex: 1 1 calc(50% - 3px);
  min-width: 0;
  padding: 6px 8px;
}

.btn.sm.green {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn.sm.red {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn.sm:hover {
  filter: brightness(1.02);
  box-shadow: none;
}
.btn.sm:active {
  transform: scale(0.96);
}
.btn.sm.pulse-green {
  animation: btnBounce 0.18s ease-out 1;
}
.btn.sm.pulse-red {
  animation: btnBounce 0.18s ease-out 1;
}

.btn.sm.disabled,
.btn.sm:disabled {
  background: #dfe8f3 !important;
  color: #6f8095 !important;
  cursor: default !important;
  filter: none !important;
  transform: none !important;
  box-shadow: none !important;
}

@keyframes btnBounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.94);
  }
  100% {
    transform: scale(1);
  }
}

.field-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 1px solid #f3b7b7;
  border-radius: 50%;
  background: #ffeaea;
  color: #b42318;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background-color 0.15s ease,
    border-color 0.15s ease, color 0.15s ease;
}

.field-clear-btn:hover {
  background: #ffdede;
  border-color: #eba7a7;
  color: #8f1d13;
}

.add-ing-box {
  margin-bottom: 12px;
}
.add-ing-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.add-ing-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.add-ing-row input {
  width: 100%;
  min-width: 0;
  padding: 8px 36px 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--soft-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
}

.add-ing-input-wrap.has-value .field-clear-btn,
.ingredient-filter-wrap.has-value .field-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

.add-ing-input-wrap .field-clear-btn:focus,
.ingredient-filter-wrap .field-clear-btn:focus {
  opacity: 1;
  pointer-events: auto;
}

.add-ing-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.add-ing-label,
.add-ing-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.add-ing-label select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--soft-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
}

.ingredient-suggestions {
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  max-height: 140px;
  overflow: auto;
}

.ingredient-suggestion {
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--soft-line);
  color: var(--text);
}

.ingredient-suggestion:last-child {
  border-bottom: none;
}
.ingredient-suggestion:hover {
  background: var(--row-hover);
}
.ingredient-suggestion strong {
  color: var(--accent);
}

.existing-ing-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.existing-ing-label {
  color: var(--muted);
}

.existing-ing-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-soft);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.existing-ing-pill:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.existing-ing-pill.status-in {
  background: #ecfff1;
  color: #207245;
  border-color: #cfeeda;
}

.existing-ing-pill.status-out {
  background: #fff1f1;
  color: #b42318;
  border-color: #ffd6d6;
}

.existing-ing-pill.flash-blue {
  animation: existingPillFlashBlue 0.28s ease-out 1;
}
.existing-ing-pill.flash-green {
  animation: existingPillFlashGreen 0.28s ease-out 1;
}
.existing-ing-pill.flash-red {
  animation: existingPillFlashRed 0.28s ease-out 1;
}

@keyframes existingPillFlashBlue {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 143, 255, 0);
  }
  45% {
    transform: scale(1.06);
    box-shadow: 0 0 0 6px rgba(0, 143, 255, 0.18);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(0, 143, 255, 0);
  }
}

@keyframes existingPillFlashGreen {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(46, 164, 79, 0);
  }
  45% {
    transform: scale(1.06);
    box-shadow: 0 0 0 6px rgba(46, 164, 79, 0.22);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(46, 164, 79, 0);
  }
}

@keyframes existingPillFlashRed {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
  }
  45% {
    transform: scale(1.06);
    box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.22);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: flex-start;
  min-width: 0;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  max-width: 100%;
  padding: 6px 11px 7px 9px;
  border-radius: 18px;
  background: var(--inactive);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  font-size: 13px;
  line-height: 1.1;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.chip.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 143, 255, 0.12);
}

.chip-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  padding-bottom: 1px;
}

.chip-badge {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid rgba(0, 143, 255, 0.18);
  background: #ffffff;
  color: #0f5ea8;
  box-shadow: 0 1px 2px rgba(15, 68, 120, 0.08);
}

.chip-badge {
  cursor: pointer;
}

.chip-badge:not(.delete):hover {
  filter: brightness(0.95);
}

.chip-badge:not(.delete):active {
  transform: scale(0.95);
}

.chip.active .chip-badge:not(.delete) {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
  box-shadow: none;
}

.chip-badge.delete {
  border-color: #f3c1c1;
  background: #fff1f1;
  color: #b42318;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease;
}

.chip.active .chip-badge.delete {
  background: #f04438;
  border-color: #f04438;
  color: #ffffff;
  box-shadow: none;
}

.chip-badge.delete:hover {
  background: #ffe3e3;
  border-color: #e8aaaa;
  color: #8f1d13;
  transform: scale(1.06);
}

.chip.active .chip-badge.delete:hover {
  background: #d92d20;
  border-color: #d92d20;
  color: #ffffff;
}

.chip-badge.delete:active {
  transform: scale(0.95);
}

.chip .arrow {
  position: absolute;
  right: -10px;
  top: -10px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.chip .up {
  color: var(--green);
}
.chip .down {
  color: var(--red);
}

@media (hover: hover) and (pointer: fine) {
  .chip .arrow {
    opacity: 0;
    transform: scale(0.9);
  }
  .chip:hover .arrow {
    opacity: 1;
    transform: scale(1);
  }
}

.ingredient-filter-box {
  margin-bottom: 12px;
}

.ingredient-filter-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.ingredient-filter-box input {
  width: 100%;
  min-width: 0;
  padding: 8px 36px 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--soft-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.filters-bar {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: wrap;
  max-width: 100%;
}

.filters-bar > * {
  min-width: 0;
}

.filters-main {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  min-width: 0;
}

.filters-utility {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
  margin-left: auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.filters-bar select {
  min-height: 36px;
  padding: 8px 8px 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  flex: 1 1 0;
  min-width: 96px;
  width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.filters-bar select:focus {
  outline: none;
  border-color: #8dc7ff;
  box-shadow: var(--focus-ring);
}

.filters-bar .g-servings {
  flex: 0 0 auto;
  margin-left: auto;
}

.filters-bar .btn {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 12px;
  border-radius: 10px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.filter-icon-btn {
  width: 34px;
  min-width: 34px;
  height: 36px;
  padding: 0;
  flex: 0 0 34px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.filter-icon-btn .star,
.filter-icon-btn .icon {
  margin: 0;
  font-size: 15px;
  line-height: 1;
}

.filter-icon-btn span + span {
  display: none;
}

.filters-bar .btn.red {
  background: #fff1f1;
  color: #b42318;
  border-color: #f3c1c1;
}

.filters-bar .btn.red:hover:not(:disabled) {
  background: #ffe3e3;
  border-color: #e8aaaa;
  color: #8f1d13;
  box-shadow: none;
}

body.dark-mode .filters-bar .btn.red:hover:not(:disabled) {
  background: #4a2a2a !important;
  border-color: #8a4a4a !important;
  color: #ffb3b3 !important;
  box-shadow: none !important;
}

.filters-bar .btn.red:active {
  transform: scale(0.97);
}

.fav-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.fav-filter-btn .star {
  font-size: 15px;
  line-height: 1;
  color: #8ca0b5;
}

.fav-filter-btn:hover:not(:disabled) {
  background: #f8fbff;
  border-color: #d7eaff;
  box-shadow: none;
}

body.dark-mode .fav-filter-btn:hover:not(:disabled) {
  background: #3a4654 !important;
  border-color: #5a6a7d !important;
  color: #eef4fb !important;
  box-shadow: none !important;
}

body.dark-mode .fav-filter-btn:hover:not(:disabled) .star {
  color: #bcc7d3;
}

body.dark-mode .fav-filter-btn.active:hover:not(:disabled) {
  background: #4a4022;
  border-color: #8f7640;
  color: #f3d57a;
}

body.dark-mode .fav-filter-btn.active:hover:not(:disabled) .star {
  color: #f2b600;
}

.fav-filter-btn.active {
  background: #fff8db;
  border-color: #f0d46a;
  color: #7e6200;
  box-shadow: none;
}

.fav-filter-btn.active .star {
  color: #f2b600;
}

.fav-filter-btn.disabled,
.fav-filter-btn:disabled {
  background: #f3f6fa !important;
  color: #97a8ba !important;
  border-color: #e2e8f0 !important;
  cursor: default !important;
  box-shadow: none !important;
  transform: none !important;
}

.fav-filter-btn.disabled .star,
.fav-filter-btn:disabled .star {
  color: #bcc7d3 !important;
}

.can-make-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.can-make-btn .icon {
  font-size: 15px;
  line-height: 1;
  color: #8ca0b5;
}

.can-make-btn:hover {
  background: #f8fbff;
  border-color: #d7eaff;
  box-shadow: none;
}

body.dark-mode .can-make-btn:hover:not(:disabled) {
  background: #313b46 !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

body.dark-mode .can-make-btn:hover:not(:disabled) .icon {
  color: #bcc7d3;
}

body.dark-mode .can-make-btn.active:hover:not(:disabled) {
  background: #244634 !important;
  border-color: #4f9a73 !important;
  color: #b9f0d0 !important;
}

body.dark-mode .can-make-btn.active:hover:not(:disabled) .icon {
  color: #63d08c;
}

.can-make-btn.active {
  background: #ecfff1;
  border-color: #bfe7cc;
  color: #207245;
  box-shadow: none;
}

.can-make-btn.active .icon {
  color: #2ea44f;
}

.recipe-fav-btn {
  margin-left: auto;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #9fb0c2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(15, 68, 120, 0.03);
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.recipe-fav-btn:hover {
  background: #fff9e7;
  border-color: #f0d46a;
  color: #d8a900;
  box-shadow: none;
}

.recipe-fav-btn:active {
  transform: scale(0.95);
}

.recipe-fav-btn.active {
  background: #fff8db;
  border-color: #f0d46a;
  color: #f2b600;
}

.recipe-missing-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background: #fff1f1;
  color: #b42318;
  border: 1px solid #f3c1c1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  white-space: nowrap;
}

.editor-fav-field .fav-star-btn {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.editor-fav-field .fav-star-btn .star {
  font-size: 18px;
  line-height: 1;
  color: #9fb0c2;
}

.editor-fav-field .fav-star-btn:hover {
  background: #fff9e7;
  border-color: #f0d46a;
  color: #7e6200;
  box-shadow: none;
}

.editor-fav-field .fav-star-btn.active {
  background: #fff8db;
  border-color: #f0d46a;
  color: #7e6200;
}

.editor-fav-field .fav-star-btn.active .star {
  color: #f2b600;
}

.editor-fav-field .fav-star-btn:active {
  transform: scale(0.97);
}

.g-servings {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 4px 6px 4px 8px;
  white-space: nowrap;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: none;
}

.g-servings .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-right: 2px;
  line-height: 1;
}

.g-servings .btn-sv {
  width: 26px;
  min-width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 15px;
  font-weight: 700;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    transform 0.12s ease;
}

.g-servings .btn-sv:hover {
  background: #f4f8fc;
  border-color: var(--border-strong);
}

.g-servings .btn-sv:active {
  transform: scale(0.96);
}

.g-servings input {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  height: 26px;
  min-height: 26px;
  text-align: center;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 26px;
  color: var(--text);
  appearance: textfield;
  -moz-appearance: textfield;
}

.g-servings input:focus {
  outline: none;
  border-color: #8dc7ff;
  box-shadow: 0 0 0 2px rgba(0, 143, 255, 0.12);
}

.g-servings input::-webkit-outer-spin-button,
.g-servings input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.list-wrap {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding-right: 6px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

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

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--soft-line);
  cursor: pointer;
  user-select: none;
}

.row:hover {
  background: var(--row-hover);
}

.row .name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  line-height: 1.2;
}

.meta {
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
}

.row.selected {
  background: var(--accent-soft);
}

.row.selected .name {
  color: #17324d;
}

.row.selected .meta {
  color: #294766;
}

.row.glow-soft {
  animation: glowSoft 2s ease-out;
}

@keyframes glowSoft {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 143, 255, 0.35);
  }
  30% {
    box-shadow: 0 0 0 8px rgba(0, 143, 255, 0.15);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 143, 255, 0);
  }
}

@keyframes mobilePanelIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.empty-msg {
  font-size: 14px;
  color: var(--text-soft);
  min-height: 22px;
  text-align: center;
  padding-inline: 6px;
}

.empty-msg .msg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.empty-msg .msg.show {
  opacity: 1;
  transform: translateY(0);
}

.quick-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.quick-controls-random {
  display: flex;
  justify-content: center;
}

.quick-controls-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.quick-controls-actions .btn {
  flex: 0 1 auto;
}

@media (max-width: 1120px) {
  .filters-utility {
    flex: 0 0 100%;
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
}

@media (max-width: 1080px) {
  .quick-controls-actions .btn:not(.icon-btn) {
    flex: 1 1 200px;
  }
}

@media (max-width: 900px) {
  body {
    padding: 0;
    overflow: hidden;
  }

  .viewer-panel .panel-top {
    margin-bottom: 8px;
  }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: var(--mobile-header-h);
    padding: 12px var(--mobile-shell-side) 10px;
    margin: 0;
    background: linear-gradient(
      180deg,
      rgba(247, 251, 255, 0.94) 0%,
      rgba(243, 248, 253, 0.9) 100%
    );
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(219, 232, 246, 0.8);
  }

  body.dark-mode .app-header {
    background: linear-gradient(
      180deg,
      rgba(21, 25, 30, 0.94) 0%,
      rgba(27, 33, 40, 0.9) 100%
    );
    border-bottom-color: rgba(57, 69, 82, 0.85);
  }

  .app-header h1 {
    font-size: 17px;
    line-height: 1.15;
    letter-spacing: 0.01em;
    max-width: 100%;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .icon-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 13px;
  }

  .mobile-tabs {
    display: flex;
    position: sticky;
    top: var(--mobile-header-h);
    z-index: 115;
    margin: 6px var(--mobile-shell-side) 6px;
    min-height: var(--mobile-tabs-h);
    align-items: center;
  }

  .stage {
    display: block;
    height: calc(100dvh - var(--mobile-header-h) - var(--mobile-tabs-h) - 6px);
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  .col,
  .left-col,
  .center-col,
  .right-col {
    display: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: none;
    height: 100%;
    max-height: 100%;
    padding: 12px 12px 16px;
    border-radius: 0;
    box-shadow: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: none;
    background: transparent;
    opacity: 0;
  }

  .col.active,
  .left-col.active,
  .center-col.active,
  .right-col.active {
    display: block;
    animation: mobilePanelIn 160ms ease;
    opacity: 1;
  }

  .panel-top {
    gap: 2px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .panel-top .panel-kicker {
    font-size: 10px;
    letter-spacing: 0.09em;
  }

  .panel-top h3 {
    font-size: 15px;
    line-height: 1.15;
  }

  .panel-top .panel-subtitle {
    margin-top: 1px;
    font-size: 11px;
    line-height: 1.3;
    max-width: none;
  }

  .left-col.active,
  .right-col.active {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .center-col.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .center-col.active .list-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .center-col {
    gap: 10px;
  }

  .filters-bar {
    gap: 8px;
    margin-bottom: 2px;
  }

  .filters-main {
    gap: 8px;
    flex-wrap: wrap;
  }

  .filters-utility {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 8px;
  }

  .filters-bar select {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 11px;
  }

  .filter-icon-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    flex: 0 0 38px !important;
    border-radius: 11px;
  }

  .filters-bar .btn {
    min-height: 38px;
    border-radius: 11px;
  }

  .g-servings {
    height: 38px;
    padding: 4px 6px 4px 8px;
    border-radius: 11px;
  }

  .g-servings .btn-sv {
    width: 28px;
    min-width: 28px;
    height: 28px;
    flex: 0 0 28px;
  }

  .g-servings input {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    height: 28px;
    min-height: 28px;
  }

  .list-wrap {
    border-radius: 14px;
  }

  .row {
    align-items: flex-start;
    gap: 10px;
    padding: 13px 14px;
  }

  .row .name {
    font-size: 14px;
    line-height: 1.25;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
  }

  .meta {
    font-size: 11.5px;
    line-height: 1.35;
    white-space: normal;
  }

  .recipe-fav-btn {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 17px;
  }

  .recipe-missing-badge {
    padding: 4px 8px;
    font-size: 10.5px;
  }

  .recipe-card {
    padding-top: 10px;
  }

  .recipe-header {
    gap: 10px;
    margin-bottom: 10px;
  }

  .recipe-title-row {
    gap: 8px;
    align-items: flex-start;
  }

  .recipe-title-star {
    font-size: 20px;
    margin-top: 3px;
  }

  .recipe-title-text h2 {
    font-size: 18px;
    line-height: 1.15;
  }

  .recipe-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    row-gap: 8px;
    flex-wrap: wrap;
  }

  .recipe-actions .btn {
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 11px;
  }

  .recipe-actions-top {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
  }

  .recipe-actions-top .btn {
    flex: 0 0 auto;
    min-width: 0;
  }

  .recipe-actions-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
  }

  .shopping-action-btn {
    width: auto;
    min-width: 170px;
    margin-left: 0;
    white-space: nowrap;
  }

  .recipe-card > p.small-muted {
    margin-bottom: 10px !important;
  }

  .recipe-card h3 {
    font-size: 15px;
    line-height: 1.2;
    margin-bottom: 8px;
  }

  .recipe-card ul,
  .recipe-card ol {
    margin-top: 0;
    margin-bottom: 14px;
    padding-left: 20px;
  }

  .recipe-card li {
    margin-bottom: 4px;
    line-height: 1.45;
  }

  .recipe-header + p.small-muted {
    margin: 0 0 12px 0 !important;
    font-size: 12px;
    line-height: 1.35;
  }

  .recipe-missing-summary {
    font-size: 12.5px;
    padding: 9px 12px;
    border-radius: 11px;
  }

  .shopping-action-btn {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .quick-controls {
    gap: 10px;
    padding-top: 2px;
  }

  .quick-controls-random {
    justify-content: stretch;
  }

  .random-btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    border-radius: 12px;
  }

  .quick-controls-actions {
    gap: 8px;
    justify-content: stretch;
  }

  .quick-controls-actions .btn:not(.icon-btn) {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    min-height: 40px;
  }

  .row.selected {
    box-shadow: inset 0 0 0 1px rgba(0, 143, 255, 0.12);
  }
}

@media (max-width: 820px) {
  .quick-controls-actions {
    justify-content: stretch;
  }

  .quick-controls-actions .btn:not(.icon-btn) {
    flex: 1 1 calc(50% - 4px);
  }
}

@media (max-width: 560px) {
  .quick-controls-actions .btn:not(.icon-btn),
  .quick-controls-actions .icon-btn {
    flex: 1 1 100%;
  }

  .random-btn {
    width: 100%;
    min-width: 0;
  }

  .recipe-actions-right {
    margin-left: 0;
    width: 100%;
  }
}

.random-btn {
  min-width: 220px;
  min-height: 42px;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
}

.random-btn .dice {
  display: inline-block;
  transform-origin: center;
  transition: transform 0.18s ease;
}

.random-btn:hover .dice {
  transform: rotate(-12deg) scale(1.08);
}

.random-btn:active .dice {
  transform: rotate(10deg) scale(0.96);
}

.icon-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 17px;
  line-height: 1;
  background: linear-gradient(
    180deg,
    var(--surface) 0%,
    var(--surface-soft) 100%
  );
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 4px 14px rgba(15, 68, 120, 0.08);
  transition: background-color 0.16s ease, border-color 0.16s ease,
    color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}

.icon-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  border-color: var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 8px 20px rgba(15, 68, 120, 0.12);
  transform: translateY(-1px);
}

.icon-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 3px 10px rgba(15, 68, 120, 0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 68, 120, 0.03);
  transition: background-color 0.16s ease, border-color 0.16s ease,
    color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease,
    opacity 0.16s ease;
}

.btn:hover:not(:disabled) {
  background: #f8fbff;
  border-color: var(--border-strong);
  box-shadow: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: #8dc7ff;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: none;
}

.btn.primary:hover:not(:disabled) {
  background: #0b85ea;
  border-color: #0b85ea;
  box-shadow: none;
}

.btn[disabled] {
  opacity: 1;
  cursor: default;
  background: #eef4fa;
  border-color: #dde8f3;
  color: #8596aa;
  box-shadow: none;
  transform: none;
}

.btn.soft-red {
  background: #fff1f1;
  border-color: #f3c1c1;
  color: #b42318;
}

.btn.soft-red:hover:not(:disabled) {
  background: #ffe3e3;
  border-color: #e8aaaa;
  color: #8f1d13;
  box-shadow: none;
}

.btn.soft-blue {
  background: #eef6ff;
  border-color: #d7eaff;
  color: #0f5ea8;
}

.btn.soft-blue:hover:not(:disabled) {
  background: #e6f2ff;
  border-color: #c9e1ff;
  color: #0b4f90;
  box-shadow: none;
}

.btn.soft-red:active,
.btn.soft-blue:active {
  transform: scale(0.97);
}

.shopping-modal-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.shopping-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shopping-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.shopping-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.shopping-section-helper {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-soft);
}

.shopping-manual-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.shopping-manual-input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.shopping-manual-input-wrap input {
  width: 100%;
  min-width: 0;
  padding: 8px 36px 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--soft-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
}
.shopping-manual-qty {
  flex: 0 0 72px;
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid var(--soft-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.shopping-manual-qty:focus {
  outline: none;
  border-color: #8dc7ff;
  box-shadow: var(--focus-ring);
}

.shopping-manual-input-wrap.has-value .field-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

.shopping-manual-input-wrap .field-clear-btn:focus {
  opacity: 1;
  pointer-events: auto;
}

.shopping-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 0;
}

.shopping-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-soft);
}

.shopping-row.checked {
  background: var(--surface-soft);
  border-color: var(--border);
  opacity: 0.75;
}

.shopping-row.just-added {
  animation: shoppingRowFlash 0.9s ease-out 1;
}

@keyframes shoppingRowFlash {
  0% {
    background: #eef7ff;
    border-color: #9fd2ff;
    box-shadow: 0 0 0 0 rgba(0, 143, 255, 0);
    transform: translateY(1px);
  }
  35% {
    background: #e7f4ff;
    border-color: #8ecfff;
    box-shadow: 0 0 0 4px rgba(0, 143, 255, 0.1);
    transform: translateY(0);
  }
  100% {
    background: var(--card-soft);
    border-color: var(--border);
    box-shadow: 0 0 0 0 rgba(0, 143, 255, 0);
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-tab,
  .col.active,
  .left-col.active,
  .center-col.active,
  .right-col.active,
  .empty-msg .msg,
  .random-btn .dice {
    transition: none !important;
    animation: none !important;
  }
}

.shopping-row.checked .shopping-name,
.shopping-row.checked .shopping-qty {
  text-decoration: line-through;
  color: #7b8898;
}

.shopping-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.shopping-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.shopping-qty {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}

.shopping-empty {
  padding: 14px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
}

.shopping-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 4px;
}

.recipe-card h2 {
  margin: 0;
}

.recipe-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 8px;
}

.recipe-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.recipe-title-star {
  flex: 0 0 auto;
  font-size: 22px;
  line-height: 1;
  color: #f2b600;
  margin-top: 2px;
}

.recipe-title-star.is-off {
  color: #b8c4d1;
}

.recipe-title-text {
  min-width: 0;
  flex: 1;
}

.recipe-title-text h2 {
  margin: 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.recipe-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  row-gap: 10px;
}

.recipe-actions-top {
  display: flex;
  gap: 8px;
}

.recipe-actions-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.recipe-meta-inline {
  margin: 6px 0 0 0;
  font-size: 12px;
  line-height: 1.35;
}

.recipe-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-align: center;
}

.recipe-actions .btn {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}

.recipe-actions-top .btn {
  min-width: 92px;
  justify-content: center;
}

.btn.green {
  background: var(--green);
  color: #fff;
}
.btn.red {
  background: var(--red);
  color: #fff;
}

.btn.soft-amber {
  background: #fff4e8;
  border-color: #ffd7ad;
  color: #9a4d00;
}

.btn.soft-amber:hover:not(:disabled) {
  background: #ffeddc;
  border-color: #ffc98f;
  color: #7f3f00;
  box-shadow: none;
}

.btn.soft-amber:active {
  transform: scale(0.97);
}

.btn.soft-green {
  background: #ecfff1;
  border-color: #bfe7cc;
  color: #207245;
}

.btn.soft-green:hover {
  background: #ecfff1;
  border-color: #bfe7cc;
  color: #207245;
  box-shadow: none;
}

.btn.soft-green:active {
  transform: none;
}

.shopping-action-btn {
  min-width: 180px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-left: auto;
}

.shopping-action-btn.is-locked {
  pointer-events: none;
  cursor: default;
}

.shopping-list-btn-pop {
  animation: shoppingListBtnPop 0.28s ease-out 1;
}

@keyframes shoppingListBtnPop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

.recipe-card ul,
.recipe-card ol {
  margin-left: 18px;
}

.recipe-ingredient-item.missing {
  color: #b42318;
  font-weight: 600;
}

.recipe-ingredient-item .missing-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  background: #fff1f1;
  color: #b42318;
  border: 1px solid #f3c1c1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  vertical-align: middle;
}

.recipe-missing-summary {
  margin: 0 0 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff4e8;
  border: 1px solid #ffd7ad;
  color: #9a4d00;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.recipe-header .recipe-missing-summary,
.recipe-actions + .recipe-missing-summary {
  margin-top: 2px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
  box-sizing: border-box;
}

.delete-confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.delete-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  margin: 0;
  flex: 1 1 260px;
  min-width: 0;
}

.delete-confirm-check input {
  width: auto !important;
  min-width: auto !important;
  flex: 0 0 auto;
  margin: 2px 0 0 0;
  accent-color: var(--accent);
}

.delete-confirm-check > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.delete-confirm-check strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.delete-confirm-check .small-muted {
  font-size: 11.5px;
  line-height: 1.3;
}

@media (max-width: 560px) {
  .delete-confirm-row {
    align-items: flex-start;
  }

  .delete-confirm-row > div:last-child {
    width: 100%;
    justify-content: flex-end;
  }
}

.modal {
  background: var(--surface);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 0;
  overflow: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
  transform: scale(0.98);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.modal.show {
  transform: scale(1);
  opacity: 1;
}

.modal .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  margin: 0;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--soft-line);
  transition: box-shadow 0.18s ease;
}

.modal.scrolled .header {
  box-shadow: 0 8px 18px rgba(15, 68, 120, 0.08);
}

.modal .close {
  border-radius: 10px;
  padding: 7px 10px;
  cursor: pointer;
  border: 1px solid #f3b7b7;
  background: #ffeaea;
  color: #b42318;
  font-weight: 700;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.modal .close:hover {
  background: #ffdede;
  border-color: #eba7a7;
  color: #8f1d13;
  box-shadow: none;
}

.modal .close:active {
  transform: scale(0.97);
}

.modal.manage-list {
  width: 72vw;
  max-width: 860px;
  max-height: 80vh;
}

.manage-list-wrap {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal.editor {
  width: 82vw;
  height: 86vh;
  max-width: 980px;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 18px 16px;
  overflow: auto;
}

.modal.settings > div:not(.header),
.modal.small-input > div:not(.header) {
  padding: 16px 18px 18px;
}

.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recipe-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--card-soft);
  border: 1px solid var(--border);
}

.recipe-row.manage-clickable {
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, transform 0.12s ease;
}

.recipe-row.manage-clickable:hover {
  background: var(--row-hover);
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px rgba(0, 143, 255, 0.08);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.modal input,
.modal textarea,
.modal select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.shopping-manual-add .shopping-manual-qty {
  width: 72px !important;
  flex: 0 0 72px;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus {
  outline: none;
  border-color: #8dc7ff;
  box-shadow: var(--focus-ring);
}

.editor-section-card {
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    var(--card-soft) 0%,
    var(--card-soft-2) 100%
  );
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 89, 160, 0.04);
}

.editor-body > .editor-section-card:first-child {
  margin-top: 0;
}

.editor-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 8px;
}

.editor-name-servings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px;
  align-items: end;
}

.editor-name-servings .field label,
.editor-classifications .field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.editor-name-servings input,
.editor-classifications select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  padding: 9px 10px;
  min-height: 40px;
}

.editor-name-servings input:focus,
.editor-classifications select:focus,
.editor-section-card textarea:focus {
  outline: none;
  border-color: #8dc7ff;
  box-shadow: 0 0 0 3px rgba(0, 143, 255, 0.12);
}

.editor-classifications {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 140px;
  gap: 10px;
  align-items: end;
}

.select-add-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
}

.mini-add-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #d8eaff;
  background: #eef6ff;
  color: #0f5ea8;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 68, 120, 0.03);
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.mini-add-btn:hover {
  background: #e4f1ff;
  border-color: #c8e0ff;
  color: #0b4f90;
  box-shadow: none;
}

.mini-add-btn:active {
  transform: scale(0.97);
}

.editor-section-card textarea {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  padding: 10px;
  resize: vertical;
}

.ing-row {
  border: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    var(--card-soft) 0%,
    var(--card-soft-2) 100%
  );
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 89, 160, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.ing-row:hover {
  border-color: var(--border-strong);
  box-shadow: 0 6px 16px rgba(0, 143, 255, 0.06);
}

.ing-row.ingredient-focus {
  border-color: #8dc7ff;
  box-shadow: 0 0 0 3px rgba(0, 143, 255, 0.16),
    0 6px 16px rgba(0, 143, 255, 0.08);
  background: linear-gradient(180deg, #f4faff 0%, #eef7ff 100%);
}

body.dark-mode .ing-row.ingredient-focus {
  border-color: #5eaeea;
  box-shadow: 0 0 0 3px rgba(0, 143, 255, 0.22), 0 8px 20px rgba(0, 0, 0, 0.22);
  background: linear-gradient(180deg, #24384a 0%, #213342 100%);
}

.ing-row.pop-in {
  animation: none;
}

.ing-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.ing-name-wrap {
  flex: 1;
  min-width: 0;
}

.ing-name-input-wrap {
  position: relative;
  width: 100%;
}

.ing-top input[type="text"] {
  width: 100%;
  min-width: 0;
  padding: 10px 38px 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.ing-top input[type="text"]:focus,
.ing-bottom input:focus,
.ing-bottom select:focus {
  outline: none;
  border-color: #8dc7ff;
  box-shadow: 0 0 0 3px rgba(0, 143, 255, 0.12);
  background: #fff;
}

.ing-remove {
  background: #fff1f1;
  color: #b42318;
  border: 1px solid #f3c1c1;
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  flex: 0 0 auto;
}

.ing-remove:hover {
  background: #ffe3e3;
  border-color: #e8aaaa;
  color: #8f1d13;
  box-shadow: none;
}

.ing-remove:active {
  transform: scale(0.97);
}

.ing-name-wrap.has-value .field-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

.ing-name-input-wrap .field-clear-btn:focus {
  opacity: 1;
  pointer-events: auto;
}

.ing-suggestions {
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  max-height: 150px;
  overflow: auto;
  box-shadow: 0 10px 22px rgba(15, 68, 120, 0.08);
}

.ing-suggestion {
  padding: 9px 11px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--soft-line);
  color: var(--text);
  transition: background-color 0.12s ease;
}

.ing-suggestion:last-child {
  border-bottom: none;
}
.ing-suggestion:hover {
  background: var(--row-hover);
}
.ing-suggestion strong {
  color: var(--accent);
}

.ing-existing-status {
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.ing-existing-status.is-new {
  color: #67809d;
}

.ing-existing-status .status-label {
  font-weight: 600;
  color: var(--text-soft);
  margin-right: 2px;
}

.ing-existing-status .status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  line-height: 1;
}

.ing-existing-status .status-pill.in {
  background: #ecfff1;
  color: #207245;
  border-color: #cfeeda;
}

.ing-existing-status .status-pill.out {
  background: #fff1f1;
  color: #b42318;
  border-color: #ffd6d6;
}

.ing-existing-status .status-pill.new {
  background: #f3f8ff;
  color: #4f6b8b;
  border-color: #dce9f8;
}

.ing-bottom {
  display: grid;
  grid-template-columns:
    minmax(84px, 0.9fr) minmax(110px, 1fr) minmax(110px, auto)
    auto;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.ing-bottom input[type="number"],
.ing-bottom select,
.ing-bottom input.unit-inline {
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  min-height: 40px;
}

.ing-inline-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  padding: 0 6px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
}

.ing-inline-check:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
}

.ing-inline-check input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.ing-location {
  min-width: 110px;
}

.editor-footer {
  flex: 0 0 auto;
  padding: 12px 18px;
  background: var(--surface);
  border-top: 1px solid var(--soft-line);
}

.save-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

.save-warn {
  color: var(--warn);
  font-size: 13px;
  background: #ffecec;
  border: 1px solid #ffd3d3;
  padding: 8px 10px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.save-warn.show {
  opacity: 1;
  transform: translateY(0);
}

.invalid {
  border-color: var(--warn) !important;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.18) !important;
}
.pulse-once {
  animation: pulsePink 1.2s ease-out 1;
}

@keyframes pulsePink {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
  }
  35% {
    box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.22);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
  }
}

.row-pulse {
  animation: rowPulse 1.5s ease-out 1;
}

@keyframes rowPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(166, 212, 255, 0);
  }
  20% {
    box-shadow: 0 0 0 8px rgba(166, 212, 255, 0.35);
  }
  40% {
    box-shadow: 0 0 0 0 rgba(166, 212, 255, 0);
  }
  60% {
    box-shadow: 0 0 0 8px rgba(166, 212, 255, 0.28);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(166, 212, 255, 0);
  }
}

.modal.settings {
  width: 420px;
  max-width: 90vw;
}

.modal.small-input {
  width: 420px;
  max-width: 92vw;
  max-height: 60vh;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--soft-line);
}

.setting-row:last-child {
  border-bottom: none;
}
.danger {
  background: #ffecec !important;
  border: 1px solid #ffd1d1 !important;
}

.btn.inline {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
}

.btn.inline.green {
  background: rgba(46, 164, 79, 0.12) !important;
  border-color: rgba(46, 164, 79, 0.35) !important;
  color: #2ea44f !important;
}

.btn.inline.green:hover:not(:disabled) {
  background: rgba(46, 164, 79, 0.18) !important;
  border-color: #2ea44f !important;
  color: #2ea44f !important;
}

.btn.inline.red {
  background: rgba(255, 107, 107, 0.12) !important;
  border-color: rgba(255, 107, 107, 0.35) !important;
  color: #ff6b6b !important;
}

.btn.inline.red:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.18) !important;
  border-color: #ff6b6b !important;
  color: #ff6b6b !important;
}

.small-muted {
  font-size: 13px;
  color: var(--text-soft);
}

.ingredient-usage-header-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.ingredient-usage-delete-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}

.ingredient-usage-delete-toggle input {
  width: auto;
  min-width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.ingredient-usage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ingredient-usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-soft);
}

.ingredient-usage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.ingredient-usage-delete-btn {
  display: none;
}

.ingredient-usage-list.allow-delete .ingredient-usage-delete-btn {
  display: inline-flex;
}

.ingredient-usage-name {
  min-width: 0;
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.ingredient-usage-empty {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 560px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .head-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .head-actions .btn {
    flex: 1 1 calc(50% - 6px);
  }

  .add-ing-row {
    flex-wrap: nowrap;
    align-items: center;
  }

  .add-ing-row .btn {
    width: auto;
    flex: 0 0 auto;
  }

  .add-ing-input-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  .chips {
    gap: 6px;
  }

  .chip {
    min-height: 32px;
    padding: 6px 10px 6px 8px;
    font-size: 12.5px;
  }

  .recipe-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .recipe-actions-top {
    width: 100%;
    gap: 8px;
  }

  .recipe-actions-top .btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .shopping-action-btn {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .shopping-modal-body {
    padding: 14px;
  }

  .shopping-manual-add {
    flex-wrap: nowrap;
    align-items: center;
  }

  .shopping-manual-input-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  .shopping-manual-qty {
    flex: 0 0 76px;
    width: 76px;
    min-width: 76px;
  }

  .shopping-manual-add .btn {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .shopping-actions .btn {
    flex: 0 0 auto;
  }

  .ingredient-usage-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .ingredient-usage-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .editor-footer {
    padding: 12px 14px;
  }

  .filters-main {
    gap: 6px;
  }

  .filters-bar select {
    min-width: calc(50% - 22px);
    flex: 1 1 calc(50% - 22px);
  }

  .filters-utility {
    gap: 6px;
  }
}

body.dark-mode .panel-kicker,
body.dark-mode .panel-subtitle,
body.dark-mode .section-helper {
  color: #9fb1c5;
}

body.dark-mode .chip-badge {
  background: #2a333d;
  border-color: #4e647a;
  color: #9fd0ff;
  box-shadow: none;
}

body.dark-mode .chip-badge.delete {
  background: #4a2a2a;
  border-color: #8a4a4a;
  color: #ffb3b3;
}

body.dark-mode .chip-badge.delete:hover {
  background: #5a3030;
  border-color: #b56565;
  color: #ffd1d1;
}

body.dark-mode .chip.active .chip-badge.delete {
  background: #ff6b6b;
  border-color: #ff6b6b;
  color: #ffffff;
}

body.dark-mode .chip.active .chip-badge.delete:hover {
  background: #ff7d7d;
  border-color: #ff7d7d;
  color: #ffffff;
}

body.dark-mode .chip .arrow {
  background: var(--surface);
  border-color: var(--border);
}

body.dark-mode .recipe-missing-badge,
body.dark-mode .recipe-ingredient-item .missing-tag {
  box-shadow: none;
}

body.dark-mode
  .btn:not(.primary):not(.soft-blue):not(.soft-red):not(.soft-green):not(
    .soft-amber
  ):not(.fav-filter-btn):not(.can-make-btn):not(.red):hover:not(:disabled),
body.dark-mode .g-servings .btn-sv:hover {
  background: #313b46;
  border-color: var(--border-strong);
  color: var(--text);
}

/* Top filter buttons */
body.dark-mode .fav-filter-btn:hover:not(:disabled) {
  background: #313b46 !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

body.dark-mode .fav-filter-btn:hover:not(:disabled) .star {
  color: #d2dbe6 !important;
}

body.dark-mode .fav-filter-btn.active:hover:not(:disabled) {
  background: #5b4d24 !important;
  border-color: #b3923f !important;
  color: #ffe08a !important;
}

body.dark-mode .fav-filter-btn.active:hover:not(:disabled) .star {
  color: #f2b600 !important;
}

body.dark-mode .can-make-btn:hover:not(:disabled) {
  background: #3a4654 !important;
  border-color: #5a6a7d !important;
  color: #eef4fb !important;
  box-shadow: none !important;
}

body.dark-mode .can-make-btn:hover:not(:disabled) .icon {
  color: #d2dbe6 !important;
}

body.dark-mode .can-make-btn.active:hover:not(:disabled) {
  background: #1f3a2d !important;
  border-color: #2f6a4b !important;
  color: #9fe0ba !important;
}

body.dark-mode .can-make-btn.active:hover:not(:disabled) .icon {
  color: #7be0a3 !important;
}

body.dark-mode #clearFilters:hover:not(:disabled) {
  background: #5a3030 !important;
  border-color: #b56565 !important;
  color: #ffd1d1 !important;
  box-shadow: none !important;
}

body.dark-mode .row.selected .name,
body.dark-mode .row.selected .meta {
  color: #17324d;
}

body.dark-mode .ingredient-suggestions,
body.dark-mode .ing-suggestions {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

body.dark-mode .shopping-row.just-added {
  animation: shoppingRowFlashDark 0.9s ease-out 1;
}

@keyframes shoppingRowFlashDark {
  0% {
    background: #24384a;
    border-color: #4f86b8;
    box-shadow: 0 0 0 0 rgba(0, 143, 255, 0);
    transform: translateY(1px);
  }
  35% {
    background: #284156;
    border-color: #62a1dc;
    box-shadow: 0 0 0 4px rgba(0, 143, 255, 0.14);
    transform: translateY(0);
  }
  100% {
    background: var(--card-soft);
    border-color: var(--border);
    box-shadow: 0 0 0 0 rgba(0, 143, 255, 0);
    transform: translateY(0);
  }
}

@media (max-width: 1250px) and (min-width: 1081px) {
  body {
    padding: 14px;
  }

  .stage {
    gap: 14px;
  }

  .left-col {
    width: 285px;
    flex: 0 0 285px;
  }

  .right-col {
    width: 340px;
    flex: 0 0 340px;
  }

  .col {
    padding: 12px;
  }

  .center-col {
    gap: 9px;
    padding: 10px;
  }
}

@media (max-width: 1180px) and (min-width: 1081px) {
  .filters-bar {
    gap: 6px;
  }

  .filters-main {
    gap: 6px;
  }

  .filters-utility {
    gap: 6px;
  }

  .filters-bar select {
    min-width: 92px;
    padding: 8px 8px 8px 9px;
    font-size: 11.5px;
  }

  .filters-bar .btn {
    padding: 8px 10px;
  }

  .g-servings {
    padding: 4px 5px 4px 7px;
  }
}

@media (max-width: 1080px) and (min-width: 901px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
    padding: 16px;
  }

  .app-header {
    margin-bottom: 12px;
  }

  .stage {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
    height: auto;
    margin-top: 10px;
  }

  .left-col,
  .center-col,
  .right-col {
    width: 100%;
    max-width: 100%;
    flex: none;
    height: auto;
    max-height: none;
    padding: 16px;
  }

  .center-col {
    min-width: 0;
  }

  .panel-top {
    gap: 2px;
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .list-wrap {
    height: auto;
    min-height: 360px;
    max-height: 50vh;
  }

  .head-actions .btn.sm {
    flex: 1 1 calc(50% - 4px);
  }
}

@media (max-width: 820px) {
  .panel-subtitle,
  .section-helper {
    font-size: 11.5px;
  }

  .modal.manage-list {
    width: 94vw;
    max-height: 88vh;
  }

  .modal.editor {
    width: 94vw;
    height: 88vh;
  }

  .editor-name-servings {
    grid-template-columns: 1fr;
  }

  .editor-classifications {
    grid-template-columns: 1fr;
  }

  .ing-bottom {
    grid-template-columns: 1fr 1fr;
  }

  .ing-inline-check {
    justify-content: flex-start;
  }

  .filters-utility {
    width: 100%;
    justify-content: flex-end;
  }

  .fav-filter-btn,
  .can-make-btn {
    flex: 0 0 36px;
    justify-content: center;
  }

  .filters-bar .g-servings {
    margin-left: 0;
  }

  .recipe-title-row {
    align-items: flex-start;
  }

  .recipe-title-text {
    min-width: 0;
  }

  /* Recipe image editor */
  .recipe-image-editor {
    display: grid !important;
    grid-template-columns: 120px minmax(0, 1fr) !important;
    gap: 16px !important;
    align-items: center !important;
  }

  .recipe-image-preview-wrap {
    width: 120px !important;
    height: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    min-height: 120px !important;
    max-height: 120px !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px dashed var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
  }

  #modalImagePreview {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  #modalImagePlaceholder {
    padding: 10px;
    text-align: center;
    font-size: 12px;
    color: var(--text-soft);
  }

  .recipe-image-editor-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    min-width: 0;
  }

  .recipe-image-editor-actions input[type="file"],
  .recipe-image-editor-actions .btn {
    width: 100% !important;
  }

  /* Emergency recipe image editor override */
  .editor .recipe-image-editor {
    display: grid !important;
    grid-template-columns: 120px minmax(0, 1fr) !important;
    gap: 16px !important;
    align-items: center !important;
  }

  .editor .recipe-image-preview-wrap {
    width: 120px !important;
    height: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
    min-height: 120px !important;
    max-height: 120px !important;
    overflow: hidden !important;
    display: flex !important;
  }

  .editor #modalImagePreview {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .editor .recipe-image-editor-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    min-width: 0 !important;
  }
}

.image-crop-modal {
  width: min(94vw, 520px);
  max-height: 90vh;
  overflow: hidden;
}

.image-crop-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.crop-frame {
  position: relative;
  width: min(72vw, 360px);
  height: min(72vw, 360px);
  max-width: 360px;
  max-height: 360px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 16px;
  background: #111;
  touch-action: none;
  user-select: none;
}

.crop-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

#cropImage {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  max-height: none;
  transform-origin: center center;
  cursor: grab;
  user-select: none;
  -webkit-user-drag: none;
}

#cropImage.dragging {
  cursor: grabbing;
}

.crop-zoom-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.crop-zoom-label input {
  width: 100%;
}

.crop-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 560px) {
  .image-crop-body {
    padding: 14px;
  }

  .crop-actions {
    flex-direction: column-reverse;
  }

  .crop-actions .btn {
    width: 100%;
  }
}

/* Large recipe image viewer */
#recipeImageBackdrop {
  padding: 24px;
  box-sizing: border-box;
}

#recipeImageBackdrop .modal {
  width: min(90vw, 760px);
  max-height: calc(100vh - 48px);
  overflow: hidden;
}

#recipeImageBackdrop .recipe-image-modal-body {
  padding: 20px;
}

#recipeImageLarge {
  width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  display: block;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.recipe-image-modal-body img {
  width: 100%;
  max-height: calc(85vh - 120px);
  object-fit: contain;
  display: block;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-backdrop {
  background: rgba(0, 0, 0, 0);
  transition: background-color 0.18s ease;
}

.modal-backdrop.modal-open {
  background: rgba(0, 0, 0, 0.4);
}

.modal {
  transform: scale(0.98);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.modal.show {
  transform: scale(1);
  opacity: 1;
}

.modal.dimmed-behind-confirm {
  opacity: 0 !important;
  transform: scale(0.96) !important;
  pointer-events: none !important;
}

.recipe-check-list {
  list-style: none;
  padding-left: 0;
  margin: 2px 0 12px;
}

.recipe-check-row {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 5px 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  transition: opacity 0.18s ease, color 0.18s ease;
}

.recipe-check-row input {
  margin-top: 2px;
  flex: 0 0 auto;
}

.recipe-check-text {
  font-size: 13px;
  line-height: 1.35;
}

.recipe-check-row.checked {
  opacity: 0.45;
  color: var(--text-soft);
}

/* No strikethrough */
.recipe-check-row.checked .recipe-check-text {
  text-decoration: none;
}

@media (max-width: 900px) {
  .ingredients-panel,
  .recipes-panel,
  .viewer-panel {
    transition: transform 0.22s ease, opacity 0.22s ease;
  }

  .mobile-slide-out-left {
    transform: translateX(-24px);
    opacity: 0;
  }

  .mobile-slide-out-right {
    transform: translateX(24px);
    opacity: 0;
  }

  .mobile-slide-in-left {
    animation: mobileSlideInLeft 0.22s ease both;
  }

  .mobile-slide-in-right {
    animation: mobileSlideInRight 0.22s ease both;
  }

  @keyframes mobileSlideInLeft {
    from {
      transform: translateX(-24px);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  @keyframes mobileSlideInRight {
    from {
      transform: translateX(24px);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }
}

.editor-name-servings {
  grid-template-columns: minmax(0, 1fr) 140px 140px;
}

@media (max-width: 820px) {
  .editor-name-servings {
    grid-template-columns: 1fr 1fr;
  }

  .editor-name-servings .field:first-child {
    grid-column: 1 / -1;
  }
}

.recipe-meta-line {
  display: flex;
  align-items: baseline;
  column-gap: 5px;
  row-gap: 1px;
  flex-wrap: wrap;
  margin: 2px 0 0;
}

.recipe-time-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.2;
}

.recipe-time-icon {
  font-size: 14px;
  line-height: 1;
  transform: translateY(1px);
}

.recipe-meta-inline {
  line-height: 1.2;
}

.recipe-title-text h2 {
  margin-bottom: 12px;
}

.shopping-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

body.dark-mode .shopping-count-badge {
  background: #3d78aa;
  color: #eef7ff;
}

.mini-add-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  background: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  color: #fff !important;
  font-size: 0 !important;
}

.mini-add-btn::before {
  content: "+";
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.mini-add-btn:hover {
  background: #0b85ea !important;
  border-color: #0b85ea !important;
  color: #fff !important;
}

body.dark-mode .mini-add-btn {
  background: #173450 !important;
  border-color: #2f5f8a !important;
  color: #dceeff !important;
}

body.dark-mode .mini-add-btn::before {
  color: #dceeff;
}

body.dark-mode .mini-add-btn:hover {
  background: #20496f !important;
  border-color: #3d78aa !important;
  color: #eef7ff !important;
}

body.dark-mode .mini-add-btn:hover::before {
  color: #eef7ff;
}

.add-recipe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-plus-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #207245;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

body.dark-mode .btn-plus-icon {
  background: #3f8a5c;
  color: #fff;
}

/* =========================================================
   UNIFIED BUTTON / STATUS DESIGN SYSTEM v1
   Add this at the very bottom of styles.css
   ========================================================= */

/* ---------- Light mode tokens ---------- */
:root {
  --ui-neutral-bg: #ffffff;
  --ui-neutral-border: #dbe8f6;
  --ui-neutral-text: #17324d;
  --ui-neutral-hover-bg: #f4f9ff;
  --ui-neutral-hover-border: #b8dcff;

  --ui-primary-bg: #eaf5ff;
  --ui-primary-border: #b8dcff;
  --ui-primary-text: #005fae;
  --ui-primary-hover-bg: #dff0ff;
  --ui-primary-hover-border: #99ceff;
  --ui-primary-hover-text: #004f91;

  --ui-primary-solid-bg: #008fff;
  --ui-primary-solid-border: #008fff;
  --ui-primary-solid-text: #ffffff;
  --ui-primary-solid-hover-bg: #0b85ea;
  --ui-primary-solid-hover-border: #0b85ea;

  --ui-success-bg: #ecfff1;
  --ui-success-border: #bdecc9;
  --ui-success-text: #207245;
  --ui-success-hover-bg: #dcf8e5;
  --ui-success-hover-border: #9fe0b3;

  --ui-danger-bg: #fff1f1;
  --ui-danger-border: #ffbcbc;
  --ui-danger-text: #b42318;
  --ui-danger-hover-bg: #ffe3e3;
  --ui-danger-hover-border: #f29b9b;

  --ui-warning-bg: #fff7ea;
  --ui-warning-border: #ffd39b;
  --ui-warning-text: #9a5600;
  --ui-warning-hover-bg: #fff0d6;
  --ui-warning-hover-border: #ffc06f;

  --ui-disabled-bg: #f4f7fb;
  --ui-disabled-border: #dbe8f6;
  --ui-disabled-text: #6f8095;
}

/* ---------- Dark mode tokens ---------- */
body.dark-mode {
  --ui-neutral-bg: #25303a;
  --ui-neutral-border: #425061;
  --ui-neutral-text: #c7d3e0;
  --ui-neutral-hover-bg: #313b46;
  --ui-neutral-hover-border: #4a5868;

  --ui-primary-bg: #173450;
  --ui-primary-border: #2f5f8a;
  --ui-primary-text: #dceeff;
  --ui-primary-hover-bg: #20496f;
  --ui-primary-hover-border: #3d78aa;
  --ui-primary-hover-text: #eef7ff;

  --ui-primary-solid-bg: #173450;
  --ui-primary-solid-border: #2f5f8a;
  --ui-primary-solid-text: #dceeff;
  --ui-primary-solid-hover-bg: #20496f;
  --ui-primary-solid-hover-border: #3d78aa;

  --ui-success-bg: #173d27;
  --ui-success-border: #2f6b45;
  --ui-success-text: #d9ffe5;
  --ui-success-hover-bg: #1f5736;
  --ui-success-hover-border: #3f8a5c;

  --ui-danger-bg: #4a2020;
  --ui-danger-border: #8a3a3a;
  --ui-danger-text: #ffdede;
  --ui-danger-hover-bg: #642929;
  --ui-danger-hover-border: #a84a4a;

  --ui-warning-bg: #4a3518;
  --ui-warning-border: #8a6730;
  --ui-warning-text: #ffe7b8;
  --ui-warning-hover-bg: #60451f;
  --ui-warning-hover-border: #a67a36;

  --ui-disabled-bg: #252d36;
  --ui-disabled-border: #394552;
  --ui-disabled-text: #7f91a6;
}

/* ---------- Base buttons ---------- */
.btn,
.btn.inline,
.btn.sm {
  background: var(--ui-neutral-bg) !important;
  border-color: var(--ui-neutral-border) !important;
  color: var(--ui-neutral-text) !important;
  box-shadow: none;
}

.btn:hover:not(:disabled),
.btn.inline:hover:not(:disabled),
.btn.sm:hover:not(:disabled) {
  background: var(--ui-neutral-hover-bg) !important;
  border-color: var(--ui-neutral-hover-border) !important;
  color: var(--ui-neutral-text) !important;
}

/* ---------- Primary / blue ---------- */
.btn.primary,
.btn.soft-blue {
  background: var(--ui-primary-solid-bg) !important;
  border-color: var(--ui-primary-solid-border) !important;
  color: var(--ui-primary-solid-text) !important;
}

.btn.primary:hover:not(:disabled),
.btn.soft-blue:hover:not(:disabled) {
  background: var(--ui-primary-solid-hover-bg) !important;
  border-color: var(--ui-primary-solid-hover-border) !important;
  color: var(--ui-primary-solid-text) !important;
}

/* ---------- Success / green ---------- */
.btn.soft-green,
.btn.green {
  background: var(--ui-success-bg) !important;
  border-color: var(--ui-success-border) !important;
  color: var(--ui-success-text) !important;
}

.btn.soft-green:hover:not(:disabled),
.btn.green:hover:not(:disabled) {
  background: var(--ui-success-hover-bg) !important;
  border-color: var(--ui-success-hover-border) !important;
  color: var(--ui-success-text) !important;
}

/* ---------- Danger / red ---------- */
.btn.soft-red,
.btn.red,
.btn.danger,
#resetAppBtn.red {
  background: var(--ui-danger-bg) !important;
  border-color: var(--ui-danger-border) !important;
  color: var(--ui-danger-text) !important;
}

.btn.soft-red:hover:not(:disabled),
.btn.red:hover:not(:disabled),
.btn.danger:hover:not(:disabled),
#resetAppBtn.red:hover:not(:disabled) {
  background: var(--ui-danger-hover-bg) !important;
  border-color: var(--ui-danger-hover-border) !important;
  color: var(--ui-danger-text) !important;
}

/* ---------- Warning / amber ---------- */
.btn.soft-amber,
.shopping-action-btn.soft-amber,
#viewerAddMissingToShopping.soft-amber {
  background: var(--ui-warning-bg) !important;
  border-color: var(--ui-warning-border) !important;
  color: var(--ui-warning-text) !important;
}

.btn.soft-amber:hover:not(:disabled),
.shopping-action-btn.soft-amber:hover:not(:disabled),
#viewerAddMissingToShopping.soft-amber:hover:not(:disabled) {
  background: var(--ui-warning-hover-bg) !important;
  border-color: var(--ui-warning-hover-border) !important;
  color: var(--ui-warning-text) !important;
}

/* ---------- Disabled / unavailable ---------- */
.btn:disabled,
.btn.disabled,
#viewerAddMissingToShopping:disabled:not(.soft-green) {
  background: var(--ui-disabled-bg) !important;
  border-color: var(--ui-disabled-border) !important;
  color: var(--ui-disabled-text) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  cursor: default !important;
}

/* ---------- Shopping button success ---------- */
#viewerAddMissingToShopping.soft-green,
.shopping-action-btn.soft-green {
  background: var(--ui-success-bg) !important;
  border-color: var(--ui-success-border) !important;
  color: var(--ui-success-text) !important;
}

#viewerAddMissingToShopping.soft-green:hover:not(:disabled),
.shopping-action-btn.soft-green:hover:not(:disabled) {
  background: var(--ui-success-hover-bg) !important;
  border-color: var(--ui-success-hover-border) !important;
  color: var(--ui-success-text) !important;
}

/* ---------- Modal close and remove buttons ---------- */
.modal .close,
.ing-remove {
  background: var(--ui-danger-bg) !important;
  border-color: var(--ui-danger-border) !important;
  color: var(--ui-danger-text) !important;
}

.modal .close:hover,
.ing-remove:hover {
  background: var(--ui-danger-hover-bg) !important;
  border-color: var(--ui-danger-hover-border) !important;
  color: var(--ui-danger-text) !important;
}

/* ---------- Small circular field clear buttons ---------- */
.field-clear-btn {
  background: var(--ui-danger-bg) !important;
  border-color: var(--ui-danger-border) !important;
  color: var(--ui-danger-text) !important;
}

.field-clear-btn:hover {
  background: var(--ui-danger-hover-bg) !important;
  border-color: var(--ui-danger-hover-border) !important;
  color: var(--ui-danger-text) !important;
}

/* ---------- Mini add buttons: cuisine / collection ---------- */
.mini-add-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  background: var(--ui-primary-solid-bg) !important;
  border-color: var(--ui-primary-solid-border) !important;
  color: var(--ui-primary-solid-text) !important;
  font-size: 0 !important;
}

.mini-add-btn::before {
  content: "+";
  color: var(--ui-primary-solid-text);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.mini-add-btn:hover {
  background: var(--ui-primary-solid-hover-bg) !important;
  border-color: var(--ui-primary-solid-hover-border) !important;
  color: var(--ui-primary-solid-text) !important;
}

/* ---------- Add Recipe plus icon ---------- */
.add-recipe-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}

.btn-plus-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--ui-success-text);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

body.dark-mode .btn-plus-icon {
  background: #3f8a5c;
  color: #ffffff;
}

/* ---------- Filter icon buttons ---------- */
.fav-filter-btn,
.can-make-btn {
  background: var(--ui-neutral-bg) !important;
  border-color: var(--ui-neutral-border) !important;
  color: var(--ui-disabled-text) !important;
}

.fav-filter-btn.active {
  background: var(--ui-warning-bg) !important;
  border-color: var(--ui-warning-border) !important;
  color: var(--ui-warning-text) !important;
}

.can-make-btn.active {
  background: var(--ui-success-bg) !important;
  border-color: var(--ui-success-border) !important;
  color: var(--ui-success-text) !important;
}

.fav-filter-btn:hover:not(:disabled) {
  background: var(--ui-warning-hover-bg) !important;
  border-color: var(--ui-warning-hover-border) !important;
  color: var(--ui-warning-text) !important;
}

.can-make-btn:hover:not(:disabled) {
  background: var(--ui-success-hover-bg) !important;
  border-color: var(--ui-success-hover-border) !important;
  color: var(--ui-success-text) !important;
}

.fav-filter-btn:disabled,
.fav-filter-btn.disabled {
  background: var(--ui-disabled-bg) !important;
  border-color: var(--ui-disabled-border) !important;
  color: var(--ui-disabled-text) !important;
}

/* ---------- Missing states ---------- */
.recipe-missing-summary,
.recipe-missing-badge,
.missing-tag,
.recipe-ingredient-item .missing-tag {
  background: var(--ui-danger-bg) !important;
  border-color: var(--ui-danger-border) !important;
  color: var(--ui-danger-text) !important;
}

/* ---------- Status pills ---------- */
.status-pill.in,
.existing-ing-pill.status-in {
  background: var(--ui-success-bg) !important;
  border-color: var(--ui-success-border) !important;
  color: var(--ui-success-text) !important;
}

.status-pill.out,
.existing-ing-pill.status-out {
  background: var(--ui-danger-bg) !important;
  border-color: var(--ui-danger-border) !important;
  color: var(--ui-danger-text) !important;
}

.status-pill,
.ing-existing-status .status-pill {
  background: var(--ui-neutral-bg) !important;
  border-color: var(--ui-neutral-border) !important;
  color: var(--ui-neutral-text) !important;
}

/* ---------- File upload button ---------- */
input[type="file"]::file-selector-button {
  background: var(--ui-primary-bg) !important;
  border: 1px solid var(--ui-primary-border) !important;
  color: var(--ui-primary-text) !important;
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: var(--ui-primary-hover-bg) !important;
  border-color: var(--ui-primary-hover-border) !important;
  color: var(--ui-primary-hover-text) !important;
}

/* Light mode: soft-blue buttons should be soft, not solid */
body:not(.dark-mode) .btn.soft-blue {
  background: var(--ui-primary-bg) !important;
  border-color: var(--ui-primary-border) !important;
  color: var(--ui-primary-text) !important;
}

body:not(.dark-mode) .btn.soft-blue:hover:not(:disabled) {
  background: var(--ui-primary-hover-bg) !important;
  border-color: var(--ui-primary-hover-border) !important;
  color: var(--ui-primary-hover-text) !important;
}

/* Mini add buttons - compact green version */
.mini-add-btn {
  width: 42px !important;
  min-width: 42px !important;
  height: 40px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 12px !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

/* Keep the + visually centred */
.mini-add-btn {
  transform: translateY(-1px);
}

@media (max-width: 820px) {
  .mini-add-btn {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    font-size: 21px !important;
  }
}

/* Remove old generated mini-add plus */
.mini-add-btn::before {
  content: none !important;
  display: none !important;
}

.recipe-search-box {
  margin-bottom: 10px;
}

.recipe-search-wrap {
  position: relative;
}

.recipe-search-wrap input {
  width: 100%;
  padding-right: 38px;
}

.recipe-search-wrap .field-clear-btn {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* Recipe search box */
.recipe-search-box {
  margin: 0 0 10px;
}

.recipe-search-wrap {
  position: relative;
  width: 100%;
}

.recipe-search-wrap input {
  width: 100%;
  min-height: 40px;
  padding: 10px 38px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease,
    background-color 0.16s ease;
}

.recipe-search-wrap input::placeholder {
  color: var(--text-soft);
}

.recipe-search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.recipe-search-wrap .field-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* Hide clear button until search has value */
.recipe-search-wrap:not(.has-value) .field-clear-btn {
  opacity: 0;
  pointer-events: none;
}

/* Dark mode */
body.dark-mode .recipe-search-wrap input {
  background: var(--input-bg);
  border-color: var(--border);
  color: var(--text);
}

body.dark-mode .recipe-search-wrap input::placeholder {
  color: var(--text-soft);
}

/* Manage Recipes modal metadata */
.manage-recipe-meta {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.3;
}

.manage-meta-top {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  color: var(--text-soft);
}

.manage-meta-top .list-time-meta {
  color: var(--text);
}

.manage-meta-bottom {
  color: var(--text-soft);
}

/* Settings modal cleanup */
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.setting-text {
  min-width: 0;
}

.setting-text strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13.5px;
  color: var(--text);
}

.setting-text .small-muted {
  font-size: 12px;
  line-height: 1.35;
}

.settings-button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.setting-row-danger {
  border-color: color-mix(in srgb, var(--ui-danger-border) 70%, var(--border));
}

@media (max-width: 560px) {
  .setting-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .setting-row .btn,
  .settings-button-group .btn {
    width: 100%;
  }

  .settings-button-group {
    justify-content: stretch;
  }
}

/* Prevent Settings modal content/borders being clipped */
#settingsBackdrop .modal {
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding-bottom: 28px !important;
  box-sizing: border-box;
}

#settingsBackdrop .settings-body {
  padding-bottom: 10px;
  overflow: visible;
}

#settingsBackdrop .setting-row {
  overflow: visible;
}

#settingsBackdrop .setting-row-danger {
  margin-bottom: 3px;
  border-color: transparent !important;
  box-shadow: inset 0 0 0 1px
    color-mix(in srgb, var(--ui-danger-border) 70%, var(--border));
}

/* Time filter and recipe sort controls */
#filterTime,
#sortRecipes {
  min-width: 112px;
}

/* Recipe search + quick filter layout */
.recipe-search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
}

.recipe-search-wrap {
  min-width: 0;
}

.recipe-search-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.recipe-search-actions .fav-filter-btn,
.recipe-search-actions .can-make-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
}

/* Dropdown filter layout */
.filters-main {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.filters-main select {
  width: 100%;
  min-width: 0;
}

/* Let the sort dropdown take a little more room when it wraps */
#sortRecipes {
  min-width: 0;
}

/* Star / can-make filters beside search */
.recipe-search-actions .fav-filter-btn,
.recipe-search-actions .can-make-btn {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

/* Neutral/off state */
.recipe-search-actions .fav-filter-btn,
.recipe-search-actions .can-make-btn {
  background: var(--ui-primary-bg) !important;
  border: 1px solid var(--ui-primary-border) !important;
  color: var(--ui-primary-text) !important;
}

.recipe-search-actions .fav-filter-btn:hover:not(:disabled),
.recipe-search-actions .can-make-btn:hover:not(:disabled) {
  background: var(--ui-primary-hover-bg) !important;
  border-color: var(--ui-primary-hover-border) !important;
  color: var(--ui-primary-hover-text) !important;
}

/* Favourite active */
.recipe-search-actions .fav-filter-btn.active {
  background: var(--ui-warning-bg) !important;
  border-color: var(--ui-warning-border) !important;
  color: var(--ui-warning-text) !important;
}

/* Can Make active */
.recipe-search-actions .can-make-btn.active {
  background: var(--ui-success-bg) !important;
  border-color: var(--ui-success-border) !important;
  color: var(--ui-success-text) !important;
}

/* Disabled */
.recipe-search-actions .fav-filter-btn:disabled,
.recipe-search-actions .can-make-btn:disabled,
.recipe-search-actions .fav-filter-btn.disabled,
.recipe-search-actions .can-make-btn.disabled {
  background: var(--ui-disabled-bg) !important;
  border-color: var(--ui-disabled-border) !important;
  color: var(--ui-disabled-text) !important;
  opacity: 1 !important;
  cursor: not-allowed;
}

/* Move global servings into Recipes header */
.recipes-panel-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.recipes-heading-text {
  min-width: 0;
}

.header-servings {
  justify-self: end;
  margin-top: 0;
  white-space: nowrap;
}

/* Dropdown filter layout */
.filters-main {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)) !important;
  gap: 8px !important;
  align-items: center !important;
  width: 100% !important;
  min-width: 0 !important;
}

.filters-main select {
  width: 100% !important;
  min-width: 0 !important;
}

#filterTime,
#sortRecipes {
  min-width: 0 !important;
}

/* Hide the old utility row if it still exists */
.filters-utility {
  display: none;
}

@media (max-width: 520px) {
  .recipes-panel-top {
    grid-template-columns: 1fr;
  }

  .header-servings {
    justify-self: start;
  }
}

/* Header servings control */
.header-servings.g-servings {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 7px 8px !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  background: var(--surface-soft) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.header-servings.g-servings span {
  font-size: 13px;
  color: var(--text);
}

.header-servings.g-servings button {
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  padding: 0 !important;
  border: 1px solid var(--ui-primary-border) !important;
  border-radius: 8px !important;
  background: var(--ui-primary-bg) !important;
  color: var(--ui-primary-text) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  cursor: pointer;
}

.header-servings.g-servings button:hover {
  background: var(--ui-primary-hover-bg) !important;
  border-color: var(--ui-primary-hover-border) !important;
  color: var(--ui-primary-hover-text) !important;
}

.header-servings.g-servings input {
  width: 42px !important;
  min-width: 42px !important;
  height: 26px !important;
  padding: 0 6px !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  background: var(--input-bg) !important;
  color: var(--text) !important;
  text-align: center !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

/* Clear filters icon beside search */
.recipe-search-actions .filter-clear-icon-btn {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

/* Cleaner recipe list rows */
#recipeList .row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 12px !important;
  align-items: center !important;
  padding: 14px 16px !important;
  min-height: 64px;
}

.recipe-row-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#recipeList .row .name {
  min-width: 0;
  max-width: 100%;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#recipeList .row .meta,
#recipeList .row .recipe-row-meta {
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-row-side {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.recipe-row-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
}

.recipe-row-time-icon {
  font-size: 12px;
  line-height: 1;
  transform: translateY(1px);
}

#recipeList .row .recipe-fav-btn {
  flex: 0 0 auto;
}

/* Keep missing badges tidy inside the row */
#recipeList .row .recipe-missing-badge {
  align-self: flex-start;
  margin-top: 2px;
}

/* Slightly tighter on narrow screens */
@media (max-width: 520px) {
  #recipeList .row {
    padding: 12px 12px !important;
    gap: 10px !important;
    min-height: 60px;
  }

  #recipeList .row .name {
    font-size: 13.5px;
  }

  #recipeList .row .meta,
  #recipeList .row .recipe-row-meta,
  .recipe-row-time {
    font-size: 11.5px;
  }

  .recipe-row-side {
    gap: 8px;
  }
}

/* Dark mode recipe list selected row */
body.dark-mode #recipeList .row.selected {
  background: rgba(0, 143, 255, 0.22) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 143, 255, 0.38) !important;
}

body.dark-mode #recipeList .row.selected .name {
  color: #ffffff !important;
}

body.dark-mode #recipeList .row.selected .meta,
body.dark-mode #recipeList .row.selected .recipe-row-meta,
body.dark-mode #recipeList .row.selected .recipe-row-time {
  color: #d9ecff !important;
}

body.dark-mode #recipeList .row.selected .recipe-row-time-icon {
  opacity: 0.95;
}

/* Active search/filter indicators */
.filters-main select.filter-active {
  background: var(--ui-primary-bg) !important;
  border-color: var(--ui-primary-border) !important;
  color: var(--ui-primary-text) !important;
  box-shadow: inset 0 0 0 1px var(--ui-primary-border);
}

.recipe-search-wrap.filter-active input {
  background: var(--ui-primary-bg) !important;
  border-color: var(--ui-primary-border) !important;
  color: var(--ui-primary-text) !important;
  box-shadow: inset 0 0 0 1px var(--ui-primary-border);
}

body.dark-mode .filters-main select.filter-active,
body.dark-mode .recipe-search-wrap.filter-active input {
  background: rgba(0, 143, 255, 0.16) !important;
  border-color: rgba(0, 143, 255, 0.55) !important;
  color: var(--text) !important;
}

/* Combined ingredient search/add helper */
.ingredient-search-helper {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--text-soft);
}

/* Unit dropdown + add button inside recipe ingredient rows */
.ing-bottom .ing-unit-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.ing-bottom .ing-unit-wrap select {
  width: 100%;
  min-width: 0;
}

.ing-bottom .ing-unit-wrap .mini-add-btn {
  width: 40px !important;
  min-width: 40px !important;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}

/* Add in-stock ingredients to manual shopping list */
.stock-shopping-search-wrap {
  position: relative;
  margin-bottom: 10px;
}

.stock-shopping-search-wrap input {
  width: 100%;
  min-width: 0;
  padding: 8px 36px 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--soft-border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 13px;
}

.stock-shopping-search-wrap.has-value .field-clear-btn {
  opacity: 1;
  pointer-events: auto;
}

.stock-shopping-bulk-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.stock-shopping-bulk-actions .btn {
  flex: 1;
}

.stock-shopping-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.stock-shopping-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-soft);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.stock-shopping-row:hover {
  background: var(--row-hover);
}

.stock-shopping-row input {
  width: 16px;
  height: 16px;
}

.stock-shopping-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 560px) {
  .stock-shopping-bulk-actions,
  .stock-shopping-footer {
    flex-direction: column;
  }

  .stock-shopping-bulk-actions .btn,
  .stock-shopping-footer .btn {
    width: 100%;
  }
}

/* Manual shopping quantity controls */
.manual-shopping-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.manual-qty-control {
  display: inline-grid;
  grid-template-columns: 30px 52px 30px;
  gap: 5px;
  align-items: center;
  justify-content: end;
}

.manual-qty-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--ui-primary-border);
  background: var(--ui-primary-bg);
  color: var(--ui-primary-text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.manual-qty-btn:hover:not(:disabled) {
  background: var(--ui-primary-hover-bg);
  border-color: var(--ui-primary-hover-border);
  color: var(--ui-primary-hover-text);
}

.manual-qty-btn:disabled {
  background: var(--ui-disabled-bg) !important;
  border-color: var(--ui-disabled-border) !important;
  color: var(--ui-disabled-text) !important;
  cursor: not-allowed;
}

.manual-qty-input {
  width: 52px;
  height: 30px;
  min-width: 0;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 560px) {
  .manual-shopping-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .manual-shopping-row .manual-qty-control {
    grid-column: 2;
    justify-content: start;
    margin-top: 4px;
  }
}

/* Shopping list: desktop two-column layout */
#shoppingBackdrop .modal.manage-list {
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
}

#shoppingBackdrop .shopping-modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
  overflow: hidden;
}

#shoppingBackdrop .shopping-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 14px;
}

#shoppingBackdrop .shopping-section-head {
  flex: 0 0 auto;
}

#shoppingBackdrop #shoppingListItems,
#shoppingBackdrop #manualShoppingListItems {
  flex: 1 1 auto;
  min-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

#shoppingBackdrop .shopping-actions {
  flex: 0 0 auto;
  margin-top: 12px;
}

#shoppingBackdrop .shopping-manual-add {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

/* Mobile/tablet: stack shopping sections */
@media (max-width: 760px) {
  #shoppingBackdrop .modal.manage-list {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
  }

  #shoppingBackdrop .shopping-modal-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: 14px;
  }

  #shoppingBackdrop .shopping-section {
    min-height: auto;
  }

  #shoppingBackdrop #shoppingListItems,
  #shoppingBackdrop #manualShoppingListItems {
    min-height: 0;
    max-height: none;
    overflow: visible;
  }
}

/* Add In-Stock Ingredients modal: keep footer buttons visible */
#stockShoppingBackdrop .stock-shopping-modal {
  width: min(430px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden !important;
}

#stockShoppingBackdrop .stock-shopping-modal .header {
  flex: 0 0 auto;
}

#stockShoppingBackdrop .stock-shopping-modal > div:not(.header) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#stockShoppingBackdrop .stock-shopping-search-wrap,
#stockShoppingBackdrop .stock-shopping-bulk-actions,
#stockShoppingBackdrop .stock-shopping-footer,
#stockShoppingBackdrop .stock-shopping-modal .small-muted {
  flex: 0 0 auto;
}

#stockShoppingBackdrop .stock-shopping-list {
  flex: 1 1 auto;
  min-height: 130px;
  max-height: none !important;
  overflow-y: auto;
}

#stockShoppingBackdrop .stock-shopping-footer {
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--soft-line);
  background: var(--surface);
}

body.dark-mode #stockShoppingBackdrop .stock-shopping-footer {
  background: var(--surface);
}

@media (max-width: 560px) {
  #stockShoppingBackdrop .stock-shopping-modal {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
  }

  #stockShoppingBackdrop .stock-shopping-list {
    min-height: 120px;
  }
}

/* Keep Add In-Stock Ingredients modal height stable while searching */
#stockShoppingBackdrop .stock-shopping-modal {
  height: min(680px, calc(100dvh - 24px)) !important;
  max-height: calc(100dvh - 24px) !important;
}

#stockShoppingBackdrop .stock-shopping-modal > div:not(.header) {
  min-height: 0 !important;
}

#stockShoppingBackdrop .stock-shopping-list {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
}

/* Keep footer visually anchored */
#stockShoppingBackdrop .stock-shopping-footer {
  flex: 0 0 auto !important;
  margin-top: 12px !important;
}

/* Meal Planner modal */
#mealPlannerBackdrop .meal-planner-modal {
  width: min(1120px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.meal-planner-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 14px;
}

.meal-planner-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--soft-line);
}

.meal-planner-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.meal-planner-helper {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-soft);
}

.meal-planner-grid {
  display: grid;
  grid-template-columns: 80px repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.meal-planner-cell {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
}

.meal-planner-corner,
.meal-planner-slot-head,
.meal-planner-day-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.meal-planner-slot-head {
  background: var(--ui-primary-bg);
  border-color: var(--ui-primary-border);
  color: var(--ui-primary-text);
}

.meal-planner-day-head {
  background: var(--surface);
  color: var(--text);
}

.meal-planner-slot-cell {
  min-height: 92px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meal-plan-empty {
  height: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}

.meal-plan-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
  box-shadow: var(--shadow-sm);
}

.meal-plan-entry span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dark-mode .meal-planner-slot-head {
  background: rgba(0, 143, 255, 0.18);
  border-color: rgba(0, 143, 255, 0.45);
  color: var(--text);
}

@media (max-width: 760px) {
  #mealPlannerBackdrop .meal-planner-modal {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
  }

  .meal-planner-top {
    grid-template-columns: 1fr;
  }

  .meal-planner-top .btn {
    width: 100%;
  }

  .meal-planner-grid {
    grid-template-columns: 72px repeat(3, minmax(150px, 1fr));
  }

  .meal-planner-slot-cell {
    min-height: 86px;
  }
}

/* Add to Meal Planner modal */
.add-meal-plan-modal {
  width: min(460px, calc(100vw - 24px));
}

.add-meal-plan-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.add-meal-plan-recipe-name {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.add-meal-plan-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-meal-plan-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.add-meal-plan-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.meal-plan-day-options {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.meal-plan-option-btn {
  min-height: 38px;
  padding: 8px 10px;
}

.meal-plan-option-btn.active {
  background: var(--ui-primary-bg) !important;
  border-color: var(--ui-primary-border) !important;
  color: var(--ui-primary-text) !important;
  box-shadow: inset 0 0 0 1px var(--ui-primary-border);
}

.add-meal-plan-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Planned meal remove button */
.meal-plan-entry {
  grid-template-columns: minmax(0, 1fr) auto;
}

.meal-plan-remove-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 999px;
  border: 1px solid var(--ui-danger-border);
  background: var(--ui-danger-bg);
  color: var(--ui-danger-text);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.meal-plan-remove-btn:hover {
  background: var(--ui-danger-hover-bg);
  border-color: var(--ui-danger-hover-border);
  color: var(--ui-danger-hover-text);
}

@media (max-width: 560px) {
  .meal-plan-day-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .add-meal-plan-footer {
    flex-direction: column;
  }

  .add-meal-plan-footer .btn {
    width: 100%;
  }
}

/* Meal Planner modal spacing refinement */
#mealPlannerBackdrop .meal-planner-modal {
  padding: 0 !important;
}

#mealPlannerBackdrop .meal-planner-modal .header {
  padding: 22px 24px 18px !important;
  border-bottom: 1px solid var(--soft-line);
}

#mealPlannerBackdrop .meal-planner-body {
  padding: 18px 24px 24px !important;
}

#mealPlannerBackdrop .meal-planner-top {
  padding-bottom: 14px;
  margin-bottom: 2px;
}

#mealPlannerBackdrop .meal-planner-grid {
  padding: 2px 4px 8px 0;
}

@media (max-width: 560px) {
  #mealPlannerBackdrop .meal-planner-modal .header {
    padding: 18px 18px 14px !important;
  }

  #mealPlannerBackdrop .meal-planner-body {
    padding: 14px 18px 18px !important;
  }

  #mealPlannerBackdrop .meal-planner-grid {
    padding-right: 2px;
  }
}

/* Meal Planner: compact single-meal slots */
.meal-planner-slot-cell {
  min-height: 64px !important;
  padding: 7px !important;
}

.meal-plan-empty {
  border-style: dashed !important;
  opacity: 0.75;
}

.meal-plan-entry {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  gap: 8px !important;
  align-items: center !important;
  padding: 6px 8px !important;
  min-height: 42px;
}

.meal-plan-entry-img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  flex: 0 0 auto;
}

.meal-plan-entry span {
  font-size: 12px;
  line-height: 1.2;
}

.meal-plan-remove-btn {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  font-size: 10px !important;
}

.meal-planner-corner,
.meal-planner-slot-head,
.meal-planner-day-head {
  min-height: 40px !important;
}

/* Add to Planner warning */
#addToMealPlanWarn {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--ui-danger-border);
  background: var(--ui-danger-bg);
  color: var(--ui-danger-text);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
}

#addToMealPlanWarn.show {
  animation: plannerWarnPulse 0.22s ease-out 1;
}

@keyframes plannerWarnPulse {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.025);
  }
  100% {
    transform: scale(1);
  }
}

/* Meal Planner slot-picking mode */
.meal-planner-picker-notice {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
}

.meal-planner-picker-notice.info {
  background: var(--ui-primary-bg);
  border: 1px solid var(--ui-primary-border);
  color: var(--ui-primary-text);
}

.meal-planner-picker-notice.success {
  background: var(--ui-success-bg);
  border: 1px solid var(--ui-success-border);
  color: var(--ui-success-text);
}

.meal-planner-picker-notice.error {
  background: var(--ui-danger-bg);
  border: 1px solid var(--ui-danger-border);
  color: var(--ui-danger-text);
}

.meal-plan-slot-pickable {
  cursor: pointer;
  outline: 2px dashed rgba(0, 143, 255, 0.28);
  outline-offset: -5px;
  transition: background-color 0.15s ease, transform 0.12s ease,
    outline-color 0.15s ease;
}

.meal-plan-slot-pickable:hover {
  background: var(--ui-primary-bg);
  outline-color: var(--ui-primary-border);
  transform: translateY(-1px);
}

.meal-plan-slot-occupied {
  cursor: not-allowed;
  opacity: 0.9;
}

.meal-plan-slot-occupied:hover {
  box-shadow: inset 0 0 0 1px var(--ui-danger-border);
}

body.dark-mode .meal-plan-slot-pickable {
  outline-color: rgba(0, 143, 255, 0.42);
}

body.dark-mode .meal-plan-slot-pickable:hover {
  background: rgba(0, 143, 255, 0.16);
}

/* Meal Planner: suggested column while adding recipe */
.meal-plan-suggested-column-head {
  background: var(--ui-success-bg) !important;
  border-color: var(--ui-success-border) !important;
  color: var(--ui-success-text) !important;
  box-shadow: inset 0 0 0 1px var(--ui-success-border);
}

.meal-plan-suggested-column {
  background: color-mix(
    in srgb,
    var(--ui-success-bg) 65%,
    var(--surface-soft)
  ) !important;
  border-color: var(--ui-success-border) !important;
}

.meal-plan-suggested-column.meal-plan-slot-pickable {
  outline-color: var(--ui-success-border);
}

.meal-plan-suggested-column.meal-plan-slot-pickable:hover {
  background: var(--ui-success-bg) !important;
  outline-color: var(--ui-success-border);
}

body.dark-mode .meal-plan-suggested-column {
  background: rgba(46, 164, 79, 0.16) !important;
  border-color: rgba(46, 164, 79, 0.45) !important;
}

body.dark-mode .meal-plan-suggested-column-head {
  background: rgba(46, 164, 79, 0.22) !important;
  border-color: rgba(46, 164, 79, 0.55) !important;
  color: var(--text) !important;
}

/* Meal Planner recipe entries are clickable */
.meal-plan-entry {
  cursor: pointer;
}

.meal-plan-entry:hover {
  border-color: var(--ui-primary-border);
  background: var(--ui-primary-bg);
}

.meal-plan-entry:hover span {
  color: var(--ui-primary-text);
}

.meal-plan-entry .meal-plan-remove-btn {
  cursor: pointer;
}

/* Meal Planner entry layout: keep remove button aligned */
.meal-plan-entry {
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  overflow: hidden;
}

.meal-plan-entry.has-image {
  grid-template-columns: 34px minmax(0, 1fr) auto !important;
}

.meal-plan-entry span {
  min-width: 0 !important;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

.meal-plan-entry .meal-plan-remove-btn {
  justify-self: end;
  flex: 0 0 auto;
  margin-left: 4px;
}

/* Recipe list thumbnails */
#recipeList .row {
  grid-template-columns: 48px minmax(0, 1fr) auto !important;
}

.recipe-row-thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

.recipe-row-img,
.recipe-row-img-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.recipe-row-img-placeholder {
  color: var(--text-soft);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

body.dark-mode .recipe-row-img,
body.dark-mode .recipe-row-img-placeholder {
  background: var(--surface-soft);
  border-color: var(--border);
}

@media (max-width: 520px) {
  #recipeList .row {
    grid-template-columns: 42px minmax(0, 1fr) auto !important;
  }

  .recipe-row-thumb,
  .recipe-row-img,
  .recipe-row-img-placeholder {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }

  .recipe-row-img-placeholder {
    font-size: 8.5px;
  }
}

/* Recipe list thumbnails: larger image, softer no-image placeholder */
#recipeList .row {
  grid-template-columns: 58px minmax(0, 1fr) auto !important;
  padding: 8px 14px !important;
  min-height: 68px;
}

.recipe-row-thumb,
.recipe-row-img,
.recipe-row-img-placeholder {
  width: 58px !important;
  height: 58px !important;
  border-radius: 13px !important;
}

.recipe-row-img {
  object-fit: cover;
}

.recipe-row-img-placeholder {
  color: #aebdcb !important;
  font-size: 8.5px !important;
  font-weight: 800;
  line-height: 1.05;
  opacity: 0.65;
}

body.dark-mode .recipe-row-img-placeholder {
  color: #6f8092 !important;
  opacity: 0.7;
}

@media (max-width: 520px) {
  #recipeList .row {
    grid-template-columns: 50px minmax(0, 1fr) auto !important;
    padding: 8px 12px !important;
    min-height: 62px;
  }

  .recipe-row-thumb,
  .recipe-row-img,
  .recipe-row-img-placeholder {
    width: 50px !important;
    height: 50px !important;
    border-radius: 11px !important;
  }

  .recipe-row-img-placeholder {
    font-size: 7.8px !important;
  }
}

/* Recipe image upload/camera buttons */
.recipe-image-picker-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
}

.recipe-image-file-input {
  display: none;
}

.mobile-camera-btn {
  display: none !important;
}

@media (max-width: 760px) {
  .recipe-image-picker-actions {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-camera-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
}

/* Recipe list thumbnail actions */
.recipe-row-img-btn {
  position: relative;
  width: 58px !important;
  height: 58px !important;
  border-radius: 13px !important;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-soft);
}

.recipe-row-img-btn.has-image:hover {
  border-color: var(--ui-primary-border);
  box-shadow: inset 0 0 0 1px var(--ui-primary-border);
}

.recipe-row-img-btn.has-image:hover::after {
  content: "View";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 25, 50, 0.42);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.recipe-row-img-btn .recipe-row-img {
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: 0 !important;
  object-fit: cover;
  display: block;
}

.recipe-row-img-btn.no-image {
  border-style: dashed;
}

.recipe-row-no-image-text,
.recipe-row-add-image-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aebdcb;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: opacity 0.15s ease;
}

.recipe-row-add-image-text {
  opacity: 0;
  color: var(--ui-primary-text);
}

.recipe-row-img-btn.no-image:hover {
  background: var(--ui-primary-bg);
  border-color: var(--ui-primary-border);
}

.recipe-row-img-btn.no-image:hover .recipe-row-no-image-text {
  opacity: 0;
}

.recipe-row-img-btn.no-image:hover .recipe-row-add-image-text {
  opacity: 1;
}

body.dark-mode .recipe-row-no-image-text {
  color: #6f8092;
}

body.dark-mode .recipe-row-img-btn.has-image:hover::after {
  background: rgba(0, 0, 0, 0.5);
}

@media (max-width: 520px) {
  .recipe-row-img-btn {
    width: 50px !important;
    height: 50px !important;
    border-radius: 11px !important;
  }

  .recipe-row-no-image-text,
  .recipe-row-add-image-text {
    font-size: 7.8px;
  }
}

/* Recipe list thumbnail hover refinements */
.recipe-row-img-btn.no-image:hover {
  background: var(--ui-success-bg) !important;
  border-color: var(--ui-success-border) !important;
}

.recipe-row-img-btn.no-image:hover .recipe-row-add-image-text {
  color: var(--ui-success-text) !important;
}

.recipe-row-img-btn.has-image:hover::after {
  background: rgba(0, 25, 50, 0.28) !important;
}

body.dark-mode .recipe-row-img-btn.has-image:hover::after {
  background: rgba(0, 0, 0, 0.34) !important;
}

/* Recipe viewer: planner/shopping action buttons */
.recipe-actions-right {
  margin-left: 0 !important;
  width: 100% !important;
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
}

#viewerAddToMealPlan {
  margin-left: 0 !important;
}

#viewerAddMissingToShopping {
  margin-left: 0 !important;
}

.recipe-actions-right .btn {
  flex: 0 1 auto;
}

/* Consistent checkbox styling: removes native click/enlarge twitch */
input[type="checkbox"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background-color: var(--surface);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 12px 12px;
  cursor: pointer;
  transform: none !important;
  transition: background-color 0.12s ease, border-color 0.12s ease,
    box-shadow 0.12s ease !important;
}

input[type="checkbox"]:active {
  transform: none !important;
}

input[type="checkbox"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 8.2 6.7 11 12.2 5' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

body.dark-mode input[type="checkbox"] {
  background-color: var(--input-bg);
  border-color: var(--border-strong);
}

body.dark-mode input[type="checkbox"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* Ingredient Usage: action buttons */
.ingredient-usage-actions .btn {
  min-height: 34px;
  padding: 7px 11px;
}

@media (max-width: 560px) {
  .ingredient-usage-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Force custom checkboxes to stay perfectly square */
input[type="checkbox"] {
  box-sizing: border-box !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  padding: 0 !important;
  aspect-ratio: 1 / 1 !important;
  display: inline-grid !important;
  place-content: center !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

/* Ingredient Usage: align Allow delete checkbox */
.ingredient-usage-allow-delete,
.allow-delete-row {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

/* Recipe viewer: section tick-all headings */
.recipe-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
}

.recipe-section-title h3 {
  margin: 0 !important;
  line-height: 1.2;
}

.recipe-section-master-check {
  flex: 0 0 auto;
}

/* Recipe viewer: reduce checkbox list indent */
.recipe-check-list {
  list-style: none !important;
  padding-left: 0 !important;
  margin: 8px 0 18px !important;
}

.recipe-check-row {
  display: grid !important;
  grid-template-columns: 18px minmax(0, 1fr) !important;
  gap: 8px !important;
  align-items: start !important;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

.recipe-check-row .recipe-progress-check {
  margin-top: 2px !important;
}

.recipe-check-text {
  min-width: 0;
}

/* Slightly soften completed items */
.recipe-check-row.checked .recipe-check-text {
  opacity: 0.48;
}

/* Recipe viewer: show half-state checkbox */
input[type="checkbox"]:indeterminate {
  background-color: #8ecbf5 !important;
  border-color: #8ecbf5 !important;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 8h8' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-size: 12px 12px !important;
}

body.dark-mode input[type="checkbox"]:indeterminate {
  background-color: #5faee8 !important;
  border-color: #5faee8 !important;
}

/* Recipe viewer: give list items a neat indent under the heading text */
#ingListWrap .recipe-check-list,
.recipe-section-title + .recipe-check-list {
  padding-left: 28px !important;
}

#ingListWrap .recipe-check-row,
.recipe-section-title + .recipe-check-list .recipe-check-row {
  margin-left: 0 !important;
}

/* Recipe viewer: title dropdown menu */
.recipe-title-row {
  position: relative;
  align-items: flex-start;
}

.recipe-title-text {
  min-width: 0;
  flex: 1 1 auto;
}

.recipe-title-menu {
  position: relative;
  flex: 0 0 auto;
  align-self: flex-start;
  margin-left: 4px;
  z-index: 20;
}

.recipe-more-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 4px;
}

.recipe-more-btn:hover,
.recipe-more-btn[aria-expanded="true"] {
  background: var(--ui-primary-bg);
  border-color: var(--ui-primary-border);
  color: var(--ui-primary-text);
}

.recipe-more-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 160px;
  display: none;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(15, 35, 55, 0.18);
  z-index: 50;
}

.recipe-more-menu.show {
  display: grid;
  gap: 4px;
}

body.dark-mode .recipe-more-menu {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

@media (max-width: 520px) {
  .recipe-more-btn {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .recipe-more-menu {
    width: 150px;
  }
}

/* Recipe Viewer: move more-actions menu into panel header */
.viewer-panel,
.viewer-panel .panel-top {
  overflow: visible !important;
}

.viewer-panel-top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 12px !important;
  align-items: start !important;
  position: relative;
}

.viewer-panel-heading {
  min-width: 0;
}

.viewer-header-menu {
  position: relative;
  justify-self: end;
  align-self: start;
  z-index: 100;
  margin-left: 8px;
}

.viewer-header-menu .recipe-more-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 0 4px !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.viewer-header-menu .recipe-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 170px;
  display: none;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(15, 35, 55, 0.18);
  z-index: 120;
}

.viewer-header-menu .recipe-more-menu.show {
  display: grid;
  gap: 8px;
}

body.dark-mode .viewer-header-menu .recipe-more-menu {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

/* Recipe Viewer: header dropdown menu */
.viewer-panel,
.viewer-panel .panel-top {
  overflow: visible !important;
}

.viewer-panel-top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 12px !important;
  align-items: start !important;
  position: relative;
}

.viewer-panel-heading {
  min-width: 0;
}

.viewer-header-menu {
  position: relative;
  justify-self: end;
  align-self: start;
  z-index: 100;
}

.viewer-header-menu .recipe-more-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 0 4px !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.viewer-header-menu .recipe-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 140px;
  display: none;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(15, 35, 55, 0.18);
  z-index: 120;
}

.viewer-header-menu .recipe-more-menu.show {
  display: grid;
  gap: 8px;
}

.viewer-header-menu .recipe-more-menu .btn {
  width: 100%;
}

body.dark-mode .viewer-header-menu .recipe-more-menu {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

/* Ingredient Manager: header options dropdown */
.ingredient-panel-top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 12px !important;
  align-items: start !important;
  position: relative;
  overflow: visible !important;
}

.ingredient-panel-heading {
  min-width: 0;
}

.ingredient-options-menu {
  position: relative;
  justify-self: end;
  align-self: start;
  z-index: 80;
}

.ingredient-more-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 0 4px !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

.ingredient-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  display: none;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(15, 35, 55, 0.18);
  z-index: 120;
}

.ingredient-more-menu.show {
  display: grid;
  gap: 8px;
}

.ingredient-menu-check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 8px 9px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
}

.ingredient-menu-check-row span {
  white-space: nowrap;
}

.ingredient-menu-check-row:hover {
  background: var(--surface-soft);
}

.ingredient-menu-check-row input {
  margin: 0 !important;
}

body.dark-mode .ingredient-more-menu {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

/* Meal Planner: drag and drop planned meals */
.meal-plan-entry[draggable="true"] {
  cursor: grab;
}

.meal-plan-entry[draggable="true"]:active {
  cursor: grabbing;
}

.meal-plan-drag-source {
  opacity: 0.45;
  transform: scale(0.98);
}

/* Green suggested column while dragging */
.meal-plan-drag-suggested {
  background: color-mix(
    in srgb,
    var(--ui-success-bg) 65%,
    var(--surface-soft)
  ) !important;
  border-color: var(--ui-success-border) !important;
}

.meal-planner-slot-head.meal-plan-drag-suggested {
  background: var(--ui-success-bg) !important;
  border-color: var(--ui-success-border) !important;
  color: var(--ui-success-text) !important;
  box-shadow: inset 0 0 0 1px var(--ui-success-border);
}

/* Blue hover target */
.meal-plan-drag-over {
  outline: 2px dashed var(--ui-primary-border) !important;
  outline-offset: -5px;
  background: var(--ui-primary-bg) !important;
}

/* Red occupied target: will ask swap/replace */
.meal-plan-drag-swap {
  outline: 2px dashed var(--ui-danger-border) !important;
  outline-offset: -5px;
  background: var(--ui-danger-bg) !important;
}

.meal-plan-dragging .meal-planner-slot-cell {
  transition: background-color 0.12s ease, outline-color 0.12s ease,
    transform 0.12s ease;
}

.meal-plan-dragging .meal-planner-slot-cell:hover {
  transform: translateY(-1px);
}

body.dark-mode .meal-plan-drag-suggested {
  background: rgba(46, 164, 79, 0.16) !important;
  border-color: rgba(46, 164, 79, 0.45) !important;
}

body.dark-mode .meal-plan-drag-over {
  background: rgba(0, 143, 255, 0.16) !important;
}

body.dark-mode .meal-plan-drag-swap {
  background: rgba(244, 63, 94, 0.14) !important;
}

/* Meal Planner: keep swap/replace confirmation above the planner modal */
#mealPlanDropConfirmBackdrop {
  z-index: 9999 !important;
}

#mealPlanDropConfirmBackdrop .modal {
  z-index: 10000 !important;
}

/* Meal Planner: swap/replace confirmation text spacing */
#mealPlanDropConfirmText {
  margin: 0 !important;
  padding: 16px 20px 10px !important;
  line-height: 1.45 !important;
}

#mealPlanDropConfirmBackdrop .modal-actions {
  padding: 10px 20px 20px !important;
  margin: 0 !important;
}

/* Meal Planner: swap/replace confirmation action layout */
#mealPlanDropConfirmBackdrop .meal-plan-drop-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 10px 20px 20px !important;
  margin: 0 !important;
}

.meal-plan-drop-main-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#mealPlanDropConfirmBackdrop .meal-plan-drop-actions .btn {
  min-width: 70px;
}

@media (max-width: 460px) {
  #mealPlanDropConfirmBackdrop .meal-plan-drop-actions {
    align-items: stretch !important;
  }

  .meal-plan-drop-main-actions {
    flex: 1 1 auto;
  }

  #mealPlanDropConfirmBackdrop .meal-plan-drop-actions .btn {
    min-width: 0;
  }
}

/* Add In-Stock Ingredients: simplify bulk actions */
.stock-shopping-bulk-actions {
  display: none !important;
}

/* Add In-Stock Ingredients: footer action layout */
.stock-shopping-footer.stock-shopping-footer-split {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.stock-shopping-footer.stock-shopping-footer-split .btn {
  min-width: 110px;
}

#addSelectedStockShoppingBtn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

/* Shopping List: choose ingredients button near manual input */
.choose-ingredients-btn {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
}

#shoppingBackdrop .manual-shopping-add-row + .choose-ingredients-btn {
  margin-bottom: 14px;
}

/* Shopping List: tighten manual input + choose ingredients spacing */
#shoppingBackdrop .shopping-manual-add {
  margin-bottom: 0px !important;
}

#shoppingBackdrop .choose-ingredients-btn {
  margin-top: 0 !important;
  margin-bottom: 14px !important;
}

/* Recipe list: highlight recipes already used in the Meal Planner */
.planned-highlight-btn {
  width: 40px;
  min-width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.12s ease;
}

.planned-highlight-btn:hover {
  background: var(--ui-success-bg);
  border-color: var(--ui-success-border);
  color: var(--ui-success-text);
}

.planned-highlight-btn.active {
  background: var(--ui-success-bg);
  border-color: var(--ui-success-border);
  color: var(--ui-success-text);
}

#recipeList .row.planned-recipe-row {
  border-color: var(--ui-success-border) !important;
  box-shadow: inset 4px 0 0 var(--ui-success-border),
    0 2px 8px rgba(15, 68, 120, 0.06);
}

#recipeList .row.planned-recipe-row:not(.selected) {
  background: var(--ui-success-bg) !important;
}

body.dark-mode #recipeList .row.planned-recipe-row:not(.selected) {
  background: rgba(46, 164, 79, 0.16) !important;
}

body.dark-mode .planned-highlight-btn.active {
  background: rgba(46, 164, 79, 0.18);
  border-color: rgba(46, 164, 79, 0.45);
}

/* Meal Planner: top action buttons */
.meal-planner-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  .meal-planner-actions {
    width: 100%;
    justify-content: stretch;
  }

  .meal-planner-actions .btn {
    flex: 1 1 100%;
  }
}

/* Meal Planner: clear planner confirmation */
#clearMealPlannerConfirmBackdrop {
  z-index: 9999 !important;
}

#clearMealPlannerConfirmBackdrop .modal {
  z-index: 10000 !important;
}

#clearMealPlannerConfirmText {
  margin: 0 !important;
  padding: 16px 20px 10px !important;
  line-height: 1.45 !important;
}

#clearMealPlannerConfirmBackdrop .clear-meal-planner-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 10px 20px 20px !important;
  margin: 0 !important;
}

#mealPlanToShoppingBtn {
  min-width: 260px;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

/* Mobile recipe list compact layout */
@media (max-width: 900px) {
  /* Keep the recipe panel top area available, but hide the repeated heading text */
  .recipes-panel .panel-top {
    display: block !important;
    padding: 0 !important;
    margin: 0 0 8px !important;
    border-bottom: 0 !important;
  }

  .recipes-panel .panel-kicker,
  .recipes-panel .panel-top h3,
  .recipes-panel .panel-subtitle {
    display: none !important;
  }

  /* Tighten the mobile tabs */
  .mobile-tabs {
    margin-bottom: 10px !important;
  }

  .mobile-tab {
    min-height: 42px !important;
    padding: 8px 10px !important;
  }

  /* Tighten global servings */
  .filters-utility {
    margin-bottom: 10px !important;
  }

  .g-servings {
    min-height: 34px !important;
  }

  .g-servings button,
  .g-servings input {
    height: 30px !important;
  }

  /* Search row slightly tighter */
  .recipe-search-row {
    gap: 7px !important;
    margin-bottom: 8px !important;
  }

  .recipe-search-wrap input {
    height: 36px !important;
  }

  .recipe-search-row button,
  .planned-highlight-btn,
  #clearFilters {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
  }

  /* Mobile filters are hidden until opened */
  .mobile-recipe-filters-toggle {
    display: flex !important;
    width: 100%;
    justify-content: center;
    margin: 0 0 8px !important;
    min-height: 36px !important;
  }

  .recipes-panel .filters-bar {
    display: none !important;
  }

  .recipes-panel.mobile-filters-open .filters-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
    margin-bottom: 10px !important;
  }

  .recipes-panel .filters-bar select {
    min-height: 36px !important;
    height: 36px !important;
    font-size: 12px !important;
  }

  /* Compact recipe cards */
  #recipeList .row {
    min-height: 56px !important;
    padding: 7px 8px !important;
    gap: 9px !important;
  }

  #recipeList .recipe-thumb,
  #recipeList .recipe-thumb img,
  #recipeList .recipe-thumb-placeholder {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
  }

  #recipeList .recipe-thumb-placeholder {
    font-size: 7px !important;
    line-height: 1.05 !important;
  }

  #recipeList .recipe-row-title {
    font-size: 12.5px !important;
    line-height: 1.15 !important;
  }

  #recipeList .recipe-row-meta {
    font-size: 11px !important;
    line-height: 1.15 !important;
    margin-top: 2px !important;
  }

  #recipeList .recipe-fav-btn {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 11px !important;
  }
}

/* Desktop: keep the filter toggle hidden */
@media (min-width: 901px) {
  .mobile-recipe-filters-toggle {
    display: none !important;
  }
}

/* Mobile recipe list: compact servings row */
@media (max-width: 900px) {
  .recipes-panel .filters-utility {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    margin: 0 0 8px !important;
  }

  .recipes-panel .g-servings {
    width: auto !important;
    min-height: 34px !important;
    padding: 3px 6px !important;
    border-radius: 12px !important;
  }

  .recipes-panel .g-servings label {
    font-size: 12px !important;
  }

  .recipes-panel .g-servings button,
  .recipes-panel .g-servings input {
    height: 28px !important;
    min-height: 28px !important;
  }

  .recipes-panel .g-servings input {
    width: 42px !important;
  }
}

/* Mobile recipe list: tidy collapsible filters */
@media (max-width: 900px) {
  .mobile-recipe-filters-toggle {
    min-height: 34px !important;
    height: 34px !important;
    margin: 0 0 8px !important;
    border-radius: 12px !important;
    font-size: 12.5px !important;
  }

  .recipes-panel.mobile-filters-open .filters-bar {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 10px !important;
    margin: 0 0 10px !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    background: var(--surface-soft) !important;
  }

  .recipes-panel.mobile-filters-open .filters-bar select {
    width: 100% !important;
    min-width: 0 !important;
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 11px !important;
    font-size: 12px !important;
  }

/* Mobile recipe filters: compact 2-row layout */
@media (max-width: 900px) {
  .recipes-panel.mobile-filters-open .filters-bar {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .recipes-panel.mobile-filters-open .filters-bar select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .recipes-panel.mobile-filters-open #filterMealType {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open #filterCuisine {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open #filterCollection {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open #filterTime {
    grid-column: span 3 !important;
  }

  .recipes-panel.mobile-filters-open #sortRecipes {
    grid-column: span 3 !important;
  }
}

/* Mobile recipe filters: compact 2-row layout */
@media (max-width: 900px) {
  .recipes-panel.mobile-filters-open .filters-bar {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .recipes-panel.mobile-filters-open .filters-bar select {
    width: 100% !important;
    min-width: 0 !important;
    height: 34px !important;
    min-height: 34px !important;
  }

  .recipes-panel.mobile-filters-open #filterMealType {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open #filterCuisine {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open #filterCollection {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open #filterTime {
    grid-column: span 3 !important;
  }

  .recipes-panel.mobile-filters-open #sortRecipes {
    grid-column: span 3 !important;
  }
}

/* Mobile recipe filters: compact 2-row layout */
@media (max-width: 900px) {
  .recipes-panel.mobile-filters-open .filters-bar {
    padding: 10px !important;
    margin: 0 0 10px !important;
  }

  .recipes-panel.mobile-filters-open .filters-main {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .recipes-panel.mobile-filters-open .filters-main select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 34px !important;
    min-height: 34px !important;
  }

  .recipes-panel.mobile-filters-open .filters-main #filterMealType {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open .filters-main #filterCuisine {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open .filters-main #filterCollection {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open .filters-main #filterTime {
    grid-column: span 3 !important;
  }

  .recipes-panel.mobile-filters-open .filters-main #sortRecipes {
    grid-column: span 3 !important;
  }
}

/* Mobile recipe filters: compact 2-row layout - fixed */
@media (max-width: 900px) {
  .recipes-panel.mobile-filters-open .filters-bar {
    width: 100% !important;
    padding: 10px !important;
    margin: 0 0 10px !important;
  }

  .recipes-panel.mobile-filters-open .filters-main {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: none !important;
  }

  /* Force the actual grid items/wrappers to stretch */
  .recipes-panel.mobile-filters-open .filters-main > * {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  .recipes-panel.mobile-filters-open .filters-main select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 34px !important;
    min-height: 34px !important;
    display: block !important;
  }

  /* Top row: 3 equal dropdowns */
  .recipes-panel.mobile-filters-open .filters-main > *:has(#filterMealType),
  .recipes-panel.mobile-filters-open .filters-main #filterMealType {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open .filters-main > *:has(#filterCuisine),
  .recipes-panel.mobile-filters-open .filters-main #filterCuisine {
    grid-column: span 2 !important;
  }

  .recipes-panel.mobile-filters-open .filters-main > *:has(#filterCollection),
  .recipes-panel.mobile-filters-open .filters-main #filterCollection {
    grid-column: span 2 !important;
  }

  /* Second row: 2 wider dropdowns */
  .recipes-panel.mobile-filters-open .filters-main > *:has(#filterTime),
  .recipes-panel.mobile-filters-open .filters-main #filterTime {
    grid-column: span 3 !important;
  }

  .recipes-panel.mobile-filters-open .filters-main > *:has(#sortRecipes),
  .recipes-panel.mobile-filters-open .filters-main #sortRecipes {
    grid-column: span 3 !important;
  }
}

/* Mobile recipe filters: final compact 2-row layout */
@media (max-width: 900px) {
  .recipes-panel.mobile-filters-open .filters-bar {
    display: block !important;
    width: 100% !important;
    padding: 10px !important;
    margin: 0 0 10px !important;
    border: 1px solid var(--border) !important;
    border-radius: 16px !important;
    background: var(--surface-soft) !important;
  }

  .recipes-panel.mobile-filters-open .filters-main {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .recipes-panel.mobile-filters-open .filters-main select {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 7px 9px !important;
    font-size: 12px !important;
    border-radius: 11px !important;
  }

  /* Top row: 3 equal filters */
  .recipes-panel.mobile-filters-open #filterMealType,
  .recipes-panel.mobile-filters-open #filterCuisine,
  .recipes-panel.mobile-filters-open #filterCollection {
    flex: 1 1 calc((100% - 16px) / 3) !important;
  }

  /* Second row: 2 equal filters */
  .recipes-panel.mobile-filters-open #filterTime,
  .recipes-panel.mobile-filters-open #sortRecipes {
    flex: 1 1 calc((100% - 8px) / 2) !important;
  }
}

/* Mobile recipe list: compact bottom action buttons */
@media (max-width: 900px) {
  .recipes-panel .quick-controls {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }

  .recipes-panel .quick-actions {
    display: contents !important;
  }

  .recipes-panel #randomBtn,
  .recipes-panel #addRecipeBtn,
  .recipes-panel #manageBtn,
  .recipes-panel #mealPlannerBtn,
  .recipes-panel #shoppingListBtn {
    width: 100% !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 7px 8px !important;
    font-size: 12px !important;
    border-radius: 11px !important;
    white-space: nowrap !important;
  }

  .recipes-panel #manageBtn,
  .recipes-panel #mealPlannerBtn,
  .recipes-panel #shoppingListBtn {
    grid-column: auto !important;
  }

  .recipes-panel #manageBtn {
    grid-column: 1 / 2 !important;
  }

  .recipes-panel #mealPlannerBtn {
    grid-column: 2 / 3 !important;
  }

  .recipes-panel #shoppingListBtn {
    grid-column: 1 / -1 !important;
  }
}

/* Mobile recipe list: compact bottom action buttons */
@media (max-width: 900px) {
  .recipes-panel .quick-controls {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }

  .recipes-panel #randomBtn,
  .recipes-panel #addRecipeBtn {
    grid-column: span 3 !important;
  }

  .recipes-panel #manageBtn,
  .recipes-panel #mealPlannerBtn,
  .recipes-panel #shoppingListBtn {
    grid-column: span 2 !important;
  }

  .recipes-panel #randomBtn,
  .recipes-panel #addRecipeBtn,
  .recipes-panel #manageBtn,
  .recipes-panel #mealPlannerBtn,
  .recipes-panel #shoppingListBtn {
    width: 100% !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 7px 6px !important;
    font-size: 12px !important;
    border-radius: 11px !important;
    white-space: nowrap !important;
  }
}

/* Desktop recipe list: restore quick controls to 2-line layout */
@media (min-width: 901px) {
  .recipes-panel .quick-controls {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-top: 14px !important;
  }

  .recipes-panel #randomBtn {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  .recipes-panel #addRecipeBtn,
  .recipes-panel #manageBtn,
  .recipes-panel #mealPlannerBtn,
  .recipes-panel #shoppingListBtn {
    grid-column: auto !important;
    width: 100% !important;
    min-height: 40px !important;
  }
}

/* Recipe quick controls: desktop original layout */
@media (min-width: 901px) {
  .recipes-panel .quick-controls {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
    margin-top: 14px !important;
  }

  .recipes-panel .quick-controls-random {
    display: flex !important;
    justify-content: center !important;
  }

  .recipes-panel .quick-controls-actions {
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: nowrap !important;
  }

  .recipes-panel .quick-controls-actions .btn {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
  }

  .recipes-panel #randomBtn {
    width: 100% !important;
  }
}

/* Recipe quick controls: compact mobile layout */
@media (max-width: 900px) {
  .recipes-panel .quick-controls {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }

  .recipes-panel .quick-controls-random,
  .recipes-panel .quick-controls-actions {
    display: contents !important;
  }

  .recipes-panel #randomBtn,
  .recipes-panel #addRecipeBtn {
    grid-column: span 3 !important;
  }

  .recipes-panel #manageBtn,
  .recipes-panel #mealPlannerBtn,
  .recipes-panel #shoppingListBtn {
    grid-column: span 2 !important;
  }

  .recipes-panel #randomBtn,
  .recipes-panel #addRecipeBtn,
  .recipes-panel #manageBtn,
  .recipes-panel #mealPlannerBtn,
  .recipes-panel #shoppingListBtn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 7px 6px !important;
    font-size: 12px !important;
    border-radius: 11px !important;
    white-space: nowrap !important;
  }
}
