@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
  --primary: #D4A5A5;
  --primary-light: #C48B8B;
  --primary-dark: #B37171;
  --accent: #9E5757;
  --accent-light: #FFF5F5;
  --danger: #E76F51;
  --danger-light: #F4A261;
  --bg: #F7F5F2;
  --bg-card: #FFFFFF;
  --bg-section: #EDE8E2;
  --text: #2D3436;
  --text-secondary: #636E72;
  --text-light: #B2BEC3;
  --border: #DDD8D2;
  --border-light: #EDE8E2;
  --shadow-sm: 0 1px 3px rgba(45, 52, 54, 0.06);
  --shadow-md: 0 4px 12px rgba(45, 52, 54, 0.08);
  --shadow-lg: 0 8px 24px rgba(45, 52, 54, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

::selection {
  background: var(--primary-light);
  color: white;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 80px;
}

.app-header {
  text-align: center;
  padding: 32px 0 16px;
}

.app-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
}

.app-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 300;
}

.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg-section);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
  position: sticky;
  top: 8px;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.tab-btn:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}

/* Recipe List */
.summary-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  animation: fadeInUp 0.4s ease both;
}

.summary-stat {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--primary);
}

.summary-number {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.summary-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInUp 0.4s ease 0.1s both;
}

.search-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

.sort-select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  min-width: 160px;
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary-light);
}

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

.recipe-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: box-shadow 0.2s, transform 0.2s;
  animation: fadeInUp 0.4s ease both;
}

.recipe-card:nth-child(1) { animation-delay: 0s; }
.recipe-card:nth-child(2) { animation-delay: 0.05s; }
.recipe-card:nth-child(3) { animation-delay: 0.1s; }
.recipe-card:nth-child(4) { animation-delay: 0.15s; }
.recipe-card:nth-child(5) { animation-delay: 0.2s; }
.recipe-card:nth-child(6) { animation-delay: 0.25s; }

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

.recipe-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.recipe-card-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.recipe-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-section);
  color: var(--text-secondary);
  white-space: nowrap;
}

.recipe-card-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.recipe-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

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

.stat-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  font-weight: 500;
  margin-bottom: 2px;
}

.stat-value {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.stat-value.cost {
  color: var(--primary);
}

.stat-value.serving {
  color: var(--accent);
}

.recipe-ingredients-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.ingredient-chip {
  font-size: 0.7rem;
  padding: 3px 10px;
  background: var(--bg);
  border-radius: 20px;
  color: var(--text-secondary);
  font-weight: 500;
}

.ingredient-chip.more {
  background: var(--border-light);
  color: var(--text-light);
  font-style: italic;
}

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

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--bg-section);
  color: var(--text);
}

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

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

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

/* Editor */
.editor-container {
  max-width: 720px;
  margin: 0 auto;
  animation: fadeInUp 0.4s ease both;
}

.editor-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-group-half {
  flex: 1;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.1);
}

.form-input.input-error {
  border-color: var(--danger);
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
}

.error-text {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
  display: block;
}

/* Ingredients Section */
.ingredients-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.ingredient-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border-light);
  animation: fadeInUp 0.3s ease both;
}

.ingredient-row:last-of-type {
  border-bottom: none;
}

.ingredient-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  align-items: center;
}

.ing-name {
  flex: 2;
  min-width: 120px;
}

.ing-qty {
  width: 70px;
  flex: none;
}

.ing-unit {
  width: 90px;
  flex: none;
}

.price-input-wrap {
  position: relative;
  width: 100px;
  flex: none;
}

.price-prefix {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.875rem;
  pointer-events: none;
}

.ing-price {
  padding-left: 24px;
}

.ing-subtotal {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 60px;
  text-align: right;
  padding-top: 10px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-top: 6px;
}

.btn-remove {
  background: transparent;
  color: var(--danger);
}

.btn-remove:hover:not(:disabled) {
  background: var(--danger);
  color: white;
}

.btn-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-add-ingredient {
  width: 100%;
  padding: 10px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-light);
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.btn-add-ingredient:hover {
  border-color: var(--primary-light);
  background: rgba(45, 106, 79, 0.04);
}

/* Cost Summary */
.cost-summary-card {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
  color: white;
}

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

.cost-label {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.9;
}

.cost-note {
  opacity: 0.7;
  font-size: 0.8rem;
}

.cost-amount {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
}

.cost-amount.total {
  font-size: 1.25rem;
}

.cost-amount.per-serving {
  font-size: 1.75rem;
}

.cost-summary-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
  margin: 12px 0;
}

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

.btn-save {
  padding: 14px 48px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* Comparison */
.comparison-container {
  animation: fadeInUp 0.4s ease both;
}

.comparison-picker {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.picker-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
}

.picker-note {
  font-weight: 400;
  color: var(--text-light);
  font-size: 0.8rem;
}

.picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.picker-chip {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 24px;
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.picker-chip:hover {
  border-color: var(--primary-light);
}

.picker-chip.selected {
  border-color: var(--primary);
  background: rgba(45, 106, 79, 0.08);
  color: var(--primary);
}

.chip-check {
  font-weight: 700;
}

.chip-cost {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-left: 2px;
}

.comparison-winner {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.winner-text {
  font-size: 0.9rem;
  color: var(--primary-dark);
  line-height: 1.5;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.comparison-column {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  animation: fadeInUp 0.4s ease both;
}

.comparison-column:nth-child(1) { animation-delay: 0s; }
.comparison-column:nth-child(2) { animation-delay: 0.05s; }
.comparison-column:nth-child(3) { animation-delay: 0.1s; }
.comparison-column:nth-child(4) { animation-delay: 0.15s; }

.compare-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.compare-bar-container {
  height: 8px;
  background: var(--bg-section);
  border-radius: 4px;
  margin: 12px 0;
  overflow: hidden;
}

.compare-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--primary));
  border-radius: 4px;
  transition: width 0.6s ease;
}

.compare-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.compare-stat {
  text-align: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.compare-stat.highlight {
  background: rgba(45, 106, 79, 0.08);
}

.compare-stat-value {
  display: block;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
}

.compare-stat.highlight .compare-stat-value {
  font-size: 1.2rem;
}

.compare-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  font-weight: 500;
}

.compare-ingredients {
  border-top: 1px dashed var(--border-light);
  padding-top: 12px;
}

.compare-ing-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 8px;
}

.compare-ing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.compare-ing-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 60px;
  flex-shrink: 0;
}

.compare-ing-bar-wrap {
  flex: 1;
  height: 4px;
  background: var(--bg-section);
  border-radius: 2px;
  overflow: hidden;
}

.compare-ing-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.compare-ing-cost {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  min-width: 45px;
  text-align: right;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  animation: fadeInUp 0.5s ease both;
}

.empty-state.small {
  padding: 32px 20px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 360px;
  margin: 0 auto;
}

/* Skeleton Loading */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.skeleton-card {
  height: 200px;
  background: linear-gradient(90deg, var(--bg-section) 25%, var(--bg) 50%, var(--bg-section) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: shimmer 1.5s infinite;
}

/* Toast */
.toast-confirm {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--danger);
  color: white;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: fadeInUp 0.3s ease both;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive */
@media (max-width: 640px) {
  .app-shell {
    padding: 0 12px 80px;
  }

  .app-title {
    font-size: 1.375rem;
  }

  .tab-btn {
    font-size: 0.775rem;
    padding: 9px 8px;
  }

  .summary-bar {
    flex-direction: column;
    gap: 8px;
  }

  .filter-bar {
    flex-direction: column;
  }

  .sort-select {
    min-width: unset;
  }

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

  .recipe-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .ingredient-fields {
    flex-direction: column;
  }

  .ing-name,
  .ing-qty,
  .ing-unit,
  .price-input-wrap {
    width: 100%;
    min-width: unset;
  }

  .ing-subtotal {
    text-align: left;
    padding-top: 0;
  }

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

  .cost-amount.per-serving {
    font-size: 1.4rem;
  }

  .btn-save {
    width: 100%;
  }
}

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to Recipe Cost Calculator! This app helps you track ingredient costs and calculate how much each serving of your recipes costs.", "view": "user", "highlight_selector": ".app-header", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Let's create your first recipe. Tap the '✚ New Recipe' tab to get started.", "view": "user", "highlight_selector": ".tab-btn:nth-child(2)", "wait_for": "user_interaction"},
  {"step": 3, "narration": "Fill in the recipe name, category, and number of servings. Then add each ingredient with its quantity, unit, and price per unit.", "view": "user", "highlight_selector": ".editor-container", "wait_for": "tap_to_continue"},
  {"step": 4, "narration": "As you add ingredients, the total cost and cost per serving update in real time in this green summary card.", "view": "user", "highlight_selector": ".cost-summary-card", "wait_for": "tap_to_continue"},
  {"step": 5, "narration": "Click 'Save Recipe' when done. Your recipe appears in the 'My Recipes' tab with a full cost breakdown.", "view": "user", "highlight_selector": ".btn-save", "wait_for": "user_interaction"},
  {"step": 6, "narration": "On the My Recipes tab, you can search, sort by cost, edit or delete recipes. The summary bar shows your total recipes and average cost per serving.", "view": "user", "highlight_selector": ".summary-bar", "wait_for": "tap_to_continue"},
  {"step": 7, "narration": "Once you have 2+ recipes, head to the '⚖ Compare' tab to see them side by side — with cost bars, per-serving prices, and ingredient breakdowns.", "view": "user", "highlight_selector": ".tab-btn:nth-child(3)", "wait_for": "user_interaction"}
]
-->

/* Auth */
.auth-gate {
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.auth-login-btn {
  margin-top: 16px;
}

.auth-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.auth-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.auth-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.auth-user-name {
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.2;
}

.auth-user-email {
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .auth-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-logout-btn {
    width: 100%;
  }
}

.ingredients-db-section {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.ingredient-price-form {
  margin-top: 12px;
  margin-bottom: 16px;
}

.ingredient-price-actions {
  margin-top: 8px;
}

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

.ingredient-price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.ingredient-price-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--bg);
}

.ingredient-price-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.ingredient-price-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.ingredient-price-meta,
.ingredient-price-notes,
.ingredients-refresh-note {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ingredient-price-amount {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
  white-space: nowrap;
}

.ingredients-refresh-note {
  margin: 8px 0 20px;
}

@media (max-width: 640px) {
  .ingredient-price-grid {
    grid-template-columns: 1fr;
  }
}

.viz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease both;
}

.chart-wrap {
  width: 100%;
  min-height: 280px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 280px !important;
}

.trend-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .trend-summary {
    flex-direction: column;
    gap: 4px;
  }

  .chart-wrap,
  .chart-wrap canvas {
    height: 240px !important;
    min-height: 240px;
  }
}

.ai-dish-section {
  margin-bottom: 20px;
}

.ai-dish-form {
  margin-top: 12px;
}

.ai-dish-input {
  min-height: 110px;
  resize: vertical;
}

.ai-dish-actions {
  margin-top: 10px;
  flex-wrap: wrap;
}

.ai-dish-result {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border-light);
}

.ai-dish-result-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.ai-dish-result-header h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.ai-dish-result-header span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.ai-dish-result-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
}

.ai-dish-ingredients {
  display: grid;
  gap: 8px;
}

.ai-dish-ingredient-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
}

.ai-ing-name {
  font-weight: 600;
  color: var(--text);
}

.ai-ing-meta,
.ai-ing-cost {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
}

.ai-ing-cost {
  font-weight: 700;
  color: var(--primary);
}

.ai-description {
  background: rgba(45, 106, 79, 0.06);
  border-left: 3px solid var(--primary-light);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.ai-dish-applied-note {
  margin: 10px 0 20px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(212, 163, 115, 0.14);
  color: var(--primary-dark);
  font-size: 0.85rem;
  border: 1px solid rgba(212, 163, 115, 0.35);
}

@media (max-width: 640px) {
  .ai-dish-ingredient-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .ai-ing-meta,
  .ai-ing-cost {
    text-align: left;
  }
}

.recipe-card-actions {
  flex-wrap: wrap;
}

.recipe-cost-sheet-wrap {
  margin-top: 16px;
  margin-bottom: 20px;
}

.recipe-cost-sheet-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.recipe-cost-sheet {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.recipe-cost-sheet-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.recipe-cost-sheet-header h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--primary-dark);
  font-size: 1.35rem;
  margin: 0;
}

.recipe-cost-sheet-subtitle {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.recipe-cost-sheet-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
}

.recipe-cost-sheet-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.recipe-cost-sheet-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.recipe-cost-sheet-summary div {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.recipe-cost-sheet-summary span {
  display: block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.recipe-cost-sheet-summary strong {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  color: var(--primary-dark);
}

.recipe-cost-sheet-section h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1rem;
  color: var(--primary-dark);
  margin-bottom: 10px;
}

.recipe-cost-sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.recipe-cost-sheet-table th,
.recipe-cost-sheet-table td {
  border-top: 1px solid var(--border-light);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}

.recipe-cost-sheet-table th {
  color: var(--text-secondary);
  font-weight: 700;
  background: var(--bg-section);
}

.recipe-grid-cost-sheet-preview {
  display: none;
}

@media (max-width: 640px) {
  .recipe-cost-sheet-header,
  .recipe-cost-sheet-summary {
    grid-template-columns: 1fr;
    display: grid;
  }

  .recipe-cost-sheet-meta {
    text-align: left;
  }

  .recipe-cost-sheet-summary {
    grid-template-columns: 1fr 1fr;
  }

  .recipe-cost-sheet-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

.share-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  z-index: 120;
  animation: fadeInUp 0.25s ease both;
}

.share-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.share-panel-header h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.share-panel-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.share-panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.share-panel-field {
  margin-bottom: 12px;
}

.share-panel-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.share-panel-textarea {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
}

.share-panel-copied {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 640px) {
  .share-panel {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 12px;
  }

  .share-panel-actions {
    flex-direction: column;
  }

  .share-panel-actions .btn {
    width: 100%;
  }
}
