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

:root {
  --bg: #f7efe6;
  --bg-warm: #f2e8da;
  --card: #fffdf8;
  --card-border: rgba(0, 0, 0, 0.06);

  --ink: #1a1a1a;
  --ink-secondary: #6b6560;
  --muted: #a09a92;
  --muted-light: #d4cfc8;

  --green: #4f7d48;
  --green-dark: #3d6133;
  --green-soft: #dceee2;
  --green-muted: rgba(79, 125, 72, 0.12);

  --yellow: #f4dc70;
  --yellow-soft: #fdf5d6;
  --pink: #eda9d5;
  --pink-soft: #f9e5f0;
  --blue: #cde8f2;
  --blue-soft: #e5f4fa;
  --orange: #f0a050;
  --orange-soft: #fdecd6;

  --nav-bg: #1a1a1a;
  --nav-active: #ffffff;
  --nav-inactive: #737373;

  --white: #ffffff;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 999px;

  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-nav: 0 -4px 24px rgba(0, 0, 0, 0.15);

  --font: "Inter", system-ui, -apple-system, sans-serif;

  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 40px;

  --page-padding: 20px;
  --bottom-nav-h: 80px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tap: 48px;
}

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

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: #e8e0d6;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.1);
}

.app-content {
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px);
}

.page {
  display: none;
  animation: pageIn 0.2s ease-out;
}

.page.active {
  display: block;
}

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

.page-inner {
  padding: 0 var(--page-padding) var(--space-lg);
}

.page-header {
  margin-bottom: var(--space-xl);
  padding-top: var(--space-xl);
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-2xs);
}

.page-subtitle {
  font-size: 15px;
  color: var(--ink-secondary);
  line-height: 1.4;
}

.card-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-3xl) var(--space-xl);
  background: var(--card);
  border: 2px dashed var(--muted-light);
  border-radius: var(--radius-lg);
  text-align: center;
}

.placeholder-emoji {
  font-size: 40px;
  opacity: 0.7;
}

.placeholder-text {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.placeholder-hint {
  font-size: 13px;
  color: var(--muted);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-xl);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-lg);
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.profile-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.profile-qi {
  font-size: 14px;
  font-weight: 500;
  color: var(--orange);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.settings-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--card);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: var(--font);
  text-align: left;
}

.settings-item:active {
  background: var(--bg-warm);
}

.settings-item:not(:last-child) {
  border-bottom: 1px solid var(--card-border);
}

.settings-icon {
  font-size: 20px;
  width: 32px;
  text-align: center;
}

.settings-label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}

.settings-value {
  font-size: 14px;
  color: var(--muted);
}

.settings-link {
  text-decoration: none;
}

.bottom-nav {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 520px);
  z-index: 100;
  background: var(--nav-bg);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-radius: 28px;
  box-shadow: var(--shadow-nav);
}

.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-xs) var(--space-sm);
  background: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 0;
  min-height: 56px;
  position: relative;
}

.nav-tab:active {
  transform: scale(0.9);
}

.nav-icon {
  font-size: 22px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: grayscale(100%);
  opacity: 0.6;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--nav-inactive);
  transition: color 0.15s ease;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.nav-tab.active .nav-icon {
  transform: scale(1.1) translateY(-2px);
  filter: grayscale(0%);
  opacity: 1;
}

.nav-tab.active .nav-label {
  color: var(--nav-active);
}

.nav-tab.active::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--green);
  border-radius: 50%;
}

.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--white);
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast[hidden] {
  display: none;
}

/* ============================================================
   HOME PAGE
   ============================================================ */

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xl) 0 var(--space-md);
}

.home-brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.brand-icon {
  font-size: 24px;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.home-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-align: center;
  flex: 1;
}

.home-qi {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  background: var(--orange-soft);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 14px;
  color: var(--orange);
}

/* ============================================================
   MEMBER SCROLL
   ============================================================ */

.member-scroll {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding: var(--space-xs) 0 var(--space-lg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.member-scroll::-webkit-scrollbar {
  display: none;
}

.member-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  cursor: pointer;
  flex-shrink: 0;
}

.member-item:active {
  transform: scale(0.95);
}

.member-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: var(--yellow-soft);
  border: 3px solid transparent;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.member-item.active .member-avatar {
  border-color: var(--green);
  transform: scale(1.08);
}

.member-item.active .member-avatar.add-avatar {
  border-color: var(--green);
}

.member-avatar.add-avatar {
  background: var(--green-soft);
  color: var(--green);
  font-size: 22px;
  font-weight: 600;
  border: 2px dashed var(--green);
}

.member-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-item.active .member-name {
  color: var(--ink);
}

/* ============================================================
   HERO BLOCK
   ============================================================ */

.hero-block {
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  margin-bottom: var(--space-xl);
  background: linear-gradient(145deg, var(--yellow-soft) 0%, var(--orange-soft) 100%);
  position: relative;
  overflow: hidden;
}

.hero-edit-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid rgba(79, 125, 72, 0.22);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.72);
  color: var(--green-dark);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(47, 77, 53, 0.08);
}

.hero-edit-btn:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.9);
}

.hero-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}

.hero-greeting {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin-bottom: var(--space-xs);
}

.hero-greeting span {
  color: var(--green);
}

.hero-sub {
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-secondary);
  margin-bottom: var(--space-lg);
}

.hero-direction-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}

.hero-direction-tags {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.hero-direction-tag {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.hero-stat {
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
}

.hero-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.hero-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}

.hero-stat-value span {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

/* ============================================================
   QUICK ACTIONS
   ============================================================ */

.quick-actions-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-2xs);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font);
  min-height: 72px;
}

.qa-btn:active {
  transform: scale(0.94);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.qa-icon {
  font-size: 24px;
}

.qa-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-secondary);
}

/* ============================================================
   TODAY CARD
   ============================================================ */

.today-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.today-card {
  background: var(--pink-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-xl);
  margin-bottom: var(--space-xl);
  cursor: pointer;
  transition: all 0.15s ease;
}

.today-card:active {
  transform: scale(0.98);
}

.today-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.today-meal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.today-meal-fit {
  font-size: 11px;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-soft);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.today-meal-badges {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.today-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: rgba(255, 255, 255, 0.6);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* ============================================================
   EXTENSION CARD
   ============================================================ */

.extension-card {
  background: var(--blue-soft);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.ext-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.ext-desc {
  font-size: 14px;
  color: var(--ink-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.4;
}

.ext-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ext-btn:active {
  transform: scale(0.96);
  opacity: 0.85;
}

/* ============================================================
   MEAL BUILDER
   ============================================================ */

.meal-mode-toggle {
  display: flex;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  padding: 3px;
  margin-bottom: var(--space-md);
}

.meal-mode-btn {
  flex: 1;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  min-height: 40px;
}

.meal-mode-btn:active {
  transform: scale(0.95);
}

.meal-mode-btn.active {
  background: var(--ink);
  color: var(--white);
}

.meal-builder {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.meal-builder-section {
  margin-bottom: var(--space-md);
}

.meal-builder-section:last-child {
  margin-bottom: 0;
}

.meal-builder-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.meal-builder-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meal-builder-pill {
  padding: 8px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--card);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
}

.meal-builder-pill:active {
  transform: scale(0.95);
}

.meal-builder-pill.selected {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}

.meal-builder-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
  min-height: 44px;
  box-sizing: border-box;
}

.meal-builder-input::placeholder {
  color: var(--muted);
}

.meal-builder-input:focus {
  border-color: var(--green);
}

.meal-builder-members {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.meal-builder-member {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--card);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 40px;
}

.meal-builder-member:active {
  transform: scale(0.95);
}

.meal-builder-member.selected {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-dark);
}

.meal-builder-member-emoji {
  font-size: 16px;
}

.family-member-cards {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: 2px 2px var(--space-xs);
  margin: 0 -2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.family-member-cards::-webkit-scrollbar {
  display: none;
}

.family-member-cards .family-member-card {
  flex: 0 0 132px;
  min-height: 118px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  background: var(--card);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.family-member-cards .family-member-card:active {
  transform: scale(0.98);
}

.family-member-cards .family-member-card.selected {
  background: var(--green-soft);
  border-color: var(--green);
}

.family-member-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.family-member-card-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-warm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.family-member-card-avatar.add {
  background: var(--muted-light);
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

.family-member-card-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.family-member-card-profile {
  min-height: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.family-member-card.selected .family-member-card-profile {
  color: var(--green-dark);
}

.family-member-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.family-member-card-action {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--green);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

.family-member-card-action.secondary {
  color: var(--muted);
}

.family-member-cards .family-member-add-card {
  border-style: dashed;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.35);
}

.meal-builder-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.meal-builder-btn {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  min-height: 50px;
  letter-spacing: -0.2px;
}

.meal-builder-btn:active {
  transform: scale(0.96);
}

.meal-builder-btn-primary {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(79, 125, 72, 0.3);
}

.meal-builder-btn-primary:active {
  background: var(--green-dark);
}

.meal-builder-btn-secondary {
  background: var(--bg-warm);
  color: var(--ink-secondary);
  font-weight: 600;
}

.meal-builder-btn-secondary:active {
  background: var(--muted-light);
}

.meal-builder-save-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) 0;
}

.meal-builder-save-btn {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--card);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.meal-builder-save-btn:active {
  background: var(--bg-warm);
  transform: scale(0.97);
}

.meal-builder-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.meal-builder-dirty-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--orange);
}

.meal-builder-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 16px;
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
}

.meal-builder-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--green-soft);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.app-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  z-index: 500;
  transition: opacity 0.3s ease;
}

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

.app-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--green-soft);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.app-loading-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
}

.app-toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--white);
  padding: var(--space-sm) var(--space-xl);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90%;
  text-align: center;
}

.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.meal-builder-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--card-border);
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  margin: var(--space-md) 0;
  min-height: 44px;
}

.meal-builder-toggle:active {
  background: var(--bg-warm);
  transform: scale(0.98);
}

.meal-builder-toggle-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.meal-builder-summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
  background: var(--green-soft);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

.meal-builder-expanded {
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.plan-length-options {
  display: flex;
  gap: var(--space-sm);
}

.plan-length-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  border: 2px solid var(--card-border);
  background: var(--card);
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 100px;
  text-align: center;
}

.plan-length-card:active {
  transform: scale(0.96);
}

.plan-length-card.selected {
  border-color: var(--green);
  background: var(--green-soft);
}

.plan-length-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.plan-length-card.selected .plan-length-title {
  color: var(--green-dark);
}

.plan-length-qi {
  font-size: 13px;
  font-weight: 600;
  color: var(--orange);
}

.plan-length-desc {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.plan-length-card.selected .plan-length-desc {
  color: var(--ink-secondary);
}

.plan-qi-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  padding: 6px 0;
}

.plan-qi-hint-warn {
  color: var(--orange);
}

.meal-builder-btn-disabled {
  background: var(--muted-light);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

/* ============================================================
   MEALS PAGE
   ============================================================ */

.meal-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 var(--space-md);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0 calc(-1 * var(--page-padding));
  padding-left: var(--page-padding);
  padding-right: var(--page-padding);
}

.meal-filters::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--card);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 44px;
}

.filter-pill:active {
  transform: scale(0.95);
}

.filter-pill.active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.meal-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding-bottom: calc(var(--space-xl) + var(--safe-bottom));
}

.meal-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.meal-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.meal-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  flex: 1;
  margin-right: var(--space-sm);
}

.meal-fit-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: var(--green-dark);
  background: var(--green-soft);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.meal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.meal-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--bg-warm);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.meal-ingredients {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--space-md);
  line-height: 1.4;
}

.meal-ingredients strong {
  color: var(--ink-secondary);
  font-weight: 600;
}

.meal-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.meal-btn {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 48px;
}

.meal-btn:active {
  transform: scale(0.96);
}

.meal-btn-save {
  background: var(--bg-warm);
  color: var(--ink-secondary);
  font-weight: 500;
  order: 2;
}

.meal-btn-save:active {
  background: var(--muted-light);
}

.meal-btn-grocery {
  background: var(--green);
  color: var(--white);
  order: 1;
  flex: 1.2;
}

.meal-btn-grocery:active {
  background: var(--green-dark);
}

.meal-btn-icon {
  font-size: 16px;
}

.meal-card-generated {
  border: 2px solid var(--green);
  background: linear-gradient(145deg, var(--green-soft) 0%, var(--card) 100%);
  position: relative;
}

.meal-card-generated::before {
  content: "✨ Generated for you";
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}

.meal-generation-error {
  background: #fff5f0;
  border: 1px solid #f0d0c0;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  animation: pageIn 0.25s ease-out;
}

.meal-generation-error-title {
  font-size: 16px;
  font-weight: 700;
  color: #9a3a1a;
  margin-bottom: var(--space-xs);
}

.meal-generation-error-desc {
  font-size: 14px;
  color: #7a5a4a;
  line-height: 1.5;
  margin-bottom: var(--space-md);
}

.meal-generation-error-actions {
  display: flex;
  gap: var(--space-sm);
}

.meal-generation-error-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
}

.meal-generation-error-btn:active {
  transform: scale(0.96);
}

.meal-generation-error-retry {
  background: var(--green);
  color: var(--white);
}

.meal-generation-error-retry:active {
  background: var(--green-dark);
}

.meal-generation-error-edit {
  background: var(--bg-warm);
  color: var(--ink-secondary);
}

.meal-generation-error-edit:active {
  background: var(--muted-light);
}

.meal-btn-save.saved {
  background: var(--green-soft);
  color: var(--green-dark);
}

.meal-btn-grocery.added {
  background: var(--bg-warm);
  color: var(--ink-secondary);
}

/* ============================================================
   GROCERY PAGE
   ============================================================ */

.grocery-title {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.8px;
}

.grocery-tabs {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  padding: var(--space-xs) 0 var(--space-lg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.grocery-tabs::-webkit-scrollbar {
  display: none;
}

.grocery-tab {
  flex-shrink: 0;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--card);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.grocery-tab:active {
  transform: scale(0.95);
}

.grocery-tab.active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.grocery-summary {
  background: linear-gradient(145deg, var(--green-soft) 0%, var(--blue-soft) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.grocery-summary-stats {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-xs);
}

.grocery-summary-desc {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.4;
}

.grocery-swap {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.grocery-swap-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.grocery-swap-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
}

.grocery-swap-subtitle {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-secondary);
}

.grocery-swap-toggle-row {
  display: flex;
  gap: var(--space-sm);
}

.grocery-swap-toggle {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--bg);
  font-family: var(--font);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.grocery-swap-toggle.active {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-dark);
}

.grocery-swap-toggle:active {
  transform: scale(0.96);
}

.grocery-swap-toggle-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: inherit;
  white-space: nowrap;
}

.grocery-swap-toggle-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.grocery-swap-toggle.active .grocery-swap-toggle-subtitle {
  color: var(--green-dark);
}

.grocery-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.grocery-group {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.grocery-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-warm);
  border-bottom: 1px solid var(--card-border);
}

.grocery-group-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.grocery-group-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.68);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease;
}

.grocery-group-toggle:active {
  transform: scale(0.94);
  background: var(--green-soft);
}

.grocery-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--card-border);
  transition: background 0.15s ease;
}

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

.grocery-item:active {
  background: var(--bg-warm);
}

.grocery-item.checked {
  opacity: 0.5;
}

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

.grocery-checkbox {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--muted-light);
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  font-size: 14px;
}

.grocery-item.checked .grocery-checkbox {
  background: var(--green);
  border-color: var(--green);
  color: var(--white);
}

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

.grocery-item-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  transition: all 0.15s ease;
}

.grocery-item-used {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.grocery-swap-suggestion {
  font-size: 11px;
  line-height: 1.35;
  color: var(--green-dark);
  margin-top: 4px;
}

.grocery-swap-status {
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
  margin-top: 4px;
}

.grocery-empty-state {
  display: grid;
  gap: var(--space-sm);
  justify-items: start;
  padding: var(--space-2xl);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.54);
  box-shadow: var(--shadow-card);
}

.grocery-empty-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}

.grocery-empty-desc {
  max-width: 320px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-secondary);
}

.grocery-empty-btn {
  margin-top: 2px;
  padding: 10px 14px;
  border: 1px solid var(--green);
  border-radius: var(--radius-md);
  background: var(--green);
  color: var(--white);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.grocery-cta {
  display: flex;
  gap: var(--space-sm);
  position: sticky;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px);
  padding: var(--space-sm) 0;
  background: var(--bg);
}

.grocery-cta-btn {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.grocery-cta-btn:active {
  transform: scale(0.96);
}

.grocery-cta-shop {
  background: var(--green);
  color: var(--white);
}

.grocery-cta-shop:active {
  background: var(--green-dark);
}

.grocery-cta-save {
  background: var(--bg-warm);
  color: var(--ink);
}

.grocery-cta-save:active {
  background: var(--muted-light);
}

/* ============================================================
   FAMILY PLAN DAY DETAIL
   ============================================================ */

.fp-day-detail {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.fp-day-detail-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-md);
}

.fp-day-detail-section {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--card-border);
}

.fp-day-detail-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.fp-day-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: var(--space-xs);
}

.fp-day-detail-text {
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.6;
}

.fp-day-detail-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fp-day-ingredient-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--bg-warm);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* ============================================================
   INSIGHTS PAGE
   ============================================================ */

.insights-hero {
  background: linear-gradient(145deg, var(--orange-soft) 0%, var(--yellow-soft) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  margin-bottom: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.insights-hero::after {
  content: "🔄";
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 32px;
  opacity: 0.3;
}

.insights-hero-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.insights-hero-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.insights-hero-value span {
  color: var(--green);
}

.insights-hero-copy {
  margin-top: var(--space-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-secondary);
  line-height: 1.45;
}

.insights-period-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  background: var(--card);
  border-radius: var(--radius-full);
  padding: 4px;
  border: 1px solid var(--card-border);
}

.insights-period-tabs:empty {
  display: none;
}

.insights-period-tab {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.insights-period-tab:active {
  transform: scale(0.95);
}

.insights-period-tab.active {
  background: var(--ink);
  color: var(--white);
}

.insights-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.insights-stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.insights-stat-icon {
  font-size: 24px;
  margin-bottom: var(--space-sm);
}

.insights-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-2xs);
}

.insights-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.insights-chart-section {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.insights-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-lg);
}

.insights-bar-chart {
  display: flex;
  align-items: stretch;
  gap: var(--space-sm);
  min-height: 0;
  height: auto;
  padding-bottom: 0;
  position: relative;
  flex-direction: column;
}

.insights-bar-chart::before {
  content: none;
}

.insights-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
  position: relative;
  z-index: 1;
}

.insights-bar {
  width: 100%;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--green);
  transition: height 0.3s ease;
  min-height: 4px;
}

.insights-bar.highlight {
  background: var(--orange);
}

.insights-bar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.insights-bar-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-secondary);
}

.insights-friction {
  background: var(--green-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.insights-friction-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.insights-friction-reason {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.insights-friction-emoji {
  font-size: 28px;
  margin-bottom: var(--space-sm);
}

.insights-efficiency-main {
  display: grid;
  gap: var(--space-2xs);
}

.insights-efficiency-rate {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}

.insights-efficiency-sub,
.insights-empty-note {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  line-height: 1.45;
}

.insights-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

.insights-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-warm);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
}

.insights-action-list {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.insights-action-btn {
  width: 100%;
  border: 1px solid rgba(71, 111, 67, 0.2);
  background: var(--card);
  color: var(--green-dark);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

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

/* ============================================================
   PROFILE PAGE
   ============================================================ */

.profile-user-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.profile-user-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.profile-user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--green-soft) 0%, var(--blue-soft) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.profile-user-info {
  flex: 1;
}

.profile-user-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-2xs);
}

.profile-user-type {
  font-size: 14px;
  font-weight: 500;
  color: var(--green);
}

.profile-user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.profile-user-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  background: var(--bg-warm);
  padding: 5px 12px;
  border-radius: var(--radius-full);
}

.profile-edit-btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--card);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.profile-edit-btn:active {
  background: var(--bg-warm);
  transform: scale(0.98);
}

.profile-save-section {
  margin-top: var(--space-md);
}

.profile-save-btn {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--green);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.profile-save-btn:active {
  background: var(--green-dark);
  transform: scale(0.98);
}

.profile-save-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.profile-section {
  margin-bottom: var(--space-xl);
}

.profile-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
  padding-left: var(--space-xs);
}

.profile-members {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.profile-members::-webkit-scrollbar {
  display: none;
}

.profile-member-card {
  flex-shrink: 0;
  width: 100px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all 0.15s ease;
}

.profile-member-card:active {
  transform: scale(0.95);
}

.profile-member-card.active {
  border-color: var(--green);
  background: var(--green-soft);
}

.profile-member-card.add-member {
  border-style: dashed;
  border-color: var(--muted-light);
  background: transparent;
  box-shadow: none;
}

.profile-member-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.profile-member-card.add-member .profile-member-avatar {
  background: var(--muted-light);
  color: var(--muted);
  font-size: 24px;
}

.profile-member-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.profile-member-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.profile-extension {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
}

.profile-extension-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.profile-extension-icon {
  font-size: 24px;
}

.profile-extension-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.profile-extension-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--space-md);
  line-height: 1.4;
}

.profile-extension-actions {
  display: flex;
  gap: var(--space-sm);
}

.profile-extension-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.profile-extension-btn:active {
  transform: scale(0.96);
}

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

.profile-extension-btn-primary:active {
  opacity: 0.85;
}

.profile-extension-btn-secondary {
  background: var(--bg-warm);
  color: var(--ink);
}

.profile-extension-btn-secondary:active {
  background: var(--muted-light);
}

/* ============================================================
   QUIZ
   ============================================================ */

.hero-quiz-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px dashed var(--green);
  background: rgba(79, 125, 72, 0.06);
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
}

.hero-quiz-btn:active {
  background: rgba(79, 125, 72, 0.12);
  transform: scale(0.98);
}

.hero-quiz-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.hero-quiz-text {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-dark);
  text-align: left;
}

.hero-quiz-arrow {
  font-size: 20px;
  font-weight: 600;
  color: var(--green);
  flex-shrink: 0;
}

.quiz-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--page-padding);
  animation: qiModalIn 0.2s ease-out;
}

.quiz-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  position: relative;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  animation: qiModalCardIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 85vh;
  overflow-y: auto;
}

.quiz-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.quiz-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.quiz-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-warm);
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.quiz-close:active {
  background: var(--muted-light);
  transform: scale(0.9);
}

.quiz-progress {
  height: 4px;
  background: var(--muted-light);
  border-radius: 2px;
  margin-bottom: var(--space-xl);
  overflow: hidden;
}

.quiz-progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0;
}

.quiz-question-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.quiz-question {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-xl);
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  min-height: 52px;
}

.quiz-option:active {
  background: var(--green-soft);
  border-color: var(--green);
  transform: scale(0.98);
}

.quiz-option-letter {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--muted-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-secondary);
  flex-shrink: 0;
}

.quiz-option-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}

.quiz-result-icon {
  font-size: 40px;
  text-align: center;
  margin-bottom: var(--space-sm);
}

.quiz-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  margin-bottom: var(--space-xs);
}

.quiz-result-profile {
  font-size: 26px;
  font-weight: 800;
  color: var(--green);
  text-align: center;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.5px;
}

.quiz-result-hint {
  font-size: 14px;
  color: var(--ink-secondary);
  text-align: center;
  line-height: 1.5;
  margin-bottom: var(--space-xl);
}

.quiz-save-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--green);
  color: var(--white);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: var(--space-sm);
}

.quiz-save-btn:active {
  background: var(--green-dark);
  transform: scale(0.98);
}

.quiz-save-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.quiz-retake-btn {
  display: block;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--ink-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-retake-btn:active {
  background: var(--bg-warm);
  transform: scale(0.98);
}

/* ============================================================
   MEMBER QUIZ STATUS (in family builder)
   ============================================================ */

.meal-builder-member-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meal-builder-member-wrap .meal-builder-member {
  width: 100%;
}

.meal-builder-member-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-quiz-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 0 6px;
  line-height: 1.4;
  max-width: 132px;
}

.member-quiz-done {
  color: var(--green-dark);
}

.member-quiz-check {
  font-weight: 700;
  color: var(--green);
}

.member-quiz-pending {
  color: var(--muted);
}

.member-quiz-btn {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  color: var(--green);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.member-quiz-btn:active {
  color: var(--green-dark);
}

.member-edit-btn {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.member-edit-btn:active {
  color: var(--ink-secondary);
}

.member-quiz-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 86px;
}

/* ============================================================
   FAMILY MEMBER MODAL
   ============================================================ */

.family-member-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 320;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--page-padding);
  animation: qiModalIn 0.2s ease-out;
}

.family-member-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  position: relative;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  animation: qiModalCardIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.family-member-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-warm);
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.family-member-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-lg);
  letter-spacing: 0;
}

.family-member-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.family-member-field span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.family-member-field input,
.family-member-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}

.family-member-field input:focus,
.family-member-field select:focus {
  border-color: var(--green);
}

.family-member-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.family-member-save {
  margin-left: auto;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--green);
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.family-member-delete {
  min-height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: #B4533A;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.family-member-delete:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

/* ============================================================
   MOBILE OPTIMIZATIONS
   ============================================================ */

html {
  scroll-behavior: smooth;
}

body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
}

.page-inner {
  padding-bottom: calc(var(--space-3xl) + var(--safe-bottom));
}

.bottom-nav {
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

button,
[role="button"],
.nav-tab,
.qa-btn,
.filter-pill,
.grocery-tab,
.insights-period-tab,
.settings-item,
.meal-btn,
.grocery-cta-btn,
.profile-edit-btn,
.profile-save-btn,
.profile-extension-btn,
.profile-member-card,
.ext-btn,
.hero-stat,
.today-card {
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="number"],
textarea,
select {
  min-height: 48px;
  font-size: 16px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 125, 72, 0.15);
}

*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

* {
  scrollbar-width: none;
}

.grocery-cta {
  padding-bottom: calc(var(--space-sm) + var(--safe-bottom));
}

@media (max-width: 430px) {
  :root {
    --page-padding: 16px;
  }

  .page-title {
    font-size: 24px;
  }

  .hero-greeting {
    font-size: 22px;
  }

  .quick-actions-grid {
    gap: var(--space-xs);
  }

  .qa-btn {
    min-height: 68px;
    padding: var(--space-xs) var(--space-2xs);
  }

  .meal-filters,
  .grocery-tabs,
  .member-scroll,
  .profile-members {
    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
    margin-left: calc(-1 * var(--page-padding));
    margin-right: calc(-1 * var(--page-padding));
  }

  .grocery-swap-toggle-row {
    gap: 10px;
  }

  .grocery-swap-toggle {
    padding: 10px;
  }

  .grocery-swap-toggle-label {
    font-size: 12px;
  }

  .grocery-swap-toggle-subtitle {
    font-size: 10px;
  }
}

@media (max-width: 390px) {
  .bottom-nav {
    width: 96vw;
    padding-left: 8px;
    padding-right: 8px;
  }

  .nav-label {
    font-size: 9px;
  }

  .nav-icon {
    font-size: 19px;
  }
}

@media (max-width: 375px) {
  :root {
    --page-padding: 14px;
    --space-lg: 18px;
    --space-xl: 20px;
    --space-2xl: 28px;
  }

  .page-title {
    font-size: 22px;
  }

  .hero-greeting {
    font-size: 20px;
  }

  .insights-hero-value {
    font-size: 22px;
  }

  .grocery-title {
    font-size: 28px;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================================
   QI MODAL
   ============================================================ */

.qi-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--page-padding);
  animation: qiModalIn 0.2s ease-out;
}

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

.qi-modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  position: relative;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  animation: qiModalCardIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes qiModalCardIn {
  from { transform: scale(0.92) translateY(16px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.qi-modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-warm);
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.qi-modal-close:active {
  background: var(--muted-light);
  transform: scale(0.9);
}

.qi-modal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.3px;
}

.qi-modal-subtitle {
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-xl);
}

.qi-modal-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.qi-modal-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}

.qi-modal-option-disabled {
  align-items: flex-start;
  background: rgba(107, 142, 117, 0.08);
}

.qi-modal-option-disabled .qi-modal-option-value {
  color: var(--ink-secondary);
  font-weight: 500;
  line-height: 1.4;
}

.qi-modal-option-icon {
  font-size: 24px;
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.qi-modal-option-info {
  flex: 1;
  min-width: 0;
}

.qi-modal-option-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.qi-modal-option-value {
  font-size: 12px;
  color: var(--green);
  font-weight: 600;
  margin-top: 2px;
}

.qi-modal-option-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--card-border);
  background: var(--card);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.qi-modal-option-btn:active {
  background: var(--bg-warm);
  transform: scale(0.95);
}

.qi-modal-option-btn-primary {
  background: var(--green);
  color: var(--white);
  border-color: var(--green);
}

.qi-modal-option-btn-primary:active {
  background: var(--green-dark);
}

.qi-modal-footer {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

/* ============================================================
   INVITE PANEL
   ============================================================ */

.invite-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 310;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--page-padding);
  animation: qiModalIn 0.2s ease-out;
}

.invite-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl) var(--space-xl);
  position: relative;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  animation: qiModalCardIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.invite-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-warm);
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.invite-close:active {
  background: var(--muted-light);
  transform: scale(0.9);
}

.invite-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: var(--space-xs);
  letter-spacing: -0.3px;
}

.invite-subtitle {
  font-size: 14px;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin-bottom: var(--space-xl);
}

.invite-code-label,
.invite-link-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-xs);
}

.invite-code-box {
  font-family: var(--font-mono, monospace);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  padding: var(--space-md);
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  text-align: center;
  margin-bottom: var(--space-lg);
  letter-spacing: 1px;
}

.invite-code-loading {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.invite-link-label {
  margin-top: 0;
}

.invite-link-box {
  font-size: 13px;
  color: var(--ink-secondary);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  word-break: break-all;
  line-height: 1.4;
}

.invite-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--green);
  color: var(--white);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: var(--space-sm);
}

.invite-btn:active {
  background: var(--green-dark);
  transform: scale(0.98);
}

.invite-btn-share {
  background: var(--card);
  color: var(--ink-secondary);
  border: 1px solid var(--card-border);
}

.invite-btn-share:active {
  background: var(--bg-warm);
}

/* ============================================================
   PLAN OPTION INSUFFICIENT
   ============================================================ */

.plan-option-insufficient {
  opacity: 0.85;
}

.plan-option-insufficient.plan-length-card {
  border-style: dashed;
}

.plan-length-insufficient {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--orange);
  margin-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .page {
    animation: none;
  }
}
