:root {
  /* Midnight Dark Theme (Default) */
  --primary: #4FACFE;
  --primary-dark: #3A8BDE;
  --secondary: #00F5FF;
  --danger: #FF6B6B;
  --warning: #F4D03F;
  --bg: #0D1117;
  --card: #161B22;
  --card-elevated: #21262D;
  --text: #E6EDF3;
  --text-light: #7D8590;
  --border: #30363D;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  --glow: 0 0 20px rgba(79, 172, 254, 0.15);
  --gradient-header: linear-gradient(135deg, #4FACFE 0%, #00F5FF 100%);
}

/* Glossy Theme - Deep Glass (readable but translucent) */
html[data-theme="glossy"],
[data-theme="glossy"] {
  --primary: #A78BFA;
  --primary-dark: #8B5CF6;
  --secondary: #60A5FA;
  --danger: #F87171;
  --warning: #FBBF24;
  --bg: #0f172a;
  --card: rgba(30, 41, 59, 0.85);
  --card-elevated: rgba(51, 65, 85, 0.9);
  --text: #f8fafc;
  --text-light: #94a3b8;
  --border: rgba(148, 163, 184, 0.2);
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --glow: 0 0 40px rgba(139, 92, 246, 0.3);
  --gradient-header: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);
}

/* Glossy theme - main cards with subtle depth */
html[data-theme="glossy"] .section,
html[data-theme="glossy"] .nutrition-card,
html[data-theme="glossy"] .tabs.compact {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.3),
    0 8px 10px -6px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
}

/* Glossy theme - modals and settings (glass layer on top) */
html[data-theme="glossy"] .modal {
  background: rgba(15, 23, 42, 0.6) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

html[data-theme="glossy"] .modal-content,
html[data-theme="glossy"] .settings-card {
  background: linear-gradient(145deg, rgba(51, 65, 85, 0.95) 0%, rgba(30, 41, 59, 0.98) 100%) !important;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    inset 0 1px 1px rgba(255, 255, 255, 0.08) !important;
}

/* Glossy theme - elevated hover states removed */

/* Glossy theme - inputs */
html[data-theme="glossy"] input[type="number"],
html[data-theme="glossy"] input[type="text"] {
  background: rgba(15, 23, 42, 0.6) !important;
  border-color: rgba(148, 163, 184, 0.25) !important;
  color: #f8fafc !important;
}

/* Glossy theme - buttons with gradient */
html[data-theme="glossy"] .btn-primary {
  background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%) !important;
  color: white !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4) !important;
}

html[data-theme="glossy"] .amount-btn.minus {
  background: rgba(148, 163, 184, 0.2) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
}

html[data-theme="glossy"] .amount-btn.plus {
  background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%) !important;
  color: white !important;
}

/* Candy Theme - Pastel & Cute */
html[data-theme="candy"],
[data-theme="candy"] {
  --primary: #FF6B9D;
  --primary-dark: #E85D8C;
  --secondary: #C44569;
  --danger: #FF8A80;
  --warning: #FFD54F;
  --bg: #FFF0F3;
  --card: #ffffff;
  --card-elevated: #FFF5F8;
  --text: #5A4A4A;
  --text-light: #9E8E8E;
  --border: #FFD0DC;
  --shadow: 0 4px 15px rgba(255, 107, 157, 0.12);
  --glow: 0 0 20px rgba(255, 107, 157, 0.15);
  --gradient-header: linear-gradient(135deg, #FF6B9D 0%, #FFA6C9 100%);
}

/* Candy Theme - Light & Pastel */
html[data-theme="candy"] {
  --primary: #FF85A2;
  --primary-dark: #FF6B8A;
  --secondary: #FFC2D1;
  --danger: #FF9AA2;
  --warning: #FFD6A5;
  --bg: #FFF8FA;
  --card: #FFFFFF;
  --card-elevated: #FFF0F5;
  --text: #5A4A52;
  --text-light: #9A8A92;
  --border: #FFD6E5;
  --shadow: 0 4px 20px rgba(255, 133, 162, 0.15);
  --glow: 0 0 20px rgba(255, 133, 162, 0.2);
}

/* Override all dark backgrounds for candy */
html[data-theme="candy"] body,
html[data-theme="candy"] .container {
  background: #FFF8FA;
}

html[data-theme="candy"] .section,
html[data-theme="candy"] .nutrition-card,
html[data-theme="candy"] .settings-card,
html[data-theme="candy"] .history-item,
html[data-theme="candy"] .food-item,
html[data-theme="candy"] .quick-log-preview,
html[data-theme="candy"] .tabs.compact,
html[data-theme="candy"] .settings-card-header {
  background: #FFFFFF;
  border-color: #FFD6E5;
  box-shadow: 0 4px 15px rgba(255, 133, 162, 0.1);
}

html[data-theme="candy"] .compact-header {
  background: transparent;
}

/* Candy theme - progress bars */
html[data-theme="candy"] .nutri-bar {
  background: #FFE5ED;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

html[data-theme="candy"] .nutri-bar .progress-fill {
  box-shadow: 0 0 6px currentColor;
}

/* Candy theme - buttons */
html[data-theme="candy"] .btn-primary {
  background: linear-gradient(135deg, #FF85A2 0%, #FFB5C5 100%);
  color: white;
  border: none;
}

/* Candy theme - water log minus button (match plus button) */
html[data-theme="candy"] .amount-btn.minus {
  background: linear-gradient(135deg, #FF85A2 0%, #FFB5C5 100%);
  color: white;
}

/* Candy theme - theme preview buttons visibility fix */
html[data-theme="candy"] .theme-option {
  border: 2px solid #FFD6E5;
}

html[data-theme="candy"] .theme-option .theme-name {
  color: #5A4A52;
}

html[data-theme="candy"] .theme-option .theme-desc {
  color: #9A8A92;
}

/* Ensure Glossy theme preview is visible in Candy theme */
html[data-theme="candy"] .theme-preview.glossy-theme {
  border: 1px solid rgba(255, 255, 255, 0.3);
}

html[data-theme="candy"] .tabs.compact .tab-btn:hover {
  background: #FFF0F5;
}

html[data-theme="candy"] .tabs.compact .tab-btn.active {
  background: linear-gradient(135deg, #FF85A2 0%, #FFB5C5 100%);
  color: white;
}

/* Supplement pills in candy */
html[data-theme="candy"] .supplement-chip {
  background: #FFE5ED !important;
  color: #FF6B8A !important;
  border: 1px solid #FFD6E5 !important;
}

html[data-theme="candy"] .food-item-wrapper {
  background: transparent;
  border-bottom: 1px solid #FFD6E5 !important;
}

html[data-theme="candy"] .food-item-wrapper:last-child {
  border-bottom: none !important;
}

html[data-theme="candy"] .food-item,
html[data-theme="candy"] .food-item-wrapper.meal-breakfast .food-item,
html[data-theme="candy"] .food-item-wrapper.meal-lunch .food-item,
html[data-theme="candy"] .food-item-wrapper.meal-dinner .food-item,
html[data-theme="candy"] .food-item-wrapper.meal-snack .food-item {
  background: #FFFFFF !important;
  border: none !important;
}

/* Candy theme - settings button */
html[data-theme="candy"] .btn-icon {
  background: #FFFFFF;
  border: 1px solid #FFD6E5;
  box-shadow: 0 2px 8px rgba(255, 133, 162, 0.1);
}

html[data-theme="candy"] .btn-icon:active {
  background: #FFF0F5;
}

/* Neon Theme - Cyberpunk */
html[data-theme="neon"],
[data-theme="neon"] {
  --primary: #FF00FF;
  --primary-dark: #D400D4;
  --secondary: #00FFFF;
  --danger: #FF0055;
  --warning: #FFFF00;
  --bg: #0a0a0f;
  --card: #12121a;
  --card-elevated: #1a1a28;
  --text: #E0E0E0;
  --text-light: #888899;
  --border: #FF00FF40;
  --shadow: 0 0 20px rgba(255, 0, 255, 0.3);
  --glow: 0 0 30px rgba(255, 0, 255, 0.4);
  --gradient-header: linear-gradient(135deg, #FF00FF 0%, #00FFFF 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Hide global scrollbar for a native app feel */
::-webkit-scrollbar {
  display: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
  font-size: 14px;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
  -ms-overflow-style: none;
  /* IE/Edge */
  scrollbar-width: none;
  /* Firefox */
}

/* Gradient background themes */
[data-theme="glossy"] body,
[data-theme="candy"] body {
  background-attachment: fixed;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 10px;
  padding-bottom: 80px;
  position: relative;
  /* Space for bottom nav */
}

/* Compact Header */
.compact-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 0;
}

.compact-header h1 {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

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

.header-date-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 16px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   SYMPTOMS & COUNTERS PREMIUM STYLE
   ========================================== */

.severity-buttons {
  display: flex;
  gap: 6px;
  width: 100%;
}

.severity-btn {
  flex: 1;
  padding: 10px 0;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  font-weight: bold;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
}

.severity-btn.s1.active { background: rgba(253, 224, 71, 0.2); border-color: #FDE047; color: #FDE047; box-shadow: 0 0 10px rgba(253, 224, 71, 0.2); }
.severity-btn.s2.active { background: rgba(250, 204, 21, 0.2); border-color: #FACC15; color: #FACC15; box-shadow: 0 0 10px rgba(250, 204, 21, 0.2); }
.severity-btn.s3.active { background: rgba(251, 146, 60, 0.2); border-color: #FB923C; color: #FB923C; box-shadow: 0 0 10px rgba(251, 146, 60, 0.2); }
.severity-btn.s4.active { background: rgba(234, 88, 12, 0.2); border-color: #EA580C; color: #EA580C; box-shadow: 0 0 10px rgba(234, 88, 12, 0.2); }
.severity-btn.s5.active { background: rgba(239, 68, 68, 0.2); border-color: #EF4444; color: #EF4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }

.premium-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  background: var(--card-elevated);
  border-radius: 12px;
  border: 1px dashed var(--border);
  text-align: center;
}

.premium-empty-state .empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.8;
}

.premium-empty-state p {
  color: var(--text-light);
  font-weight: 500;
}

.premium-symptom-card {
  background: linear-gradient(145deg, var(--card-elevated) 0%, var(--card) 100%) !important;
  border-radius: 12px;
  padding: 16px !important;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  position: relative;
  /* overflow: hidden; */ /* REMOVED - was clipping swipe buttons */
  border: 1px solid var(--border) !important;
  width: 100%;
}

.symptom-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.symptom-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.symptom-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.severity-dots {
  display: flex;
  gap: 4px;
}

.sev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.sev-dot.active-1 { background: #FDE047; box-shadow: 0 0 5px #FDE047; }
.sev-dot.active-2 { background: #FACC15; box-shadow: 0 0 5px #FACC15; }
.sev-dot.active-3 { background: #FB923C; box-shadow: 0 0 5px #FB923C; }
.sev-dot.active-4 { background: #EA580C; box-shadow: 0 0 5px #EA580C; }
.sev-dot.active-5 { background: #EF4444; box-shadow: 0 0 5px #EF4444; }

/* Inline culprits container appearing below the swipeable row */
.inline-culprits-container {
  padding: 12px 16px 16px 16px;
  background: var(--card-bg); /* Match app background or slightly offset it */
  animation: slideDownFade 0.3s ease forwards;
  position: relative;
  z-index: 1; /* Below the swipable item */
}

.counter-pin-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.counter-pin-btn.pinned {
  opacity: 1;
}

.counter-unpin-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.5);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  color: var(--text-light);
  cursor: pointer;
}
.counter-unpin-badge:hover {
  background: var(--danger);
  color: white;
}

.header-date-btn:hover {
  background: var(--card-elevated);
  transform: translateY(-1px);
}

.btn-icon {
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 18px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.btn-icon:hover {
  background: var(--card-elevated);
  transform: translateY(-1px);
}

/* Compact Tabs (Bottom Navigation) */
.tabs.compact {
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  padding: 12px 10px 24px;
  /* Extra padding for iOS home indicator */
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border);
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 480px;
  margin: 0 auto;
}

.tabs.compact .tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 50px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--text-light);
  opacity: 0.6;
}

.tabs.compact .tab-btn svg {
  width: 24px;
  height: 24px;
  transition: inherit;
}

.tabs.compact .tab-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

.tabs.compact .tab-btn.active {
  color: var(--primary);
  opacity: 1;
}

.tabs.compact .tab-btn.active svg {
  stroke: var(--primary);
  filter: drop-shadow(0 0 8px rgba(79, 172, 254, 0.5));
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Sub-Tab Navigation inside Log Tab */
.subtabs {
  position: sticky;
  top: 10px;
  /* Account for container padding */
  z-index: 10;
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--card);
  padding: 6px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.subtab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.25s ease;
}

.subtab-btn:hover {
  background: var(--card-elevated);
  color: var(--text);
}

.subtab-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #0D1117;
  box-shadow: 0 2px 8px rgba(79, 172, 254, 0.35);
}

.subtab-content {
  display: none;
}

.subtab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Removed Compact Date Display */

/* Combined Nutrition Card */
.nutrition-card {
  background: var(--card);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

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

.nutrition-row:last-child {
  margin-bottom: 0;
}

.nutri-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.nutri-name {
  font-size: 12px;
  font-weight: 600;
  width: 64px;
  color: var(--text-light);
  flex-shrink: 0;
}

.nutri-bar {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
  margin-left: 4px;
}

.nutri-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px currentColor;
  opacity: 0.9;
}

.nutri-value {
  font-size: 12px;
  font-weight: 500;
  width: 70px;
  text-align: right;
  white-space: nowrap;
}

/* Sections */
.section {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  user-select: none;
}

.section-header h3,
.section-header h4 {
  font-size: 14px;
  font-weight: 600;
}

.toggle-icon {
  font-size: 12px;
  color: var(--text-light);
  transition: transform 0.2s;
}

.toggle-icon.expanded {
  transform: rotate(180deg);
}

.section-content {
  padding: 0 12px 12px;
}

.section-content.hidden {
  display: none;
}

/* Compact Food List - Swipe to Delete */
.food-list.compact {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--card-elevated);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.food-list.compact #older-logs {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.food-item-wrapper {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  touch-action: pan-y;
  background: var(--bg);
}

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

#older-logs .food-item-wrapper:last-child {
  border-bottom: none;
}

/* Premium Textarea / Input / Select */
.premium-textarea, .premium-input, .premium-select {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  box-sizing: border-box;
  outline: none !important;
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
}

.premium-textarea {
  resize: vertical;
  min-height: 48px;
}

.premium-select {
  /* Custom chevron for select */
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23cccccc%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
  padding-right: 32px;
}

.premium-textarea:focus, .premium-input:focus, .premium-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.2);
}

/* Swipe Actions (for food-items) */
/* Meal-time background colors - subtle tint on the food-item only, fully opaque */
.food-item-wrapper.meal-breakfast .food-item {
  background: linear-gradient(135deg, #252019 0%, #1c2129 100%);
  border: none;
}

.food-item-wrapper.meal-lunch .food-item {
  background: linear-gradient(135deg, #1a231c 0%, #1c2129 100%);
  border: none;
}

.food-item-wrapper.meal-dinner .food-item {
  background: linear-gradient(135deg, #201d28 0%, #1c2129 100%);
  border: none;
}

.food-item-wrapper.meal-snack .food-item,
.food-item-wrapper .food-item {
  background: var(--card-elevated);
  border: none;
}

.food-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--card-elevated);
  border-radius: 0;
  border: none;
  position: relative;
  z-index: 2;
  transition: transform 0.2s ease;
  cursor: grab;
  width: 100%;
}

.food-item.swiping {
  cursor: grabbing;
}

.food-item-actions {
  position: absolute;
  right: -140px;
  /* Offset to the right of the actual parent boundary */
  top: 0;
  bottom: 0;
  width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.food-item-actions button {
  flex: 1;
  height: 100%;
  border: none;
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}

.food-item-actions button:hover {
  opacity: 0.9;
}

.food-item-actions .edit-btn {
  background: var(--primary);
}

.food-item-actions .delete-btn-swipe {
  background: var(--danger);
}

.food-item-info {
  flex: 1;
  min-width: 0;
  padding-right: 8px;
}

.food-item-info h4 {
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 2px;
  white-space: normal;
  word-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.food-item-info span {
  font-size: 11px;
  color: var(--text-light);
  white-space: normal;
}

.food-item-stats {
  flex-shrink: 0;
  min-width: fit-content;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.food-item-stats-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.food-item-stats-main span {
  font-size: 11px;
  color: var(--text-light);
}

.food-item-stats .log-time {
  font-size: 10px;
  color: var(--text-light);
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* Inline Edit Form */
.inline-edit-form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.inline-edit-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 16px;
  /* 16px prevents iOS zoom */
  font-weight: 600;
  width: 0;
  /* Let flex handle width */
}

.inline-edit-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.3);
}

.inline-edit-unit {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}

.inline-edit-time {
  background: var(--bg);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 8px 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  width: 90px;
}

.inline-edit-time:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.3);
}

.inline-edit-save {
  background: var(--primary);
  color: #0D1117;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}

.inline-edit-cancel {
  background: transparent;
  color: var(--text-light);
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

/* Legacy delete button */
.delete-btn {
  background: rgba(255, 107, 107, 0.15);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}

/* Supplement Chips */
.supplement-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.supplement-chip {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #0D1117;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(79, 172, 254, 0.35);
}

/* Supplement Progress Bars */
.supp-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.supp-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}

.supp-bar-item span:first-child {
  width: 40px;
  font-weight: 600;
  color: var(--text-light);
}

.mini-bar {
  flex: 1;
  height: 4px;
  background: var(--bg);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mini-bar .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(79, 172, 254, 0.45);
}

.supp-bar-item span:last-child {
  width: 65px;
  text-align: right;
  color: var(--text-light);
  white-space: nowrap;
}

/* Compact Micronutrients */
.micro-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
}

.micro-compact span {
  color: var(--text-light);
  background: var(--bg);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.micro-compact b {
  color: var(--primary);
  font-weight: 600;
}

/* Forms */
.log-form.compact {
  background: var(--card);
  border-radius: 12px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

/* When log-form is inside a section-content, remove extra styling */
.section-content .log-form.compact {
  box-shadow: none;
  border: none;
  padding: 0;
  margin-bottom: 0;
  background: transparent;
}

.input-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group {
  margin-bottom: 10px;
  width: 100%;
  box-sizing: border-box;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

.form-group.half {
  flex: 1;
  min-width: 0;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

.form-group input::placeholder {
  color: var(--text-light);
  opacity: 0.6;
}

.form-row.compact {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.form-row.compact input,
.form-row.compact select {
  flex: 1;
  padding: 10px 12px;
  font-size: 13px;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  box-sizing: border-box;
  min-width: 0;
}

.form-row.compact input:focus,
.form-row.compact select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

.form-row.compact button {
  padding: 8px 16px;
  font-size: 13px;
}

/* Selected Food Info */
.selected-food-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--card-elevated);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
}

.nutrition-preview {
  font-size: 11px;
  color: var(--text-light);
}

.nutrition-preview span {
  margin-left: 6px;
}

/* Search Results */
.search-results {
  max-height: 150px;
  overflow-y: auto;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
}

.search-result-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  transition: background 0.15s ease;
}

.search-result-item:hover {
  background: var(--bg);
}

.search-result-item mark {
  background: var(--primary);
  color: var(--bg);
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

.food-cals {
  font-size: 11px;
  color: var(--text-light);
}

/* Recent Foods */
.recent-foods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.recent-food-chip {
  background: var(--card-elevated);
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.recent-food-chip:hover {
  background: var(--primary);
  color: #0D1117;
  border-color: var(--primary);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #0D1117;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(79, 172, 254, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.45);
}

.btn-secondary {
  background: var(--card-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  width: 90%;
  max-width: 350px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}

.modal-content.compact {
  padding: 18px;
}

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

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

.daily-insight-button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #7dd3fc;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.daily-insight-button:hover { transform: translateY(-1px); background: rgba(79, 172, 254, 0.12); }
.daily-insight-button:focus-visible { outline: 2px solid #7dd3fc; outline-offset: 3px; }
.daily-insight-glyph { font-size: 20px; line-height: 1; transform: translateY(-1px); }

.modal-header h3 {
  font-size: 16px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-light);
}

/* Settings Modal */
.settings-modal {
  max-height: 90vh;
  overflow-y: auto;
}

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  overflow: hidden;
}

.settings-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--card-elevated);
  border-bottom: 1px solid var(--border);
}

.settings-card-icon {
  font-size: 18px;
}

.settings-card-header h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.settings-card-content {
  padding: 16px;
}

.settings-help-text {
  margin: 5px 0 0;
  color: var(--text-light);
  font-size: 11px;
}

.settings-help-text.configured { color: #86efac; }

.btn-save-settings {
  width: 100%;
  margin-top: 8px;
}

/* Theme Grid */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--card-elevated);
}

.theme-option:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.theme-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

.theme-preview {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.theme-preview.dark-theme {
  background: linear-gradient(135deg, #0D1117 0%, #161B22 50%, #21262D 100%);
}

.theme-preview.glossy-theme {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.theme-preview.candy-theme {
  background: linear-gradient(135deg, #FFF8FA 0%, #FFE5ED 50%, #FFD6E5 100%);
  border: 2px solid #FF85A2;
}

.theme-preview.neon-theme {
  background: linear-gradient(135deg, #FF00FF 0%, #0a0a0f 50%, #00FFFF 100%);
  box-shadow: 0 0 10px rgba(255, 0, 255, 0.5);
}

.theme-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.theme-desc {
  font-size: 10px;
  color: var(--text-light);
}

/* Empty State */
.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 15px;
  font-size: 13px;
  opacity: 0.7;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  padding: 12px;
  background: var(--card-elevated);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
}

.history-date {
  font-weight: 600;
  font-size: 13px;
}

.history-stats {
  font-size: 11px;
  color: var(--text-light);
}

/* Quick Log */
.quick-log-preview {
  background: var(--card-elevated);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.quick-log-preview.hidden {
  display: none;
}

/* Suggestion Container */
.suggestion-container {
  border: 2px solid #4a90e2;
  /* Match the blue card */
  background: #1a1f2e;
  /* Dark background like main card */
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
  width: 100%;
}

.suggestion-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8b9dc3;
  /* Muted text */
  font-size: 13px;
  margin-bottom: 8px;
  font-weight: 600;
}

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

.suggestion-chip {
  background: #2d3748;
  border: 1px solid #4a5568;
  color: #e2e8f0;
  border-radius: 16px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
  min-height: 44px;
}

.suggestion-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #4a90e2;
}

.suggestion-chip.active {
  background: rgba(74, 144, 226, 0.15);
  border-color: #4a90e2;
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
}

.chip-primary {
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 2px;
}

.chip-secondary {
  font-size: 11px;
  color: #8b9dc3;
}

.preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#quick-log-food-name {
  font-weight: 600;
  font-size: 14px;
}

.preview-nutrition {
  font-size: 12px;
  color: var(--text-light);
}

.quick-log-error {
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 8px;
  font-size: 13px;
}

.quick-log-error.hidden {
  display: none;
}

/* Log Divider */
.log-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--text-light);
  font-size: 12px;
}

.log-divider::before,
.log-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.log-divider span {
  padding: 0 12px;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Drink Card (Waterminder-style) */
.drink-card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.drink-card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.drink-icon {
  font-size: 32px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

.drink-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  min-width: 140px;
  text-align: center;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237D8590' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.drink-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

.drink-amount-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.amount-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  font-size: 24px;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.amount-btn.minus {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  color: var(--text);
}

.amount-btn.plus {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #0D1117;
}

.amount-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

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

.amount-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: var(--bg);
  padding: 12px 24px;
  border-radius: 16px;
  border: 2px solid var(--border);
  min-width: 120px;
  justify-content: center;
}

.amount-input {
  background: transparent;
  border: none;
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.amount-input:focus {
  outline: none;
}

.amount-unit {
  font-size: 16px;
  color: var(--text-light);
  font-weight: 500;
}

.quick-amounts {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.quick-btn {
  background: var(--card-elevated);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-btn:hover {
  background: var(--primary);
  color: #0D1117;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.quick-btn:active {
  transform: translateY(0);
}

.btn-log-drink {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #0D1117;
  border: none;
  padding: 14px 24px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(79, 172, 254, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-log-drink:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(79, 172, 254, 0.5);
}

.btn-log-drink:active {
  transform: translateY(0);
}

/* Quick Log Grid for Supplements */
.quick-log-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px;
}

.quick-log-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(145deg, var(--card-elevated) 0%, var(--card) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.quick-log-btn:hover {
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(79, 172, 254, 0.4);
}

.quick-log-btn:active {
  transform: translateY(0) scale(0.98);
}

.quick-log-btn .supp-icon {
  font-size: 20px;
  line-height: 1;
}

.quick-log-btn .supp-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.quick-log-btn .supp-dose {
  font-size: 9px;
  color: var(--text-light);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.quick-log-btn:hover .supp-name,
.quick-log-btn:hover .supp-dose {
  color: #0D1117;
}

.quick-log-btn.logging {
  animation: pulse-success 0.5s ease;
}

.quick-log-btn.dragging {
  opacity: 0.45;
  transform: scale(0.95);
}

.quick-log-btn.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: 2px;
  background: var(--card-elevated);
}

.quick-log-btn:active {
  cursor: grabbing;
}

@keyframes pulse-success {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.95);
    background: #4ADE80;
  }

  100% {
    transform: scale(1);
  }
}

/* Supplement Search within Quick Log */
.supp-search-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.supp-search-section input {
  width: 100%;
  padding: 12px 14px;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s ease;
}

.supp-search-section input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

.supp-search-section input::placeholder {
  color: var(--text-light);
  opacity: 0.6;
}

.supp-search-results {
  max-height: 200px;
  overflow-y: auto;
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 8px;
}

.supp-search-results.hidden {
  display: none;
}

.supp-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

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

.supp-search-item:hover {
  background: var(--bg);
}

.supp-search-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.supp-search-item-icon {
  font-size: 18px;
}

.supp-search-item-name {
  font-size: 13px;
  font-weight: 500;
}

.supp-search-item-dose {
  font-size: 11px;
  color: var(--text-light);
}

.supp-search-item-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #0D1117;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.supp-search-item-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(79, 172, 254, 0.4);
}

/* Date Selection Modal List */
.date-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 50vh;
  overflow-y: auto;
  margin-top: 10px;
}

.date-option {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--card-elevated);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.date-option:hover {
  background: rgba(79, 172, 254, 0.1);
  border-color: var(--primary);
}

.date-option.selected-date {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.15) 0%, rgba(0, 245, 255, 0.1) 100%);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.date-option.selected-date::after {
  content: '✓';
  color: var(--primary);
}

/* Date Modal Specific Positioning Override */
#date-modal {
  position: absolute;
  /* Revert default fixed modal behavior */
  top: 60px;
  right: 16px;
  /* Align to the inside right edge of the .container */
  width: auto;
  height: auto;
  align-items: flex-start;
  justify-content: flex-end;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 1000;
}

#date-modal .modal-content {
  margin: 0;
  width: 220px;
  max-width: none;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#date-modal .modal-header {
  display: none;
  /* Hide header completely for dropdown feel */
}

/* Hide scrollbar for date list but keep functionality */
#date-list::-webkit-scrollbar {
  display: none;
}

#date-list {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
  margin-top: 0;
}
/* ============================
   INSIGHTS & TOOLS (TAB 4)
   ============================ */

/* Custom Counters Grid */
.counter-menu-dropdown {
  position: fixed !important;
  z-index: 10000 !important;
}

.counter-menu-dropdown.hidden {
  display: none !important;
}

.dash-counters-grid,
.dashboard-counters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0 16px 0;
}

.counter-card {
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  /* overflow: hidden; */ /* REMOVED - was clipping dropdown menu */
}

/* Base list item wrapper */
.food-item-wrapper {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border); /* iOS Thin hair separator */
}

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

/* Update premium symptom cards specifically for iOS feel */
.premium-symptom-card {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.premium-symptom-card:active {
  background: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="candy"] .premium-symptom-card:active {
  background: rgba(0, 0, 0, 0.03) !important;
}

[data-theme="glossy"] .counter-card {
  background: linear-gradient(145deg, rgba(51, 65, 85, 0.4) 0%, rgba(30, 41, 59, 0.6) 100%) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="candy"] .counter-card {
  background: #FFFFFF;
  border-color: #FFD6E5;
  box-shadow: 0 4px 15px rgba(255, 133, 162, 0.08);
}

.counter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}

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

.counter-icon {
  font-size: 20px;
}

.counter-actions {
  display: flex;
  gap: 6px;
}

.pin-btn, .del-counter-btn {
  font-size: 14px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  background: transparent;
  padding: 2px 4px;
  border-radius: 4px;
  border: none;
  color: var(--text);
}

.pin-btn:hover, .del-counter-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.1);
}

.pin-btn.active {
  opacity: 1;
  filter: drop-shadow(0 0 5px var(--warning));
  color: var(--warning);
}

.counter-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 2px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.counter-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.counter-subtitle {
  font-size: 10px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Emoji Picker Modal Styles */
.emoji-picker-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  z-index: 1000;
  width: 90%;
  max-width: 320px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: scaleIn 0.2s ease-out;
  overflow: hidden;
}

.emoji-picker-popup.hidden {
  display: none !important;
}

.emoji-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.emoji-close-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.emoji-close-btn:hover {
  background: var(--card);
  color: var(--text);
}

.emoji-pages-container {
  position: relative;
  width: 100%;
  height: 240px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  overscroll-behavior: contain;
}

.emoji-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(4, 1fr);
  padding: 8px;
  gap: 2px;
  transition: transform 0.3s ease-out;
  will-change: transform;
}

.emoji-page.hidden {
  display: none;
}

.emoji-page button {
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 10px;
  transition: transform 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.emoji-page button:hover {
  transform: scale(1.1);
  background: var(--card);
}

.emoji-page button:active {
  transform: scale(0.95);
  background: var(--border);
}

.emoji-pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}

.emoji-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.emoji-dot.active {
  background: var(--primary);
  transform: scale(1.2);
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Overlay behind emoji picker */
.emoji-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  animation: fadeIn 0.2s ease-out;
}

.emoji-picker-overlay.hidden {
  display: none;
}

/* Fix date input width in Safari */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  max-width: 100%;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

/* Fix modal content overflow */
.modal-content {
  max-width: 400px;
  width: 90%;
  box-sizing: border-box;
}

.modal-content input,
.modal-content select {
  max-width: 100%;
  box-sizing: border-box;
}

.modal-content select {
  padding-right: 36px !important;
}

/* Nutrition Details Modal styling */
.nutrition-modal-content {
  max-width: 400px;
  width: 90%;
  margin: auto;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.nutrition-modal-body {
  overflow-y: auto;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin; /* Firefox */
  padding-right: 5px; /* space for scroll bar */
}

/* Let's style the native scrollbar for the modal body if scrollable */
.nutrition-modal-body::-webkit-scrollbar {
  width: 6px;
  display: block; /* enable scrollbar visually if overflow */
}
.nutrition-modal-body::-webkit-scrollbar-track {
  background: var(--bg); 
  border-radius: 3px;
}
.nutrition-modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.nutrition-modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

.nutrition-modal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 4px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.nutrition-modal-label {
  font-weight: 500;
  color: var(--text-light);
}

.nutrition-modal-value {
  font-weight: 600;
  color: var(--text);
}

.daily-insight-modal-content {
  max-width: 460px;
  max-height: 93vh;
  overflow-y: auto;
  padding: 22px;
}

.daily-insight-header { align-items: flex-start; }
.daily-insight-header h3 { margin: 5px 0 0; font-size: 21px; }
.daily-insight-eyebrow { display: flex; align-items: center; gap: 6px; color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.daily-insight-eyebrow svg { width: 14px; height: 14px; }
.daily-insight-body { display: flex; flex-direction: column; gap: 16px; }
.daily-insight-snapshot { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255, 255, 255, 0.035); }
.insight-snapshot-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.insight-snapshot-heading .insight-section-title { margin: 0; }
.insight-snapshot-heading > span { color: var(--text-light); font-size: 10px; text-align: right; }
.insight-snapshot-group { display: flex; flex-direction: column; gap: 7px; }
.insight-snapshot-group .insight-section-title { margin-bottom: 0; }
.insight-snapshot-group .insight-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.insight-snapshot-group:first-of-type .insight-metric { border-color: rgba(79, 172, 254, 0.3); }
.insight-snapshot-group:nth-of-type(2) .insight-metric { border-color: rgba(56, 189, 248, 0.35); }
.daily-insight-html { display: flex; flex-direction: column; gap: 10px; }
.daily-insight-html section { padding: 13px 14px; border: 1px solid var(--border); border-radius: 11px; background: rgba(255, 255, 255, 0.035); }
.daily-insight-html h4 { margin: 0 0 6px; color: var(--text); font-size: 14px; }
.daily-insight-html p { margin: 0; color: var(--text-light); font-size: 13px; line-height: 1.55; }
.daily-insight-html strong { color: #fbbf24; font-weight: 800; }
.daily-insight-html ul { margin: 4px 0 0; padding-left: 20px; color: var(--text-light); font-size: 13px; line-height: 1.55; }
.daily-insight-html li { margin: 4px 0; }
.daily-insight-html .ai-note-summary { background: linear-gradient(135deg, rgba(79, 172, 254, 0.14), rgba(167, 139, 250, 0.13)); }
.daily-insight-html .ai-note-hydration { border-color: rgba(56, 189, 248, 0.5); }
.daily-insight-html .ai-note-hydration strong { color: #7dd3fc; }
.daily-insight-html .ai-note-watchout { border-left: 3px solid #fb923c; }
.daily-insight-html .ai-note-watchout.important { border-left-color: #f87171; }
.daily-insight-html .ai-note-watchout.info { border-left-color: #60a5fa; }
.daily-insight-html .ai-note-win { border-color: rgba(74, 222, 128, 0.45); }
.daily-insight-html .ai-note-win strong { color: #86efac; }
.daily-insight-html .ai-note-next { border-color: rgba(167, 139, 250, 0.4); }
.daily-insight-html .ai-note-disclaimer { padding: 2px 4px; border: 0; background: transparent; color: var(--text-light); font-size: 11px; }
.daily-insight-hero { padding: 16px; border-radius: 14px; background: linear-gradient(135deg, rgba(79, 172, 254, 0.18), rgba(167, 139, 250, 0.2)); border: 1px solid rgba(167, 139, 250, 0.25); }
.daily-insight-hero.high { border-color: rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.12); }
.daily-insight-hero h4 { margin: 7px 0 6px; font-size: 18px; }
.daily-insight-hero p, .insight-watchout p { margin: 0; color: var(--text-light); line-height: 1.55; font-size: 13px; }
.insight-risk { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; color: var(--primary); }
.insight-chart, .insight-section { padding-top: 2px; }
.insight-section-title { margin-bottom: 10px; color: var(--text-light); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.insight-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.insight-metric { padding: 10px 11px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255, 255, 255, 0.035); }
.insight-metric span { display: block; color: var(--text-light); font-size: 11px; }
.insight-metric strong { display: block; margin-top: 4px; color: var(--text); font-size: 16px; }
.insight-metric small { color: var(--text-light); font-size: 10px; font-weight: 500; }
@media (min-width: 520px) {
  .insight-snapshot-group .insight-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.insight-watchout { padding: 11px 12px; margin-top: 8px; border-left: 3px solid var(--primary); border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.insight-watchout.important { border-color: #f87171; }.insight-watchout.watch { border-color: #fb923c; }.insight-watchout.info { border-color: #4facfe; }
.insight-watchout strong { display: block; margin-bottom: 4px; font-size: 13px; }
.daily-insight-list { margin: 0; padding-left: 20px; color: var(--text-light); font-size: 13px; line-height: 1.55; }
.daily-insight-list li { margin: 5px 0; }.daily-insight-list.positive { color: #86efac; }.daily-insight-list.next-steps { color: var(--text-light); }
.daily-insight-disclaimer { margin: 0; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-light); font-size: 11px; line-height: 1.45; }
.daily-insight-loading, .daily-insight-error { padding: 28px 8px; color: var(--text-light); text-align: center; line-height: 1.5; }
.daily-insight-error strong { display: block; color: #fca5a5; }.daily-insight-error p { margin: 8px 0; }.daily-insight-error svg { width: 25px; height: 25px; margin-bottom: 8px; color: #f87171; }
.insight-spinner { display: inline-block; width: 18px; height: 18px; margin-right: 8px; vertical-align: -4px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: insight-spin 0.8s linear infinite; }
@keyframes insight-spin { to { transform: rotate(360deg); } }
