/* =============================================================
   JÍDELNÍCKOVAČ — Modern Fitness UI
   Dark theme, glassmorphism, neon accents
   ============================================================= */

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

:root {
  --bg-0: #090b14;
  --bg-1: #0d1021;
  --bg-2: #131629;
  --bg-3: #1a1e35;
  --bg-4: #212540;
  --card: #161928;
  --card-hover: #1c2035;
  --border: rgba(255,255,255,0.07);
  --border-bright: rgba(255,255,255,0.14);

  --blue: #4f9ef0;
  --blue-dark: #3380d4;
  --green: #00d4a3;
  --green-dark: #00b890;
  --orange: #ff8c42;
  --purple: #a855f7;
  --red: #f0614f;
  --yellow: #ffd700;

  /* Makro barvy */
  --mc-kcal:    #8b5cf6;
  --mc-protein: #4f9ef0;
  --mc-carbs:   #16a34a;
  --mc-fat:     #eab308;

  --text-primary: #f0f4ff;
  --text-secondary: #8892b0;
  --text-muted: #4a5068;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);

  --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
  background: var(--bg-0);
  color: var(--text-primary);
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── LAYOUT ────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  width: 100%;
  max-width: none;
  overflow: hidden;
}

/* ─── HEADER ────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  background: rgba(9,11,20,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

/* ─── DAILY STATUS BAR ──────────────────────────────────────── */
.daily-status-bar {
  position: sticky;
  top: 50px;
  z-index: 99;
  flex-shrink: 0;
  background: rgba(13,15,26,0.97);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.dsb-inner {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 20px;
  height: 46px;
}
.dsb-item {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* Donut pie */
.dsb-pie-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.dsb-pie {
  width: 34px;
  height: 34px;
  transform: rotate(-90deg);
}
.dsb-pie-track {
  fill: none;
  stroke: var(--bg-4);
  stroke-width: 3.5;
}
.dsb-pie-fill {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 0 75.4;
  transition: stroke-dasharray 0.5s ease, stroke 0.3s;
}
.dsb-pie-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7.5px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

/* Text next to pie */
.dsb-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dsb-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}
.dsb-vals {
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.dsb-val   { font-size: 14px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.4px; line-height: 1; }
.dsb-sep   { font-size: 10px; color: var(--text-muted); }
.dsb-muted { font-size: 11px; color: var(--text-secondary); }
.dsb-unit  { font-size: 9px; color: var(--text-muted); margin-left: 1px; }

.dsb-divider {
  width: 1px; height: 22px; background: var(--border);
  margin: 0 16px; flex-shrink: 0;
}
.dsb-remaining-item {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.dsb-remaining-val {
  font-size: 12px; font-weight: 700; color: var(--text-secondary);
  background: var(--bg-2); padding: 3px 10px; border-radius: 20px;
  border: 1px solid var(--border);
}
.dsb-remaining-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 5px;
  min-height: 0;
  overflow: hidden;
  flex-wrap: nowrap;
}
.dsb-rem-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}
.dsb-rem-chips {
  display: flex;
  gap: 5px;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}
.dsb-rem-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.dsb-rem-chip:hover { background: var(--bg-3); border-color: var(--blue); }
.dsb-rem-icon { font-size: 11px; }
.dsb-rem-name { font-size: 10px; font-weight: 600; color: var(--text-primary); }
.dsb-rem-mac  { font-size: 9px; color: var(--text-muted); }
.dsb-rem-proj {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 8px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}
.dsb-rem-proj-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }
.dsb-rem-proj-val   { font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.dsb-rem-proj-val.ok { color: var(--green); }
.dsb-rem-proj-sep   { font-size: 9px; color: var(--text-muted); }
.dsb-rem-proj-bar {
  width: 48px; height: 4px; background: var(--bg-4); border-radius: 2px; overflow: hidden; flex-shrink: 0;
}
.dsb-rem-proj-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.dsb-rem-proj-pct { font-size: 10px; font-weight: 700; }
.dsb-rem-all-done {
  font-size: 11px; font-weight: 600; color: var(--green);
  padding: 3px 20px 5px; letter-spacing: 0.2px;
}

.dsb-macro-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 20px 6px;
  min-height: 18px;
}

.dsb-macro-card {
  width: 132px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dsb-macro-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dsb-macro-name {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dsb-macro-status {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}

.dsb-macro-vals {
  display: none;
}

.dsb-macro-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-3);
  overflow: hidden;
}

.dsb-macro-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
}

.dsb-macro-overflow {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: rgba(240,97,79,0.9);
}

.dsb-macro-target {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: calc(100% - 1px);
  width: 2px;
  background: rgba(255,255,255,0.85);
  opacity: 0.9;
}

.dsb-macro-card.ok .dsb-macro-status { color: var(--green); }
.dsb-macro-card.under .dsb-macro-status { color: var(--text-muted); }
.dsb-macro-card.over .dsb-macro-status { color: var(--red); }

.dsb-progress-track {
  height: 3px; background: var(--bg-3); overflow: hidden;
}
.dsb-progress-fill {
  height: 100%; background: var(--blue);
  transition: width 0.5s ease, background 0.3s;
}
[data-theme="light"] .daily-status-bar { background: rgba(237,240,247,0.98); }
[data-theme="light"] .dsb-pie-track    { stroke: var(--bg-4); }
[data-theme="light"] .dsb-remaining-val { background: var(--bg-3); }
[data-theme="light"] .dsb-rem-chip { background: var(--bg-1); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  gap: 16px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.logo-text {
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.logo-sub { display: none; }

/* ─── NAVIGATION ────────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.nav-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-direction: column;
}

.nav-tab:hover {
  background: var(--bg-3);
  color: var(--text-primary);
}

.nav-tab.active {
  background: linear-gradient(135deg, rgba(79,158,240,0.2), rgba(0,212,163,0.15));
  color: var(--blue);
  border-color: rgba(79,158,240,0.3);
}

.nav-tab .tab-icon { font-size: 17px; line-height: 1; }
.nav-tab .tab-label { font-size: 9px; color: inherit; opacity: 0.75; line-height: 1; }
.nav-tab.active .tab-label { opacity: 1; }
.nav-tab:hover .tab-label { opacity: 1; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid rgba(79,158,240,0.3);
}

/* ─── MAIN CONTENT ──────────────────────────────────────────── */
.app-main { flex: 1; min-height: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.tab-content { display: none; }
.tab-content.active { display: block; flex: 1; min-height: 0; overflow-y: auto; padding: 24px; }
.tab-assistant-full.active { display: flex; padding: 0; overflow: hidden; height: 100%; }

/* ─── DASHBOARD ─────────────────────────────────────────────── */
.dashboard-hero {
  background: linear-gradient(135deg, #0d1021 0%, #131842 50%, #0f1a1f 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.dashboard-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(79,158,240,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.dashboard-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: 20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(0,212,163,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(420px, 1fr);
  gap: 24px;
  align-items: start;
}

.hero-left {}

.hero-greeting {
  font-size: 13px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.hero-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), rgba(240,244,255,0.7));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.hero-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
}

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

.dash-coach {
  height: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.12));
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 430px;
}

.dash-coach-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 26px;
  color: var(--text-secondary);
  font-size: 12px;
}

.dash-coach-meta span {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.07);
}

.dash-coach-time {
  color: var(--text-primary);
  font-size: clamp(58px, 7vw, 104px);
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.dash-coach-date {
  color: var(--text-secondary);
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 22px;
}

.dash-coach-rating {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.dash-coach-message {
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.45;
  max-width: 760px;
}

.dash-coach-message p { margin: 0 0 8px; }
.dash-coach-message p:last-child { margin-bottom: 0; }
.dash-coach-message ul { margin: 8px 0 0 18px; }

.dash-coach-briefing {
  border-left: 3px solid rgba(96,221,178,0.75);
  padding-left: 18px;
}

.dash-brief-grid {
  display: grid;
  gap: 8px;
}

.dash-brief-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: start;
}

.dash-brief-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-top: 4px;
}

.dash-brief-text {
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.38;
}

.dash-brief-text strong {
  color: var(--green);
  font-weight: 850;
}

.dash-coach-loading {
  position: relative;
}

.dash-coach-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 9px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: var(--green);
  vertical-align: -2px;
  animation: dashCoachSpin 0.8s linear infinite;
}

.dash-coach-stale {
  opacity: 0.78;
}

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

.dash-coach-input-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  align-items: end;
  margin-top: auto;
  padding-top: 22px;
}

.dash-coach-input {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.22);
  color: var(--text-primary);
  padding: 11px 12px;
  font: inherit;
  line-height: 1.35;
}

.dash-coach-input:focus {
  outline: none;
  border-color: rgba(79,158,240,0.5);
}

.dash-coach-send {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: white;
  cursor: pointer;
}

.dash-coach-send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.dash-coach-send svg {
  width: 18px;
  height: 18px;
}

.hero-right {
  min-width: 0;
  width: 100%;
  align-self: start;
}

.dash-snapshot {
  height: 520px;
  min-height: 520px;
  max-height: 520px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-md);
  background: rgba(0,0,0,0.12);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-intake-bars {
  flex: 1 1 auto;
  min-height: 210px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dash-intake-bar {
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.045);
  padding: 12px 10px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.dash-intake-top {
  min-width: 0;
}

.dash-intake-label {
  display: block;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.dash-intake-top strong {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.1;
  white-space: normal;
}

.dash-intake-track {
  position: relative;
  min-height: 142px;
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(to top, color-mix(in srgb, var(--bar-color) 20%, transparent), color-mix(in srgb, var(--bar-color) 8%, transparent)),
    rgba(0,0,0,0.18);
  border: 1px solid color-mix(in srgb, var(--bar-color) 24%, rgba(255,255,255,0.10));
}

.dash-intake-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--fill-pct);
  min-height: 3px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bar-color) 84%, white 16%), var(--bar-color));
  box-shadow: 0 -10px 28px color-mix(in srgb, var(--bar-color) 28%, transparent);
  transition: height 0.35s ease;
}

.dash-intake-target {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--target-pct);
  border-top: 2px dashed rgba(255,255,255,0.76);
  z-index: 2;
}

.dash-intake-target span {
  position: absolute;
  right: 5px;
  bottom: 4px;
  color: var(--text-primary);
  background: rgba(0,0,0,0.42);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.dash-intake-current {
  position: absolute;
  left: 50%;
  bottom: clamp(8px, var(--fill-pct), calc(100% - 26px));
  transform: translate(-50%, 50%);
  z-index: 3;
  color: var(--text-primary);
  background: rgba(7,10,22,0.84);
  border: 1px solid color-mix(in srgb, var(--bar-color) 52%, rgba(255,255,255,0.18));
  border-radius: 7px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(0,0,0,0.22);
}

.dash-intake-bar.over .dash-intake-current {
  border-color: rgba(239,68,68,0.72);
  color: #fecaca;
}

.dash-intake-bar.hit .dash-intake-current {
  color: #bbf7d0;
}

.dash-intake-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 750;
}

.dash-intake-foot b {
  color: var(--text-primary);
  font-size: 12px;
}

.dash-snapshot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.dash-snapshot-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.dash-snapshot-title {
  color: var(--text-primary);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.18;
  max-width: 520px;
}

.dash-ai-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dash-ai-summary.loading::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.8;
  vertical-align: 2px;
  animation: dashAiPulse 1s ease-in-out infinite;
}

@keyframes dashAiPulse {
  0%, 100% { transform: scale(0.75); opacity: 0.45; }
  50% { transform: scale(1.15); opacity: 1; }
}

.dash-snapshot-pill {
  flex-shrink: 0;
  color: var(--text-primary);
  background: rgba(79,158,240,0.14);
  border: 1px solid rgba(79,158,240,0.22);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.dash-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dash-snapshot-grid-compact {
  flex: 0 0 auto;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dash-mini-card {
  min-height: 64px;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dash-mini-label {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.dash-mini-val {
  color: var(--blue);
  font-size: 16px;
  font-weight: 850;
  line-height: 1.05;
}

.dash-mini-text {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.25;
}

.dash-mini-unit {
  color: var(--text-secondary);
  font-size: 11px;
  margin-top: 4px;
}

.dash-snapshot-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.dash-snapshot-strip div {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.12);
  padding: 9px 10px;
}

.dash-snapshot-strip span,
.dash-snapshot-strip small {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.dash-snapshot-strip strong {
  display: block;
  color: var(--text-primary);
  font-size: 17px;
  margin-top: 4px;
}

.dash-snapshot-notes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.dash-snapshot-notes span {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  font-size: 12px;
}

/* ─── STATS GRID ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  background: var(--card-hover);
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.stat-card-val {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-unit {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── MACRO RINGS ────────────────────────────────────────────── */
.macro-rings-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.macro-ring-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}

.macro-ring-card:hover {
  background: var(--card-hover);
  transform: translateY(-2px);
}

.macro-ring-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
}

.macro-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.macro-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.macro-ring-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.macro-ring-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.macro-ring-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.macro-ring-unit { font-size: 12px; color: var(--text-secondary); margin-left: 2px; }
.macro-ring-target { font-size: 11px; color: var(--text-muted); }
.macro-ring-remaining {
  font-size: 11px; font-weight: 600; margin-top: 3px;
  color: var(--text-muted);
}
.macro-ring-remaining.over { color: #ef4444; }

/* ─── DASHBOARD GRID ─────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.dash-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.dash-panel h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

/* Today meals */
.today-meal-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.today-meal-item:last-child { border-bottom: none; }
.today-meal-item:hover { padding-left: 8px; }

.today-meal-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.today-meal-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.today-meal-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.kcal-badge, .protein-badge, .time-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.kcal-badge { background: rgba(79,158,240,0.15); color: var(--blue); }
.protein-badge { background: rgba(79,158,240,0.1); color: var(--blue); }
.time-badge { background: rgba(255,255,255,0.05); color: var(--text-secondary); }

/* Week highlights */
.highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.highlight-icon {
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  width: 16px;
}

/* ─── DAY SELECTOR ───────────────────────────────────────────── */
.day-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.day-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  min-width: 80px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.day-btn:hover {
  background: var(--card-hover);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.day-btn.active {
  background: linear-gradient(135deg, rgba(79,158,240,0.25), rgba(0,212,163,0.15));
  border-color: var(--blue);
  color: var(--blue);
}

.day-btn .day-short {
  font-size: 16px;
  font-weight: 800;
}

.day-btn .day-kcal {
  font-size: 10px;
  opacity: 0.7;
}

/* ─── DAY PLAN ───────────────────────────────────────────────── */
.day-header {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.day-header-info { flex: 1; }

.day-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.day-theme {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.prep-note {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,212,163,0.1);
  border: 1px solid rgba(0,212,163,0.2);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  color: var(--green);
}

.day-totals-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  min-width: 500px;
}

.day-total-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.day-total-num {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.day-total-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.day-total-bar {
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

.day-total-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ─── MEAL CARDS ─────────────────────────────────────────────── */
.meals-list { display: flex; flex-direction: column; gap: 12px; }

.meal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.meal-card:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-sm);
}

.meal-card.expanded {
  border-color: rgba(79,158,240,0.3);
  box-shadow: 0 0 0 1px rgba(79,158,240,0.1), var(--shadow-md);
}

.meal-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
}

.meal-type-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.meal-card-title { flex: 1; min-width: 0; }

.meal-card-title h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meal-meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.meal-time { font-size: 12px; color: var(--text-secondary); }

.prepped-badge {
  font-size: 11px;
  background: rgba(0,212,163,0.15);
  color: var(--green);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

.prep-time { font-size: 12px; color: var(--text-muted); }

.meal-macros-quick {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}

.quick-macro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 40px;
}

.quick-macro svg { display: block; }

.qm-val {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.qm-label {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}

.qm-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1;
  margin-top: 6px;
}

.expand-arrow {
  color: var(--text-muted);
  font-size: 12px;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.expand-arrow.up { transform: rotate(180deg); }

/* ─── MEAL CARD BODY ─────────────────────────────────────────── */
.meal-card-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

.prep-origin-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,212,163,0.08);
  border: 1px solid rgba(0,212,163,0.15);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  margin: 16px 0;
  font-size: 13px;
  color: var(--green);
}

.meal-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 16px;
}

.meal-ingredients h4,
.meal-instructions h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ingredients-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ingredient-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.ing-amount {
  font-weight: 700;
  color: var(--blue);
  min-width: 60px;
  flex-shrink: 0;
}

.ing-name { flex: 1; }

.ing-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.instructions-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.instructions-list li {
  font-size: 13px;
  color: var(--text-secondary);
  padding-left: 4px;
}

.storage-tip, .nutrition-note {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.storage-tip {
  background: rgba(168,85,247,0.08);
  border: 1px solid rgba(168,85,247,0.15);
  color: rgba(168,85,247,0.9);
}

.nutrition-note {
  background: rgba(79,158,240,0.08);
  border: 1px solid rgba(79,158,240,0.15);
  color: rgba(79,158,240,0.9);
}

/* Macro bars */
.macro-bar-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

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

.macro-bar-label { font-size: 12px; color: var(--text-secondary); }
.macro-bar-val { font-size: 13px; font-weight: 700; }

.macro-bar-track {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.macro-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.macro-bar-pct {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── MEAL PREP ──────────────────────────────────────────────── */
.prep-intro {
  background: linear-gradient(135deg, rgba(0,212,163,0.08), rgba(79,158,240,0.05));
  border: 1px solid rgba(0,212,163,0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.prep-intro h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--green);
}

.prep-intro p { color: var(--text-secondary); font-size: 14px; }

.prep-timeline { display: flex; flex-direction: column; gap: 20px; margin-bottom: 40px; }

.prep-session-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.prep-session-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

.prep-day-badge {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--blue), var(--green));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  flex-shrink: 0;
}

.prep-session-info { flex: 1; }
.prep-session-info h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.prep-covers { font-size: 13px; color: var(--text-secondary); }

.prep-duration {
  text-align: center;
  background: rgba(79,158,240,0.1);
  border: 1px solid rgba(79,158,240,0.2);
  border-radius: var(--radius-md);
  padding: 12px 20px;
}

.prep-duration-num {
  font-size: 28px;
  font-weight: 900;
  color: var(--blue);
  line-height: 1;
}

.prep-duration-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.prep-tabs {
  display: flex;
  gap: 1px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
}

.prep-tab-btn {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.prep-tab-btn:hover { background: var(--bg-3); color: var(--text-secondary); }
.prep-tab-btn.active { background: var(--card); color: var(--blue); }

.prep-tab-content { padding: 20px 24px; }
.prep-tab-content.hidden { display: none; }

.prep-tasks { display: flex; flex-direction: column; gap: 16px; }

.prep-task-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: var(--transition);
}

.prep-task-item.done {
  opacity: 0.5;
  text-decoration: line-through;
}

.prep-task-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.prep-task-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-bright);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.prep-task-checkbox:hover { border-color: var(--green); }
.prep-task-checkbox.checked { background: var(--green); border-color: var(--green); }

.prep-task-checkbox svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: white;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: var(--transition);
}

.prep-task-checkbox.checked svg { opacity: 1; }

.prep-task-main { flex: 1; }
.prep-task-main strong { font-size: 14px; }

.prep-task-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.prep-task-meta span {
  font-size: 12px;
  color: var(--text-secondary);
}

.prep-task-detail {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.6;
}

.prep-task-storage {
  font-size: 12px;
  color: var(--purple);
  padding: 6px 10px;
  background: rgba(168,85,247,0.08);
  border-radius: var(--radius-sm);
}

.prep-tips-list { display: flex; flex-direction: column; gap: 10px; }

.prep-tip-item {
  padding: 12px 16px;
  background: rgba(255,215,0,0.05);
  border: 1px solid rgba(255,215,0,0.1);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.prep-shopping-list { display: flex; flex-direction: column; gap: 8px; }

.prep-shop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

/* ─── SHOPPING LIST ──────────────────────────────────────────── */
.shopping-section { margin-bottom: 40px; }
.shopping-section h2 { font-size: 20px; font-weight: 800; margin-bottom: 16px; }

.shopping-total {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,212,163,0.08);
  border: 1px solid rgba(0,212,163,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
}

.shopping-note { color: var(--text-muted); font-size: 12px; }

.shopping-section-block { margin-bottom: 24px; }
.shopping-section-block h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }

.shopping-items { display: flex; flex-direction: column; gap: 8px; }

.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.shopping-item:hover { background: var(--card-hover); }

.shopping-item.done {
  opacity: 0.4;
  text-decoration: line-through;
}

.shopping-check {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-bright);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shopping-check svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: white;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shopping-item-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.shopping-item-name { font-size: 14px; font-weight: 600; }
.shopping-item-amount { font-size: 12px; color: var(--text-secondary); }

.shopping-item-right { text-align: right; }
.shopping-item-price { display: block; font-size: 13px; font-weight: 700; color: var(--green); }
.shopping-item-note { display: block; font-size: 11px; color: var(--text-muted); }

/* ─── WEEK STATS ─────────────────────────────────────────────── */
.week-stats-section { margin-bottom: 40px; }
.week-stats-section h2 { font-size: 20px; font-weight: 800; margin-bottom: 16px; }

.week-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.week-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.week-stat-val { font-size: 24px; font-weight: 800; line-height: 1; margin-bottom: 2px; }
.week-stat-unit { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.week-stat-label { font-size: 12px; color: var(--text-secondary); }

/* ─── DATABASE ───────────────────────────────────────────────── */
.db-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.db-search-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
}

.db-search {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.db-search:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,158,240,0.1);
}

.db-search::placeholder { color: var(--text-muted); }

.db-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }

.filter-btn.active {
  background: rgba(79,158,240,0.15);
  border-color: rgba(79,158,240,0.4);
  color: var(--blue);
}

.db-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.food-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.food-card:hover {
  background: var(--card-hover);
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.food-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.food-emoji { font-size: 24px; }

.food-cat-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.food-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.food-macros-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.food-macro {
  text-align: center;
  padding: 6px 4px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
}

.food-macro-val {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
}

.food-macro-label {
  font-size: 10px;
  color: var(--text-muted);
}

.food-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.food-price { font-size: 12px; color: var(--text-secondary); }

.food-stores { display: flex; gap: 4px; }

.store-badge {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.food-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.food-detail.hidden { display: none; }

.food-detail-section {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.food-detail-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.food-detail-macros span { font-size: 12px; }

.food-prep-tip {
  background: rgba(255,215,0,0.06);
  border: 1px solid rgba(255,215,0,0.1);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: rgba(255,215,0,0.8);
}

/* ─── CALCULATOR ─────────────────────────────────────────────── */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 24px;
}

.calc-form-panel, .calc-results-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.calc-form-panel h2, .calc-results-panel h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 24px;
}

.calc-form { display: flex; flex-direction: column; gap: 16px; }

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input, .form-group select {
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,158,240,0.1);
}

.form-group select option {
  background: var(--bg-2);
  color: var(--text-primary);
}

.calc-btn {
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 8px;
}

.calc-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(79,158,240,0.3);
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.result-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.result-card.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(79,158,240,0.15), rgba(0,212,163,0.1));
  border-color: rgba(79,158,240,0.3);
  text-align: center;
  padding: 24px;
}

.result-main-val {
  font-size: 48px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}

.result-main-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.result-main-sub { font-size: 13px; color: var(--text-secondary); }

.result-val { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.result-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.result-note { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.macro-targets { margin-bottom: 20px; }
.macro-targets h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }

.macro-targets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.macro-target-card {
  background: var(--bg-2);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.mt-val { font-size: 24px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.mt-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.mt-kcal { font-size: 11px; color: var(--text-muted); }
.mt-pct { font-size: 13px; font-weight: 700; margin-top: 4px; }

.safety-warning {
  padding: 12px 16px;
  background: rgba(240,97,79,0.1);
  border: 1px solid rgba(240,97,79,0.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 13px;
  margin-bottom: 16px;
}

.safety-ok {
  padding: 12px 16px;
  background: rgba(0,212,163,0.08);
  border: 1px solid rgba(0,212,163,0.2);
  border-radius: var(--radius-sm);
  color: var(--green);
  font-size: 13px;
  margin-bottom: 16px;
}

.results-method-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 12px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
}

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

/* ─── SECTION TITLES ─────────────────────────────────────────── */
.section-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .calc-layout { grid-template-columns: 1fr; }
  .hero-content { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .day-totals-grid { min-width: unset; grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .tab-content.active { padding: 16px; }
  .dashboard-hero { padding: 18px; }
  .dash-coach,
  .dash-snapshot {
    height: auto;
    min-height: auto;
    max-height: none;
    padding: 16px;
  }
  .dash-coach-time { font-size: 58px; }
  .dash-coach-message { font-size: 15px; }
  .dash-brief-row { grid-template-columns: 1fr; gap: 3px; }
  .dash-intake-bars { grid-template-columns: repeat(2, minmax(0, 1fr)); min-height: auto; }
  .dash-intake-track { min-height: 150px; }
  .dash-snapshot-grid,
  .dash-snapshot-strip { grid-template-columns: 1fr; }
  .dash-coach-input-row { grid-template-columns: 1fr 42px; }
  .meal-detail-grid { grid-template-columns: 1fr; }
  .macro-rings-grid { grid-template-columns: repeat(2, 1fr); }
  .macro-bar-row { grid-template-columns: 1fr; }
  .day-header { flex-direction: column; }
  .day-totals-grid { min-width: unset; grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-tabs { overflow-x: auto; justify-content: flex-start; }
  .nav-tab .tab-label { display: none; }
  .results-grid { grid-template-columns: 1fr; }
  .macro-targets-grid { grid-template-columns: 1fr; }
  .meal-macros-quick { flex-wrap: wrap; }
  .food-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 480px) {
  .header-inner { padding: 0 16px; }
  .logo-text { font-size: 15px; }
  .day-selector { gap: 6px; }
  .day-btn { min-width: 60px; padding: 10px 10px; }
  .dash-intake-bars { gap: 8px; }
  .dash-intake-bar { padding: 10px 8px; }
  .dash-intake-track { min-height: 132px; }
  .dash-intake-top strong { font-size: 12px; }
  .dash-intake-current,
  .dash-intake-target span { font-size: 9px; }
}

/* =============================================================
   PROGRESS & DATE-AWARE EXTENSIONS
   ============================================================= */

/* ─── MEAL CHECK BUTTON ──────────────────────────────────────── */
.meal-check-btn {
  width: 30px; height: 30px; min-width: 30px;
  border-radius: 50%;
  border: 2px solid var(--border-bright);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
  flex-shrink: 0;
}
.meal-check-btn:hover { border-color: var(--green); background: rgba(0,212,163,0.1); }
.meal-check-btn.checked { background: var(--green); border-color: var(--green); }
.meal-check-btn svg { width: 14px; height: 14px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity var(--transition); }
.meal-check-btn.checked svg { opacity: 1; }

.meal-card-done .meal-card-header { opacity: 0.65; }
.strikethrough { text-decoration: line-through; opacity: 0.6; }
.done-badge { font-size: 11px; background: rgba(0,212,163,0.15); color: var(--green); padding: 2px 8px; border-radius: 20px; font-weight: 700; }

.meal-check-full { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.meal-check-full-btn {
  width: 100%; padding: 12px; border-radius: var(--radius-md); border: 2px dashed var(--border-bright);
  background: transparent; color: var(--text-secondary); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.meal-check-full-btn:hover { border-color: var(--green); color: var(--green); background: rgba(0,212,163,0.05); }
.meal-check-full-btn.done { background: rgba(0,212,163,0.1); border-color: var(--green); color: var(--green); border-style: solid; }

/* ─── TODAY MEALS WITH CHECKBOXES ────────────────────────────── */
.today-meal-item { display: flex; align-items: center; gap: 12px; }
.today-meal-check { width: 24px; height: 24px; min-width: 24px; border-radius: 50%; border: 2px solid var(--border-bright); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); flex-shrink: 0; }
.today-meal-check.checked { background: var(--green); border-color: var(--green); }
.today-meal-check svg { width: 12px; height: 12px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transition: opacity var(--transition); }
.today-meal-check.checked svg { opacity: 1; }
.today-meal-content { flex: 1; cursor: pointer; }
.today-meal-item.meal-done .today-meal-name { text-decoration: line-through; opacity: 0.5; }

/* ─── DAY DATE BADGE ─────────────────────────────────────────── */
.day-date-badge { display: inline-block; font-size: 13px; font-weight: 500; padding: 4px 12px; border-radius: 20px; margin-left: 10px; vertical-align: middle; }
.day-date-badge.today { background: rgba(0,212,163,0.15); color: var(--green); border: 1px solid rgba(0,212,163,0.3); }
.day-date-badge.past { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.day-date-badge.future { background: rgba(79,158,240,0.1); color: var(--blue); }

/* ─── DAY COMPLETION BAR ─────────────────────────────────────── */
.day-completion-bar { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.dcb-track { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.dcb-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 3px; transition: width 0.6s ease; }
.dcb-text { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

/* ─── DAY BTN DOTS ────────────────────────────────────────────── */
.day-btn { position: relative; }
.day-date { font-size: 11px; color: var(--text-secondary); }
.day-dots { display: flex; gap: 3px; justify-content: center; padding: 2px 0; }
.day-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border-bright); }
.day-dot.done { background: var(--green); }
.day-btn.today { border-color: var(--green); }
.day-btn.today .day-short { color: var(--green); }
.day-btn.past { opacity: 0.6; }

/* ─── WEEK NAVIGATOR ─────────────────────────────────────────── */
.week-navigator { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 20px; margin-bottom: 16px; }
.week-nav-btn { padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-2); color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition); }
.week-nav-btn:hover { border-color: var(--blue); color: var(--blue); }
.week-nav-center { text-align: center; }
.week-nav-label { font-size: 15px; font-weight: 700; }
.week-nav-this { font-size: 11px; color: var(--green); margin-top: 2px; }

/* ─── PROGRESS DASHBOARD ─────────────────────────────────────── */
.progress-section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
@media (max-width: 900px) { .progress-section-grid { grid-template-columns: 1fr; } }

.progress-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; }
.progress-card-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 14px; }

/* Day progress */
.day-progress-visual { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.day-progress-bar-wrap { flex: 1; height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.day-progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); border-radius: 4px; transition: width 0.5s ease; }
.day-progress-text { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.day-progress-num { font-size: 22px; font-weight: 900; color: var(--green); line-height: 1; }
.day-progress-sep { font-size: 16px; color: var(--text-muted); }
.day-progress-total { font-size: 14px; color: var(--text-secondary); }
.day-progress-pct { font-size: 12px; color: var(--text-muted); margin-left: 4px; }

.consumed-macros { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

/* Week grid */
.week-meal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 10px; }
.week-day-mini { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 4px; text-align: center; }
.week-day-mini.today { border-color: var(--green); background: rgba(0,212,163,0.08); }
.week-day-mini.past { opacity: 0.6; }
.week-day-mini.future { opacity: 0.7; }
.wdm-day { font-size: 10px; font-weight: 700; color: var(--text-secondary); }
.wdm-date { font-size: 9px; color: var(--text-muted); margin-bottom: 4px; }
.wdm-circles { display: flex; gap: 2px; justify-content: center; margin-bottom: 4px; }
.wdm-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-bright); }
.wdm-dot.done { background: var(--green); }
.wdm-pct { font-size: 10px; color: var(--text-muted); }
.week-overall { font-size: 13px; color: var(--text-secondary); }
.week-overall-pct { display: inline-block; background: rgba(0,212,163,0.15); color: var(--green); padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 700; margin-left: 8px; }

/* Weight / goal */
.weight-log-form { margin-bottom: 14px; }
.weight-log-form label { font-size: 12px; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.weight-input-row { display: flex; gap: 8px; }
.weight-input { flex: 1; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 15px; font-weight: 700; outline: none; }
.weight-input:focus { border-color: var(--blue); }
.weight-save-btn { padding: 10px 16px; border-radius: var(--radius-sm); border: none; background: linear-gradient(135deg, var(--blue), var(--green)); color: white; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.weight-save-btn:hover { opacity: 0.9; }

.goal-progress { margin-top: 10px; }
.goal-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.goal-bar-track { height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.goal-bar-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--green)); border-radius: 4px; transition: width 0.6s ease; }
.goal-stats { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.goal-eta { font-size: 12px; color: var(--blue); }

/* Stats mini */
.stats-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stats-mini-item { background: var(--bg-2); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.smi-val { font-size: 22px; font-weight: 900; line-height: 1; }
.smi-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* Next prep teaser */
.next-prep-item { display: flex; align-items: center; gap: 10px; background: rgba(79,158,240,0.08); border: 1px solid rgba(79,158,240,0.15); border-radius: var(--radius-sm); padding: 10px 14px; }
.next-prep-icon { font-size: 22px; }
.next-prep-label { font-size: 12px; font-weight: 700; }
.next-prep-when { font-size: 12px; color: var(--text-secondary); }

/* ─── PREP TIMELINE ──────────────────────────────────────────── */
.prep-week-block { margin-bottom: 8px; }
.prep-week-title { display: flex; align-items: center; justify-content: space-between; font-size: 18px; font-weight: 800; margin-bottom: 16px; }
.prep-week-dates { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.prep-timeline-row { display: flex; align-items: flex-start; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.ptc-connector { font-size: 24px; color: var(--text-muted); align-self: center; flex-shrink: 0; padding: 0 4px; }

.prep-timeline-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; min-width: 200px; flex: 1; transition: var(--transition);
}
.prep-timeline-card.past { opacity: 0.5; }
.prep-timeline-card.today { border-color: var(--green); box-shadow: 0 0 0 1px rgba(0,212,163,0.2); }

.ptc-icon { font-size: 24px; margin-bottom: 8px; }
.ptc-date { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.ptc-diff { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; margin-bottom: 8px; }
.ptc-diff.today { background: rgba(0,212,163,0.2); color: var(--green); }
.ptc-diff.past { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.ptc-diff.future { background: rgba(79,158,240,0.15); color: var(--blue); }
.ptc-label { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.ptc-duration { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.ptc-covers { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }

.ptc-tasks { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.ptc-task { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }
.ptc-task.done { opacity: 0.4; text-decoration: line-through; }
.ptc-check { width: 18px; height: 18px; min-width: 18px; border: 1.5px solid var(--border-bright); border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.ptc-check svg { width: 10px; height: 10px; fill: none; stroke: white; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ptc-task.done .ptc-check { background: var(--green); border-color: var(--green); }
.ptc-task.done .ptc-check svg { opacity: 1; }

/* ─── PROGRESS TAB ───────────────────────────────────────────── */
.progress-main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .progress-main-grid { grid-template-columns: 1fr; } }

.prog-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.prog-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.prog-wide { grid-column: 1 / -1; }

/* Weight chart */
.weight-add-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.weight-date-display { font-size: 13px; color: var(--text-secondary); }
.weight-chart { margin-bottom: 16px; min-height: 100px; }
.weight-chart-empty { text-align: center; padding: 30px; color: var(--text-muted); font-size: 13px; }
.weight-chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 0 4px; }
.weight-bar-item { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 40px; }
.weight-bar-val { font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.weight-bar-track { width: 100%; flex: 1; background: var(--bg-2); border-radius: 4px 4px 0 0; display: flex; align-items: flex-end; }
.weight-bar-fill { width: 100%; border-radius: 4px 4px 0 0; background: var(--blue); transition: height 0.5s ease; min-height: 4px; }
.weight-bar-fill.goal { background: var(--green); }
.weight-bar-date { font-size: 10px; color: var(--text-muted); }
.weight-goal-line { font-size: 11px; color: var(--green); margin-top: 4px; }

.weight-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.weight-stat { background: var(--bg-2); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.ws-val { font-size: 18px; font-weight: 800; }
.ws-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* Adherence grid */
.adherence-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.adh-day { background: var(--bg-2); border-radius: var(--radius-sm); padding: 8px 4px; text-align: center; }
.adh-day.today { border: 1px solid var(--green); }
.adh-day.past { opacity: 0.7; }
.adh-date { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
.adh-dots { display: flex; flex-direction: column; gap: 2px; align-items: center; margin-bottom: 4px; }
.adh-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-bright); }
.adh-dot.done { background: var(--green); }
.adh-dot.missed { background: rgba(240,97,79,0.4); }
.adh-pct { font-size: 10px; color: var(--text-muted); }

/* Goal big visual */
.goal-big-visual { margin-bottom: 16px; }
.goal-big-numbers { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.gbn-start, .gbn-current, .gbn-goal { font-size: 20px; font-weight: 800; }
.gbn-arrow { font-size: 16px; color: var(--text-muted); }
.goal-big-bar { height: 10px; background: rgba(255,255,255,0.06); border-radius: 5px; overflow: hidden; margin-bottom: 6px; }
.goal-big-fill { height: 100%; background: linear-gradient(90deg, var(--orange), var(--green)); border-radius: 5px; transition: width 0.8s ease; }
.goal-big-pct { font-size: 13px; color: var(--text-secondary); text-align: center; }
.goal-remaining { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }
.goal-eta-box { font-size: 13px; color: var(--blue); background: rgba(79,158,240,0.08); border: 1px solid rgba(79,158,240,0.15); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; }

.streak-display { display: flex; align-items: center; gap: 8px; }
.streak-fire { font-size: 28px; }
.streak-num { font-size: 36px; font-weight: 900; color: var(--orange); line-height: 1; }
.streak-label { font-size: 14px; color: var(--text-secondary); }

/* Settings */
.settings-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.settings-item { background: var(--bg-2); border-radius: var(--radius-sm); padding: 10px 14px; }
.si-label { font-size: 11px; color: var(--text-muted); }
.si-val { font-size: 14px; font-weight: 600; }
.si-note { max-width: 380px; margin-top: 3px; color: var(--text-muted); font-size: 10px; line-height: 1.4; }
.today-axis-setting { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.settings-switch { position: relative; width: 42px; height: 24px; flex: 0 0 42px; cursor: pointer; }
.settings-switch input { position: absolute; opacity: 0; pointer-events: none; }
.settings-switch span { position: absolute; inset: 0; border: 1px solid var(--border-bright); border-radius: 999px; background: var(--bg-4); transition: var(--transition); }
.settings-switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: var(--transition); }
.settings-switch input:checked + span { border-color: rgba(0,212,163,0.5); background: rgba(0,212,163,0.2); }
.settings-switch input:checked + span::after { transform: translateX(18px); background: var(--green); }
.settings-switch input:focus-visible + span { outline: 3px solid rgba(79,158,240,0.28); outline-offset: 2px; }
.danger-btn { width: 100%; padding: 10px; border-radius: var(--radius-sm); border: 1px solid rgba(240,97,79,0.3); background: rgba(240,97,79,0.1); color: var(--red); font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--transition); }
.danger-btn:hover { background: rgba(240,97,79,0.2); }

/* Old pref button styles removed — replaced by slider system above */

/* ═══ SHOPPING TRIGGER BUTTON ══════════════════════════════════ */
.shopping-trigger-btn { background: rgba(0,212,163,0.1); border: 1px solid rgba(0,212,163,0.35); color: var(--green); font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 8px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.shopping-trigger-btn:hover { background: rgba(0,212,163,0.2); }

/* ═══ MODAL OVERLAY ════════════════════════════════════════════ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.78); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal-box { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; width: 100%; max-width: 580px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-box-wide { max-width: 680px; }
@media (min-width: 640px) {
  .modal-overlay { align-items: center; padding: 20px; }
  .modal-box { border-radius: var(--radius); }
}
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; padding: 0 4px; line-height: 1; transition: color 0.15s; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { overflow-y: auto; padding: 16px 20px; flex: 1; }

.confirm-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.timeline-context-menu {
  position: fixed;
  z-index: 1300;
  min-width: 200px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(15,23,42,0.96);
  border: 1px solid var(--border);
  box-shadow: 0 18px 46px rgba(0,0,0,0.32);
}

.timeline-context-menu.hidden {
  display: none;
}

.timeline-context-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.timeline-context-item:hover {
  background: rgba(79,158,240,0.12);
  color: #fff;
}

.extra-meal-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.extra-meal-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.extra-meal-name-wrap {
  position: relative;
}

.extra-meal-inline-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 5;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15,23,42,0.97);
  box-shadow: 0 18px 40px rgba(0,0,0,0.28);
}

.extra-meal-inline-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text-primary);
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
}

.extra-meal-inline-item:hover {
  background: rgba(79,158,240,0.12);
}

.extra-meal-inline-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.extra-meal-inline-macros,
.extra-meal-inline-empty {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.extra-meal-textarea {
  min-height: 86px;
  resize: vertical;
}

.extra-meal-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.extra-meal-photo-preview {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(79,158,240,0.18);
  background: rgba(79,158,240,0.06);
  border-radius: 12px;
}

.extra-meal-photo-thumb {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  border: 1px solid rgba(255,255,255,0.08);
}

.extra-meal-photo-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.extra-meal-photo-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}

.extra-meal-photo-remove {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.extra-meal-photo-remove:hover {
  border-color: rgba(240,97,79,0.4);
  color: var(--red);
}

.extra-meal-ai-btn {
  border: 1px solid rgba(79,158,240,0.28);
  background: rgba(79,158,240,0.08);
  color: var(--blue);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.extra-meal-ai-btn:hover {
  background: rgba(79,158,240,0.14);
}

.extra-meal-ai-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.extra-meal-search-block {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.extra-meal-search-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.extra-meal-search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.extra-meal-result {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
}

.extra-meal-result:hover {
  border-color: rgba(79,158,240,0.35);
  background: rgba(79,158,240,0.06);
}

.extra-meal-result-name {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.extra-meal-result-macros,
.extra-meal-empty {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.extra-meal-right-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

/* ═══ SWAP OPTIONS ═════════════════════════════════════════════ */
.swap-options-list { overflow-y: auto; padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.swap-option { padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.swap-option:hover { border-color: var(--blue); background: rgba(79,158,240,0.04); }
.swap-option.swap-active { border-color: var(--green); }
.swap-option.swap-reset { border-style: dashed; border-color: rgba(255,255,255,0.15); }
.swap-option.swap-reset:hover { border-color: var(--orange); }
.swap-opt-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.swap-opt-name { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.swap-opt-badges { display: flex; gap: 5px; flex-wrap: wrap; flex-shrink: 0; }
.swap-pref-badge { font-size: 10px; background: rgba(255,215,0,0.15); color: #ffd700; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.swap-current-badge { font-size: 10px; background: rgba(0,212,163,0.15); color: var(--green); padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.swap-opt-macros { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }
.swap-opt-meta { display: flex; gap: 7px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
.swap-tag { background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 4px; }
.swap-empty { padding: 24px; text-align: center; color: var(--text-muted); }

/* ═══ SWAP BUTTON ON MEAL CARD ════════════════════════════════ */
.swap-meal-btn { background: none; border: 1px solid var(--border); color: var(--text-muted); font-size: 11px; padding: 4px 9px; border-radius: 6px; cursor: pointer; white-space: nowrap; transition: all 0.15s; flex-shrink: 0; }
.swap-meal-btn:hover { border-color: var(--orange); color: var(--orange); background: rgba(255,140,66,0.08); }
.swap-meal-btn-full { margin-top: 8px; width: 100%; padding: 10px; border-radius: var(--radius-sm); border: 1px dashed rgba(255,140,66,0.35); background: rgba(255,140,66,0.07); color: var(--orange); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.swap-meal-btn-full:hover { background: rgba(255,140,66,0.15); border-color: var(--orange); }
.custom-meal-badge { font-size: 10px; background: rgba(168,85,247,0.2); color: var(--purple); padding: 1px 6px; border-radius: 8px; vertical-align: middle; font-weight: 600; }

/* ═══ SHOPPING MODAL ITEMS ════════════════════════════════════ */
.shopping-modal-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }
.shop-cat-block { margin-bottom: 18px; }
.shop-cat-title { font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.shop-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-2); border-radius: 6px; margin-bottom: 4px; cursor: pointer; transition: opacity 0.2s; user-select: none; }
.shop-item.done { opacity: 0.38; text-decoration: line-through; }
.shop-item.done .shop-check { background: var(--green); border-color: var(--green); }
.shop-item.done .shop-check svg { display: block; }
.shop-check { width: 18px; height: 18px; border: 1.5px solid var(--border); border-radius: 4px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.shop-check svg { width: 10px; height: 10px; stroke: white; stroke-width: 2.5; fill: none; display: none; }
.shop-item-name { flex: 1; font-size: 13px; color: var(--text-primary); }
.shop-item-amount { font-size: 12px; color: var(--blue); font-weight: 700; }
.shopping-modal-note { font-size: 12px; color: var(--text-muted); text-align: center; padding: 12px 0 4px; border-top: 1px solid var(--border); margin-top: 12px; }

/* ═══ LIGHT THEME ══════════════════════════════════════════════ */
[data-theme="light"] {
  --bg-0: #edf0f7;
  --bg-1: #ffffff;
  --bg-2: #f4f6fb;
  --bg-3: #e8ecf5;
  --bg-4: #dde2ee;
  --card: #ffffff;
  --card-hover: #f8f9fc;
  --border: rgba(15,20,50,0.10);
  --border-bright: rgba(15,20,50,0.18);
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #059669;
  --green-dark: #047857;
  --orange: #d97706;
  --purple: #7c3aed;
  --red: #dc2626;
  --yellow: #ca8a04;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.16);
}
/* ── Header ── */
[data-theme="light"] .app-header { background: rgba(237,240,247,0.96); box-shadow: 0 1px 0 rgba(0,0,0,0.08); }
[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg-2); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--bg-4); }

/* ── Nav tabs ── */
[data-theme="light"] .nav-tab:hover { background: var(--bg-3); }
[data-theme="light"] .nav-tab.active { background: rgba(37,99,235,0.1); color: var(--blue); border: 1px solid rgba(37,99,235,0.25); }

/* ── Dashboard hero: dark island — scoped CSS var override so all children stay light-colored ── */
[data-theme="light"] .dashboard-hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #142540 50%, #0f1e35 100%);
  --text-primary: #f0f4ff;
  --text-secondary: #8fa3c8;
  --text-muted: #5a7090;
  --border: rgba(255,255,255,0.10);
  --card: rgba(255,255,255,0.08);
  --card-hover: rgba(255,255,255,0.12);
  --border-bright: rgba(255,255,255,0.18);
}

/* ── Stat cards outside hero ── */
[data-theme="light"] .stat-card { background: var(--bg-1); border-color: var(--border); box-shadow: var(--shadow-sm); }

/* ── Macro rings ── */
[data-theme="light"] .macro-ring-card { background: var(--bg-1); border-color: var(--border); box-shadow: var(--shadow-sm); }

/* ── Meal cards & panels ── */
[data-theme="light"] .meal-card { background: var(--bg-1); border-color: var(--border); }
[data-theme="light"] .meal-card-header:hover { background: var(--bg-2); }
[data-theme="light"] .meal-card-body { background: var(--bg-2); }
[data-theme="light"] .dash-panel { background: var(--bg-1); border-color: var(--border); }
[data-theme="light"] .prog-card { background: var(--bg-1); border-color: var(--border); }
[data-theme="light"] .progress-card { background: var(--bg-1); border-color: var(--border); }

/* ── Progress bars (fix hardcoded rgba(255,255,255,X) tracks) ── */
[data-theme="light"] .dcb-track,
[data-theme="light"] .day-progress-bar-wrap,
[data-theme="light"] .goal-bar-track,
[data-theme="light"] .goal-big-bar,
[data-theme="light"] .day-total-bar,
[data-theme="light"] .macro-bar-track { background: rgba(0,0,0,0.07); }

/* ── Day plan ── */
[data-theme="light"] .day-btn { background: var(--bg-1); border-color: var(--border); color: var(--text-secondary); }
[data-theme="light"] .day-btn.active { background: var(--bg-2); border-color: var(--blue); }
[data-theme="light"] .day-btn.today { border-color: var(--green); }
[data-theme="light"] .week-navigator { background: var(--bg-2); border-color: var(--border); }
[data-theme="light"] .day-header { background: var(--bg-1); border-color: var(--border); }

/* ── Badges & chips (fix hardcoded white rgba) ── */
[data-theme="light"] .time-badge { background: rgba(0,0,0,0.05); }
[data-theme="light"] .day-date-badge.past { background: rgba(0,0,0,0.05); }
[data-theme="light"] .ptc-diff.past { background: rgba(0,0,0,0.05); }
[data-theme="light"] .swap-tag { background: rgba(0,0,0,0.06); }
[data-theme="light"] .prep-origin-banner { background: rgba(0,0,0,0.04); }

/* ── Today meals (dashboard) ── */
[data-theme="light"] .today-meal-item { background: var(--bg-2); border: 1px solid var(--border); }
[data-theme="light"] .today-meal-item.meal-done { opacity: 0.6; }

/* ── Week mini grid ── */
[data-theme="light"] .week-day-mini { background: var(--bg-2); }

/* ── Prep timeline ── */
[data-theme="light"] .prep-timeline-card { background: var(--bg-1); border-color: var(--border); box-shadow: var(--shadow-sm); }
[data-theme="light"] .prep-week-block { background: var(--bg-1); border-color: var(--border); }
[data-theme="light"] .ptc-tasks { background: var(--bg-2); }

/* ── Progress tab ── */
[data-theme="light"] .adh-day { background: var(--bg-2); }
[data-theme="light"] .weight-chart-bars { background: var(--bg-2); border-color: var(--border); }
[data-theme="light"] .weight-bar-track { background: var(--bg-3); }

/* ── Food database ── */
[data-theme="light"] .food-card { background: var(--bg-1); border-color: var(--border); box-shadow: var(--shadow-sm); }
[data-theme="light"] .food-detail { background: var(--bg-2); }

/* ── Calculator ── */
[data-theme="light"] .calc-form-panel,
[data-theme="light"] .calc-results-panel { background: var(--bg-1); border-color: var(--border); }
[data-theme="light"] .result-card { background: var(--bg-2); border-color: var(--border); }
[data-theme="light"] .macro-target-card { background: var(--bg-2); }

/* ── Modals & swap ── */
[data-theme="light"] .modal-box { background: var(--bg-1); }
[data-theme="light"] .swap-option { background: var(--bg-2); }
[data-theme="light"] .swap-option.swap-reset { border-color: rgba(0,0,0,0.15); }
[data-theme="light"] .shop-item { background: var(--bg-2); }

/* ── Preferences ── */
[data-theme="light"] .pref-row { background: var(--bg-1); }
[data-theme="light"] .prefs-panel-wrap { background: var(--bg-1); }

/* ── Shopping list in prep tab ── */
[data-theme="light"] .shopping-item { background: var(--bg-2); }
[data-theme="light"] .shopping-section-block { background: var(--bg-1); }

/* ── Misc ── */
[data-theme="light"] .section-title { color: var(--text-secondary); }
[data-theme="light"] .storage-tip { background: rgba(0,0,0,0.04); }
[data-theme="light"] .nutrition-note { background: rgba(0,0,0,0.04); }
[data-theme="light"] .calc-form input,
[data-theme="light"] .calc-form select { background: var(--bg-2); border-color: var(--border); color: var(--text-primary); }
[data-theme="light"] .weight-input { background: var(--bg-2); border-color: var(--border); color: var(--text-primary); }
[data-theme="light"] .db-search { background: var(--bg-2); border-color: var(--border); color: var(--text-primary); }
[data-theme="light"] .highlight-item { background: var(--bg-2); }

/* ═══ THEME TOGGLE BUTTON ══════════════════════════════════════ */
.theme-toggle-btn { background: rgba(255,255,255,0.08); border: 1px solid var(--border-bright); color: var(--text-primary); font-size: 14px; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.theme-toggle-btn:hover { background: rgba(255,255,255,0.15); }
[data-theme="light"] .theme-toggle-btn { background: rgba(0,0,0,0.06); border-color: var(--border); }
[data-theme="light"] .theme-toggle-btn:hover { background: rgba(0,0,0,0.10); }

/* ═══ PREF SLIDERS (replaces old button grid) ════════════════ */
.prefs-panel-wrap { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.prefs-grid { display: flex; flex-direction: column; }
.pref-row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pref-row:last-child { border-bottom: none; }
.pref-row.pref-carb { opacity: 0.9; }
.pref-icon-name { display: flex; align-items: center; gap: 10px; min-width: 160px; flex-shrink: 0; }
.pref-icon { font-size: 22px; line-height: 1; }
.pref-name { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.pref-desc { font-size: 11px; color: var(--text-muted); }
.pref-slider-col { flex: 1; min-width: 200px; }
.pref-slider-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.pref-val-label { font-size: 12px; font-weight: 700; transition: color 0.2s; }
.pref-reset-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 0 4px; opacity: 0.6; }
.pref-reset-btn:hover { opacity: 1; color: var(--orange); }

/* Range slider base */
.pref-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 3px; outline: none; cursor: pointer;
  background: linear-gradient(to right, #6b7280 0%, #ff8c42 25%, #8892b0 50%, #4fcc8c 75%, #00d4a3 100%); }
[data-theme="light"] .pref-slider {
  background: linear-gradient(to right, #9ca3af 0%, #d97706 25%, #9ca3af 50%, #16a34a 75%, #059669 100%); }
.pref-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--pref-color, #8892b0); border: 2.5px solid rgba(255,255,255,0.85); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.45); transition: transform 0.12s; }
.pref-slider::-webkit-slider-thumb:hover { transform: scale(1.18); }
.pref-slider::-webkit-slider-thumb:active { transform: scale(1.25); }
.pref-slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--pref-color, #8892b0); border: 2.5px solid rgba(255,255,255,0.85); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.45); }
[data-theme="light"] .pref-slider::-webkit-slider-thumb { border-color: rgba(255,255,255,0.95); box-shadow: 0 2px 8px rgba(0,0,0,0.25); }

.pref-slider-ticks { display: flex; justify-content: space-between; margin-top: 3px; }
.pref-slider-ticks span { font-size: 9px; color: var(--text-muted); text-align: center; }

/* Groups note */
.prefs-groups-note { font-size: 12px; color: var(--text-muted); padding: 10px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prefs-group-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.protein-tag { background: rgba(79,158,240,0.12); color: var(--blue); }

/* Regen banner */
.prefs-regen-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: linear-gradient(135deg, rgba(255,215,0,0.08), rgba(255,140,66,0.08)); border-top: 1px solid rgba(255,215,0,0.2); flex-wrap: wrap; }
[data-theme="light"] .prefs-regen-banner { background: linear-gradient(135deg, rgba(202,138,4,0.08), rgba(217,119,6,0.08)); border-top-color: rgba(202,138,4,0.2); }
.prefs-regen-text { display: flex; align-items: center; gap: 10px; }
.prefs-regen-icon { font-size: 20px; }
.prefs-regen-title { font-size: 13px; font-weight: 700; color: var(--yellow); }
[data-theme="light"] .prefs-regen-title { color: #92400e; }
.prefs-regen-sub { font-size: 11px; color: var(--text-muted); }
.prefs-regen-actions { display: flex; gap: 8px; flex-shrink: 0; }
.prefs-regen-btn { padding: 8px 16px; background: var(--yellow); color: #000; border: none; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.prefs-regen-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.prefs-regen-dismiss { padding: 8px 12px; background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 8px; font-size: 12px; cursor: pointer; }
.prefs-regen-dismiss:hover { border-color: var(--text-muted); }
.prefs-hint { font-size: 12px; color: var(--text-muted); padding: 10px 16px; border-top: 1px solid var(--border); text-align: center; }

/* ═══ ACTIVE / CURRENT MEAL GLOW ════════════════════════════ */

@keyframes meal-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(79,238,170,0.0), 0 2px 12px rgba(79,238,170,0.18); }
  50%  { box-shadow: 0 0 0 6px rgba(79,238,170,0.0), 0 4px 24px rgba(79,238,170,0.38); }
  100% { box-shadow: 0 0 0 0 rgba(79,238,170,0.0), 0 2px 12px rgba(79,238,170,0.18); }
}
@keyframes meal-pulse-near {
  0%   { box-shadow: 0 0 0 0 rgba(255,140,66,0.0), 0 2px 12px rgba(255,140,66,0.20); }
  50%  { box-shadow: 0 0 0 6px rgba(255,140,66,0.0), 0 4px 24px rgba(255,140,66,0.40); }
  100% { box-shadow: 0 0 0 0 rgba(255,140,66,0.0), 0 2px 12px rgba(255,140,66,0.20); }
}

/* Base active meal card */
.today-meal-item.meal-now {
  position: relative;
  border-left: 3px solid var(--green) !important;
  border-radius: var(--radius-sm);
  animation: meal-pulse 2.4s ease-in-out infinite;
  background: rgba(0,212,163,0.05) !important;
  transition: border-color 0.3s;
}

/* Near (≤60 min) — orange glow */
.today-meal-item.meal-now.meal-now-near,
.today-meal-item.meal-now.meal-now-soon {
  border-left-color: var(--orange) !important;
  background: rgba(255,140,66,0.05) !important;
  animation: meal-pulse-near 2.0s ease-in-out infinite;
}

/* Right now! (±45 min) — strong green */
.today-meal-item.meal-now.meal-now-now {
  border-left-color: var(--green) !important;
  background: rgba(0,212,163,0.08) !important;
  animation: meal-pulse 1.8s ease-in-out infinite;
}

/* Overdue — red, no pulse */
.today-meal-item.meal-now.meal-now-late {
  border-left-color: var(--red) !important;
  background: rgba(240,97,79,0.05) !important;
  animation: none;
}

/* Light theme glow adjustments */
[data-theme="light"] .today-meal-item.meal-now {
  background: rgba(0,160,120,0.06) !important;
}
[data-theme="light"] .today-meal-item.meal-now.meal-now-near,
[data-theme="light"] .today-meal-item.meal-now.meal-now-soon {
  background: rgba(217,119,6,0.07) !important;
}
[data-theme="light"] .today-meal-item.meal-now.meal-now-now {
  background: rgba(0,160,120,0.09) !important;
}

/* ── Now badge ──────────────────────────────────────────── */
.now-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.now-badge-dim  { background: rgba(136,146,176,0.15); color: var(--text-muted); }
.now-badge-soon { background: rgba(255,140,66,0.15); color: var(--orange); }
.now-badge-near { background: rgba(255,140,66,0.22); color: var(--orange); }
.now-badge-now  {
  background: rgba(0,212,163,0.18);
  color: var(--green);
  box-shadow: 0 0 6px rgba(0,212,163,0.35);
}
.now-badge-late { background: rgba(240,97,79,0.18); color: var(--red); }

[data-theme="light"] .now-badge-dim  { background: rgba(0,0,0,0.07); color: var(--text-muted); }
[data-theme="light"] .now-badge-soon { background: rgba(217,119,6,0.12); color: #b45309; }
[data-theme="light"] .now-badge-near { background: rgba(217,119,6,0.18); color: #b45309; }
[data-theme="light"] .now-badge-now  { background: rgba(0,140,100,0.12); color: #065f46; box-shadow: 0 0 6px rgba(0,140,100,0.25); }
[data-theme="light"] .now-badge-late { background: rgba(220,38,38,0.12); color: #b91c1c; }

/* ── Arrow indicator ────────────────────────────────────── */
.meal-now-arrow {
  margin-left: auto;
  padding-left: 8px;
  font-size: 14px;
  color: var(--green);
  opacity: 0.85;
  flex-shrink: 0;
  animation: arrow-bounce 1.4s ease-in-out infinite;
}
.meal-now.meal-now-near  .meal-now-arrow,
.meal-now.meal-now-soon  .meal-now-arrow { color: var(--orange); }
.meal-now.meal-now-late  .meal-now-arrow { color: var(--red); animation: none; }

@keyframes arrow-bounce {
  0%, 100% { transform: translateX(0); }
  50%       { transform: translateX(4px); }
}

/* ═══ MEAL MODIFIER MODAL ════════════════════════════════════ */
.meal-mod-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 6px; opacity: 0.5; flex-shrink: 0; transition: all 0.15s; }
.meal-mod-btn:hover { opacity: 1; color: var(--blue); background: rgba(79,158,240,0.12); }

.meal-mod-badge { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-left: 4px; vertical-align: middle; }
.meal-skipped .today-meal-name { text-decoration: line-through; opacity: 0.4; }
.meal-skipped .today-meal-check { border-color: var(--red) !important; }

/* Modal box content */
.mmod-meal-info { padding: 8px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.mmod-meal-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.mmod-meal-base-macros { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.mmod-mode-tabs { display: flex; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; flex-shrink: 0; }
.mmod-tab { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--text-secondary); font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.mmod-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.mmod-section { padding: 0; }

.mmod-search-row { margin-bottom: 8px; }
.mmod-search-input { width: 100%; padding: 10px 14px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; color: var(--text-primary); font-size: 13px; outline: none; box-sizing: border-box; }
.mmod-search-input:focus { border-color: var(--blue); }

.mmod-search-results { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.mmod-search-results:empty { display: none; }
.mmod-result-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mmod-result-item:last-child { border-bottom: none; }
.mmod-res-info { flex: 1; min-width: 140px; }
.mmod-res-add-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; margin-top: 6px; }
.mmod-amount-input { width: 64px; padding: 5px 8px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 7px; color: var(--text-primary); font-size: 13px; text-align: center; outline: none; }
.mmod-amount-input:focus { border-color: var(--blue); }
.mmod-amount-unit { font-size: 12px; color: var(--text-muted); }
.mmod-res-preview { font-size: 11px; color: var(--green); flex: 1; min-width: 80px; }
.mmod-res-add-btn { padding: 5px 12px; background: var(--blue); color: #fff; border: none; border-radius: 7px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mmod-res-add-btn:hover { filter: brightness(1.12); }

.mmod-res-emoji { font-size: 20px; flex-shrink: 0; padding-top: 2px; }
.mmod-res-name { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.mmod-res-macro { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.mmod-no-results { padding: 12px 14px; font-size: 12px; color: var(--text-muted); }

.mmod-additions-list { margin: 8px 0; }
.mmod-additions-title { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; }
.mmod-addition-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mmod-add-name { font-size: 13px; font-weight: 600; flex: 1; }
.mmod-add-amount { font-size: 12px; color: var(--text-muted); }
.mmod-add-macro { font-size: 11px; color: var(--text-secondary); }
.mmod-remove-btn { background: none; border: none; color: var(--red); cursor: pointer; font-size: 14px; padding: 2px 6px; }

.mmod-manual-btn { background: none; border: 1px dashed var(--border); color: var(--text-muted); font-size: 12px; padding: 7px 14px; border-radius: 8px; cursor: pointer; width: 100%; text-align: center; margin-top: 8px; }
.mmod-manual-btn:hover { border-color: var(--blue); color: var(--blue); }
.mmod-manual-form { margin-top: 10px; padding: 12px; background: var(--bg-2); border-radius: 10px; }
.mmod-manual-macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0; }

.mmod-input { width: 100%; padding: 8px 12px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); font-size: 13px; outline: none; box-sizing: border-box; }
.mmod-input:focus { border-color: var(--blue); }
.mmod-input-sm { padding: 7px 8px; font-size: 12px; text-align: center; }
.mmod-add-manual-btn { margin-top: 6px; padding: 8px 16px; background: var(--blue); color: #fff; border: none; border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; }

/* Replace mode */
.mmod-replace-info { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.mmod-replace-search-hint { text-align: center; font-size: 11px; color: var(--text-muted); margin: 8px 0; }
.mmod-replace-macros-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.mmod-macro-label { font-size: 11px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }

/* Summary */
.mmod-summary { margin: 0; padding: 12px 16px; background: var(--bg-2); border-radius: 10px; }
.mmod-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; flex-wrap: wrap; margin-bottom: 6px; }
.mmod-sum-label { color: var(--text-muted); font-size: 12px; }
.mmod-sum-vals { color: var(--text-primary); }
.mmod-budget-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; padding: 5px 0; gap: 8px; flex-wrap: wrap; }
.budget-ok  { color: var(--green); }
.budget-over { color: var(--orange); }
.budget-under { color: var(--blue); }

/* Actions */
.mmod-actions { display: flex; gap: 8px; padding: 16px 0 4px; border-top: 1px solid var(--border); margin-top: 12px; flex-wrap: wrap; }
.mmod-save-btn { flex: 1; padding: 10px 20px; background: var(--green); color: #111; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; min-width: 140px; }
.mmod-save-btn:hover { filter: brightness(1.1); }
.mmod-skip-btn { padding: 10px 14px; background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 10px; font-size: 13px; cursor: pointer; }
.mmod-skip-btn:hover { border-color: var(--red); color: var(--red); }
.mmod-clear-btn { padding: 10px 14px; background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 10px; font-size: 13px; cursor: pointer; }
.mmod-clear-btn:hover { border-color: var(--red); color: var(--red); }

/* ─── EDIT BUTTON IN PLAN CARD ──────────────────────────── */
.meal-mod-btn-inline {
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 6px;
}
.meal-mod-btn-inline:hover { border-color: var(--blue); color: var(--blue); background: rgba(79,158,240,0.08); }

/* ═══ MEAL MOD — EDIT MODE ════════════════════��═════════════ */
.mmod-edit-hint {
  font-size: 12px; color: var(--text-muted); margin-bottom: 10px;
}
.mmod-edit-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }

.mmod-edit-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  background: var(--bg-2); flex-wrap: wrap;
}
.mmod-edit-row.mmod-edit-removed {
  background: transparent; opacity: 0.55;
  padding: 4px 10px;
}
.mmod-edit-remove {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center; padding: 0;
  transition: all 0.15s;
}
.mmod-edit-remove:hover { border-color: #ff4444; color: #ff4444; background: rgba(255,68,68,0.1); }
.mmod-edit-restore {
  font-size: 11px; padding: 3px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
}
.mmod-edit-restore:hover { border-color: var(--green); color: var(--green); }
.mmod-edit-name {
  flex: 1; font-size: 13px; color: var(--text-primary); min-width: 100px;
}
.removed-name { text-decoration: line-through; color: var(--text-muted); }
.mmod-edit-amount {
  width: 62px; padding: 4px 6px; background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-primary); font-size: 13px; text-align: right;
}
.mmod-edit-amount:focus { outline: none; border-color: var(--blue); }
.mmod-edit-unit { font-size: 12px; color: var(--text-muted); min-width: 28px; }
.mmod-edit-unit-free { font-size: 12px; color: var(--text-muted); font-style: italic; }
.mmod-edit-macro {
  font-size: 11px; color: var(--text-secondary); margin-left: auto;
  white-space: nowrap;
}
.mmod-edit-macro.mmod-unmatched { color: var(--text-muted); font-style: italic; }
.mmod-edit-note { color: var(--text-muted); font-style: italic; }

/* ─── MEAL MOD BALANCE ──────────────────────────────────── */
.mmod-balance {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 8px;
}
.mmod-balance.ok   { background: rgba(107,212,37,0.12); color: #6bd425; }
.mmod-balance.under { background: rgba(79,158,240,0.12); color: var(--blue); }
.mmod-balance.over  { background: rgba(255,140,66,0.12); color: var(--orange); }

/* ─── SAVE AS CUSTOM MEAL ───────────────────────────────── */
.mmod-save-as-section { margin: 12px 0 0 0; border-top: 1px solid var(--border); padding-top: 10px; }
.mmod-save-as-toggle {
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; cursor: pointer; padding: 4px 0;
  display: flex; align-items: center; gap: 6px;
}
.mmod-save-as-toggle:hover { color: var(--text-primary); }
.mmod-save-as-form { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mmod-save-as-btn {
  padding: 8px 14px; background: var(--orange); border: none; color: #fff;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.mmod-save-as-btn:hover { background: #e07a30; }

/* ─── ADDITIONS TOTAL ───────────────────────────────────── */
.mmod-additions-total {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  margin-top: 4px;
  text-align: right;
}

/* ═══ PLAN TIMELINE ═══════════════════════════════════════ */
.tl-outer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(79,158,240,0.14), transparent 34%),
    linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  flex-wrap: wrap;
}

.plan-view-toggle {
  display: inline-flex;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.pvt-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.pvt-btn.active,
.pvt-btn:hover {
  background: var(--blue);
  color: #fff;
}

.tl-date-label {
  flex: 1;
  min-width: 180px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.today-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,212,163,0.14);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.tl-add-btn,
.tl-add-save,
.tl-edit-btn,
.tl-del-btn,
.tl-done-btn,
.tl-add-cancel {
  transition: var(--transition);
}

.tl-add-btn {
  border: none;
  background: linear-gradient(135deg, var(--blue), #60a5fa);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(79,158,240,0.18);
}

.tl-add-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }

.tl-day-macros {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 700;
}

.tl-sep {
  color: var(--text-muted);
  font-weight: 400;
}

.tl-consumed-inline {
  color: var(--text-secondary);
  font-size: 12px;
}

.tl-scroll {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tl-hours-col {
  position: sticky;
  top: 0;
  height: 864px;
}

.tl-hour-label {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.tl-events-col {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(79,158,240,0.05), transparent 18%),
    linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0));
  cursor: crosshair;
}

.tl-slot-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.tl-slot-band {
  position: absolute;
  left: 14px;
  right: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(79,158,240,0.02), rgba(79,158,240,0.008));
  border: 1px solid transparent;
  opacity: 0;
  transform: scaleX(0.985);
  transition: opacity 0.14s ease, transform 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.tl-events-col.tl-drag-mode .tl-slot-band {
  opacity: 0;
}

.tl-slot-band.active {
  opacity: 0.9 !important;
  transform: scaleX(1);
  background: linear-gradient(180deg, rgba(96,165,250,0.12), rgba(96,165,250,0.035));
  border-color: rgba(96,165,250,0.32);
  box-shadow: inset 0 0 0 1px rgba(96,165,250,0.12), 0 8px 18px rgba(79,158,240,0.06);
}

.tl-hour-row {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.tl-hour-even {
  background: rgba(255,255,255,0.015);
}

.tl-half-tick,
.tl-quarter-tick {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed rgba(255,255,255,0.04);
}

.tl-quarter-tick {
  left: 18px;
  right: 18px;
}

.tl-now-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px solid rgba(240,97,79,0.9);
  z-index: 2;
  pointer-events: none;
}

.tl-now-dot {
  position: absolute;
  left: -1px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(240,97,79,0.18);
}

.tl-block {
  position: absolute;
  min-height: 26px;
  padding: 0 5px;
  z-index: 3;
  cursor: grab;
}

.tl-block.tl-dragging {
  z-index: 5;
  cursor: grabbing;
}

.tl-block-window {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  height: var(--tl-slot-h, 12px);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.tl-block-window-core {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), color-mix(in srgb, var(--tl-accent) 72%, white 10%), rgba(255,255,255,0.04));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--tl-accent) 22%, transparent),
    0 0 14px color-mix(in srgb, var(--tl-accent) 26%, transparent),
    0 10px 18px color-mix(in srgb, var(--tl-accent) 10%, transparent);
  opacity: 0.95;
}

.tl-block-inner {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  min-height: 26px;
  border-left: 4px solid var(--tl-accent, var(--blue));
  border-radius: 14px;
  padding: 4px 8px 4px 10px;
  background: rgba(17,24,39,0.92);
  border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 16px 32px rgba(0,0,0,0.25);
}

.tl-block-done .tl-block-inner {
  opacity: 0.72;
  background: rgba(14,22,28,0.72);
}

.tl-block-done .tl-block-window-core {
  opacity: 0.65;
}

.tl-block-skipped .tl-block-inner {
  opacity: 0.55;
  filter: grayscale(0.2);
}

.tl-block-mainline {
  display: grid;
  grid-template-columns: minmax(0, 58%) minmax(110px, 42%);
  gap: 10px;
  align-items: center;
  min-height: 16px;
  padding-right: 56px;
}

.tl-block-name-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.tl-block-photo {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: 0 4px 12px rgba(0,0,0,0.22);
}

.tl-block-name {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tl-type-label {
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.tl-type-extra {
  color: #cbd5e1;
}

.tl-block-macros {
  font-size: 9px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  justify-self: end;
  text-align: right;
  max-width: none;
}

.tl-block-actions {
  position: absolute;
  top: 3px;
  right: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.tl-done-btn,
.tl-edit-btn,
.tl-del-btn {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(15,23,42,0.82);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.tl-done-btn:hover,
.tl-edit-btn:hover,
.tl-del-btn:hover {
  transform: translateY(-1px);
}

.tl-done-btn.active,
.tl-done-btn:hover {
  color: #052e16;
  background: rgba(0,212,163,0.9);
  border-color: rgba(0,212,163,0.95);
}

.tl-edit-btn:hover {
  color: #fff;
  background: rgba(79,158,240,0.9);
  border-color: rgba(79,158,240,0.95);
}

.tl-del-btn:hover {
  color: #fff;
  background: rgba(240,97,79,0.9);
  border-color: rgba(240,97,79,0.95);
}

#tl-add-panel {
  display: none;
}

.tl-add-form {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  padding: 18px;
  box-shadow: 0 18px 42px rgba(0,0,0,0.18);
}

.tl-add-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
}

.tl-add-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.tl-add-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.tl-add-input,
.tl-add-num {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
  color: var(--text-primary);
  outline: none;
}

.tl-add-input {
  padding: 11px 13px;
  font-size: 14px;
}

.tl-add-num {
  padding: 8px 10px;
  font-size: 13px;
}

.tl-add-input:focus,
.tl-add-num:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,158,240,0.12);
}

.tl-add-macros {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.tl-add-macros label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
}

.tl-add-btns {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.tl-add-cancel {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tl-add-save {
  border: none;
  background: linear-gradient(135deg, var(--green), #4ade80);
  color: #052e16;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.tl-add-cancel:hover {
  border-color: var(--text-muted);
}

.tl-add-save:hover {
  filter: brightness(1.05);
}

.plan-fallback {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.plan-fallback-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
}

.plan-fallback-sub,
.plan-fallback-error {
  font-size: 12px;
  color: var(--text-muted);
}

.plan-fallback-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-fallback-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}

.plan-fallback-time {
  font-size: 12px;
  font-weight: 800;
  color: var(--blue);
}

.plan-fallback-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.plan-fallback-macros {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

[data-theme="light"] .tl-toolbar,
[data-theme="light"] .tl-day-macros,
[data-theme="light"] .tl-add-form {
  background: var(--bg-1);
}

[data-theme="light"] .tl-events-col {
  background:
    linear-gradient(180deg, rgba(79,158,240,0.07), transparent 18%),
    linear-gradient(180deg, rgba(0,0,0,0.01), rgba(0,0,0,0));
}

[data-theme="light"] .tl-slot-band {
  background: linear-gradient(180deg, rgba(79,158,240,0.03), rgba(79,158,240,0.01));
}

[data-theme="light"] .tl-slot-band.active {
  background: linear-gradient(180deg, rgba(79,158,240,0.14), rgba(79,158,240,0.05));
  border-color: rgba(79,158,240,0.24);
}

[data-theme="light"] .tl-hour-row {
  border-top-color: rgba(15,23,42,0.08);
}

[data-theme="light"] .tl-hour-even {
  background: rgba(15,23,42,0.02);
}

[data-theme="light"] .tl-half-tick,
[data-theme="light"] .tl-quarter-tick {
  border-top-color: rgba(15,23,42,0.06);
}

[data-theme="light"] .tl-block-inner {
  background: rgba(255,255,255,0.96);
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 12px 28px rgba(15,23,42,0.08);
}

[data-theme="light"] .tl-block-done .tl-block-inner {
  background: rgba(248,250,252,0.88);
}

[data-theme="light"] .tl-done-btn,
[data-theme="light"] .tl-edit-btn,
[data-theme="light"] .tl-del-btn {
  background: rgba(255,255,255,0.95);
  border-color: rgba(15,23,42,0.1);
}


@media (max-width: 900px) {
  .tl-scroll {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 10px;
  }

  .tl-add-row,
  .tl-add-macros {
    grid-template-columns: 1fr;
  }

  .tl-date-label {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .tl-toolbar {
    padding: 14px;
  }

  .plan-view-toggle,
  .tl-add-btn {
    width: 100%;
  }

  .plan-view-toggle {
    justify-content: space-between;
  }

  .pvt-btn {
    flex: 1;
    text-align: center;
  }

  .tl-day-macros {
    font-size: 12px;
  }

  .tl-scroll {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .tl-hour-label {
    font-size: 10px;
  }

  .tl-block {
    padding: 4px;
  }

  .tl-block-inner {
    padding: 10px 10px 12px;
  }

  .tl-block-actions {
    position: static;
    margin-top: 8px;
    justify-content: flex-end;
  }

  .tl-add-btns {
    flex-direction: column-reverse;
  }

  .tl-add-cancel,
  .tl-add-save {
    width: 100%;
  }
}

/* ─── MY MEALS TAB ──────────────────────────────────────── */
.my-meals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.my-meal-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}
.my-meal-card:hover { border-color: rgba(79,158,240,0.4); transform: translateY(-2px); }
.my-meal-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.my-meal-card-photo {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 2px;
}
.my-meal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.my-meal-name { font-size: 15px; font-weight: 700; color: var(--text-primary); flex: 1; }
.my-meal-delete {
  background: none; border: none; font-size: 16px; cursor: pointer;
  opacity: 0.5; padding: 2px 4px; border-radius: 6px; transition: opacity 0.2s;
}
.my-meal-delete:hover { opacity: 1; }
.my-meal-macros { display: flex; gap: 10px; font-size: 13px; flex-wrap: wrap; }
.my-meal-ingredients { display: flex; flex-wrap: wrap; gap: 5px; }
.my-meal-ing {
  background: var(--bg-3, rgba(255,255,255,0.06));
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-muted);
}
.my-meal-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.my-meal-type {
  background: rgba(79,158,240,0.12);
  color: var(--blue);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

/* ─── EMPTY STATE ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

/* Protein slider pin icon */
.pref-pin-icon { font-size: 10px; opacity: 0.7; cursor: default; }

/* Light theme overrides */
[data-theme="light"] .mmod-search-input { background: #fff; }
[data-theme="light"] .mmod-search-results { background: #fff; }
[data-theme="light"] .mmod-result-item:hover { background: var(--bg-2); }
[data-theme="light"] .mmod-manual-form { background: var(--bg-1); }
[data-theme="light"] .mmod-input { background: #fff; }
[data-theme="light"] .mmod-summary { background: var(--bg-1); }

/* ═══ PREF GROUP HEADERS ════════════════════════════════════ */
.pref-group-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 16px 6px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pref-group-header:first-child { border-top: none; }
.pref-group-title { font-size: 12px; font-weight: 800; color: var(--text-primary); letter-spacing: 0.3px; }
.pref-group-note  { font-size: 11px; color: var(--text-muted); }
[data-theme="light"] .pref-group-header { background: rgba(0,0,0,0.03); }

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-3);
  border: 1px solid var(--border-bright);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  animation: toastSlideIn 0.35s cubic-bezier(0.175,0.885,0.32,1.275) forwards;
  pointer-events: auto;
  cursor: pointer;
}

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg  { flex: 1; line-height: 1.4; }

.toast-success { border-color: rgba(0,212,163,0.5); background: rgba(0,212,163,0.08); }
.toast-error   { border-color: rgba(240,97,79,0.5);  background: rgba(240,97,79,0.08); }
.toast-info    { border-color: rgba(79,158,240,0.5); background: rgba(79,158,240,0.08); }
.toast-warning { border-color: rgba(255,140,66,0.5); background: rgba(255,140,66,0.08); }

.toast-ai-approval {
  align-items: center;
  gap: 10px;
  cursor: default;
  border-color: rgba(0,212,163,0.45);
  background: linear-gradient(135deg, rgba(0,212,163,0.14), rgba(79,158,240,0.09)), var(--bg-3);
}

.toast-ai-approval-body {
  flex: 1;
  min-width: 0;
}

.toast-ai-approval-title {
  margin-bottom: 3px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.toast-ai-approval-text {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.35;
}

.toast-ai-approval-reason {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.3;
}

.toast-ai-approval-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 900;
}

.toast-ai-approval-ok {
  color: #06130f;
  background: var(--green);
}

.toast-ai-approval-ok span {
  position: relative;
  z-index: 1;
}

.toast-ai-approval-cancel {
  color: #fff;
  background: rgba(240,97,79,0.92);
  font-size: 16px;
}

.toast-countdown-ring {
  position: absolute;
  inset: 0;
  width: 34px;
  height: 34px;
  transform: rotate(-90deg);
}

.toast-countdown-track {
  fill: none;
  stroke: rgba(0,0,0,0.2);
  stroke-width: 3;
}

.toast-countdown-progress {
  fill: none;
  stroke: rgba(255,255,255,0.92);
  stroke-dasharray: 94.25;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  stroke-width: 3;
  animation: toastCountdown 10s linear forwards;
}

.toast.toast-out { animation: toastSlideOut 0.25s ease forwards; }

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(70px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0)   scale(1); }
}
@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0)   scale(1); max-height: 80px; }
  to   { opacity: 0; transform: translateX(60px) scale(0.95); max-height: 0; margin-bottom: -8px; padding: 0; }
}

@keyframes toastCountdown {
  to { stroke-dashoffset: 94.25; }
}

[data-theme="light"] .toast { background: #fff; border-color: rgba(0,0,0,0.15); }

/* ═══════════════════════════════════════════════════════════
   PHOTO UPLOAD — MEAL MOD MODAL
   ═══════════════════════════════════════════════════════════ */

.mmod-photo-drop {
  position: relative;
  border: 2px dashed var(--border-bright);
  border-radius: var(--radius-md);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-2);
}
.mmod-photo-drop:hover,
.mmod-photo-drop.dragover {
  border-color: var(--blue);
  background: rgba(79,158,240,0.06);
}
.mmod-photo-drop input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.mmod-photo-drop-icon { font-size: 40px; margin-bottom: 10px; }
.mmod-photo-drop-label { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.mmod-photo-drop-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.mmod-photo-ai-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(168,85,247,0.08);
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: var(--radius-sm);
  margin-top: 12px;
  font-size: 12px;
  color: var(--purple);
}

/* Loading */
.mmod-photo-loading {
  text-align: center;
  padding: 40px 20px;
}
.mmod-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: mmodSpin 0.75s linear infinite;
  margin: 0 auto 16px;
}
@keyframes mmodSpin { to { transform: rotate(360deg); } }
.mmod-loading-label {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Photo result */
.mmod-photo-preview-wrap {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.mmod-photo-preview-img {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 14px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  display: block;
}
.mmod-photo-preview-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.mmod-photo-preview-ai-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.mmod-photo-preview-macros-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mmod-photo-preview-macro {
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-2);
  font-size: 12px;
  font-weight: 600;
}
.mmod-photo-reshot-btn {
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  align-self: flex-start;
}
.mmod-photo-reshot-btn:hover { background: var(--bg-3); color: var(--text-primary); }

.mmod-photo-result-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}
.mmod-photo-result-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.mmod-photo-macros-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.mmod-photo-macro-box {
  text-align: center;
  padding: 8px 4px;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
}
.mmod-photo-macro-val {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 3px;
}
.mmod-photo-macro-lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.mmod-photo-edit-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  margin-top: 4px;
}
.mmod-photo-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.mmod-photo-edit-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.mmod-photo-confirm-btn {
  width: 100%;
  padding: 12px;
  background: var(--green);
  color: #000;
  font-weight: 700;
  font-size: 14px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.mmod-photo-confirm-btn:hover { background: var(--green-dark); }

/* Photo badge in meal card */
.meal-photo-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(168,85,247,0.15);
  color: var(--purple);
  border: 1px solid rgba(168,85,247,0.25);
  font-weight: 600;
  vertical-align: middle;
}

/* Photo thumbnail in today meals list */
.today-meal-photo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-bright);
}

/* Photo thumbnail in plan meal card header */
.meal-card-photo-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border-bright);
}

.extra-meal-type-badge {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

/* Auto-corrected macros badge */
.macro-corrected-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.25);
  border-radius: 20px;
  padding: 1px 7px;
  margin-left: 4px;
  vertical-align: middle;
}

/* "upraveno" badge in plan meal card */
.meal-mod-badge-inline {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255,140,66,0.15);
  color: var(--orange);
  border: 1px solid rgba(255,140,66,0.3);
  font-weight: 600;
  vertical-align: middle;
}

/* Skipped meal card */
.meal-card-skipped { opacity: 0.55; }

/* Protein over-limit warning badge on meal card */
.meal-protein-warning {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #f97316;
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: 20px;
  padding: 2px 8px;
  margin-top: 4px;
  white-space: nowrap;
}

/* Protein gap warning banner — shown above meal cards */
.protein-gap-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(249, 115, 22, 0.08);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 10px 0 4px;
}
.pgb-icon { font-size: 18px; flex-shrink: 0; }
.pgb-text { flex: 1; font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.pgb-text strong { color: #f97316; }
.pgb-btn {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: #f97316;
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.pgb-btn:hover { background: #ea6c10; }

/* ── Dashboard goal alerts ─────────────────────────────── */
.dash-alerts-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px;
}
.dash-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.03);
  border-left: 3px solid var(--alert-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  backdrop-filter: none;
}
.dash-alert-icon { font-size: 20px; flex-shrink: 0; }
.dash-alert-body { flex: 1; min-width: 0; }
.dash-alert-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
}
.dash-alert-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.dash-alert-btn {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.my-meal-detail {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) 1.1fr;
  gap: 18px;
}
.my-meal-detail-photo,
.my-meal-detail-photo-placeholder {
  width: 100%;
  max-height: 520px;
  min-height: 280px;
  object-fit: contain;
  border-radius: 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
}
.my-meal-detail-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
}
.my-meal-detail-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.my-meal-detail-name { font-size: 22px; line-height: 1.2; font-weight: 800; color: var(--text-primary); margin-bottom: 10px; }
.my-meal-detail-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.my-meal-detail-meta-item {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
}
.my-meal-detail-meta-item span { display: block; color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.my-meal-detail-meta-item b { color: var(--text-secondary); font-size: 12px; }
.my-meal-detail-macros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.my-meal-detail-macros div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; }
.my-meal-detail-macros b { display: block; font-size: 20px; line-height: 1; margin-bottom: 5px; }
.my-meal-detail-macros span { color: var(--text-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
.my-meal-detail-section h4 { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.my-meal-detail-ingredients { display: flex; flex-wrap: wrap; gap: 6px; }
.my-meal-detail-ingredients span { background: var(--bg-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 10px; color: var(--text-secondary); font-size: 12px; }
.my-meal-detail-instructions { padding-left: 18px; color: var(--text-secondary); line-height: 1.6; }
@media (max-width: 760px) {
  .my-meal-detail { grid-template-columns: 1fr; }
  .my-meal-detail-macros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dash-alert-btn:hover { opacity: 0.85; }

/* Photo in expanded meal card */
.meal-photo-full {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

/* ═══════════════════════════════════════════════════════════
   FOTO JÍDLA — "MOJE JÍDLA" TAB (PHOTO HISTORY)
   ═══════════════════════════════════════════════════════════ */

.photo-meals-section {
  margin-top: 28px;
}
.photo-meals-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--purple);
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(168,85,247,0.07);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(168,85,247,0.15);
}
.photo-meals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.photo-meal-card {
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
}
.photo-meal-card:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }
.photo-meal-card:hover {
  transform: translateY(-3px);
  border-color: rgba(168,85,247,0.3);
}
.photo-meal-card-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.photo-meal-card-body {
  padding: 10px 12px;
}
.photo-meal-card-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-meal-card-macros {
  display: flex;
  gap: 6px;
  font-size: 11px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.photo-meal-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}
.photo-meal-card-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  opacity: 0.5;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity 0.15s;
}
.photo-meal-card-delete:hover { opacity: 1; background: rgba(240,97,79,0.15); }

[data-theme="light"] .photo-meal-card { background: #fff; }
[data-theme="light"] .mmod-photo-drop { background: rgba(0,0,0,0.03); }
[data-theme="light"] .mmod-photo-result-card { background: rgba(0,0,0,0.04); }
[data-theme="light"] .mmod-photo-macro-box { background: rgba(0,0,0,0.06); }

/* ═══════════════════════════════════════════════════════════
   AI CHAT WIDGET
   ═══════════════════════════════════════════════════════════ */

#ai-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 8888;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

body[data-current-tab="assistant"] #ai-chat-widget {
  display: none;
}

/* ── Floating Action Button ── */
.chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(168,85,247,0.5);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s;
  position: relative;
  flex-shrink: 0;
}
.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(168,85,247,0.65);
}
.chat-fab:active { transform: scale(0.95); }
.chat-fab-icon { font-size: 24px; line-height: 1; }
.chat-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  background: var(--red);
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-0);
}
.chat-fab-badge.hidden { display: none; }

/* ── Chat Panel ── */
.chat-panel {
  width: 370px;
  max-height: 600px;
  background: var(--bg-1);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 60px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatPanelIn 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
  max-width: calc(100vw - 48px);
}
.chat-panel.hidden { display: none; }
@keyframes chatPanelIn {
  from { opacity: 0; transform: scale(0.92) translateY(16px); transform-origin: bottom right; }
  to   { opacity: 1; transform: scale(1)    translateY(0);    transform-origin: bottom right; }
}

/* ── Header ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(168,85,247,0.15) 0%, rgba(124,58,237,0.1) 100%);
  border-bottom: 1px solid var(--border);
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(168,85,247,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.chat-title   { font-weight: 700; font-size: 14px; }
.chat-subtitle { font-size: 11px; color: var(--green); }
.chat-header-actions { display: flex; gap: 4px; }
.chat-hdr-btn {
  width: 28px; height: 28px;
  background: none; border: none; cursor: pointer;
  border-radius: 6px; font-size: 14px;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.chat-hdr-btn:hover { background: var(--bg-3); color: var(--text-primary); }

/* ── Messages ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
  max-height: 380px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 2px; }

.chat-turn {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-turn-delete {
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  z-index: 2;
}

.chat-turn:hover .chat-turn-delete {
  opacity: 1;
  pointer-events: auto;
}

.chat-turn-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 92%;
  animation: msgIn 0.25s ease;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.ai   { align-self: flex-start; }

.chat-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0; margin-top: 2px;
}
.chat-msg.user .chat-msg-avatar { background: rgba(79,158,240,0.2); }
.chat-msg.ai   .chat-msg-avatar { background: rgba(168,85,247,0.2); }

.chat-msg-bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  max-width: 100%;
  word-break: break-word;
}
.chat-msg.user .chat-msg-bubble {
  background: linear-gradient(135deg, #4f9ef0, #3380d4);
  color: #fff;
  border-radius: 16px 4px 16px 16px;
}
.chat-msg.ai .chat-msg-bubble {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 4px 16px 16px 16px;
}

/* markdown-like formatting in AI messages */
.chat-msg.ai .chat-msg-bubble strong { color: var(--green); }
.chat-msg.ai .chat-msg-bubble code {
  background: var(--bg-4);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
  font-size: 12px;
}
.chat-msg.ai .chat-msg-bubble ul {
  margin: 6px 0 2px 16px;
}
.chat-msg.ai .chat-msg-bubble li { margin-bottom: 3px; }

/* Image in chat message */
.chat-msg-img {
  max-width: 200px;
  max-height: 180px;
  border-radius: 10px;
  display: block;
  margin-bottom: 6px;
  cursor: zoom-in;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
}
.chat-typing span {
  width: 7px; height: 7px;
  background: var(--purple);
  border-radius: 50%;
  animation: chatTyping 1.2s infinite ease-in-out;
  opacity: 0.6;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Image preview (attached before send) ── */
.chat-img-preview {
  padding: 8px 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-img-preview.hidden { display: none; }
.chat-img-preview img {
  height: 52px;
  width: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border-bright);
}
.chat-img-remove {
  width: 20px; height: 20px;
  background: var(--bg-4); border: none; border-radius: 50%;
  color: var(--text-secondary); font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.chat-img-remove:hover { background: var(--red); color: #fff; }

/* ── Suggestions chips ── */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 4px;
}
.chat-suggestions.hidden { display: none; }
.chat-sug {
  padding: 5px 11px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.chat-sug:hover {
  background: rgba(168,85,247,0.12);
  border-color: rgba(168,85,247,0.3);
  color: var(--purple);
}

/* ── Input area ── */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
}
.chat-img-btn {
  width: 36px; height: 36px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
  transition: background 0.15s;
  margin-bottom: 1px;
}
.chat-img-btn:hover { background: var(--bg-4); }
.chat-input {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: inherit;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.15s;
  outline: none;
}
.chat-input:focus { border-color: rgba(168,85,247,0.4); }
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
  width: 36px; height: 36px;
  background: var(--purple);
  border: none; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
  margin-bottom: 1px;
}
.chat-send-btn svg { width: 16px; height: 16px; color: #fff; }
.chat-send-btn:hover { background: #9333ea; }
.chat-send-btn:active { transform: scale(0.92); }
.chat-send-btn:disabled { background: var(--bg-4); cursor: not-allowed; }

/* ── Empty state ── */
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-secondary);
  gap: 8px;
}
.chat-empty-icon { font-size: 40px; margin-bottom: 6px; }
.chat-empty-title { font-weight: 600; font-size: 14px; }
.chat-empty-sub   { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ── Light theme ── */
[data-theme="light"] .chat-panel { background: #fff; border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .chat-header { background: rgba(168,85,247,0.06); }
[data-theme="light"] .chat-input  { background: #f5f5f7; border-color: rgba(0,0,0,0.12); color: #111; }
[data-theme="light"] .chat-msg.ai .chat-msg-bubble { background: #f0f0f5; border-color: rgba(0,0,0,0.08); color: #111; }
[data-theme="light"] .chat-sug   { background: #f0f0f5; }
[data-theme="light"] .chat-input-area { background: #fff; }
[data-theme="light"] .chat-img-btn { background: #f0f0f5; }

/* Responsive */
@media (max-width: 480px) {
  #ai-chat-widget { bottom: 16px; right: 16px; }
  .chat-panel { width: calc(100vw - 32px); }
}

/* ═══════════════════════════════════════════════════════════
   TRÉNINKOVÝ PLÁN
   ═══════════════════════════════════════════════════════════ */

.training-goals-bar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px;
}
.training-goal-chip {
  padding: 5px 12px; background: rgba(79,158,240,0.1); border: 1px solid rgba(79,158,240,0.25);
  border-radius: 20px; font-size: 12px; color: var(--blue); font-weight: 600;
}

.training-week-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-bottom: 20px;
}
@media (max-width: 700px) { .training-week-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) { .training-week-grid { grid-template-columns: repeat(2, 1fr); } }

.training-day-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 12px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.training-day-card.today { border-color: var(--blue); background: rgba(79,158,240,0.08); }
.training-day-card.done  { border-color: var(--green); background: rgba(0,212,163,0.08); }
.training-day-card.rest  { opacity: 0.55; }
.training-day-card:hover { transform: translateY(-2px); border-color: var(--blue); box-shadow: 0 10px 26px rgba(0,0,0,0.18); }
.training-day-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.tday-label    { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.tday-icon     { font-size: 22px; }
.tday-activity { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.tday-duration { font-size: 11px; color: var(--text-muted); }
.tday-kcal     { font-size: 11px; font-weight: 700; }
.tday-done-badge { font-size: 10px; color: var(--green); font-weight: 700; margin-top: 2px; }

.btn-training-log {
  padding: 10px 20px; background: var(--green); color: #111; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 700; cursor: pointer; transition: filter 0.15s;
}
.btn-training-log:hover { filter: brightness(1.1); }

.training-programs-list { display: flex; flex-direction: column; gap: 16px; }
.training-program-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
}
.tprog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.tprog-name  { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.tprog-count { font-size: 11px; color: var(--text-muted); }
.tprog-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tprog-table thead { background: var(--bg-3); }
.tprog-table th { padding: 7px 14px; text-align: left; font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.tprog-table td { padding: 8px 14px; border-top: 1px solid var(--border); color: var(--text-secondary); }
.tprog-table tr:hover td { background: var(--bg-3); }

.training-log-list { display: flex; flex-direction: column; gap: 6px; }
.training-log-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--bg-2); border-radius: 8px; font-size: 12px; flex-wrap: wrap;
}
.tlog-date     { color: var(--text-muted); min-width: 80px; }
.tlog-activity { font-weight: 600; color: var(--text-primary); }
.tlog-duration { color: var(--text-secondary); }
.tlog-kcal     { font-weight: 700; }
.tlog-notes    { color: var(--text-muted); flex: 1; }

.ai-notes-list { display: flex; flex-direction: column; gap: 8px; }
.ai-note-item {
  padding: 10px 14px; background: rgba(168,85,247,0.08); border: 1px solid rgba(168,85,247,0.2);
  border-radius: 8px; font-size: 13px; color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════
   VÝŽIVOVÉ DOPLŇKY
   ═══════════════════════════════════════════════════════════ */

.supp-schedule-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px;
}
@media (max-width: 600px) { .supp-schedule-grid { grid-template-columns: 1fr; } }

.supp-sched-block {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px;
}
.supp-sched-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.supp-sched-item  { font-size: 12px; color: var(--text-secondary); padding: 3px 0; border-bottom: 1px solid var(--border); }
.supp-sched-item:last-child { border-bottom: none; }
.supp-sched-empty { font-size: 12px; color: var(--text-muted); font-style: italic; }

.supp-cost-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; margin-bottom: 16px;
  background: rgba(0,212,163,0.08); border: 1px solid rgba(0,212,163,0.2); border-radius: 10px;
  font-size: 13px; color: var(--text-secondary);
}

.btn-add-supplement {
  padding: 8px 18px; background: var(--blue); color: #fff; border: none; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: filter 0.15s;
}
.btn-add-supplement:hover { filter: brightness(1.1); }

.supp-cards-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }

.supp-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px;
  transition: border-color 0.15s;
}
.supp-card:hover { border-color: var(--border-bright); }
.supp-card-inactive { opacity: 0.5; }

.supp-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px;
}
.supp-card-info { flex: 1; }
.supp-card-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.supp-card-dose { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.supp-card-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.supp-prio { font-size: 14px; letter-spacing: -2px; }
.supp-toggle-btn {
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: none;
  font-size: 11px; font-weight: 600; cursor: pointer; color: var(--text-muted); white-space: nowrap;
  transition: all 0.15s;
}
.supp-toggle-btn.active { background: rgba(0,212,163,0.15); color: var(--green); border-color: rgba(0,212,163,0.4); }
.supp-delete-btn {
  padding: 4px 8px; background: none; border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; color: var(--text-muted); font-size: 13px; transition: all 0.15s;
}
.supp-delete-btn:hover { color: var(--red); border-color: var(--red); }

.supp-card-reason  { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 6px; }
.supp-card-brand   { font-size: 11px; color: var(--text-muted); font-style: italic; margin-bottom: 6px; }
.supp-card-ai-note {
  font-size: 12px; color: var(--purple); padding: 6px 10px; background: rgba(168,85,247,0.08);
  border-radius: 6px; margin-bottom: 6px;
}
.supp-card-footer  { display: flex; align-items: center; justify-content: space-between; }
.supp-freq  { font-size: 11px; color: var(--text-muted); }
.supp-price { font-size: 12px; color: var(--orange); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   AI ASISTENT — FULL TAB
   ═══════════════════════════════════════════════════════════ */

.tab-assistant-full {
  padding: 0 !important;
  overflow: hidden;
}

#assistant-content {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
}

.assistant-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 800px) {
  .assistant-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .assistant-sidebar { max-height: 260px; overflow-y: auto; border-right: none; border-bottom: 1px solid var(--border); }
}

/* Sidebar */
.assistant-sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-2);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.asst-sidebar-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-muted); margin: 8px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}

/* Context panel */
.asst-ctx-macro { margin-bottom: 12px; }
.asst-ctx-macro-row {
  display: flex; justify-content: space-between; font-size: 12px;
  color: var(--text-secondary); margin-bottom: 4px;
}
.asst-ctx-bar { height: 4px; background: var(--bg-4); border-radius: 2px; margin-bottom: 8px; overflow: hidden; }
.asst-ctx-bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.asst-ctx-meals { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.asst-ctx-meal { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); padding: 3px 0; }
.asst-ctx-meal.done { color: var(--text-muted); }
.asst-ctx-meal.done .asst-ctx-meal-name { text-decoration: line-through; }
.asst-ctx-meal-check { color: var(--green); font-size: 11px; width: 14px; }
.asst-ctx-meal-name  { flex: 1; }
.asst-ctx-meal-kcal  { font-size: 11px; color: var(--text-muted); }
.asst-ctx-training {
  padding: 6px 10px; background: rgba(255,140,66,0.1); border-radius: 8px;
  font-size: 12px; color: var(--orange); font-weight: 600; margin-bottom: 8px;
}

/* Quick prompts */
.asst-quick-prompts { display: flex; flex-direction: column; gap: 6px; }
.asst-quick-btn {
  text-align: left; padding: 7px 10px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; font-size: 11px; color: var(--text-secondary); cursor: pointer; transition: all 0.15s;
  line-height: 1.3;
}
.asst-quick-btn:hover { background: var(--bg-4); color: var(--text-primary); border-color: var(--blue); }
.asst-quick-gen {
  border-color: rgba(0,212,163,0.35);
  color: var(--green);
  background: rgba(0,212,163,0.06);
}
.asst-quick-gen:hover { background: rgba(0,212,163,0.15); border-color: var(--green); color: var(--green); }

/* Capabilities */
.asst-capabilities { display: flex; flex-direction: column; gap: 4px; }
.asst-cap-item { font-size: 11px; color: var(--text-muted); padding: 2px 0; }
.asst-cap-highlight { color: var(--green); font-weight: 600; }

/* Sessions list */
.asst-sessions-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.asst-new-chat-btn {
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  background: var(--blue); color: #fff; border: none;
  border-radius: 20px; cursor: pointer; transition: filter 0.15s;
  white-space: nowrap;
}
.asst-new-chat-btn:hover { filter: brightness(1.15); }
.asst-sessions-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 200px; overflow-y: auto; margin-bottom: 4px;
}
.asst-sessions-list::-webkit-scrollbar { width: 3px; }
.asst-sessions-list::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 2px; }
.asst-session-item {
  position: relative; display: flex; flex-direction: column;
  padding: 7px 28px 7px 9px; border-radius: 8px; cursor: pointer;
  transition: background 0.15s; border: 1px solid transparent;
}
.asst-session-item:hover { background: var(--bg-3); }
.asst-session-item.active { background: var(--bg-3); border-color: var(--blue); }
.asst-session-title {
  font-size: 12px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 170px;
}
.asst-session-summary {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 180px;
}
.asst-session-meta {
  font-size: 10px; color: var(--text-muted); margin-top: 4px;
}
.asst-session-del {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 13px;
  opacity: 0; transition: opacity 0.15s; padding: 2px 4px;
  color: var(--text-muted);
}
.asst-session-item:hover .asst-session-del { opacity: 1; }
.asst-session-del:hover { color: var(--red); }
.asst-sessions-empty { font-size: 11px; color: var(--text-muted); padding: 6px 0; }
.asst-sidebar-divider { height: 1px; background: var(--border); margin: 10px 0; }

/* Chat header bar */
.asst-chat-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-1); flex-shrink: 0;
}
.asst-chat-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: calc(100% - 50px);
}
.asst-hdr-btn {
  background: none; border: none; cursor: pointer; font-size: 16px;
  padding: 4px 6px; border-radius: 6px; color: var(--text-muted);
  transition: background 0.15s;
}
.asst-hdr-btn:hover { background: var(--bg-3); }

/* Main chat */
.assistant-chat-main {
  display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}

.asst-chat-messages {
  flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px;
  scroll-behavior: smooth;
}
.asst-chat-messages::-webkit-scrollbar { width: 4px; }
.asst-chat-messages::-webkit-scrollbar-track { background: transparent; }
.asst-chat-messages::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 2px; }

.asst-msg { display: flex; max-width: 82%; animation: msgIn 0.2s ease; }
.asst-msg.user { align-self: flex-end; }
.asst-msg.ai   { align-self: flex-start; }

.asst-msg-bubble {
  padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.6;
  word-break: break-word; max-width: 100%;
}
.asst-msg.user .asst-msg-bubble {
  background: linear-gradient(135deg, #4f9ef0, #3380d4); color: #fff;
  border-radius: 16px 4px 16px 16px;
}
.asst-msg.ai .asst-msg-bubble {
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-primary);
  border-radius: 4px 16px 16px 16px;
}
.asst-msg.ai .asst-msg-bubble strong { color: var(--green); }
.asst-msg.ai .asst-msg-bubble code {
  background: var(--bg-4); padding: 1px 5px; border-radius: 3px;
  font-family: monospace; font-size: 12px;
}
.asst-msg.ai .asst-msg-bubble ul { margin: 6px 0 2px 18px; }
.asst-msg.ai .asst-msg-bubble li { margin-bottom: 4px; }
.asst-msg.ai .asst-msg-bubble p  { margin: 0 0 6px; }
.asst-msg.ai .asst-msg-bubble p:last-child { margin-bottom: 0; }
.asst-msg.ai .asst-msg-bubble .asst-h { display: block; font-size: 15px; margin-bottom: 6px; }

.asst-msg-img {
  max-width: 220px; max-height: 200px; border-radius: 10px; display: block; margin-bottom: 8px;
}

/* Image preview */
.asst-img-preview {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: var(--bg-3); border-top: 1px solid var(--border);
}
.asst-img-preview.hidden { display: none; }
.asst-img-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.asst-img-remove {
  background: none; border: 1px solid var(--border); color: var(--text-muted); border-radius: 6px;
  width: 24px; height: 24px; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center;
}

/* Input area */
.asst-input-area {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px;
  border-top: 1px solid var(--border); background: var(--bg-2);
}
.asst-img-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  font-size: 16px; flex-shrink: 0; transition: background 0.15s;
}
.asst-img-btn:hover { background: var(--bg-4); }
.asst-input {
  flex: 1; padding: 9px 14px; background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text-primary); font-size: 14px; resize: none; outline: none;
  line-height: 1.4; max-height: 150px; font-family: inherit; transition: border-color 0.15s;
}
.asst-input:focus { border-color: var(--blue); }
.asst-input::placeholder { color: var(--text-muted); }
.asst-send-btn {
  width: 36px; height: 36px; background: linear-gradient(135deg, #a855f7, #7c3aed);
  border: none; border-radius: 10px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: filter 0.15s;
}
.asst-send-btn:hover { filter: brightness(1.15); }
.asst-send-btn svg { width: 16px; height: 16px; color: #fff; }

/* ── Nav tabs scroll on mobile ── */
.nav-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }

/* ── Light theme overrides ── */
[data-theme="light"] .assistant-sidebar { background: var(--bg-1); }
[data-theme="light"] .asst-msg.ai .asst-msg-bubble { background: #f0f4f8; border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .asst-input { background: #fff; }
[data-theme="light"] .training-program-card { background: #fff; }
[data-theme="light"] .supp-card { background: #fff; }

/* ═══════════════════════════════════════════════════════════
   MODEL SELECTOR
   ═══════════════════════════════════════════════════════════ */

.model-selector {
  position: relative;
}

.model-selector-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.model-selector-btn:hover {
  background: var(--bg-3);
  color: var(--text-primary);
  border-color: var(--purple);
}

.model-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
  box-shadow: 0 0 4px rgba(168,85,247,0.6);
}

.model-selector-arrow {
  font-size: 10px;
  color: var(--text-muted);
}

.model-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  z-index: 200;
  overflow: hidden;
  animation: menuDrop 0.15s ease;
}
@keyframes menuDrop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.model-menu.hidden { display: none; }

.model-menu-title {
  padding: 10px 14px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.model-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.model-menu-item:last-child { border-bottom: none; }
.model-menu-item:hover      { background: var(--bg-3); }
.model-menu-item.active     { background: rgba(168,85,247,0.1); }

.model-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.model-item-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.model-item-badge {
  font-size: 10px;
  color: var(--purple);
  font-weight: 600;
  white-space: nowrap;
}
.model-menu-item.active .model-item-label::before {
  content: '✓ ';
  color: var(--purple);
}
.model-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Light theme */
[data-theme="light"] .model-menu { background: #fff; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
[data-theme="light"] .model-menu-item:hover { background: #f5f5f5; }
[data-theme="light"] .model-menu-item.active { background: rgba(168,85,247,0.08); }

/* Hide label on very narrow screens, keep dot+arrow */
@media (max-width: 600px) {
  #model-selector-label { display: none; }
  .model-selector-btn { padding: 5px 8px; }
  .model-menu { width: 260px; right: 0; }
}

/* ── AI message meta (time + model) ── */
.asst-msg-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 7px;
  padding-left: 1px;
  opacity: 0.7;
  line-height: 1.2;
  text-align: left;
}

.asst-msg.user .asst-msg-meta {
  color: rgba(255,255,255,0.78);
  text-align: right;
}

.asst-date-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 4px 0;
}

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

.asst-date-divider span {
  flex-shrink: 0;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-2);
}

/* =============================================================
   MOBILE APP SHELL & READABILITY PASS
   ============================================================= */
@supports (padding: max(0px)) {
  .app-header {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .tab-content.active {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

button,
input,
textarea,
select {
  font-size: 16px;
}

@media (max-width: 820px) {
  body {
    overflow: hidden;
    font-size: 15px;
    line-height: 1.55;
  }

  .app-wrapper {
    min-height: 100dvh;
    height: 100dvh;
  }

  .app-header {
    top: auto;
    bottom: 0;
    border-top: 1px solid var(--border);
    border-bottom: none;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .header-inner {
    height: 66px;
    padding: 0 10px;
    gap: 8px;
    align-items: stretch;
  }

  .app-logo,
  .user-avatar,
  .theme-toggle-btn,
  .model-selector {
    display: none !important;
  }

  .header-actions {
    position: fixed;
    right: 12px;
    bottom: calc(148px + env(safe-area-inset-bottom));
    z-index: 120;
    display: flex;
  }

  .shopping-trigger-btn {
    min-height: 44px;
    max-width: 132px;
    padding: 9px 12px;
    border-radius: 999px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    line-height: 1.15;
  }

  .nav-tabs {
    width: 100%;
    flex: 1;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 4px;
    padding: 8px 2px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

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

  .nav-tab {
    min-width: 70px;
    min-height: 50px;
    padding: 7px 8px;
    border-radius: 12px;
    scroll-snap-align: start;
    color: var(--text-secondary);
  }

  .nav-tab .tab-icon {
    font-size: 20px;
  }

  .nav-tab .tab-label {
    display: block;
    max-width: 62px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 10px;
    opacity: 0.9;
  }

  .daily-status-bar {
    top: 0;
  }

  .dsb-inner {
    min-height: 58px;
    height: auto;
    padding: 8px 12px;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .dsb-inner::-webkit-scrollbar {
    display: none;
  }

  .dsb-divider,
  .dsb-remaining-item {
    display: none;
  }

  .dsb-item {
    min-width: 128px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
  }

  .dsb-pie-wrap,
  .dsb-pie {
    width: 38px;
    height: 38px;
  }

  .dsb-label {
    font-size: 10px;
    letter-spacing: 0;
  }

  .dsb-val {
    font-size: 16px;
    letter-spacing: 0;
  }

  .dsb-muted {
    font-size: 13px;
  }

  .dsb-remaining-row {
    padding: 0 12px 8px;
    overflow-x: auto;
  }

  .dsb-macro-row {
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0 12px 8px;
  }

  .dsb-macro-card {
    min-width: 138px;
  }

  .app-main {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }

  .tab-content.active {
    padding-top: 16px;
    padding-bottom: 22px;
  }

  .dashboard-hero,
  .day-header,
  .prep-intro,
  .dash-panel,
  .stat-card,
  .macro-ring-card,
  .meal-card,
  .modal-box,
  .calc-card {
    border-radius: 14px;
  }

  .dashboard-hero {
    padding: 14px;
    margin-bottom: 16px;
  }

  .dashboard-hero::before,
  .dashboard-hero::after {
    display: none;
  }

  .hero-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .dash-coach,
  .dash-snapshot {
    height: auto;
    padding: 15px;
    min-height: auto;
    max-height: none;
  }

  .dash-coach-meta {
    margin-bottom: 14px;
  }

  .dash-coach-meta span,
  .dash-snapshot-notes span {
    font-size: 12px;
    line-height: 1.35;
  }

  .dash-coach-time {
    font-size: 48px;
    line-height: 1;
  }

  .dash-coach-date {
    font-size: 16px;
    margin-bottom: 14px;
  }

  .dash-coach-briefing {
    padding-left: 12px;
  }

  .dash-coach-message,
  .dash-brief-text {
    font-size: 15px;
    line-height: 1.5;
  }

  .dash-snapshot-title,
  .section-title,
  .day-title {
    font-size: 20px;
    letter-spacing: 0;
  }

  .dash-mini-card {
    min-height: 82px;
    padding: 12px;
  }

  .dash-mini-val {
    font-size: 22px;
  }

  .macro-rings-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .macro-ring-card,
  .stat-card {
    padding: 14px 10px;
  }

  .macro-ring-wrap {
    width: 70px;
    height: 70px;
  }

  .dashboard-grid,
  .meal-detail-grid,
  .day-header,
  .macro-bar-row {
    grid-template-columns: 1fr;
  }

  .day-header {
    display: grid;
    gap: 14px;
    padding: 16px;
  }

  .day-totals-grid {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .day-total-card {
    padding: 10px 8px;
  }

  .day-selector {
    margin: 0 -16px 16px;
    padding: 0 16px 8px;
    scroll-snap-type: x proximity;
  }

  .day-btn {
    min-width: 76px;
    min-height: 62px;
    scroll-snap-align: start;
  }

  .meal-card-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px;
  }

  .meal-type-badge {
    grid-column: 1;
    align-self: start;
  }

  .meal-card-title {
    grid-column: 2 / 4;
  }

  .meal-card-title h3 {
    white-space: normal;
    font-size: 16px;
    line-height: 1.3;
  }

  .meal-macros-quick {
    grid-column: 1 / 4;
    justify-content: space-between;
    gap: 8px;
    padding-top: 6px;
  }

  .quick-macro {
    min-width: 46px;
  }

  .meal-card-body {
    padding: 0 14px 16px;
  }

  .ingredient-item {
    font-size: 14px;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    width: 100%;
    max-width: none;
    max-height: min(88dvh, 760px);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    overflow-y: auto;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .chat-fab {
    right: 14px;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .chat-panel {
    position: fixed;
    inset: 8px 8px calc(74px + env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    max-height: none;
    border-radius: 14px;
  }

  .chat-suggestions {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .chat-sug {
    white-space: nowrap;
  }

  .assistant-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(130px, 28dvh) minmax(0, 1fr);
  }

  .assistant-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 420px) {
  .macro-rings-grid,
  .stats-grid,
  .dash-snapshot-grid,
  .day-totals-grid {
    grid-template-columns: 1fr;
  }

  .nav-tab {
    min-width: 64px;
  }

  .nav-tab .tab-label {
    max-width: 56px;
  }

  .dash-coach-time {
    font-size: 42px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TODAY HOME — 2026 REDESIGN
   The dashboard is a day view first; deeper analytics live below.
   ═══════════════════════════════════════════════════════════════ */

.nav-more-trigger,
.mobile-more-sheet {
  display: none;
}

body[data-current-tab="dashboard"] .chat-fab {
  display: none;
}

.today-home {
  width: min(100%, 1460px);
  margin: 0 auto;
  padding-bottom: 48px;
}

.today-intro-grid {
  display: grid;
  grid-template-columns: minmax(310px, 0.64fr) minmax(540px, 1.36fr);
  gap: 18px;
  margin-bottom: 18px;
}

.today-hero,
.today-coach,
.today-timeline-card,
.today-next-card,
.today-nutrition-card,
.today-secondary-card,
.today-details {
  border: 1px solid var(--border);
  border-radius: 24px;
}

.today-hero {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  color: #f7fbff;
  background:
    linear-gradient(145deg, rgba(45, 104, 213, 0.96), rgba(20, 47, 104, 0.98) 54%, rgba(10, 92, 79, 0.96));
  border-color: rgba(116, 169, 255, 0.28);
  box-shadow: 0 22px 60px rgba(8, 20, 52, 0.32);
}

.today-hero-orb {
  position: absolute;
  width: 280px;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.today-hero-orb-one {
  top: -160px;
  right: -80px;
  background: radial-gradient(circle, rgba(112, 221, 194, 0.34), rgba(112, 221, 194, 0));
}

.today-hero-orb-two {
  bottom: -190px;
  left: -60px;
  background: radial-gradient(circle, rgba(125, 166, 255, 0.38), rgba(125, 166, 255, 0));
}

.today-hero-content {
  position: relative;
  z-index: 1;
  min-height: 310px;
  padding: 28px 30px 26px;
  display: flex;
  flex-direction: column;
}

.today-eyebrow,
.today-section-kicker,
.today-coach-overline {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 1.35px;
  text-transform: uppercase;
}

.today-eyebrow {
  max-width: 52%;
  color: rgba(237, 249, 255, 0.9);
  margin-bottom: 10px;
  font-size: 15px;
  letter-spacing: 1.55px;
}

.today-time {
  font-size: clamp(64px, 6vw, 88px);
  line-height: 0.88;
  font-weight: 880;
  letter-spacing: -5px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 12px 32px rgba(4, 13, 38, 0.24);
}

.today-date {
  margin-top: 14px;
  color: rgba(241, 248, 255, 0.82);
  font-size: 17px;
  font-weight: 720;
}

.today-weather {
  position: absolute;
  top: 24px;
  right: 28px;
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: rgba(241, 248, 255, 0.78);
  font-size: 11px;
  white-space: nowrap;
}

.today-weather-value {
  font-weight: 780;
}

.today-weather-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  font-size: 14px;
}

.today-hero-progress {
  margin-top: 12px;
  padding-top: 0;
}

.today-hero-progress-copy {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 28px;
  color: rgba(240, 248, 255, 0.74);
  font-size: 12px;
}

.today-hero-progress-copy strong {
  color: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.today-hero-progress-track {
  position: relative;
  height: 6px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(3, 13, 36, 0.26);
}

.today-hero-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(122, 230, 200, 0.32), #7ae6c8);
  box-shadow: 0 0 15px rgba(122, 230, 200, 0.28);
  transition: width 0.45s cubic-bezier(0.25, 0.75, 0.25, 1);
}

.today-day-meal-markers {
  position: absolute;
  inset: 0;
}

.today-day-plan-marker,
.today-day-actual-marker {
  position: absolute;
  z-index: 3;
  transform: translateX(-50%);
}

.today-day-plan-marker {
  top: -5px;
  width: 18px;
  height: 28px;
  color: rgba(236, 246, 255, 0.68);
  text-align: center;
}

.today-day-plan-marker i {
  width: 3px;
  height: 15px;
  display: block;
  margin: 0 auto;
  border-radius: 99px;
  background: rgba(235, 245, 255, 0.58);
  box-shadow: 0 0 0 2px rgba(18, 48, 94, 0.6);
}

.today-day-plan-marker b {
  display: block;
  margin-top: 3px;
  font-size: 7px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.2px;
}

.today-day-plan-marker.done i {
  background: #82ebce;
}

.today-day-plan-marker.done {
  color: #c9fff0;
}

.today-day-plan-marker.overdue i,
.today-day-plan-marker.skipped i {
  background: #ff9d92;
}

.today-day-plan-marker.overdue,
.today-day-plan-marker.skipped {
  color: #ffd2cd;
}

.today-day-plan-marker.current i {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.today-day-meal-connector {
  position: absolute;
  z-index: 2;
  top: -17px;
  height: 1px;
  min-width: 2px;
  background: rgba(130, 235, 206, 0.54);
}

.today-day-actual-marker {
  top: calc(-25px - (var(--actual-row) * 11px));
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(225, 255, 247, 0.6);
  border-radius: 50%;
  color: #062119;
  background: #82ebce;
  font-size: 8px;
  line-height: 1;
  font-weight: 950;
  box-shadow: 0 3px 10px rgba(5, 24, 39, 0.28);
}

.today-day-now {
  position: absolute;
  z-index: 5;
  top: -29px;
  transform: translateX(-50%);
  pointer-events: none;
}

.today-day-now span {
  display: block;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
  color: #fff;
  background: rgba(8, 29, 62, 0.88);
  font-size: 8px;
  line-height: 1.2;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px rgba(5, 17, 42, 0.2);
}

.today-day-now i {
  position: absolute;
  top: 16px;
  left: 50%;
  width: 1px;
  height: 20px;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

.today-day-now i::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: -3px;
  width: 7px;
  height: 7px;
  border: 2px solid rgba(20, 64, 99, 0.72);
  border-radius: 50%;
  background: #fff;
}

.today-day-scale {
  position: relative;
  height: 7px;
  margin-top: 18px;
  color: rgba(230, 243, 255, 0.48);
  font-size: 7px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.today-day-scale span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.today-day-scale span.first {
  transform: none;
}

.today-day-scale span.last {
  transform: translateX(-100%);
}

.today-day-macro-rail {
  margin-top: 8px;
  padding-top: 0;
  border-top: 0;
}

.today-day-macro-head {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(232, 245, 255, 0.62);
  font-size: 7px;
  line-height: 1;
  font-weight: 780;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.today-day-macro-head > span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0;
  text-transform: none;
}

.today-day-macro-head i {
  width: 11px;
  height: 0;
  display: inline-block;
  border-top: 1.5px solid rgba(235, 246, 255, 0.76);
}

.today-day-macro-head i.plan {
  border-top-style: dashed;
  opacity: 0.62;
}

.today-day-macro-head i.actual {
  margin-left: 4px;
  border-top-width: 2.5px;
}

.today-day-macro-rows {
  display: grid;
  gap: 3px;
}

.today-day-macro-row {
  position: relative;
  height: 31px;
}

.today-day-macro-row svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.today-day-macro-row line,
.today-day-macro-row path {
  vector-effect: non-scaling-stroke;
}

.today-day-macro-row line {
  stroke: rgba(232, 245, 255, 0.1);
  stroke-width: 1;
}

.today-day-macro-row path {
  fill: none;
  stroke: var(--macro-color);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.today-day-macro-row path.plan {
  stroke-width: 1.3;
  stroke-dasharray: 3 3;
  opacity: 0.58;
}

.today-day-macro-row path.actual {
  stroke-width: 2.5;
  opacity: 0.98;
}

.today-day-macro-label {
  position: absolute;
  z-index: 2;
  top: 1px;
  left: 3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  border-radius: 5px;
  color: rgba(237, 247, 255, 0.65);
  background: rgba(18, 48, 94, 0.72);
  font-size: 7px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.today-day-macro-label b {
  color: var(--macro-color);
  font-size: 8px;
  font-weight: 950;
}

.today-day-legend {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(232, 245, 255, 0.55);
  font-size: 6.5px;
  line-height: 1;
  font-weight: 750;
  white-space: nowrap;
}

.today-day-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.today-day-legend i {
  width: 9px;
  height: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-style: normal;
  font-size: 6px;
  font-weight: 950;
}

.today-day-legend i.plan {
  width: 2px;
  height: 9px;
  border-radius: 99px;
  background: rgba(235, 245, 255, 0.58);
}

.today-day-legend i.confirmed {
  color: #062119;
  background: #82ebce;
}

.today-day-legend i.missing {
  color: #4a1210;
  background: #ff9d92;
}

.today-day-legend i.macro-plan,
.today-day-legend i.macro-actual {
  width: 11px;
  height: 0;
  border-radius: 0;
  background: transparent;
}

.today-day-legend i.macro-plan {
  border-top: 1.5px dashed rgba(235, 246, 255, 0.72);
}

.today-day-legend i.macro-actual {
  border-top: 2.5px solid rgba(235, 246, 255, 0.9);
}

.today-day-legend-divider {
  width: 1px;
  height: 10px;
  background: rgba(235, 246, 255, 0.18);
}

.today-coach {
  min-height: 310px;
  padding: 26px 28px 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 0%, rgba(0, 212, 163, 0.09), transparent 33%),
    var(--card);
  box-shadow: var(--shadow-sm);
}

.today-coach-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.today-coach-avatar {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: #081b19;
  background: linear-gradient(145deg, #7ae6c8, #2dc89f);
  font-size: 19px;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(0, 212, 163, 0.2);
}

.today-coach-overline,
.today-section-kicker {
  color: var(--text-muted);
}

.today-coach .dash-coach-rating {
  margin: 4px 0 0;
  color: var(--text-primary);
  font-size: 19px;
  line-height: 1.25;
  text-transform: none;
  letter-spacing: -0.25px;
}

.today-coach-chat-link,
.today-link-btn,
.today-icon-btn,
.today-text-link {
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.today-coach-chat-link {
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}

.today-coach-chat-link:hover,
.today-link-btn:hover,
.today-text-link:hover {
  color: var(--blue);
  background: rgba(79, 158, 240, 0.08);
}

.today-coach .dash-coach-message {
  max-width: none;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.today-coach .dash-brief-grid {
  gap: 11px;
}

.today-coach .dash-brief-row {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
}

.today-coach .dash-brief-label {
  color: var(--green);
  font-size: 10px;
}

.today-coach .dash-brief-text {
  font-size: 16px;
  line-height: 1.42;
}

.today-coach .dash-coach-input-row {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(133, 155, 199, 0.12);
  background: linear-gradient(180deg, rgba(20, 25, 42, 0), var(--card) 25%);
}

.today-coach .dash-coach-input {
  min-height: 52px;
  max-height: 96px;
  padding: 10px 12px;
  border-color: var(--border);
  background: var(--bg-2);
}

.dash-coach-conversation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 1px 8px;
}

.dash-coach-turn {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.dash-coach-turn.user {
  align-items: flex-end;
}

.dash-coach-turn-label {
  padding-inline: 3px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.dash-coach-turn-bubble {
  width: fit-content;
  max-width: 94%;
  padding: 10px 12px;
  border: 1px solid rgba(130, 151, 195, 0.13);
  border-radius: 4px 14px 14px;
  color: var(--text-primary);
  background: rgba(10, 14, 27, 0.24);
  font-size: 14px;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.dash-coach-turn.user .dash-coach-turn-bubble {
  border-color: rgba(79, 158, 240, 0.25);
  border-radius: 14px 4px 14px 14px;
  background: rgba(79, 158, 240, 0.12);
}

.dash-coach-turn-bubble p {
  margin: 0 0 7px;
}

.dash-coach-turn-bubble p:last-child {
  margin-bottom: 0;
}

.dash-coach-turn-bubble ul {
  margin: 7px 0 2px 18px;
  padding: 0;
}

.dash-coach-turn-bubble li + li {
  margin-top: 5px;
}

.dash-coach-action-result {
  width: min(94%, 520px);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid rgba(96, 221, 178, 0.25);
  border-radius: 11px;
  color: var(--green);
  background: rgba(96, 221, 178, 0.08);
}

.dash-coach-action-result > span {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #09241f;
  background: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.dash-coach-action-result strong,
.dash-coach-action-result small {
  display: block;
}

.dash-coach-action-result strong {
  font-size: 12px;
  line-height: 1.2;
}

.dash-coach-action-result small {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.35;
}

.dash-coach-action-result.error {
  border-color: rgba(239, 105, 87, 0.28);
  color: #ff8b7b;
  background: rgba(239, 105, 87, 0.08);
}

.dash-coach-action-result.error > span {
  color: #fff;
  background: #e45f50;
}

.dash-coach-turn-pending .dash-coach-turn-bubble {
  min-width: 54px;
  padding-block: 12px;
}

.today-content-grid {
  display: grid;
  grid-template-columns: minmax(620px, 1.55fr) minmax(300px, 0.68fr);
  gap: 18px;
  align-items: start;
}

.today-timeline-card,
.today-nutrition-card,
.today-secondary-card,
.today-details {
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.today-timeline-card {
  padding: 26px 26px 20px;
}

.today-section-head,
.today-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.today-section-head {
  margin-bottom: 24px;
}

.today-section-head h2,
.today-card-head h3,
.today-next-card h3 {
  margin-top: 5px;
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: -0.5px;
}

.today-card-head h3,
.today-next-card h3 {
  font-size: 18px;
}

.today-link-btn {
  flex-shrink: 0;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 750;
}

.today-timeline {
  --today-rail: rgba(136, 146, 176, 0.2);
}

.today-event {
  position: relative;
  display: grid;
  grid-template-columns: 58px 32px minmax(0, 1fr);
  align-items: stretch;
  min-height: 86px;
}

.today-event-time {
  padding: 18px 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.today-event-rail {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 9px;
}

.today-event-rail::before {
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--today-rail);
}

.today-event:first-of-type .today-event-rail::before {
  top: 17px;
}

.today-event-dot {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-4);
  border-radius: 50%;
  color: var(--text-muted);
  background: var(--card);
  font-size: 11px;
  line-height: 1;
  font-weight: 950;
}

.today-event-card {
  min-width: 0;
  margin: 0 0 9px 8px;
  padding: 14px 15px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg-2);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.today-event-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-bright);
  background: var(--card-hover);
}

.today-event-card:focus-visible {
  outline: 3px solid rgba(79, 158, 240, 0.3);
  outline-offset: 2px;
  border-color: var(--blue);
}

.today-event-title {
  max-width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.today-event-title > span:last-child {
  min-width: 0;
}

.today-event-title small,
.today-event-title strong {
  display: block;
}

.today-event-title small {
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0.75px;
  text-transform: uppercase;
}

.today-event-title strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.3;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-event-kind-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--text-secondary);
  background: var(--bg-3);
  font-size: 13px;
}

.today-event-meta {
  margin: 7px 0 0 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.today-event-meta span:not(:last-child)::after {
  content: "·";
  margin-left: 7px;
  color: var(--text-muted);
}

.today-event-state {
  color: var(--text-secondary);
}

.today-event-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.today-event-action {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-secondary);
  background: var(--card);
  font-size: 11px;
  line-height: 1.1;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.today-event-action:hover {
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.today-event-action-primary {
  color: #071b18;
  border-color: transparent;
  background: var(--green);
}

.today-event-action-primary:hover {
  color: #071b18;
  border-color: transparent;
  background: #42dfb8;
}

.today-event-action-quiet {
  border-color: transparent;
  background: transparent;
}

.today-event-done .today-event-dot {
  color: #062019;
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(0, 212, 163, 0.1);
}

.today-event-done .today-event-card {
  border-color: rgba(0, 212, 163, 0.16);
  background: rgba(0, 212, 163, 0.045);
}

.today-event-done .today-event-state {
  color: var(--green);
}

.today-event-done .today-event-title strong {
  color: var(--text-secondary);
}

.today-event-skipped .today-event-dot {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.today-event-skipped .today-event-card {
  opacity: 0.72;
  border-color: rgba(240, 97, 79, 0.22);
}

.today-event-skipped .today-event-title strong {
  text-decoration: line-through;
}

.today-event-skipped .today-event-state {
  color: var(--red);
}

.today-event-overdue .today-event-dot {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(240, 97, 79, 0.1);
}

.today-event-overdue .today-event-card {
  border-color: rgba(240, 97, 79, 0.3);
  background: linear-gradient(90deg, rgba(240, 97, 79, 0.075), var(--bg-2) 58%);
}

.today-event-overdue .today-event-state {
  color: var(--red);
}

.today-event-current .today-event-dot {
  color: #071b18;
  border-color: #8ff1d6;
  background: #8ff1d6;
  box-shadow: 0 0 0 6px rgba(0, 212, 163, 0.12);
}

.today-event-current .today-event-card {
  border-color: rgba(0, 212, 163, 0.4);
  box-shadow: 0 12px 30px rgba(0, 212, 163, 0.07);
}

.today-event-current .today-event-state {
  color: var(--green);
}

.today-now-row {
  display: grid;
  grid-template-columns: 58px 32px minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
}

.today-now-row time {
  padding-right: 10px;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.today-now-row > span {
  grid-column: 2 / 4;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-size: 9px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.today-now-row > span::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, rgba(0, 212, 163, 0.8), rgba(0, 212, 163, 0.05));
}

.today-now-row i {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 2px solid var(--card);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 212, 163, 0.13);
}

.today-empty {
  min-height: 330px;
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-align: center;
}

.today-empty-icon {
  margin-bottom: 14px;
  font-size: 38px;
}

.today-empty strong {
  color: var(--text-primary);
  font-size: 18px;
}

.today-empty span {
  max-width: 360px;
  margin: 6px auto 18px;
}

.today-empty button,
.today-next-card > button {
  min-height: 40px;
  padding: 9px 13px;
  border: 0;
  border-radius: 10px;
  color: #071b18;
  background: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.today-side-stack {
  display: grid;
  gap: 14px;
}

.today-next-card,
.today-nutrition-card,
.today-secondary-card {
  padding: 20px;
}

.today-next-card {
  position: relative;
  overflow: hidden;
  color: #f6fbff;
  background: linear-gradient(145deg, #173567, #112548 64%, #153c39);
  border-color: rgba(100, 158, 240, 0.28);
}

.today-next-card::after {
  content: "";
  position: absolute;
  top: -80px;
  right: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(101, 217, 186, 0.22), transparent 70%);
  pointer-events: none;
}

.today-next-card.needs-attention {
  background: linear-gradient(145deg, #52252b, #281820 65%, #2d2021);
  border-color: rgba(240, 97, 79, 0.35);
}

.today-next-card.all-done {
  background: linear-gradient(145deg, #0f4d40, #12332f 72%);
  border-color: rgba(0, 212, 163, 0.35);
}

.today-next-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 18px;
  font-weight: 900;
}

.today-next-card .today-section-kicker {
  color: rgba(230, 240, 255, 0.62);
}

.today-next-card h3 {
  position: relative;
  z-index: 1;
  margin-top: 7px;
  color: #fff;
}

.today-next-card p {
  position: relative;
  z-index: 1;
  margin: 7px 0 16px;
  color: rgba(235, 244, 255, 0.7);
  font-size: 12px;
  line-height: 1.45;
}

.today-next-card > button {
  position: relative;
  z-index: 1;
  min-height: 36px;
  padding: 8px 11px;
  font-size: 11px;
}

.today-next-card.needs-attention > button {
  color: #421817;
  background: #ffb4aa;
}

.today-card-head {
  margin-bottom: 17px;
}

.today-icon-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-2);
}

.today-energy-number {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 18px;
}

.today-energy-number strong {
  color: var(--text-primary);
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -1px;
}

.today-energy-number span {
  color: var(--text-muted);
  font-size: 11px;
}

.today-energy-number b {
  color: var(--purple);
  font-size: 12px;
}

.today-macro-line + .today-macro-line {
  margin-top: 14px;
}

.today-macro-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.today-macro-copy > span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 750;
}

.today-macro-copy strong {
  color: var(--text-primary);
  font-size: 12px;
}

.today-macro-copy small {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
}

.today-macro-line.over .today-macro-copy strong {
  color: var(--red);
}

.today-macro-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-3);
}

.today-macro-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.4s ease;
}

.today-text-link {
  margin-top: 16px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 750;
}

.today-secondary-list {
  display: grid;
  gap: 7px;
}

.today-secondary-list button {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text-primary);
  background: var(--bg-2);
  text-align: left;
  cursor: pointer;
}

.today-secondary-list button > span:first-child {
  font-size: 16px;
  text-align: center;
}

.today-secondary-list strong,
.today-secondary-list small {
  display: block;
}

.today-secondary-list strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-secondary-list small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.today-secondary-list i {
  color: var(--text-muted);
  font-style: normal;
}

.today-secondary-empty {
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}

.today-details {
  margin-top: 18px;
  padding: 25px 26px 26px;
}

.today-detail-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.2fr) repeat(2, minmax(220px, 0.7fr));
  gap: 12px;
}

.today-detail-macros {
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--bg-2);
}

.today-detail-link-card {
  position: relative;
  min-height: 160px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 15px;
  color: var(--text-primary);
  background: var(--bg-2);
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.today-detail-link-card:hover {
  border-color: var(--border-bright);
  background: var(--card-hover);
  transform: translateY(-1px);
}

.today-detail-link-card small {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.today-detail-link-card strong {
  font-size: 17px;
  line-height: 1.25;
}

.today-detail-link-card > span:last-child {
  margin-top: auto;
  padding-top: 17px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
}

.today-detail-link-icon {
  position: absolute;
  top: 16px;
  right: 17px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Today timeline detail modal */
.today-event-modal-box {
  max-width: 760px;
  max-height: min(88dvh, 820px);
}

.today-event-modal-header {
  padding: 20px 24px 16px;
}

.today-event-modal-body {
  padding: 22px 24px 24px;
}

.today-event-modal-hero {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 17px;
  margin-bottom: 22px;
}

.today-event-modal-hero > img,
.today-event-modal-icon {
  width: 76px;
  height: 76px;
  border-radius: 20px;
}

.today-event-modal-hero > img {
  object-fit: cover;
  border: 1px solid var(--border);
}

.today-event-modal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background:
    linear-gradient(145deg, rgba(79, 158, 240, 0.18), rgba(0, 212, 163, 0.1)),
    var(--bg-2);
  border: 1px solid var(--border);
  font-size: 27px;
}

.today-event-modal-type {
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.today-event-modal-hero h2 {
  margin: 0 0 9px;
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1.18;
  font-weight: 880;
  letter-spacing: -0.5px;
}

.today-event-modal-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--bg-2);
  font-size: 10px;
  font-weight: 800;
}

.today-event-modal-status.done {
  color: var(--green);
  border-color: rgba(0, 212, 163, 0.25);
  background: rgba(0, 212, 163, 0.08);
}

.today-event-modal-status.overdue,
.today-event-modal-status.skipped {
  color: var(--red);
  border-color: rgba(240, 97, 79, 0.25);
  background: rgba(240, 97, 79, 0.08);
}

.today-event-modal-status.current {
  color: var(--blue);
  border-color: rgba(79, 158, 240, 0.25);
  background: rgba(79, 158, 240, 0.08);
}

.today-event-modal-macros {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 22px;
}

.today-event-modal-macros > div {
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-2);
}

.today-event-modal-macros small,
.today-event-modal-macros strong {
  display: block;
}

.today-event-modal-macros small {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.65px;
  text-transform: uppercase;
}

.today-event-modal-macros strong {
  color: var(--text-primary);
  font-size: 21px;
  line-height: 1;
  font-weight: 900;
}

.today-event-modal-macros strong span {
  margin-left: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.today-event-modal-training-metrics {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.today-event-modal-section {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.today-event-modal-section + .today-event-modal-section,
.today-event-modal-note {
  margin-top: 20px;
}

.today-event-modal-section h4 {
  margin-bottom: 11px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.today-event-modal-ingredients {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.today-event-modal-ingredients > div {
  min-width: 0;
  padding: 9px 11px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
}

.today-event-modal-ingredients span {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-event-modal-ingredients strong {
  flex-shrink: 0;
  color: var(--text-primary);
  font-size: 11px;
}

.today-event-modal-section ol {
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.today-event-modal-section p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.today-event-modal-section p + p {
  margin-top: 8px;
}

.today-event-modal-note {
  padding: 12px 14px;
  border: 1px solid rgba(0, 212, 163, 0.16);
  border-radius: 12px;
  color: var(--text-secondary);
  background: rgba(0, 212, 163, 0.055);
  font-size: 12px;
  line-height: 1.5;
}

.today-event-modal-note span {
  margin-right: 8px;
  color: var(--green);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.today-event-modal-actions {
  padding: 14px 24px max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
}

.today-event-modal-actions > div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.today-modal-primary,
.today-modal-secondary,
.today-modal-quiet {
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 10px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.today-modal-primary {
  border: 1px solid transparent;
  color: #062019;
  background: var(--green);
}

.today-modal-secondary {
  border: 1px solid var(--border);
  color: var(--text-primary);
  background: var(--bg-2);
}

.today-modal-quiet {
  border: 1px solid transparent;
  color: var(--text-muted);
  background: transparent;
}

.today-modal-primary:hover {
  background: #42dfb8;
}

.today-modal-secondary:hover,
.today-modal-quiet:hover {
  color: var(--text-primary);
  border-color: var(--border-bright);
}

[data-theme="light"] .today-hero {
  box-shadow: 0 20px 50px rgba(33, 74, 140, 0.2);
}

[data-theme="light"] .today-coach,
[data-theme="light"] .today-timeline-card,
[data-theme="light"] .today-nutrition-card,
[data-theme="light"] .today-secondary-card,
[data-theme="light"] .today-details {
  background: var(--bg-1);
}

[data-theme="light"] .today-event-dot {
  background: var(--bg-1);
}

[data-theme="light"] .today-event-card,
[data-theme="light"] .today-secondary-list button,
[data-theme="light"] .today-detail-macros,
[data-theme="light"] .today-detail-link-card {
  background: var(--bg-2);
}

[data-theme="light"] .today-event-done .today-event-card {
  background: rgba(5, 150, 105, 0.05);
}

[data-theme="light"] .today-event-overdue .today-event-card {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.07), var(--bg-2) 58%);
}

@media (max-width: 1180px) {
  .today-intro-grid {
    grid-template-columns: minmax(300px, 0.62fr) minmax(470px, 1.38fr);
  }

  .today-content-grid {
    grid-template-columns: minmax(540px, 1.35fr) minmax(280px, 0.65fr);
  }

  .today-event-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .today-event-actions {
    justify-content: flex-start;
    padding-left: 40px;
  }

  .today-detail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .today-detail-macros {
    grid-column: 1 / 3;
  }
}

@media (max-width: 920px) {
  .today-intro-grid,
  .today-content-grid {
    grid-template-columns: 1fr;
  }

  .today-hero,
  .today-hero-content {
    min-height: 280px;
  }

  .today-coach {
    min-height: 280px;
  }

  .today-side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .today-secondary-card {
    grid-column: 1 / 3;
  }
}

@media (max-width: 820px) {
  body.mobile-sheet-open {
    overflow: hidden;
  }

  .header-inner {
    padding-inline: 6px;
  }

  .app-header {
    position: fixed;
    inset: auto 0 0;
    z-index: 400;
  }

  .nav-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 7px 0;
    overflow: visible;
  }

  .nav-tab.mobile-secondary {
    display: none;
  }

  .nav-more-trigger {
    display: flex;
  }

  .nav-tab {
    min-width: 0;
    width: 100%;
    padding: 6px 2px;
  }

  .nav-tab .tab-label {
    max-width: none;
  }

  .header-actions {
    display: none;
  }

  .mobile-more-sheet {
    position: fixed;
    inset: 0 0 calc(66px + env(safe-area-inset-bottom));
    z-index: 450;
    display: flex;
    align-items: flex-end;
    padding: 12px;
    background: rgba(3, 6, 16, 0.62);
    backdrop-filter: blur(10px);
  }

  .mobile-more-sheet.hidden {
    display: none;
  }

  .mobile-more-panel {
    width: 100%;
    padding: 20px;
    border: 1px solid var(--border-bright);
    border-radius: 22px;
    background: var(--bg-1);
    box-shadow: 0 -18px 70px rgba(0, 0, 0, 0.45);
  }

  .mobile-more-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 17px;
  }

  .mobile-more-kicker {
    color: var(--green);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .mobile-more-title {
    margin-top: 2px;
    color: var(--text-primary);
    font-size: 19px;
    font-weight: 850;
  }

  .mobile-more-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    background: var(--bg-2);
    font-size: 22px;
  }

  .mobile-more-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .mobile-more-grid button,
  .mobile-more-actions button {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 13px;
    color: var(--text-primary);
    background: var(--bg-2);
    font: inherit;
    cursor: pointer;
  }

  .mobile-more-grid button {
    min-height: 82px;
    padding: 11px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 750;
  }

  .mobile-more-grid button span {
    font-size: 22px;
  }

  .mobile-more-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 9px;
  }

  .mobile-more-actions button {
    min-height: 44px;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
  }

  .tab-content.active {
    padding: 14px;
  }

  .today-home {
    padding-bottom: 24px;
  }

  .today-intro-grid {
    gap: 12px;
    margin-bottom: 12px;
  }

  .today-hero,
  .today-coach,
  .today-timeline-card,
  .today-next-card,
  .today-nutrition-card,
  .today-secondary-card,
  .today-details {
    border-radius: 18px;
  }

  .today-content-grid {
    gap: 12px;
  }

  .today-hero,
  .today-hero-content {
    min-height: 260px;
  }

  .today-hero-content {
    padding: 24px 22px 21px;
  }

  .today-time {
    font-size: clamp(66px, 19vw, 88px);
    letter-spacing: -4px;
  }

  .today-coach {
    min-height: 0;
    padding: 21px 20px;
  }

  .today-coach-head {
    grid-template-columns: 40px minmax(0, 1fr);
    margin-bottom: 18px;
  }

  .today-coach-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .today-coach-chat-link {
    display: none;
  }

  .today-coach .dash-coach-rating {
    font-size: 17px;
  }

  .today-coach .dash-brief-text {
    font-size: 14px;
  }

  .today-timeline-card {
    padding: 21px 14px 15px;
  }

  .today-section-head {
    margin-bottom: 18px;
    padding-inline: 5px;
  }

  .today-section-head h2 {
    font-size: 19px;
  }

  .today-link-btn {
    padding-inline: 4px;
  }

  .today-side-stack {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .today-secondary-card {
    grid-column: auto;
  }

  .today-details {
    margin-top: 12px;
    padding: 21px 16px 18px;
  }

  .today-detail-grid {
    grid-template-columns: 1fr;
  }

  .today-detail-macros {
    grid-column: auto;
  }
}

@media (max-width: 580px) {
  .today-hero,
  .today-hero-content {
    min-height: 238px;
  }

  .today-time {
    font-size: 70px;
  }

  .today-eyebrow {
    max-width: 68%;
    font-size: 13px;
  }

  .today-weather {
    top: 20px;
    right: 20px;
    gap: 5px;
    font-size: 10px;
  }

  .today-weather-place,
  .today-weather-condition {
    display: none;
  }

  .today-weather-icon {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .today-date {
    font-size: 15px;
  }

  .today-day-legend {
    gap: 8px;
  }

  .today-event-modal-header {
    padding: 17px 17px 13px;
  }

  .today-event-modal-body {
    padding: 18px 17px 20px;
  }

  .today-event-modal-hero {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 13px;
    margin-bottom: 18px;
  }

  .today-event-modal-hero > img,
  .today-event-modal-icon {
    width: 58px;
    height: 58px;
    border-radius: 15px;
  }

  .today-event-modal-icon {
    font-size: 21px;
  }

  .today-event-modal-hero h2 {
    font-size: 19px;
  }

  .today-event-modal-macros {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .today-event-modal-ingredients {
    grid-template-columns: 1fr;
  }

  .today-event-modal-actions {
    padding-inline: 17px;
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .today-event-modal-actions > span {
    display: none;
  }

  .today-event-modal-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .today-event-modal-actions button {
    width: 100%;
  }

  .today-event {
    grid-template-columns: 43px 26px minmax(0, 1fr);
    min-height: 0;
  }

  .today-event-time {
    padding-right: 6px;
    font-size: 10px;
  }

  .today-event-dot {
    width: 21px;
    height: 21px;
    font-size: 9px;
  }

  .today-event-card {
    margin-left: 5px;
    padding: 12px;
    gap: 10px;
  }

  .today-event-title strong {
    font-size: 13px;
    white-space: normal;
  }

  .today-event-title small {
    font-size: 9px;
  }

  .today-event-meta {
    margin-left: 0;
  }

  .today-event-actions {
    padding-left: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .today-event-action {
    min-height: 32px;
    padding: 7px 9px;
    font-size: 10px;
  }

  .today-now-row {
    grid-template-columns: 43px 26px minmax(0, 1fr);
  }

  .today-now-row time {
    padding-right: 6px;
    font-size: 9px;
  }

  .today-coach .dash-brief-row {
    grid-template-columns: 45px minmax(0, 1fr);
    gap: 8px;
  }

  .today-coach .dash-coach-input-row {
    padding-top: 16px;
  }

  .today-energy-number strong {
    font-size: 25px;
  }

  .mobile-more-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-more-grid button {
    min-height: 68px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 10px 13px;
    text-align: left;
  }

  .mobile-more-grid button span {
    font-size: 18px;
  }
}

/* ═══ Today meal cards: compact, readable and action-oriented ═══ */
.today-event {
  min-height: 74px;
}

.today-event-time {
  padding-top: 14px;
  font-size: 13px;
}

.today-event-rail {
  padding-top: 7px;
}

.today-event-card {
  grid-template-columns: minmax(300px, 1fr) minmax(280px, auto) minmax(350px, 0.95fr);
  gap: 12px;
  margin-bottom: 6px;
  padding: 10px 13px;
  border-radius: 14px;
}

.today-event-main {
  min-width: 0;
}

.today-event-title {
  gap: 9px;
}

.today-event-title strong {
  font-size: 16px;
  line-height: 1.22;
  font-weight: 800;
}

.today-event-title small {
  margin-bottom: 3px;
  font-size: 10px;
  line-height: 1;
}

.today-event-kind-icon {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.today-event-shuffle {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(139, 92, 246, 0.32);
  border-radius: 10px;
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.09);
  cursor: pointer;
  transition: var(--transition);
}

.today-event-shuffle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.today-event-shuffle circle {
  fill: currentColor;
  stroke: none;
}

.today-event-shuffle:hover {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.68);
  background: rgba(139, 92, 246, 0.17);
  transform: rotate(7deg);
}

.today-event-shuffle:disabled {
  cursor: wait;
  opacity: 0.65;
}

.today-event-shuffle.loading svg {
  animation: today-dice-spin 0.75s linear infinite;
}

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

.today-event-meta {
  margin: 4px 0 0 41px;
  gap: 0;
  font-size: 11px;
  line-height: 1.2;
}

.today-event-meta span::after {
  display: none;
}

.today-meal-macro-summary {
  margin: 6px 0 0 41px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px 13px;
  font-variant-numeric: tabular-nums;
}

.today-meal-macro-summary span {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.today-meal-macro-summary span::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: var(--meal-macro-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--meal-macro-color) 32%, transparent);
}

.today-meal-macro-summary b {
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
}

.today-meal-macro-summary small {
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1;
  font-weight: 650;
}

.today-event-actions {
  max-width: 310px;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
}

.today-event-action {
  min-height: 35px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 790;
}

.today-event-action-ai {
  color: #b6a4ff;
  border-color: rgba(139, 92, 246, 0.26);
  background: rgba(139, 92, 246, 0.07);
}

.today-event-action-ai:hover {
  color: #d4c8ff;
  border-color: rgba(167, 139, 250, 0.56);
  background: rgba(139, 92, 246, 0.13);
}

.today-event-macro-bars {
  height: 58px;
  padding-left: 13px;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
  gap: 8px;
}

.today-event-macro-metric {
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: 1fr;
  align-items: center;
  gap: 6px;
  text-align: left;
}

.today-event-macro-columns {
  width: 22px;
  height: 48px;
  gap: 3px;
}

.today-event-macro-columns i {
  width: 9px;
}

.today-event-macro-copy {
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  justify-items: start;
  gap: 3px;
  font-size: 9px;
  line-height: 1.05;
  white-space: nowrap;
}

.today-event-macro-copy b {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 780;
}

.today-event-macro-copy b i {
  color: var(--macro-color);
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
}

.today-event-macro-copy span {
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 700;
}

.today-event-macro-copy span strong {
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 900;
}

.today-event-macro-copy small {
  overflow: hidden;
  max-width: 100%;
  color: var(--text-muted);
  font-size: 7.5px;
  text-overflow: ellipsis;
}

@container (max-width: 1120px) {
  .today-event-card {
    grid-template-columns: minmax(280px, 1fr) minmax(280px, auto);
  }

  .today-event-macro-bars {
    grid-column: 1 / -1;
    height: 53px;
    padding: 7px 0 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .today-event-macro-columns {
    height: 42px;
  }
}

@container (max-width: 700px) {
  .today-event-card {
    grid-template-columns: 1fr;
  }

  .today-event-actions {
    max-width: none;
  }

  .today-event-macro-bars {
    grid-column: auto;
  }
}

@container (max-width: 500px) {
  .today-meal-macro-summary {
    margin-left: 0;
  }

  .today-event-macro-bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }
}

/* ═══ AI / photo meal draft ═══════════════════════════════════ */
#extra-meal-box.modal-box-wide {
  width: min(860px, calc(100vw - 28px));
  max-width: 860px;
  max-height: min(900px, calc(100vh - 32px));
}

.extra-meal-modal-header {
  flex: 0 0 auto;
}

.extra-meal-draft-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  padding: 11px 13px;
  border: 1px solid rgba(0, 212, 163, 0.23);
  border-radius: 12px;
  background: rgba(0, 212, 163, 0.055);
}

.extra-meal-draft-notice > span {
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--green);
  background: rgba(0, 212, 163, 0.12);
  font-size: 9px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.extra-meal-draft-notice strong,
.extra-meal-draft-notice small {
  display: block;
}

.extra-meal-draft-notice strong {
  color: var(--text-primary);
  font-size: 13px;
}

.extra-meal-draft-notice small {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.38;
}

.extra-meal-row {
  grid-template-columns: 145px minmax(0, 1fr);
}

.extra-meal-field-label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 780;
}

.extra-meal-field-label > span {
  padding-left: 2px;
}

.extra-meal-textarea {
  min-height: 64px;
  line-height: 1.45;
}

.extra-meal-actions-row {
  margin-top: -3px;
}

.extra-meal-ai-btn {
  min-height: 38px;
  padding: 8px 13px;
  font-size: 12px;
}

.extra-meal-photo-btn {
  color: var(--green);
  border-color: rgba(0, 212, 163, 0.26);
  background: rgba(0, 212, 163, 0.07);
}

.extra-meal-macro-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.extra-meal-macro-editor label {
  min-width: 0;
  padding: 9px 10px 10px;
  border: 1px solid color-mix(in srgb, var(--draft-macro) 24%, var(--border));
  border-radius: 11px;
  background: color-mix(in srgb, var(--draft-macro) 5%, var(--bg-2));
}

.extra-meal-macro-editor label > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  color: var(--draft-macro);
  font-size: 10px;
  font-weight: 850;
}

.extra-meal-macro-editor label small {
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 700;
}

.extra-meal-macro-editor input {
  width: 100%;
  margin-top: 5px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text-primary);
  background: transparent;
  font-size: 19px;
  line-height: 1.15;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.extra-meal-ai-chat {
  overflow: hidden;
  border: 1px solid rgba(139, 92, 246, 0.24);
  border-radius: 14px;
  background: rgba(139, 92, 246, 0.045);
}

.extra-meal-ai-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px 10px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
}

.extra-meal-ai-chat-head strong,
.extra-meal-ai-chat-head span {
  display: block;
}

.extra-meal-ai-chat-head strong {
  color: var(--text-primary);
  font-size: 13px;
}

.extra-meal-ai-chat-head div > span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 10px;
}

.extra-meal-unsaved-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 7px;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.12);
  font-size: 8px !important;
  font-weight: 900;
  letter-spacing: 0.55px;
  text-transform: uppercase;
}

.extra-meal-chat-messages {
  max-height: 180px;
  overflow-y: auto;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.extra-meal-chat-empty {
  padding: 8px 9px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.extra-meal-chat-message {
  max-width: 86%;
  padding: 8px 10px;
  border-radius: 10px 10px 10px 3px;
  color: var(--text-secondary);
  background: var(--bg-2);
}

.extra-meal-chat-message.user {
  align-self: flex-end;
  border-radius: 10px 10px 3px 10px;
  background: rgba(79, 158, 240, 0.12);
}

.extra-meal-chat-message.error {
  color: var(--red);
  background: rgba(240, 97, 79, 0.08);
}

.extra-meal-chat-message small {
  display: block;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 850;
  text-transform: uppercase;
}

.extra-meal-chat-message p {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
}

.extra-meal-chat-message.loading p {
  animation: extra-meal-pulse 1s ease-in-out infinite alternate;
}

@keyframes extra-meal-pulse {
  to { opacity: 0.5; }
}

.extra-meal-chat-quick {
  padding: 0 12px 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.extra-meal-chat-quick button {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.extra-meal-chat-quick button:hover {
  color: var(--text-primary);
  border-color: rgba(167, 139, 250, 0.45);
}

.extra-meal-chat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(139, 92, 246, 0.15);
}

.extra-meal-chat-row textarea {
  min-height: 38px;
  max-height: 90px;
  resize: vertical;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  color: var(--text-primary);
  background: var(--bg-2);
  font: inherit;
  font-size: 11px;
}

.extra-meal-chat-row textarea:focus {
  border-color: rgba(167, 139, 250, 0.58);
}

.extra-meal-chat-row button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: #7c3aed;
  cursor: pointer;
}

.extra-meal-chat-row button:disabled {
  opacity: 0.5;
  cursor: wait;
}

.extra-meal-chat-row svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.extra-meal-search-block {
  border-top: 0;
  padding: 0;
}

.extra-meal-search-block summary {
  cursor: pointer;
  list-style-position: inside;
  text-transform: none;
}

.extra-meal-search-block[open] summary {
  margin-bottom: 8px;
}

.extra-meal-save-footnote {
  margin: -6px 0 0;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.35;
  text-align: right;
}

@media (max-width: 700px) {
  #extra-meal-box.modal-box-wide {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .extra-meal-row {
    grid-template-columns: 1fr;
  }

  .extra-meal-macro-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .extra-meal-photo-preview {
    grid-template-columns: 72px minmax(0, 1fr) auto;
  }

  .extra-meal-photo-thumb {
    width: 72px;
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .today-hero-progress-fill,
  .today-event-card,
  .today-macro-track i,
  .today-detail-link-card {
    transition: none;
  }
}

/* Today home: one live companion module beside the full day timeline. */
.today-primary-grid {
  display: grid;
  grid-template-columns: minmax(350px, 0.72fr) minmax(650px, 1.58fr);
  gap: 18px;
  align-items: stretch;
}

.today-companion-column {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  isolation: isolate;
}

.today-companion-column .today-hero,
.today-companion-column .today-coach {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.today-companion-column .today-coach {
  border-top: 1px solid var(--border);
}

.today-primary-grid .today-hero,
.today-primary-grid .today-hero-content {
  min-height: 0;
}

.today-primary-grid .today-hero-content {
  padding: 27px 28px 24px;
}

.today-hero-moment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  align-items: stretch;
  gap: 18px;
}

.today-hero-clock {
  min-width: 0;
  align-self: center;
}

.today-companion-column .today-weather {
  position: static;
  width: 116px;
  height: 116px;
  margin: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 16px;
  color: rgba(241, 248, 255, 0.68);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
}

.today-companion-column .today-weather-icon {
  width: 31px;
  height: 31px;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 20px;
}

.today-weather-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.today-companion-column .today-weather-value {
  order: -1;
  color: rgba(255, 255, 255, 0.94);
  font-size: 22px;
  line-height: 1;
  font-weight: 820;
  letter-spacing: -0.5px;
}

.today-companion-column .today-weather-place,
.today-companion-column .today-weather-condition {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: rgba(236, 246, 255, 0.62);
  font-size: 9px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-companion-column .today-eyebrow {
  max-width: 100%;
  margin: 0 0 12px;
  color: rgba(247, 251, 255, 0.94);
  font-size: 17px;
  line-height: 1.18;
  font-weight: 820;
  letter-spacing: -0.25px;
  text-transform: none;
}

.today-primary-grid .today-time {
  font-size: clamp(64px, 5.3vw, 84px);
}

.today-primary-grid .today-coach {
  min-height: 360px;
}

.today-primary-grid .today-coach .dash-brief-text {
  font-size: 14px;
  line-height: 1.48;
}

.today-timeline-card {
  container-type: inline-size;
}

.today-timeline-layout {
  display: block;
}

.today-timeline-layout .today-event-title strong {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.today-section-tools {
  display: flex;
  align-items: center;
  gap: 18px;
}

.today-timeline-card .today-section-head h2 {
  margin-top: 0;
}

.today-timeline-progress {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 13px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.today-timeline-progress span {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.today-timeline-progress span:not(:last-child)::after {
  content: "·";
  position: absolute;
  right: -9px;
  color: var(--border-strong);
}

.today-timeline-progress strong {
  color: var(--text-primary);
  font-weight: 850;
}

.today-timeline-progress-now {
  color: var(--green) !important;
  font-weight: 850;
}

.today-timeline-progress .needs-attention {
  color: var(--red);
  font-weight: 750;
}

.today-timeline-progress .is-complete {
  color: var(--green);
  font-weight: 750;
}

.today-row-macro-key {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1;
  font-weight: 720;
  white-space: nowrap;
}

.today-row-macro-key span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.today-row-macro-key i {
  width: 7px;
  height: 13px;
  display: inline-block;
  border-radius: 3px 3px 1px 1px;
}

.today-row-macro-key i.actual {
  background: var(--green);
}

.today-row-macro-key i.plan {
  border: 1px dashed currentColor;
  background: rgba(148, 163, 184, 0.14);
}

.today-event-card {
  grid-template-columns: minmax(235px, 1fr) auto minmax(250px, 300px);
}

.today-event-macro-bars {
  min-width: 0;
  height: 88px;
  padding-left: 15px;
  display: grid;
  align-items: stretch;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border-left: 1px solid var(--border);
}

.today-event-macro-metric {
  min-width: 0;
  display: grid;
  grid-template-rows: 48px auto;
  gap: 5px;
  text-align: center;
}

.today-event-macro-columns {
  height: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  border-bottom: 1px solid var(--border);
}

.today-event-macro-columns i {
  width: 10px;
  min-height: 0;
  display: block;
  border-radius: 3px 3px 0 0;
  transition: height 0.35s ease;
}

.today-event-macro-columns i.actual {
  background: var(--macro-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--macro-color) 24%, transparent);
}

.today-event-macro-columns i.plan {
  border: 1px dashed color-mix(in srgb, var(--macro-color) 72%, transparent);
  background: color-mix(in srgb, var(--macro-color) 17%, transparent);
}

.today-event-macro-copy {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 8px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.today-event-macro-copy b {
  color: var(--macro-color);
  font-size: 9px;
  font-weight: 900;
}

.today-event-macro-copy span {
  overflow: hidden;
  color: var(--text-secondary);
  font-weight: 800;
  text-overflow: ellipsis;
}

.today-event-macro-copy em {
  font-style: normal;
}

.today-event-macro-copy small {
  flex-basis: 100%;
  color: var(--text-muted);
  font-size: 7px;
  line-height: 1.15;
}

@container (max-width: 900px) {
  .today-event-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .today-event-macro-bars {
    grid-column: 1 / -1;
    height: 82px;
    padding: 11px 0 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }
}

@container (max-width: 560px) {
  .today-section-tools {
    align-items: flex-end;
    flex-direction: column-reverse;
    gap: 7px;
  }

  .today-row-macro-key {
    font-size: 8px;
  }

  .today-event-card {
    grid-template-columns: 1fr;
  }

  .today-event-actions {
    padding-left: 0;
  }

  .today-event-macro-bars {
    grid-column: auto;
  }

  .today-event-macro-copy {
    gap: 1px 2px;
  }
}

.today-support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
  align-items: stretch;
}

.today-support-grid > section {
  min-width: 0;
  height: 100%;
}

.today-event-card {
  cursor: pointer !important;
}

.today-event-card:hover {
  border-color: rgba(79, 158, 240, 0.42);
  box-shadow: 0 12px 32px rgba(16, 35, 75, 0.11);
  transform: translateY(-1px);
}

.today-event-card:active {
  transform: translateY(0);
}

.today-event-modal-chat {
  margin-top: 22px;
  padding: 17px;
  border: 1px solid rgba(79, 158, 240, 0.2);
  border-radius: 15px;
  background:
    radial-gradient(circle at 100% 0, rgba(0, 212, 163, 0.08), transparent 38%),
    var(--bg-2);
}

.today-event-modal-chat-head {
  margin-bottom: 12px;
}

.today-event-modal-chat-head strong,
.today-event-modal-chat-head span {
  display: block;
}

.today-event-modal-chat-head strong {
  color: var(--text-primary);
  font-size: 13px;
}

.today-event-modal-chat-head span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.today-event-modal-chat-reply {
  margin-bottom: 12px;
  padding: 11px 12px;
  border-left: 3px solid var(--green);
  border-radius: 8px;
  color: var(--text-secondary);
  background: var(--bg-1);
  font-size: 12px;
  line-height: 1.55;
}

.today-event-modal-chat-reply.hidden {
  display: none;
}

.today-event-modal-chat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: end;
}

.today-event-modal-chat-input {
  width: 100%;
  min-height: 42px;
  max-height: 112px;
  padding: 11px 12px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text-primary);
  background: var(--bg-1);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  outline: none;
}

.today-event-modal-chat-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79, 158, 240, 0.11);
}

.today-event-modal-chat-send {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
}

.today-event-modal-chat-send:disabled {
  opacity: 0.55;
  cursor: wait;
}

.today-event-modal-chat-send svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 1180px) {
  .today-primary-grid {
    grid-template-columns: minmax(320px, 0.72fr) minmax(570px, 1.4fr);
  }

  .today-support-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .today-support-grid .today-secondary-card {
    grid-column: 1 / 3;
  }
}

@media (max-width: 1020px) {
  .today-primary-grid {
    grid-template-columns: 1fr;
  }

  .today-companion-column {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .today-primary-grid .today-hero,
  .today-primary-grid .today-hero-content {
    min-height: 0;
  }

  .today-primary-grid .today-coach {
    min-height: 360px;
  }
}

@media (max-width: 820px) {
  .today-primary-grid,
  .today-support-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .today-companion-column {
    grid-template-columns: 1fr;
    gap: 0;
    border-radius: 18px;
  }

  .today-support-grid {
    margin-top: 12px;
  }

  .today-support-grid .today-secondary-card {
    grid-column: auto;
  }

  .today-primary-grid .today-hero,
  .today-primary-grid .today-hero-content {
    min-height: 0;
  }

  .today-primary-grid .today-coach {
    min-height: 0;
  }
}

@media (max-width: 580px) {
  .today-hero-moment {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 11px;
  }

  .today-primary-grid .today-time {
    font-size: 64px;
    letter-spacing: -3.5px;
  }

  .today-companion-column .today-weather {
    width: 88px;
    height: 88px;
    padding: 9px;
    border-radius: 13px;
    gap: 4px;
  }

  .today-companion-column .today-weather-icon {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }

  .today-companion-column .today-weather-value {
    font-size: 17px;
  }

  .today-companion-column .today-weather-place,
  .today-companion-column .today-weather-condition {
    font-size: 7px;
  }

  .today-companion-column .today-eyebrow {
    margin-bottom: 8px;
    font-size: 14px;
  }

  .today-coach .dash-coach-input-row {
    margin-top: 12px;
    padding-top: 0;
  }

  .today-event-modal-chat {
    margin-top: 18px;
    padding: 13px;
  }
}

/* Final cascade for the timeline card — kept after the dashboard layout rules. */
.today-event-card {
  grid-template-columns: minmax(260px, 1fr) 190px minmax(300px, 1.15fr);
}

.today-event-macro-bars {
  grid-column: auto;
  height: 58px;
  padding: 0 0 0 13px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 0;
  border-left: 1px solid var(--border);
}

.today-event-macro-metric {
  grid-template-columns: 1fr;
  grid-template-rows: 12px 30px 13px;
  gap: 1px;
  overflow: hidden;
  padding-inline: 3px;
  text-align: center;
}

.today-event-macro-columns {
  grid-row: 2;
  width: 100%;
  height: 30px;
  border-bottom-color: color-mix(in srgb, var(--macro-color) 22%, var(--border));
}

.today-event-macro-columns i {
  width: 12px;
}

.today-event-macro-copy {
  display: contents;
}

.today-event-macro-copy b {
  grid-row: 1;
  justify-self: center;
  gap: 3px;
  font-size: 10px;
}

.today-event-macro-copy b i {
  display: none;
}

.today-event-macro-copy span {
  grid-row: 3;
  justify-self: center;
  font-size: 10px;
}

.today-event-macro-copy span strong {
  font-size: 11px;
}

.today-event-macro-copy small {
  display: none;
}

.today-meal-macro-summary b {
  font-size: 13px;
}

.today-meal-macro-summary small {
  font-size: 9.5px;
}

@container (max-width: 720px) {
  .today-event-card {
    grid-template-columns: minmax(235px, 1fr) minmax(230px, auto);
  }

  .today-event-macro-bars {
    grid-column: 1 / -1;
    height: 53px;
    padding: 7px 0 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .today-event-macro-columns {
    height: 30px;
  }
}

@container (max-width: 540px) {
  .today-event-card {
    grid-template-columns: 1fr;
  }

  .today-event-macro-bars {
    grid-column: auto;
  }
}

@container (max-width: 390px) {
  .today-event-macro-bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }
}

/* Dense desktop timeline: all daily meals stay visible without shrinking copy. */
.today-timeline-card {
  padding: 20px 22px 14px;
}

.today-timeline-card .today-section-head {
  margin-bottom: 14px;
}

.today-timeline-progress {
  margin-top: 6px;
}

.today-event {
  min-height: 0;
}

.today-event-time {
  padding-top: 12px;
}

.today-event-rail {
  padding-top: 6px;
}

.today-event-card {
  grid-template-columns: minmax(240px, 1fr) 268px minmax(280px, 360px);
  gap: 10px;
  margin: 0 0 4px 8px;
  padding: 8px 12px;
}

.today-event-title {
  align-items: flex-start;
}

.today-event-title > span:last-of-type {
  align-self: center;
}

.today-event-heading-kicker {
  display: flex !important;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 5px;
}

.today-event-heading-kicker i {
  color: var(--text-secondary);
  font-style: normal;
  letter-spacing: 0;
  text-transform: none;
}

.today-event-overdue .today-event-heading-kicker i {
  color: var(--red);
}

.today-event-current .today-event-heading-kicker i,
.today-event-done .today-event-heading-kicker i {
  color: var(--green);
}

.today-meal-macro-summary {
  margin: 5px 0 0 41px;
  flex-wrap: nowrap;
  gap: 9px;
}

.today-meal-macro-summary span {
  gap: 3px;
}

.today-meal-macro-summary small {
  display: none;
}

.today-meal-macro-summary b {
  font-size: 12px;
}

.today-event-actions {
  width: 268px;
  max-width: none;
  flex-wrap: nowrap;
  gap: 5px;
}

.today-event-action {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 10.5px;
}

.today-event-macro-bars {
  height: 52px;
}

.today-event-macro-metric {
  grid-template-rows: 11px 27px 12px;
}

.today-event-macro-columns {
  height: 27px;
}

.today-now-row {
  min-height: 34px;
}

@container (max-width: 980px) {
  .today-event-card {
    grid-template-columns: minmax(220px, 1fr) 248px minmax(270px, 1fr);
  }

  .today-event-actions {
    width: 248px;
  }

  .today-event-action {
    padding-inline: 7px;
    font-size: 10px;
  }

  .today-event-macro-copy b,
  .today-event-macro-copy span {
    font-size: 9px;
  }

  .today-event-macro-copy span strong {
    font-size: 10px;
  }
}

@container (max-width: 760px) {
  .today-event-card {
    grid-template-columns: minmax(230px, 1fr) minmax(245px, auto);
  }

  .today-event-actions {
    width: auto;
  }

  .today-event-macro-bars,
  .today-row-macro-key {
    display: none;
  }
}

@container (max-width: 540px) {
  .today-timeline-card {
    padding-inline: 14px;
  }

  .today-event-card {
    grid-template-columns: 1fr;
  }

  .today-event-actions {
    flex-wrap: wrap;
  }

  .today-meal-macro-summary {
    margin-left: 0;
    flex-wrap: wrap;
  }
}

/* ═══ Fluid dashboard canvas + compact companion + glass header ═══ */
@media (min-width: 1021px) {
  body[data-current-tab="dashboard"] .today-home {
    width: 100%;
    max-width: 2200px;
  }

  body[data-current-tab="dashboard"] .today-primary-grid {
    height: clamp(670px, calc(100dvh - 98px), 900px);
    min-height: 0;
  }

  body[data-current-tab="dashboard"] .today-companion-column {
    grid-template-rows: minmax(0, 2fr) minmax(0, 3fr);
  }

  body[data-current-tab="dashboard"] .today-primary-grid .today-hero,
  body[data-current-tab="dashboard"] .today-primary-grid .today-hero-content,
  body[data-current-tab="dashboard"] .today-primary-grid .today-coach {
    min-height: 0;
  }

  body[data-current-tab="dashboard"] .today-timeline-card {
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  body[data-current-tab="dashboard"] .today-timeline-layout {
    min-height: 0;
    flex: 1;
    display: flex;
  }

  body[data-current-tab="dashboard"] .today-timeline {
    min-height: 0;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  body[data-current-tab="dashboard"] .today-event {
    min-height: 74px;
    flex: 1 1 0;
  }

  body[data-current-tab="dashboard"] .today-now-row {
    min-height: 32px;
    flex: 0 0 32px;
  }

  body[data-current-tab="dashboard"] .today-event-card {
    height: calc(100% - 4px);
  }

  body[data-current-tab="dashboard"] .today-primary-grid .today-hero-content {
    height: 100%;
    padding: 12px 18px 10px;
  }

  body[data-current-tab="dashboard"] .today-hero-moment {
    min-height: 70px;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 12px;
  }

  body[data-current-tab="dashboard"] .today-primary-grid .today-time {
    font-size: clamp(56px, 4.2vw, 70px);
    line-height: 0.9;
    letter-spacing: -4px;
  }

  body[data-current-tab="dashboard"] .today-companion-column .today-weather {
    width: 92px;
    height: 70px;
    padding: 8px 9px;
    gap: 3px;
    border-radius: 13px;
  }

  body[data-current-tab="dashboard"] .today-companion-column .today-weather-icon {
    width: 20px;
    height: 20px;
    font-size: 15px;
  }

  body[data-current-tab="dashboard"] .today-companion-column .today-weather-value {
    font-size: 18px;
  }

  body[data-current-tab="dashboard"] .today-companion-column .today-weather-place,
  body[data-current-tab="dashboard"] .today-companion-column .today-weather-condition {
    font-size: 7.5px;
    line-height: 1.1;
  }

  body[data-current-tab="dashboard"] .today-date {
    margin-top: 4px;
    font-size: 15px;
    line-height: 1.2;
  }

  body[data-current-tab="dashboard"] .today-hero-progress {
    margin-top: 3px;
  }

  body[data-current-tab="dashboard"] .today-companion-column .today-coach .dash-coach-input-row {
    margin-top: auto;
    padding-top: 10px;
  }
}

@media (min-width: 821px) {
  .app-header {
    padding-inline: 18px;
    border-bottom-color: rgba(111, 141, 191, 0.15);
    background:
      radial-gradient(circle at 12% -80%, rgba(79, 158, 240, 0.12), transparent 31%),
      linear-gradient(180deg, rgba(15, 18, 31, 0.96), rgba(9, 11, 20, 0.94));
    box-shadow: 0 8px 30px rgba(2, 6, 23, 0.2);
  }

  .header-inner {
    height: 50px;
  }

  .app-logo {
    gap: 9px;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(126, 231, 204, 0.28);
    border-radius: 10px;
    background:
      linear-gradient(145deg, rgba(79, 158, 240, 0.92), rgba(0, 212, 163, 0.82));
    box-shadow: 0 7px 18px rgba(0, 212, 163, 0.12);
  }

  .logo-text {
    font-size: 15px;
    letter-spacing: -0.35px;
  }

  .nav-tabs {
    max-width: fit-content;
    flex: 0 1 auto;
    gap: 2px;
    padding: 2px;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 13px;
    background: rgba(20, 24, 41, 0.58);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.025),
      0 8px 24px rgba(2, 6, 23, 0.12);
  }

  .nav-tab {
    min-height: 36px;
    gap: 3px;
    padding: 3px 9px;
    border-radius: 10px;
    font-weight: 650;
  }

  .nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.055);
  }

  .nav-tab.active {
    color: #8bc4ff;
    border-color: rgba(79, 158, 240, 0.34);
    background:
      linear-gradient(145deg, rgba(79, 158, 240, 0.19), rgba(0, 212, 163, 0.09));
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.06),
      0 5px 14px rgba(37, 99, 235, 0.1);
  }

  .nav-tab .tab-icon {
    font-size: 16px;
  }

  .nav-tab .tab-label {
    font-size: 8.5px;
    font-weight: 700;
  }

  .theme-toggle-btn {
    width: 30px;
    height: 30px;
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.055);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  }

  .user-avatar {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.18);
  }

  [data-theme="light"] .app-header {
    border-bottom-color: rgba(15, 23, 42, 0.1);
    background:
      radial-gradient(circle at 12% -80%, rgba(37, 99, 235, 0.09), transparent 31%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(244, 246, 251, 0.95));
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
  }

  [data-theme="light"] .nav-tabs {
    border-color: rgba(15, 23, 42, 0.08);
    background: rgba(232, 236, 245, 0.72);
  }
}

@media (min-width: 1021px) and (max-height: 820px) {
  body[data-current-tab="dashboard"] .today-primary-grid .today-hero-content {
    padding: 8px 14px 6px;
  }

  body[data-current-tab="dashboard"] .today-hero-moment {
    min-height: 48px;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 9px;
  }

  body[data-current-tab="dashboard"] .today-primary-grid .today-time {
    font-size: 52px;
    line-height: 0.9;
    letter-spacing: -3px;
  }

  body[data-current-tab="dashboard"] .today-companion-column .today-weather {
    width: 92px;
    height: 48px;
    padding: 5px 7px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
  }

  body[data-current-tab="dashboard"] .today-companion-column .today-weather-icon {
    flex: 0 0 17px;
    width: 17px;
    height: 17px;
    font-size: 13px;
  }

  body[data-current-tab="dashboard"] .today-companion-column .today-weather-value {
    font-size: 15px;
  }

  body[data-current-tab="dashboard"] .today-date {
    margin-top: 0;
    font-size: 13px;
  }

  body[data-current-tab="dashboard"] .today-hero-progress {
    margin-top: 1px;
  }

  body[data-current-tab="dashboard"] .today-day-scale {
    margin-top: 14px;
  }

  body[data-current-tab="dashboard"] .today-day-macro-rail {
    margin-top: 5px;
  }

  body[data-current-tab="dashboard"] .today-day-legend {
    margin-top: 4px;
  }
}
