/* Coach Brain member PWA — Editorial Minimal (DESIGN.md locked tokens).
   Mobile-first phone PWA. Light-only: DESIGN.md's locked token set is light;
   dark is not defined there, so we do not invent it. */

:root {
  --bg-base: #FFFFFF;
  --bg-subtle: #FAFAFA;
  --bg-muted: #F4F4F5;
  --fg-base: #09090B;
  --fg-muted: #52525B;
  --fg-subtle: #71717A;
  --border: #E4E4E7;
  --accent: #4F46E5;

  --grad-peach: linear-gradient(135deg, #FFF4EC 0%, #FEE7D6 100%);
  --grad-mint: linear-gradient(135deg, #ECFDF3 0%, #D1F4DD 100%);
  --grad-sky: linear-gradient(135deg, #EEF4FF 0%, #DCE7FF 100%);
  --grad-lavender: linear-gradient(135deg, #F3EEFF 0%, #E2D6FB 100%);
  --grad-rose: linear-gradient(135deg, #FFF1F4 0%, #FDDDE3 100%);
  --grad-pulse: linear-gradient(90deg, #FAFAFA 0%, #F3EEFF 50%, #FAFAFA 100%);

  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-subtle);
  color: var(--fg-base);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------- app shell ---------- */
.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar .who {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-subtle);
}

.screen { padding: 20px; display: none; }
.screen.active { display: block; }

/* ---------- login ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px;
  max-width: 640px;
  margin: 0 auto;
}
.auth-hero {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-sub { color: var(--fg-muted); margin-bottom: 28px; }

form { margin: 0; }
.field { margin-bottom: 16px; }
label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
input[type="email"], input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--fg-base);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}
.btn-primary { background: var(--fg-base); color: #fff; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: var(--bg-base); color: var(--fg-base); border-color: var(--border); }
.btn-ghost:active { background: var(--bg-muted); }
.btn:disabled { opacity: 0.5; cursor: default; }

.auth-toggle {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
}
.auth-toggle a { color: var(--accent); cursor: pointer; text-decoration: none; }

.notice {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--fg-muted);
}
.notice.error { background: var(--grad-rose); border-color: #FDDDE3; color: #9F1239; }
.notice.hidden { display: none; }

/* ---------- pulse strip ---------- */
.pulse {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: baseline;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--grad-pulse);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.pulse .metric { display: flex; flex-direction: column; }
.pulse .metric .val {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.pulse .metric .val.mono { font-family: var(--font-mono); font-size: 18px; }
.pulse .metric .lbl {
  font-size: 11px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- sync banner ---------- */
.sync-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  margin-bottom: 16px;
  color: var(--fg-muted);
}
.sync-banner.ok { background: var(--bg-subtle); }
.sync-banner.stale { background: var(--grad-peach); border-color: #FEE7D6; color: #9A3412; }
.sync-banner .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sync-banner.ok .dot { background: #16A34A; }
.sync-banner.stale .dot { background: #EA580C; }
.sync-banner .reconnect { margin-left: auto; color: var(--accent); font-weight: 500; }
.sync-banner time { font-family: var(--font-mono); }

/* ---------- section ---------- */
.section { margin-bottom: 22px; }
.section > h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

/* ---------- hero action cards ---------- */
.hero-cards { display: grid; gap: 12px; }
.hero-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s, box-shadow 0.1s;
}
.hero-card:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(9,9,11,0.06); }
.hero-card.lavender { background: var(--grad-lavender); }
.hero-card.sky { background: var(--grad-sky); }
.hero-card .hc-title { font-family: var(--font-serif); font-size: 19px; font-weight: 600; }
.hero-card .hc-sub { font-size: 13px; color: var(--fg-muted); }

/* ---------- decision card ---------- */
.decision {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-base);
}
.decision .verdict {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.decision .verdict .word {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.decision .reason { color: var(--fg-muted); font-size: 14px; }
.decision .caps {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
}
.decision .caps span strong { color: var(--fg-base); }

/* tier badge */
.tier {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.tier.A { background: var(--grad-rose); border-color: #FDDDE3; color: #9F1239; }
.tier.B { background: var(--grad-mint); border-color: #D1F4DD; color: #166534; }
.tier.C { background: var(--grad-sky); border-color: #DCE7FF; color: #3730A3; }

/* ---------- rows / lists ---------- */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-base);
}
.row .row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .row-title { font-weight: 500; }
.row .row-sub { font-size: 12px; color: var(--fg-subtle); font-family: var(--font-mono); }
.row .row-val { font-family: var(--font-mono); font-size: 13px; color: var(--fg-muted); text-align: right; white-space: nowrap; }
.row .row-date { font-family: var(--font-mono); font-size: 12px; color: var(--fg-subtle); }

/* correlations */
.corr .row-title { font-weight: 400; font-size: 14px; }
.corr .r-val { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.corr .r-val.pos { color: #166534; }
.corr .r-val.neg { color: #9F1239; }

/* ---------- empty state ---------- */
.empty {
  padding: 22px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--fg-subtle);
  font-size: 14px;
  background: var(--bg-subtle);
}

/* ---------- modal (check-in) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9,9,11,0.4);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-backdrop.active { display: flex; }
.modal {
  width: 100%;
  max-width: 640px;
  background: var(--bg-base);
  border-radius: 18px 18px 0 0;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 641px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 18px; }
}
.modal .m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.modal .m-title { font-family: var(--font-serif); font-size: 22px; font-weight: 600; }
.modal .m-close {
  border: none; background: none; cursor: pointer;
  color: var(--fg-subtle); width: 32px; height: 32px; border-radius: 8px;
}
.modal .m-close:hover { background: var(--bg-muted); }
.modal .m-sub { color: var(--fg-muted); font-size: 13px; margin-bottom: 18px; }

.q { margin-bottom: 20px; }
.q .q-text { font-weight: 500; margin-bottom: 10px; }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-base);
  font-size: 14px;
  transition: border-color 0.1s, background 0.1s;
}
.opt:hover { background: var(--bg-muted); }
.opt.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); background: var(--bg-base); }
.opt .opt-pen { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); }

.savebar {
  position: sticky;
  bottom: 0;
  margin: 8px -20px -20px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg-base);
  border-top: 1px solid var(--border);
}

.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; flex: none; }
.center-note { text-align: center; color: var(--fg-subtle); font-size: 13px; padding: 40px 0; }
.foot { text-align: center; color: var(--fg-subtle); font-size: 12px; padding: 18px 0 28px; }
.foot a { color: var(--accent); cursor: pointer; }
