/* ==========================================================================
   Loftia Codex Design System - Cooking Calculator
   Styles carefully matched to https://loftiacodex.com/
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:ital,wght@0,400;0,600;0,700;0,800;1,400;1,600&display=swap');

@font-face {
  font-family: "Nunito Variable";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("./fonts/nunito-latin-wght-normal.woff2") format("woff2-variations");
}

@font-face {
  font-family: "Fredoka Variable";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("./fonts/fredoka-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  /* Loftia Codex Official Palette */
  --bg: #ece5cc;
  --panel: #fffdf6;
  --panel-2: #f4eedb;
  --panel-mint: #d4efe4;
  --panel-mint-strong: #aac4a4;
  --mint-body: #e2f2eb;
  --mint-line: #d3e9df;
  --border: #dcd3b4;
  --border-soft: #ece5ca;
  --border-focus: #237a68;
  
  /* Text & Ink */
  --text: #324337;
  --text-strong: #23463a;
  --ink: #1d3c32;
  --muted: #5e776a;
  --faint: #8a9e92;
  
  /* Brand Accents */
  --accent: #3f6f60;
  --accent-2: #98d4a8;
  --leaf: #508372;
  --leaf-green: #7ca844;
  --teal: #237a68;
  --teal-deep: #1b5f51;
  --teal-bright: #4fd0b8;
  --teal-tint: #eaf8f4;
  
  /* Highlights & Gamified Statuses */
  --here: #d46f24;
  --here-wash: #fff1e3;
  --here-ink: #9a4b10;
  --danger: #cf4338;
  --danger-wash: #fdf0ee;
  --quest: #6f4fb8;
  --quest-wash: #efe9fa;
  --gold: #b37e1b;
  --gold-wash: #fff8e6;

  /* Tactile Gaming Shadows */
  --shadow-sm: 0 2px 0 rgba(35, 70, 58, 0.08);
  --shadow: 0 3px 0 rgba(35, 70, 58, 0.10);
  --shadow-raised: 0 3px 0 rgba(35, 70, 58, 0.12), 0 0 0 1px rgba(35, 70, 58, 0.04);
  --shadow-pop: 0 4px 0 rgba(35, 70, 58, 0.12), 0 0 0 1px rgba(35, 70, 58, 0.05);
  --shadow-pressed: 0 1px 0 rgba(35, 70, 58, 0.14);

  /* Geometry */
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;

  /* Typography */
  --font-body: "Nunito Variable", "Nunito", ui-rounded, system-ui, -apple-system, sans-serif;
  --font-display: "Fredoka Variable", "Fredoka", "Nunito Variable", ui-rounded, system-ui, sans-serif;

  /* Codex Dot Grid */
  --dots: radial-gradient(circle, rgba(80, 131, 114, 0.18) 1.2px, transparent 1.6px);
  --header-h: 68px;
}

/* Base Reset & Background */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image: var(--dots);
  background-size: 20px 20px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Typography Helpers */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  margin-top: 0;
  line-height: 1.25;
}

a {
  color: var(--teal);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

/* ==========================================================================
   Header & Navbar (Codex Style)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--panel);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 8px rgba(35, 70, 58, 0.05);
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--panel-mint);
  border: 1px solid var(--panel-mint-strong);
  padding: 2px;
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}

.brand-word {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand-sub {
  color: var(--teal);
}

.app-pill {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--panel-mint);
  color: var(--teal-deep);
  border: 1px solid var(--accent-2);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-status-pill {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  transition: all 0.2s ease;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(35, 122, 104, 0.2);
  transition: background 0.2s ease;
}

.save-status-pill.saving .save-dot {
  background: var(--here);
  box-shadow: 0 0 0 2px rgba(212, 111, 36, 0.2);
}

/* ==========================================================================
   Tactile Gaming Buttons
   ========================================================================== */
.btn {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.12s ease;
  user-select: none;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal-deep);
  box-shadow: var(--shadow);
}
.btn-primary:hover {
  background: #2a8a76;
}
.btn-primary:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-pressed);
}

.btn-mint {
  background: var(--panel-mint);
  color: var(--teal-deep);
  border-color: var(--accent-2);
  box-shadow: var(--shadow-sm);
}
.btn-mint:hover {
  background: #c3e9da;
}
.btn-mint:active {
  transform: translateY(1px);
}

.btn-subtle {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-subtle:hover {
  background: var(--panel-2);
  border-color: var(--border-focus);
}
.btn-subtle:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-pressed);
}

.btn-danger {
  background: var(--danger-wash);
  color: var(--danger);
  border-color: #f1b5b0;
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover {
  background: #fbdad6;
}

/* ==========================================================================
   Hero Financial Summary Dashboard
   ========================================================================== */
.hero-dashboard {
  background: var(--panel);
  border-bottom: 2px solid var(--border);
  padding: 18px 0;
  box-shadow: 0 4px 12px rgba(35, 70, 58, 0.04);
}

.dashboard-container {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
}

.dashboard-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-title-group h2 {
  font-size: 1.35rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboard-tagline {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 2px;
}

.presets-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.preset-chip {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--text-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4px 11px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 0 rgba(35, 70, 58, 0.05);
}
.preset-chip:hover {
  background: var(--panel-mint);
  border-color: var(--teal);
  color: var(--teal-deep);
  transform: translateY(-1px);
}
.preset-chip:active {
  transform: translateY(1px);
}

/* Stats Cards Grid */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
}

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

.stat-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.stat-sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 4px;
}

/* Stat card variants */
.stat-card.profit-positive {
  background: linear-gradient(145deg, #d8f5ea, var(--panel-mint));
  border-color: #8be0c6;
}
.stat-card.profit-positive .stat-value {
  color: var(--teal-deep);
}
.stat-card.profit-positive .stat-label {
  color: var(--teal);
}

.stat-card.profit-negative {
  background: var(--danger-wash);
  border-color: #f1b5b0;
}
.stat-card.profit-negative .stat-value {
  color: var(--danger);
}

.stat-card.cost-card {
  background: linear-gradient(145deg, #fff7eb, #f9ede0);
  border-color: #e5cbaf;
}
.stat-card.cost-card .stat-value {
  color: var(--here-ink);
}

.stat-card.revenue-card {
  background: linear-gradient(145deg, #f7fdf9, #e9f6ef);
  border-color: #bfe5d4;
}

.stat-card.energy-card {
  background: linear-gradient(145deg, #fffcf0, #faf3dc);
  border-color: #ecdca5;
}
.stat-card.energy-card .stat-value {
  color: #8b6b15;
}

/* ==========================================================================
   Main Workspace Layout
   ========================================================================== */
.main-workspace {
  max-width: 1360px;
  margin: 20px auto 40px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
  align-items: start;
}

/* ==========================================================================
   Panel Container (Codex Style)
   ========================================================================== */
.codex-panel {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-raised);
  overflow: hidden;
}

.panel-header {
  background: var(--panel-2);
  border-bottom: 1.5px solid var(--border);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 18px;
}

/* ==========================================================================
   Left Column: Recipe Explorer & Controls
   ========================================================================== */
.controls-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

/* Search Bar (Codex style) */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 38px;
  color: var(--ink);
  outline: none;
  transition: all 0.15s ease;
}
.search-input:focus {
  background: #fff;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(35, 122, 104, 0.15);
}

.search-icon-svg {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  fill: var(--muted);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  display: none;
}
.search-clear.visible {
  display: block;
}

/* Filter Tags & Sorters */
.filters-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.filter-pill:hover {
  border-color: var(--teal);
  color: var(--ink);
}
.filter-pill.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal-deep);
  box-shadow: 0 2px 0 rgba(35, 70, 58, 0.15);
}

.sort-select {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--text-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  cursor: pointer;
  outline: none;
}
.sort-select:focus {
  border-color: var(--teal);
}

/* Recipe Grid */
.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
  max-height: 800px;
  overflow-y: auto;
  padding-right: 4px;
}

/* Custom Scrollbar */
.recipes-grid::-webkit-scrollbar,
.scroll-area::-webkit-scrollbar {
  width: 8px;
}
.recipes-grid::-webkit-scrollbar-track,
.scroll-area::-webkit-scrollbar-track {
  background: var(--panel-2);
  border-radius: 4px;
}
.recipes-grid::-webkit-scrollbar-thumb,
.scroll-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.recipes-grid::-webkit-scrollbar-thumb:hover,
.scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Recipe Card */
.recipe-card {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  position: relative;
}

.recipe-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: var(--shadow-raised);
}

.recipe-card.in-queue {
  border-color: var(--teal);
  background: linear-gradient(180deg, #fffdf8, #f5fcf9);
}

.recipe-card-top {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.recipe-icon-box {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(35, 70, 58, 0.06);
}

.recipe-icon-box img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

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

.recipe-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-meta-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Badges */
.badge-tag {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-lv1 {
  background: #eaf4d3;
  color: #4f6e1f;
  border: 1px solid #c7e099;
}

.badge-lv2 {
  background: var(--panel-mint);
  color: var(--teal-deep);
  border: 1px solid var(--accent-2);
}

.badge-lv3 {
  background: var(--quest-wash);
  color: var(--quest);
  border: 1px solid #d4c2f5;
}

.badge-energy {
  background: #fff6db;
  color: #8b6807;
  border: 1px solid #f2dd99;
}

.badge-energy img {
  width: 12px;
  height: 12px;
}

.recipe-desc {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

/* Required Ingredients Mini Pill List */
.recipe-ingredients-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  border: 1px solid var(--border-soft);
}

.ing-mini-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-strong);
  background: #fff;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 6px;
}

.ing-mini-pill img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

/* Recipe Financial Stats Footer */
.recipe-financials {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fbf9f1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-bottom: 10px;
}

.fin-item {
  display: flex;
  flex-direction: column;
}

.fin-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.fin-val {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.fin-val img {
  width: 14px;
  height: 14px;
}

.val-sell { color: var(--ink); }
.val-cost { color: var(--here-ink); }
.val-profit { color: var(--teal-deep); }

/* Card Actions / Stepper */
.recipe-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.recipe-stepper {
  display: flex;
  align-items: center;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.step-btn {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease;
}
.step-btn:hover {
  background: var(--border);
}
.step-btn:active {
  background: var(--panel-mint-strong);
}

.step-input {
  width: 44px;
  height: 32px;
  text-align: center;
  border: none;
  background: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  outline: none;
  -moz-appearance: textfield;
}
.step-input::-webkit-outer-spin-button,
.step-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.quick-add-group {
  display: flex;
  gap: 4px;
}

/* ==========================================================================
   Right Column: Planner & Shopping List
   ========================================================================== */
.planner-panel {
  display: flex;
  flex-direction: column;
}

/* Custom Tabs in Planner Header */
.tab-switcher {
  display: flex;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.tab-btn {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  background: none;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover {
  color: var(--ink);
}
.tab-btn.active {
  background: var(--panel);
  color: var(--teal-deep);
  box-shadow: 0 2px 4px rgba(35, 70, 58, 0.08);
}

.tab-badge {
  background: var(--panel-mint);
  color: var(--teal-deep);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.tab-btn.active .tab-badge {
  background: var(--teal);
  color: #fff;
}

/* Tab Content Areas */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  opacity: 0.75;
}

.empty-state h3 {
  font-size: 1.15rem;
  color: var(--text-strong);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.88rem;
  max-width: 300px;
  margin: 0 auto 16px;
}

/* Queue List */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.queue-item {
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}
.queue-item:hover {
  border-color: var(--border-focus);
}

.queue-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.queue-item-art {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.queue-item-art img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.queue-item-details {
  min-width: 0;
}

.queue-item-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-sub {
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.queue-financials {
  text-align: right;
  min-width: 70px;
}

.q-profit {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--teal-deep);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}
.q-profit img {
  width: 14px;
  height: 14px;
}

.q-sell {
  font-size: 0.72rem;
  color: var(--muted);
}

.remove-item-btn {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.12s ease;
}
.remove-item-btn:hover {
  color: var(--danger);
  background: var(--danger-wash);
}

/* ==========================================================================
   Ingredients & Shopping List Breakdown Tab
   ========================================================================== */
.ingredients-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.ing-summary-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-strong);
}

.ing-toggle-group {
  display: flex;
  gap: 6px;
}

.ingredients-table-wrap {
  max-height: 520px;
  overflow-y: auto;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
}

.ing-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  font-size: 0.85rem;
}

.ing-table th {
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.ing-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.ing-table tr:hover td {
  background: #fdfaf0;
}

.ing-table tr.all-owned td {
  background: #f4faf6;
}

.ing-cell-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ing-cell-img {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  object-fit: contain;
  padding: 1px;
}

.ing-source-tag {
  font-size: 0.7rem;
  color: var(--muted);
}

.ing-qty-badge {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
}

/* Owned Input in Table */
.owned-input {
  width: 48px;
  padding: 4px 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.owned-input:focus {
  border-color: var(--teal);
}

.cost-editable {
  width: 48px;
  padding: 4px 6px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--here-ink);
  outline: none;
}

.line-cost {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--here-ink);
  display: flex;
  align-items: center;
  gap: 3px;
}
.line-cost img {
  width: 14px;
  height: 14px;
}

.line-cost.free {
  color: var(--teal);
}

/* ==========================================================================
   Export / Share Modal & Drawer
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 60, 50, 0.45);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(29, 60, 50, 0.25);
  width: 100%;
  max-width: 580px;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal-dialog {
  transform: translateY(0);
}

.modal-header {
  background: var(--panel-2);
  border-bottom: 1.5px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.modal-close-btn:hover {
  background: var(--border);
  color: var(--ink);
}

.modal-body {
  padding: 20px;
}

.modal-textarea {
  width: 100%;
  height: 240px;
  font-family: monospace;
  font-size: 0.85rem;
  padding: 12px;
  background: var(--panel-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--ink);
  resize: vertical;
  outline: none;
}

.modal-footer {
  background: var(--panel-2);
  border-top: 1.5px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--teal-deep);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 300;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s ease;
}
.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1100px) {
  .stat-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .main-workspace {
    grid-template-columns: 1fr;
  }
  .recipes-grid {
    max-height: 540px;
  }
}

@media (max-width: 720px) {
  :root {
    --header-h: 58px;
  }
  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat-card:first-child {
    grid-column: span 2;
  }
  .header-actions .btn span {
    display: none;
  }
  .presets-container {
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .recipes-grid {
    grid-template-columns: 1fr;
  }
}

