/* Perfect Peace — Product Experience V2.
   A restrained design system: calm, spacious, mobile-first, theme-aware.
   Christian identity comes through content and the hub concept, not decoration.
   One accent (cedar), a real type scale, soft elevation, honest empty states. */

/* ---------------------------------------------------------------- tokens */
:root {
  /* Type */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Georgia", "Times New Roman", serif;
  --fs-display: 1.9rem;
  --fs-h1: 1.4rem;
  --fs-h2: 1.12rem;
  --fs-h3: .98rem;
  --fs-body: 1rem;
  --fs-sm: .875rem;
  --fs-xs: .78rem;
  --lh-tight: 1.25;
  --lh: 1.55;

  /* Spacing — 4px base */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Radii */
  --r-sm: 10px; --r: 16px; --r-lg: 22px; --r-pill: 999px;

  /* Layout */
  --maxw: 640px;
  --nav-h: 64px;
  --sidebar-w: 232px;
  --tap: 46px;

  /* Motion */
  --motion-fast: 120ms;
  --motion: 200ms;
  --ease: cubic-bezier(.22, .61, .36, 1);

  /* Light theme (warm paper) */
  --bg: #f4f1ea;
  --surface: #fbfaf6;
  --surface-sunk: #ece8df;
  --text: #22241f;
  --text-dim: #595c54;
  --text-faint: #8a8d82;
  --border: #e3ded2;
  --border-strong: #cfc8b8;
  --accent: #3f6f5f;            /* cedar green */
  --accent-strong: #345d50;
  --accent-soft: #e4ede8;
  --accent-text: #ffffff;
  --accent-ring: #3f6f5f;
  --ok: #3f7355; --ok-soft: #e3eee6;
  --caution: #8a6318; --caution-soft: #f3ead6;
  --danger: #9c3b34; --danger-soft: #f3e1de;
  --info: #3a6478; --info-soft: #e2ecf0;
  --e0: none;
  --e1: 0 1px 2px rgba(40,38,30,.04), 0 4px 14px rgba(40,38,30,.05);
  --e2: 0 6px 20px rgba(40,38,30,.10), 0 2px 6px rgba(40,38,30,.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2025;
    --surface-sunk: #26292f;
    --text: #e8e8e5;
    --text-dim: #a9aca5;
    --text-faint: #767a72;
    --border: #2f333a;
    --border-strong: #3d424a;
    --accent: #6fa896;
    --accent-strong: #7fb6a4;
    --accent-soft: #22322d;
    --accent-text: #0f1c18;
    --accent-ring: #6fa896;
    --ok: #6fae86; --ok-soft: #1e2c24;
    --caution: #d0a45c; --caution-soft: #2f2814;
    --danger: #dd7a72; --danger-soft: #32201e;
    --info: #7aa7bb; --info-soft: #1b2a30;
    --e1: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.22);
    --e2: 0 8px 26px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
  }
}
:root[data-theme="light"] {
  --bg: #f4f1ea; --surface: #fbfaf6; --surface-sunk: #ece8df; --text: #22241f;
  --text-dim: #595c54; --text-faint: #8a8d82; --border: #e3ded2; --border-strong: #cfc8b8;
  --accent: #3f6f5f; --accent-strong: #345d50; --accent-soft: #e4ede8; --accent-text: #ffffff; --accent-ring: #3f6f5f;
  --ok: #3f7355; --ok-soft: #e3eee6; --caution: #8a6318; --caution-soft: #f3ead6;
  --danger: #9c3b34; --danger-soft: #f3e1de; --info: #3a6478; --info-soft: #e2ecf0;
  --e1: 0 1px 2px rgba(40,38,30,.04), 0 4px 14px rgba(40,38,30,.05);
  --e2: 0 6px 20px rgba(40,38,30,.10), 0 2px 6px rgba(40,38,30,.06);
}
:root[data-theme="dark"] {
  --bg: #14161a; --surface: #1d2025; --surface-sunk: #26292f; --text: #e8e8e5;
  --text-dim: #a9aca5; --text-faint: #767a72; --border: #2f333a; --border-strong: #3d424a;
  --accent: #6fa896; --accent-strong: #7fb6a4; --accent-soft: #22322d; --accent-text: #0f1c18; --accent-ring: #6fa896;
  --ok: #6fae86; --ok-soft: #1e2c24; --caution: #d0a45c; --caution-soft: #2f2814;
  --danger: #dd7a72; --danger-soft: #32201e; --info: #7aa7bb; --info-soft: #1b2a30;
  --e1: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.22);
  --e2: 0 8px 26px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: var(--fs-body)/var(--lh) var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .1px; }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
code { background: var(--surface-sunk); padding: 1px 5px; border-radius: 6px; font-size: .85em; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: var(--r-sm); transition: top var(--motion) var(--ease);
}
.skip-link:focus { top: 8px; }

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

/* ---------------------------------------------------------------- header */
.app-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.3) blur(10px);
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s3) var(--s4) var(--s2);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: var(--s3); }
.brand-mark {
  width: 28px; height: 28px; flex: 0 0 auto; display: block;
  color: var(--accent);   /* the wheel uses currentColor, so it stays theme-aware */
}
.app-header h1 { font-size: var(--fs-h3); margin: 0; letter-spacing: .3px; }
.app-header .sub { font-size: var(--fs-xs); color: var(--text-faint); font-weight: 500; font-family: var(--font-body); }
.icon-btn {
  min-width: var(--tap); min-height: var(--tap); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: var(--r-sm);
  font-size: 1.1rem; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform var(--motion-fast) var(--ease), background var(--motion-fast);
}
.icon-btn:active { transform: scale(.95); }

/* ---------------------------------------------------------------- layout shell */
#app { max-width: var(--maxw); margin: 0 auto; padding: var(--s3) var(--s4) calc(var(--nav-h) + var(--s6)); }
#view:focus { outline: none; }

/* Primary nav — bottom bar on mobile, sidebar on desktop */
.mainnav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-top: 1px solid var(--border);
  display: flex; z-index: 30;
}
.mainnav button {
  flex: 1; border: none; background: none; color: var(--text-faint); font-size: var(--fs-xs);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-weight: 550; font-family: var(--font-body); position: relative;
  transition: color var(--motion-fast);
}
.mainnav button .ic { font-size: 1.2rem; line-height: 1; }
.mainnav button.active { color: var(--accent); }
.mainnav button.active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}

@media (min-width: 900px) {
  .layout { display: block; }
  .mainnav {
    top: 0; bottom: 0; right: auto; width: var(--sidebar-w); height: 100vh;
    flex-direction: column; justify-content: flex-start; gap: var(--s1);
    padding: calc(var(--s7) + var(--s2)) var(--s3) var(--s4);
    border-top: none; border-right: 1px solid var(--border); backdrop-filter: none;
    background: var(--surface);
  }
  .mainnav button {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: var(--s3);
    padding: var(--s3) var(--s4); border-radius: var(--r-sm); font-size: var(--fs-sm);
    min-height: var(--tap);
  }
  .mainnav button .ic { font-size: 1.15rem; }
  .mainnav button.active { background: var(--accent-soft); color: var(--accent-strong); }
  .mainnav button.active::before { display: none; }
  #app { margin-left: var(--sidebar-w); padding-top: var(--s5); padding-bottom: var(--s7); }
  .app-header { padding-left: calc(var(--sidebar-w) + var(--s4)); }
}

/* ---------------------------------------------------------------- typography helpers */
.page-head { margin: var(--s2) 0 var(--s5); }
.page-head h1 { font-size: var(--fs-display); line-height: var(--lh-tight); margin: 0 0 var(--s2); }
.page-head .lead { color: var(--text-dim); font-size: var(--fs-body); margin: 0; }
.page-head .eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 1px; color: var(--accent); font-weight: 650; margin-bottom: var(--s2); }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: var(--fs-sm); }
.section-title {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .8px; color: var(--text-faint);
  margin: var(--s5) 2px var(--s2); font-weight: 650;
}
.stack > * + * { margin-top: var(--s3); }
.center { text-align: center; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: var(--s4); margin: var(--s3) 0; box-shadow: var(--e1);
}
.card.card--flat { box-shadow: var(--e0); background: transparent; border-color: var(--border); }
.card.card--sunk { box-shadow: var(--e0); background: var(--surface-sunk); border-color: transparent; }
.card.card--accent { background: var(--accent-soft); border-color: transparent; }
.card h2 { font-size: var(--fs-h2); margin: 0 0 var(--s3); font-weight: 600; line-height: var(--lh-tight); }
.card h3 { font-size: var(--fs-h3); margin: 0 0 var(--s2); }
.card > p { color: var(--text-dim); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.card-head h2 { margin-bottom: 0; }

/* Recommendation card (plan-draft review) — spaced and grouped so it doesn't read as one dense block */
.draft-rec .chip-row { margin-bottom: var(--s2); }
.draft-rec .rec-title { font-size: var(--fs-h3); font-weight: 650; line-height: var(--lh-tight); margin: var(--s2) 0 var(--s1); }
.draft-rec .rec-detail { color: var(--text); margin: var(--s1) 0 0; line-height: 1.55; }
.draft-rec .rec-meta { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--border); display: grid; gap: var(--s2); }
.draft-rec .rec-meta p { margin: 0; color: var(--text-dim); line-height: 1.5; font-size: var(--fs-sm); }
.draft-rec .rec-meta strong { color: var(--text); font-weight: 600; }
.draft-rec .rec-evnote { margin: var(--s3) 0 0; }
.draft-rec .evidence { margin-top: var(--s2); }
.draft-rec .rec-usernote { margin-top: var(--s2); }
.draft-rec .rec-actions { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--border); }

/* Ready-to-use handoff prompt on the "Prepare for a plan" screen */
.handoff-prompt {
  width: 100%; box-sizing: border-box; resize: vertical;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: var(--fs-sm); line-height: 1.45; color: var(--text);
  background: var(--surface-sunk); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: var(--s3);
}

/* Hero card — the single most important surface on a screen */
.hero {
  background: linear-gradient(155deg, var(--accent-soft), color-mix(in srgb, var(--surface) 70%, var(--accent-soft)));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: var(--r-lg); padding: var(--s5); margin: var(--s3) 0; box-shadow: var(--e1);
}
.hero .eyebrow { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 1px; color: var(--accent-strong); font-weight: 650; }
.hero h2 { font-size: var(--fs-h1); margin: var(--s2) 0 var(--s2); }
.hero p { color: var(--text-dim); }

/* ---------------------------------------------------------------- buttons */
button { font-family: inherit; }
.btn {
  min-height: var(--tap); padding: 0 18px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; gap: 7px; font-family: var(--font-body);
  transition: transform var(--motion-fast) var(--ease), background var(--motion-fast), border-color var(--motion-fast);
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-sunk); }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: var(--fs-body); padding: 0 22px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-xs); }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
.btn-row.wrap > .btn { flex: 0 1 auto; }

/* ---------------------------------------------------------------- chips */
.chip {
  font-size: var(--fs-xs); padding: 3px 10px; border-radius: var(--r-pill); background: var(--surface-sunk);
  color: var(--text-dim); border: 1px solid transparent; display: inline-flex; align-items: center; gap: 4px;
  font-weight: 550; white-space: nowrap;
}
.chip.cat { color: var(--text); background: transparent; border-color: var(--border-strong); }
.chip.chip--posture { background: var(--accent-soft); color: var(--accent-strong); }
.chip.chip--form { background: var(--surface-sunk); color: var(--text-dim); }
.chip.chip--spiritual { background: var(--info-soft); color: var(--info); }
.chip.chip--muted { background: transparent; color: var(--text-faint); border-color: var(--border); }
.chip.warn, .chip.chip--caution { background: var(--caution-soft); color: var(--caution); }
.chip.review { background: var(--caution-soft); color: var(--caution); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- callouts / notices */
.callout, .notice {
  border-radius: var(--r-sm); padding: var(--s3) var(--s4); font-size: var(--fs-sm); margin: var(--s3) 0;
  border: 1px solid transparent; line-height: var(--lh);
}
.callout.info, .notice.info { background: var(--info-soft); color: var(--info); }
.callout.caution, .notice.warn { background: var(--caution-soft); color: var(--caution); }
.callout.danger, .notice.danger { background: var(--danger-soft); color: var(--danger); }
.callout.quiet { background: var(--surface-sunk); color: var(--text-dim); }
.callout.accent { background: var(--accent-soft); color: var(--accent-strong); }
.callout strong, .notice strong { font-weight: 700; }
.callout ul, .notice ul { margin: var(--s1) 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- segmented control */
.segmented {
  display: inline-flex; background: var(--surface-sunk); border-radius: var(--r-pill); padding: 3px;
  gap: 2px; width: 100%; margin: var(--s2) 0 var(--s4);
}
.segmented button {
  flex: 1; border: none; background: transparent; color: var(--text-dim); cursor: pointer;
  padding: 9px 12px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 600;
  font-family: var(--font-body); transition: background var(--motion-fast), color var(--motion-fast);
  min-height: 40px;
}
.segmented button.active { background: var(--surface); color: var(--accent-strong); box-shadow: var(--e1); }

/* ---------------------------------------------------------------- daily flow rail (Today's rhythm) */
/* A calm, at-a-glance overview of the five movements of the day. Communicates "where am I" and what
   is done vs. later — never a percentage, streak, or pressure. Fits comfortably at 320px. */
.flow-rail { display: flex; list-style: none; margin: var(--s3) 0 var(--s5); padding: 0; }
.flow-rail li {
  flex: 1 1 0; min-width: 0; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center;
}
/* Connector line to the previous movement, filled once this movement has been reached. */
.flow-rail li::before {
  content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.flow-rail li:first-child::before { display: none; }
.flow-rail li.done::before, .flow-rail li.current::before, .flow-rail li.active::before { background: var(--accent); }
.flow-rail .mark {
  position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .74rem; font-weight: 700; line-height: 1;
  background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-faint);
}
.flow-rail .lbl { font-size: .62rem; font-weight: 600; color: var(--text-faint); line-height: 1.15; letter-spacing: .1px; }
.flow-rail li.done .mark { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.flow-rail li.done .lbl { color: var(--text-dim); }
.flow-rail li.active .mark { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.flow-rail li.active .lbl { color: var(--text-dim); }
.flow-rail li.current .mark { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.flow-rail li.current .lbl { color: var(--accent-strong); font-weight: 700; }

/* a completed stage collapsed into a quiet, revisitable summary row */
.stage-done-head { display: flex; align-items: center; gap: var(--s3); }
.stage-done-head .grow { flex: 1; min-width: 0; }
.stage-check {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: .8rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-strong);
}
.attention-list { margin: var(--s2) 0; }

/* progress (step completion — never a worth/life score) */
.progress { margin: var(--s2) 0 var(--s4); }
.progress-track { height: 6px; background: var(--surface-sunk); border-radius: var(--r-pill); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: var(--r-pill); transition: width var(--motion) var(--ease); }
.progress .faint { margin-top: 5px; }

/* ---------------------------------------------------------------- forms */
label.field { display: block; margin: var(--s3) 0; }
label.field > span { display: block; font-size: var(--fs-sm); color: var(--text-dim); margin-bottom: 5px; font-weight: 600; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 11px 13px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
textarea { min-height: 92px; resize: vertical; line-height: var(--lh); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-ring); outline-offset: 1px; border-color: var(--accent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.checkbox-row { display: flex; align-items: center; gap: var(--s3); margin: var(--s3) 0; }
.checkbox-row input { width: 22px; height: 22px; min-height: 22px; flex: 0 0 auto; }

/* ---------------------------------------------------------------- selectable option rows (Start Here focus, etc.) */
.option {
  display: flex; align-items: center; gap: var(--s3); width: 100%; text-align: left;
  padding: 13px 15px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); cursor: pointer; margin-bottom: var(--s2);
  font-size: var(--fs-sm); font-weight: 550; font-family: var(--font-body); min-height: var(--tap);
  transition: border-color var(--motion-fast), background var(--motion-fast);
}
.option:hover { border-color: var(--accent); }
.option.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; }
.option .tick { width: 18px; flex: 0 0 auto; color: var(--accent); }

/* ---------------------------------------------------------------- onboarding review (skipped / doesn't-apply) */
/* Calm, non-error treatment: a skipped row is gently set off so it's noticeable while scrolling; a
   doesn't-apply row keeps its own distinct badge. Both read clearly in light and dark themes. */
.q-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.q-review .q-prompt { display: block; font-size: var(--fs-sm); color: var(--text-dim); font-weight: 600; margin-bottom: 5px; }
.q-badge { flex: 0 0 auto; font-size: var(--fs-xs); font-weight: 650; padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.q-badge.skipped { background: var(--surface-sunk); color: var(--text-dim); }
.q-badge.na { background: transparent; color: var(--text-faint); border: 1px dashed var(--border-strong); }
.q-skipped {
  border-left: 3px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface-sunk) 45%, transparent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 10px 12px; margin-left: -2px;
}

/* A calm threshold paragraph above "Begin onboarding" — not a warning, quote, or marketing line.
   Comfortable spacing and line-height so it reads slowly on a phone. */
.reflective-threshold {
  color: var(--text-dim);
  font-size: var(--fs-body);
  line-height: 1.7;
  margin: var(--s4) 0 var(--s2);
}

/* ---------------------------------------------------------------- timer / capture */
.timer-card { text-align: center; }
.timer-elapsed { font-size: 3rem; font-weight: 300; font-variant-numeric: tabular-nums; letter-spacing: 1px; margin: var(--s2) 0; }
.timer-activity { font-weight: 600; font-size: var(--fs-h2); font-family: var(--font-display); }
.timer-meta { color: var(--text-dim); font-size: var(--fs-sm); margin-bottom: var(--s3); }
.timer-warn { color: var(--caution); font-size: var(--fs-sm); margin-top: var(--s2); }
.pulse { display:inline-block; width:9px; height:9px; border-radius:50%; background: var(--accent); margin-right:6px; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { opacity:1 } 50% { opacity:.3 } }

.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.qa-btn {
  min-height: 66px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface-sunk);
  color: var(--text); cursor: pointer; padding: 8px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; font-size: var(--fs-xs); font-weight: 600; text-align: center; line-height: 1.15;
  transition: transform var(--motion-fast) var(--ease), border-color var(--motion-fast);
}
.qa-btn:hover { border-color: var(--accent); }
.qa-btn .dot { width: 8px; height: 8px; border-radius: 50%; }
.qa-btn small { color: var(--text-faint); font-size: .66rem; font-weight: 500; }
.qa-btn:active { transform: scale(.97); }

/* ---------------------------------------------------------------- timeline */
.day-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin: var(--s2) 0 var(--s3); }
.day-nav .date { font-weight: 600; font-size: var(--fs-h3); text-align: center; flex: 1; font-family: var(--font-display); }
.entry {
  display: flex; gap: var(--s3); padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); margin: 7px 0; cursor: pointer; align-items: flex-start;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}
.entry:hover { border-color: var(--border-strong); }
.entry:active { background: var(--surface-sunk); }
.entry .bar { width: 4px; align-self: stretch; border-radius: 3px; background: var(--accent); flex: 0 0 4px; }
.entry .body { flex: 1; min-width: 0; }
.entry .time { font-size: var(--fs-xs); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.entry .name { font-weight: 600; margin: 1px 0; overflow-wrap: anywhere; }
.entry .chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.entry .dur { font-size: var(--fs-sm); color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 1px; }
.gap-row {
  display: flex; align-items: center; gap: var(--s2); margin: 5px 4px; padding: 7px 12px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-sm); color: var(--text-faint);
  font-size: var(--fs-sm); background: transparent; cursor: pointer;
}
.gap-row .g-fill { margin-left: auto; color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- data viz */
.assump { background: var(--caution-soft); color: var(--caution); border-radius: var(--r-sm); padding: 9px 12px; font-size: var(--fs-sm); margin: var(--s2) 0; }
.assump ul { margin: 4px 0 0; padding-left: 18px; }
.label-tag { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 1px 6px; border-radius: 5px; }
.label-suggested { background: var(--accent-soft); color: var(--accent-strong); }
.label-assumption { background: var(--caution-soft); color: var(--caution); }
.label-uncertain { background: var(--danger-soft); color: var(--danger); }
.label-confirmed { background: var(--surface-sunk); color: var(--text-dim); }

.bar-row { display: flex; align-items: center; gap: var(--s2); margin: 7px 0; font-size: var(--fs-sm); }
.bar-row .lbl { flex: 0 0 38%; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 16px; background: var(--surface-sunk); border-radius: 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 8px; transition: width var(--motion) var(--ease); }
.bar-row .val { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--text-dim); min-width: 52px; text-align: right; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: var(--s2) 0; }
.stat { background: var(--surface-sunk); border-radius: var(--r-sm); padding: 12px; }
.stat .n { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--font-display); }
.stat .k { font-size: var(--fs-xs); color: var(--text-dim); }
.obs { list-style: none; padding: 0; margin: var(--s2) 0; }
.obs li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-dim); }
.obs li:last-child { border-bottom: none; }

.week-day { display: flex; align-items: center; gap: var(--s2); margin: 6px 0; }
.week-day .wd { flex: 0 0 46px; font-size: var(--fs-xs); color: var(--text-dim); }
.week-stack { flex: 1; height: 20px; background: var(--surface-sunk); border-radius: 6px; display: flex; overflow: hidden; }
.week-stack span { height: 100%; }

/* ---------------------------------------------------------------- wagon wheel */
.wheel-wrap { display: flex; justify-content: center; padding: var(--s2) 0 var(--s4); }
.wheel { width: 100%; max-width: 340px; height: auto; }
.wheel .spoke-label { font-size: 9px; font-family: var(--font-body); fill: var(--text-dim); }
.wheel .hub-label { font-size: 11px; font-family: var(--font-display); fill: var(--accent-strong); font-weight: 600; }
.area-list { display: flex; flex-direction: column; gap: var(--s2); }
.area-row {
  display: flex; align-items: center; gap: var(--s3); padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); cursor: pointer; text-align: left; width: 100%;
  font-family: var(--font-body); color: var(--text); transition: border-color var(--motion-fast);
}
.area-row:hover { border-color: var(--border-strong); }
.area-row .swatch { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.area-row .grow { flex: 1; min-width: 0; }
.area-row .a-name { font-weight: 600; display: block; }
.area-row .a-state { font-size: var(--fs-xs); color: var(--text-faint); display: block; margin-top: 2px; }
.area-row .a-state:empty { display: none; }
.state-tag { font-size: var(--fs-xs); font-weight: 600; padding: 3px 10px; border-radius: var(--r-pill); white-space: nowrap; }
.state-emphasis { background: var(--accent-soft); color: var(--accent-strong); }
.state-protected { background: var(--ok-soft); color: var(--ok); }
.state-attention { background: var(--caution-soft); color: var(--caution); }
.state-postponed { background: var(--surface-sunk); color: var(--text-dim); }
.state-reflected { background: var(--info-soft); color: var(--info); }
.state-lighter { background: var(--surface-sunk); color: var(--text-dim); }
.state-limited { background: transparent; color: var(--text-faint); border: 1px dashed var(--border-strong); }
.state-tag.state-provisional { background: transparent; border: 1px dashed currentColor; }

/* ---------------------------------------------------------------- empty states */
.empty, .empty-state { text-align: center; color: var(--text-faint); padding: var(--s6) var(--s4); }
.empty .icon, .empty-state .big { font-size: 2rem; margin-bottom: var(--s2); opacity: .8; }
.empty h3 { color: var(--text-dim); font-size: var(--fs-h3); margin: 0 0 var(--s2); }
.empty p { color: var(--text-faint); font-size: var(--fs-sm); margin: 0 auto var(--s3); max-width: 34ch; }
.empty .btn { margin-top: var(--s1); }

/* ---------------------------------------------------------------- lists */
.list-item { display: flex; align-items: center; gap: var(--s3); padding: 11px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; }

/* evidence progressive disclosure */
details.evidence { margin-top: var(--s2); border-top: 1px solid var(--border); padding-top: var(--s2); }
details.evidence > summary {
  cursor: pointer; color: var(--accent); font-size: var(--fs-sm); font-weight: 600; list-style: none;
  display: flex; align-items: center; gap: 6px;
}
details.evidence > summary::-webkit-details-marker { display: none; }
details.evidence > summary::before { content: "›"; transition: transform var(--motion-fast); display: inline-block; }
details.evidence[open] > summary::before { transform: rotate(90deg); }
details.evidence .ev-body { margin-top: var(--s2); }
.ev-cat { margin: var(--s2) 0; }

/* ---------------------------------------------------------------- modal / sheet */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(20,18,14,.45); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity var(--motion-fast);
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
  background: var(--surface); width: 100%; max-width: var(--maxw); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: var(--s2) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom, 0)); max-height: 92vh; overflow-y: auto;
  transform: translateY(24px); transition: transform var(--motion) var(--ease); box-shadow: var(--e2);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet .grabber { width: 40px; height: 4px; border-radius: 3px; background: var(--border-strong); margin: var(--s2) auto var(--s3); }
.sheet h2 { margin: var(--s1) 0 var(--s3); font-size: var(--fs-h1); }
@media (min-width: 900px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: var(--r-lg); max-width: 560px; margin: 0 var(--s4); }
}

/* ---------------------------------------------------------------- toast + banner */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: var(--r-pill); font-size: var(--fs-sm);
  z-index: 60; opacity: 0; transition: opacity var(--motion), transform var(--motion); pointer-events: none; max-width: 90%;
  box-shadow: var(--e2);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
@media (min-width: 900px) { #toast { bottom: 24px; left: calc(50% + var(--sidebar-w) / 2); } }

.storage-banner {
  background: var(--danger-soft); color: var(--danger); font-size: var(--fs-sm); font-weight: 600;
  line-height: 1.4; padding: 10px 14px; text-align: center; border-bottom: 1px solid var(--danger);
}

/* ---------------------------------------------------------------- utility */
.hidden { display: none !important; }
.spacer { height: var(--s2); }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .btn:active, .icon-btn:active, .qa-btn:active { transform: none; }
}
