/* ============================================================
   Calm Minimal (Swiss) — Deep Blue · Cool White
   ============================================================ */
:root {
  /* Surfaces */
  --bg: #f4f4f2;
  --paper: #ffffff;
  --paper-2: #fafaf8;
  --line: #e6e6e2;
  --line-strong: #d4d4ce;

  /* Ink */
  --ink: #16181c;
  --ink-2: #3a3d44;
  --ink-3: #6a6e76;
  --ink-mute: #9aa0a8;

  /* Accent — single Swiss accent */
  --accent: #3b6ea5;
  --accent-deep: #2d568a;
  --accent-soft: rgba(59, 110, 165, 0.08);
  --accent-line: rgba(59, 110, 165, 0.28);
  --ai-bg: #cddbe2;
  --ai-bg-strong: #a8bcd0;

  /* Semantic (used very sparingly, monochrome leaning) */
  --good: #3b6ea5;
  --warn: #b95c3e;
  --warn-soft: rgba(185, 92, 62, 0.10);

  --shadow-sm: 0 1px 0 rgba(20, 22, 26, 0.04);
  --shadow-md: 0 1px 0 rgba(20, 22, 26, 0.04), 0 16px 40px -24px rgba(20, 22, 26, 0.18);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  --font: "Noto Sans TC", "Helvetica Neue", "Inter", system-ui, -apple-system, sans-serif;
  --font-num: "Fraunces", "Times New Roman", "Noto Serif TC", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-feature-settings: "tnum", "ss01";
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.005em;
}

body { min-height: 100vh; background: var(--bg); }

#root { padding: 56px 48px 96px; max-width: 1320px; margin: 0 auto; }

button { font-family: inherit; cursor: pointer; }

/* ============ Top bar ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 28px;
  margin-bottom: 56px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 32px; height: 32px;
  border-radius: 0;
  background: var(--accent);
  display: grid; place-items: center;
  color: white;
  position: relative;
}
.brand-mark::after { display: none; }
.brand-mark svg { width: 16px; height: 16px; }

.brand-text .brand-title {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--ink);
}
.brand-text .brand-sub {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 6px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
}

.topbar-right { display: flex; gap: 12px; align-items: center; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: none;
  font-weight: 500;
}
.chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* ============ Grid ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 1px !important;
}
/* KPI grid: 5 equal columns regardless of col-* */
.grid.kpi-grid {
  grid-template-columns: repeat(5, 1fr);
}
.grid + .grid { margin-top: 32px; }

.card {
  background: var(--paper);
  border: none;
  border-radius: 0;
  padding: 32px;
  box-shadow: none;
  position: relative;
}
.card-soft { background: var(--paper-2); }
.card-warm { background: var(--paper); }

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }
.col-3 { grid-column: span 3; }

@media (max-width: 1100px) {
  .col-8, .col-7, .col-6, .col-5, .col-4, .col-3 { grid-column: span 12; }
  #root { padding: 32px 20px 60px; }
}

/* ============ Headings — Swiss editorial ============ */
.eyebrow {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.eyebrow::before {
  content: attr(data-num) "";
  margin-right: 10px;
  color: var(--ink-mute);
  font-family: var(--font-num);
  font-style: italic;
  font-weight: 400;
}

.h1 {
  font-family: var(--font-num);
  font-size: 56px;
  font-weight: 300;
  line-height: 1.05;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.h2 {
  font-family: var(--font-num);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.h3 {
  font-size: 14px; font-weight: 600;
  color: var(--ink); margin: 0;
  letter-spacing: 0.02em;
}
.muted {
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1.65;
}
.label {
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ============ Hero ============ */
.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  align-items: stretch;
  margin-bottom: 32px !important;
}
.hero-left {
  background: var(--paper);
  border-radius: 0;
  border: none;
  padding: 56px 48px;
  position: relative;
  overflow: hidden;
}
.hero-left::before { display: none; }

.hero-stat-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.hero-stat { padding-right: 24px; position: relative; }
.hero-stat + .hero-stat { padding-left: 24px; border-left: 1px solid var(--line); }
.hero-stat .label { color: var(--ink-mute); }
.hero-stat .value {
  font-family: var(--font-num);
  font-size: 40px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.05;
  margin-top: 12px;
  letter-spacing: -0.02em;
}
.hero-stat .delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; font-weight: 500;
  margin-top: 10px;
  color: var(--accent);
  letter-spacing: 0.08em;
  font-family: var(--font);
}
.hero-stat .delta.up { color: var(--warn); }

.hero-right {
  display: flex; flex-direction: column;
  gap: 1px;
  background: var(--line);
  justify-content: stretch;
}
.ring-card {
  background: var(--paper);
  border: none;
  border-radius: 0;
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 18px;
  box-shadow: none;
  flex: 1;
}
.ring-card .ring-meta {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
}
.ring-card .ring-meta .label {
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  font-family: var(--font);
}
.ring-card .ring-meta .pct {
  font-family: var(--font-num);
  font-size: 64px;
  font-weight: 300;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 0.95;
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}
.ring-card .ring-meta .pct .small {
  font-size: 14px;
  color: var(--ink-mute);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: var(--font);
  font-weight: 500;
  margin: 0;
}
.ring-card .ring-meta .desc {
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.7;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  width: 100%;
}
.ring-card .ring-meta .desc strong { white-space: nowrap; }

.timeline-mini {
  display: flex; gap: 0;
  flex-wrap: wrap;
  background: var(--paper);
  border: none;
  border-radius: 0;
  padding: 24px 32px;
}
.tl-pill {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 6px 14px 6px 0;
  border-radius: 0;
  background: transparent;
  border: none;
  color: var(--ink-mute);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.tl-pill + .tl-pill { padding-left: 14px; border-left: 1px solid var(--line); }
.tl-pill strong {
  color: var(--ink);
  margin-left: 0;
  font-family: var(--font-num);
  font-weight: 400;
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}

/* ============ KPI cards ============ */
.kpi {
  display: flex; flex-direction: column;
  gap: 16px;
  min-height: 160px;
  position: relative;
  overflow: hidden;
}
.kpi .kpi-head { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi .kpi-head .label::before {
  content: attr(data-num);
  display: inline-block;
  margin-right: 8px;
  color: var(--ink-mute);
  font-family: var(--font-num);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.kpi .kpi-icon {
  display: none;
}
.kpi .kpi-value {
  font-family: var(--font-num);
  font-size: 40px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink) !important;
}
.kpi .kpi-value .unit {
  font-size: 13px;
  color: var(--ink-mute);
  margin-left: 6px;
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.kpi .kpi-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
  margin-top: auto;
}
.kpi .delta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0;
  border-radius: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: transparent !important;
}
.delta-pill.good { color: var(--accent) !important; }
.delta-pill.bad { color: var(--warn) !important; }
.delta-pill.flat { color: var(--ink-mute) !important; }

.kpi .spark {
  position: static;
  width: auto;
  height: 32px;
  opacity: 1;
}

/* ============ Tabs / Week selector ============ */
.week-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: 1px solid var(--line);
}
.week-tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: 0;
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.15s ease;
  border-right: 1px solid var(--line);
}
.week-tab:last-child { border-right: none; }

/* Grid variant — 5 per row, max 3 rows (15 weeks) */
.week-tabs-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-self: flex-start;
  max-width: 224px;
  margin-right: 16px;
}
.week-tabs-grid .week-tab {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  padding: 6px 10px;
  font-size: 11px;
}
.week-tabs-grid .week-tab:nth-child(5n) { border-right: none; }
.week-tabs-grid .week-tab:nth-last-child(-n+5):nth-child(5n+1),
.week-tabs-grid .week-tab:nth-last-child(-n+5):nth-child(5n+1) ~ .week-tab { border-bottom: none; }
.week-tab:hover { color: var(--ink); background: var(--paper-2); }
.week-tab.active {
  background: var(--accent);
  color: var(--paper);
  box-shadow: none;
  font-weight: 600;
}

/* ============ Charts ============ */
.chart-wrap { width: 100%; }
.chart-legend {
  display: flex; gap: 24px; flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.legend-dot {
  display: inline-block; width: 10px; height: 2px;
  border-radius: 0; margin-right: 8px; vertical-align: 3px;
}

.chart-tooltip {
  position: absolute;
  background: var(--ink);
  color: white;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 2px;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  transform: translate(-50%, -120%);
  opacity: 0;
  transition: opacity 0.15s;
  letter-spacing: 0.04em;
}
.chart-tooltip.on { opacity: 1; }
.chart-tooltip strong {
  font-family: var(--font-num);
  margin-right: 8px;
  font-weight: 400;
}

/* ============ Composition ============ */
.compo-bar {
  display: flex; height: 14px;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
}
.compo-seg { height: 100%; transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1); }

/* ============ Timeline ============ */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--line-strong);
  border-radius: 0;
}
.tl-item { position: relative; padding-bottom: 26px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -32px; top: 6px;
  width: 9px; height: 9px;
  border-radius: 0;
  background: var(--paper);
  border: 1px solid var(--accent);
  box-shadow: none;
  transform: rotate(45deg);
}
.tl-item.muscle::before,
.tl-item.bmi::before,
.tl-item.weight::before { border-color: var(--accent); }
.tl-item.start::before { background: var(--accent); border-color: var(--accent); }
.tl-item .tl-date {
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}
.tl-item .tl-title {
  font-weight: 500;
  margin: 6px 0 4px;
  font-size: 15px;
  color: var(--ink);
}
.tl-item .tl-desc {
  font-size: 14px;
  color: var(--ink-3);
  line-height: 1.65;
}

/* Horizontal timeline */
.timeline-h {
  position: relative;
  margin-top: 8px;
  padding: 16px 0 4px;
}
.timeline-h-track {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 30px;
  height: 1px;
  background: var(--line-strong);
}
.timeline-h-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(180px, 1fr);
  gap: 0;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.timeline-h-scroll::-webkit-scrollbar { height: 6px; }
.timeline-h-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.tl-h-item {
  position: relative;
  padding: 28px 18px 4px;
  border-right: 1px dashed var(--line);
}
.tl-h-item:last-child { border-right: none; }
.tl-h-node {
  position: absolute;
  top: 24px;
  left: 18px;
  width: 11px; height: 11px;
  background: var(--paper);
  border: 1.5px solid var(--ink-mute);
  transform: rotate(45deg);
  z-index: 1;
}
.tl-h-item.start .tl-h-node { background: var(--accent); border-color: var(--accent); }
.tl-h-item.weight .tl-h-node,
.tl-h-item.fat .tl-h-node,
.tl-h-item.bmi .tl-h-node,
.tl-h-item.visceral .tl-h-node,
.tl-h-item.water .tl-h-node,
.tl-h-item.muscle .tl-h-node,
.tl-h-item.goal .tl-h-node,
.tl-h-item.streak .tl-h-node { border-color: var(--accent); }
.tl-h-item.goal .tl-h-node { background: var(--accent); }
.tl-h-date {
  margin-top: 22px;
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: var(--font-num);
  font-weight: 500;
}
.tl-h-title {
  margin: 6px 0 4px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}
.tl-h-desc {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.55;
}

/* ============ AI panel ============ */
.ai-card {
  background: var(--ai-bg) !important;
  color: var(--ink);
  border: none;
  border-radius: 0;
  padding: 22px 22px 22px !important;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ai-card .ai-summary,
.ai-card .ai-list { padding-left: 0; padding-right: 0; }
.ai-card .ai-list { margin: 36px -22px -22px !important; flex: 1; }
.ai-card .ai-list li { align-items: stretch; }
.ai-card::after { display: none; }
.ai-card .eyebrow { color: var(--accent); }
.ai-card .label { color: var(--ink-mute); }
.ai-card .h2 { color: var(--ink); }

.ai-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  border: none;
}
.ai-tag .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(59,110,165, 0.6);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(59,110,165, 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(59,110,165, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59,110,165, 0); }
}
.ai-summary {
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink-2);
  margin: 32px 0 0;
  font-family: var(--font-num);
  font-weight: 300;
  letter-spacing: 0.005em;
}
.ai-summary .hl {
  background: transparent;
  padding: 0;
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  font-weight: 400;
}
.ai-list {
  list-style: none;
  padding: 0;
  margin: 36px -22px -22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: transparent;
  border: none;
}
.ai-list li {
  background: var(--paper);
  border: none;
  border-radius: 0;
  padding: 22px 28px;
  display: flex; gap: 14px;
  align-items: flex-start;
  font-size: 14px; line-height: 1.65;
  color: var(--ink-3);
}
.ai-list .ai-bullet {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 0;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  font-family: var(--font-num);
  font-style: italic;
  font-weight: 400;
  font-size: 14px;
  color: var(--accent);
}
.ai-list li > div:last-child > div:first-child {
  color: var(--ink) !important;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.ai-list li > div:last-child > div:last-child {
  color: var(--ink-3) !important;
  max-height: 210px;
  overflow-y: auto;
}
.ai-list li > div:last-child > div:last-child::-webkit-scrollbar {
  width: 3px;
}
.ai-list li > div:last-child > div:last-child::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 2px;
}

/* ============ Chat ============ */
.chat {
  display: flex; flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 120px;
  max-height: 480px;
  overflow-y: auto;
  padding: 4px 4px 4px 0;
}
.chat-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 2px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.chat-msg.ai {
  align-self: flex-start;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
}
.chat-input {
  display: flex; gap: 0;
  margin-top: 16px;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 0;
}
.chat-input input {
  flex: 1; border: none; outline: none;
  background: transparent;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
}
.chat-input input:focus { background: var(--paper-2); }
.chat-input button {
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 0;
  padding: 12px 22px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chat-input button:hover { background: var(--accent-deep); }
.chat-input button:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-suggestion {
  display: inline-flex;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-3);
  margin: 0 6px 6px 0;
  letter-spacing: 0.04em;
  font-family: inherit;
}
.chat-suggestion:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink); }

.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-mute);
  animation: typing 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ============ Section header ============ */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin: 0 0 28px;
}
.section-head:has(+ .timeline-h) { margin-bottom: 8px; }

/* ============ Body part viz ============ */
.body-viz {
  display: grid; grid-template-columns: 180px 1fr;
  gap: 32px; align-items: center;
}
.body-svg { width: 100%; max-width: 180px; }
.part-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px 32px;
}
.part-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; font-size: 14px;
}
.part-row .pname {
  color: var(--ink-mute);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.part-row .pval {
  font-family: var(--font-num);
  font-weight: 400;
  color: var(--ink);
  font-size: 18px;
}
.part-bar {
  flex: none;
  height: 4px;
  background: var(--line);
  border-radius: 0;
  overflow: hidden;
  min-width: 60px;
  position: relative;
}
.part-bar > div {
  height: 100%;
  background: var(--accent);
  border-radius: 0;
}

/* ============ Buttons / Modal ============ */
.btn {
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 9px 18px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
  white-space: nowrap;
}
.btn { border-color: var(--line-strong); color: var(--ink-2); }
.btn:hover { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 22, 26, 0.6);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: 50;
  animation: fade 0.2s;
}
.modal {
  background: var(--paper);
  border-radius: 0;
  padding: 40px 36px;
  width: min(440px, 92vw);
  box-shadow: var(--shadow-md);
  animation: pop 0.3s cubic-bezier(0.16,1,0.3,1);
  border: 1px solid var(--line);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label {
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}
.field input {
  border: none;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 8px 0;
  font-size: 18px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-num);
  font-weight: 300;
  width: 100%;
  box-sizing: border-box;
  display: block;
}
.field input:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

/* ============ Misc ============ */
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.row-between { display: flex; justify-content: space-between; align-items: center; }
.gap-12 { gap: 12px; }
.flex { display: flex; }

.fade-in { animation: fadeIn 0.5s ease both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ============ Week comparison cards (overrides JSX inline) ============ */
.week-card {
  cursor: pointer;
  background: var(--paper);
  padding: 24px;
  transition: background 0.2s;
  border-right: 1px solid var(--line);
  position: relative;
}
.week-card:last-child { border-right: none; }
.week-card.is-sel { background: #cddbe2; border-top: 2px solid #5f95ad; margin-top: -1px; }
.week-card.is-sel .wc-num { color: #5f95ad; }

/* Week-card body content +1px */
.week-card .wc-delta { font-size: 13px !important; }
.week-card .wc-row { font-size: 14px !important; }
.week-card .wc-row span { font-size: 13px !important; }
.week-card .wc-row strong { font-size: 15px !important; }
.week-card .wc-note { font-size: 13px !important; }

/* ============================
   Page Motion
   ============================ */

/* Hero entrance — left/right slide up on load */
@keyframes heroSlideUp {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: none; }
}
.hero-left  { animation: heroSlideUp 0.85s cubic-bezier(0.16,1,0.3,1) 0.05s both; }
.hero-right { animation: heroSlideUp 0.85s cubic-bezier(0.16,1,0.3,1) 0.22s both; }

/* Scroll-triggered reveal — JS adds .is-visible via IntersectionObserver */
.scroll-anim {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity  0.65s cubic-bezier(0.16,1,0.3,1),
    transform 0.65s cubic-bezier(0.16,1,0.3,1);
}
.scroll-anim.is-visible { opacity: 1; transform: none; }

/* Milestone items: slide in from right with stagger */
.tl-h-item {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.tl-h-item.is-visible { opacity: 1; transform: none; }

/* ============ Quarter nav tabs (small, eyebrow-row) ============ */
.quarter-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
  align-self: flex-start;
}
.quarter-tab {
  padding: 3px 8px;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  font-size: 10px;
  color: var(--ink-mute);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.quarter-tab:last-child { border-right: none; }
.quarter-tab:hover { color: var(--ink); background: var(--paper-2); }
.quarter-tab.active { background: #5f95ad; color: var(--paper); font-weight: 600; }

/* ============ View toggle button ============ */
.btn-view-toggle {
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  padding: 5px 13px;
  font-family: var(--font);
  letter-spacing: 0.08em;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-view-toggle:hover { background: var(--accent); color: white; border-color: var(--accent); }

/* ============ Serpentine milestone layout ============ */
.ms-snake { padding: 8px 0 4px; }

.ms-snake-row {
  display: flex;
  position: relative;
  align-items: flex-start;
}
.ms-snake-row.ms-odd { flex-direction: row-reverse; }

.ms-track {
  position: absolute;
  top: 6px;
  height: 1px;
  background: var(--line);
  z-index: 0;
  pointer-events: none;
}

.ms-snake-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10px 28px;
  text-align: center;
}

.ms-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.ms-snake-item.peak .ms-node,
.ms-snake-item.low .ms-node { border-color: var(--accent); background: var(--accent); }
.ms-snake-item.note .ms-node { border-color: var(--accent); }

.ms-date { font-size: 11px; color: var(--ink-mute); letter-spacing: 0.06em; margin-bottom: 3px; }
.ms-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 3px; line-height: 1.3; }
.ms-desc { font-size: 11px; color: var(--ink-3); line-height: 1.5; }

.ms-turn {
  height: 28px;
  position: relative;
}
.ms-turn::before {
  content: '';
  position: absolute;
  left: var(--tx);
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
  transform: translateX(-50%);
}
