/*
 * MISE - Kitchen-Friendly Recipe Management
 * Design Philosophy: Glanceable, thumb-friendly, forgiving
 */

/* ==========================================================================
   CSS Custom Properties - Warm Kitchen Palette
   ========================================================================== */

:root {
  /* Colors - Warm and appetizing */
  --color-cream: #fdfbf7;
  --color-cream-dark: #f5f0e8;
  --color-warm-white: #fffef9;
  --color-parchment: #f8f4ec;

  /* Primary accent - Terracotta */
  --color-primary: #c75d3a;
  --color-primary-dark: #a84d2e;
  --color-primary-light: #e8a089;

  /* Secondary accent - Forest green */
  --color-secondary: #4a6741;
  --color-secondary-dark: #3a5234;
  --color-secondary-light: #7a9970;

  /* Neutral tones */
  --color-text: #2d2a26;
  --color-text-muted: #6b6560;
  --color-text-light: #8a857e;
  --color-border: #e0dbd3;
  --color-border-light: #eae6df;

  /* Status colors */
  --color-success: #4a6741;
  --color-warning: #d4a03a;
  --color-error: #c44536;
  --color-checked: #9a958e;

  /* Typography */
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Spacing - Generous for touch targets */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Touch targets - 44px minimum */
  --touch-target: 2.75rem;
  --touch-target-lg: 3.5rem;

  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(45, 42, 38, 0.05);
  --shadow-md: 0 4px 6px rgba(45, 42, 38, 0.07);
  --shadow-lg: 0 10px 15px rgba(45, 42, 38, 0.1);

  /* Layout */
  --nav-height: 4rem;
  --sidebar-width: 5rem;
  --content-max-width: 48rem;
  --content-padding: var(--space-4);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-cream: #1a1916;
    --color-cream-dark: #232019;
    --color-warm-white: #0f0e0c;
    --color-parchment: #1f1c18;

    --color-text: #f0ebe4;
    --color-text-muted: #a8a299;
    --color-text-light: #7a756d;
    --color-border: #3a3632;
    --color-border-light: #2a2724;

    --color-primary-light: #c75d3a;
    --color-secondary-light: #4a6741;
  }
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Layout Shell
   ========================================================================== */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Mobile: bottom nav */
.app-content {
  flex: 1;
  padding-bottom: var(--nav-height);
  overflow-y: auto;
}

/* Desktop: sidebar layout */
@media (min-width: 768px) {
  .app-shell {
    flex-direction: row;
  }

  .app-content {
    padding-bottom: 0;
    padding-left: var(--sidebar-width);
  }
}

/* ==========================================================================
   Navigation
   ========================================================================== */

/* Mobile bottom nav */
.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-warm-white);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--space-2);
  z-index: 100;
}

@media (min-width: 768px) {
  .nav-bottom {
    display: none;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: var(--space-2);
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-item:hover,
.nav-item:focus {
  color: var(--color-text);
  background: var(--color-cream-dark);
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.nav-item-label {
  font-size: var(--font-size-xs);
  margin-top: var(--space-1);
}

/* Desktop sidebar */
.nav-sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-warm-white);
  border-right: 1px solid var(--color-border);
  flex-direction: column;
  align-items: center;
  padding: var(--space-4) 0;
  z-index: 100;
}

@media (min-width: 768px) {
  .nav-sidebar {
    display: flex;
  }
}

.nav-sidebar .nav-item {
  width: 100%;
  padding: var(--space-3) var(--space-2);
}

.nav-logo {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-6);
  text-decoration: none;
}

/* ==========================================================================
   Page Structure
   ========================================================================== */

.page {
  padding: var(--content-padding);
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.page-header {
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  margin: 0 0 var(--space-2) 0;
  color: var(--color-text);
}

.page-subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
  margin: 0;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--color-warm-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card-link:hover .card {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Recipe card specific */
.recipe-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.recipe-card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin: 0;
  line-height: var(--line-height-tight);
}

.recipe-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.recipe-card-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.recipe-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ==========================================================================
   Tags / Badges
   ========================================================================== */

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-cream-dark);
  border-radius: var(--radius-full);
  text-transform: lowercase;
}

.tag-dietary {
  background: var(--color-secondary-light);
  color: white;
}

.tag-effort {
  background: var(--color-primary-light);
  color: white;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-target);
  padding: var(--space-3) var(--space-5);
  font-size: var(--font-size-base);
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-cream-dark);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-border);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-cream-dark);
  color: var(--color-text);
}

.btn-icon {
  padding: var(--space-2);
  min-width: var(--touch-target);
}

/* Floating action button */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-4));
  right: var(--space-4);
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  z-index: 50;
}

@media (min-width: 768px) {
  .fab {
    bottom: var(--space-6);
    right: var(--space-6);
  }
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-warm-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-textarea {
  min-height: 6rem;
  resize: vertical;
}

.form-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--color-error);
  margin-top: var(--space-1);
}

/* ==========================================================================
   Grid Layouts
   ========================================================================== */

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-cards {
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   Recipe Detail View
   ========================================================================== */

.recipe-header {
  margin-bottom: var(--space-6);
}

.recipe-title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  margin: 0 0 var(--space-3) 0;
  line-height: var(--line-height-tight);
}

.recipe-description {
  font-size: var(--font-size-lg);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-4) 0;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-6);
  padding: var(--space-4);
  background: var(--color-cream-dark);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.recipe-meta-item {
  display: flex;
  flex-direction: column;
}

.recipe-meta-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.recipe-meta-value {
  font-size: var(--font-size-lg);
  font-weight: 600;
}

/* Ingredients section */
.recipe-section {
  margin-bottom: var(--space-8);
}

.recipe-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.recipe-section-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin: 0;
}

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

.ingredient-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
  min-height: var(--touch-target);
}

.ingredient-item:last-child {
  border-bottom: none;
}

.ingredient-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
  accent-color: var(--color-primary);
}

.ingredient-quantity {
  font-weight: 600;
  min-width: 4rem;
}

.ingredient-name {
  flex: 1;
}

.ingredient-prep {
  color: var(--color-text-muted);
  font-style: italic;
}

.ingredient-item.checked {
  color: var(--color-checked);
  text-decoration: line-through;
}

/* Steps section */
.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step-counter;
}

.step-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.step-item:last-child {
  border-bottom: none;
}

.step-number {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: white;
  font-weight: 600;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-full);
}

.step-content {
  flex: 1;
  padding-top: var(--space-1);
}

.step-instruction {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
}

.step-timer {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background: var(--color-cream-dark);
  border-radius: var(--radius-md);
}

/* Active cooking step */
.step-item.active {
  background: var(--color-cream-dark);
  margin: 0 calc(var(--space-4) * -1);
  padding-left: var(--space-4);
  padding-right: var(--space-4);
  border-radius: var(--radius-lg);
}

.step-item.active .step-number {
  width: 2.5rem;
  height: 2.5rem;
  font-size: var(--font-size-base);
}

.step-item.active .step-instruction {
  font-size: var(--font-size-xl);
}

/* ==========================================================================
   Search and Filter
   ========================================================================== */

.search-bar {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.search-input {
  flex: 1;
  padding-left: var(--space-10);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b6560' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: var(--space-3) center;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background: var(--color-warm-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  border-color: var(--color-text-muted);
}

.filter-chip.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0 0 var(--space-2) 0;
}

.empty-state-text {
  color: var(--color-text-muted);
  margin: 0 0 var(--space-6) 0;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

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

.text-muted {
  color: var(--color-text-muted);
}

.text-center {
  text-align: center;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.hidden {
  display: none !important;
}

/* Turbo loading indicator */
.turbo-progress-bar {
  background-color: var(--color-primary);
}

/* Flash messages */
.flash {
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-md);
}

.flash-notice {
  background: var(--color-secondary-light);
  color: white;
}

.flash-alert {
  background: var(--color-error);
  color: white;
}

/* ==========================================================================
   Nested Form Fields
   ========================================================================== */

.nested-field {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  flex-wrap: wrap;
}

.nested-field .form-group {
  margin-bottom: 0;
}

.nested-fields-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Make ingredient row items wrap nicely on mobile */
@media (max-width: 640px) {
  .nested-field.ingredient-item {
    flex-wrap: wrap;
  }

  .nested-field.ingredient-item .form-group {
    flex: 1 1 calc(50% - var(--space-2)) !important;
    min-width: 0;
  }

  .nested-field.ingredient-item .form-group:has(select) {
    flex: 1 1 100% !important;
  }
}

/* Tag checkbox styling */
.filter-chips label {
  cursor: pointer;
}

.filter-chips label input[type="checkbox"] {
  display: none;
}

.filter-chips label.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* Datalist styling */
datalist {
  display: none;
}

/* ==========================================================================
   Modal Component
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  animation: fadeIn var(--transition-fast);
}

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

.modal {
  background: var(--color-cream);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 28rem;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--transition-normal);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4) 0;
  gap: var(--space-4);
}

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0;
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-4);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
  margin-top: var(--space-4);
}

/* Flash messages in modal */
#ingredient-modal-messages {
  padding: 0 var(--space-4);
}

#ingredient-modal-messages .flash {
  margin: var(--space-2) 0 0;
}

/* "Add new" option styling in selects */
.form-select option[value="new"] {
  font-weight: 600;
  color: var(--color-primary);
}

/* ==========================================================================
   AI Capture & Refine
   ========================================================================== */

.capture-box {
  max-width: 44rem;
}

.capture-input {
  min-height: 16rem;
  font-size: var(--font-size-base);
  line-height: 1.6;
}

.capture-hints {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-3);
}

.capture-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.capture-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  animation: fadeIn var(--transition-normal);
}

.capture-spinner {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: captureSpin 0.8s linear infinite;
}

@keyframes captureSpin {
  to { transform: rotate(360deg); }
}

.refine-row {
  display: flex;
  gap: var(--space-3);
  align-items: stretch;
}

.refine-input {
  flex: 1;
}

@media (max-width: 480px) {
  .refine-row {
    flex-direction: column;
  }
}

/* ==========================================================================
   Meal Plan
   ========================================================================== */

.week-nav {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.plan-week {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.plan-day {
  background: var(--color-warm-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.plan-day.today {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}

.plan-day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.plan-day-name {
  font-weight: 600;
  color: var(--color-text);
}

.plan-day-date {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.plan-meals {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.plan-meal {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--color-parchment);
  border-radius: var(--radius-sm);
}

.plan-meal-type {
  font-size: var(--font-size-xs, 0.75rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-light);
  flex-shrink: 0;
}

.plan-meal-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-meal-remove {
  background: none;
  border: none;
  color: var(--color-text-light);
  cursor: pointer;
  font-size: var(--font-size-base);
  line-height: 1;
  padding: var(--space-1);
}

.plan-meal-remove:hover {
  color: var(--color-error);
}

.plan-add-form {
  margin-top: auto;
}

.plan-add-row {
  display: flex;
  gap: var(--space-2);
}

.plan-add-select {
  flex: 1;
  min-width: 0;
}

.plan-add-meal-type {
  width: 7rem;
  flex-shrink: 0;
}

.btn-sm {
  min-height: var(--touch-target);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
}

.plan-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ==========================================================================
   Shopping Lists
   ========================================================================== */

.progress-track {
  height: 0.5rem;
  background: var(--color-cream-dark);
  border-radius: var(--radius-full, 999px);
  overflow: hidden;
  flex: 1;
}

.progress-fill {
  height: 100%;
  background: var(--color-secondary);
  border-radius: inherit;
  transition: width var(--transition-normal);
}

.shopping-progress {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.shopping-progress-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
}

.shopping-section {
  margin-bottom: var(--space-6);
}

.shopping-section-title {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

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

.shopping-item + .shopping-item {
  border-top: 1px solid var(--color-border-light);
}

.shopping-item-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-2) var(--space-1);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: var(--font-size-base);
  color: var(--color-text);
}

.shopping-item-box {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-warm-white);
  font-size: 0.9rem;
}

.shopping-item.checked .shopping-item-box {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
}

.shopping-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shopping-item.checked .shopping-item-name {
  text-decoration: line-through;
  color: var(--color-checked);
}

.shopping-item-notes {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
}

.shopping-add {
  margin-top: var(--space-6);
  max-width: 32rem;
}

.shopping-list-card-title {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-lg);
}

.shopping-list-card .progress-track {
  margin-top: var(--space-3);
}

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ==========================================================================
   Companion Chat
   ========================================================================== */

.chat-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 8rem);
  max-width: 46rem;
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
}

.chat-intro {
  background: var(--color-parchment);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.chat-intro-personas {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.chat-intro-persona {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.chat-intro-persona p {
  margin: 0;
  font-size: var(--font-size-sm);
}

.chat-intro-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.chat-persona-emoji {
  font-size: 1.3rem;
  line-height: 1;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: 85%;
}

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

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

.chat-speaker {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.chat-speaker-name {
  font-weight: 600;
}

.chat-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-warm-white);
  border: 1px solid var(--color-border-light);
  overflow-wrap: break-word;
}

.chat-bubble p:first-child { margin-top: 0; }
.chat-bubble p:last-child { margin-bottom: 0; }

.chat-message-user .chat-bubble {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.chat-event {
  align-self: center;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  background: var(--color-cream-dark);
  border-radius: var(--radius-full);
  padding: var(--space-1) var(--space-4);
}

.chat-typing {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  margin-left: var(--space-1);
}

.chat-typing-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--color-text-light);
  animation: chatTyping 1.2s infinite ease-in-out;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes chatTyping {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-0.2rem); }
}

.chat-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.chat-quick-prompt-form {
  display: inline-flex;
}

.chat-quick-prompt {
  cursor: pointer;
}

.chat-form-container {
  position: sticky;
  bottom: 0;
  background: var(--color-cream);
  padding: var(--space-3) 0;
}

.chat-input-row {
  display: flex;
  gap: var(--space-3);
}

.chat-input {
  flex: 1;
}
