:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --ink: #f8fafc;
  --muted: #a8adb7;
  --panel: #15181d;
  --panel-strong: #1b1f26;
  --panel-soft: #101318;
  --line: #2a3039;
  --brand: #d20f2f;
  --brand-dark: #8f0b22;
  --accent: #ff334f;
  --focus: #ff4b61;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(210, 15, 47, 0.26), transparent 310px),
    linear-gradient(180deg, #14171c 0 174px, transparent 174px),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px 20px 70px;
}

.topbar,
.date-nav,
.view-switch,
.section-heading,
.day-card,
.summary-card {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin: -20px -20px 0;
  padding: 14px 20px 12px;
  border-bottom: 1px solid rgba(255, 51, 79, 0.24);
  background: #14171c;
  color: white;
}

.brand-lockup {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: min(58vw, 430px);
  max-height: 66px;
  object-fit: contain;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  overflow: hidden;
  font-size: clamp(1.5rem, 5vw, 2.35rem);
  font-weight: 500;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h2 {
  font-size: 1.15rem;
}

.header-actions {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 16px;
}

.icon-button,
.header-icon-button,
.primary-button,
.segment {
  border: 1px solid var(--line);
  cursor: pointer;
}

.header-icon-button {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 0;
  background: transparent;
  color: white;
}

.header-icon-button:hover {
  color: var(--accent);
}

.header-icon-button svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.date-input {
  position: absolute;
  right: 62px;
  top: 0;
  width: 46px;
  height: 46px;
  border: 0;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
}

.date-input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.icon-button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.week-title {
  margin: 4px 0 4px;
  text-align: center;
  line-height: 1;
}

.week-title small {
  color: rgba(248, 250, 252, 0.5);
  font-size: 0.72rem;
  font-weight: 500;
}

.section-heading span,
.summary-card small,
.day-card small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
}

.view-switch {
  width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(21, 24, 29, 0.82);
}

.segment {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--brand);
  color: white;
}

.date-nav {
  margin: 0 -20px 14px;
  padding: 14px 14px 16px;
  border-bottom: 1px solid rgba(255, 51, 79, 0.2);
  background: #14171c;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
  touch-action: pan-y;
}

.date-nav.current-week {
  border-color: rgba(255, 51, 79, 0.72);
  box-shadow:
    inset 0 -1px 0 rgba(255, 51, 79, 0.54),
    inset 0 1px 0 rgba(255, 51, 79, 0.26);
}

.day-strip {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.day-card {
  width: min(50px, 11.5vw);
  height: min(50px, 11.5vw);
  min-width: 38px;
  min-height: 38px;
  justify-self: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: transparent;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
}

.day-card.active {
  border-color: var(--accent);
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(210, 15, 47, 0.18);
}

.day-card.today {
  border-color: rgba(255, 75, 97, 0.85);
}

.day-card.completed {
  background: rgba(210, 15, 47, 0.18);
  border-color: rgba(255, 51, 79, 0.42);
}

.day-card.completed.active {
  background: var(--brand);
  border-color: var(--accent);
}

.workout-detail {
  touch-action: pan-y;
}

.section-heading {
  justify-content: space-between;
  gap: 14px;
  margin: 22px 0 12px;
}

.primary-button {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--brand);
  color: white;
  font-weight: 900;
}

.primary-button:hover,
.icon-button:hover {
  border-color: var(--accent);
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.summary-card {
  position: relative;
  min-height: 160px;
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-card.complete {
  border-color: rgba(255, 51, 79, 0.42);
  background:
    linear-gradient(135deg, rgba(210, 15, 47, 0.12), transparent 52%),
    var(--panel);
}

.summary-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.summary-check {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid rgba(255, 51, 79, 0.5);
  border-radius: 50%;
  background: rgba(210, 15, 47, 0.2);
  color: white;
  font-size: 0.9rem;
  font-weight: 900;
}

.summary-card h3 {
  margin: 0;
  font-size: 0.98rem;
}

.summary-list {
  display: grid;
  gap: 8px;
  width: 100%;
}

.summary-item {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.summary-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.workout-cards {
  display: grid;
  gap: 14px;
}

.exercise-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.exercise-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.exercise-card h3,
.exercise-heading h3 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 1rem;
}

.exercise-heading {
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.exercise-heading h3 {
  min-width: 0;
  border: 0;
}

.set-grid,
.set-row {
  display: grid;
  grid-template-columns: minmax(58px, 0.9fr) minmax(54px, 0.8fr) minmax(86px, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.set-grid-header {
  padding: 9px 12px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.set-row {
  min-height: 52px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}

.set-list .set-row:first-child {
  border-top: 0;
}

.set-index {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.set-reps {
  font-weight: 800;
}

.weight-input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #0f1217;
  color: var(--ink);
}

.check-input {
  width: 22px;
  height: 22px;
  accent-color: var(--brand);
}

tr.complete {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.set-row.complete,
.run-row.complete {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.22);
}

.set-row.complete .set-index,
.run-row.complete strong {
  text-decoration: line-through;
  text-decoration-color: var(--accent);
}

.run-list {
  display: grid;
}

.run-row {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.run-row:first-child {
  border-top: 0;
}

.run-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(64px, auto) 42px;
  align-items: center;
  gap: 12px;
}

.run-main strong {
  min-width: 0;
}

.run-target {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.run-distance {
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.reminder-card {
  border-color: rgba(255, 51, 79, 0.24);
}

.reminder-list {
  display: grid;
}

.reminder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 800;
}

.reminder-row:first-child {
  border-top: 0;
}

.reminder-row.complete {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.22);
}

.reminder-row.complete span {
  text-decoration: line-through;
  text-decoration-color: var(--accent);
}

.metcon-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.metcon-heading h3,
.metcon-heading strong {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.metcon-heading strong {
  font-size: 0.9rem;
}

.metcon-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 12px 14px 14px;
  color: var(--ink);
  line-height: 1.28;
}

.metcon-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  margin: 0 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1217;
  color: var(--ink);
  font-weight: 900;
}

.metcon-check.complete {
  border-color: rgba(255, 51, 79, 0.45);
  background: rgba(210, 15, 47, 0.14);
  color: #ffffff;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.race-countdown {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin: 24px 0 0;
  border-top: 1px solid rgba(255, 51, 79, 0.18);
  padding: 18px 0 4px;
  color: var(--muted);
  text-align: center;
}

.race-countdown strong {
  color: white;
  font-size: clamp(2rem, 10vw, 3.4rem);
  line-height: 0.95;
}

.race-countdown span {
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px 14px 64px;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    margin: -14px -14px 0;
    padding: 12px 14px 10px;
  }

  .week-grid {
    grid-template-columns: 1fr;
  }

  .date-nav {
    margin: 0 -14px 14px;
    padding: 12px 8px 14px;
  }

  .day-card {
    font-size: 0.95rem;
  }

  .brand-logo {
    width: min(56vw, 286px);
    max-height: 54px;
  }

  .header-actions {
    gap: 8px;
  }

  .header-icon-button {
    width: 42px;
    height: 42px;
  }

  .header-icon-button svg {
    width: 28px;
    height: 28px;
  }

  .date-input {
    right: 50px;
    width: 42px;
    height: 42px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .set-grid,
  .set-row {
    grid-template-columns: 50px 48px minmax(74px, 1fr) 36px;
    gap: 8px;
  }

  .weight-input {
    min-width: 0;
  }

  .run-main {
    grid-template-columns: minmax(0, 1fr) minmax(54px, auto) 34px;
    gap: 8px;
  }

  .metcon-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px;
  }
}

[hidden] { display: none !important; }
.sample-notice { margin: 12px 0; color: var(--muted); font-size: .875rem; text-align: center; }

/* Daily nutrition */
.food-active .app-shell { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
.food-view { touch-action: pan-y; }
.header-actions { gap: 8px; }
.brand-logo { max-width: 100%; }
.header-icon-button[aria-pressed="true"] { color: var(--accent); background: rgba(210,15,47,.12); border-radius: 8px; }
.date-input { right: 54px; }
.weigh-in-state { padding: 0 14px; color: var(--muted); font-size: .875rem; }
.weigh-in-form { padding: 14px; }
.weigh-in-form label { font-size: .875rem; }
.weigh-in-form label span { color: var(--muted); }
.weigh-in-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.weigh-in-controls input { width: 110px; flex: 1 1 100px; max-width: 180px; min-height: 46px; border: 1px solid var(--line); background: var(--panel-soft); color: white; border-radius: 8px; padding: 10px; font: inherit; }
.weigh-in-form p { color: var(--muted); font-size: .875rem; line-height: 1.5; margin-top: 12px; }
.weigh-in-form button:disabled, .weigh-in-form input:disabled { opacity: .5; cursor: not-allowed; }
.food-day-confirm { display: flex; gap: 10px; align-items: center; margin: 20px 0 8px; padding: 14px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; font-size: .875rem; }
.food-day-confirm input { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--brand); }
.weight-panel { padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.weight-heading { display: flex; justify-content: space-between; gap: 20px; }
.weight-heading > div { display: grid; gap: 6px; }
.weight-heading span, .progress-note { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.weight-heading strong { font-size: 2rem; }
.weight-heading small { color: var(--muted); font-size: 1rem; font-weight: 400; }
.weight-chart { display: block; width: 100%; height: auto; margin: 16px 0 0; }
.weight-chart text { fill: var(--muted); font: 14px system-ui, sans-serif; }
.chart-grid { stroke: var(--line); }
.chart-goal { stroke: #85abbd; stroke-width: 2; stroke-dasharray: 6 6; }
.chart-actual { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; }
.chart-dot { fill: var(--accent); stroke: var(--panel); stroke-width: 1; }
.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .875rem; margin-bottom: 12px; }
.chart-legend span:first-child { color: var(--accent); }
.weight-progress { display: block; width: 100%; height: 10px; margin: 12px 0; accent-color: var(--accent); }
.weight-history { margin-top: 18px; color: var(--muted); font-size: .875rem; }
.weight-history summary { cursor: pointer; min-height: 40px; }
.weight-history table { width: 100%; text-align: left; border-collapse: collapse; }
.weight-history td, .weight-history th { padding: 10px; border-bottom: 1px solid var(--line); }
.progress-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 20px 0; }
.progress-stat { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-strong); }
.progress-stat > strong { font-size: 1.75rem; }
.progress-stat h3 { font-size: 1rem; margin: 10px 0 6px; }
.progress-stat p { color: var(--muted); font-size: .875rem; line-height: 1.5; }
@media (max-width: 760px) { .progress-stats { grid-template-columns: repeat(2,minmax(0,1fr)); } .brand-logo { width: min(44vw,286px); } .date-input { right: 50px; } }
@media (max-width: 380px) { .header-actions { gap: 2px; } .header-icon-button { width: 38px; } .date-input { right: 40px; width: 38px; } .progress-stats { grid-template-columns: 1fr; } }
.planner-navigation { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0; }
.planner-help { color: var(--muted); font-size: .875rem; line-height: 1.5; margin: 0 0 16px; }
#weekGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.planner-card { gap: 14px; padding: 16px; }
.planner-state { color: var(--muted); font-size: .8rem; }
.planner-card.complete .planner-state { color: var(--accent); }
.session-day-label { display: grid; width: 100%; gap: 6px; color: var(--muted); font-size: .875rem; }
.session-day-label select { width: 100%; min-height: 46px; padding: 10px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-soft); color: var(--ink); color-scheme: dark; }
.session-day-label select:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.planner-card .summary-topline { align-items: center; }
.planner-card .session-day-label { width: auto; flex: 0 1 175px; margin-left: auto; }
.planner-card .session-day-label select { min-height: 42px; padding: 8px; font-size: .875rem; }
.session-complete { display: block; color: var(--accent); font-size: .8rem; margin-top: 6px; }
.daily-tip-button { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 14px; margin-top: 18px; border: 1px solid rgba(255,51,79,.3); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; cursor: pointer; text-align: left; }
.daily-tip-button span { color: var(--muted); font-size: .875rem; white-space: nowrap; }
#dailyTipBody { font-size: 1rem; line-height: 1.65; margin-bottom: 24px; }
.tip-dialog .food-dialog-header h2 { margin-top: 8px; }
.tips-section > h3 { font-size: 1rem; margin: 24px 0 12px; }
.tips-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.tip-card { padding: 18px; background: var(--panel-strong); border: 1px solid var(--line); border-radius: 10px; }
.tip-card h4 { margin: 0 0 10px; font-size: 1rem; }
.tip-card p { color: var(--muted); font-size: 1rem; line-height: 1.6; }
.tip-card h3 { margin: 0 0 16px; font-size: 1.1rem; }
.tip-card dl { margin: 0; }
.tip-card dt { margin-top: 14px; font-size: .875rem; font-weight: 700; }
.tip-card dd { margin: 4px 0 0; color: var(--muted); line-height: 1.5; }
.coach-week-note { padding: 18px; margin: 16px 0; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; }
.coach-week-note h3 { margin: 0 0 10px; font-size: 1rem; }
.coach-week-note p { margin: 8px 0 0; line-height: 1.5; font-size: .95rem; }
.coach-session-detail, .coach-session-note { color: var(--muted); font-size: .875rem; line-height: 1.5; }
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .brand-lockup { flex-basis: 100%; justify-content: center; }
  .brand-logo { width: min(75vw, 320px); }
  .header-actions { width: 100%; justify-content: flex-end; }
  .tips-grid { grid-template-columns: 1fr; }
}
.day-session { display: grid; gap: 12px; }
.day-session-title { display: flex; align-items: center; gap: 12px; margin: 4px 0 0; font-size: 1rem; }
.day-session-title span { color: var(--muted); font-size: .8rem; font-weight: 400; }
.challenge-progress { display: grid; justify-items: center; gap: 8px; margin: 18px 0 8px; padding: 22px 8px 12px; border-top: 1px solid rgba(255,51,79,.24); text-align: center; }
.challenge-eyebrow { color: var(--muted); font-size: .875rem; }
.challenge-progress > strong { color: white; font-size: clamp(2.8rem, 10vw, 4rem); line-height: 1; letter-spacing: -.04em; }
.challenge-progress strong small { font-size: .5em; }
.challenge-phase { color: var(--muted); font-size: .875rem; }
.challenge-progress progress { appearance: none; width: min(100%, 440px); height: 12px; margin: 8px 0; overflow: hidden; border: 0; border-radius: 20px; background: var(--panel-strong); accent-color: var(--accent); }
.challenge-progress progress::-webkit-progress-bar { background: var(--panel-strong); border-radius: 20px; }
.challenge-progress progress::-webkit-progress-value { background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 20px; }
.challenge-progress progress::-moz-progress-bar { background: var(--accent); border-radius: 20px; }
.challenge-count { font-size: 1rem; font-weight: 650; }
.challenge-note { max-width: 440px; color: var(--muted); font-size: .875rem; line-height: 1.5; }
@media (max-width: 760px) { #weekGrid { grid-template-columns: 1fr; } }
.food-view > .section-heading { flex-direction: row; align-items: center; }
.text-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; min-height: 44px; padding: 8px; font: inherit; font-size: .875rem; }
.text-button:hover { color: white; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.calorie-card { display: grid; gap: 12px; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, rgba(210,15,47,.16), transparent 70%), var(--panel-strong); }
.calorie-card > span { color: var(--muted); font-size: .95rem; }
.calorie-card > strong { font-size: clamp(2.5rem, 10vw, 3.5rem); line-height: 1; letter-spacing: -.04em; }
.calorie-detail { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .875rem; }
.calorie-card progress { appearance: none; width: 100%; height: 12px; border: 0; border-radius: 20px; overflow: hidden; background: #080b0f; accent-color: var(--accent); }
.calorie-card progress::-webkit-progress-bar { background: #080b0f; border-radius: 20px; }
.calorie-card progress::-webkit-progress-value { background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 20px; }
.calorie-card progress::-moz-progress-bar { background: var(--accent); border-radius: 20px; }
.macro-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.macro-card { display: grid; gap: 10px; min-width: 0; padding: 16px 12px; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 9px; background: var(--panel); }
.macro-card.carbs { border-top-color: #d5ad69; }
.macro-card.fat { border-top-color: #85abbd; }
.macro-card > span { color: var(--muted); font-size: .875rem; }
.macro-card strong { font-size: 1.35rem; }
.macro-card small { display: block; margin-top: 3px; color: var(--muted); font-size: .875rem; font-weight: 400; }
.food-list { display: grid; gap: 12px; }
.food-entry { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-strong); }
.food-entry-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.food-entry h3 { margin: 0; font-size: 1rem; line-height: 1.5; overflow-wrap: anywhere; }
.food-entry-heading > strong { white-space: nowrap; padding-top: 3px; }
.food-entry small { color: var(--muted); font-size: .875rem; font-weight: 400; }
.food-entry-macros { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 12px 0 2px; color: var(--muted); font-size: .875rem; }
.food-entry-macros b { color: var(--ink); font-weight: 500; }
.food-entry-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 2px; }
.food-entry-footer > span { color: var(--muted); font-size: .8rem; }
.food-empty { text-align: center; padding: 28px 16px; border: 1px dashed var(--line); border-radius: 12px; }
.food-empty > span { display: block; color: var(--accent); font-size: 2rem; }
.food-empty h3 { margin: 10px 0; font-size: 1rem; }
.food-empty p, .food-footnote, .food-help { color: var(--muted); font-size: .875rem; line-height: 1.5; }
.food-footnote { margin-top: 18px; text-align: center; }
.food-status { color: #f3b887; font-size: .875rem; line-height: 1.5; }
.food-status:not(:empty) { margin: 14px 0; }
.food-add-bar { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: rgba(11,13,16,.97); border-top: 1px solid var(--line); }
.food-primary { display: block; width: 100%; min-height: 50px; border: 0; border-radius: 10px; padding: 12px 18px; background: var(--brand); color: white; font: inherit; font-weight: 750; cursor: pointer; }
.food-primary:hover { background: #e21738; }
.food-primary:disabled { opacity: .6; cursor: wait; }
.food-add-bar .food-primary { max-width: 1080px; margin: auto; }
.food-dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: var(--panel-strong); color: var(--ink); }
.food-dialog::backdrop { background: rgba(0,0,0,.72); }
.food-dialog-header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 20px; }
.food-dialog-header p { color: var(--muted); font-size: .875rem; margin-top: 6px; }
.close-button { flex: 0 0 40px; height: 40px; border: 0; background: var(--panel-soft); color: var(--ink); border-radius: 50%; font-size: 1.6rem; cursor: pointer; }
.food-dialog label { display: block; font-size: .875rem; line-height: 1.5; }
.food-dialog input, .food-dialog textarea { display: block; box-sizing: border-box; width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel-soft); color: white; font: inherit; font-size: 16px; margin: 6px 0 12px; }
.food-dialog textarea { resize: vertical; }
.food-dialog .food-help { margin: 10px 0 16px; }
.manual-button { width: 100%; margin-top: 6px; }
.nutrition-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 12px; margin-top: 12px; }
@media (max-width: 520px) {
  .food-dialog { margin: auto auto 12px; padding: 18px; }
  .calorie-card { padding: 18px; }
  .macro-grid { gap: 8px; }
}
