/* ── Variables ── */
:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #34d399;
  --primary-bg: #ecfdf5;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --protein-color: #8b5cf6;
  --carbs-color: #f59e0b;
  --fat-color: #ef4444;
  --sugar-color: #ec4899;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --nav-height: 68px;
  --header-height: 56px;
  --transition: 0.2s ease;
}

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

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body { margin: 0; height: 100dvh; height: 100vh; overflow: hidden; }

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: none;
}

/* ── App Shell ── */
#app {
  max-width: 600px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* ── Header ── */
#app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(255,255,255,0.88);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-dark);
}
.logo i { color: var(--primary); }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Main Content ── */
#main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
}
.view.active { display: flex; }

.view-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px calc(16px + var(--nav-height));
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  overscroll-behavior-y: contain;
}

.view-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.view-title i {
  color: var(--primary);
  font-size: 1.1rem;
}

/* ── Bottom Nav ── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition);
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}
.nav-btn i { font-size: 1.25rem; }
.nav-btn span { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.nav-btn.active {
  color: var(--primary);
  position: relative;
}
.nav-btn.active::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}
.nav-btn:active { transform: scale(0.92); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  border: 1px solid transparent;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h3 i { color: var(--primary); font-size: 0.9rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  transition: all 0.25s ease;
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-accent {
  background: linear-gradient(135deg, var(--info), #2563eb);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

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

.btn-block { width: 100%; }

.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg); color: var(--text); }

/* ── Auth Button (Login/Logout toggle) ── */
.btn-auth {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}
.btn-auth i { font-size: 0.82rem; }
.btn-login-style {
  color: var(--primary-dark);
  background: var(--primary-bg);
  border: 1px solid rgba(16,185,129,0.25);
}
.btn-login-style:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.btn-logout-style {
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-logout-style:hover {
  background: var(--danger);
  color: #fff;
}
.btn-login {
  color: var(--primary-dark);
  background: var(--primary-bg);
  border: 1px solid rgba(16,185,129,0.25);
}
.btn-login:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}


/* ── Greeting ── */
.greeting-card {
  padding: 20px;
  background: linear-gradient(135deg, rgba(16,185,129,0.08) 0%, rgba(52,211,153,0.04) 100%);
  border-radius: var(--radius);
  margin-bottom: 14px;
  border: 1px solid rgba(16,185,129,0.12);
}
.greeting-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.greeting-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ── Calorie Ring ── */
.calorie-card {
  text-align: center;
  padding: 28px 24px;
  background: linear-gradient(180deg, var(--surface) 0%, rgba(16,185,129,0.03) 100%);
}
.calorie-ring-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
}
.calorie-ring { width: 100%; height: 100%; }
.calorie-ring circle { transition: stroke-dashoffset 0.8s ease; }
.calorie-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cal-label-top {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.cal-num {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary-dark);
  line-height: 1;
}
.cal-divider { font-size: 0.7rem; color: var(--text-muted); margin: 2px 0; }
.cal-target-num { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.cal-unit { font-size: 0.7rem; color: var(--text-muted); }

.calorie-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
}
.cal-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.cal-meta-item i { color: var(--primary); font-size: 0.9rem; }
.cal-meta-item strong { color: var(--text); }

/* ── Macros Grid ── */
.macros-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.macro-card {
  padding: 14px;
  margin-bottom: 0;
  position: relative;
  overflow: hidden;
}
.macro-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
}
.macro-protein::before { background: var(--protein-color); }
.macro-carbs::before { background: var(--carbs-color); }
.macro-fat::before { background: var(--fat-color); }
.macro-sugar::before { background: var(--sugar-color); }
.macro-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.macro-protein .macro-icon { background: #ede9fe; color: var(--protein-color); }
.macro-carbs .macro-icon { background: #fef3c7; color: var(--carbs-color); }
.macro-fat .macro-icon { background: #fee2e2; color: var(--fat-color); }
.macro-sugar .macro-icon { background: #fce7f3; color: var(--sugar-color); }

.macro-info { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.macro-label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; }
.macro-value { font-size: 1.05rem; font-weight: 700; }

.macro-bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.macro-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.macro-protein .macro-fill { background: var(--protein-color); }
.macro-carbs .macro-fill { background: var(--carbs-color); }
.macro-fat .macro-fill { background: var(--fat-color); }
.macro-sugar .macro-fill { background: var(--sugar-color); }

.macro-target { font-size: 0.7rem; color: var(--text-muted); }

/* ── AI Suggestion ── */
.suggestion-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 50%, rgba(52,211,153,0.08) 100%);
  border: 1px solid #a7f3d0;
  position: relative;
  overflow: hidden;
}
.suggestion-card::after {
  content: '';
  position: absolute;
  right: -20px;
  top: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(16,185,129,0.06);
}
.suggestion-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary-dark);
}
.suggestion-header i { font-size: 1rem; }
.suggestion-header .btn-icon { margin-left: auto; width: 32px; height: 32px; }
.suggestion-body {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 10px;
}
.section-header h2, .section-header h3 {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-header h2 i, .section-header h3 i {
  color: var(--primary);
  font-size: 0.95rem;
}

/* ── Meals List ── */
.meals-list { margin-bottom: 16px; }

.meal-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--border-light);
}
.meal-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.meal-item-photo {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.meal-type-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.meal-type-icon.breakfast { background: #fef3c7; color: #d97706; }
.meal-type-icon.lunch { background: #dbeafe; color: #2563eb; }
.meal-type-icon.dinner { background: #ede9fe; color: #7c3aed; }
.meal-type-icon.snack { background: #fce7f3; color: #db2777; }
.meal-type-icon.drink { background: #e0f2fe; color: #0284c7; }

.meal-item-info { flex: 1; min-width: 0; }
.meal-item-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-item-type { font-size: 0.75rem; color: var(--text-muted); text-transform: capitalize; }
.meal-item-macros {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.meal-item-macros span { display: flex; align-items: center; gap: 3px; }
.meal-item-cal {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-dark);
  white-space: nowrap;
}
.meal-item-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  opacity: 0.7;
  padding: 0;
  line-height: 1;
}
.meal-item-delete:hover, .meal-item-delete:active {
  color: var(--danger);
  background: var(--danger-bg);
  opacity: 1;
}

.exercise-item {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--border-light);
}
.exercise-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.exercise-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #dbeafe;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.exercise-info { flex: 1; }
.exercise-name { font-weight: 600; font-size: 0.9rem; }
.exercise-detail { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.exercise-cals { font-weight: 700; color: var(--info); font-size: 0.9rem; }

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  background: linear-gradient(180deg, transparent, rgba(16,185,129,0.02));
  border-radius: var(--radius-sm);
}
.empty-state i { font-size: 2.2rem; margin-bottom: 10px; display: block; opacity: 0.5; }
.empty-state p { font-size: 0.85rem; line-height: 1.5; }

/* ── Log Tabs ── */
.log-tabs {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 5px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}
.log-tab {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-xs);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.log-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.exercise-type-selector { grid-template-columns: repeat(4, 1fr); }

/* ── Intensity Selector ── */
.intensity-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.intensity-btn {
  padding: 10px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.intensity-btn[data-intensity="easy"].active {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #16a34a;
}
.intensity-btn[data-intensity="moderate"].active {
  border-color: var(--warning);
  background: #fffbeb;
  color: #d97706;
}
.intensity-btn[data-intensity="intense"].active {
  border-color: var(--danger);
  background: #fef2f2;
  color: #dc2626;
}

/* ── Calorie Estimate Row ── */
.cal-estimate-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.cal-estimate-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
}
.cal-estimate-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.cal-estimate-row .btn { white-space: nowrap; }

/* ── Photo Card ── */
.photo-card { text-align: center; }
.photo-preview {
  width: 100%;
  height: 200px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 14px;
  transition: all 0.3s ease;
  background: linear-gradient(180deg, transparent, rgba(16,185,129,0.03));
}
.photo-preview:hover {
  border-color: var(--primary);
  background: rgba(16,185,129,0.04);
}
.photo-preview i { font-size: 2.5rem; margin-bottom: 8px; opacity: 0.6; }
.photo-preview p { font-size: 0.85rem; }

.photo-img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.photo-actions {
  display: flex;
  gap: 8px;
}
.photo-actions .btn {
  flex: 1;
  font-size: 0.82rem;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
}

/* ── Analysis Result ── */
.analysis-title {
  color: var(--info);
  font-size: 0.95rem;
}
.analysis-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.analysis-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
}
.analysis-item-name { font-weight: 500; }
.analysis-item-cals { font-weight: 600; color: var(--primary-dark); }


/* ── Selectable Analysis Items ── */
.analysis-item-select {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  margin-bottom: 6px;
  transition: opacity 0.2s;
}
.analysis-item-select:has(input[type=checkbox]:not(:checked)) {
  opacity: 0.45;
  text-decoration: line-through;
}
.analysis-check {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-top: 6px;
  flex-shrink: 0;
}
.analysis-check input[type=checkbox] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}
.analysis-item-detail {
  flex: 1;
  min-width: 0;
}
.analysis-edit-name {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  padding: 2px 0;
  border-bottom: 1px dashed rgba(0,0,0,0.15);
  outline: none;
  font-family: inherit;
}
.analysis-edit-name:focus {
  border-bottom-color: var(--primary);
}
.analysis-edit-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.analysis-edit-row label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 14px;
  text-align: right;
}
.analysis-edit-cal,
.analysis-edit-macro {
  width: 52px;
  padding: 3px 4px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  font-size: 0.78rem;
  text-align: center;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.analysis-edit-cal { width: 58px; font-weight: 600; color: var(--primary-dark); }
.analysis-edit-cal:focus,
.analysis-edit-macro:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.15);
}

/* Analysis Totals Bar */
.analysis-totals-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--primary-bg), rgba(16,185,129,0.08));
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.analysis-total-label {
  font-weight: 600;
  color: var(--primary-dark);
  margin-right: 4px;
}
.analysis-total-item {
  color: var(--text-secondary);
}
.analysis-total-item strong {
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
}
.analysis-actions-bar {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}
.btn-sm {
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.btn-outline {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.15);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Meal Form ── */
.meal-form-card { margin-top: 0; }
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.25s ease;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
  background: rgba(16,185,129,0.02);
}
.form-row textarea { resize: vertical; }
.form-row .optional { font-weight: 400; color: var(--text-muted); font-size: 0.75rem; }

.form-row-half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meal-type-selector {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.meal-type-btn {
  padding: 10px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.meal-type-btn i { font-size: 1rem; }
.meal-type-btn.active {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary-dark);
}

.nutrition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.nutri-input { position: relative; }
.nutri-input label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.nutri-input input {
  width: 100%;
  padding: 10px 30px 10px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
  text-align: center;
}
.nutri-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.nutri-unit {
  position: absolute;
  right: 8px;
  bottom: 10px;
  font-size: 0.72rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Chat ── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.chat-welcome {
  text-align: center;
  padding: 40px 20px;
}
.chat-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 14px;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.35);
  animation: floatAvatar 3s ease-in-out infinite;
}
@keyframes floatAvatar {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.chat-welcome h3 { font-size: 1.1rem; margin-bottom: 6px; }
.chat-welcome p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 16px;
}
.quick-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  background: var(--surface);
}
.quick-advice-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  background: var(--surface);
}
.quick-advice-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16,185,129,0.15);
}

.quick-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16,185,129,0.15);
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  margin-bottom: 8px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
  animation: fadeInUp 0.3s ease;
}
.chat-bubble.user {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 6px;
}
.chat-bubble.assistant {
  background: var(--surface);
  color: var(--text);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow);
}
.chat-bubble.assistant .logged-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--primary-bg);
  color: var(--primary-dark);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
}
.chat-bubble.assistant .logged-badge i { font-size: 0.7rem; }

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: var(--surface);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  width: fit-content;
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.chat-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: calc(12px + var(--nav-height));
}
.chat-input-bar input {
  flex: 1;
  padding: 11px 18px;
  background: var(--bg);
  border-radius: 24px;
  border: 1.5px solid var(--border);
  font-size: 0.9rem;
  transition: all 0.25s ease;
}
.chat-input-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.1);
  background: var(--surface);
}
.btn-send {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.btn-send:hover { background: var(--primary-dark); }

/* ── History ── */
.date-nav-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, var(--surface) 0%, rgba(16,185,129,0.03) 100%);
}
.date-display {
  text-align: center;
  flex: 1;
}
.date-display input[type="date"] {
  border: none;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  cursor: pointer;
  padding: 4px;
}
.date-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-macros {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.history-macro {
  text-align: center;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-xs);
}
.hm-label { display: block; font-size: 0.7rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.hm-value { display: block; font-size: 1.2rem; font-weight: 700; color: var(--text); }
.hm-unit { font-size: 0.7rem; color: var(--text-muted); }

.weekly-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 140px;
  padding-top: 10px;
}
.week-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.week-bar-fill {
  width: 100%;
  max-width: 32px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(to top, var(--primary-dark), var(--primary), var(--primary-light));
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 3px;
  box-shadow: 0 2px 4px rgba(16,185,129,0.2);
}
.week-bar-fill.over-target {
  background: linear-gradient(to top, var(--warning), #fbbf24);
}
.week-bar-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
}
.week-bar-val {
  font-size: 0.6rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Profile ── */
.profile-form { display: flex; flex-direction: column; gap: 2px; }

.notice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--info-bg);
  border: 1px solid #bfdbfe;
  color: var(--info);
}
.notice-card i { font-size: 1.2rem; flex-shrink: 0; }
.notice-card p { font-size: 0.85rem; }

.bmi-display {
  text-align: center;
  margin-bottom: 14px;
}
.bmi-number {
  font-size: 2.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
.bmi-cat {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
}
.bmi-bar-wrap { margin-top: 8px; }
.bmi-bar {
  height: 8px;
  border-radius: 4px;
  display: flex;
  overflow: hidden;
  position: relative;
  margin-bottom: 6px;
}
.bmi-zone { height: 100%; }
.bmi-under { background: #93c5fd; }
.bmi-normal { background: #86efac; }
.bmi-over { background: #fcd34d; }
.bmi-obese { background: #fca5a5; }
.bmi-indicator {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid white;
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
  transition: left 0.4s ease;
}
.bmi-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 2px;
}

/* ── Loading Overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.loading-spinner {
  background: var(--surface);
  padding: 32px 40px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
.loading-spinner p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.3s ease;
  max-width: 90%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--primary-dark); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

/* ── Login Screen ── */
.login-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 20px;
  animation: loginFadeIn 0.25s ease;
}
.login-modal-overlay.hidden {
  display: none !important;
}
.login-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
@keyframes loginFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-card {
  background: var(--surface);
  border-radius: 24px;
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
}
.login-modal-card {
  position: relative;
  z-index: 1;
  animation: loginSlideUp 0.3s ease;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-icon {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin: 0 auto 16px;
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.35);
  animation: floatAvatar 3s ease-in-out infinite;
}
.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary-dark);
}
.login-logo p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}
.login-field {
  margin-bottom: 16px;
}
.login-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.login-field label i {
  width: 16px;
  color: var(--text-muted);
}
.login-field input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.login-btn {
  margin-top: 8px;
  padding: 14px;
  font-size: 1rem;
}
.login-error {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
}
.login-toggle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 16px;
  cursor: pointer;
}
.login-toggle strong {
  color: var(--primary);
}
.login-toggle span:hover strong {
  text-decoration: underline;
}

.login-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
}

/* ── Privacy & Disclaimer ── */
.privacy-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.privacy-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.privacy-list li i {
  color: var(--primary);
  font-size: 0.85rem;
  margin-top: 2px;
  flex-shrink: 0;
}
.disclaimer-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.disclaimer-card h3 i { color: var(--warning) !important; }
.disclaimer-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

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

/* ── Animations ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .nutrition-grid { grid-template-columns: 1fr 1fr; }
  .history-macros { grid-template-columns: repeat(4, 1fr); }
}



/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }


/* ── Fitness Plan ── */
.sport-type-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px; margin-top: 8px;
}
.sport-type-btn {
  padding: 10px 8px; border-radius: 10px; border: 2px solid var(--border, #e2e8f0);
  background: var(--bg2, #f8fafc); cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all 0.2s; text-align: center;
}
.sport-type-btn.active {
  border-color: var(--primary); background: var(--primary-bg);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
.sport-type-btn:hover { border-color: var(--primary); }
.difficulty-selector { display: flex; gap: 8px; margin-top: 8px; }
.diff-btn {
  flex: 1; padding: 10px; border-radius: 10px; border: 2px solid var(--border, #e2e8f0);
  background: var(--bg2, #f8fafc); cursor: pointer; font-weight: 600; font-size: 13px;
  transition: all 0.2s; text-align: center;
}
.diff-btn.active {
  border-color: var(--primary); background: var(--primary-bg);
  color: var(--primary-dark);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
.plan-card { overflow: hidden; }
.plan-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.plan-meta { font-size: 12px; color: var(--text-dim, #94a3b8); }
.plan-overview { font-size: 13px; color: var(--text-dim, #94a3b8); margin: 8px 0; }
.progress-bar {
  width: 100%; height: 6px; background: var(--border, #e2e8f0);
  border-radius: 3px; margin: 8px 0 12px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 3px;
  transition: width 0.6s ease;
}
.plan-days { display: flex; flex-direction: column; gap: 4px; }
.plan-day {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; transition: all 0.2s;
  background: var(--bg2, #f8fafc); border: 1px solid var(--border, #e2e8f0);
}
.plan-day:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
  transform: translateY(-1px);
}
.plan-day.done { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.3); }
.plan-day.done .day-check { color: #22c55e; }
.plan-day.rest { opacity: 0.7; }
.day-num {
  width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}
.plan-day.rest .day-num { background: var(--border, #cbd5e1); }
.day-info { flex: 1; min-width: 0; }
.day-info strong { font-size: 13px; display: block; }
.day-dur { font-size: 11px; color: var(--text-dim, #94a3b8); }
.day-rest { font-size: 11px; color: #f59e0b; font-weight: 600; }
.day-check { font-size: 20px; color: var(--border, #cbd5e1); }
.day-exercises {
  padding: 8px 12px 8px 56px; font-size: 12px; background: rgba(99,102,241,0.03);
  border-left: 3px solid rgba(99,102,241,0.2); margin-left: 16px;
}
.day-exercises.collapsed { display: none; }
.plan-day.done + .day-exercises { display: block; }
.ex-item { padding: 3px 0; display: flex; gap: 8px; align-items: baseline; }
.ex-item strong { min-width: 120px; }
.ex-item em { color: var(--text-dim, #94a3b8); font-style: normal; font-size: 11px; }
.ex-warmup, .ex-cooldown { padding: 4px 0; color: var(--text-dim, #94a3b8); font-style: italic; }
.plan-tips { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border, #e2e8f0); }
.plan-tips h4 { font-size: 13px; margin-bottom: 6px; }
.plan-tips ul { padding-left: 20px; font-size: 12px; color: var(--text-dim, #94a3b8); }
.plan-tips li { margin-bottom: 4px; }
.advice-input-row { display: flex; gap: 8px; margin-bottom: 8px; }
.quick-advice-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.advice-result { margin-top: 12px; }
.advice-text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

/* ── Weight-editable analysis items ── */
.analysis-val {
  display: inline-block;
  min-width: 28px;
  padding: 2px 6px;
  font-size: 0.82rem;
  text-align: center;
  color: var(--text);
  font-family: inherit;
  background: rgba(0,0,0,0.04);
  border: none;
  border-radius: 4px;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}
.analysis-val-cal {
  min-width: 42px;
  font-weight: 700;
  color: var(--primary-dark);
}
.analysis-weight-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}
.analysis-weight-row label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  min-width: 18px;
}
.analysis-weight-row label i {
  font-size: 0.7rem;
}
.analysis-edit-weight {
  width: 62px;
  padding: 4px 6px;
  border: 1.5px solid var(--primary);
  border-radius: 6px;
  font-size: 0.82rem;
  text-align: center;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.analysis-edit-weight:focus {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 2px rgba(16,185,129,0.2);
}
.analysis-weight-unit {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
}


/* ── Manual Add Item ── */
#manual-add-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.add-item-panel {
  margin-top: 10px;
}
.add-item-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.add-item-search-row .form-input {
  flex: 1;
  margin: 0;
}
.food-search-results {
  margin-top: 8px;
  max-height: 280px;
  overflow-y: auto;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.food-result-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  transition: background 0.15s;
}
.food-result-item:last-child { border-bottom: none; }
.food-result-item:hover { background: rgba(16, 185, 129, 0.05); }
.food-result-info { flex: 1; min-width: 0; }
.food-result-name {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 3px;
}
.food-result-macros {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.food-result-macros .cal-val {
  font-weight: 700;
  color: var(--primary-dark);
}
.food-result-portion-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.food-portion-input {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  text-align: center;
  background: var(--bg);
  color: var(--text);
}
.food-portion-input:focus {
  border-color: var(--primary);
  outline: none;
}
.food-result-default {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 2px;
}
.food-add-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, background 0.15s;
  box-shadow: 0 2px 6px rgba(16,185,129,0.3);
}
.food-add-btn:hover { transform: scale(1.1); }
.food-add-btn:active { transform: scale(0.95); background: var(--primary-dark); }
.food-search-loading {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.food-search-ai-badge {
  font-size: 0.7rem;
  background: var(--primary);
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 6px;
  vertical-align: middle;
}


/* ═══ DARK MODE ═══ */
[data-theme="dark"] {
  --primary: #34d399;
  --primary-dark: #10b981;
  --primary-light: #6ee7b7;
  --primary-bg: rgba(16, 185, 129, 0.1);
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --border-light: #1e293b;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --warning-bg: rgba(245, 158, 11, 0.1);
  --info-bg: rgba(59, 130, 246, 0.1);
  --shadow: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
}

[data-theme="dark"] .login-modal-overlay {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}
[data-theme="dark"] .login-card {
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
[data-theme="dark"] .suggestion-card {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}
[data-theme="dark"] .meal-type-icon.breakfast { background: rgba(217, 119, 6, 0.15); }
[data-theme="dark"] .meal-type-icon.lunch { background: rgba(37, 99, 235, 0.15); }
[data-theme="dark"] .meal-type-icon.dinner { background: rgba(124, 58, 237, 0.15); }
[data-theme="dark"] .meal-type-icon.snack { background: rgba(219, 39, 119, 0.15); }
[data-theme="dark"] .meal-type-icon.drink { background: rgba(2, 132, 199, 0.15); }
[data-theme="dark"] .macro-protein .macro-icon { background: rgba(139, 92, 246, 0.15); }
[data-theme="dark"] .macro-carbs .macro-icon { background: rgba(245, 158, 11, 0.15); }
[data-theme="dark"] .macro-fat .macro-icon { background: rgba(239, 68, 68, 0.15); }
[data-theme="dark"] .macro-sugar .macro-icon { background: rgba(236, 72, 153, 0.15); }
[data-theme="dark"] .history-macro { background: var(--border); }
[data-theme="dark"] .history-macro[style*="background:#dbeafe"] { background: rgba(37, 99, 235, 0.15) !important; }
[data-theme="dark"] .history-macro[style*="background:#ecfdf5"] { background: rgba(5, 150, 105, 0.15) !important; }
[data-theme="dark"] .disclaimer-card { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.2); }
[data-theme="dark"] .notice-card { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.2); }
[data-theme="dark"] .btn-primary {
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}
[data-theme="dark"] .photo-preview { border-color: var(--border); }
[data-theme="dark"] .analysis-item-select { background: var(--border); }
[data-theme="dark"] .analysis-edit-weight { background: var(--surface); color: var(--text); }
[data-theme="dark"] .analysis-edit-name { color: var(--text); }
[data-theme="dark"] .analysis-totals-bar { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.2); }
[data-theme="dark"] .week-bar-fill { background: linear-gradient(to top, var(--primary-dark), var(--primary)); }
[data-theme="dark"] .exercise-icon { background: rgba(37, 99, 235, 0.15); }
[data-theme="dark"] .sport-type-btn { background: var(--border); }
[data-theme="dark"] #bottom-nav { background: rgba(15, 23, 42, 0.92); }
[data-theme="dark"] #app-header { background: rgba(30, 41, 59, 0.88); }
[data-theme="dark"] .btn-login-style { color: var(--primary); background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.2); }
[data-theme="dark"] .btn-login-style:hover { background: var(--primary); color: #fff; }
[data-theme="dark"] .greeting-card { background: linear-gradient(135deg, rgba(16,185,129,0.06) 0%, rgba(52,211,153,0.02) 100%); border-color: rgba(16,185,129,0.1); }
[data-theme="dark"] .calorie-card { background: linear-gradient(180deg, var(--surface) 0%, rgba(16,185,129,0.03) 100%); }
[data-theme="dark"] .macro-card::before { opacity: 0.7; }
[data-theme="dark"] .meal-item { border-color: var(--border); }
[data-theme="dark"] .exercise-item { border-color: var(--border); }
[data-theme="dark"] .date-nav-card { background: linear-gradient(135deg, var(--surface) 0%, rgba(16,185,129,0.03) 100%); }
[data-theme="dark"] .quick-btn { background: var(--surface); }
[data-theme="dark"] .diff-btn { background: var(--border); }
[data-theme="dark"] .plan-day { background: var(--border); }
[data-theme="dark"] .food-search-results { background: var(--surface); }
[data-theme="dark"] .food-result-item:hover { background: rgba(16, 185, 129, 0.12); }
[data-theme="dark"] .food-portion-input { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .log-tab { color: var(--text-secondary); }
[data-theme="dark"] .quick-btn { border-color: var(--border); color: var(--text-secondary); }
[data-theme="dark"] .quick-advice-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  background: var(--surface);
}
.quick-advice-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-bg);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(16,185,129,0.15);
}

.quick-btn:hover { background: rgba(16, 185, 129, 0.1); }
[data-theme="dark"] .cal-num { color: var(--primary); }
[data-theme="dark"] .bmi-indicator { background: var(--text); border-color: var(--surface); }
[data-theme="dark"] .greeting-card h2 {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  background-clip: text;
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  color: var(--text) !important;
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

/* ═══ Quick Add Card ═══ */
.quick-add-card {
  background: linear-gradient(135deg, var(--primary-bg), rgba(16, 185, 129, 0.04));
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.quick-add-card h3 {
  color: var(--primary-dark);
}
.quick-add-hint {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: -8px 0 12px;
}
.quick-add-card .add-item-search-row .form-input {
  padding: 12px 16px;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
}
.quick-add-card .add-item-search-row .btn {
  height: 46px;
  min-width: 46px;
  border-radius: var(--radius-sm);
}

/* ═══ Voice Input ═══ */
.voice-active {
  color: var(--danger) !important;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══ Chat TTS Button ═══ */
.chat-tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  margin-top: 8px;
  float: right;
  transition: all 0.2s;
}
.chat-tts-btn:hover {
  background: var(--primary-bg);
  color: var(--primary-dark);
}
[data-theme="dark"] .chat-tts-btn {
  background: rgba(255,255,255,0.08);
}
[data-theme="dark"] .chat-tts-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
}



/* ── Plan Notes Input ── */
.plan-notes-input {
  resize: vertical;
  min-height: 48px;
  max-height: 160px;
  line-height: 1.55;
  padding: 12px 14px !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.88rem;
  transition: all 0.25s ease;
}
.plan-notes-input:focus {
  min-height: 72px;
}

/* ── Barcode Scanner Modal ── */
.barcode-modal {
  position: fixed;
  inset: 0;
  z-index: 6000;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.barcode-modal.hidden { display: none !important; }
.barcode-modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.barcode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.barcode-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.barcode-header h3 i { color: var(--primary); }
#barcode-reader {
  width: 100%;
  min-height: 250px;
}
#barcode-reader video { border-radius: 0 !important; }
.barcode-hint {
  text-align: center;
  padding: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Pricing Modal ── */
.pricing-modal {
  position: fixed;
  inset: 0;
  z-index: 5500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: loginFadeIn 0.25s ease;
}
.pricing-modal.hidden { display: none !important; }
.pricing-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.pricing-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: 24px;
  padding: 36px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.15);
  animation: loginSlideUp 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.pricing-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.pricing-close:hover { background: var(--bg); color: var(--text); }
.pricing-header {
  text-align: center;
  margin-bottom: 24px;
}
.pricing-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 14px;
  box-shadow: 0 6px 20px rgba(245,158,11,0.3);
}
.pricing-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.pricing-header p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.pricing-toggle {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}
.pricing-period {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pricing-period.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.pricing-save {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
}
.pricing-amount {
  text-align: center;
  margin-bottom: 20px;
}
.pricing-currency {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-secondary);
  vertical-align: top;
}
.pricing-number {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.pricing-per {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}
.pricing-features {
  list-style: none;
  margin-bottom: 24px;
}
.pricing-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.88rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}
.pricing-features li:last-child { border-bottom: none; }
.pricing-features li i {
  color: var(--primary);
  width: 20px;
  text-align: center;
  font-size: 0.85rem;
}
.pricing-cta {
  padding: 14px;
  font-size: 1rem;
  margin-bottom: 10px;
}
.pricing-disclaimer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.pricing-free-features {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.pricing-free-features h4 {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.pricing-free-features p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ── Subscription Badge ── */
.sub-card { }
.sub-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.sub-free {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.sub-premium {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(217,119,6,0.1));
  color: #d97706;
  border: 1px solid rgba(245,158,11,0.3);
}
.sub-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ── Upgrade Banner ── */
.upgrade-banner {
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(217,119,6,0.04));
  border: 1px solid rgba(245,158,11,0.2) !important;
  padding: 14px 18px !important;
}
.upgrade-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.upgrade-banner-text {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.upgrade-banner-text > i {
  font-size: 1.4rem;
  color: #d97706;
}
.upgrade-banner-text strong {
  font-size: 0.9rem;
  display: block;
}
.upgrade-banner-text p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Dark theme additions */
[data-theme="dark"] .pricing-card { background: var(--surface); }
[data-theme="dark"] .pricing-period.active { background: var(--border); }
[data-theme="dark"] .pricing-free-features { background: var(--border); }
[data-theme="dark"] .barcode-modal-content { background: var(--surface); }
[data-theme="dark"] .sub-free { background: var(--border); }
[data-theme="dark"] .upgrade-banner { background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(217,119,6,0.03)); }
[data-theme="dark"] .quick-advice-btn { background: var(--surface); border-color: var(--border); color: var(--text-secondary); }
[data-theme="dark"] .quick-advice-btn:hover { background: rgba(16,185,129,0.1); }

/* ═══ Responsive Layout ═══ */

/* Small phone (under 380px) */
@media (max-width: 380px) {
  html { font-size: 13.5px; }
  .view-scroll { padding: 12px 10px calc(12px + var(--nav-height)); }
  .card { padding: 14px; border-radius: 12px; }
  .greeting-card h2 { font-size: 1.3rem; }
  .calorie-ring-wrap { width: 140px; height: 140px; }
  .cal-num { font-size: 1.8rem; }
  .macros-grid { grid-template-columns: 1fr; gap: 8px; }
  .sport-type-grid { grid-template-columns: repeat(2, 1fr); }
  .meal-type-selector { flex-wrap: wrap; }
  .meal-type-btn { font-size: 0.72rem; padding: 6px 8px; }
  .exercise-type-grid, .exercise-type-selector { grid-template-columns: repeat(2, 1fr); }
  .nutrition-grid { grid-template-columns: 1fr 1fr; }
  .analysis-edit-row { flex-wrap: wrap; }
  .food-result-macros { font-size: 0.7rem; gap: 4px; }
  .nav-btn span { font-size: 0.58rem; }
  .nav-btn i { font-size: 1.05rem; }
  .calorie-meta { gap: 12px; flex-wrap: wrap; justify-content: center; }
  .cal-meta-item { font-size: 0.75rem; }
  .difficulty-selector { flex-direction: column; gap: 6px; }
  .chat-bubble { max-width: 92%; font-size: 0.84rem; }
  .btn { padding: 10px 16px; font-size: 0.84rem; }
  .history-macros { grid-template-columns: repeat(2, 1fr); }
  .photo-actions { flex-direction: column; }
}

/* Regular phone (380-600px) */
@media (min-width: 381px) and (max-width: 600px) {
  .sport-type-grid { grid-template-columns: repeat(3, 1fr); }
  .macros-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .history-macros { grid-template-columns: repeat(4, 1fr); }
  .exercise-type-selector { grid-template-columns: repeat(3, 1fr); }
}

/* Tablet portrait (601-900px) */
@media (min-width: 601px) {
  #app { max-width: 720px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  #bottom-nav { max-width: 720px; }
  .nutrition-grid { grid-template-columns: repeat(3, 1fr); }
  .sport-type-grid { grid-template-columns: repeat(5, 1fr); }
  .meal-type-selector { gap: 6px; }
  .card { padding: 22px; }
  .view-scroll { padding: 20px 20px calc(20px + var(--nav-height)); }
  .macros-grid { grid-template-columns: repeat(4, 1fr); }
  .form-row-half { display: flex; gap: 12px; }
  .form-row-half .form-row { flex: 1; }
  .history-macros { grid-template-columns: repeat(4, 1fr); }
  .exercise-type-selector { grid-template-columns: repeat(4, 1fr); }
  .greeting-card h2 { font-size: 1.6rem; }
  .calorie-ring-wrap { width: 200px; height: 200px; }
  .cal-num { font-size: 2.5rem; }
  .analysis-items { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .chat-bubble { max-width: 75%; }
  .plan-days { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .day-exercises { margin-left: 0; grid-column: 1 / -1; }
  .photo-preview { height: 260px; }
  .photo-img { max-height: 360px; }
}

/* Tablet landscape / small desktop (900px+) */
@media (min-width: 901px) {
  #app { max-width: 860px; }
  #bottom-nav { max-width: 860px; height: 72px; }
  .nav-btn { gap: 4px; }
  .nav-btn i { font-size: 1.3rem; }
  .nav-btn span { font-size: 0.7rem; }
  .nutrition-grid { grid-template-columns: repeat(3, 1fr); }
  .sport-type-grid { grid-template-columns: repeat(5, 1fr); }
  .exercise-type-grid, .exercise-type-selector { grid-template-columns: repeat(6, 1fr); }
  .plan-days { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .day-exercises { grid-column: 1 / -1; }
  .card { padding: 24px; }
  .view-scroll { padding: 24px 24px calc(24px + var(--nav-height)); }
  .macros-grid { grid-template-columns: repeat(4, 1fr); }
  .greeting-card h2 { font-size: 1.7rem; }
  .calorie-ring-wrap { width: 220px; height: 220px; }
  .cal-num { font-size: 2.8rem; }
  .chat-bubble { max-width: 65%; }
  .photo-preview { height: 300px; }
  .photo-img { max-height: 400px; }
  .analysis-items { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .quick-actions { gap: 10px; }
  .quick-btn { padding: 10px 18px; font-size: 0.84rem; }
}

/* Large desktop (1200px+) */
@media (min-width: 1200px) {
  #app { max-width: 960px; }
  #bottom-nav { max-width: 960px; }
  .plan-days { grid-template-columns: repeat(3, 1fr); }
}

/* ═══ PHOTO THUMBNAILS ═══ */
.photo-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 0;
}
.photo-thumb {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: visible;
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}
.photo-thumb-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid #fff;
  padding: 0;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.photo-thumb-num {
  position: absolute;
  bottom: 2px;
  left: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.photo-thumb-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  border: 2px dashed var(--border);
  font-size: 0.7rem;
  font-weight: 600;
}
.photo-thumb-add i { font-size: 1.2rem; }
.photo-thumb-add:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
