/* === Reset & Base Styles === */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden; /* Prevent full-page scroll */
  color-scheme: light;
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #222;
}

body.dark-theme {
  color-scheme: dark;
}

.auth-banner {
  background: #111;
  color: #f5f5f5;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.auth-banner .auth-buttons {
  display: flex;
  gap: 0.5rem;
}

.auth-banner button {
  background: #2d2d2d;
  color: #f5f5f5;
  border: none;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
}

.auth-banner button:hover {
  background: #3f3f3f;
}

.auth-banner button.hidden,
.auth-banner .hidden {
  display: none;
}

.auth-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-dialog.hidden {
  display: none;
}

.auth-dialog-content {
  background: #ffffff;
  color: #111;
  padding: 2rem;
  border-radius: 10px;
  width: min(92%, 420px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  position: relative;
}

.auth-dialog-content h2 {
  margin-top: 0;
}

.auth-dialog-content .close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.auth-dialog-content form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-dialog-content input {
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #d0d0d0;
  font-size: 1rem;
}

.auth-dialog-content button.primary {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.65rem;
  border-radius: 6px;
  cursor: pointer;
}

.auth-dialog-content button.primary:hover {
  background: var(--accent-hover);
}

.auth-dialog-content button.link {
  background: none;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  padding: 0;
  font-size: 0.95rem;
}

.auth-error {
  color: #d93025;
  min-height: 1.2rem;
  margin-top: 0.25rem;
}

.auth-switch {
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

:root {
  --accent-color: #FF6600;
  --accent-hover: #ff8533;  /* lighter orange for hover */
  --accent-active: #cc5200; /* darker burnt orange for active */
}

/* === Header & Navigation === */
#app-header {
  background: #f8f8f8;
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
}

/* Keep landing page .logo untouched; size only the header logo */
#app-header img.logo {
  height: 60px;
  max-height: 60px;
  width: auto;
  vertical-align: middle;
}

#app-header .logo-link {
  display: inline-block;
  line-height: 0;
  margin-right: 8px;
  text-decoration: none;
}

#app-header .app-title {
  display: flex;         /* keeps logo + title aligned */
  align-items: center;
  gap: 8px;
  margin: 0 0 0.5rem;
}


.app-title {
  margin: 0 0 0.5rem;
}

.header-controls {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.controls-left,
.controls-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.controls-right {
  margin-left: auto;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.hidden {
  display: none !important;
}

.week-nav button,
#preferences-btn {
  margin-right: 0.5rem;
}

#subscription-btn {
  background: #d32f2f;
  color: white;
}

#subscription-btn:hover {
  background: #b71c1c;
}

/* === Tabs === */
#tab-nav .tab,
.recipe-mode-tabs .tab {
  background: #eee;
  color: #333;
  border: none;
  border-radius: 4px 4px 0 0;
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  box-sizing: border-box;
  vertical-align: middle;
  gap: 6px;
}

#tab-nav .tab:hover,
.recipe-mode-tabs .tab:hover {
  background-color: var(--accent-hover);
  color: #fff;
}

#tab-nav .tab.active,
.recipe-mode-tabs .tab.active {
  background-color: var(--accent-color);
  color: #fff;
  box-shadow: inset 0 -2px 0 0 var(--accent-active);
}

.tab {
  padding: 0 1rem;
  background: var(--accent-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  box-sizing: border-box;
  vertical-align: middle;
  gap: 6px;
}

.tab.active {
  background: var(--accent-hover);
  color: #fff;
}

/* === Content Visibility === */
.tab-content {
  display: block;
}

.tab-content.hidden {
  display: none;
}

/* === Week Header === */
.week-header {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

/* === Meal Table === */
#meal-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-bottom: 1rem;
}

#meal-table th,
#meal-table td {
  border: 1px solid #ddd;
  padding: 0.5rem;
  vertical-align: top;
  overflow: hidden;
  min-height: 3rem;
}

#meal-table th {
  background: #var(--accent-color);
  font-weight: bold;
  text-align: center;
}

#meal-table .meal-label {
  white-space: nowrap;
  font-weight: bold;
}

.meal-cell {
  cursor: pointer;
  position: relative;
}

.meal-cell .meal-name {
  display: block;
  margin-bottom: 0.25rem;
}

.meal-cell .status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.25rem;
}

/* === Plan Actions === */
.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* === Recipe Browser === */
.library-controls {
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.browse-container {
  display: flex;
  gap: 1rem;
  height: 100%;
}

.browse-container.single-pane {
  flex-direction: column;
}

.recipe-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.recipe-list li {
  padding: 0.5rem;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.recipe-list li:last-child {
  border-bottom: none;
}

.recipe-list .recipe-name {
  flex-grow: 1;
}

.recipe-list .recipe-flags {
  display: flex;
  gap: 0.5rem;
}

.recipe-details {
  flex-grow: 1;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1rem;
  max-height: 60vh;
  overflow-y: auto;
}

.recipe-details h3 {
  margin-top: 0;
}

/* === Modal & Preferences UI === */
.modal {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 1.5rem;
  z-index: 1000;
}

.modal.hidden,

.modal-overlay.hidden {
  display: none;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.35);  /* grey blur effect */
  backdrop-filter: blur(2px);             /* nice touch if supported */
  z-index: 999;                          /* should be beneath .modal z-index */
  display: flex;
  align-items: center;
  justify-content: center;
}
/* === Draggable Modal Enhancements === */
.drag-handle {
  height: 24px;
  cursor: move;
  background: rgba(0, 0, 0, 0.03);
  user-select: none;
  margin-bottom: 0.5rem;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.drag-handle::after {
  content: "••••";
  color: rgba(0, 0, 0, 0.15);
  font-size: 1.1rem;
  letter-spacing: 3px;
  line-height: 1;
}

.drag-handle:hover::after {
  color: rgba(0, 0, 0, 0.3);
}



.modal h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.modal .close {
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 1.5rem;
  cursor: pointer;
  font-weight: bold;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 1.5rem;
}

.modal-actions button {
  padding: 0.5rem 1rem;
  border-radius: 5px;
  border: none;
  font-weight: bold;
  cursor: pointer;
}

.modal-actions button:first-child {
  background: #eee;
}

.duplicate-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 1.5rem 0;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.duplicate-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  transition: all 0.2s ease;
  user-select: none;
}

.duplicate-options label:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.duplicate-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-color);
  cursor: pointer;
  margin: 0;
}

.duplicate-options label:has(input:checked) {
  background: rgba(255, 102, 0, 0.05);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.modal-actions button:last-child {
  background: #d32f2f;
  color: white;
}

.modal-content.wide {
  max-width: 800px;
  width: 90%;
}

.modal-content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0.25rem 0.5rem !important; /* light visual spacing below drag handle */
  max-height: 70vh;
  overflow-y: auto;
  margin: auto;
  width: 100%;
}


/* === Tabs in Modal === */
/* === Tabs in Modal: Modern Polished Style === */
/* === Tabs in Preferences Modal === */
.tab-buttons {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #e5e7eb; /* subtle divider */
  margin-bottom: 1.5rem;
  padding-bottom: 0.25rem;
}

.tab-buttons button {
  all: unset;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  color: #4b5563; /* gray-700 */
  border-radius: 0.375rem 0.375rem 0 0;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
  position: relative;
}

.tab-buttons button:hover {
  background-color: #f3f4f6; /* light gray hover */
  color: #111827;           /* gray-900 */
}

.tab-buttons button.active {
  color: #111827;           /* gray-900 */
  background-color: transparent;
  box-shadow: inset 0 -2px 0 0 var(--accent-color); /* orange underline */
}

.tab-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Only show active tab section */
.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* === Tag & Drag-Drop Pills === */
.tag-pill {
  padding: 6px 12px;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: grab;
  margin: 4px;
  display: inline-block;
  user-select: none;
}

/* Shared drop zone style */
.drop-zone {
  min-height: 80px !important;
  border: 2px dashed #cbd5e1 !important;
  background-color: #f8fafc !important;
  border-radius: 8px !important;
  padding: 12px !important;
  margin: 8px 0 16px 0 !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
}

.dragging-active .drop-zone * {
  pointer-events: none !important;
}

.tag-pool {
  min-height: 48px;
  border: none !important;
  box-shadow: none !important;
  padding: 12px 0;
  margin: 8px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: transparent !important;
}

.drop-zone.dragover {
  background-color: rgba(255, 102, 0, 0.05) !important;
  border: 2px dashed var(--accent-color, #ff6600) !important;
  border-radius: 8px !important;
}

.tag-pill,
.drop-zone .tag-pill,
.tag-pool .tag-pill {
  background-color: #fff5f0 !important;
  border: 1px solid #ffd8c2 !important;
  color: #e65c00 !important;
  border-radius: 20px !important;
  padding: 5px 12px !important;
  font-size: 0.9em !important;
  display: inline-flex;
  align-items: center;
  cursor: grab;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.tag-pill:hover,
.drop-zone .tag-pill:hover,
.tag-pool .tag-pill:hover {
  background-color: #ffebe0 !important;
  border-color: #ffb894 !important;
}

.drop-zone .tag-pill button,
.tag-pool .tag-pill button {
  margin-left: 6px;
  background: none;
  border: none;
  font-size: 0.9em;
  color: #ef4444 !important;
  font-weight: bold;
  cursor: pointer;
}


/* === Household Grid === */
.advanced-household-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: #333;
}

body.dark-theme .advanced-household-label {
  color: #cbd5e1 !important;
}

.household-grid {
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.household-grid th,
.household-grid td {
  border: 1px solid #ccc;
  padding: 4px;
  text-align: center;
}

.household-grid input {
  width: 50px;
}

/* === Scrollable Lists (Favourites, Banished) === */
.recipe-scrollbox {
  max-height: 150px;
  overflow-y: auto;
  border: 1px dashed #ccc;
  padding: 0.5rem;
  margin-bottom: 1rem;
}

.recipe-scrollbox div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.recipe-scrollbox button {
  border: none;
  background: none;
  font-size: 1rem;
  color: red;
  cursor: pointer;
}

/* === Buttons === */
button {
  padding: 0.5rem 0.75rem;
  background: var(--accent-color);
  color: #111111;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
}

button:hover {
   background: var(--accent-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
/* === Calendar Grid Enhancements === */
.calendar {
  display: grid;
  grid-template-rows: auto auto auto auto; /* header + 3 meal rows */
  grid-template-columns: 120px repeat(7, 1fr);
  gap: 1px;
  background: #ccc;
  border: 1px solid #ccc;
  margin: 1rem auto;
  font-size: 0.9rem;
}

.calendar .day-header {
  font-weight: bold;
  background: #fff5ee;
  color: #1f2937;
  text-align: center;
  padding: 0.5rem;
  border: 1px solid #ccc;
}

.calendar .meal-header {
  font-weight: bold;
  background: #f0f0f0;
  color: #1f2937;
  text-align: left;
  padding: 0.5rem;
  border: 1px solid #ccc;
}

.calendar-cell {
  background: #fff;
  color: #111827;
  padding: 0.5rem;
  border: 1px solid #ddd;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.calendar-cell.slot-label {
  font-weight: bold;
  background: #f0f0f0;
  color: #111827;
  text-align: left;
}

.calendar-cell.locked {
  background-color: #f9f9f9;
  opacity: 0.5;
  pointer-events: none;
}

/* === Dot Indicator in Meal Cells === */
.calendar-cell .recipe-dot {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.calendar-cell:hover {
  background-color: #fffaf0;
  transition: background-color 0.2s ease-in-out;
}

.calendar-cell.paused-cell {
  background-color: #f8fafc;
  border-style: dashed;
  color: #94a3b8;
  cursor: pointer;
}

.calendar-cell.paused-cell:hover {
  border-color: #ff6f3c;
  color: #ff6f3c;
}

.pause-icon {
  display: inline-block;
  height: 24px;
  position: relative;
  width: 24px;
}

.pause-icon::before,
.pause-icon::after {
  background: currentColor;
  border-radius: 2px;
  content: "";
  height: 18px;
  position: absolute;
  top: 3px;
  width: 5px;
}

.pause-icon::before {
  left: 5px;
}

.pause-icon::after {
  right: 5px;
}


.calendar-row {
  display: grid;
  grid-template-columns: 120px repeat(7, 1fr);
}

.recipe-dot.breakfast {
  background-color: #e74c3c;
}
.recipe-dot.lunch {
  background-color: #f39c12;
}
.recipe-dot.dinner {
  background-color: #2ecc71;
}

.main-content {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 120px); /* Subtract header height accurately */
  overflow: hidden;
}

/* === View Plan Recipe Details === */
#recipe-title {
  margin-top: 1rem;
  font-weight: bold;
  font-size: 1.1rem;
}

#right-pane {
  flex: 1 1 40%;
  max-width: 40%;
  height: 100%;                /* Forces it to take up remaining height */
  max-height: 300px            /* Constrain overflow */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* prevents inner content from expanding */
}

#recipe-details {
  height: 500px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* prevents inner content from expanding and keeps tabs/search bar sticky! */
  background: #f9f9f9;
  border-radius: 8px;
  box-sizing: border-box;
  padding: 0; /* padding will be handled inside content and search/tab containers */
}

#recipe-tab-buttons.tab-buttons {
  margin: 1rem 1rem 0 !important;
}

#recipe-content {
  flex-grow: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 1rem;
  box-sizing: border-box;
}

#recipe-content.current-recipe-layout {
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
  padding: 0;
  height: 100%;
}

.recipe-header-sticky {
  flex-shrink: 0;
  padding: 1rem 1rem 0;
  box-sizing: border-box;
}

.recipe-scroll-area {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0 1rem 1.5rem;
  box-sizing: border-box;
  min-height: 0;
}
.recipe-flags {
  display: inline-block;
  margin-left: 0.5rem;
  width: 2rem;
  text-align: center;
}


/* === Recipe Tags (Below Title) === */
#recipe-details .tag-pill {
  background: #ddd;
  border: none;
  margin-right: 6px;
  font-size: 0.75rem;
  display: inline-block;
}

/* === Action Buttons in Recipe Details === */
#recipe-details .action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

#recipe-details .action-buttons button {
  font-size: 0.8rem;
  background: #eee;
  color: #333;
  border: 1px solid #aaa;
}

#recipe-details .action-buttons button:hover {
  background: #ddd;
}

#calendar {
  width: 100%;
  max-width: 100%;
}

#recipe-tab-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

#recipe-tab-buttons button.active {
  background-color: var(--accent-color);
  color: white;
}

.cell-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.lock-icon {
  width: 14px;
  height: 14px;
  margin-left: 0.5em;
  opacity: 0.6;
  vertical-align: middle;
  display: inline-block;
  color: #ff6f3c;
}

.effort-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.preference-item {
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: 0.375rem;
  background-color: #f9fafb;
  font-size: 0.95rem;
  border: 1px solid #e5e7eb;
  color: #1f2937;
}
.recipe-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f8f8;
  border: 1px solid #ddd;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border-radius: 5px;
  font-size: 0.95rem;
}

.recipe-item button.small-remove-btn {
  background: none;
  border: none;
  color: #cc0000;
  font-size: 1rem;
  cursor: pointer;
}
.mealtime-grid {
  display: grid;
  grid-template-columns: max-content auto;
  gap: 0.5rem 1rem;
  align-items: center;
}
.tag-pill button {
  background: transparent;
  border: none;
  color: #d32f2f;
  font-size: 0.9rem;
  margin-left: 0.5em;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}
.tag-pill button:hover {
  color: #b71c1c;
}


.shopping-list-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}


.shopping-list-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  }
  #shopping-list-content ul {
  list-style-type: none;
  padding-left: 1em;
}

#shopping-list-content li {
  margin-bottom: 0.4em;
}

.selected-cell {
  border: 2px solid #3498db; /* Soften colour if needed */
  /*background-color: rgba(256,50,0,0.2);*/
  box-shadow: 0 0 4px rgba(52, 152, 219, 0.6); /* subtle glow */
  transition: box-shadow 0.2s ease-in-out;
}

.hover-cell {
  background-color: rgba(52, 152, 219, 0.6);
  transition: background-color 0.2s ease;
}

.recipe-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  border-bottom: 1px solid #ddd;
  gap: 1rem;
cursor: pointer;
}
.recipe-item:active {
  cursor: grabbing;
}
.recipe-name {
  flex-grow: 1;
  font-weight: bold;
}

.recipe-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: auto;
}

.multi-select-checkbox {
  margin-right: 0.5rem;
}

.recipe-flags span {
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: 0.5rem;
}

.recipe-mode-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.recipe-mode-tabs .tab {
  cursor: pointer;
  font-weight: bold;
  color: #333;
}

.recipe-mode-tabs .tab.active {
  border-bottom: 2px solid orange;
  color: black;
}

.library-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

#recipe-search {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  flex: 1 1 300px;
  max-width: 400px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#recipe-search:focus {
  border-color: #2c7be5;
  box-shadow: 0 0 6px rgba(44, 123, 229, 0.3);
  outline: none;
}

#pane-recipe-search {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

#pane-recipe-search:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 6px rgba(255, 102, 0, 0.3);
  outline: none;
}

#recipe-search-btn {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  background-color: #2c7be5;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#recipe-search-btn:hover {
  background-color: var(--accent-hover);
}
.recipe-item.sponsored-ad {
  background: #d6d6d6;
  border-left: 4px solid #e9e9e9;
}
/* ===== Shared Ad Badge (inline, default) ===== */
.ad-badge {
  display: inline-block;
  margin-left: .5rem;
  padding: 2px 6px;
  font-size: 0.75rem;
  line-height: 1;
  border-radius: 6px;
  background: #fff5ee;
  color: #444;
  letter-spacing: .02em;
}

/* ===== Ad Carousel ===== */
#ad-slot {
  flex: 0 0 360px;
  position: sticky;     /* stays visible while scrolling */
  top: 12px;
  width: 360px;
  margin-bottom: 24px;
  z-index: 1;           /* below modals */
}
#ad-slot.hidden { display: none; }
@media (max-width: 1100px) {
  #ad-slot { display: none; }
}

#ad-slot .ad-card {
  background: #e1e1e1;
  border: 1px solid #c8c8c8;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;   /* anchor for carousel badge */
}

#ad-slot .ad-header {
  padding: 14px 16px 6px;
  font-weight: 700;
  font-size: 1.1rem;
}
#ad-slot .ad-media {
  display: grid;
  place-items: center;
  padding: 10px 16px 6px;
}
#ad-slot .ad-media img {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  border: 1px dashed rgba(0,0,0,.15);
  background: #fff;
  border-radius: 8px;
}
#ad-slot .ad-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px 16px;
}
#ad-slot .ad-cta {
  appearance: none;
  border: none;
  background: #d23f57;   /* brandable */
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
#ad-slot .ad-cta:hover { filter: brightness(0.95); }

/* Carousel badge overrides the inline style */
#ad-slot .ad-badge {
  position: absolute;
  right: 10px;
  bottom: 8px;
  background: #f3f3f3;
  border: 1px solid #d5d5d5;
  color: #555;
  z-index: 2;
}

/* ===== Planner Layout ===== */
.planner-row {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
.calendar-wrap {
  flex: 1 1 auto;
}

/* Add space before footer buttons */
.modal-footer {
  margin-top: 1.5rem;  /* push buttons down */
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Meal times block inside Household */
.mealtime-grid {
  margin-top: 1rem;         /* space after number of people */
  padding-top: 0.75rem;
  border-top: 1px solid #eee; /* light divider line */
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
}

/* Meal times subheader */
.mealtime-grid::before {
  content: "Meal Times";
  grid-column: 1 / -1;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #333;
}

/* Wider modal for advanced household grid & shopping list */
#preferences-modal,
#shopping-list-pane {
  max-width: 900px !important;
  width: 92% !important;
}

/* === Unified Page Spacing & Premium Margins === */
main {
  padding: 1.5rem 2rem;
  max-width: 1480px;
  margin: 0 auto;
}

main:has(#admin-dashboard:not(.hidden)) {
  max-width: 98% !important;
}

.header-controls {
  margin-bottom: 0.75rem !important; /* give the rows consistent breathing room */
}

/* === Unified Brand Header Bar === */
.header-brand-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0; /* modern slate boundary */
}

.header-brand-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-brand-left .app-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.header-brand-left .welcome-message {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1e293b; /* dark slate */
  letter-spacing: -0.025em;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.header-brand-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-brand-right #user-status {
  font-size: 0.95rem;
  color: #64748b; /* slate gray */
  font-weight: 600;
}

.header-brand-right #logout-btn {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-brand-right #logout-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.header-brand-right #preferences-btn,
.header-brand-right #subscription-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.header-brand-right #preferences-btn {
  background: var(--accent-color);
  color: white;
}

.header-brand-right #preferences-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.header-brand-right #subscription-btn:hover {
  transform: translateY(-1px);
}

/* === Modern Accelerating/Decelerating Loading Screen === */
.loading-screen {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999; /* higher than all elements */
  opacity: 1;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  visibility: visible;
}

.loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.loading-logo {
  width: 140px;
  height: auto;
  will-change: transform;
  /* ease-in-out gives accelerating and decelerating clockwise velocity */
  animation: sine-spin 2s infinite ease-in-out;
}

.loading-text {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.02em;
  font-family: system-ui, -apple-system, sans-serif;
  animation: loading-pulse 1.5s infinite ease-in-out;
}

.ingest-stopping {
  display: inline-block;
  will-change: transform;
  animation: sine-spin 2s infinite ease-in-out !important;
  pointer-events: none !important;
  background-color: #dc2626 !important;
  border-color: #dc2626 !important;
}

@keyframes sine-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes loading-pulse {
  0%, 100% {
    opacity: 0.6;
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

/* === Switch Controls === */
.desktop-switch-button {
  background: transparent !important;
  border: 0 !important;
  padding: 4px !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
}

.desktop-switch-track {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 1px solid #94a3b8;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.desktop-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform 0.2s ease;
}

[role="switch"][aria-checked="true"] .desktop-switch-track,
.desktop-filter-toggle input:checked + .desktop-switch-track,
.settings-toggle-row input:checked + .desktop-switch-track {
  background: var(--accent-color);
  border-color: var(--accent-color);
}

[role="switch"][aria-checked="true"] .desktop-switch-thumb,
.desktop-filter-toggle input:checked + .desktop-switch-track .desktop-switch-thumb,
.settings-toggle-row input:checked + .desktop-switch-track .desktop-switch-thumb {
  transform: translateX(18px);
}

.desktop-filter-toggle input,
.settings-toggle-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ==========================================================================
   💡 INTENTIONAL, PREMIUM DARK THEME OVERRIDES (v1.2.3 REDESIGN)
   ========================================================================== */
body.dark-theme {
  background-color: #111315 !important; /* Deep pitch warm slate */
  color: #e2e8f0 !important; /* Premium soft gray */
}

/* Custom scrollbars for dark mode */
body.dark-theme ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.dark-theme ::-webkit-scrollbar-track {
  background: transparent;
}

body.dark-theme ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.16);
}

body.dark-theme #app-header {
  background-color: #16191c !important; /* Elevated panel */
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .header-brand-left .app-logo {
  filter: brightness(0) invert(1) opacity(0.9) !important;
}

body.dark-theme .welcome-message {
  color: #94a3b8 !important;
}

/* Header Controls & Status Bar */
body.dark-theme .header-brand-right #user-status {
  color: #64748b !important;
  font-size: 0.85rem;
}

body.dark-theme .header-brand-right #theme-toggle-btn {
  background-color: rgba(255, 255, 255, 0.03) !important;
  color: #fbbf24 !important; /* Amber lightbulb */
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .header-brand-right #theme-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme .header-brand-right #logout-btn {
  background: transparent !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

body.dark-theme .header-brand-right #logout-btn:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Tab Navigation (Linear/Notion inspired) */
body.dark-theme #tab-nav,
body.dark-theme .recipe-mode-tabs {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme #tab-nav .tab,
body.dark-theme .recipe-mode-tabs .tab {
  background-color: transparent !important;
  color: #64748b !important;
  border: none !important;
  border-radius: 0 !important;
  border-bottom: 2px solid transparent !important;
  font-weight: 600 !important;
  padding: 0 16px !important;
  font-size: 0.875rem !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
}

body.dark-theme #tab-nav .tab.active,
body.dark-theme .recipe-mode-tabs .tab.active {
  background-color: transparent !important;
  color: #f8fafc !important;
  border-bottom: 2px solid var(--accent-color) !important;
  box-shadow: none !important;
}

body.dark-theme #tab-nav .tab:hover:not(.active),
body.dark-theme .recipe-mode-tabs .tab:hover:not(.active) {
  color: #cbd5e1 !important;
  background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Interactive Table Board Redesign */
body.dark-theme #calendar {
  background-color: rgba(255, 255, 255, 0.02) !important;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

body.dark-theme .calendar-cell {
  background-color: #16191c !important; /* Elevated card surface */
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.03) !important;
  padding: 10px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.dark-theme .calendar-cell.day-header {
  background-color: #1a1d21 !important;
  color: #94a3b8 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  font-size: 0.72rem !important;
  letter-spacing: 0.06em !important;
}

body.dark-theme .calendar-cell.slot-label {
  background-color: #1a1d21 !important;
  color: #f8fafc !important;
  border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
  font-weight: 700 !important;
  text-transform: capitalize !important;
  font-size: 0.8rem !important;
}

body.dark-theme .calendar-cell.empty-cell {
  background-color: rgba(255, 255, 255, 0.01) !important; /* Soft empty surface */
}

body.dark-theme .calendar-cell.paused-cell {
  background-color: rgba(255, 255, 255, 0.01) !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
  color: #64748b !important;
}

body.dark-theme .calendar-cell.paused-cell:hover {
  border-color: rgba(255, 111, 60, 0.6) !important;
  color: #ff6f3c !important;
}

body.dark-theme .calendar-cell.empty-cell .plus-icon {
  color: #64748b !important;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

body.dark-theme .calendar-cell.empty-cell:hover .plus-icon {
  opacity: 0.9;
  color: var(--accent-color) !important;
}

body.dark-theme .calendar-cell:hover:not(.day-header):not(.slot-label) {
  background-color: #1c2026 !important;
  border-color: rgba(255, 102, 0, 0.3) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  transform: translateY(0) !important;
}

/* selected planning cell glow */
body.dark-theme .selected-cell {
  border: 2px solid var(--accent-color) !important;
  background-color: #1c2026 !important;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.3) !important;
  z-index: 10;
}

body.dark-theme .selected-cell .cell-wrapper span:not(.effort-dot) {
  font-weight: 700 !important;
  color: #fff !important;
}

/* Effort indicators */
body.dark-theme .effort-dot {
  box-shadow: 0 0 6px currentColor;
}

/* Recipe details detail workspace */
body.dark-theme main {
  background-color: #111315 !important;
}

body.dark-theme #recipe-pane {
  background-color: #16191c !important;
  border-left: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: #e2e8f0 !important;
  box-shadow: -4px 0 30px rgba(0, 0, 0, 0.15);
}

body.dark-theme #recipe-details {
  background-color: #1b1f24 !important; /* Recipe inner workspace card */
  color: #cbd5e1 !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.03) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 4px 16px rgba(0, 0, 0, 0.15);
}

body.dark-theme #recipe-details h2,
body.dark-theme #recipe-details h3,
body.dark-theme #recipe-details h4 {
  color: #f8fafc !important;
  font-weight: 700 !important;
}

body.dark-theme #recipe-details ul li,
body.dark-theme #recipe-details ol li {
  line-height: 1.6;
}

/* Premium modern soft pill tag indicators instead of default gray buttons */
body.dark-theme .tag-pill {
  background-color: rgba(255, 102, 0, 0.1) !important;
  color: #ffa366 !important; /* Soft orange/coral */
  border: 1px solid rgba(255, 102, 0, 0.15) !important;
  padding: 4px 12px !important;
  border-radius: 99px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  text-transform: lowercase !important;
}

/* Recipe Library & Browse Lists */
body.dark-theme .recipe-item {
  background-color: #16191c !important;
  border: 1px solid rgba(255, 255, 255, 0.03) !important;
  color: #cbd5e1 !important;
  border-radius: 10px !important;
  margin-bottom: 8px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

body.dark-theme .recipe-item:hover {
  background-color: #1a1d21 !important;
  border-color: rgba(255, 102, 0, 0.25) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
  transform: translateY(-1px) !important;
}

body.dark-theme .recipe-item .recipe-name {
  color: #f8fafc !important;
  font-weight: 600 !important;
}

body.dark-theme .recipe-item.selected-item {
  background-color: #1c2026 !important;
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.12) !important;
}

/* Modals & Backdrop Blur */
body.dark-theme .modal-overlay {
  background-color: rgba(8, 10, 12, 0.72) !important;
  backdrop-filter: blur(10px) !important;
}

body.dark-theme .modal {
  background-color: #15181c !important; /* Graphite shell */
  color: #f4f1ea !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55) !important;
}

body.dark-theme .modal-content {
  background-color: transparent !important;
  color: #f4f1ea !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

body.dark-theme .modal-content h2,
body.dark-theme .modal-content h3 {
  color: #f8fafc !important;
}

body.dark-theme .modal .close,
body.dark-theme .modal-content .close {
  color: #8f9bad !important;
  background: transparent !important;
  transition: all 0.2s ease !important;
  padding: 2px 6px;
  border-radius: 4px;
}

body.dark-theme .modal .close:hover,
body.dark-theme .modal-content .close:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.06) !important;
}

body.dark-theme .modal-content input,
body.dark-theme .modal-content select,
body.dark-theme .modal-content textarea {
  background-color: #111315 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  transition: all 0.2s ease !important;
}

body.dark-theme .modal-content input:focus,
body.dark-theme .modal-content select:focus,
body.dark-theme .modal-content textarea:focus {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15) !important;
  outline: none !important;
}

/* Sticky Headers / Controls inside lower pane */
body.dark-theme .library-controls {
  background-color: #16191c !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
}

body.dark-theme #recipe-search,
body.dark-theme #pane-recipe-search,
body.dark-theme #recipe-tag-filter {
  background-color: #111315 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
}

body.dark-theme #recipe-search:focus,
body.dark-theme #pane-recipe-search:focus,
body.dark-theme #recipe-tag-filter:focus {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15) !important;
  outline: none !important;
}

/* Audit logs dashboard */
body.dark-theme #admin-dashboard {
  background-color: #111315 !important;
  color: #e2e8f0 !important;
}

body.dark-theme #admin-dashboard h2 {
  color: #f8fafc !important;
  border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .dashboard-card {
  background-color: #16191c !important;
  border: 1px solid rgba(255, 255, 255, 0.04) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}

body.dark-theme .dashboard-card h3 {
  color: #f8fafc !important;
}

body.dark-theme .dashboard-card table th {
  background-color: #1a1d21 !important;
  color: #94a3b8 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .dashboard-card table td {
  border-bottom-color: rgba(255, 255, 255, 0.03) !important;
  color: #cbd5e1 !important;
}

/* Calorie/cost indicators styling */
body.dark-theme #avg-calories,
body.dark-theme #total-cost,
body.dark-theme #cost-pppd {
  color: #f8fafc !important;
  font-weight: 700;
}

body.dark-theme #week-display {
  color: #f8fafc !important;
  font-weight: 700 !important;
}

/* Secondary/outlined week navigation, preferences, reroll, share plan & action button sets */
body.dark-theme .week-nav button,
body.dark-theme #preferences-btn,
body.dark-theme #share-image-btn,
body.dark-theme .controls button:not([onclick*="bulk"]):not([id*="download"]):not(#logout-btn):not(#theme-toggle-btn):not(#subscription-btn) {
  background-color: rgba(255, 255, 255, 0.02) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.dark-theme .week-nav button:hover,
body.dark-theme #preferences-btn:hover,
body.dark-theme #share-image-btn:hover,
body.dark-theme .controls button:hover:not([onclick*="bulk"]):not([id*="download"]):not(#logout-btn):not(#theme-toggle-btn):not(#subscription-btn) {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

/* Draggable Modal Handle dark overrides */
body.dark-theme .drag-handle {
  background: transparent !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

body.dark-theme .drag-handle::after {
  color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .drag-handle:hover::after {
  color: rgba(255, 255, 255, 0.25) !important;
}

/* Duplicate options popup dark overrides */
body.dark-theme .duplicate-options label {
  background-color: #1a1d21 !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  color: #cbd5e1 !important;
}

body.dark-theme .duplicate-options label:hover {
  background-color: #20252b !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

body.dark-theme .duplicate-options label:has(input:checked) {
  background-color: rgba(255, 102, 0, 0.08) !important;
  border-color: var(--accent-color) !important;
  color: #ffa366 !important;
}

/* Modal Inner Tab Buttons (Browse vs Current Recipe) dark overrides */
body.dark-theme .tab-buttons {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .tab-buttons button {
  background-color: transparent !important;
  color: #64748b !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  font-weight: 600 !important;
  padding: 8px 16px !important;
  font-size: 0.875rem !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
}

body.dark-theme .tab-buttons button.active {
  color: #f8fafc !important;
  border-bottom: 2px solid var(--accent-color) !important;
  box-shadow: none !important;
}

body.dark-theme .tab-buttons button:hover:not(.active) {
  color: #cbd5e1 !important;
  background-color: rgba(255, 255, 255, 0.03) !important;
}

/* ==========================================================================
   💥 TACTILE OUTLINED ACTION BUTTONS & TAB ALIGNMENTS (v1.2.4)
   ========================================================================== */

/* Action Buttons in Current Recipe Tab (Tactile outlined style) */
.recipe-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.recipe-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.recipe-actions button:hover:not(:disabled) {
  background-color: #f8fafc;
  color: #0f172a;
  border-color: #94a3b8;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.recipe-actions button:active:not(:disabled) {
  transform: translateY(0);
}

.recipe-actions button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background-color: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
  box-shadow: none;
}

/* Premium Dark Mode Action Buttons */
body.dark-theme .recipe-actions button {
  background-color: rgba(255, 255, 255, 0.02) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.dark-theme .recipe-actions button:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
}

body.dark-theme .recipe-actions button:disabled {
  background-color: rgba(255, 255, 255, 0.01) !important;
  border-color: rgba(255, 255, 255, 0.03) !important;
  color: #475569 !important;
}

/* Tab Buttons inside Recipe Details Pane (Light Mode Underlined Style) */
#recipe-tab-buttons.tab-buttons {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0;
}

#recipe-tab-buttons.tab-buttons button {
  background: transparent;
  color: #64748b;
  border: none;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: none;
}

#recipe-tab-buttons.tab-buttons button:hover:not(:disabled) {
  color: #334155;
  background-color: #f1f5f9;
}

#recipe-tab-buttons.tab-buttons button.active {
  background-color: transparent;
  color: var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
}

#recipe-tab-buttons.tab-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: #94a3b8;
}

/* ==========================================================================
   ✨ TASTE PROFILE ONBOARDING WIZARD CLASSES (v1.2.4)
   ========================================================================== */

.onboarding-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  inset: 0;
  background: rgba(8, 10, 12, 0.72);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.onboarding-overlay.hidden {
  display: none !important;
}

.onboarding-modal {
  position: relative;
  display: block;
  width: min(720px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 24px !important;
  box-shadow: 0 24px 80px rgba(0,0,0,0.15) !important;
  padding: 32px !important;
  z-index: 9999;
  box-sizing: border-box;
}

.onboarding-modal .close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 1.75rem;
  font-weight: bold;
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s ease;
  line-height: 1;
}

.onboarding-modal .close:hover {
  color: #0f172a;
}

.onboarding-content-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 480px;
  background-color: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
}

.onboarding-header-section {
  text-align: center;
  margin-bottom: 1.5rem;
}

.onboarding-header-section h2 {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.onboarding-header-section p {
  color: #64748b;
  margin: 0;
  font-size: 1rem;
}

.onboarding-steps-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto 2rem auto;
  max-width: 500px;
  position: relative;
  padding: 0 10px;
  width: 100%;
}

.onboarding-steps-indicator::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #f1f5f9;
  z-index: 1;
  transform: translateY(-50%);
}

.onboarding-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  z-index: 2;
  transition: all 0.3s ease;
}

.onboarding-step-dot.active {
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15);
  transform: scale(1.1);
}

.onboarding-step-dot.completed {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff;
}

.onboarding-tag-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
}

.onboarding-pill {
  padding: 10px 20px !important;
  background-color: #f8fafc !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 99px !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.onboarding-pill:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
}

.onboarding-pill:active {
  transform: translateY(0) scale(0.96) !important;
}

.onboarding-pill.selected {
  background-color: var(--accent-color) !important;
  color: #ffffff !important;
  border-color: var(--accent-color) !important;
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.25) !important;
}

.onboarding-search-container {
  margin-bottom: 1rem;
  width: 100%;
}

.onboarding-search-input {
  width: 100%;
  padding: 12px 16px !important;
  font-size: 1rem !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02) !important;
  box-sizing: border-box;
}

.onboarding-search-input:focus {
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15) !important;
}

.onboarding-recipe-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.onboarding-recipe-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.onboarding-recipe-card:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.onboarding-recipe-card.selected {
  background-color: rgba(255, 102, 0, 0.05);
  border-color: var(--accent-color);
}

.onboarding-recipe-card .recipe-title {
  font-weight: 700;
  color: #334155;
  font-size: 0.95rem;
}

.onboarding-recipe-card .recipe-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

.onboarding-recipe-card .action-icon {
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.onboarding-recipe-card.selected .action-icon {
  transform: scale(1.2);
}

.onboarding-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
  border-top: 1px solid #f1f5f9;
  padding-top: 1.5rem;
}

.onboarding-btn {
  padding: 12px 32px !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  border: none;
}

.onboarding-btn.primary {
  background-color: var(--accent-color);
  color: #ffffff;
  font-weight: 850 !important;
  box-shadow: 0 4px 14px rgba(255, 102, 0, 0.25);
}

.onboarding-btn.primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 102, 0, 0.35);
}

.onboarding-btn.secondary {
  background-color: #f1f5f9;
  color: #475569 !important;
}

.onboarding-btn.secondary:hover {
  background-color: #e2e8f0;
  color: #0f172a !important;
  transform: translateY(-1px);
}

.onboarding-btn.back {
  background-color: transparent;
  color: #64748b !important;
  border: 1px solid #cbd5e1;
  padding: 11px 24px !important;
}

.onboarding-btn.back:hover {
  color: #334155 !important;
  border-color: #94a3b8;
  background-color: #f8fafc;
}

.onboarding-hero-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.onboarding-hero-icon {
  font-size: 4rem;
  animation: float-logo 3s ease-in-out infinite;
}

@keyframes float-logo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ==========================================================================
   Dark Theme overrides for Onboarding Modal
   ========================================================================== */
body.dark-theme .onboarding-modal {
  background: #15181c !important;
  color: #f4f1ea !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,0.55) !important;
}

body.dark-theme .onboarding-modal .close {
  color: #8f9bad !important;
}

body.dark-theme .onboarding-modal .close:hover {
  color: #ffffff !important;
}

body.dark-theme .onboarding-content-wrapper {
  background-color: transparent !important;
  border-color: transparent !important;
}

body.dark-theme .onboarding-header-section h2 {
  color: #f8fafc !important;
}

body.dark-theme .onboarding-header-section p {
  color: #94a3b8 !important;
}

body.dark-theme .onboarding-steps-indicator::before {
  background-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .onboarding-step-dot {
  background-color: #181c20 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #64748b !important;
}

body.dark-theme .onboarding-step-dot.active {
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15) !important;
}

body.dark-theme .onboarding-step-dot.completed {
  background-color: var(--accent-color) !important;
  border-color: var(--accent-color) !important;
  color: #ffffff !important;
}

body.dark-theme .onboarding-pill {
  background-color: rgba(255, 255, 255, 0.02) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: none !important;
}

body.dark-theme .onboarding-pill:hover {
  background-color: rgba(255, 255, 255, 0.06) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme .onboarding-pill.selected {
  background-color: var(--accent-color) !important;
  color: #ffffff !important;
  border-color: var(--accent-color) !important;
  box-shadow: 0 4px 12px rgba(255, 102, 0, 0.25) !important;
}

body.dark-theme .onboarding-search-input {
  background-color: #111315 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .onboarding-recipe-list {
  border-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .onboarding-recipe-card {
  background-color: #16191c !important;
  border-color: rgba(255, 255, 255, 0.03) !important;
}

body.dark-theme .onboarding-recipe-card:hover {
  background-color: #1a1d21 !important;
  border-color: rgba(255, 102, 0, 0.2) !important;
}

body.dark-theme .onboarding-recipe-card.selected {
  background-color: rgba(255, 102, 0, 0.08) !important;
  border-color: var(--accent-color) !important;
}

body.dark-theme .onboarding-recipe-card .recipe-title {
  color: #f8fafc !important;
}

body.dark-theme .onboarding-recipe-card .recipe-meta {
  color: #94a3b8 !important;
}

body.dark-theme .onboarding-footer {
  border-top-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .onboarding-btn.secondary {
  background-color: rgba(255, 255, 255, 0.04) !important;
  color: #cbd5e1 !important;
}

body.dark-theme .onboarding-btn.secondary:hover {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #f8fafc !important;
}

body.dark-theme .onboarding-btn.back {
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #cbd5e1 !important;
}

body.dark-theme .onboarding-btn.back:hover {
  background-color: rgba(255, 255, 255, 0.03) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

/* ==========================================================================
   💡 ROTATING CONTEXTUAL TIPS & TRICKS BAR
   ========================================================================== */
.contextual-tips-bar {
  display: flex;
  background-color: #f8fafc; /* Very light slate gray */
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  font-family: system-ui, -apple-system, sans-serif;
  overflow: hidden;
  position: relative;
  min-height: 58px;
  height: 58px;
  align-items: center;
  touch-action: pan-y;
}

.tips-content-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 1;
  transform: translate(var(--tip-drag-x, 0), 0);
}

.contextual-tips-bar.is-dragging .tips-content-wrap {
  transition: none;
  opacity: .82;
}

/* Slide out state (slide up slightly and fade out) */
.contextual-tips-bar.transition-out .tips-content-wrap {
  opacity: 0;
  transform: translateY(-8px);
}

/* Slide in state (start from below and ready to fade in) */
.contextual-tips-bar.transition-in .tips-content-wrap {
  opacity: 0;
  transform: translateY(8px);
}

.tips-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
}

.tips-icon {
  color: var(--accent-color, #ff6600);
  font-size: 1.1rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.tips-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: #475569; /* Slate gray */
  line-height: 1.4;
}

.tips-cta-btn {
  background: transparent;
  color: var(--accent-color, #ff6600);
  border: 1px solid var(--accent-color, #ff6600);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.tips-cta-btn:hover {
  background: rgba(255, 102, 0, 0.05);
}

.tips-cta-btn.hidden {
  display: none !important;
}

/* Premium Dark Mode Contextual Tips overrides */
body.dark-theme .contextual-tips-bar {
  background-color: #16191c !important; /* Brighter elevated charcoal */
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 4px 20px rgba(0, 0, 0, 0.2) !important;
}

body.dark-theme .tips-text {
  color: #cbd5e1 !important; /* Soft premium slate gray text */
}

body.dark-theme .tips-cta-btn {
  color: var(--accent-color, #ff6600) !important;
  border-color: var(--accent-color, #ff6600) !important;
}

body.dark-theme .tips-cta-btn:hover {
  background: rgba(255, 102, 0, 0.1) !important;
  color: var(--accent-hover, #ff8533) !important;
  border-color: var(--accent-hover, #ff8533) !important;
}

/* Calendar link modal styling extensions */
.calendar-section-title {
  font-family: inherit;
  transition: color 0.2s ease;
}

body.dark-theme .calendar-section-title {
  color: #f8fafc !important;
}

body.dark-theme .calendar-helper-note {
  border-top-color: rgba(255, 255, 255, 0.05) !important;
  color: #cbd5e1 !important;
}

/* ==========================================================================
   🛒 SHOPPING LIST SCROLLABLE LAYOUT & CUSTOM TICK BOXES
   ========================================================================== */

/* Layout overrides to ensure the modal fits nicely and doesn't go off-screen */
#shopping-list-pane {
  max-width: 800px !important;
  width: 90% !important;
  box-sizing: border-box !important;
}

#shopping-list-pane .modal-content.wide {
  max-height: calc(85vh - 120px) !important;
  overflow-y: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 1.5rem 2rem !important;
  box-sizing: border-box !important;
}

/* Make categorized lists scrollable starting from "Bakery" down */
#shopping-list-content {
  max-height: calc(85vh - 280px) !important;
  min-height: 150px !important;
  overflow-y: auto !important;
  padding-right: 8px !important;
  margin-top: 1rem !important;
  border-top: 1px solid #f1f5f9 !important;
  padding-top: 1rem !important;
  box-sizing: border-box !important;
}

body.dark-theme #shopping-list-content {
  border-top-color: rgba(255, 255, 255, 0.05) !important;
}

/* Base custom label align */
#shopping-list-content li label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  user-select: none;
  line-height: 1.4;
  vertical-align: middle;
}

/* Custom Checkbox Design (Bypasses default browser styling) */
#shopping-list-content input[type="checkbox"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
  border: 2px solid #cbd5e1 !important;
  border-radius: 4px !important;
  background-color: #ffffff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  position: relative !important;
  flex-shrink: 0 !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  margin: 0 !important;
  vertical-align: middle !important;
}

#shopping-list-content input[type="checkbox"]:hover {
  border-color: #94a3b8 !important;
}

#shopping-list-content input[type="checkbox"]:checked {
  background-color: var(--accent-color, #ff6600) !important;
  border-color: var(--accent-color, #ff6600) !important;
}

#shopping-list-content input[type="checkbox"]:checked::after {
  content: "" !important;
  position: absolute !important;
  width: 4px !important;
  height: 8px !important;
  border: solid #ffffff !important;
  border-width: 0 2px 2px 0 !important;
  transform: rotate(45deg) !important;
  top: 1px !important;
  left: 5px !important;
}

/* Custom Dark Mode Checkboxes: Dark Background and Orange Ticks */
body.dark-theme #shopping-list-content input[type="checkbox"] {
  background-color: #111315 !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  padding: 0 !important;
  width: 18px !important;
  height: 18px !important;
  border-radius: 4px !important;
}

body.dark-theme #shopping-list-content input[type="checkbox"]:hover {
  border-color: rgba(255, 255, 255, 0.45) !important;
}

body.dark-theme #shopping-list-content input[type="checkbox"]:checked {
  background-color: #111315 !important; /* Keeps dark background */
  border-color: var(--accent-color, #ff6600) !important; /* Orange outline */
}

body.dark-theme #shopping-list-content input[type="checkbox"]:checked::after {
  border-color: var(--accent-color, #ff6600) !important; /* Orange tick mark */
}

/* Share Button SVG Icon Styling */
#share-image-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

#share-image-btn svg {
  color: var(--accent-color, #ff6600) !important;
  vertical-align: middle !important;
  flex-shrink: 0 !important;
}

/* === Recipe Library Layout Refactor & Spacing Hierarchy === */

/* Compact spacing for app-header and brand bar to maximize vertical area */
#app-header {
  padding: 0.5rem 1.5rem !important;
}

.header-brand-bar {
  margin-bottom: 0.75rem !important;
  padding-bottom: 0.5rem !important;
}

/* Consolidated navigation bar styles */
.navigation-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 1rem !important;
  margin-bottom: 0.5rem !important;
}

/* Centered Week Selector inside Header */
.week-nav-centered {
  display: flex;
  flex-direction: column !important; /* date range on one line, buttons underneath */
  justify-content: center;
  align-items: center;
  gap: 0.5rem !important; /* premium spacing between text and buttons */
  margin: 0.5rem auto 0.25rem auto !important; /* pulled closer contextually */
  padding: 0.25rem 1rem !important;
  background-color: transparent !important; /* integrates cleanly inside header */
  border: none !important;
  border-radius: 0 !important;
  max-width: 620px;
  box-shadow: none !important;
  transition: all 0.2s ease;
}

.week-buttons-row {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 0.75rem !important;
}

.week-nav-centered button {
  background: #1e2227 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px !important;
  padding: 6px 14px !important;
  font-weight: 700 !important;
  color: #cbd5e1 !important;
  font-size: 0.85rem !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.week-nav-centered button:hover {
  background: var(--accent-color, #ff6600) !important;
  color: #ffffff !important;
  border-color: var(--accent-color, #ff6600) !important;
  box-shadow: 0 2px 8px rgba(255, 102, 0, 0.3) !important;
}

.week-nav-centered .week-header {
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  color: #111827 !important;
  min-width: auto !important; /* no artificial min-width since it's stacked on one line */
  text-align: center !important;
  font-family: 'Outfit', 'Inter', sans-serif !important;
  letter-spacing: 0.025em !important;
  text-transform: uppercase !important;
  text-shadow: none !important;
}

body.dark-theme .week-nav-centered .week-header {
  color: #f8fafc !important;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

/* Master Width Alignment Grid for Recipe Library elements */
#recipe-library {
  max-width: 1240px !important; /* unified grid master width */
  margin: 0 auto !important;
  width: 100% !important;
}

/* Modern Contextual controls wrapper for Recipe Library - Translucent Toolbar */
.library-controls-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem !important; /* tight space */
  background: transparent !important;
  background-color: transparent !important;
  backdrop-filter: none !important;
  border: none !important;
  padding: 0 !important; /* borderless and paddingless */
  margin-bottom: 0.75rem !important;
  box-shadow: none !important;
}

.desktop-library-primary-row,
.desktop-library-secondary-row {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.desktop-library-primary-row {
  justify-content: flex-start;
}

.desktop-library-secondary-row {
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, .18);
}

.desktop-library-primary-row .search-input-wrapper {
  flex: 0 1 360px;
  width: min(360px, 100%) !important;
}

.desktop-library-secondary-row #recipe-library-buttons {
  width: auto !important;
  margin: 0 !important;
}

.desktop-library-secondary-row .desktop-filter-toggle {
  margin-left: auto;
  border: 0;
  background: transparent;
  padding-right: 0;
}

/* Left-aligned controls/buttons inside panels */
.left-aligned-buttons {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: center !important;
  gap: 0.5rem !important;
  width: 100% !important;
  margin: 0.5rem 0 1rem 0 !important; /* perfect breathing room between tip box and calendar/list */
}

/* Search input wrapper with integrated search SVG icon */
.search-input-wrapper {
  position: relative;
  width: 100% !important; /* Search bar spans full width at the top */
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.6rem !important;
  font-size: 0.95rem;
  background-color: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
}

.search-input-wrapper input::placeholder {
  color: #475569 !important;
}

.search-input-wrapper input:focus {
  border-color: var(--accent-color, #ff6600) !important;
  box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15) !important;
  outline: none !important;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  transition: color 0.2s;
}

.search-input-wrapper input:focus + .search-icon {
  color: var(--accent-color, #ff6600);
}

/* Redesigned Contextual Bulk buttons */
#recipe-library-buttons {
  display: flex !important;
  gap: 0.5rem !important;
  flex-shrink: 0 !important; /* prevent wrapping or shrinking */
}

.bulk-btn {
  background: transparent !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 0.55rem 1rem !important; /* tighter layout */
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  color: #334155 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
  white-space: nowrap !important;
}

.bulk-btn:hover {
  background: #fff7ed !important;
  border-color: var(--accent-color, #ff6f3c) !important;
  color: var(--accent-color, #ff6f3c) !important;
}

.desktop-custom-meal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.desktop-filter-toggle,
.settings-toggle-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 235px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
}

.settings-toggle-row {
  width: 100%;
  margin: 12px 0;
}

.settings-toggle-row span:first-child {
  display: grid;
  gap: 4px;
}

.settings-toggle-row small {
  color: #64748b;
  font-weight: 500;
}

.desktop-add-custom-meal {
  margin: 0;
  padding: 9px 14px;
  border: 1px solid #ffb392;
  border-radius: 8px;
  background: #fffaf7;
  color: #9a3412;
  font-weight: 800;
  cursor: pointer;
}

.desktop-add-custom-meal:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.desktop-custom-recipe-badge {
  flex: 0 0 auto;
  margin-left: 8px;
  border: 1px solid #ffb392;
  border-radius: 999px;
  background: #fff1e9;
  color: #9a3412;
  padding: 3px 7px;
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.recipe-library-empty {
  padding: 24px;
  border: 1px dashed #ffb392;
  border-radius: 8px;
  background: #fffaf7;
  color: #9a3412;
  font-weight: 700;
  text-align: center;
}

body.dark-theme .recipe-library-empty {
  border-color: #70402f;
  background: #211916;
  color: #ff9a76;
}

body.dark-theme .desktop-filter-toggle,
body.dark-theme .settings-toggle-row,
body.dark-theme .desktop-custom-recipe-badge {
  border-color: #8e4934;
  background: #33221d;
  color: #ff9a76;
}

body.dark-theme .desktop-add-custom-meal {
  background: #111315;
  border: 1px solid rgba(255,255,255,.12);
  color: #cbd5e1;
}

.desktop-account-settings {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.account-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.account-setting-row > span {
  display: grid;
  gap: 4px;
}

.account-setting-row small {
  color: #64748b;
}

.account-setting-row button:not(.desktop-switch-button),
.account-tier-pill {
  flex: 0 0 auto;
  border: 1px solid #ffb392;
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
}

.account-setting-row button:not(.desktop-switch-button) {
  cursor: pointer;
}

body.dark-theme .account-setting-row {
  background: rgba(255,255,255,.025);
  border-color: rgba(255,255,255,.1);
}

body.dark-theme .account-setting-row button:not(.desktop-switch-button),
body.dark-theme .account-tier-pill {
  background: #211916;
  border-color: #70402f;
  color: #ff9a76;
}

@media (min-width: 769px) {
  .custom-meal-editor {
    box-shadow: 0 0 0 100vmax rgba(5, 7, 10, .68), 0 24px 80px rgba(0, 0, 0, 0.45) !important;
  }

  .custom-meal-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
  }

  .custom-meal-form > label:first-child,
  .custom-meal-form > label:nth-of-type(3),
  .custom-meal-form > label:last-of-type,
  .custom-tag-suggestions,
  .custom-meal-number-grid,
  .custom-ingredient-rows,
  .custom-ingredient-add,
  .custom-estimates-display,
  .override-toggle-row,
  #custom-meal-overrides-wrapper,
  .custom-meal-delete {
    grid-column: 1 / -1;
  }
}

body.dark-theme .bulk-btn,
body.dark-theme .desktop-filter-toggle,
body.dark-theme .settings-toggle-row {
  background: rgba(255,255,255,.025) !important;
  border-color: rgba(255,255,255,.12) !important;
  color: #cbd5e1 !important;
}

body.dark-theme .bulk-btn:hover,
body.dark-theme .desktop-add-custom-meal:hover {
  border-color: var(--accent-color) !important;
  color: var(--accent-hover) !important;
}

.desktop-batch-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px;
}

.desktop-batch-header,
.desktop-batch-card-title,
.desktop-batch-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.desktop-batch-header h2,
.desktop-batch-card h3 {
  margin: 0;
}

.desktop-batch-header > div,
.desktop-batch-card-title > div {
  display: grid;
  gap: 5px;
}

.desktop-batch-header span,
.desktop-batch-card-title span {
  color: #64748b;
  font-size: .85rem;
}

.desktop-batch-header button,
.desktop-batch-card-actions button {
  border: 1px solid #cbd5e1;
  background: transparent;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 700;
  cursor: pointer;
}

#desktop-add-batch-btn {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #ffffff !important;
  font-weight: 850 !important;
}

.desktop-batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.desktop-batch-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,.06);
}

.desktop-batch-meals {
  display: grid;
  gap: 7px;
  margin: 16px 0;
}

.desktop-batch-meals span {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
}

.desktop-batch-repeat {
  border: 1px solid #ffb392;
  color: #9a3412 !important;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 800;
}

.desktop-batch-empty {
  margin-top: 20px;
  padding: 28px;
  text-align: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
}

.desktop-batch-editor {
  position: fixed;
}

.desktop-batch-fields {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}

.desktop-batch-fields label:not(.settings-toggle-row) {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.desktop-batch-fields .settings-toggle-row {
  grid-column: 1 / -1;
}

.desktop-batch-selector {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 330px;
  overflow: auto;
}

.desktop-batch-selector label {
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
}

.desktop-batch-selector label:has(input:checked) {
  border-color: var(--accent-color);
  background: #fff7ed;
}

.desktop-batch-selector span {
  display: grid;
  gap: 3px;
}

body.dark-theme .desktop-batch-card,
body.dark-theme .desktop-batch-meals span,
body.dark-theme .desktop-batch-selector label {
  background: #1b1e22;
  border-color: rgba(255,255,255,.1);
}

body.dark-theme .desktop-batch-selector label:has(input:checked) {
  border-color: var(--accent-color);
  background: #33221d;
}

body.dark-theme .header-brand-right #theme-toggle-btn {
  background: transparent !important;
  border: 0 !important;
}

.bulk-btn.add-btn:hover,
.bulk-btn.fav-btn:hover,
.bulk-btn.ban-btn:hover {
  background: #fff7ed !important;
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
}

body.dark-theme .bulk-btn.add-btn:hover,
body.dark-theme .bulk-btn.fav-btn:hover,
body.dark-theme .bulk-btn.ban-btn:hover {
  background: rgba(255,102,0,.08) !important;
  border-color: var(--accent-color) !important;
  color: var(--accent-hover) !important;
}

.bulk-btn.add-btn:hover {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #10b981 !important;
}

.bulk-btn.fav-btn:hover {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #f59e0b !important;
}

.bulk-btn.ban-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #ef4444 !important;
}

body:not(.dark-theme) .bulk-btn.add-btn:hover,
body:not(.dark-theme) .bulk-btn.fav-btn:hover,
body:not(.dark-theme) .bulk-btn.ban-btn:hover {
  background: var(--accent-hover, #e65c00) !important;
  border-color: var(--accent-hover, #e65c00) !important;
  color: #ffffff !important;
}

/* Filters row */
.library-filters-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.filter-label {
  display: none !important; /* hide the label text completely as requested */
}

/* High-density list style overrides with grey borders and inset glow */
body.dark-theme .recipe-list {
  background-color: #1a1d21 !important; /* 1-2% lighter background than surrounding container */
  border: 1px solid rgba(255, 255, 255, 0.08) !important; /* grey border on all sides as requested */
  border-radius: 12px !important;
  max-height: 70vh !important; /* elevated above fold presence */
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.35) !important; /* Inset glow & drop shadow */
}

body.dark-theme .recipe-list li {
  padding: 0.65rem 1rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: #f1f5f9 !important;
  transition: background 0.15s ease !important;
}

body.dark-theme .recipe-list li:hover {
  background-color: rgba(255, 102, 0, 0.08) !important;
}

body.dark-theme .recipe-details {
  background-color: #1a1d21 !important; /* Matches list background */
  border: 1px solid rgba(255, 255, 255, 0.08) !important; /* grey border on all sides as requested */
  border-radius: 12px !important;
  max-height: 70vh !important;
  color: #f1f5f9 !important;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}

/* ==========================================================================
   🔄 Expandable Inline Recipe Details
   ========================================================================== */

/* Refactor standard list item for flex direction column and remove default hover padding clash */
.recipe-item {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  padding: 0 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  background: transparent !important;
}

.recipe-item:last-child {
  border-bottom: none !important;
}

/* Separate clickable row from expanded content */
.recipe-item-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 0.65rem 1rem !important;
  cursor: pointer !important;
  transition: background 0.15s ease !important;
  position: relative !important;
}

body.dark-theme .recipe-item-row {
  color: #f1f5f9 !important;
}

body.dark-theme .recipe-item-row:hover {
  background-color: rgba(255, 102, 0, 0.06) !important;
}

/* Subtle chevron expand indicator */
.recipe-item-row::after {
  content: '›';
  font-size: 1.5rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.25);
  margin-left: 1rem;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
  display: inline-block;
  transform: rotate(0deg);
  font-weight: 300;
}

.recipe-item-row:hover::after {
  opacity: 1;
}

.recipe-item.expanded .recipe-item-row::after {
  opacity: 1;
  transform: rotate(90deg);
  color: var(--accent-color, #ff6f3c);
}

/* Expanded Panel Animating Element */
.recipe-expanded-panel {
  height: 0;
  opacity: 0;
  overflow: hidden;
  transition: height 220ms cubic-bezier(0.4, 0, 0.2, 1), opacity 220ms ease;
  box-sizing: border-box;
  background-color: rgba(0, 0, 0, 0.18) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
}

.expanded-panel-inner {
  padding: 1.25rem 1.5rem;
  box-sizing: border-box;
}

/* Header layout within expansion */
.expanded-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}

.expanded-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.expanded-recipe-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}

.expanded-header-right {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.expanded-meta-pill {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.expanded-meta-pill.calories {
  border-color: rgba(255, 111, 60, 0.15);
  color: #ffd8c7;
}

.expanded-meta-pill.cost {
  border-color: rgba(16, 185, 129, 0.15);
  color: #d1fae5;
}

/* Two-column structural grid */
.expanded-body-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.75rem;
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .expanded-body-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.expanded-column {
  display: flex;
  flex-direction: column;
}

.expanded-column h5 {
  margin: 0 0 0.65rem 0;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-color, #ff6f3c);
}

.expanded-ingredients-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.expanded-ingredients-list li {
  padding: 0.25rem 0 !important;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.02) !important;
  color: #e2e8f0 !important;
  display: flex !important;
  justify-content: flex-start !important;
  gap: 0.5rem;
}

.expanded-ingredients-list li:last-child {
  border-bottom: none !important;
}

.ing-qty {
  font-weight: 700;
  color: var(--accent-color, #ff6f3c);
  min-width: 2.2rem;
  text-align: right;
  display: inline-block;
}

.ing-unit {
  color: #94a3b8;
  min-width: 1.8rem;
  display: inline-block;
}

.ing-name {
  color: #e2e8f0;
}

.expanded-scroll-area {
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Elegant dark-theme scrollbar for instructions scroll area */
.expanded-scroll-area::-webkit-scrollbar {
  width: 5px;
}

.expanded-scroll-area::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
  border-radius: 3px;
}

.expanded-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.expanded-scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color, #ff6f3c);
}

.expanded-instructions-list {
  padding-left: 1.25rem;
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.expanded-instructions-list li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}

.expanded-instructions-list li::marker {
  font-weight: 700;
  color: var(--accent-color, #ff6f3c);
}

/* Compact action bar under grid */
.expanded-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
}

.expanded-action-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #cbd5e1 !important;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  outline: none;
}

.expanded-action-btn:hover {
  background: rgba(255, 111, 60, 0.08);
  border-color: var(--accent-color, #ff6f3c);
  color: #fff !important;
}

.expanded-action-btn.add-btn {
  background: rgba(255, 111, 60, 0.12);
  border-color: rgba(255, 111, 60, 0.25);
  color: #ffa17a !important;
}

.expanded-action-btn.add-btn:hover {
  background: var(--accent-color, #ff6f3c);
  border-color: var(--accent-color, #ff6f3c);
  color: #fff !important;
}

.expanded-action-btn.delete-recipe-btn {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5 !important;
}

.expanded-action-btn.delete-recipe-btn:hover {
  background: #dc2626;
  border-color: #ef4444;
  color: #ffffff !important;
}

body:not(.dark-theme) .expanded-action-btn.delete-recipe-btn {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #b91c1c !important;
}

body:not(.dark-theme) .expanded-action-btn.delete-recipe-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff !important;
}

/* Light theme repair for desktop week controls and inline recipe panels */
body:not(.dark-theme) .week-buttons-row button,
body:not(.dark-theme) .week-nav button {
  background: #fff7ed !important;
  color: #9a3412 !important;
  border: 1px solid #fdba74 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
}

body:not(.dark-theme) .week-buttons-row button:hover,
body:not(.dark-theme) .week-nav button:hover {
  background: var(--accent-color, #ff6f3c) !important;
  color: #ffffff !important;
  border-color: var(--accent-color, #ff6f3c) !important;
}

body:not(.dark-theme) .recipe-list,
body:not(.dark-theme) #recipe-details,
body:not(.dark-theme) #recipe-content {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-color: #e5e7eb !important;
}

body:not(.dark-theme) .recipe-item {
  border-bottom-color: #e5e7eb !important;
}

body:not(.dark-theme) .recipe-item-row {
  color: #1f2937 !important;
}

body:not(.dark-theme) .recipe-item-row:hover {
  background-color: #fff7ed !important;
}

body:not(.dark-theme) .recipe-item-row::after {
  color: #fb923c;
}

body:not(.dark-theme) .recipe-expanded-panel {
  background-color: #f8fafc !important;
  border-top-color: #e5e7eb !important;
  color: #334155 !important;
}

body:not(.dark-theme) .expanded-header-row,
body:not(.dark-theme) .expanded-actions-row {
  border-color: #e5e7eb !important;
}

body:not(.dark-theme) .expanded-recipe-title,
body:not(.dark-theme) .expanded-ingredients-list li,
body:not(.dark-theme) .ing-name,
body:not(.dark-theme) .expanded-instructions-list {
  color: #1f2937 !important;
}

body:not(.dark-theme) .expanded-meta-pill {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #475569 !important;
}

body:not(.dark-theme) .expanded-meta-pill.calories {
  border-color: #fed7aa !important;
  color: #c2410c !important;
}

body:not(.dark-theme) .expanded-meta-pill.cost {
  border-color: #bbf7d0 !important;
  color: #047857 !important;
}

body:not(.dark-theme) .expanded-action-btn {
  background: #ffffff !important;
  border-color: #e5e7eb !important;
  color: #334155 !important;
}

body:not(.dark-theme) .expanded-action-btn.add-btn,
body:not(.dark-theme) .library-controls button,
body:not(.dark-theme) #recipe-search-btn {
  background: var(--accent-color, #ff6f3c) !important;
  border-color: var(--accent-color, #ff6f3c) !important;
  color: #ffffff !important;
}

/* ==========================================================================
   💅 UI Polish & Advanced Mode Enhancements
   ========================================================================== */

/* Tag/Favourite/Banished dark-theme box overrides */
body.dark-theme .tag-pool {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 12px 0 !important;
}

body.dark-theme .drop-zone {
  border-color: rgba(255, 102, 0, 0.25) !important;
  background-color: rgba(255, 102, 0, 0.04) !important;
}

body.dark-theme .drop-zone.dragover {
  background-color: rgba(255, 102, 0, 0.1) !important;
  border-color: var(--accent-color, #ff6f3c) !important;
}

body.dark-theme .drop-zone .tag-pill,
body.dark-theme .tag-pool .tag-pill {
  background-color: rgba(255, 102, 0, 0.1) !important;
  border: 1px solid rgba(255, 102, 0, 0.25) !important;
  color: #ffa17a !important;
}

body.dark-theme .drop-zone .tag-pill button,
body.dark-theme .tag-pool .tag-pill button {
  color: #f87171 !important;
}

/* Cancel buttons styling for premium high contrast */
#preferences-cancel,
#duplicate-cancel-btn,
#confirm-cancel-btn,
#cell-cancel-btn,
.modal-actions button:first-child,
.modal-footer button:first-child {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  transition: all 0.15s ease !important;
  font-weight: 700 !important;
}

#preferences-cancel:hover,
#duplicate-cancel-btn:hover,
#confirm-cancel-btn:hover,
#cell-cancel-btn:hover,
.modal-actions button:first-child:hover,
.modal-footer button:first-child:hover {
  background-color: #e2e8f0 !important;
  color: #1e293b !important;
  border-color: #94a3b8 !important;
}

body.dark-theme #preferences-cancel,
body.dark-theme #duplicate-cancel-btn,
body.dark-theme #confirm-cancel-btn,
body.dark-theme #cell-cancel-btn,
body.dark-theme .modal-actions button:first-child,
body.dark-theme .modal-footer button:first-child {
  background-color: #2a2e35 !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  font-weight: 700 !important;
}

body.dark-theme #preferences-cancel:hover,
body.dark-theme #duplicate-cancel-btn:hover,
body.dark-theme #confirm-cancel-btn:hover,
body.dark-theme #cell-cancel-btn:hover,
body.dark-theme .modal-actions button:first-child:hover,
body.dark-theme .modal-footer button:first-child:hover {
  background-color: #383e47 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

/* Recipe list item hover cleanup to resolve double highlights */
body.dark-theme .recipe-item-row:hover {
  background-color: transparent !important; /* disable inner hover highlight when collapsed */
}

body.dark-theme .recipe-item:not(.expanded):hover {
  background-color: rgba(255, 102, 0, 0.05) !important; /* single clean outer hover background */
  border-color: var(--accent-color, #ff6f3c) !important;
}

/* When expanded, hover should highlight only the row wrapper header */
body.dark-theme .recipe-item.expanded:hover {
  background-color: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .recipe-item.expanded .recipe-item-row:hover {
  background-color: rgba(255, 102, 0, 0.05) !important;
  border-radius: 12px 12px 0 0 !important;
}

/* ==========================================================================
   💎 PREMIUM VISUAL POLISH & CONTRAST FIXES
   ========================================================================== */

/* 1. Advanced Household Mode Label Premium Styling */
.advanced-household-label {
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  margin-top: 1.25rem !important;
  margin-bottom: 0.75rem !important;
  color: #1e293b !important;
  display: block !important;
}

body.dark-theme .advanced-household-label {
  color: #f1f5f9 !important; /* High visibility slate-white */
}

/* 2. Solid & High-Contrast Tag/Favourite/Banished boxes in both themes */
.tag-pool {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 12px 0 !important;
  min-height: 48px !important;
  box-sizing: border-box !important;
}

body.dark-theme .tag-pool {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 12px 0 !important;
}

body.dark-theme .tag-pill,
body.dark-theme .drop-zone .tag-pill,
body.dark-theme .tag-pool .tag-pill {
  background-color: rgba(255, 102, 0, 0.1) !important;
  border: 1px solid rgba(255, 102, 0, 0.25) !important;
  color: #ffa17a !important;
}

body.dark-theme .tag-pill:hover,
body.dark-theme .drop-zone .tag-pill:hover,
body.dark-theme .tag-pool .tag-pill:hover {
  background-color: rgba(255, 102, 0, 0.18) !important;
  border-color: rgba(255, 102, 0, 0.4) !important;
}

body.dark-theme .drop-zone .tag-pill button,
body.dark-theme .tag-pool .tag-pill button {
  color: #f87171 !important;
}

body.dark-theme .search-input-wrapper input {
  background-color: #111315 !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .search-input-wrapper input::placeholder {
  color: #475569 !important;
}

/* 3. Bulletproof Double-Box Overlay Refactor (Internal Box transparent) */
.modal-content,
.modal-content.wide,
#preferences-modal .modal-content,
#shopping-list-pane .modal-content,
#duplicate-modal .modal-content,
#confirm-modal .modal-content,
#calendar-link-modal .modal-content,
#cell-chooser-modal .modal-content,
#preferences-form,
.modal form {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  outline: none !important;
  padding: 0.25rem 0.5rem !important;
}

body.dark-theme .modal-content,
body.dark-theme .modal-content.wide,
body.dark-theme #preferences-modal .modal-content,
body.dark-theme #shopping-list-pane .modal-content,
body.dark-theme #duplicate-modal .modal-content,
body.dark-theme #confirm-modal .modal-content,
body.dark-theme #calendar-link-modal .modal-content,
body.dark-theme #cell-chooser-modal .modal-content,
body.dark-theme #preferences-form,
body.dark-theme .modal form {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  outline: none !important;
}

/* 4. High-Contrast & Premium Cancel Buttons in Light and Dark Themes */
#preferences-cancel,
#duplicate-cancel-btn,
#confirm-cancel-btn,
#cell-cancel-btn,
.modal-actions button:first-child,
.modal-footer button:first-child,
button.cancel-btn,
button[id*="cancel"] {
  background-color: #f1f5f9 !important;
  color: #0f172a !important; /* Dark slate for high contrast in light theme */
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
  transition: all 0.15s ease !important;
}

#preferences-cancel:hover,
#duplicate-cancel-btn:hover,
#confirm-cancel-btn:hover,
#cell-cancel-btn:hover,
.modal-actions button:first-child:hover,
.modal-footer button:first-child:hover,
button.cancel-btn:hover,
button[id*="cancel"]:hover {
  background-color: #e2e8f0 !important;
  color: #000000 !important;
  border-color: #94a3b8 !important;
}

body.dark-theme #preferences-cancel,
body.dark-theme #duplicate-cancel-btn,
body.dark-theme #confirm-cancel-btn,
body.dark-theme #cell-cancel-btn,
body.dark-theme .modal-actions button:first-child,
body.dark-theme .modal-footer button:first-child,
body.dark-theme button.cancel-btn,
body.dark-theme button[id*="cancel"] {
  background-color: #2a2e35 !important;
  color: #f8fafc !important; /* White/slate-white for maximum contrast in dark theme */
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  font-weight: 700 !important;
}

body.dark-theme #preferences-cancel:hover,
body.dark-theme #duplicate-cancel-btn:hover,
body.dark-theme #confirm-cancel-btn:hover,
body.dark-theme #cell-cancel-btn:hover,
body.dark-theme .modal-actions button:first-child:hover,
body.dark-theme .modal-footer button:first-child:hover,
body.dark-theme button.cancel-btn:hover,
body.dark-theme button[id*="cancel"]:hover {
  background-color: #383e47 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}

/* 5. Complete Recipe List Clash Override & Double Highlight Prevention */
.recipe-list li.recipe-item {
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  border: 1px solid #ddd !important;
  background-color: #f8f8f8 !important;
  border-radius: 6px !important;
  margin-bottom: 0.5rem !important;
  box-shadow: none !important;
}

.recipe-list li.recipe-item:not(.expanded):hover {
  background-color: #f1f1f1 !important;
  border-color: var(--accent-color, #ff6f3c) !important;
}

.recipe-list li.recipe-item:not(.expanded) .recipe-item-row:hover {
  background-color: transparent !important;
}

body.dark-theme .recipe-list li.recipe-item {
  padding: 0 !important;
  background-color: #16191c !important;
  border: 1px solid rgba(255, 255, 255, 0.03) !important;
  border-radius: 10px !important;
  margin-bottom: 8px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

body.dark-theme .recipe-list li.recipe-item:not(.expanded):hover {
  background-color: rgba(255, 102, 0, 0.05) !important;
  border-color: var(--accent-color, #ff6f3c) !important;
}

body.dark-theme .recipe-list li.recipe-item:not(.expanded) .recipe-item-row:hover {
  background-color: transparent !important;
}

/* Expanded state list card unified hover highlight */
.recipe-list li.recipe-item.expanded {
  background-color: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

body.dark-theme .recipe-list li.recipe-item.expanded {
  background-color: #16191c !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.recipe-list li.recipe-item.expanded:hover {
  background-color: #f1f5f9 !important;
  border-color: var(--accent-color, #ff6f3c) !important;
  box-shadow: none !important;
  transform: none !important;
}

body.dark-theme .recipe-list li.recipe-item.expanded:hover {
  background-color: rgba(255, 102, 0, 0.05) !important;
  border-color: var(--accent-color, #ff6f3c) !important;
  box-shadow: none !important;
  transform: none !important;
}

.recipe-list li.recipe-item.expanded .recipe-item-row:hover {
  background-color: transparent !important;
}

body.dark-theme .recipe-list li.recipe-item.expanded .recipe-item-row:hover {
  background-color: transparent !important;
}

.onboarding-hero-logo {
  display: block;
  height: 58px;
  margin: 0 auto 18px;
  object-fit: contain;
  width: 58px;
}

body.dark-theme .onboarding-hero-logo {
  filter: brightness(0) invert(1);
}

/* ==========================================================================
   Fossil Fuel Custom Household Sharing & Pausing CSS
   ========================================================================== */

/* === Household Calendar Sharing & Link CSS === */
.household-sharing-section {
  margin-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 1.5rem;
}

body.dark-theme .household-sharing-section {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.household-sharing-section h3 {
  margin-top: 0;
  color: #1e293b;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

body.dark-theme .household-sharing-section h3 {
  color: #f8fafc !important;
}

.household-sharing-section p {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 1rem;
  line-height: 1.4;
}

body.dark-theme .household-sharing-section p {
  color: #94a3b8 !important;
}

#sharing-linked {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.dark-theme #sharing-linked {
  background: rgba(16, 185, 129, 0.08) !important;
  border-color: rgba(16, 185, 129, 0.2) !important;
}

#sharing-linked span {
  font-size: 0.9rem;
  color: #15803d;
  font-weight: 600;
}

body.dark-theme #sharing-linked span {
  color: #34d399 !important;
}

#sharing-linked button {
  padding: 4px 8px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
}

#sharing-not-linked {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.sharing-link-btn {
  padding: 8px 16px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

#sharing-members-container {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #475569;
}

body.dark-theme #sharing-members-container {
  background: #111315 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}

#sharing-members-list button {
  padding: 6px 12px;
  background: #f97316;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  margin-top: 8px;
  transition: background 0.2s ease;
}

#sharing-members-list button:hover {
  background: #ea580c;
}

/* === Advanced Household grid styling === */
.advanced-cell-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px;
}

.pause-label-text {
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  margin: 0;
  user-select: none;
  color: #64748b;
}

body.dark-theme .pause-label-text {
  color: #94a3b8;
}

.household-grid td {
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

/* Gray out paused slot cells in the advanced settings table */
.household-grid td:has(.pause-slot-check:checked) {
  background-color: #f1f5f9;
  opacity: 0.65;
}

body.dark-theme .household-grid td:has(.pause-slot-check:checked) {
  background-color: rgba(255, 255, 255, 0.04);
}

/* Override desktop custom badge to be a borderless icon */
.desktop-custom-recipe-badge {
  border: none !important;
  background: none !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  vertical-align: middle !important;
  margin-left: 6px !important;
}

body.dark-theme .desktop-custom-recipe-badge {
  border: none !important;
  background: none !important;
}

/* Draggable Aisle Reordering Settings (Desktop) */
#desktop-aisle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
  margin-top: 10px;
}
#desktop-aisle-list .aisle-reorder-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  font-weight: 700;
  font-size: 0.95rem;
  user-select: none;
  touch-action: none;
}
body.dark-theme #desktop-aisle-list .aisle-reorder-item {
  background: #1e1e24;
  border-color: #303038;
  color: #ffffff;
}
.aisle-reorder-item.dragging {
  opacity: 0.6;
  background-color: rgba(255, 111, 60, 0.08) !important;
  border-color: #ff6f3c !important;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

/* Presence Indicators (FF-HOUSE-001) */
.presence-indicator-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: #059669; /* Darker green for light theme */
  font-weight: 600;
  width: 100%;
  box-sizing: border-box;
}
body.dark-theme .presence-indicator-bar {
  color: #34d399; /* Lighter green for dark theme */
}
.presence-pulse-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* --- FF-PRES-002 / FF-PRES-003: Presence Indicator Collapse & Transition --- */
.presence-indicator-bar {
  transition: max-height 250ms ease-out, opacity 250ms ease-out, padding 250ms ease-out, margin 250ms ease-out, border-color 250ms ease-out !important;
  max-height: 100px;
  overflow: hidden;
}
.presence-indicator-bar.collapsed {
  max-height: 0 !important;
  opacity: 0 !important;
  padding: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  border-top-width: 0 !important;
  border-bottom-width: 0 !important;
  border-color: transparent !important;
  pointer-events: none;
}

/* --- FF-DESK-001: Collapsible Header (Desktop Navigation Area) --- */
#app-header {
  position: relative !important;
  transition: padding 0.3s ease-in-out !important;
}

.header-brand-bar {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
}

.header-brand-left {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 16px !important;
}

.header-brand-right {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
}

/* Week nav container transitions */
.week-nav-centered {
  transition: max-height 0.3s ease-in-out, margin 0.3s ease-in-out, padding 0.3s ease-in-out, opacity 0.3s ease-in-out !important;
  max-height: 120px !important;
  opacity: 1 !important;
  overflow: visible !important;
}

/* === ADMIN USER ANALYTICS === */
.admin-subnav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.admin-subnav-btn {
  padding: 0.55rem 0.9rem;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-weight: 700;
  cursor: pointer;
}

.admin-subnav-btn.active {
  border-color: #ff6f3c;
  background: #fff4ef;
  color: #c2410c;
}

.user-analytics-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.analytics-metric-card,
.user-analytics-table-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.analytics-metric-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
}

.analytics-metric-card strong {
  color: #0f172a;
  font-size: 1.4rem;
}

.analytics-metric-card span,
.user-analytics-table-heading p,
.user-analytics-table td span {
  color: #64748b;
  font-size: 0.78rem;
}

.analytics-metric-card.analytics-error {
  grid-column: 1 / -1;
  color: #b91c1c;
}

.user-analytics-table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.user-analytics-table-heading h3,
.user-analytics-table-heading p {
  margin: 0;
}

#user-analytics-search {
  min-width: 240px;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

.user-analytics-table-wrap {
  max-height: min(62vh, 680px);
  overflow: auto !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.user-analytics-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
}

.user-analytics-table th,
.user-analytics-table td {
  padding: 0.8rem;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: top;
}

.user-analytics-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #475569;
  background: #f8fafc;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-analytics-table td {
  color: #334155;
  font-size: 0.82rem;
}

.user-analytics-table td strong,
.user-analytics-table td span {
  display: block;
}

.analytics-status {
  width: fit-content;
  margin-bottom: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca !important;
  font-weight: 700;
}

.status-active,
.status-converted {
  background: #dcfce7;
  color: #166534 !important;
}

.status-at-risk,
.status-viewed-subscription-page,
.status-trial---pending,
.status-manual-access {
  background: #fef3c7;
  color: #92400e !important;
}

.status-dormant,
.status-cancelled {
  background: #fee2e2;
  color: #991b1b !important;
}

body.dark-theme .admin-subnav-btn,
body.dark-theme .analytics-metric-card,
body.dark-theme .user-analytics-table-card {
  border-color: rgba(255,255,255,0.08);
  background: #181b1f;
  color: #cbd5e1;
}

body.dark-theme .admin-subnav-btn.active {
  border-color: #ff6f3c;
  background: rgba(255,111,60,0.12);
  color: #ff8a63;
}

body.dark-theme .analytics-metric-card strong,
body.dark-theme .user-analytics-table td {
  color: #f1f5f9;
}

body.dark-theme .user-analytics-table th {
  background: #121417;
  color: #94a3b8;
}

.admin-review-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.admin-scraper-workspace {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

.admin-scraper-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.admin-scraper-heading h2,
.admin-scraper-heading p,
.admin-scraper-grid h3,
.admin-scraper-grid p {
  margin-top: 0;
}

.admin-scraper-heading p,
.admin-scraper-grid p,
.admin-scraper-grid li {
  color: #64748b;
  line-height: 1.55;
}

.admin-scraper-mode {
  flex: 0 0 auto;
  padding: 0.35rem 0.65rem;
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.admin-scraper-mode.is-running { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.admin-scraper-mode.is-offline { color: #991b1b; background: #fee2e2; border-color: #fecaca; }

.admin-scraper-heading-actions,
.admin-scraper-card-actions,
.admin-scraper-toolbar,
.admin-scraper-log-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.admin-scraper-workspace button {
  border: 0;
  border-radius: 7px;
  padding: 0.62rem 0.8rem;
  color: #fff;
  background: #2563eb;
  font-weight: 700;
  cursor: pointer;
}

.admin-scraper-workspace button.secondary { color: #334155; background: #e2e8f0; }
.admin-scraper-workspace button.danger { background: #dc2626; }
.admin-scraper-workspace button:disabled { opacity: 0.45; cursor: not-allowed; }

.admin-scraper-config {
  display: grid;
  grid-template-columns: 150px 150px 140px minmax(260px, 1fr);
  gap: 0.8rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.admin-scraper-config label {
  display: grid;
  gap: 0.4rem;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-scraper-config input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}

.admin-scraper-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.admin-scraper-grid article {
  padding: 1.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-scraper-grid article.is-running {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.admin-scraper-grid article > span {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: #2563eb;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-scraper-grid small {
  display: block;
  width: fit-content;
  margin: 0 0 0.9rem;
  padding: 0.3rem 0.5rem;
  color: #64748b;
  background: #e2e8f0;
  border-radius: 5px;
  font-size: 0.82rem;
}

.admin-scraper-grid small.is-running { color: #92400e; background: #fef3c7; }
.admin-scraper-grid small.is-complete { color: #166534; background: #dcfce7; }
.admin-scraper-grid small.is-failed { color: #991b1b; background: #fee2e2; }

.admin-scraper-toolbar { margin: 1rem 0; }

.admin-scraper-log-panel {
  padding: 1rem;
  color: #e2e8f0;
  background: #0f172a;
  border-radius: 10px;
}

.admin-scraper-log-panel > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-scraper-log-panel h3 { margin: 0 0 0.75rem; color: #f8fafc; }
.admin-scraper-log-panel strong { color: #fbbf24; font-size: 0.8rem; }

#admin-scraper-log {
  height: 330px;
  margin: 0 0 0.75rem;
  padding: 1rem;
  overflow: auto;
  white-space: pre-wrap;
  color: #7dd3fc;
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 7px;
  font: 0.76rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.admin-scraper-log-panel button.secondary { color: #e2e8f0; background: #334155; }
#admin-scraper-log-range { margin-left: auto; color: #94a3b8; font-size: 0.75rem; }

@media (max-width: 900px) {
  .admin-scraper-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-scraper-config { grid-template-columns: 1fr 1fr; }
  .admin-scraper-heading { flex-direction: column; }
}

@media (max-width: 620px) {
  .admin-scraper-grid,
  .admin-scraper-config { grid-template-columns: 1fr; }
}

.admin-review-card .user-analytics-table-wrap {
  max-height: calc(100vh - 430px);
  min-height: 260px;
}

.admin-review-card .user-analytics-table {
  min-width: 1600px;
}

#admin-user-analytics-page .user-analytics-table-wrap {
  max-height: calc(100vh - 390px);
  min-height: 280px;
}

.admin-review-page,
#admin-user-analytics-page {
  min-height: 0;
}

.user-analytics-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.user-analytics-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #94a3b8;
  background-clip: padding-box;
}

.user-analytics-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #64748b;
  background-clip: padding-box;
}

body.dark-theme .user-analytics-table-wrap::-webkit-scrollbar-thumb {
  background: #475569;
  background-clip: padding-box;
}

@media (max-height: 760px) {
  .admin-review-card .user-analytics-table-wrap,
  #admin-user-analytics-page .user-analytics-table-wrap {
    max-height: 52vh;
    min-height: 220px;
  }
}

.admin-tier-change-btn {
  margin-top: 0.45rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid #ff6f3c;
  border-radius: 6px;
  background: transparent;
  color: #c2410c;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

body.dark-theme #admin-dashboard .analytics-card,
body.dark-theme #admin-dashboard .audit-logs-card,
body.dark-theme #admin-dashboard .audit-logs-scrollbox,
body.dark-theme #admin-dashboard .admin-review-card {
  background: #181b1f !important;
  border-color: rgba(255,255,255,0.08) !important;
  box-shadow: none !important;
}

body.dark-theme #admin-dashboard .analytics-card h3,
body.dark-theme #admin-dashboard .audit-logs-card h3,
body.dark-theme #admin-dashboard .analytics-list li,
body.dark-theme #admin-dashboard .audit-list li {
  color: #e2e8f0 !important;
  border-color: rgba(255,255,255,0.06) !important;
}

body.dark-theme #admin-dashboard .analytics-list span,
body.dark-theme #admin-dashboard .audit-list span {
  background: #22262b !important;
  color: #cbd5e1 !important;
  border-color: rgba(255,255,255,0.08) !important;
}

body.dark-theme #admin-dashboard .audit-list div,
body.dark-theme #admin-dashboard .audit-list strong {
  color: #cbd5e1 !important;
}

body.dark-theme #user-analytics-search,
body.dark-theme .admin-review-page input[type="search"] {
  background: #111315;
  color: #f8fafc;
  border-color: rgba(255,255,255,0.12);
}

body.dark-theme .admin-review-card {
  color: #e2e8f0;
}

body.dark-theme .admin-tier-change-btn {
  color: #ff8a63;
}

.admin-inline-input,
.admin-inline-select {
  width: 100%;
  min-width: 8rem;
  padding: 0.48rem 0.55rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #172033;
}

.admin-unit-input,
.admin-number-input {
  min-width: 5.5rem;
}

.admin-review-page td > span {
  display: block;
  margin-top: 0.25rem;
  color: #64748b;
  font-size: 0.72rem;
}

.admin-merge-ingredient {
  margin-top: 0.4rem;
  white-space: nowrap;
}

.admin-ingredient-heading-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.admin-ingredient-heading-actions span {
  color: #64748b;
  font-size: 0.75rem;
  white-space: nowrap;
}

.admin-ingredient-heading-actions button {
  white-space: nowrap;
}

.admin-row-pending td {
  background: rgba(255, 111, 60, 0.07);
}

.admin-row-pending td:first-child {
  box-shadow: inset 3px 0 #ff6f3c;
}

body.dark-theme .admin-ingredient-heading-actions span {
  color: #94a3b8;
}

body.dark-theme .admin-row-pending td {
  background: rgba(255, 111, 60, 0.09);
}

body.dark-theme .admin-inline-input,
body.dark-theme .admin-inline-select {
  background: #111315;
  color: #f8fafc;
  border-color: rgba(255,255,255,0.14);
}

.admin-recipe-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(0,0,0,0.72);
}

.admin-recipe-editor {
  width: min(900px, 100%);
  max-height: calc(100vh - 3rem);
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid #d7dde5;
  border-radius: 14px;
  background: #fff;
  color: #172033;
}

.admin-recipe-editor-heading,
.admin-recipe-editor-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-recipe-editor label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.admin-recipe-editor input,
.admin-recipe-editor textarea {
  width: 100%;
  padding: 0.65rem;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #172033;
  font: inherit;
}

.admin-recipe-editor textarea {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.55;
}

.admin-recipe-field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.admin-recipe-editor-actions {
  justify-content: space-between;
  margin: 0;
}

.admin-delete-recipe {
  border: 1px solid #dc2626 !important;
  background: #17191c !important;
  color: #f87171 !important;
  box-shadow: none;
}

.admin-delete-recipe:hover,
.admin-delete-recipe:focus-visible {
  border-color: #fb7185 !important;
  background: #2a171b !important;
  color: #fda4af !important;
}

body.dark-theme .admin-delete-recipe {
  border-color: #ef4444 !important;
  background: #111315 !important;
  color: #fb7185 !important;
}

body.dark-theme .admin-delete-recipe:hover,
body.dark-theme .admin-delete-recipe:focus-visible {
  border-color: #fb7185 !important;
  background: #2a171b !important;
  color: #fecdd3 !important;
}

body.dark-theme .admin-recipe-editor {
  background: #181b1f;
  color: #f1f5f9;
  border-color: rgba(255,255,255,0.12);
}

body.dark-theme .admin-recipe-editor input,
body.dark-theme .admin-recipe-editor textarea {
  background: #111315;
  color: #f8fafc;
  border-color: rgba(255,255,255,0.14);
}

@media (max-width: 760px) {
  .admin-recipe-field-grid { grid-template-columns: 1fr 1fr; }
}

/* --- FF-BATCH-001: One Slot Per Row Batch Layout (Desktop) --- */
.desktop-batch-selector {
  grid-template-columns: 1fr !important;
}

/* --- FF-SHOP-002: Full Width Aisle Configuration (Desktop) --- */
#desktop-aisle-list {
  max-width: 100% !important;
}

/* --- FF-SET-001: Standardised Secondary Action Buttons --- */
.secondary-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(255, 111, 60, 0.45) !important;
  background: transparent !important;
  color: #ff6f3c !important;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  text-decoration: none;
}
.secondary-action-btn:hover {
  background: rgba(255, 111, 60, 0.08) !important;
  border-color: #ff6f3c !important;
  color: #ff6f3c !important;
  box-shadow: 0 2px 8px rgba(255, 111, 60, 0.15) !important;
}
body.dark-theme .secondary-action-btn {
  border-color: rgba(255, 111, 60, 0.45) !important;
  color: #ff6f3c !important;
}

/* === FIXED SIZE SETTINGS MODAL & SCROLLING === */
#preferences-modal {
  max-width: 900px !important;
  width: 900px !important;
  height: 740px !important;
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
  padding: 0 !important;
}

#preferences-modal.hidden {
  display: none !important;
}

#preferences-modal .modal-content {
  display: flex !important;
  flex-direction: column !important;
  flex-grow: 1 !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
  padding: 1.5rem !important;
  background: #ffffff !important;
  color: #1e293b !important;
}

body.dark-theme #preferences-modal .modal-content {
  background: #16161a !important;
  color: #f4f1ea !important;
}

#preferences-modal #preferences-form {
  display: flex !important;
  flex-direction: column !important;
  flex-grow: 1 !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
}

#preferences-modal .tab-section {
  flex-grow: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding-right: 8px !important;
  margin-top: 1rem !important;
}

#preferences-modal .modal-footer {
  display: none !important;
}

/* Modal text styling to ensure readability */
#preferences-modal h2,
#preferences-modal h3,
#preferences-modal h4,
#preferences-modal strong {
  color: #1e293b !important;
}
body.dark-theme #preferences-modal h2,
body.dark-theme #preferences-modal h3,
body.dark-theme #preferences-modal h4,
body.dark-theme #preferences-modal strong {
  color: #f8fafc !important;
}

#preferences-modal label {
  color: #1e293b !important;
}
body.dark-theme #preferences-modal label {
  color: #cbd5e1 !important;
}

#preferences-modal p,
#preferences-modal small {
  color: #64748b !important;
}
body.dark-theme #preferences-modal p,
body.dark-theme #preferences-modal small {
  color: #94a3b8 !important;
}

#preferences-modal .tab-buttons button {
  color: #64748b !important;
}
#preferences-modal .tab-buttons button.active {
  color: #1e293b !important;
}
body.dark-theme #preferences-modal .tab-buttons button {
  color: #64748b !important;
}
body.dark-theme #preferences-modal .tab-buttons button.active {
  color: #f8fafc !important;
}

/* Advanced grid cells styling */
.household-grid th,
.household-grid td {
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}
.household-grid th {
  background-color: #f8fafc !important;
}
body.dark-theme .household-grid th,
body.dark-theme .household-grid td {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #f8fafc !important;
}
body.dark-theme .household-grid th {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

.household-grid input {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 4px !important;
}
body.dark-theme .household-grid input {
  background-color: #121214 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Gray out paused slot cells */
.household-grid td:has(.pause-slot-check:checked) {
  background-color: #f1f5f9 !important;
  opacity: 0.65 !important;
}
body.dark-theme .household-grid td:has(.pause-slot-check:checked) {
  background-color: rgba(255, 255, 255, 0.04) !important;
}

/* === PORTIONS STEPPER WIDGET === */
.stepper-input {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
  margin-top: 6px;
}
body.dark-theme .stepper-input {
  background: #121214;
  border-color: rgba(255, 255, 255, 0.1);
}
.stepper-btn {
  background: transparent;
  border: none;
  color: #ff6f3c;
  font-size: 1.4rem;
  font-weight: bold;
  width: 44px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.stepper-btn:hover {
  background: rgba(255, 111, 60, 0.1);
}
.stepper-input input {
  width: 55px !important;
  height: 40px !important;
  border: none !important;
  background: transparent !important;
  text-align: center !important;
  padding: 0 !important;
  font-size: 1.1rem !important;
  font-weight: bold !important;
  color: #1e293b !important;
  outline: none !important;
}
body.dark-theme .stepper-input input {
  color: #ffffff !important;
}
.stepper-input input::-webkit-outer-spin-button,
.stepper-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* === MODERNIZED INPUTS & CUSTOM DROPDOWN === */
#preferences-modal select,
#preferences-modal input[type="text"],
#preferences-modal input[type="time"] {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  font-size: 0.95rem !important;
  outline: none !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  min-height: 42px !important;
}
body.dark-theme #preferences-modal select,
body.dark-theme #preferences-modal input[type="text"],
body.dark-theme #preferences-modal input[type="time"] {
  background-color: #121214 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}
#preferences-modal select:focus,
#preferences-modal input[type="text"]:focus,
#preferences-modal input[type="time"]:focus {
  border-color: #ff6f3c !important;
  box-shadow: 0 0 0 3px rgba(255, 111, 60, 0.25) !important;
}

/* Custom dropdown chevron (FF-ICON-001) */
#preferences-modal select {
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="%23ff6f3c" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>') !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  background-size: 18px 18px !important;
  padding-right: 44px !important;
  cursor: pointer !important;
}

/* === EMPTY STATE PLACEHOLDERS === */
.dropzone-empty-state {
  width: 100%;
  padding: 18px;
  text-align: center;
  border: 2px dashed rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px;
  color: #64748b;
  font-size: 0.85rem;
  font-style: italic;
  pointer-events: none;
  box-sizing: border-box;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.01);
}
body:not(.dark-theme) .dropzone-empty-state {
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #94a3b8;
  background: rgba(0, 0, 0, 0.01);
}

/* === FULL-SCREEN MEMBERSHIP SCREEN === */
#desktop-membership-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: #f8fafc !important;
  z-index: 999999 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto !important;
  font-family: inherit;
  box-sizing: border-box;
  color: #1e293b !important;
}
body.dark-theme #desktop-membership-screen {
  background: #0f0f12 !important;
  color: #f4f1ea !important;
}

#desktop-membership-screen.hidden {
  display: none !important;
}

.membership-screen-header {
  padding: 16px 24px !important;
  border-bottom: 1px solid #cbd5e1 !important;
  display: flex !important;
  align-items: center !important;
  background: #ffffff !important;
}
body.dark-theme .membership-screen-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
  background: #111217 !important;
}

.membership-logo-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
}
.membership-logo-wrap img {
  height: 52px !important;
  width: auto !important;
  object-fit: contain !important;
}
body.dark-theme .membership-logo-wrap img {
  content: url("images/favicon.png");
  filter: brightness(0) invert(1) opacity(0.9) !important;
}
.membership-logo-wrap .app-name {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  color: #1e293b !important;
  letter-spacing: -0.025em !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}
body.dark-theme .membership-logo-wrap .app-name {
  color: #ffffff !important;
}

@media (max-width: 768px) {
  .membership-screen-header {
    padding: 12px 16px !important;
  }
  .membership-logo-wrap {
    gap: 12px !important;
  }
  .membership-logo-wrap img {
    height: 32px !important;
  }
  .membership-logo-wrap .app-name {
    font-size: 1.25rem !important;
  }
}

.membership-screen-content {
  max-width: 1100px;
  width: 90%;
  margin: 0 auto;
  padding: 40px 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.back-to-plan-wrapper {
  margin-bottom: 24px;
}
.back-to-plan-link {
  color: #ff6f3c;
  font-weight: 800;
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s;
}
.back-to-plan-link:hover {
  transform: translateX(-4px);
}

.membership-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #1e293b;
  margin: 0 0 32px 0;
  text-align: center;
  letter-spacing: -0.03em;
}
body.dark-theme .membership-title {
  color: #ffffff;
}

#desktop-membership-screen .membership-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: stretch;
}

#desktop-membership-screen .membership-card {
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  gap: 20px;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
  box-sizing: border-box;
}
body.dark-theme #desktop-membership-screen .membership-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #16161a;
}

#desktop-membership-screen .membership-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
}
body.dark-theme #desktop-membership-screen .membership-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

#desktop-membership-screen .membership-card.selected,
#desktop-membership-screen .membership-card.plus-card.selected {
  border-color: #ff6f3c !important;
  box-shadow: 0 0 0 1px #ff6f3c, 0 12px 40px rgba(255, 111, 60, 0.15);
}

#desktop-membership-screen .popular-badge {
  position: absolute;
  top: -12px;
  right: 28px;
  background: #ff6f3c;
  color: #0f0f12;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#desktop-membership-screen .tier-name {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 900;
  color: #1e293b;
}
body.dark-theme #desktop-membership-screen .tier-name {
  color: #ffffff;
}

#desktop-membership-screen .tier-price {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ff6f3c;
  margin: 8px 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
#desktop-membership-screen .plus-card .tier-price {
  color: #ff6f3c;
}

#desktop-membership-screen .price-period {
  font-size: 1rem;
  font-weight: 600;
  color: #64748b;
}
body.dark-theme #desktop-membership-screen .price-period {
  color: #a7a7ae;
}

#desktop-membership-screen .price-annual {
  font-size: 0.85rem;
  color: #64748b;
  display: block;
  margin-top: 4px;
  font-weight: 500;
}
body.dark-theme #desktop-membership-screen .price-annual {
  color: #a7a7ae;
}

#desktop-membership-screen .tier-desc {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.4;
}
body.dark-theme #desktop-membership-screen .tier-desc {
  color: #a7a7ae;
}

#desktop-membership-screen .tier-features {
  list-style: none;
  padding: 0;
  margin: 16px 0 auto 0;
  font-size: 0.95rem;
  line-height: 2;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body.dark-theme #desktop-membership-screen .tier-features {
  color: #cbd5e1;
}

#desktop-membership-screen .tier-features li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
#desktop-membership-screen .tier-features li.nested-feature {
  font-weight: 800;
  color: #ff9a76;
}
#desktop-membership-screen .plus-card .tier-features li.nested-feature {
  color: #ff9a76;
}
body:not(.dark-theme) #desktop-membership-screen .plus-card .tier-features li.nested-feature {
  color: #ff6f3c;
}

#desktop-membership-screen .membership-select-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 111, 60, 0.45);
  background: transparent;
  color: #ff6f3c;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 16px;
}
#desktop-membership-screen .membership-select-btn:hover:not(:disabled) {
  background: rgba(255, 111, 60, 0.08);
}
#desktop-membership-screen .membership-select-btn.primary-btn {
  background: #ff6f3c;
  color: #ffffff;
  border: none;
}
#desktop-membership-screen .membership-select-btn.primary-btn:hover:not(:disabled) {
  background: #e55b27;
}
#desktop-membership-screen .plus-card .membership-select-btn {
  border-color: rgba(255, 111, 60, 0.45);
  color: #ff6f3c;
}
#desktop-membership-screen .plus-card .membership-select-btn:hover:not(:disabled) {
  background: rgba(255, 111, 60, 0.08);
}
#desktop-membership-screen .membership-select-btn:disabled {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #94a3b8 !important;
  cursor: default !important;
}
body.dark-theme #desktop-membership-screen .membership-select-btn:disabled {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.35) !important;
}

/* === BATCH OVERRIDE CHEVRON === */
.override-arrow-icon svg {
  width: 16px;
  height: 16px;
  color: #ff6f3c;
  transition: transform 250ms ease !important;
  display: inline-block;
  vertical-align: middle;
}
.override-arrow-icon.expanded svg {
  transform: rotate(180deg) !important;
}

/* === PRIMARY ORANGE BUTTON OVERRIDES === */
#desktop-batch-save,
#duplicate-confirm-btn,
#confirm-ok-btn {
  background: var(--accent-color, #ff6f3c) !important;
  border-color: var(--accent-color, #ff6f3c) !important;
  color: #ffffff !important;
  font-weight: 850 !important;
  transition: all 0.2s;
}
#desktop-batch-save:hover,
#duplicate-confirm-btn:hover,
#confirm-ok-btn:hover {
  background: var(--accent-hover, #e55b27) !important;
}

/* === BATCH SESSION MEAL OUTLINE === */
.batch-session-meal {
  position: relative !important;
}
.batch-session-meal::after {
  content: "" !important;
  position: absolute !important;
  top: 3px !important;
  left: 3px !important;
  right: 3px !important;
  bottom: 3px !important;
  border: 2px dashed var(--accent-color, #ff6f3c) !important;
  border-radius: 6px !important;
  pointer-events: none !important;
  box-sizing: border-box !important;
}

/* === BATCH EDIT/DELETE BUTTON STYLING === */
.desktop-batch-card-actions button {
  background: #475569 !important;
  color: #ffffff !important;
  border: 1px solid #475569 !important;
  border-radius: 8px !important;
  padding: 8px 16px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease, border-color 0.2s ease !important;
}

.desktop-batch-card-actions button:hover {
  background: #334155 !important;
  border-color: #334155 !important;
}

body.dark-theme .desktop-batch-card-actions button {
  background: #334155 !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
}

body.dark-theme .desktop-batch-card-actions button:hover {
  background: #475569 !important;
  border-color: #475569 !important;
}

/* === CUSTOM TOOLTIP === */
.custom-tooltip {
  position: absolute !important;
  background: #ffffff !important;
  color: #1e293b !important;
  padding: 12px 16px !important;
  border-radius: 12px !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  z-index: 1000 !important;
  max-width: 280px !important;
  pointer-events: none !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  font-size: 0.85rem !important;
  line-height: 1.4 !important;
  border: 1px solid #e2e8f0 !important;
  opacity: 0;
  transition: opacity 0.15s ease-in-out !important;
}

.custom-tooltip.visible {
  opacity: 1;
}

.custom-tooltip .tooltip-header {
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  color: #0f172a !important;
}

.custom-tooltip .tooltip-body {
  color: #475569 !important;
}

.custom-tooltip .tooltip-footer {
  margin-top: 4px !important;
  font-size: 0.75rem !important;
  color: var(--accent-color, #ff6f3c) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
}

/* Dark mode overrides for tooltip */
body.dark-theme .custom-tooltip {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3) !important;
}

body.dark-theme .custom-tooltip .tooltip-header {
  color: #ffffff !important;
}

body.dark-theme .custom-tooltip .tooltip-body {
  color: #cbd5e1 !important;
}

/* === TASTE PROFILE COMPLETION SCREEN STYLING === */
.onboarding-completion-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 8px 16px;
  width: 100%;
  box-sizing: border-box;
}

.onboarding-completion-header {
  text-align: center;
  margin-bottom: 8px;
}
.onboarding-completion-header h2 {
  font-size: 1.8rem;
  font-weight: 900;
  color: #ff6f3c;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.onboarding-completion-header p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #64748b;
  margin: 0 auto;
  max-width: 600px;
}
body.dark-theme .onboarding-completion-header p {
  color: #cbd5e1;
}

.onboarding-completion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .onboarding-completion-grid {
    grid-template-columns: 1fr;
  }
}

.onboarding-feature-tile {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
body.dark-theme .onboarding-feature-tile {
  background: #1e1e24;
  border-color: rgba(255, 255, 255, 0.08);
}
.onboarding-feature-tile:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
body.dark-theme .onboarding-feature-tile:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.onboarding-feature-tile.tile-premium-locked {
  cursor: pointer;
}
.onboarding-feature-tile.tile-premium-locked .tile-main-content {
  filter: blur(0.4px);
  opacity: 0.75;
}
.onboarding-feature-tile.tile-premium-locked:hover {
  border-color: #ff6f3c;
  background: rgba(255, 111, 60, 0.02);
}
body.dark-theme .onboarding-feature-tile.tile-premium-locked:hover {
  background: rgba(255, 111, 60, 0.04);
}

.tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.tile-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: #1e293b;
  margin: 0;
}
body.dark-theme .tile-title {
  color: #ffffff;
}

.tile-lock-icon {
  color: #ff6f3c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tile-description {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #64748b;
  margin: 4px 0 0 0;
}
body.dark-theme .tile-description {
  color: #a7a7ae;
}

.tile-subtitle-locked {
  font-size: 0.72rem;
  font-weight: 700;
  color: #ff6f3c;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.tile-btn-configure {
  background: transparent;
  border: 1px solid rgba(255, 111, 60, 0.45);
  color: #ff6f3c;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  width: fit-content;
  transition: all 0.2s;
  box-sizing: border-box;
}
.tile-btn-configure:hover {
  background: rgba(255, 111, 60, 0.08);
}

.onboarding-completion-actions {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}
@media (max-width: 480px) {
  .onboarding-completion-actions {
    flex-direction: column;
    gap: 10px;
  }
}
.onboarding-completion-actions button {
  flex: 1;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 850;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.onboarding-completion-actions .btn-start-planning {
  background: #ff6f3c;
  color: #ffffff !important;
  border: none;
}
.onboarding-completion-actions .btn-start-planning:hover {
  background: #e55b27;
}
.onboarding-completion-actions .btn-browse-recipes {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #475569 !important;
}
body.dark-theme .onboarding-completion-actions .btn-browse-recipes {
  border-color: rgba(255, 255, 255, 0.15);
  color: #cbd5e1 !important;
}
.onboarding-completion-actions .btn-browse-recipes:hover {
  background: #f1f5f9;
}
body.dark-theme .onboarding-completion-actions .btn-browse-recipes:hover {
  background: rgba(255, 255, 255, 0.04);
}

.onboarding-improve-section {
  border-top: 1px solid #e2e8f0;
  padding-top: 20px;
  margin-top: 16px;
}
body.dark-theme .onboarding-improve-section {
  border-top-color: rgba(255, 255, 255, 0.08);
}
.onboarding-improve-title {
  font-weight: 800;
  font-size: 1.1rem;
  color: #1e293b;
  margin: 0 0 12px 0;
}
body.dark-theme .onboarding-improve-title {
  color: #ffffff;
}

.onboarding-improve-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 480px) {
  .onboarding-improve-links {
    grid-template-columns: 1fr;
  }
}
.improve-action-link {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.82rem;
  color: #ff6f3c !important;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s;
}
body.dark-theme .improve-action-link {
  background: #18181c;
  border-color: rgba(255, 255, 255, 0.04);
}
.improve-action-link:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateX(2px);
}
body.dark-theme .improve-action-link:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.1);
}

/* === DESKTOP COLLAPSIBLE HEADER === */
#app-header {
  position: relative !important;
}

#app-header,
#app-header .header-brand-bar,
#week-display-wrap {
  overflow: visible !important;
}

#app-header .header-brand-bar {
  max-height: 80px !important;
  opacity: 1 !important;
  overflow: hidden !important;
  transition: max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease, opacity 0.2s ease !important;
}

#week-display-wrap {
  position: static !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  z-index: 10 !important;
  white-space: nowrap !important;
  pointer-events: auto !important;
  transition: none !important;
}

#week-display {
  position: static !important;
  transform: none;
  margin: 0 !important;
  font-size: 1.05rem !important;
  line-height: normal !important;
  font-family: 'Outfit', 'Inter', sans-serif !important;
  font-weight: 800 !important;
  letter-spacing: 0.025em !important;
  text-transform: uppercase !important;
  color: #111827 !important;
  text-align: center !important;
  cursor: default !important;
  user-select: none !important;
  white-space: nowrap !important;
  will-change: transform;
}

#header-collapse-btn {
  position: absolute !important;
  right: 1.5rem !important;
  bottom: 0.5rem !important;
  transform: none;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  cursor: pointer !important;
  padding: 4px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  will-change: transform;
}

#header-collapse-btn svg {
  width: 20px !important;
  height: 20px !important;
  color: #94a3b8 !important;
  transition: transform 250ms ease !important;
}

#app-header:not(.header-collapsed) #header-collapse-btn svg {
  transform: rotate(180deg);
}

#app-header.header-collapsed {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

#app-header.header-collapsed .navigation-row {
  margin: 0 !important;
  padding-right: 18rem !important;
}

#app-header.header-collapsed .week-nav-centered {
  position: absolute !important;
  right: 1.5rem !important;
  bottom: 0.5rem !important;
  z-index: 20 !important;
  width: auto !important;
  max-width: none !important;
  max-height: 38px !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-direction: row !important;
  gap: 0.25rem !important;
  opacity: 1 !important;
  overflow: visible !important;
  pointer-events: auto !important;
}

#app-header.header-collapsed .week-buttons-row,
#app-header.header-collapsed #reroll-counter {
  display: none !important;
}

#app-header.header-collapsed #header-collapse-btn {
  position: static !important;
}

#app-header.header-animating .week-buttons-row {
  pointer-events: none !important;
}

#app-header.header-animating {
  overflow: visible !important;
  will-change: height !important;
  transition: none !important;
}

#app-header.header-animating .week-nav-centered,
#app-header.header-animating .navigation-row,
#app-header.header-animating #header-collapse-btn,
#app-header.header-animating #header-collapse-btn svg {
  transition: none !important;
}

#app-header.header-animating #week-display {
  transition: none !important;
  margin: 0 !important;
}

#app-header.header-collapsed #header-collapse-btn svg {
  transform: rotate(0deg);
}

/* === EPM Taxonomy Layout & Admin Grid Polishes === */
.admin-review-card .user-analytics-table th,
.admin-review-card .user-analytics-table td {
  padding: 0.5rem 0.6rem; /* slightly tighter padding to fit more columns */
}

/* Explicit widths and flex behaviors for merge actions */
.admin-merge-container {
  display: flex;
  gap: 6px;
  align-items: center;
  width: 100%;
}

.admin-merge-container input {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
}

.admin-merge-container button {
  flex-shrink: 0;
  margin-top: 0 !important;
  white-space: nowrap;
}

/* Header sort and filter layouts */
.admin-sort-header-inner {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.admin-header-title-container {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* EPM Taxonomy CRUD UI panel styles */
.admin-epm-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-epm-search-box {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-epm-search-box input {
  padding: 0.4rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  min-width: 240px;
  background: #fff;
  color: #1e293b;
}

body.dark-theme .admin-epm-search-box input {
  background: #1e293b;
  border-color: #475569;
  color: #f8fafc;
}

.admin-epm-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-epm-modal {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: modalEnter 0.2s ease-out;
}

body.dark-theme .admin-epm-modal {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.admin-epm-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.dark-theme .admin-epm-modal-header {
  border-color: #334155;
}

.admin-epm-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

body.dark-theme .admin-epm-modal-header h3 {
  color: #f8fafc;
}

.admin-epm-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-epm-modal-body label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

body.dark-theme .admin-epm-modal-body label {
  color: #94a3b8;
}

.admin-epm-modal-body input,
.admin-epm-modal-body select {
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font-weight: normal;
}

body.dark-theme .admin-epm-modal-body input,
body.dark-theme .admin-epm-modal-body select {
  background: #0f172a;
  border-color: #475569;
  color: #f8fafc;
}

.admin-epm-modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

body.dark-theme .admin-epm-modal-footer {
  border-color: #334155;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.admin-epm-preview-card {
  margin-top: 10px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-epm-preview-card .preview-label {
  color: #475569;
}
body.dark-theme .admin-epm-preview-card {
  background: #0f172a;
  border-color: #334155;
}
body.dark-theme .admin-epm-preview-card .preview-label {
  color: #cbd5e1;
}

/* Onboarding Step 1-3 Premium UI modifications */
.onboarding-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  width: 100%;
}
.onboarding-step-indicator-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.onboarding-skip-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s ease;
}
.onboarding-skip-link:hover {
  color: var(--accent-color, #ff6600);
}
.onboarding-theme-toggle-wrapper {
  margin: 20px 0;
  display: flex;
  justify-content: center;
}
.onboarding-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  background: #f1f5f9;
  padding: 8px 16px;
  border-radius: 99px;
  transition: all 0.2s ease;
}
.onboarding-toggle-label input {
  cursor: pointer;
}
body.dark-theme .onboarding-toggle-label {
  background: #1e293b;
  color: #cbd5e1;
}

/* Choice Matrix Grid for Step 2 */
.onboarding-matrix-row {
  margin-bottom: 24px;
  text-align: center;
}
.onboarding-matrix-title {
  font-size: 1rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 12px;
}
body.dark-theme .onboarding-matrix-title {
  color: #f1f5f9;
}
.onboarding-matrix-capsules {
  display: inline-flex;
  gap: 10px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 99px;
}
body.dark-theme .onboarding-matrix-capsules {
  background: #1e293b;
}
.matrix-capsule-btn {
  border: none;
  background: transparent;
  padding: 8px 18px !important;
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  border-radius: 99px !important;
  color: #64748b !important;
  cursor: pointer;
  transition: all 0.2s ease;
}
.matrix-capsule-btn.selected {
  background: var(--accent-color, #ff6600) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(255, 102, 0, 0.2);
}

/* Taste preference grid for Step 2 */
.onboarding-pref-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}
.onboarding-pref-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
}
body.dark-theme .onboarding-pref-group {
  background: #0f172a;
  border-color: #1e293b;
}
.pref-group-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #334155;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
body.dark-theme .pref-group-title {
  color: #cbd5e1;
}

/* Dashboard Grid for Step 3 */
.onboarding-setup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
  width: 100%;
}
.onboarding-grid-col {
  display: flex;
  flex-direction: column;
}
.onboarding-grid-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: space-between;
  min-height: 110px;
  box-sizing: border-box;
}
body.dark-theme .onboarding-grid-item {
  background: #0f172a;
  border-color: #1e293b;
}
.onboarding-grid-item.locked {
  border-style: dashed;
  opacity: 0.85;
}
.grid-item-label {
  font-size: 0.95rem;
  font-weight: 800;
  color: #334155;
}
body.dark-theme .grid-item-label {
  color: #f1f5f9;
}
.grid-item-hint {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.3;
}
body.dark-theme .grid-item-hint {
  color: #94a3b8;
}
.onboarding-input-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 8px;
  width: fit-content;
}
body.dark-theme .onboarding-input-control {
  background: #1e293b;
  border-color: #334155;
}
.onboarding-input-control input {
  -moz-appearance: textfield;
}
.onboarding-input-control input::-webkit-outer-spin-button,
.onboarding-input-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.control-btn {
  background: #f1f5f9;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  transition: all 0.2s ease;
}
.control-btn:hover {
  background: #cbd5e1;
}
body.dark-theme .control-btn {
  background: #334155;
  color: #f1f5f9;
}
body.dark-theme .control-btn:hover {
  background: #475569;
}
.input-suffix {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 600;
}
.input-prefix {
  font-size: 0.95rem;
  color: #64748b;
  font-weight: bold;
}
.onboarding-toggle-group {
  display: inline-flex;
  background: #cbd5e1;
  padding: 3px;
  border-radius: 8px;
  width: fit-content;
}
body.dark-theme .onboarding-toggle-group {
  background: #1e293b;
}
.onboarding-toggle-group .toggle-btn {
  border: none;
  background: transparent;
  padding: 6px 14px !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  color: #475569 !important;
  cursor: pointer;
  transition: all 0.2s ease;
}
body.dark-theme .onboarding-toggle-group .toggle-btn {
  color: #94a3b8 !important;
}
.onboarding-toggle-group .toggle-btn.active {
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
body.dark-theme .onboarding-toggle-group .toggle-btn.active {
  background: #334155 !important;
  color: #ffffff !important;
}
.onboarding-action-btn {
  background: #ff6600;
  color: #ffffff;
  border: none;
  padding: 8px 16px !important;
  font-weight: bold !important;
  border-radius: 8px !important;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.88rem !important;
}
.onboarding-action-btn:hover {
  background: #e05500;
}
.onboarding-action-btn.locked-btn {
  background: #64748b;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Custom Slots Modal Overlay */
.onboarding-slots-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  inset: 0;
  background: rgba(8, 10, 12, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  border-radius: 24px;
}
.onboarding-slots-modal {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  box-sizing: border-box;
}
body.dark-theme .onboarding-slots-modal {
  background: #1e293b;
  color: #f1f5f9;
}
.onboarding-slots-modal h3 {
  margin: 0 0 8px 0;
  font-size: 1.2rem;
  font-weight: 800;
}
.onboarding-slots-modal p {
  margin: 0 0 16px 0;
  font-size: 0.88rem;
  color: #64748b;
}
body.dark-theme .onboarding-slots-modal p {
  color: #94a3b8;
}
.onboarding-slots-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slots-grid-header {
  display: grid;
  grid-template-columns: 80px repeat(3, 1fr);
  font-weight: bold;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #64748b;
  text-align: center;
}
body.dark-theme .slots-grid-header {
  color: #94a3b8;
}
.slots-grid-header div:first-child {
  text-align: left;
}
.slots-grid-row {
  display: grid;
  grid-template-columns: 80px repeat(3, 1fr);
  align-items: center;
  text-align: center;
}
.slots-grid-row .day-label {
  text-align: left;
  font-weight: bold;
  font-size: 0.88rem;
  color: #334155;
}
body.dark-theme .slots-grid-row .day-label {
  color: #cbd5e1;
}
.slot-toggle-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-weight: bold !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: all 0.2s ease;
}
body.dark-theme .slot-toggle-btn {
  border-color: #475569;
  background: #0f172a;
  color: #f1f5f9;
}
.slot-toggle-btn:hover {
  background: #e2e8f0;
}
body.dark-theme .slot-toggle-btn:hover {
  background: #1e293b;
}
.slot-toggle-btn.paused {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #ef4444 !important;
  text-decoration: line-through;
}
body.dark-theme .slot-toggle-btn.paused {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #b91c1c !important;
  color: #f87171 !important;
}

body {
  transition: background-color 3000ms cubic-bezier(0.4, 0, 0.2, 1), color 3000ms ease;
}

/* === Premium Onboarding Fullscreen & Animations === */
.onboarding-overlay {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: #ffffff !important;
  z-index: 9998 !important;
  transition: background-color 3000ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body.dark-theme .onboarding-overlay {
  background: #111315 !important; /* Matches app dark-theme background */
}

.onboarding-modal {
  position: fixed !important;
  inset: 0 !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: #ffffff !important;
  color: #1e293b !important;
  padding: 20px 40px !important;
  z-index: 9999 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-items: center !important;
  transition: background-color 3000ms cubic-bezier(0.4, 0, 0.2, 1), color 3000ms ease !important;
}

body.dark-theme .onboarding-modal {
  background: #111315 !important; /* Matches app dark-theme background */
  color: #e2e8f0 !important;
}

/* Onboarding Logo Drifting Animation */
.onboarding-logo {
  display: block;
  object-fit: contain;
  transition: all 1000ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, width, height, margin;
  z-index: 10000;
  margin: 0 auto !important;
}

.onboarding-logo.step1 {
  width: 90px !important;
  height: 90px !important;
  margin-bottom: 30px !important;
}

.onboarding-logo.step2plus {
  width: 48px !important;
  height: 48px !important;
  margin-bottom: 16px !important;
}

.onboarding-logo.rotating {
  animation: rotateLogo 8s linear infinite;
}

@keyframes rotateLogo {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.fly-in-welcome {
  animation: flyInWelcome 1000ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: 800ms;
  opacity: 0;
  will-change: transform, opacity;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes flyInWelcome {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Sun and Crescent Moon Toggle Switch === */
.theme-toggle-switch {
  position: relative;
  display: inline-block;
  width: 72px;
  height: 38px;
  margin: 0 auto;
}

.theme-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #475569;
  transition: background-color 3000ms cubic-bezier(0.4, 0, 0.2, 1), border-color 3000ms cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 38px;
  border: 2px solid #64748b;
  box-sizing: border-box;
}

.theme-toggle-knob {
  position: absolute;
  height: 30px;
  width: 30px;
  left: 2px;
  bottom: 2px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 3000ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.knob-icon {
  position: absolute;
  font-size: 1.15rem;
  transition: opacity 3000ms cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1;
}

.knob-icon.moon {
  opacity: 1;
}

.knob-icon.sun {
  opacity: 0;
}

/* Checked (Light Mode) */
.theme-toggle-switch input:checked + .theme-toggle-slider {
  background-color: var(--accent-color);
  border-color: var(--accent-active);
}

.theme-toggle-switch input:checked + .theme-toggle-slider .theme-toggle-knob {
  transform: translateX(34px);
}

.theme-toggle-switch input:checked + .theme-toggle-slider .knob-icon.moon {
  opacity: 0;
}

.theme-toggle-switch input:checked + .theme-toggle-slider .knob-icon.sun {
  opacity: 1;
}

/* === Scale Slider Layout === */
.onboarding-matrix-capsules.scale-layout {
  display: flex !important;
  justify-content: center !important;
  gap: 28px !important;
  margin: 24px auto !important;
  padding: 12px 0 !important;
  position: relative !important;
  width: 100% !important;
  max-width: 360px !important;
}

.scale-item {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  width: 44px !important;
  height: 52px !important;
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  color: #64748b !important;
  transition: color 0.3s ease !important;
}

body.dark-theme .scale-item {
  color: #475569 !important;
}

.scale-item.selected {
  color: var(--accent-color) !important;
}

.scale-arrow {
  position: absolute !important;
  color: var(--accent-color) !important;
  font-size: 0.85rem !important;
  line-height: 1 !important;
}

.scale-arrow.top {
  top: -10px !important;
}

.scale-arrow.bottom {
  bottom: -10px !important;
}

.scale-num {
  z-index: 2 !important;
}

/* === Dynamic Step 3 Grid - Always 2 Columns === */
.onboarding-setup-grid {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 16px !important;
  margin: 20px 0 !important;
  width: 100% !important;
  max-width: 720px !important;
}

/* Onboarding Step Container spacing adjustments */
#onboarding-step-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

#onboarding-step-container:has(.onboarding-setup-grid) {
  max-width: 760px;
}

/* === Onboarding Welcome Screen Layout overrides === */
.onboarding-hero-card.fullscreen-layout {
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  height: 100% !important;
  min-height: 70vh !important;
  width: 100% !important;
  max-width: 420px !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

.onboarding-hero-body {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
}

.onboarding-theme-toggle-wrapper {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  margin-top: 32px !important;
  width: 100% !important;
}

.toggle-theme-label {
  font-weight: 700 !important;
  font-size: 0.95rem !important;
  margin-top: 12px !important;
  color: #94a3b8 !important;
  text-align: center !important;
  letter-spacing: 0.02em !important;
}

body:not(.dark-theme) .toggle-theme-label {
  color: #475569 !important;
}

.onboarding-chin {
  width: 100% !important;
  padding-top: 24px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  margin-top: 32px !important;
}

body:not(.dark-theme) .onboarding-chin {
  border-top-color: rgba(0, 0, 0, 0.08) !important;
}

/* Logo inversion in dark theme */
body.dark-theme .onboarding-logo {
  filter: brightness(0) invert(1) !important;
}

/* === Compact Step 4 Setup Grid Optimizations === */
.onboarding-setup-grid .onboarding-grid-item {
  min-height: 80px !important;
  padding: 10px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  gap: 6px !important;
}

.onboarding-setup-grid .grid-item-label {
  font-size: 0.78rem !important; /* Smaller fonts inside grid cards */
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  margin-bottom: 2px !important;
}

/* Button & Toggle overrides inside grid items to allow word wrap and 2 lines */
.onboarding-setup-grid .onboarding-action-btn,
.onboarding-setup-grid .locked-btn,
.onboarding-setup-grid .onboarding-toggle-group .toggle-btn {
  white-space: normal !important; /* Allow wrapping */
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  line-height: 1.25 !important;
  font-size: 0.8rem !important; /* Smaller font sizes */
  padding: 8px 10px !important;
  height: auto !important;
  min-height: 38px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  width: 100% !important;
}

.onboarding-setup-grid .onboarding-toggle-group {
  display: flex !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.onboarding-setup-grid .onboarding-toggle-group .toggle-btn {
  flex: 1 !important;
}

/* Smaller input controls */
.onboarding-setup-grid .onboarding-input-control {
  gap: 4px !important;
  font-size: 0.85rem !important;
}

.onboarding-setup-grid .onboarding-input-control input {
  font-size: 0.95rem !important;
}

.onboarding-setup-grid .onboarding-input-control .control-btn {
  width: 24px !important;
  height: 24px !important;
  font-size: 0.85rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.onboarding-footer,
.onboarding-chin {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  margin: 0 auto !important;
  transform: none !important;
  width: 100% !important;
  max-width: 440px !important; /* matches card max-width */
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 24px)) !important; /* safe area support with 24px fallback */
  background: transparent !important;
  border-top: 0 !important;
  z-index: 10005 !important;
  box-sizing: border-box !important;
}

body.dark-theme .onboarding-footer,
body.dark-theme .onboarding-chin {
  background: transparent !important;
  border-top-color: transparent !important;
}

/* Ensure step content wrapper is a relative container with independent scroll content */
.onboarding-content-wrapper {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 440px !important;
  height: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  min-height: 0 !important;
}

.onboarding-scroll-content {
  flex: 1 !important;
  width: 100% !important;
  overflow-y: auto !important;
  padding: 20px 20px 120px 20px !important; /* 120px clearance for fixed footer */
  box-sizing: border-box !important;
}

#onboarding-step-container {
  padding-bottom: 0 !important;
}

/* === Stacked Onboarding Inputs (Step 1 of 2) === */
.onboarding-stacked-inputs {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  width: 100% !important;
  max-width: 600px !important;
  margin: 15px auto !important;
}

.onboarding-stacked-inputs .onboarding-grid-item.full-width-stacked {
  width: 100% !important;
  min-height: 84px !important;
  padding: 12px 16px !important;
  border-radius: 12px !important;
  border: 1px solid #e2e8f0 !important;
  background-color: #f8fafc !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  text-align: center !important;
}

body.dark-theme .onboarding-stacked-inputs .onboarding-grid-item.full-width-stacked {
  background-color: #0f172a !important;
  border-color: #1e293b !important;
}

.onboarding-stacked-inputs .onboarding-grid-item.full-width-stacked.batch-cook-row {
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  text-align: left !important;
}

.onboarding-stacked-inputs .grid-item-label {
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.03em !important;
  margin-bottom: 3px !important;
  color: #475569 !important;
}

.onboarding-target-helper {
  color: #71717a !important;
  font-size: 0.72rem !important;
  font-weight: 650 !important;
  line-height: 1.2 !important;
  margin: 0 0 7px !important;
}

body.dark-theme .onboarding-target-helper {
  color: #a1a1aa !important;
}

body.dark-theme .onboarding-stacked-inputs .grid-item-label {
  color: #cbd5e1 !important;
}

.onboarding-stacked-inputs .onboarding-input-control {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 4px 8px !important;
  width: fit-content !important;
  margin: 0 auto !important;
}

body.dark-theme .onboarding-stacked-inputs .onboarding-input-control {
  background: #1e293b !important;
  border-color: #334155 !important;
}

.onboarding-stacked-inputs .onboarding-input-control input {
  border: none !important;
  background: transparent !important;
  font-weight: bold !important;
  font-size: 1.05rem !important;
  color: inherit !important;
  text-align: center !important;
}

.onboarding-stacked-inputs .onboarding-input-control .control-btn {
  background: #f1f5f9 !important;
  border: none !important;
  color: #475569 !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 6px !important;
  font-size: 1.1rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
}

body.dark-theme .onboarding-stacked-inputs .onboarding-input-control .control-btn {
  background: #334155 !important;
  color: #f1f5f9 !important;
}

.onboarding-stacked-inputs .onboarding-toggle-group {
  display: flex !important;
  background: #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 2px !important;
}

body.dark-theme .onboarding-stacked-inputs .onboarding-toggle-group {
  background: #1e293b !important;
}

.onboarding-stacked-inputs .onboarding-toggle-group .toggle-btn {
  background: transparent !important;
  border: none !important;
  padding: 6px 16px !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  color: #64748b !important;
  cursor: pointer !important;
}

body.dark-theme .onboarding-stacked-inputs .onboarding-toggle-group .toggle-btn {
  color: #94a3b8 !important;
}

.onboarding-stacked-inputs .onboarding-toggle-group .toggle-btn.active {
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

body.dark-theme .onboarding-stacked-inputs .onboarding-toggle-group .toggle-btn.active {
  background: #334155 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

/* v1.3.5 onboarding polish: phone-safe chin, compact taste profile, dark-theme cohesion */
.onboarding-overlay,
.onboarding-modal {
  height: 100vh !important;
  height: 100svh !important;
  height: 100dvh !important;
}

body.dark-theme .onboarding-overlay,
body.dark-theme .onboarding-modal {
  background: #121214 !important;
}

body.dark-theme .onboarding-footer,
body.dark-theme .onboarding-chin {
  background: transparent !important;
}

.onboarding-modal {
  position: fixed !important;
  padding: max(14px, env(safe-area-inset-top, 0px)) 18px 0 !important;
}

.onboarding-logo.step1 {
  width: 72px !important;
  height: 72px !important;
  margin-bottom: 10px !important;
}

.onboarding-logo.step2plus {
  width: 40px !important;
  height: 40px !important;
  margin-bottom: 8px !important;
}

.onboarding-content-wrapper {
  height: auto !important;
  flex: 1 1 auto !important;
  max-width: 430px !important;
}

.onboarding-scroll-content {
  padding: 10px 8px 104px !important;
  scrollbar-width: none;
}

.onboarding-scroll-content::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.onboarding-welcome-content {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  min-height: 0 !important;
}

.onboarding-hero-card.fullscreen-layout {
  min-height: 0 !important;
  height: 100% !important;
  max-width: 390px !important;
}

.onboarding-hero-body {
  justify-content: center !important;
  min-height: 0 !important;
}

.onboarding-header-section h2 {
  font-size: clamp(1.7rem, 6.6vw, 2.15rem) !important;
  line-height: 1.12 !important;
  letter-spacing: 0 !important;
  margin: 0 0 10px !important;
}

.onboarding-header-section p {
  max-width: 280px !important;
  margin: 0 auto !important;
  line-height: 1.25 !important;
}

.onboarding-theme-toggle-wrapper {
  margin-top: 24px !important;
}

.onboarding-nav-header {
  margin-bottom: 14px !important;
  padding: 0 2px !important;
}

.onboarding-step-indicator-text,
.onboarding-skip-link {
  font-size: 0.78rem !important;
  letter-spacing: 0.04em !important;
}

.onboarding-matrix-row {
  margin-top: 8px !important;
  margin-bottom: 10px !important;
}

.onboarding-matrix-title {
  margin-bottom: 6px !important;
}

.onboarding-matrix-capsules.scale-layout {
  max-width: 292px !important;
  gap: 16px !important;
  margin: 12px auto !important;
  padding: 8px 0 !important;
  border-radius: 999px !important;
}

.scale-item {
  width: 38px !important;
  height: 44px !important;
  font-size: 1.05rem !important;
}

body.dark-theme .onboarding-matrix-capsules,
body.dark-theme .onboarding-pref-group,
body.dark-theme .onboarding-stacked-inputs .onboarding-grid-item.full-width-stacked,
body.dark-theme .onboarding-connect-card {
  background: #18181b !important;
  border-color: #2a2a30 !important;
}

body.dark-theme .onboarding-input-control,
body.dark-theme .onboarding-stacked-inputs .onboarding-input-control,
body.dark-theme .onboarding-toggle-group,
body.dark-theme .onboarding-stacked-inputs .onboarding-toggle-group {
  background: #24242a !important;
  border-color: #35353d !important;
}

body.dark-theme .control-btn,
body.dark-theme .onboarding-stacked-inputs .onboarding-input-control .control-btn,
body.dark-theme .onboarding-toggle-group .toggle-btn.active,
body.dark-theme .onboarding-stacked-inputs .onboarding-toggle-group .toggle-btn.active {
  background: #34343d !important;
  color: #f7f7f8 !important;
}

.onboarding-stacked-inputs {
  gap: 10px !important;
  margin: 10px auto !important;
}

.onboarding-stacked-inputs .onboarding-grid-item.full-width-stacked {
  min-height: 84px !important;
  padding: 10px 14px !important;
  border-radius: 10px !important;
}

.onboarding-pref-sections {
  gap: 10px !important;
}

.onboarding-pref-group {
  padding: 12px 14px !important;
  border-radius: 12px !important;
  background: #fafafa !important;
  border-color: #e5e7eb !important;
}

.pref-group-title {
  margin-bottom: 8px !important;
  font-size: 0.82rem !important;
  color: #4b5563 !important;
}

body.dark-theme .pref-group-title {
  color: #d4d4d8 !important;
}

.onboarding-tag-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 8px !important;
  margin: 0 !important;
  overflow: visible !important;
  max-height: none !important;
}

.onboarding-pill {
  min-height: 34px !important;
  padding: 7px 12px !important;
  border-radius: 999px !important;
  background: transparent !important;
  border: 1px solid #d6d3d1 !important;
  color: #3f3f46 !important;
  box-shadow: none !important;
  font-size: 0.84rem !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
}

.onboarding-pill .material-pill-icon {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: currentColor !important;
}

.onboarding-pill .material-pill-icon svg {
  width: 16px !important;
  height: 16px !important;
  fill: currentColor !important;
  display: block !important;
}

body.dark-theme .onboarding-pill {
  background: #202026 !important;
  border-color: #363640 !important;
  color: #e4e4e7 !important;
}

.onboarding-pill.selected,
body.dark-theme .onboarding-pill.selected {
  background: rgba(255, 111, 60, 0.15) !important;
  border-color: rgba(255, 111, 60, 0.72) !important;
  color: #ffb089 !important;
}

.onboarding-connect-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.onboarding-connect-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fafafa;
  color: #18181b;
  text-align: left;
  cursor: pointer;
}

.onboarding-connect-card.household-upgrade-card {
  align-items: flex-start;
  min-height: 112px;
  padding: 14px;
  cursor: default;
}

.onboarding-connect-card strong,
.onboarding-connect-card small {
  display: block;
}

.onboarding-connect-card strong {
  font-size: 0.96rem;
  line-height: 1.2;
}

.onboarding-connect-card small {
  margin-top: 3px;
  color: #71717a;
  line-height: 1.28;
}

.onboarding-mini-upgrade-btn {
  margin-top: 10px;
  min-height: 34px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: #ff6f1f;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(255, 111, 31, 0.22);
}

.onboarding-mini-upgrade-btn:active {
  transform: translateY(1px);
}

body.dark-theme .onboarding-connect-card {
  color: #f4f4f5;
}

body.dark-theme .onboarding-connect-card small {
  color: #a1a1aa;
}

.connect-icon {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 111, 60, 0.16);
  color: #ff7a3d;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.connect-icon svg {
  width: 21px;
  height: 21px;
  display: block;
  fill: currentColor;
}

.onboarding-connect-card.locked .connect-icon {
  background: rgba(255, 111, 60, 0.16);
  color: #ff7a3d;
}

.subscription-link-text {
  color: #ff8a4c;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.onboarding-footer,
.onboarding-chin {
  position: absolute !important;
  left: 50% !important;
  right: auto !important;
  bottom: 0 !important;
  transform: translateX(-50%) !important;
  width: min(100%, 430px) !important;
  max-width: calc(100vw - 28px) !important;
  padding: 12px 14px max(14px, env(safe-area-inset-bottom, 0px)) !important;
  background: transparent !important;
}

.onboarding-footer {
  display: flex !important;
  gap: 12px !important;
}

.onboarding-btn {
  min-height: 46px !important;
  border-radius: 10px !important;
  font-size: 0.95rem !important;
  line-height: 1.15 !important;
}

.onboarding-btn.primary {
  background: #ff6f1f !important;
  box-shadow: 0 8px 18px rgba(255, 111, 31, 0.25) !important;
}

.onboarding-platform-card {
  align-items: center;
  background: rgba(255, 111, 60, 0.08);
  border: 1px solid rgba(255, 111, 60, 0.32);
  border-radius: 14px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: 0 0 14px;
  padding: 14px;
}

.onboarding-platform-card strong,
.onboarding-platform-card small {
  display: block;
}

.onboarding-platform-card small {
  color: #64748b;
  margin-top: 3px;
}

.onboarding-store-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.onboarding-store-badge {
  background: #171719;
  border-radius: 7px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.05;
  min-width: 94px;
  padding: 8px 10px;
  text-align: center;
}

.onboarding-store-badge.disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

@media (max-width: 620px) {
  .onboarding-platform-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .onboarding-store-badges {
    justify-content: flex-start;
  }
}

.onboarding-confetti-pop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483000;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: var(--y);
  width: 9px;
  height: 14px;
  border-radius: 3px;
  opacity: 0;
  animation: onboardingConfettiPop 1120ms cubic-bezier(0.16, 1, 0.3, 1) var(--delay) forwards;
}

.confetti-piece.from-left {
  left: -16px;
}

.confetti-piece.from-right {
  right: -16px;
}

@keyframes onboardingConfettiPop {
  0% {
    opacity: 0;
    transform: translateX(0) translateY(0) rotate(0deg) scale(0.8);
  }
  22% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(var(--x)) translateY(-22vh) rotate(var(--spin)) scale(1);
  }
}

@media (max-height: 760px) {
  .onboarding-logo.step1 {
    width: 58px !important;
    height: 58px !important;
  }

  .onboarding-logo.step2plus {
    width: 34px !important;
    height: 34px !important;
  }

  .onboarding-header-section h2 {
    font-size: clamp(1.45rem, 6vw, 1.9rem) !important;
  }

  .onboarding-scroll-content {
    padding-top: 4px !important;
    padding-bottom: 94px !important;
  }

  .onboarding-pref-group {
    padding: 10px 12px !important;
  }

  .onboarding-pill {
    min-height: 31px !important;
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
  }

  .onboarding-stacked-inputs .onboarding-grid-item.full-width-stacked {
    min-height: 76px !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  .onboarding-target-helper {
    font-size: 0.68rem !important;
    margin-bottom: 5px !important;
  }
}
