:root {
  --ink: #14201c;
  --muted: #66716c;
  --faint: #8d9692;
  --paper: #f5f6f2;
  --paper-deep: #edf1ec;
  --surface: #ffffff;
  --line: rgba(20, 32, 28, 0.09);
  --line-strong: rgba(20, 32, 28, 0.15);
  --accent: #286c6f;
  --accent-dark: #225a5c;
  --accent-soft: #e2eeee;
  --accent-pale: #f0f6f6;
  --violet: #7166a6;
  --orange: #ba7728;
  --coral: #c76055;
  --blue: #527f99;
  --shadow-sm: 0 10px 30px rgba(30, 54, 46, 0.06);
  --shadow-md: 0 28px 80px rgba(24, 48, 40, 0.12);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 38px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.hidden { display: none !important; }

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px clamp(20px, 5vw, 76px);
  border-bottom: 1px solid rgba(20, 32, 28, 0.06);
  background: rgba(245, 246, 242, 0.86);
  backdrop-filter: blur(22px) saturate(140%);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 20px; font-weight: 760; text-decoration: none; letter-spacing: -0.02em; }
.brand img { border-radius: 9px; box-shadow: 0 5px 15px rgba(20, 42, 35, 0.13); }
.nav nav { display: flex; align-items: center; gap: 5px; }
.nav nav > a { padding: 10px 13px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; transition: color 180ms ease; }
.nav nav > a:hover { color: var(--ink); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.button:hover { transform: translateY(-1px); border-color: rgba(52, 123, 108, 0.35); box-shadow: var(--shadow-sm); }
.button:active { transform: translateY(0); }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; box-shadow: 0 10px 28px rgba(52, 123, 108, 0.18); }
.button.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.button.ghost { background: rgba(255, 255, 255, 0.54); }
.button.large { min-height: 52px; padding: 13px 22px; border-radius: 15px; }
.button.full { width: 100%; }

.section-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 820; letter-spacing: 0.14em; text-transform: uppercase; }
.section-intro { max-width: 760px; margin-bottom: 52px; }
.section-intro.narrow { max-width: 680px; }
.section-intro h2, .final-cta h2 {
  margin: 14px 0 20px;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.048em;
}
.section-intro p, .final-cta > p { margin: 0; color: var(--muted); font-size: 18px; line-height: 1.85; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  align-items: center;
  gap: clamp(40px, 6vw, 92px);
  width: min(1280px, calc(100% - 40px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 74px 0 96px;
}
.hero-copy { position: relative; z-index: 2; }
.hero h1 { max-width: 780px; margin: 18px 0 28px; font-size: clamp(58px, 7vw, 94px); line-height: 0.98; letter-spacing: -0.063em; }
.hero h1 span { color: var(--accent); }
.hero-lead { max-width: 690px; margin: 0; color: var(--muted); font-size: clamp(18px, 1.7vw, 21px); line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 25px; color: var(--muted); font-size: 13px; font-weight: 650; }
.trust-row span::before { content: "✓"; margin-right: 7px; color: var(--accent); }

.hero-product { position: relative; display: grid; place-items: center; min-height: 620px; }
.ambient { position: absolute; border-radius: 50%; filter: blur(10px); pointer-events: none; }
.ambient-one { width: 420px; height: 420px; background: rgba(52, 123, 108, 0.14); }
.ambient-two { right: -40px; top: 90px; width: 230px; height: 230px; background: rgba(113, 102, 166, 0.12); }

.final-cta { display: grid; justify-items: center; padding: 130px 0 150px; text-align: center; }
.final-cta > img { margin-bottom: 22px; border-radius: 20px; box-shadow: 0 16px 40px rgba(25, 48, 40, 0.2); }
.final-cta h2 { margin-top: 15px; font-size: clamp(48px, 7vw, 82px); }
.final-cta > p { max-width: 650px; }
.centered-actions { justify-content: center; }

footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 26px clamp(20px, 5vw, 76px); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
footer > span { justify-self: end; }.footer-brand { font-size: 17px; }.footer-brand img { border-radius: 8px; }

dialog { max-width: none; padding: 0; border: 0; border-radius: 25px; background: #fff; box-shadow: 0 34px 100px rgba(17, 35, 29, 0.22); }
dialog::backdrop { background: rgba(10, 19, 16, 0.42); backdrop-filter: blur(8px); }
.auth-card { position: relative; display: grid; gap: 17px; width: min(440px, calc(100vw - 28px)); padding: 34px; }
.auth-icon { border-radius: 15px; box-shadow: 0 10px 28px rgba(23, 43, 36, 0.16); }
.auth-card h2 { margin: -10px 0 0; font-size: 29px; letter-spacing: -0.035em; }
.dialog-close { position: absolute; top: 15px; right: 17px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 27px; cursor: pointer; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 13px; background: var(--paper); }
.auth-switch button { min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.auth-switch .active { background: #fff; color: var(--ink); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06); }
label { display: grid; gap: 8px; color: #35423d; font-size: 13px; font-weight: 690; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 13px; outline: none; background: #fff; color: var(--ink); padding: 13px; transition: border-color 180ms ease, box-shadow 180ms ease; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52, 123, 108, 0.11); }
textarea { min-height: 150px; resize: vertical; }
.auth-card > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.form-message { min-height: 20px; margin: 0; color: var(--accent); font-size: 12px; }.form-message.error { color: #b63d35; }

.dashboard { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; width: min(1300px, calc(100% - 40px)); min-height: calc(100vh - 72px); margin: auto; padding: 34px 0 54px; }
.dashboard aside { position: sticky; top: 105px; display: flex; flex-direction: column; align-self: start; min-height: calc(100vh - 140px); padding: 24px; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow-sm); }
.dashboard-brand { display: flex; align-items: center; gap: 12px; }.dashboard-brand img { border-radius: 13px; }.dashboard-brand h2 { margin: 1px 0 0; font-size: 18px; }
.mono { overflow-wrap: anywhere; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.side-tabs { display: grid; gap: 6px; margin-top: 28px; }.side-tabs button { min-height: 44px; padding: 11px 13px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); text-align: left; font-weight: 680; cursor: pointer; }.side-tabs button.active { background: var(--accent-soft); color: var(--accent-dark); }
#logout { margin-top: auto; }.dashboard-content { min-width: 0; }.section-title { display: flex; align-items: end; justify-content: space-between; margin: 10px 0 25px; }.section-title h1 { margin: 7px 0 0; font-size: 40px; letter-spacing: -0.04em; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }.stat-grid article, .panel { padding: 25px; border: 1px solid var(--line); border-radius: 21px; background: #fff; box-shadow: var(--shadow-sm); }.stat-grid article { display: grid; gap: 11px; }.stat-grid span { color: var(--muted); font-size: 13px; }.stat-grid strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.panel { margin-top: 15px; }.panel h3 { margin-top: 0; }.category-chart { display: grid; gap: 13px; }.bar-row { display: grid; grid-template-columns: 80px 1fr 70px; align-items: center; gap: 12px; }.bar-track { height: 11px; overflow: hidden; border-radius: 99px; background: var(--paper); }.bar-fill { height: 100%; border-radius: 99px; }
.record-list { display: grid; }.record { display: grid; grid-template-columns: 140px minmax(0, 1fr) 80px; gap: 15px; padding: 15px 0; border-bottom: 1px solid var(--line); }.record:last-child { border: 0; }.record time, .record small { color: var(--muted); }.empty { padding: 20px 0; color: var(--muted); }.lead-small { color: var(--muted); }.form-stack { display: grid; gap: 18px; max-width: 700px; }.inline-field { display: grid; grid-template-columns: 1fr auto; gap: 8px; }.chips { display: flex; flex-wrap: wrap; gap: 8px; }.chip { padding: 7px 11px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 700; }

/* ---------- Track everything: hero visual ---------- */
.track-stack { position: relative; z-index: 2; display: grid; gap: 12px; width: min(430px, 100%); }
.track-card { display: grid; gap: 6px; padding: 16px 19px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255, 255, 255, 0.94); box-shadow: var(--shadow-sm); }
.track-card:nth-child(odd) { transform: translateX(-16px); }
.track-card:nth-child(even) { transform: translateX(16px); }
.track-card b { font-size: 16px; line-height: 1.4; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.track-card small { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.track-card.coach { border-color: rgba(40, 108, 111, 0.2); background: linear-gradient(140deg, #e7f2ef, #fff); box-shadow: var(--shadow-md); }
.track-card.coach b { font-size: 19px; }
.track-tag { justify-self: start; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 780; letter-spacing: 0.04em; }
.track-tag.workout { background: #f6e4e1; color: #a2483f; }
.track-tag.water { background: #e3edf3; color: #3f6a83; }
.track-tag.meal { background: #f5eadc; color: #8f5b1d; }
.track-tag.sleep { background: #eeeaf7; color: #5f5594; }
.track-tag.ai { background: var(--accent-soft); color: var(--accent-dark); }
.meter { height: 8px; margin-top: 4px; overflow: hidden; border-radius: 99px; background: #e8eef0; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--blue); }

/* ---------- What you can track ---------- */
.track-section, .whoop-section { padding: 110px 0; border-top: 1px solid var(--line); }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature-grid article { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.72); }
.feature-grid h3 { margin: 20px 0 8px; font-size: 22px; letter-spacing: -0.02em; }
.feature-grid p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.72; }
.feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; font-size: 18px; font-weight: 800; }
.feature-icon.workout { background: #f6e4e1; color: #a2483f; }
.feature-icon.meal { background: #f5eadc; color: #8f5b1d; }
.feature-icon.water { background: #e3edf3; color: #3f6a83; }
.feature-icon.sleep { background: #eeeaf7; color: #5f5594; }
.feature-icon.behavior { background: #edf0e2; color: #5d6b2e; }
.feature-icon.thought { background: var(--accent-soft); color: var(--accent-dark); }
.capture-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.capture-modes > div { display: grid; gap: 4px; padding: 20px 22px; border: 1px solid rgba(40, 108, 111, 0.12); border-radius: 18px; background: var(--accent-pale); }
.capture-modes b { color: var(--accent-dark); font-size: 20px; }
.capture-modes span { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* ---------- AI coach ---------- */
.coach-section { margin: 20px auto 0; padding: clamp(56px, 8vw, 96px) clamp(24px, 6vw, 80px); border-radius: var(--radius-xl); background: radial-gradient(circle at 92% 8%, #315e52 0, #1b3d34 34%, #142b25 72%); color: #f4f7f4; box-shadow: var(--shadow-md); }
.coach-section .eyebrow { color: #8ed0ba; }
.coach-section .section-intro p { color: rgba(244, 247, 244, 0.68); }
.coach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.coach-grid article { padding: 22px 24px; border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 19px; background: rgba(255, 255, 255, 0.055); }
.coach-grid h3 { margin: 0 0 8px; font-size: 19px; }
.coach-grid p { margin: 0; color: rgba(244, 247, 244, 0.68); font-size: 14px; line-height: 1.72; }
.coach-section + .whoop-section { margin-top: 110px; }

/* ---------- WHOOP import ---------- */
.whoop-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); align-items: start; gap: clamp(24px, 4vw, 48px); }
.steps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; display: grid; gap: 4px; padding: 20px 22px 20px 74px; border: 1px solid var(--line); border-radius: 19px; background: #fff; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; top: 19px; left: 22px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 800; }
.steps b { font-size: 16px; }
.steps span { color: var(--muted); font-size: 14px; line-height: 1.72; }
.upload-card { position: sticky; top: 100px; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-md); }
.upload-card h3 { margin: 0 0 8px; font-size: 22px; }
.upload-card p { color: var(--muted); }
.upload-card .hero-actions { margin-top: 20px; }
.dropzone { position: relative; display: grid; place-items: center; align-content: center; gap: 6px; min-height: 200px; padding: 28px; border: 2px dashed rgba(40, 108, 111, 0.35); border-radius: 20px; background: var(--accent-pale); color: var(--ink); text-align: center; cursor: pointer; transition: border-color 180ms ease, background 180ms ease; }
.dropzone input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.dropzone strong { color: var(--accent-dark); font-size: 17px; }
.dropzone span { color: var(--muted); font-size: 13px; font-weight: 500; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { box-shadow: 0 0 0 3px rgba(52, 123, 108, 0.18); }
.dropzone.busy { opacity: 0.6; pointer-events: none; }
.upload-card .form-message, #dashboard-whoop-status { margin-top: 12px; line-height: 1.6; }
.upload-card .form-message { color: var(--accent); }
.upload-card .form-message.error { color: #b63d35; }
#auth-submit:disabled { opacity: 0.6; cursor: progress; }
.fine-print { margin: 16px 0 0; color: var(--faint) !important; font-size: 12px; line-height: 1.6; }
.lead-small a { color: var(--accent); font-weight: 700; }

/* ---------- AI keys ---------- */
.key-list { display: grid; gap: 0; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.key-row:last-child { border-bottom: 0; }
.key-row small { color: var(--muted); }
.key-row .mono { font-size: 12px; }
.small-button { min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* ---------- Account rules ---------- */
.rules { display: grid; gap: 5px; margin: 0; padding: 12px 14px; border-radius: 13px; background: var(--paper); list-style: none; }
.rules li { position: relative; padding-left: 22px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.rules li::before { content: "○"; position: absolute; left: 2px; color: var(--faint); }
.rules li.met { color: var(--accent-dark); }
.rules li.met::before { content: "✓"; color: var(--accent); font-weight: 800; }
.rules li.unmet { color: #b63d35; }
.rules li.unmet::before { content: "✕"; color: #b63d35; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr 400px; gap: 24px; }
  .feature-grid, .coach-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
  .nav nav > a { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 72px; text-align: center; }
  .hero-copy { display: grid; justify-items: center; }
  .hero-actions, .trust-row { justify-content: center; }
  .hero-product { min-height: auto; padding: 10px 0; text-align: left; }
  .whoop-layout { grid-template-columns: 1fr; }
  .upload-card { position: static; }
}

@media (max-width: 700px) {
  .nav { min-height: 64px; padding: 10px 16px; }
  .brand { font-size: 18px; }
  .brand img { width: 34px; height: 34px; }
  .nav nav { gap: 4px; }
  .nav nav .button { min-height: 40px; padding: 8px 11px; font-size: 12px; }
  .section-shell, .hero { width: calc(100% - 32px); }
  .hero { min-height: auto; padding: 56px 0 64px; }
  .hero h1 { font-size: clamp(46px, 14vw, 64px); }
  .hero-lead { font-size: 17px; }
  .hero-actions { width: 100%; }
  .hero-actions .button { width: 100%; }
  .trust-row { gap: 7px 13px; }
  .track-card:nth-child(odd), .track-card:nth-child(even) { transform: none; }
  .ambient-one { width: 300px; height: 300px; }
  .ambient-two { display: none; }
  .track-section, .whoop-section { padding: 76px 0; }
  .coach-section + .whoop-section { margin-top: 76px; }
  .section-intro { margin-bottom: 30px; }
  .section-intro h2 { font-size: 36px; }
  .section-intro p { font-size: 16px; }
  .feature-grid, .coach-grid, .capture-modes { grid-template-columns: 1fr; }
  .feature-grid article { padding: 22px; }
  .feature-grid h3 { margin-top: 14px; }
  .coach-section { padding: 52px 20px; border-radius: 28px; }
  .steps li { padding: 18px 18px 18px 64px; }
  .steps li::before { left: 18px; top: 17px; width: 32px; height: 32px; }
  .upload-card { padding: 22px; }
  .dropzone { min-height: 170px; padding: 22px; }
  .final-cta { padding: 90px 0 110px; }
  .final-cta h2 { font-size: 48px; }
  .final-cta > p { font-size: 16px; }
  footer { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  footer > span { justify-self: center; }
  .dashboard { grid-template-columns: 1fr; width: calc(100% - 32px); padding-top: 16px; }
  .dashboard aside { position: static; min-height: auto; }
  .side-tabs { grid-template-columns: repeat(2, 1fr); margin: 18px 0 12px; }
  .side-tabs button { padding: 8px 3px; text-align: center; font-size: 13px; }
  #logout { margin-top: 0; }
  .stat-grid { grid-template-columns: 1fr; }
  .record { grid-template-columns: 1fr; gap: 4px; }
  .bar-row { grid-template-columns: 65px 1fr 58px; }
  .section-title h1 { font-size: 32px; }
  .panel { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.footer-middle { display: grid; justify-items: center; gap: 6px; text-align: center; }
.footer-middle p { margin: 0; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: 13px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

/* Markdown export */
.export-options { display: grid; gap: 10px; }
.export-option { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 14px; cursor: pointer; background: var(--surface); }
.export-option:has(input:checked) { border-color: var(--accent); background: var(--accent-pale); }
.export-option input { margin-top: 3px; accent-color: var(--accent); }
.export-option span { display: grid; gap: 4px; }
.export-option small { color: var(--muted); font-size: 13px; line-height: 1.5; }
#export-synced { margin-top: 0; }
