/* TDEE Goal — UI styles (split from tokens) */

button, select, input, textarea { color: inherit; font: inherit; }

/* ─── Layout shell ────────────────────────────────────────────────────── */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}
.container-narrow { max-width: 880px; }
.container-text { max-width: 720px; }

main { flex: 1; }

/* ─── Nav ─────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-logo { background: none; border: none; padding: 0; color: inherit; cursor: pointer; }
.brand-mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.04em;
  color: var(--text);
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
}
.brand-mark-accent { color: var(--accent); }
.brand-mark-tld {
  color: var(--text-subtle);
  font-weight: 500;
  font-size: 0.8em;
  margin-left: 1px;
}
.footer .brand-mark { font-size: 18px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-link {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 13.5px; font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 120ms, background 120ms;
}
.nav-link:hover { color: var(--text); background: var(--bg-muted); }
.nav-link.is-active { color: var(--text); background: var(--bg-muted); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-meta-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12.5px; font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 120ms;
}
.nav-meta-btn:hover { color: var(--text); border-color: var(--border-strong); }

.nav-mobile-panel {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.nav-mobile-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  background: none; border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 16px; font-weight: 500;
  text-align: left;
}
.nav-mobile-link.is-active { color: var(--accent); }

/* ─── Footer ──────────────────────────────────────────────────────────── */
.footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 32px 32px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
}
.footer-brand { max-width: 360px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col .t-label { margin-bottom: 4px; }
.footer-col button {
  background: none; border: none; padding: 0;
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: left;
  transition: color 120ms;
}
.footer-col button:hover { color: var(--text); }
.footer-fineprint {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}

/* ─── Hero ────────────────────────────────────────────────────────────── */
.hero {
  padding: 56px 0 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.hero-eyebrow::before {
  content: ""; width: 16px; height: 1px; background: var(--accent);
}
.hero-sub {
  max-width: 640px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ─── Calculator ──────────────────────────────────────────────────────── */
.calc {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  margin-top: 16px;
}
.calc.mobile { grid-template-columns: 1fr; }
.calc-input {
  padding: 28px 32px;
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  min-width: 0;
}
.calc.mobile .calc-input { border-right: none; border-bottom: 1px solid var(--border); padding: 24px 18px; }
.calc-result {
  padding: 28px 32px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 22px;
  min-width: 0;
}
.calc.mobile .calc-result { padding: 24px 18px; }

.calc-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  row-gap: 8px;
}
.calc-tab {
  background: none; border: none;
  padding: 8px 14px 12px;
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  transition: all 120ms;
}
.calc-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.field-group.three { grid-template-columns: repeat(3, 1fr); }
.field-group.full { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 120ms;
  height: 38px;
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-wrap.has-error { border-color: var(--destructive); }
.input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 12px;
  color: var(--text);
  font-size: 15px;
  width: 100%;
  height: 100%;
}
.input-wrap input[type="number"]::-webkit-inner-spin-button,
.input-wrap input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.input-suffix {
  padding-right: 12px;
  color: var(--text-subtle);
  font-size: 13px;
}

/* Segmented control */
.seg {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  background: none; border: none;
  padding: 5px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  transition: all 120ms;
  white-space: nowrap;
}
.seg-btn.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.06);
}

/* Activity slider */
.activity {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 18px;
}
.activity-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 14px;
}
.activity-mult {
  font-size: 22px; font-weight: 600; color: var(--accent);
  letter-spacing: -0.01em;
}
.activity-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-deep);
  border-radius: 2px;
  outline: none;
}
.activity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 20%, transparent);
}
.activity-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.activity-ticks {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 10px;
  gap: 2px;
}
.activity-tick {
  background: none; border: none;
  font-size: 11px; font-weight: 500;
  color: var(--text-subtle);
  padding: 4px 2px;
  text-align: center;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.activity-tick.is-active { color: var(--accent); font-weight: 600; }

/* ─── Result card ─────────────────────────────────────────────────────── */
.result-card {
  display: flex; flex-direction: column;
}
.result-card.empty .result-big { color: var(--text-subtle); }
.result-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.result-formula {
  font-size: 11px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}
.result-big {
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
  font-feature-settings: "tnum", "zero";
}
.calc.mobile .result-big { font-size: 56px; }

.stack-bar {
  display: flex;
  margin-top: 22px;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-muted);
}
.stack-bar-bmr { background: var(--accent); }
.stack-bar-act { background: color-mix(in oklch, var(--accent) 35%, var(--bg-muted)); }
.stack-legend { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.stack-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 10px;
}
.stack-dot { width: 10px; height: 10px; border-radius: 2px; }
.stack-dot-bmr { background: var(--accent); }
.stack-dot-act { background: color-mix(in oklch, var(--accent) 35%, var(--bg-muted)); }
.stack-val { font-size: 14px; color: var(--text); font-weight: 500; }

/* ─── Goal grid ───────────────────────────────────────────────────────── */
.goal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.goal-card {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
  transition: all 120ms;
  gap: 4px;
}
.goal-card:hover { border-color: var(--border-strong); }
.goal-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}
.goal-glyph {
  font-size: 16px; color: var(--accent);
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  margin-bottom: 4px;
}
.goal-card.is-active .goal-glyph { background: var(--accent); color: var(--accent-fg); }
.goal-label { font-size: 14px; font-weight: 600; color: var(--text); }
.goal-desc { color: var(--text-muted); }

/* ─── Plan timeline ───────────────────────────────────────────────────── */
.timeline {
  margin-top: 8px;
  padding: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.timeline-track {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 12px 8px 4px;
}
.timeline-line {
  position: absolute;
  top: 22px; left: 8px; right: 8px;
  height: 2px;
  background: var(--bg-deep);
  border-radius: 1px;
}
.timeline-line-fill {
  position: absolute;
  top: 22px; left: 8px;
  width: calc(100% - 16px);
  height: 2px;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklch, var(--accent) 30%, var(--bg-muted)));
  border-radius: 1px;
}
.timeline-pt {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  flex: 1;
}
.timeline-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  margin-top: 4px;
}
.timeline-pt.is-start .timeline-dot { background: var(--accent); }
.timeline-pt.is-goal .timeline-dot {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 20%, transparent);
}
.timeline-label { text-align: center; }
.timeline-wt { font-size: 13px; font-weight: 600; }

/* ─── Macro chart ─────────────────────────────────────────────────────── */
.macro-chart { display: flex; flex-direction: column; gap: 14px; }
.macro-bar {
  display: flex;
  height: 14px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-muted);
}
.macro-seg { transition: width 200ms; }
.macro-protein { background: var(--accent); }
.macro-carbs { background: oklch(0.65 0.15 220); }
.macro-fat { background: oklch(0.72 0.14 60); }
[data-theme="dark"] .macro-carbs { background: oklch(0.7 0.14 220); }
[data-theme="dark"] .macro-fat { background: oklch(0.78 0.13 60); }

.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.macro-cell {
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.macro-cell-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.macro-dot { width: 8px; height: 8px; border-radius: 2px; }
.macro-dot-protein { background: var(--accent); }
.macro-dot-carbs { background: oklch(0.65 0.15 220); }
.macro-dot-fat { background: oklch(0.72 0.14 60); }
.macro-pct { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.macro-cell-g { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; color: var(--text); }
.macro-unit { font-size: 14px; color: var(--text-muted); margin-left: 2px; }

/* ─── Chips ───────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  font-size: 11.5px; font-weight: 500;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.chip-default { background: var(--bg-muted); color: var(--text-muted); border: 1px solid var(--border); }
.chip-accent { background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent); }
.chip-warning { background: var(--warning-soft); color: oklch(0.45 0.15 75); border: 1px solid color-mix(in oklch, var(--warning) 30%, transparent); }
[data-theme="dark"] .chip-warning { color: var(--warning); }

/* ─── Disclaimer ──────────────────────────────────────────────────────── */
.disclaimer {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 8px;
}
.disclaimer-mark {
  flex-shrink: 0;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--warning-soft);
  color: oklch(0.50 0.15 75);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
[data-theme="dark"] .disclaimer-mark { color: var(--warning); }

/* ─── Cards / sections ────────────────────────────────────────────────── */
.section { padding-block: 64px; }
.section-tight { padding-block: 40px; }
.section-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px;
  gap: 24px;
}
.section-head-text { max-width: 560px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.feature-card {
  padding: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.feature-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}
.feature-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.feature-card p { margin: 0; font-size: 14px; color: var(--text-muted); line-height: 1.55; }

/* Comparison table */
.cmp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.cmp-table th, .cmp-table td {
  padding: 14px 16px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.cmp-table th {
  background: var(--bg-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.cmp-table tr:last-child td { border-bottom: none; }
.cmp-table td.mono { font-size: 13px; }

/* Static prose pages (about, privacy, disclaimer) */
.static-prose { padding-bottom: 96px; color: var(--text); line-height: 1.7; font-size: 16px; }
.static-prose h2 { font-size: 22px; font-weight: 600; margin: 32px 0 12px; letter-spacing: -0.01em; }
.static-prose p { margin: 0 0 14px; color: var(--text-muted); }
.static-prose ul { margin: 0 0 18px; padding-left: 20px; color: var(--text-muted); }
.static-prose li { margin-bottom: 6px; }
.static-prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.static-prose a:hover { color: var(--accent-hover); }
.static-prose strong { color: var(--text); font-weight: 600; }

/* How-to steps (AIO-friendly explainer) */
.howto-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.howto-steps > li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  padding: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.howto-num {
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.04em;
  padding-top: 4px;
}
@media (max-width: 720px) {
  .howto-steps { grid-template-columns: 1fr; }
}

/* Audience cards */
.aud-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.aud-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 150ms;
  text-align: left;
  color: var(--text);
  font: inherit;
}
.aud-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.aud-card-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 16px;
  margin-bottom: 4px;
}
.aud-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.aud-card p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.aud-card-arrow {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

/* FAQ */
.faq-list { display: flex; flex-direction: column; }
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
}
.faq-q {
  display: flex; justify-content: space-between; align-items: center;
  background: none; border: none;
  width: 100%; padding: 0;
  font-size: 16px; font-weight: 500;
  color: var(--text);
  text-align: left;
}
.faq-q-glyph { font-family: var(--font-mono); color: var(--accent); font-size: 14px; }
.faq-a { padding-top: 12px; font-size: 14.5px; color: var(--text-muted); line-height: 1.6; max-width: 720px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: all 120ms;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-muted); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--destructive); border-color: var(--destructive); }

.cta-row { display: flex; gap: 8px; margin-top: 8px; }

/* History drawer */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.45);
  z-index: 60;
  display: flex; justify-content: flex-end;
  animation: fade-in 150ms ease-out;
}
.drawer {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: slide-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.drawer-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.drawer-close:hover { color: var(--text); border-color: var(--border-strong); }
.drawer-empty { padding: 40px 24px; }
.drawer-foot {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex; justify-content: flex-end;
}
.history-list {
  list-style: none; margin: 0; padding: 8px;
  overflow-y: auto;
  flex: 1;
}
.history-item {
  position: relative;
  width: 100%;
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: all 120ms;
}
.history-item:hover { background: var(--bg-muted); border-color: var(--border); }
.history-item-head { display: flex; justify-content: space-between; align-items: center; }
.history-item-row { display: flex; gap: 8px; align-items: baseline; }
.history-item-tdee { font-size: 22px; font-weight: 600; color: var(--text); }
.history-item-del {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 18px; line-height: 1;
  color: var(--text-subtle);
  cursor: pointer;
  opacity: 0;
  transition: all 120ms;
}
.history-item:hover .history-item-del { opacity: 1; }
.history-item-del:hover { color: var(--destructive); background: var(--bg-elevated); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

@media (max-width: 540px) {
  .drawer-backdrop { align-items: flex-end; }
  .drawer {
    width: 100%;
    max-height: 85vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    animation: slide-up 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .history-item-del { opacity: 1; }
}

/* Plan summary */
.plan-summary {
  padding: 18px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
[data-theme="dark"] .plan-summary { background: var(--accent-soft); }
.plan-summary-big {
  font-family: var(--font-mono);
  font-size: 36px; font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--accent);
}
.plan-summary-sub {
  font-size: 13px;
  color: var(--text);
}
.plan-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 12px;
}
.plan-stat {
  background: var(--bg-elevated);
  padding: 12px 14px;
}
.plan-stat-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.plan-stat-label {
  font-size: 11px;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* Deficit slider */
.deficit-slider-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.deficit-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 120ms;
}
.deficit-pill:hover { border-color: var(--border-strong); }
.deficit-pill.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.deficit-pill-pct {
  font-family: var(--font-mono);
  font-size: 16px; font-weight: 600;
}
.deficit-pill-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.deficit-pill.is-active .deficit-pill-label { color: var(--accent); }

/* Reverse table */
.reverse-table {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.reverse-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.reverse-row:last-child { border-bottom: none; }
.reverse-row.is-current { background: var(--accent-soft); }
.reverse-row-week { font-family: var(--font-mono); font-size: 12px; color: var(--text-subtle); }
.reverse-row-bar {
  height: 6px; background: var(--bg-muted); border-radius: 3px; overflow: hidden;
}
.reverse-row-fill { height: 100%; background: var(--accent); }
.reverse-row-cal { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }

/* Body fat compare table */
.bf-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.bf-card {
  padding: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.bf-card.is-recommended { border-color: var(--accent); }
.bf-card-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.bf-card-val {
  font-family: var(--font-mono);
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.bf-delta {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.bf-delta-up { color: var(--accent); font-weight: 500; }

/* Cycle phase */
.cycle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.cycle-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: all 120ms;
}
.cycle-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.cycle-btn-name { font-weight: 500; color: var(--text); }
.cycle-btn-adj { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }

/* Macro preset row */
.macro-presets {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.macro-preset {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 120ms;
}
.macro-preset.is-active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

/* Frame controls (mobile/desktop toggle) */
.viewport-toolbar {
  position: sticky;
  top: 56px;
  z-index: 40;
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.viewport-toolbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex; align-items: center; gap: 16px;
}
.viewport-toolbar .t-label { margin-right: auto; }
.viewport-frame-wrap {
  background: var(--bg-deep);
  padding: 32px 16px;
  display: flex; justify-content: center;
  border-bottom: 1px solid var(--border);
}
.viewport-frame {
  width: 390px;
  background: var(--bg);
  border-radius: 28px;
  border: 8px solid oklch(0.18 0 0);
  overflow: hidden;
  box-shadow: 0 20px 60px oklch(0 0 0 / 0.2);
}
.viewport-frame-status {
  height: 24px;
  background: var(--bg);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 18px;
  font-size: 11px;
  color: var(--text);
  font-weight: 600;
}
.viewport-frame-content {
  height: 720px;
  overflow-y: auto;
}

/* Section labels */
.label-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px;
}
.label-row-line {
  flex: 1; height: 1px; background: var(--border);
}

/* Mini explainer */
.formula-explainer {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--bg-elevated);
  margin-top: 24px;
}
.formula-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  margin: 10px 0;
  color: var(--text);
  line-height: 1.7;
}

/* Mobile responsive */
@media (max-width: 900px) {
  .container { padding: 0 20px; }
  .calc { grid-template-columns: 1fr; }
  .calc-input { border-right: none; border-bottom: 1px solid var(--border); padding: 24px; }
  .calc-result { padding: 24px; }
  .feature-grid, .aud-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .nav-links { display: none; }
  .section { padding-block: 48px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .result-big { font-size: 52px; }
  .field-group.three { grid-template-columns: 1fr 1fr; }
  .bf-compare { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .feature-grid, .aud-grid, .goal-grid, .cycle-grid { grid-template-columns: 1fr; }
  .field-group, .field-group.three { grid-template-columns: 1fr 1fr; }
  .cmp-table th:nth-child(3), .cmp-table td:nth-child(3) { display: none; }
}
@media (max-width: 420px) {
  .container { padding: 0 16px; }
  .field-group, .field-group.three { grid-template-columns: 1fr; gap: 12px; }
  .calc.mobile .calc-input,
  .calc.mobile .calc-result { padding: 20px 14px; }
  .input-wrap input { font-size: 16px; }
  .cta-row { flex-direction: column; }
  .cta-row .btn { width: 100%; }
  .deficit-slider-row { grid-template-columns: 1fr 1fr; }
  .calc-tabs { font-size: 12px; }
  .seg-btn { padding: 5px 10px; font-size: 12px; }
}
