/* =========================================================================
   AreteAI — design system
   Light-first. Navy is the one accent; everything else is off-white, paper
   and ink. Pillar colours (all navy-adjacent) are used only for identity.
   ========================================================================= */

:root {
  /* --- light (default) --- */
  --bg:          #f6f4ef;
  --surface:     #ffffff;
  --surface-2:   #f0ede5;
  --surface-3:   #e7e2d6;
  --navy:        #2b4374;
  --navy-soft:   #e4e8f2;
  --ink:         #1a2438;
  --ink-dim:     #3c4763;
  --muted:       #6a7288;
  --faint:       #9298a9;
  --line:        #e6e1d5;
  --line-2:      #d6d0c1;
  --accent:      #2f4d86;
  --accent-hi:   #253f70;
  --accent-dim:  #e6ebf5;
  --on-accent:   #ffffff;
  --ok:          #3f7d5e;
  --danger:      #b15656;

  --p-sleep:  #5a6fa6;
  --p-diet:   #3f8285;
  --p-move:   #5c9068;
  --p-focus:  #7d68a6;
  --p-time:   #4a80a8;
  --p-custom: #8a7f9e;

  --shadow-sm: 0 1px 2px rgba(26,36,56,.05), 0 1px 1px rgba(26,36,56,.04);
  --shadow:    0 10px 30px -14px rgba(26,36,56,.18);
  --shadow-lg: 0 24px 60px -20px rgba(26,36,56,.20);
  --shadow-accent: 0 10px 24px -10px color-mix(in srgb, var(--accent) 48%, transparent);

  --r-sm: 7px; --r: 11px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 22px; --s6: 32px; --s7: 48px; --s8: 72px;

  --ease: cubic-bezier(.2,.6,.2,1);
  --dur: 150ms;

  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --sidebar-w: 240px;
  --page-max: 1080px;

  color-scheme: light;
}

/* --- dark, only when explicitly chosen or system-preferred --- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#10141d; --surface:#171d29; --surface-2:#1e2634; --surface-3:#273042;
    --navy:#3a5286; --navy-soft:#1d2740;
    --ink:#eef1f7; --ink-dim:#c4cad7; --muted:#8b93a7; --faint:#5b6479;
    --line:#232c3e; --line-2:#313c53;
    --accent:#8aa4d6; --accent-hi:#a3b8e2; --accent-dim:#1e2a44; --on-accent:#0f1626;
    --ok:#6fae87; --danger:#d97878;
    --p-sleep:#8fa6da; --p-diet:#5fb0b2; --p-move:#7fae8a; --p-focus:#ab97d3; --p-time:#6fb1c6; --p-custom:#a89bc0;
    --shadow-sm:0 1px 2px rgba(0,0,0,.28);
    --shadow:0 6px 24px -8px rgba(0,0,0,.5);
    --shadow-lg:0 20px 60px -18px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:#10141d; --surface:#171d29; --surface-2:#1e2634; --surface-3:#273042;
  --navy:#3a5286; --navy-soft:#1d2740;
  --ink:#eef1f7; --ink-dim:#c4cad7; --muted:#8b93a7; --faint:#5b6479;
  --line:#232c3e; --line-2:#313c53;
  --accent:#8aa4d6; --accent-hi:#a3b8e2; --accent-dim:#1e2a44; --on-accent:#0f1626;
  --ok:#6fae87; --danger:#d97878;
  --p-sleep:#8fa6da; --p-diet:#5fb0b2; --p-move:#7fae8a; --p-focus:#ab97d3; --p-time:#6fb1c6; --p-custom:#a89bc0;
  --shadow-sm:0 1px 2px rgba(0,0,0,.28);
  --shadow:0 6px 24px -8px rgba(0,0,0,.5);
  --shadow-lg:0 20px 60px -18px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 32%, transparent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* =========================================================================
   App shell
   ========================================================================= */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  padding: var(--s5) var(--s3);
  gap: var(--s2);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3) var(--s4);
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 500;
  letter-spacing: -.01em;
}
.brand .mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--navy) 115%, white 8%), color-mix(in srgb, var(--navy) 82%, #000));
  box-shadow: 0 3px 8px -2px color-mix(in srgb, var(--navy) 55%, transparent), inset 0 1px 0 rgba(255,255,255,.14);
  display: grid; place-items: center; flex: none;
  color: #fff; font-family: var(--font-ui); font-weight: 700; font-size: .8rem;
}

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: .66rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); padding: var(--s4) var(--s3) var(--s2);
}
.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 450;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface); color: var(--ink-dim); }
.nav-item.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 550;
  box-shadow: var(--shadow-sm), inset 2px 0 0 var(--accent);
}
.nav-item.active svg { opacity: 1; color: var(--accent); }

.sidebar-foot { margin-top: auto; padding-top: var(--s4); display: flex; flex-direction: column; gap: 2px; }
button.nav-item { width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left; font-family: inherit; }
.nav-item.startover { font-size: .8rem; color: var(--faint); }
.nav-item.startover:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.profile-chip {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--muted);
  transition: background var(--dur) var(--ease);
}
.profile-chip:hover { background: var(--surface); color: var(--ink-dim); }
.avatar {
  width: 28px; height: 28px; border-radius: var(--r-full); flex: none;
  background: linear-gradient(150deg, color-mix(in srgb, var(--navy) 115%, white 8%), color-mix(in srgb, var(--navy) 82%, #000));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 600; font-size: .78rem;
}
.profile-chip .who { font-size: .82rem; line-height: 1.2; min-width: 0; }
.profile-chip .who small { display: block; color: var(--faint); font-size: .7rem; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--s6);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  min-height: 58px;
}
.topbar h1 {
  font-family: var(--font-ui);
  font-size: 1rem; font-weight: 600; letter-spacing: -.01em;
  margin: 0;
}
.topbar .context { color: var(--faint); font-size: .8rem; }
.topbar .spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: var(--s2); }

.topbar-menu { display: none; }
.topbar-sheet { display: none; }

.page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s6) var(--s6) var(--s8);
  flex: 1;
}

/* mobile bottom nav */
.bottomnav { display: none; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding-left: var(--s5); padding-right: var(--s5); }
  .page { padding: var(--s5) var(--s5) calc(var(--s8) + 40px); }

  .topbar-menu {
    display: grid; place-items: center; flex: none;
    width: 34px; height: 34px; margin-right: var(--s1);
    border: 1px solid var(--line-2); border-radius: var(--r-sm);
    background: var(--surface-2); color: var(--muted); cursor: pointer;
  }
  .topbar-menu svg { width: 17px; height: 17px; }
  .topbar { gap: var(--s3); }
  .topbar .context { display: none; }
  .topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { flex: none; }
  .topbar-sheet:not([hidden]) {
    display: flex; flex-direction: column; gap: 2px;
    padding: var(--s2) var(--s3) var(--s3);
    background: var(--surface); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .topbar-sheet .nav-item { font-size: .9rem; padding: var(--s3); }
  .bottomnav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottomnav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; border-radius: var(--r-sm);
    color: var(--muted); text-decoration: none;
    font-size: .62rem; font-weight: 500;
  }
  .bottomnav a svg { width: 20px; height: 20px; }
  .bottomnav a.active { color: var(--accent); }
}
@media (max-width: 420px) {
  .page { padding-left: var(--s4); padding-right: var(--s4); }
}

/* =========================================================================
   Typography helpers
   ========================================================================= */
.eyebrow {
  font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .13em;
  color: var(--faint);
}
.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -.015em;
  line-height: 1.14;
  margin: 0;
  text-wrap: balance;
}
h1.display { font-size: clamp(1.7rem, 3vw, 2.15rem); }
h2.display { font-size: 1.35rem; }
.serif { font-family: var(--font-display); font-weight: 400; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* one consistent rhythm between top-level blocks on every screen */
.page > * + * { margin-top: var(--s6); }

.section-head {
  display: flex; align-items: baseline; gap: var(--s3);
  margin-bottom: var(--s4);
}
.section-head h2 {
  font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin: 0;
}
.section-head .link {
  margin-left: auto; font-size: .8rem; color: var(--accent);
  text-decoration: none; font-weight: 500;
}
.section-head .link:hover { text-decoration: underline; }

/* =========================================================================
   Components
   ========================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card.pad-sm { padding: var(--s4); }
.card.flush { padding: 0; overflow: hidden; }

.grid { display: grid; gap: var(--s4); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 760px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
}

/* buttons */
.btn {
  --bg-btn: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font-family: inherit; font-size: .84rem; font-weight: 550;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--bg-btn);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white), var(--accent));
  color: var(--on-accent); border-color: transparent; font-weight: 600;
  box-shadow: 0 1px 1px rgba(0,0,0,.05), var(--shadow-accent);
}
.btn.primary:hover {
  background: linear-gradient(180deg, var(--accent), var(--accent-hi));
  transform: translateY(-1px);
  box-shadow: 0 2px 3px rgba(0,0,0,.06), 0 14px 28px -12px color-mix(in srgb, var(--accent) 55%, transparent);
}
.btn.primary:active { transform: translateY(0); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: .78rem; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line-2)); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.iconbtn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--muted); cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.iconbtn:hover { background: var(--surface-3); color: var(--ink); }
.iconbtn svg { width: 16px; height: 16px; }

/* badge / pill */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .68rem; font-weight: 600; letter-spacing: .02em;
  padding: 3px 8px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line);
}
.badge .dot { width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; }
.badge.amber { color: var(--accent); background: var(--accent-dim); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge.warn { color: var(--accent); }

/* pillar dot + accents */
.pdot { width: 8px; height: 8px; border-radius: var(--r-full); flex: none; display: inline-block; }
.p-sleep  { --pc: var(--p-sleep); }
.p-diet   { --pc: var(--p-diet); }
.p-movement { --pc: var(--p-move); }
.p-move   { --pc: var(--p-move); }
.p-focus  { --pc: var(--p-focus); }
.p-time   { --pc: var(--p-time); }
.p-custom { --pc: var(--p-custom); }
.pdot.p-sleep { background: var(--p-sleep); }
.pdot.p-diet { background: var(--p-diet); }
.pdot.p-movement, .pdot.p-move { background: var(--p-move); }
.pdot.p-focus { background: var(--p-focus); }
.pdot.p-time { background: var(--p-time); }
.pdot.p-custom { background: var(--pc, var(--p-custom)); }

/* metric */
.metric { display: flex; flex-direction: column; gap: 3px; }
.metric .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); }
.metric .value { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric .value.serif { font-family: var(--font-display); font-weight: 500; }
.metric .sub { font-size: .78rem; color: var(--muted); }

/* progress */
.track { height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--pc, var(--accent)); transition: width .5s var(--ease); }

.ring { --sz: 44px; --pct: 0; width: var(--sz); height: var(--sz); flex: none;
  border-radius: var(--r-full);
  background: conic-gradient(var(--pc, var(--accent)) calc(var(--pct) * 1%), var(--surface-3) 0);
  display: grid; place-items: center;
  -webkit-mask: none;
}
.ring::after {
  content: ""; width: calc(var(--sz) - 10px); height: calc(var(--sz) - 10px);
  border-radius: var(--r-full); background: var(--surface);
}
.ring span { position: absolute; font-size: .68rem; font-weight: 700; }
.ring-wrap { position: relative; display: grid; place-items: center; }

/* AI insight */
.ai {
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  background: linear-gradient(180deg, var(--accent-dim), transparent 120%);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: 0 12px 30px -18px color-mix(in srgb, var(--accent) 35%, transparent);
}
.ai .ai-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.ai .ai-head .spark { width: 15px; height: 15px; color: var(--accent); }
.ai .ai-head .label { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }
.ai .ai-body { font-size: .94rem; color: var(--ink-dim); }
.ai .ai-body.serif { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.45; }

/* expandable */
.expand { border-top: 1px solid var(--line); margin-top: var(--s4); }
.expand > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) 0 0;
  font-size: .8rem; font-weight: 600; color: var(--muted);
}
.expand > summary::-webkit-details-marker { display: none; }
.expand > summary .chev { width: 14px; height: 14px; transition: transform var(--dur) var(--ease); }
.expand[open] > summary .chev { transform: rotate(90deg); }
.expand .expand-body { padding: var(--s3) 0 var(--s2); color: var(--muted); font-size: .875rem; }
.expand .expand-body ul { margin: 0; padding-left: 1.1rem; }
.expand .expand-body li { margin-bottom: 4px; }

/* timeline */
.timeline { display: flex; flex-direction: column; }
.tl-row {
  display: grid;
  grid-template-columns: 52px 14px 1fr;
  gap: var(--s3);
  padding: var(--s3) 0;
  align-items: start;
}
.tl-row + .tl-row { border-top: 1px solid var(--line); }
.tl-time { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 5px; }
.tl-rail .node { width: 9px; height: 9px; border-radius: var(--r-full); background: var(--pc, var(--faint)); flex: none; }
.tl-rail .line { width: 2px; flex: 1; background: var(--line-2); min-height: 8px; }
.tl-body { min-width: 0; }
.tl-title { font-size: .92rem; font-weight: 500; display: flex; align-items: center; gap: var(--s2); }
.tl-meta { font-size: .74rem; color: var(--faint); margin-top: 1px; }
.tl-row.past { opacity: .48; }
.tl-row.now .tl-title::after {
  content: "now"; font-size: .6rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-dim); padding: 1px 6px; border-radius: var(--r-full);
}
.tl-row .check {
  appearance: none; width: 18px; height: 18px; flex: none; margin: 0;
  border: 1.5px solid var(--line-2); border-radius: 6px; cursor: pointer;
  background: var(--surface-2);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tl-row .check:checked { background: var(--accent); border-color: var(--accent); }
.tl-row .check:checked::after {
  content: "✓"; display: grid; place-items: center; color: var(--on-accent); font-size: .72rem; font-weight: 800; height: 100%;
}
.tl-title.done { text-decoration: line-through; color: var(--muted); }
.tl-why { font-size: .8rem; color: var(--muted); margin-top: var(--s2); display: none; }
.tl-row.show-why .tl-why { display: block; }
.tl-row .whytoggle { background: none; border: 0; color: var(--faint); font-size: .74rem; cursor: pointer; padding: 2px 0; }
.tl-row .whytoggle:hover { color: var(--accent); }

/* pillar cards */
.pillar-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: var(--s3);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
a.pillar-card:hover {
  border-color: color-mix(in srgb, var(--pc) 55%, var(--line));
  transform: translateY(-2px);
  box-shadow: 0 14px 32px -16px color-mix(in srgb, var(--pc) 45%, transparent);
}
.pillar-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--pc);
  box-shadow: 0 0 12px 0 color-mix(in srgb, var(--pc) 60%, transparent);
}
.pillar-card .pc-head { display: flex; align-items: center; gap: var(--s2); }
.pillar-card .pc-name { font-family: var(--font-display); font-size: 1.02rem; font-weight: 500; }
.pillar-card .pc-status { font-size: .85rem; color: var(--ink-dim); }
.pillar-card .pc-insight { font-size: .8rem; color: var(--muted); margin-top: auto; padding-top: var(--s1); }
.pillar-card .pc-foot { display: flex; align-items: center; gap: var(--s3); margin-top: auto; font-size: .74rem; color: var(--faint); }

/* the same accent-bar identity, extended to every other card-per-item list:
   goals, focus objectives, custom pillars, detected patterns */
.obj-card, .goal-card, .cp-card, .pat-card {
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.obj-card::before, .goal-card::before, .cp-card::before, .pat-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--pc, var(--accent));
  box-shadow: 0 0 12px 0 color-mix(in srgb, var(--pc, var(--accent)) 55%, transparent);
}
.obj-card { --pc: var(--p-focus); }
.goal-card, .cp-card, .pat-card { padding-left: calc(var(--s5) + 4px); }

/* segmented / scale */
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: .82rem; font-weight: 500; padding: 5px 12px; border-radius: 6px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.scale { display: flex; gap: var(--s2); flex-wrap: wrap; }
.scale button {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted);
  font: inherit; font-weight: 600; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.scale button:hover { border-color: var(--line-2); color: var(--ink); }
.scale button.on {
  background: var(--accent); color: var(--on-accent); border-color: transparent;
  box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--accent) 55%, transparent);
}
.scale-ends { display: flex; justify-content: space-between; font-size: .68rem; color: var(--faint); margin-top: 4px; }

/* inputs */
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.input, textarea.input {
  width: 100%; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  color: var(--ink); font: inherit; font-size: .9rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:focus, textarea.input:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
textarea.input { resize: vertical; min-height: 62px; }

/* toast */
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--surface-3); color: var(--ink); border: 1px solid var(--line-2);
  padding: 10px 16px; border-radius: var(--r); font-size: .84rem; box-shadow: var(--shadow-lg);
  animation: toastin .22s var(--ease);
}
.toast.err { border-color: color-mix(in srgb, var(--danger) 50%, var(--line-2)); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* modal / sheet */
.scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6,9,15,.6); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: var(--s5);
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg);
  width: min(440px, 100%); padding: var(--s6); box-shadow: var(--shadow-lg);
  animation: pop .2s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
.modal h3 { font-family: var(--font-display); font-weight: 500; margin: 0 0 var(--s3); font-size: 1.15rem; }
.modal .modal-actions { display: flex; gap: var(--s2); justify-content: flex-end; margin-top: var(--s5); }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel.line { height: 12px; margin: 6px 0; }
.skel.title { height: 22px; width: 40%; margin-bottom: var(--s4); }
.skel.card { height: 120px; border-radius: var(--r-lg); }

/* empty / error */
.state {
  text-align: center; padding: var(--s8) var(--s5);
  display: flex; flex-direction: column; align-items: center; gap: var(--s3);
}
.state .state-icon {
  width: 46px; height: 46px; border-radius: var(--r); background: var(--surface-2);
  display: grid; place-items: center; color: var(--muted);
}
.state h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.2rem; margin: 0; }
.state p { color: var(--muted); max-width: 34ch; margin: 0; font-size: .9rem; }

/* misc */
.row { display: flex; align-items: center; gap: var(--s3); }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.divider { height: 1px; background: var(--line); margin: var(--s4) 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
ul.clean { list-style: none; margin: 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.disclaimer { font-size: .72rem; color: var(--faint); border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s4); }

.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; }

/* =========================================================================
   Onboarding / intake
   ========================================================================= */
.intake-body { min-height: 100vh; display: flex; flex-direction: column; }

/* slim top bar — replaces the old setup sidebar */
.intake-topbar {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: auto 1fr; align-items: center;
  gap: var(--s3) var(--s4);
  padding: var(--s4) var(--s6) 0;
  background: var(--bg);
}
.intake-topbar .brand { padding: 0; font-size: .92rem; }
.intake-step {
  margin: 0; justify-self: end;
  font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint);
}
.intake-track {
  grid-column: 1 / -1; height: 3px; border-radius: var(--r-full);
  background: var(--surface-3); overflow: hidden; margin-top: var(--s3);
}
.intake-track-fill {
  height: 100%; width: 0; background: var(--accent);
  border-radius: var(--r-full); transition: width .55s var(--ease);
}

.intake-stage {
  flex: 1; display: flex; justify-content: center;
  padding: clamp(var(--s6), 7vh, var(--s8)) var(--s6) var(--s8);
}
.intake-col {
  width: 100%; max-width: 520px;
  display: flex; flex-direction: column; gap: var(--s5);
}
.intake-col.leaving { animation: intakeOut .18s var(--ease) forwards; }
.intake-col.entering { animation: intakeIn .32s var(--ease); }
@keyframes intakeOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes intakeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.intake-head { display: flex; flex-direction: column; gap: var(--s2); }
.intake-q {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem); line-height: 1.22; letter-spacing: -.01em;
  margin: 0;
}
.intake-sub { margin: 0; color: var(--muted); font-size: .9rem; }
.intake-understood {
  display: flex; align-items: flex-start; gap: var(--s2);
  font-size: .86rem; color: var(--muted); animation: fade .25s var(--ease);
}
.intake-understood svg { width: 15px; height: 15px; color: var(--ok); flex: none; margin-top: 2px; }

/* --- grouped mini-questions --- */
.intake-fields { display: flex; flex-direction: column; gap: var(--s5); }
.qfield { display: flex; flex-direction: column; gap: var(--s3); }
.qfield > .qlabel {
  font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}
.qfield .qhint { font-size: .82rem; color: var(--faint); margin: -4px 0 0; }

/* --- choice / multi chips --- */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  padding: 9px 15px; border-radius: var(--r-full);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"], .chip.on {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
  box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--accent) 55%, transparent);
}
.chip.text-alt { border-style: dashed; color: var(--muted); }

/* --- big option cards (situation) --- */
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.opt {
  text-align: left; padding: var(--s4); border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.opt:hover {
  border-color: var(--accent); transform: translateY(-1px); background: var(--surface);
  box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* --- form inputs --- */
.qrow { display: flex; flex-wrap: wrap; gap: var(--s3); }
.qrow > * { flex: 1 1 140px; }
.iinput, .iselect {
  width: 100%; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink);
  font: inherit; font-size: .92rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.iinput:focus, .iselect:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
textarea.iinput { resize: vertical; min-height: 46px; line-height: 1.45; font-family: inherit; }
.itoggle {
  display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer;
  font-size: .9rem; color: var(--ink);
}
.itoggle input { width: 16px; height: 16px; accent-color: var(--accent); }

/* --- composer (free text fallback + text slots) --- */
.composer { display: flex; gap: var(--s2); align-items: flex-end; }
.composer textarea {
  flex: 1; resize: none; min-height: 46px; max-height: 160px;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink);
  font: inherit; font-size: .95rem; line-height: 1.4;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.composer textarea:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.composer .send {
  width: 46px; height: 46px; flex: none; border-radius: var(--r);
  border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer;
  display: grid; place-items: center;
}
.composer .send:disabled { opacity: .4; }
.composer .send svg { width: 18px; height: 18px; }

.intake-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.intake-skip {
  background: none; border: 0; color: var(--faint); font: inherit; font-size: .84rem;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.intake-skip:hover { color: var(--muted); }

/* --- done / review --- */
.intake-done-head { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s2); }
.summary-list { display: flex; flex-direction: column; }
.summary-item {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s2) var(--s3);
  padding: var(--s3) 0; border-top: 1px solid var(--line); align-items: start;
}
.summary-item .k { font-size: .82rem; color: var(--muted); }
.summary-item .v { grid-column: 1; font-size: .9rem; color: var(--ink-dim); }
.summary-item .v .mono { font-size: .82rem; }
.summary-item .edit { grid-row: 1 / span 2; align-self: center; }

@media (max-width: 640px) {
  .intake-topbar, .intake-stage { padding-left: var(--s5); padding-right: var(--s5); }
  .opt-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   Overview
   ========================================================================= */
.ov-hero h1.display { font-size: clamp(1.7rem, 3.2vw, 2.2rem); }
.ov-hero p { margin: var(--s2) 0 0; }

.ov-priority {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  background: linear-gradient(180deg, var(--accent-dim), transparent 130%);
  box-shadow: 0 12px 30px -18px color-mix(in srgb, var(--accent) 32%, transparent);
}
.ov-priority .ov-priority-text {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  line-height: 1.32; letter-spacing: -.01em;
  margin: var(--s3) 0 0;
}

/* =========================================================================
   Today
   ========================================================================= */
.btn svg, a.link svg { width: 14px; height: 14px; flex: none; }

.section-head .count {
  margin-left: auto; font-size: .78rem; color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.today-now {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  background: linear-gradient(180deg, var(--accent-dim), transparent 140%);
  box-shadow: 0 12px 30px -18px color-mix(in srgb, var(--accent) 32%, transparent);
}
.today-now .today-now-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.24;
  letter-spacing: -.01em; margin: var(--s2) 0 var(--s1);
}
.today-now .muted { margin: 0; font-size: .86rem; }

.rhythm { display: flex; flex-wrap: wrap; gap: var(--s2); }
.rhythm-pill {
  display: flex; align-items: baseline; gap: var(--s2);
  padding: var(--s2) var(--s3); border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--line);
}
.rhythm-pill .rk {
  font-size: .64rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint);
}
.rhythm-pill .rv { font-size: .82rem; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

.mini-list { margin: var(--s3) 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--s2); }
.mini-list li { font-size: .88rem; color: var(--ink-dim); }
.mini-list .mono { color: var(--muted); margin-right: var(--s2); font-size: .82rem; }

.checkin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s4); }

/* =========================================================================
   Week
   ========================================================================= */
.wk-warn {
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--line));
  background: color-mix(in srgb, var(--danger) 7%, transparent);
  border-radius: var(--r); padding: var(--s3) var(--s4);
  font-size: .85rem; color: var(--ink-dim);
}
.info-box {
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
  background: var(--accent-dim);
  border-radius: var(--r); padding: var(--s3) var(--s4);
  font-size: .85rem; color: var(--ink-dim);
}

.bar-row {
  display: grid; grid-template-columns: 92px 1fr auto;
  gap: var(--s3); align-items: center; padding: var(--s2) 0;
}
.bar-row + .bar-row { border-top: 1px solid var(--line); }
.bar-row .bn { font-size: .86rem; color: var(--ink-dim); text-transform: capitalize; }
.bar-row .bv { font-size: .76rem; color: var(--faint); font-variant-numeric: tabular-nums; }

.wk-days { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.wk-day-btn {
  flex: 1 1 auto; min-width: 78px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: var(--s2) var(--s2);
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface-2); color: var(--muted);
  font: inherit; cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.wk-day-btn:hover { border-color: var(--accent); }
.wk-day-btn.on {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
  box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--accent) 55%, transparent);
}
.wk-day-btn .wd { font-size: .82rem; font-weight: 600; }
.wk-day-btn .wc { font-size: .66rem; opacity: .85; font-variant-numeric: tabular-nums; }
.wk-day-btn.is-today { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); }

.wk-list { display: flex; flex-direction: column; }
.wk-row {
  display: grid; grid-template-columns: 62px 1fr; gap: var(--s3);
  padding: var(--s3) 0; align-items: start;
}
.wk-row + .wk-row { border-top: 1px solid var(--line); }
.wk-row .wt { font-size: .76rem; color: var(--faint); font-variant-numeric: tabular-nums; padding-top: 2px; }
.wk-row.fixed { opacity: .6; }
.wk-row .wbody { min-width: 0; }
.wk-name { font-size: .92rem; font-weight: 500; display: flex; align-items: center; gap: var(--s2); }
.wk-name .lk { width: 13px; height: 13px; color: var(--faint); }
button.wk-name {
  background: none; border: 0; padding: 0; margin: 0; font: inherit;
  color: inherit; text-align: left; width: 100%;
}
.wk-row.session button.wk-name { cursor: pointer; }
.wk-row.session button.wk-name:hover { color: var(--accent); }
.wk-sub { font-size: .74rem; color: var(--faint); margin-top: 1px; }
.wk-why { margin-top: var(--s2); font-size: .82rem; color: var(--muted); max-width: 52ch; }
.wk-actions { display: flex; gap: var(--s2); margin-top: var(--s3); flex-wrap: wrap; }
.wk-empty { font-size: .88rem; color: var(--muted); padding: var(--s4) 0; }
.wk-fb-list { margin: var(--s3) 0 0; padding-left: 1.1rem; font-size: .85rem; color: var(--muted); }
.wk-fb-list li { margin-bottom: 4px; }

/* =========================================================================
   Pillars
   ========================================================================= */
.pl-back {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: .82rem; color: var(--muted); background: none; border: 0;
  cursor: pointer; padding: 0; font: inherit;
}
.pl-back:hover { color: var(--ink); }
.pl-back svg { width: 14px; height: 14px; transform: rotate(180deg); }

.pl-head .pl-name {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 1.95rem); letter-spacing: -.01em;
  margin: var(--s2) 0 var(--s2); display: flex; align-items: center; gap: var(--s3);
}
.pl-head .pl-name .pdot { width: 11px; height: 11px; }
.pl-head .pl-summary { color: var(--ink-dim); font-size: 1rem; margin: 0; max-width: 60ch; }

.pl-note { font-size: .78rem; color: var(--faint); margin-top: var(--s6); max-width: 62ch; }

.meal-list { display: flex; flex-direction: column; }
.meal-row {
  display: grid; grid-template-columns: 118px 1fr; gap: var(--s3);
  padding: var(--s3) 0;
}
.meal-row + .meal-row { border-top: 1px solid var(--line); }
.meal-row .mt { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.meal-row .ml { font-size: .9rem; font-weight: 500; }
.meal-row .mn { font-size: .8rem; color: var(--faint); margin-top: 2px; }

.obj-card { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4) var(--s4) var(--s4) calc(var(--s4) + 4px); background: var(--surface); }
.obj-card + .obj-card { margin-top: var(--s3); }
.obj-card .ot { font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; }
.obj-card .oline { font-size: .86rem; color: var(--ink-dim); margin-top: var(--s2); }
.obj-card .oline b { font-weight: 600; color: var(--ink); }

.chip-times { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip-times span {
  padding: 3px 10px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .78rem; color: var(--ink-dim); font-variant-numeric: tabular-nums;
}

/* =========================================================================
   Check-in
   ========================================================================= */
.ci-h {
  font-family: var(--font-display); font-weight: 500;
  font-size: 1.3rem; letter-spacing: -.01em; margin: var(--s2) 0 var(--s3);
}
.ci-pillar {
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s3) 0; flex-wrap: wrap;
}
.ci-pillar + .ci-pillar { border-top: 1px solid var(--line); }
.ci-pillar-name {
  display: flex; align-items: center; gap: var(--s2);
  min-width: 104px; font-size: .9rem; font-weight: 500;
}

/* =========================================================================
   Insights
   ========================================================================= */
.ins-cap { font-size: .83rem; color: var(--muted); margin: var(--s3) 0 0; }
.ins-cap b { color: var(--ink); font-weight: 600; }
.ins-spark { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); }
.ins-spark .sl { font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); }
.ins-spark .sv { font-size: .9rem; color: var(--ink-dim); margin-top: 2px; }
.ins-notes { list-style: none; margin: var(--s3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.ins-notes li { font-size: .88rem; color: var(--ink-dim); }
.ins-notes .nd { display: block; font-size: .72rem; color: var(--faint); font-variant-numeric: tabular-nums; margin-bottom: 2px; }
@media (max-width: 560px) { .ins-spark { grid-template-columns: 1fr; } }

/* =========================================================================
   Settings
   ========================================================================= */
.set-row {
  display: flex; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) 0; align-items: baseline;
}
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row .k { font-size: .85rem; color: var(--muted); flex: none; }
.set-row .v { font-size: .9rem; color: var(--ink-dim); text-align: right; }
.set-actions { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }
.set-name { display: flex; gap: var(--s2); }
.set-name .input { flex: 1; min-width: 0; }


/* =========================================================================
   Talk to your week (Phase 9)
   ========================================================================= */
.card.talk .talk-log {
  display: flex; flex-direction: column; gap: var(--s2);
  margin: var(--s3) 0;
}
.talk-msg {
  font-size: .88rem; line-height: 1.5; padding: var(--s2) var(--s3);
  border-radius: var(--r); max-width: 90%;
}
.talk-msg.you { align-self: flex-end; background: var(--accent); color: var(--on-accent, #fff); }
.talk-msg.ai { align-self: flex-start; background: var(--surface-2); color: var(--ink-dim); }
.talk-proposal {
  margin: var(--s2) 0 var(--s3); padding: var(--s3);
  background: var(--accent-dim); border-radius: var(--r);
}
ul.talk-changes { margin: 0 0 var(--s2); padding-left: 1.1em; }
ul.talk-changes li { font-size: .86rem; color: var(--ink-dim); margin: 2px 0; }
.talk-warn { font-size: .82rem; color: var(--danger); margin: var(--s1) 0 0; }
.talk-actions { display: flex; gap: var(--s2); margin-top: var(--s3); }
.talk-input { display: flex; gap: var(--s2); margin-top: var(--s2); }
.talk-input .input { flex: 1; min-width: 0; }

/* =========================================================================
   Weekly review (Phase 10)
   ========================================================================= */
.rv-intro {
  font-family: "Newsreader", Georgia, serif; font-size: 1.35rem; line-height: 1.35;
  color: var(--ink); margin: var(--s2) 0 0; text-wrap: balance; max-width: 30ch;
}
.rv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); margin-top: var(--s3); }
.rv-col h4 {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--faint); margin: 0 0 var(--s2); font-weight: 600;
}
ul.rv-ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
ul.rv-ul li { display: flex; gap: var(--s2); font-size: .86rem; color: var(--ink-dim); line-height: 1.4; }
.rv-ic { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--accent); }
.rv-bars { margin-top: var(--s2); }
.rv-done-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.ci-review-cta { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.ci-review-cta .btn { flex: none; }
@media (max-width: 560px) {
  .rv-cols { grid-template-columns: 1fr; gap: var(--s4); }
  .ci-review-cta { flex-direction: column; align-items: flex-start; }
}

/* Patterns (Phase 11) — on the Insights screen */
.pat-card + .pat-card { margin-top: var(--s3); }
.pat-head { display: flex; align-items: flex-start; gap: var(--s2); }
.pat-ic { width: 16px; height: 16px; flex: none; color: var(--accent); margin-top: 2px; }
.pat-ic-sm { width: 12px; height: 12px; flex: none; }
.pat-title { font-weight: 600; font-size: .95rem; line-height: 1.35; color: var(--ink); }
.pat-title.p-sleep, .pat-title.p-diet, .pat-title.p-movement, .pat-title.p-focus { color: var(--pc); }
.pat-detail { font-size: .86rem; color: var(--ink-dim); margin: var(--s2) 0 0; line-height: 1.5; }
.pat-tags { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.pat-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; color: var(--faint); background: var(--surface-2);
  padding: 2px 8px; border-radius: var(--r-full); font-variant-numeric: tabular-nums;
}
.pat-tag.on { color: var(--accent); background: var(--accent-dim); }
.pat-note { font-size: .78rem; color: var(--faint); margin: var(--s2) 0 0; font-style: italic; }

/* =========================================================================
   Goals (Phase 12)
   ========================================================================= */
.goal-card + .goal-card { margin-top: var(--s3); }
.goal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.goal-title { display: flex; align-items: center; gap: var(--s2); font-weight: 600; font-size: .98rem; color: var(--ink); }
.goal-status {
  font-size: .72rem; font-weight: 600; white-space: nowrap;
  padding: 2px 9px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--muted);
}
.goal-status.ok { background: color-mix(in srgb, var(--ok, #5f9e77) 16%, transparent); color: var(--ok, #5f9e77); }
.goal-status.warn { background: color-mix(in srgb, #c98a3c 16%, transparent); color: #b5772b; }
.goal-status.bad { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.goal-bar { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); }
.goal-bar .track { flex: 1; }
.goal-figs { font-size: .78rem; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal-meta { font-size: .8rem; color: var(--muted); margin: var(--s3) 0 0; }
.goal-spark { margin-top: var(--s3); opacity: .8; }
.goal-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.goal-form { display: flex; flex-direction: column; gap: var(--s3); }
.goal-form .field { margin: 0; }
.goal-form select.input { appearance: none; }
@media (max-width: 480px) {
  .goal-head { flex-direction: column; align-items: flex-start; gap: var(--s2); }
}

/* Custom pillars (Phase 13) */
.cp-card + .cp-card { margin-top: var(--s3); }
.cp-card .pc-head { display: flex; align-items: center; gap: var(--s2); }
.cp-card .pc-name { font-weight: 600; color: var(--ink); }
.cp-card .pc-status { font-size: .84rem; color: var(--muted); margin-top: var(--s2); }
.cp-card .pc-insight { font-size: .84rem; color: var(--ink-dim); margin-top: var(--s2); }
input.cp-color {
  width: 44px; height: 30px; padding: 2px; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
}

/* "serves" line — what a session is for (Phase 14) */
.wk-serves, .tl-serves {
  display: block; font-size: .74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent); margin-bottom: 3px;
}
.tl-why .tl-serves + span { display: block; }

/* =========================================================================
   Phase 15 — skip link, footer, trust
   ========================================================================= */
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  background: var(--accent); color: var(--on-accent, #fff);
  padding: 8px 14px; border-radius: var(--r-sm);
  font-size: .85rem; font-weight: 600; text-decoration: none;
  transform: translateY(-160%); transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.site-footer {
  max-width: var(--page-max); width: 100%; margin: 0 auto;
  padding: var(--s5) var(--s6) var(--s6);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  font-size: .78rem; color: var(--faint);
  border-top: 1px solid var(--line);
}
.site-footer a, .site-footer .linkish {
  color: var(--muted); text-decoration: none;
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
}
.site-footer a:hover, .site-footer .linkish:hover { color: var(--ink-dim); text-decoration: underline; }
.site-footer .sep { color: var(--line-2); }

@media (max-width: 1000px) {
  .site-footer { padding: var(--s5) var(--s5) calc(var(--s8) + 40px); }
}

/* commitment skips on the Week screen */
.wk-skips { font-size: .82rem; color: var(--muted); margin: var(--s3) 0 0; }
.wk-skip { white-space: nowrap; }
button.linkish {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent); text-decoration: underline;
}
button.linkish:hover { color: var(--accent-hi); }

/* =========================================================================
   Streak Psychology — consistency card + evolving companion
   Navy on paper, editorial, minimal. The companion is pure geometry; it glows
   a little more at each level. Motion is opt-in (prefers-reduced-motion).
   ========================================================================= */
.streak-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--accent-dim), transparent 62%);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  box-shadow: 0 14px 34px -20px color-mix(in srgb, var(--accent) 34%, transparent);
}

.streak-head { display: flex; flex-direction: column; gap: var(--s1); }
.streak-count { display: flex; align-items: baseline; gap: var(--s2); }
.streak-n {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2.4rem, 6vw, 3.1rem); line-height: 1; letter-spacing: -.02em;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.streak-unit { font-size: .95rem; color: var(--muted); }
.streak-msg { margin: var(--s1) 0 0; color: var(--ink-dim); font-size: .92rem; max-width: 46ch; }

/* --- 7-day activity strip --- */
.streak-strip { display: flex; gap: var(--s2); margin: var(--s4) 0 0; flex-wrap: wrap; }
.streak-day {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  min-width: 30px;
}
.streak-dot {
  width: 12px; height: 12px; border-radius: var(--r-full);
  border: 1.5px solid var(--line-2); background: var(--surface-2);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.streak-day.on .streak-dot {
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.streak-day.today .streak-dot { transform: scale(1.15); }
.streak-day.today.on .streak-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.streak-dl {
  font-size: .62rem; font-weight: 600; letter-spacing: .04em;
  color: var(--faint); text-transform: uppercase;
}
.streak-day.on .streak-dl { color: var(--muted); }

/* --- companion + progression --- */
.streak-body {
  display: flex; align-items: center; gap: var(--s5);
  margin-top: var(--s5); padding-top: var(--s5);
  border-top: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
}
.streak-companion { flex: none; display: grid; place-items: center; }
.streak-progress { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.streak-level {
  font-family: var(--font-display); font-weight: 500; font-size: 1.3rem;
  letter-spacing: -.01em; color: var(--ink);
}
.streak-level-sub { font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); }
.streak-track { margin: var(--s3) 0 var(--s1); }
.streak-track > i {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, white), var(--accent));
}
.streak-xp { font-size: .8rem; }
.streak-next { font-size: .78rem; color: var(--muted); margin-top: var(--s2); }

.streak-lvl-list { margin-top: var(--s2); }
.streak-lvl-list li.streak-lvl-now { color: var(--accent); font-weight: 600; }
.streak-lvl-list li.streak-lvl-done { color: var(--faint); }
.streak-lvl-tag { font-weight: 400; font-style: italic; }

@media (max-width: 560px) {
  .streak-body { flex-direction: column; align-items: flex-start; gap: var(--s4); text-align: left; }
  .streak-companion { align-self: center; }
}

/* --- the companion itself --- */
.companion { display: block; color: var(--accent); overflow: visible; }
.companion .comp-stroke { stroke: currentColor; fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.companion .comp-stroke.faint { opacity: .3; }
.companion .comp-stroke.dim { opacity: .16; stroke-width: 1.1; }
.companion .comp-stroke.ray { opacity: .45; stroke-width: 1.1; }
.companion .comp-fill { fill: currentColor; stroke: none; }
.companion .comp-fill.core { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 55%, transparent)); }
.companion .comp-halo { fill: currentColor; fill-opacity: .06; stroke: none; }
.companion .comp-halo.soft { fill-opacity: .04; }
.companion .comp-orbit { transform-origin: 60px 60px; }
.companion .comp-core { transform-origin: 60px 60px; }
.companion-l5 { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 22%, transparent)); }
.companion-l6 { filter: drop-shadow(0 0 12px color-mix(in srgb, var(--accent) 28%, transparent)); }
.companion-l7 { filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 34%, transparent)); }

@media (prefers-reduced-motion: no-preference) {
  .companion .comp-orbit { animation: comp-rotate 120s linear infinite; }
  .companion-l6 .comp-orbit { animation-duration: 90s; }
  .companion-l7 .comp-orbit { animation-duration: 70s; }
  .companion .comp-core { animation: comp-breathe 5s ease-in-out infinite; }
}
@keyframes comp-rotate { to { transform: rotate(360deg); } }
@keyframes comp-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* --- celebration (only fired client-side on a visible increase) --- */
.streak-n.streak-pop { animation: streak-pop .6s var(--ease); }
@keyframes streak-pop { 30% { transform: scale(1.14); } 60% { transform: scale(.98); } }

.streak-flash {
  position: absolute; inset: 0 0 auto 0;
  background: var(--accent); color: var(--on-accent);
  font-size: .82rem; font-weight: 600; text-align: center;
  padding: var(--s2) var(--s4);
  animation: streak-flash-in .4s var(--ease);
}
.streak-flash.out { animation: streak-flash-out .5s var(--ease) forwards; }
@keyframes streak-flash-in { from { transform: translateY(-100%); } }
@keyframes streak-flash-out { to { transform: translateY(-100%); opacity: 0; } }
.streak-card.streak-celebrate {
  box-shadow: 0 0 0 1px var(--accent), 0 18px 44px -18px color-mix(in srgb, var(--accent) 46%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  .streak-flash, .streak-n.streak-pop { animation: none; }
}

/* --- sidebar streak chip --- */
.sidebar-streak {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s3); margin-bottom: var(--s1);
  border-radius: var(--r-sm); text-decoration: none;
  color: var(--muted); font-size: .8rem;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.sidebar-streak:hover { background: var(--surface); color: var(--ink-dim); }
.sidebar-streak-mark { color: var(--accent); font-size: .7rem; }
.sidebar-streak-n { font-weight: 550; color: var(--ink-dim); }
.sidebar-streak-lv { margin-left: auto; font-size: .68rem; color: var(--faint); font-variant-numeric: tabular-nums; }
