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

:root {
  /* ===== Warm Harvest palette — warm, earthy, food-oriented (light) ===== */
  --bg-primary: #FBF3E6;                       /* warm cream page background */
  --bg-surface: #FFFFFF;                        /* card / panel surface */
  --bg-glass: #FFFFFF;                          /* solid white panels */
  --bg-glass-hover: #F6ECDB;                    /* warm hover tint */
  --border-glass: rgba(56, 44, 38, 0.10);      /* soft cocoa border */
  --border-glass-glow: rgba(197, 86, 47, 0.30);/* terracotta focus glow */

  --color-text: #382C26;                        /* deep cocoa text */
  --color-text-muted: #8A7A6C;                  /* warm taupe */

  --accent-primary: #C5562F;   /* Paprika / Terracotta */
  --accent-secondary: #6E8B3D; /* Olive Herb */
  --accent-tertiary: #2E8B6B;  /* Avocado Green */
  --accent-coral: #B23A48;     /* Cranberry */
  --accent-gold: #E3A02A;      /* Turmeric */

  --grad-accent: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-gold) 100%);
  --grad-success: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-tertiary) 100%);
  --grad-danger: linear-gradient(135deg, var(--accent-coral) 0%, var(--accent-primary) 100%);

  --shadow-main: 0 6px 22px 0 rgba(56, 44, 38, 0.10);
  --font-title: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--color-text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
}

/* Background glowing orbs — fixed so their off-screen corners never extend
   the document and create phantom scroll space below the app */
body::before, body::after {
  content: "";
  position: fixed;
  width: 40vw;
  height: 40vw;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}

body::before {
  top: -10vw;
  left: -10vw;
  background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
}

body::after {
  bottom: -10vw;
  right: -10vw;
  background: radial-gradient(circle, var(--accent-tertiary) 0%, transparent 70%);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(56, 44, 38, 0.06);
}

::-webkit-scrollbar-thumb {
  background: rgba(197, 86, 47, 0.22);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(197, 86, 47, 0.42);
}

/* Layout Container */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-glass);
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--grad-accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  font-family: var(--font-title);
  box-shadow: 0 4px 15px rgba(197, 86, 47, 0.42);
}

.brand-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.5px;
}

.brand-name span {
  background: linear-gradient(135deg, #C5562F, #E3A02A);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  width: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  cursor: pointer;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform 0.3s;
}

.nav-link:hover {
  color: var(--color-text);
  background: var(--bg-glass-hover);
  border-color: rgba(56, 44, 38, 0.05);
}

.nav-link:hover svg {
  transform: translateX(3px);
}

.nav-link.active {
  color: var(--color-text);
  background: rgba(197, 86, 47, 0.14);
  border-color: var(--border-glass-glow);
  box-shadow: 0 0 15px rgba(197, 86, 47, 0.10);
  font-weight: 600;
}

.nav-link.active svg {
  stroke: var(--accent-secondary);
}

.sidebar-footer {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-glass);
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border-glass-glow);
  border: 1.5px solid var(--accent-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.profile-details {
  display: flex;
  flex-direction: column;
}

.profile-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.profile-region {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Main Content Area */
.main-viewport {
  flex-grow: 1;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 2.5rem 3rem;
  position: relative;
}

.view-section {
  max-width: 1200px;
  margin: 0 auto;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.view-section.hidden {
  display: none;
  opacity: 0;
}

/* Page Header */
.view-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
}

.view-title-wrap h1 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 2.2rem;
  letter-spacing: -0.5px;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, #382C26 30%, #8A7A6C 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.view-description {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* Glass Cards */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow-main);
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.glass-card:hover {
  border-color: var(--border-glass-glow);
  box-shadow: 0 10px 40px rgba(56, 44, 38, 0.12);
}

/* Form Styling */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--color-text-muted);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(56, 44, 38, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(197, 86, 47, 0.30);
  background: rgba(56, 44, 38, 0.05);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.95rem;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Button Styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: 0 4px 15px rgba(197, 86, 47, 0.30);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(197, 86, 47, 0.45);
}

.btn-secondary {
  background: rgba(56, 44, 38, 0.06);
  border-color: var(--border-glass);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: rgba(56, 44, 38, 0.10);
  border-color: rgba(56, 44, 38, 0.15);
}

.btn-danger {
  background: var(--grad-danger);
  color: #fff;
  box-shadow: 0 4px 15px rgba(178, 58, 72, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(178, 58, 72, 0.4);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* Dashboard Widgets */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.dashboard-row-full {
  grid-column: 1 / span 2;
}

.metrics-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.metric-icon.blue { background: rgba(110, 139, 61, 0.16); color: var(--accent-secondary); border: 1.5px solid rgba(110, 139, 61, 0.32); }
.metric-icon.teal { background: rgba(46, 139, 107, 0.16); color: var(--accent-tertiary); border: 1.5px solid rgba(46, 139, 107, 0.32); }
.metric-icon.gold { background: rgba(227, 160, 42, 0.18); color: var(--accent-gold); border: 1.5px solid rgba(227, 160, 42, 0.35); }
.metric-icon.indigo { background: rgba(197, 86, 47, 0.14); color: var(--accent-primary); border: 1.5px solid rgba(197, 86, 47, 0.30); }

.metric-info {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-title);
  margin-top: 0.1rem;
}

/* Custom CSS Radial Gauge */
.budget-gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
}

.gauge-chart {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  /* conic gradient driven by --percent inline custom property */
  background: conic-gradient(
    var(--gauge-color, var(--accent-primary)) calc(var(--percent, 0) * 1%),
    rgba(56, 44, 38, 0.06) 0
  );
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  box-shadow: inset 0 0 15px rgba(56, 44, 38, 0.12);
}

.gauge-chart::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid var(--border-glass);
}

.gauge-center-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.gauge-value {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.8rem;
}

.gauge-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-top: 0.15rem;
}

.gauge-status-badge {
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.badge-success { background: rgba(46, 139, 107, 0.16); color: #2E8B6B; border: 1px solid rgba(46, 139, 107, 0.32); }
.badge-warning { background: rgba(227, 160, 42, 0.18); color: #A06A12; border: 1px solid rgba(227, 160, 42, 0.35); }
.badge-danger { background: rgba(178, 58, 72, 0.14); color: #B23A48; border: 1px solid rgba(178, 58, 72, 0.3); }

/* Quick Insights Box */
.insights-box {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

.insight-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem;
  background: rgba(56, 44, 38, 0.035);
  border-left: 3px solid var(--accent-secondary);
  border-radius: 0 10px 10px 0;
  font-size: 0.85rem;
  line-height: 1.4;
}

.insight-item.warning { border-left-color: var(--accent-gold); }
.insight-item.danger { border-left-color: var(--accent-coral); }
.insight-item.success { border-left-color: var(--accent-tertiary); }

/* Family Profile Elements */
.profile-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
}

.members-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.member-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(56, 44, 38, 0.035);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  transition: all 0.3s;
}

.member-item-card:hover {
  background: rgba(56, 44, 38, 0.05);
  border-color: rgba(56, 44, 38, 0.10);
}

.member-avatar {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--grad-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.member-card-info {
  flex-grow: 1;
  margin-left: 1rem;
}

.member-card-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.member-card-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

/* 7-Day Meal Planner Grid */
.planner-grid-7day {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  margin-top: 1rem;
}

.planner-day-col {
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.day-col-header {
  text-align: center;
  padding: 0.5rem;
  background: rgba(56, 44, 38, 0.05);
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--border-glass);
}

.meal-slot-card {
  background: rgba(56, 44, 38, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 0.75rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 110px;
  cursor: pointer;
  transition: all 0.3s;
}

.meal-slot-card:hover {
  border-color: var(--accent-secondary);
  background: rgba(56, 44, 38, 0.05);
  transform: translateY(-2px);
}

.meal-slot-tag {
  font-size: 0.65rem;
  color: var(--accent-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.meal-slot-title {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  /* limit to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meal-slot-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  border-top: 1px solid rgba(56, 44, 38, 0.05);
  padding-top: 0.4rem;
}

.meal-slot-price {
  font-weight: 600;
  color: var(--accent-tertiary);
}

/* Nutrition Analytics Page */
.nutrition-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.nutrition-bars-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.nut-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nut-bar-label-wrap {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
}

.nut-bar-label {
  color: var(--color-text);
}

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

.nut-bar-outer {
  height: 10px;
  background: rgba(56, 44, 38, 0.06);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.nut-bar-inner {
  height: 100%;
  background: var(--bar-gradient, var(--grad-accent));
  border-radius: 5px;
  width: calc(var(--percent, 0) * 1%);
  max-width: 100%;
  transition: width 0.6s ease;
}

/* Price Explorer / Seasonal Guide Grid */
.explorer-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.explorer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.5rem;
}

.food-item-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.food-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.food-category-tag {
  font-size: 0.7rem;
  background: rgba(56, 44, 38, 0.06);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  color: var(--color-text-muted);
}

.food-card-title {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.food-card-nutrition {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.food-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(56, 44, 38, 0.05);
  padding-top: 0.75rem;
}

.food-price-wrap {
  display: flex;
  flex-direction: column;
}

.food-price-label {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.food-price-val {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-tertiary);
}

.food-trend-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.trend-down { background: rgba(46, 139, 107, 0.12); color: #2E8B6B; }
.trend-up { background: rgba(178, 58, 72, 0.12); color: #B23A48; }
.trend-flat { background: rgba(56, 44, 38, 0.05); color: var(--color-text-muted); }

/* Shopping List */
.shopping-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
}

.shopping-actions {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.shopping-list-categories {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.shopping-cat-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shopping-cat-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1.5px solid rgba(56, 44, 38, 0.05);
  padding-bottom: 0.35rem;
}

.shopping-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: rgba(56, 44, 38, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  transition: all 0.2s;
}

.shopping-list-item:hover {
  background: rgba(56, 44, 38, 0.05);
}

.shopping-item-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.shopping-item-name {
  font-size: 0.9rem;
  transition: all 0.2s;
}

.shopping-list-item.checked {
  opacity: 0.45;
  border-color: rgba(56, 44, 38, 0.03);
}

.shopping-list-item.checked .shopping-item-name {
  text-decoration: line-through;
}

.shopping-item-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.shopping-item-qty {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.shopping-item-cost {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-tertiary);
  min-width: 60px;
  text-align: right;
}

/* Modals and Dialog Styles */
dialog {
  margin: auto;
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  background: #FFFFFF;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px rgba(56, 44, 38, 0.16);
  color: var(--color-text);
  padding: 2rem;
  width: 90%;
  max-width: 550px;
  outline: none;
}

/* Styles dialog backdrop */
dialog::backdrop {
  background-color: rgba(3, 7, 18, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdropFade 0.3s ease;
}

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

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 0.75rem;
}

.dialog-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.4rem;
}

.dialog-close-btn {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transition: all 0.2s;
}

.dialog-close-btn:hover {
  color: var(--color-text);
  background: rgba(56, 44, 38, 0.05);
}

/* Recipe Dialog Specifics */
.recipe-dialog-body {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.recipe-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.recipe-meta-item {
  background: rgba(56, 44, 38, 0.035);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}

.recipe-meta-label {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.recipe-meta-value {
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

.recipe-section-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 1.25rem 0 0.5rem 0;
  color: var(--accent-secondary);
}

.recipe-ingredients-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.recipe-ing-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.25rem 0;
  border-bottom: 1px dashed rgba(56, 44, 38, 0.05);
}

.recipe-instructions-ol {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Alternatives Dialog Specifics */
.swap-options-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.swap-option-card {
  background: rgba(56, 44, 38, 0.03);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.swap-option-card:hover {
  border-color: var(--accent-tertiary);
  background: rgba(56, 44, 38, 0.05);
}

.swap-card-left {
  flex-grow: 1;
}

.swap-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.swap-card-desc {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.swap-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  margin-left: 1rem;
}

.swap-card-price {
  font-weight: 700;
  color: var(--accent-tertiary);
  font-size: 1rem;
}

/* Utilities */
.text-center { text-align: center; }
.mt-3 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .dashboard-grid, .profile-layout, .nutrition-dashboard, .shopping-layout {
    grid-template-columns: 1fr;
  }
  .dashboard-row-full {
    grid-column: 1;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-glass);
    padding: 1rem 1.5rem;
  }
  .brand {
    margin-bottom: 1rem;
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    gap: 0.5rem;
  }
  .nav-link {
    white-space: nowrap;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
  }
  .sidebar-footer {
    display: none;
  }
  .main-viewport {
    padding: 1.5rem;
  }
  .view-title-wrap h1 {
    font-size: 1.8rem;
  }
}

/* Loading Screen Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(251, 243, 230, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

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

.loading-animation {
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-animation svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Once the Lottie has painted its first frame, retire the fallback spinner */
.loading-animation.is-ready .spinner {
  display: none;
}

/*
  Hold the fallback spinner back for a beat. The Lottie normally paints well
  inside this window, so the spinner never shows at all and there is no visible
  swap on reload. If the library or the JSON genuinely fails, it fades in and
  still tells the user something is happening.
*/
.loading-animation .spinner {
  opacity: 0;
  animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite,
             loader-fallback-in 0.3s ease 0.9s forwards;
}

@keyframes loader-fallback-in {
  to {
    opacity: 1;
  }
}

/* Reduced motion never loads the Lottie, so the spinner is all there is */
@media (prefers-reduced-motion: reduce) {
  .loading-animation .spinner {
    opacity: 1;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  }
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(56, 44, 38, 0.05);
  border-top-color: var(--accent-secondary);
  border-right-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

/* StudentBite Recipe Tags */
.recipe-tag {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.recipe-tag.budget_saver {
  background: rgba(46, 139, 107, 0.14);
  color: #2E8B6B;
  border: 1px solid rgba(46, 139, 107, 0.28);
}
.recipe-tag.quick_easy {
  background: rgba(227, 160, 42, 0.16);
  color: #A06A12;
  border: 1px solid rgba(227, 160, 42, 0.3);
}
.recipe-tag.treat {
  background: rgba(178, 58, 72, 0.12);
  color: #B23A48;
  border: 1px solid rgba(178, 58, 72, 0.28);
}

.meal-slot-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  width: 100%;
}

/* Login Screen Styling */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(197, 86, 47, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 85% 85%, rgba(46, 139, 107, 0.16) 0%, transparent 50%);
  z-index: 5000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2.5rem 1rem 4rem 1rem;
  box-sizing: border-box;
}

.login-card {
  width: 100%;
  max-width: 480px;
  margin-top: auto;
  margin-bottom: auto;
  flex-shrink: 0;
  padding: 2.5rem 2.25rem;
  border-radius: 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: loginCardFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-body);
}

.auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.15);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-glass);
}

.auth-tab-btn {
  flex: 1;
  padding: 0.65rem 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.auth-tab-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
}

.auth-tab-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(197, 86, 47, 0.35);
}

.auth-switch-link {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-family: var(--font-body);
  transition: opacity 0.2s ease;
}

.auth-switch-link:hover {
  opacity: 0.8;
}

.demo-users-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 140px;
  overflow-y: auto;
  padding: 0.65rem;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  scrollbar-width: thin;
}

.demo-user-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--color-text-muted);
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: monospace;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.demo-user-badge:hover {
  background: rgba(197, 86, 47, 0.16);
  border-color: var(--accent-primary);
  color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(197, 86, 47, 0.2);
}

#btn-instant-demo:hover {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
  transform: translateY(-1px);
}

/* Sidebar log out hover state */
.signout-btn:hover {
  color: var(--accent-coral) !important;
  transform: scale(1.1);
}

/* =========================================================
   Auto-sync Toast Notification
   ========================================================= */
.sync-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1.4rem;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid rgba(56, 44, 38, 0.15);
  box-shadow: 0 12px 36px rgba(56, 44, 38, 0.18), 0 0 0 1px rgba(56, 44, 38, 0.08);
  font-size: 0.9rem;
  font-weight: 600;
  color: #241A15;
  min-width: 280px;
  max-width: 440px;
  opacity: 0;
  transform: translateY(1.5rem) scale(0.96);
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.4,0,0.2,1),
              transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.sync-toast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sync-toast.toast-syncing {
  border-color: var(--accent-primary);
  background: #FFFBF5;
  color: #241A15;
  box-shadow: 0 12px 36px rgba(197, 86, 47, 0.22), 0 0 0 1px rgba(197, 86, 47, 0.25);
}

.sync-toast.toast-success {
  border-color: #2E8B6B;
  background: #F0FAF5;
  color: #114232;
  box-shadow: 0 12px 36px rgba(46, 139, 107, 0.22), 0 0 0 1px rgba(46, 139, 107, 0.3);
}

.sync-toast.toast-error {
  border-color: #B23A48;
  background: #FDF2F4;
  color: #5C151E;
  box-shadow: 0 12px 36px rgba(178, 58, 72, 0.22), 0 0 0 1px rgba(178, 58, 72, 0.3);
}

#sync-toast-msg {
  color: inherit;
  font-weight: 500;
  line-height: 1.4;
}

#sync-toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

@keyframes toast-spin {
  to { transform: rotate(360deg); }
}

.sync-toast.toast-syncing #sync-toast-icon {
  display: inline-block;
  animation: toast-spin 1s linear infinite;
}

/* ============================================================
   First-Visit Walkthrough Tour
   ============================================================ */
.walkthrough-catcher {
  position: fixed;
  inset: 0;
  z-index: 4999;
  background: transparent;
}

.walkthrough-spotlight {
  position: fixed;
  z-index: 5000;
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(44, 35, 30, 0.62), 0 0 0 3px var(--accent-gold);
  pointer-events: none;
  transition: top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.walkthrough-card {
  position: fixed;
  z-index: 5001;
  width: min(380px, calc(100vw - 32px));
  background: #FFFDF8;
  color: var(--color-text);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 1.25rem 1.4rem 1.1rem;
  box-shadow: 0 18px 50px rgba(44, 35, 30, 0.35);
  transition: top 0.3s ease, left 0.3s ease;
}

.walkthrough-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  padding-right: 1.5rem;
}

.walkthrough-text {
  font-size: 0.87rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.walkthrough-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-top: 1px solid var(--border-glass);
  padding-top: 0.85rem;
}

.walkthrough-progress {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

.walkthrough-actions {
  display: flex;
  gap: 0.5rem;
}

.walkthrough-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.2rem;
}

.walkthrough-close:hover {
  color: var(--color-text);
}

/* ===== ADMIN PANEL & USER REPORTS STYLING ===== */
.admin-badge-pill {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
  background: var(--grad-accent);
  color: #FFFFFF;
  margin-left: auto;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 6px rgba(197, 86, 47, 0.3);
}

.admin-title-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  background: var(--accent-coral);
  color: #FFFFFF;
  vertical-align: middle;
  margin-left: 0.5rem;
  letter-spacing: 0.04em;
}

.admin-tab-btn {
  background: transparent;
  border: 1px solid var(--border-glass);
  color: var(--color-text-muted);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.admin-tab-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--color-text);
}

.admin-tab-btn.active {
  background: var(--accent-primary);
  color: #FFFFFF;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(197, 86, 47, 0.25);
}

/* Stat Cards */
.admin-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-main);
  transition: transform 0.2s ease;
}

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

.admin-stat-title {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.admin-stat-value {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
}

/* Data Tables */
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

.admin-table th {
  background: rgba(56, 44, 38, 0.05);
  color: var(--color-text);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-glass);
}

.admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-glass);
  color: var(--color-text);
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: var(--bg-glass-hover);
}

/* Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-in-progress { background: #DBEAFE; color: #1E40AF; }
.badge-resolved { background: #D1FAE5; color: #065F46; }
.badge-closed { background: #E5E7EB; color: #374151; }

.badge-priority-low { background: #E0E7FF; color: #3730A3; }
.badge-priority-medium { background: #FEF3C7; color: #92400E; }
.badge-priority-high { background: #FEE2E2; color: #991B1B; }
.badge-priority-critical { background: #7F1D1D; color: #FFFFFF; }

.badge-role-admin { background: var(--accent-coral); color: #FFFFFF; }
.badge-role-user { background: rgba(56, 44, 38, 0.08); color: var(--color-text); }

/* User Report Ticket Card */
.report-ticket-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow-main);
  transition: border-color 0.2s ease;
}

.report-ticket-card:hover {
  border-color: var(--accent-primary);
}

.report-ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.report-ticket-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-text);
}

.report-ticket-body {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.8rem;
  white-space: pre-wrap;
}

.report-admin-response {
  background: rgba(110, 139, 61, 0.1);
  border-left: 3px solid var(--accent-secondary);
  padding: 0.75rem 1rem;
  border-radius: 0 8px 8px 0;
  margin-top: 0.8rem;
  font-size: 0.88rem;
}

.report-admin-response-title {
  font-weight: 700;
  color: var(--accent-secondary);
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
}

