/* ============================================================================
   Opus — design system. Dark-first, modern-minimal SaaS with real depth.
   Accent is a warm orange gradient, reserved for the live/now and primary action.
   ========================================================================== */

@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Geist Mono retired — numbers/dates now use the body font (--mono aliases --sans). */

/* ----------------------------------------------------------------------------
   Theme. LIGHT is the default (:root); DARK overrides under [data-theme="dark"].
   Both palettes share the warm-orange accent + green/amber/red status colors.
   Only the tokens below change between themes — every component reads these vars.
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* elevation — warm paper, layered (cards sit lighter, hovers a touch warmer-grey) */
  --bg:        oklch(96.5% 0.005 75);
  --surface-1: oklch(98.4% 0.004 75);
  --surface-2: oklch(99.6% 0.002 75);
  --surface-3: oklch(93.6% 0.007 75);

  /* hairline borders as warm-black alphas → crisp on light surfaces */
  --border:   rgba(28, 22, 14, .10);
  --border-2: rgba(28, 22, 14, .17);

  /* ink */
  --ink:   oklch(26% 0.012 75);
  --ink-2: oklch(45% 0.012 75);
  --ink-3: oklch(60% 0.012 75);

  /* accent — orange gradient (per brand); -bright is the deep variant for text/icons */
  --accent:        oklch(58% .19 45);
  --accent-2:      oklch(50% .2 35);
  --accent-bright: oklch(52% .2 42);
  --accent-grad:   linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --accent-line:   color-mix(in oklch, var(--accent) 38%, transparent);

  /* status — deepened so they read on near-white */
  --ok:    oklch(52% .14 150);  --ok-soft:   color-mix(in oklch, var(--ok) 13%, transparent);
  --warn:  oklch(58% .12 72);   --warn-soft: color-mix(in oklch, var(--warn) 16%, transparent);
  --bad:   oklch(55% .19 25);   --bad-soft:  color-mix(in oklch, var(--bad) 12%, transparent);

  /* contrasting ink on solid status/accent fills */
  --on-accent: #fff;
  --ok-ink:    #fff;
  --warn-ink:  #fff;
  --bad-ink:   #fff;

  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(28, 22, 14, .07);
  --shadow:    0 4px 18px rgba(28, 22, 14, .09);
  --shadow-lg: 0 24px 60px rgba(28, 22, 14, .20);
  --hi:        inset 0 1px 0 rgba(255, 255, 255, .55); /* top highlight for depth */

  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: var(--sans);   /* numbers/dates use the body font now; .mono keeps tabular-nums */

  --sidebar-w: 244px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg:        oklch(16% 0.006 65);
  --surface-1: oklch(19.5% 0.006 65);
  --surface-2: oklch(22% 0.007 65);
  --surface-3: oklch(26% 0.008 65);

  --border:   rgba(255, 255, 255, .07);
  --border-2: rgba(255, 255, 255, .13);

  --ink:   oklch(96% 0.004 75);
  --ink-2: oklch(72% 0.007 75);
  --ink-3: oklch(54% 0.007 75);

  --accent:        oklch(60% .2 45);
  --accent-2:      oklch(48% .21 35);
  --accent-bright: oklch(72% .18 50);
  --accent-line:   color-mix(in oklch, var(--accent) 42%, transparent);

  --ok:    oklch(76% .15 150);  --ok-soft:   color-mix(in oklch, var(--ok) 16%, transparent);
  --warn:  oklch(80% .14 80);   --warn-soft: color-mix(in oklch, var(--warn) 16%, transparent);
  --bad:   oklch(70% .18 25);   --bad-soft:  color-mix(in oklch, var(--bad) 16%, transparent);

  --ok-ink:   #06130b;
  --warn-ink: #1a1206;
  --bad-ink:  #1c0c08;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 6px 22px rgba(0, 0, 0, .38);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, .55);
  --hi:        inset 0 1px 0 rgba(255, 255, 255, .045);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
strong, b { font-weight: 600; }
.icon { width: 17px; height: 17px; flex-shrink: 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

/* atmosphere — a faint warm glow bleeding from the top-left */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(820px 460px at 8% -8%, color-mix(in oklch, var(--accent) 10%, transparent), transparent 62%),
    radial-gradient(700px 500px at 100% 0%, color-mix(in oklch, var(--accent-2) 6%, transparent), transparent 60%);
}

/* ---- brand mark ---------------------------------------------------------- */
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--accent-grad);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .25);
  flex-shrink: 0;
}
.brand-mark svg { width: 15px; height: 15px; }
.brand-name {
  font-weight: 600; font-size: 16px; letter-spacing: -.02em; color: var(--ink);
}

/* ---- app shell ----------------------------------------------------------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: color-mix(in oklch, var(--surface-1) 70%, transparent);
  backdrop-filter: blur(8px);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.brand-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  position: relative;
  transition: background .14s, color .14s;
}
.nav-item .icon { color: var(--ink-3); transition: color .14s; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:hover .icon { color: var(--ink-2); }
.nav-item.active { background: var(--surface-3); color: var(--accent-bright); }
.nav-item.active .icon { color: var(--accent-bright); }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent-grad);
}
.nav-item .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* collapsible category section */
.nav-section { margin-top: 2px; }
.nav-section > summary { list-style: none; cursor: pointer; }
.nav-section > summary::-webkit-details-marker { display: none; }
.nav-summary .nav-chev {
  margin-left: auto; width: 15px; height: 15px; color: var(--ink-3);
  transform: rotate(90deg); transition: transform .16s;
}
.nav-section[open] > .nav-summary .nav-chev { transform: rotate(-90deg); }
.nav-children { display: flex; flex-direction: column; gap: 1px; margin: 3px 0 2px; padding-left: 6px; }

/* a category is a collapsible node listing its projects */
.nav-cat > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 7px; padding: 6px 8px;
  border-radius: var(--radius-sm); color: var(--ink-2); font-size: 13px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-cat > summary::-webkit-details-marker { display: none; }
.nav-cat > summary:hover { background: var(--surface-2); color: var(--ink); }
.nav-cat > summary .nav-chev { width: 14px; height: 14px; color: var(--ink-3); flex-shrink: 0; transition: transform .16s; }
.nav-cat[open] > summary .nav-chev { transform: rotate(90deg); }
.nav-cat .nav-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); flex-shrink: 0; }
.nav-child-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav-cat .count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

.nav-projects { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 3px; padding-left: 15px; position: relative; }
.nav-projects::before { content: ''; position: absolute; left: 15px; top: 3px; bottom: 3px; width: 1px; background: var(--border); }
.nav-proj {
  display: block; padding: 5px 9px 5px 13px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 12.5px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-proj:hover { background: var(--surface-2); color: var(--ink); }
.nav-proj.active { background: var(--surface-3); color: var(--accent-bright); font-weight: 600; }
.nav-empty { padding: 5px 10px 5px 12px; font-size: 12px; color: var(--ink-3); }

/* category chip */
.cat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500;
  color: var(--ink-2); background: var(--surface-3); border: 1px solid var(--border);
  vertical-align: middle; transition: background .12s, color .12s;
}
.cat-chip .cat-ico { width: 11px; height: 11px; color: var(--ink-3); }
a.cat-chip:hover { color: var(--ink); background: var(--surface-2); }
.row-id h3 .cat-chip { margin-left: 8px; font-weight: 500; }
.eyebrow-row { display: flex; align-items: center; gap: 10px; }

.ul { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.ul:hover { color: var(--ink); }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.who { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: var(--radius-sm); }
.who-meta { line-height: 1.25; min-width: 0; }
.who-meta b { font-size: 13px; display: block; }
.who-meta small { color: var(--ink-3); font-size: 11px; }
.who-out { margin-left: auto; }
.icon-btn {
  display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: var(--radius-sm); color: var(--ink-3); transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

/* ---- avatars ------------------------------------------------------------- */
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff;
  background: var(--av, #6b6b73);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), var(--shadow-sm);
  flex-shrink: 0;
}
.stack { display: flex; }
.stack .avatar { width: 24px; height: 24px; margin-left: -7px; box-shadow: 0 0 0 2px var(--bg), inset 0 1px 0 rgba(255,255,255,.2); }
.stack .avatar:first-child { margin-left: 0; }

/* ---- topbar -------------------------------------------------------------- */
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 26px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
}
.topbar .spacer { flex: 1; }
.crumb { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.01em; }
.crumb .sep { color: var(--ink-3); font-weight: 400; }
.crumb .dim { color: var(--ink-3); font-weight: 500; }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-weight: 500; font-size: 13px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--ink);
  box-shadow: var(--hi);
  transition: background .14s, border-color .14s, transform .04s;
}
.btn .icon { width: 15px; height: 15px; color: var(--ink-2); }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(.5px); }
.btn-primary {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary .icon { color: #fff; }
.btn-primary:hover { filter: brightness(1.07); background: var(--accent-grad); }
.btn-ghost {
  padding: 7px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  color: var(--ink-2); border: 1px solid transparent; transition: background .14s, color .14s;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-done { background: var(--ok); border-color: transparent; color: var(--ok-ink); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-done .icon { color: var(--ok-ink); }
/* stay green on hover (don't fall back to the grey .btn:hover) — lift + brighten instead */
.btn-done:hover { background: var(--ok); filter: brightness(1.06); transform: translateY(-1px); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-done:active { transform: translateY(0); filter: brightness(.97); }

/* ---- status pills -------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill.ontrack { background: var(--ok-soft);   color: var(--ok); }   .pill.ontrack .dot { background: var(--ok); }
.pill.done    { background: var(--ok-soft);   color: var(--ok); }   .pill.done .dot { background: var(--ok); }
.pill.risk    { background: var(--warn-soft); color: var(--warn); } .pill.risk .dot { background: var(--warn); }
.pill.blocked { background: var(--bad-soft);  color: var(--bad); }  .pill.blocked .dot { background: var(--bad); }
.pill.upcoming{ background: var(--surface-3); color: var(--ink-3); }.pill.upcoming .dot { background: var(--ink-3); }
.archived-pill { background: var(--surface-3); color: var(--ink-3); }
.archived-pill .icon { width: 13px; height: 13px; }
/* "N archived" affordance in the overview page-head */
.archived-link { display: inline-flex; align-items: center; gap: 4px; }
.archived-link .icon { width: 13px; height: 13px; }

/* ---- content & headings -------------------------------------------------- */
.content { padding: 22px 26px 28px; }                 /* edge-to-edge: no max-width cap */
.content.narrow { max-width: 760px; }                  /* opt-in for forms */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.page-head p { color: var(--ink-2); margin-top: 3px; }

.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--hi);
}

/* ---- empty state --------------------------------------------------------- */
.empty {
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
  background: color-mix(in oklch, var(--surface-1) 50%, transparent);
  padding: 56px 28px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-mark {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-3);
  box-shadow: var(--hi); margin-bottom: 6px;
}
.empty-mark .icon { width: 24px; height: 24px; }
.empty h2 { font-size: 16px; font-weight: 600; }
.empty p { max-width: 46ch; }
.empty .btn { margin-top: 12px; }

/* ---- login --------------------------------------------------------------- */
.login-page { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 372px; padding: 32px 30px; }
.login-card .brand-row { padding: 0 0 18px; gap: 11px; }
.login-card h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.login-card .lead { color: var(--ink-3); font-size: 12.5px; margin: 3px 0 22px; }
.field { display: block; margin-bottom: 14px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.field input {
  width: 100%; margin-top: 7px; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-size: 13.5px;
  transition: border-color .14s, box-shadow .14s;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 26%, transparent);
}
.login-card .btn-primary { width: 100%; justify-content: center; padding: 10px; margin-top: 4px; }
.alert { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.gate-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink-3); font-size: 11.5px; margin-top: 18px; }
.gate-note .icon { width: 13px; height: 13px; }

/* ---- overview rows ------------------------------------------------------- */
.rows { overflow: hidden; margin-top: 4px; }
.row {
  display: flex; align-items: center; gap: 20px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  transition: background .14s;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--surface-3); }
.row-id { width: 258px; flex-shrink: 0; }
.row-id h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.row-id p { color: var(--ink-2); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dim { color: var(--ink-3); }
.row-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.row-owners .avatar { width: 22px; height: 22px; font-size: 10px; }
.mini-score { display: flex; gap: 3px; height: 5px; max-width: 260px; }
.mini-seg { flex: 1; border-radius: 3px; background: var(--surface-3); }
.mini-seg.g { background: var(--ok); }
.mini-hint { font-size: 11px; color: var(--ink-3); }
.row-status { width: 132px; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.row-meta { font-size: 11px; color: var(--ink-3); }
.row .chev { color: var(--ink-3); width: 16px; height: 16px; flex-shrink: 0; }

/* ---- project detail header ----------------------------------------------- */
.detail-head { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.detail-id { flex: 1; min-width: 0; }
.detail-id h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; }
.detail-id p { margin-top: 5px; max-width: 62ch; }
.detail-aside { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.progress .plab { font-size: 11px; color: var(--ink-3); margin-bottom: 6px; text-align: right; }
.progress .plab b { color: var(--ok); font-weight: 600; }
.pips { display: flex; gap: 4px; justify-content: flex-end; }
.pip { width: 28px; height: 6px; border-radius: 3px; background: var(--surface-3); transition: background .4s ease; }
.pip.filled { background: var(--ok); }
.pip.ghost { background: transparent; border: 1px dashed var(--border-2); }

.crumb a { transition: color .14s; }
.crumb a:hover { color: var(--ink); }

/* ---- tabs ---------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 13px; font-weight: 500; font-size: 13.5px; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .14s, border-color .14s;
}
.tab .icon { width: 15px; height: 15px; }
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---- status menu (details/summary popover) ------------------------------- */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; user-select: none; }
.menu > summary::-webkit-details-marker { display: none; }
.pill.as-button { padding-right: 7px; }
.pill.as-button .chev { width: 13px; height: 13px; opacity: .7; margin-left: 1px; transform: rotate(90deg); transition: transform .15s; }
.menu[open] > summary .chev { transform: rotate(-90deg); }
.menu-list {
  /* fixed → renders in viewport coords, escaping the phase-strip's overflow clip;
     JS (layout.php) positions it under its summary on open, flipping up near the edge. */
  position: fixed; z-index: 50; right: auto; top: auto;
  padding: 6px; display: flex; flex-direction: column; gap: 2px; min-width: 178px;
  box-shadow: var(--shadow-lg);
}
.menu-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); width: 100%; text-align: left; transition: background .12s; }
.menu-opt:hover { background: var(--surface-3); }
.menu-opt .menu-tick { margin-left: auto; width: 14px; height: 14px; color: var(--ink-2); }

/* ---- forms (new project) ------------------------------------------------- */
.form-wrap { max-width: 600px; }
.form { padding: 22px 22px 18px; margin-top: 6px; }
.form .field { margin-bottom: 18px; }
.field-note { font-weight: 400; color: var(--ink-3); font-size: 12px; margin: 2px 0 0; }
.seg-ctl { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.seg-opt { cursor: pointer; }
.seg-opt input { position: absolute; width: 0; height: 0; opacity: 0; }
.seg-opt .pill { border: 1px solid transparent; opacity: .5; transition: opacity .14s, box-shadow .14s; }
.seg-opt input:checked + .pill { opacity: 1; box-shadow: 0 0 0 2px var(--accent-line); }
.seg-opt input:focus-visible + .pill { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.member-pick { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.member-opt {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
  transition: border-color .14s, background .14s;
}
.member-opt input { position: absolute; width: 0; height: 0; opacity: 0; }
.member-opt .avatar { width: 24px; height: 24px; font-size: 10px; }
.member-opt .member-name { flex: 1; font-size: 13.5px; }
.member-check { width: 16px; height: 16px; color: var(--accent-bright); opacity: 0; transition: opacity .14s; }
.member-opt:has(input:checked) { border-color: var(--accent-line); background: var(--surface-3); }
.member-opt:has(input:checked) .member-check { opacity: 1; }
.member-opt.is-self { cursor: default; }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---- small button / textarea / date / grid ------------------------------ */
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-sm .icon { width: 14px; height: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field textarea {
  width: 100%; margin-top: 7px; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font: inherit; font-size: 13.5px; line-height: 1.5; resize: vertical;
}
.field textarea:focus, .field input[type="date"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 26%, transparent);
}
/* date picker chrome follows the active theme via :root color-scheme */

/* ---- sections ------------------------------------------------------------ */
.section { margin-top: 28px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-head h2 { font-size: 13px; font-weight: 600; }
.section-head .rule { flex: 1; height: 1px; background: var(--border); }

/* ---- the score (timeline) ------------------------------------------------ */
.score { position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 24px 20px; background: var(--surface-2); box-shadow: var(--hi); }
.score-axis { position: relative; height: 13px; margin-bottom: 12px; }
.axis-tick { position: absolute; transform: translateX(-50%); font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.track { position: relative; height: 58px; }
.seg {
  position: absolute; top: 0; height: 52px; border-radius: 9px; padding: 9px 11px;
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  transition: box-shadow .4s ease, background .4s ease;
  min-width: 58px;   /* a single-day phase stays readable, not a sliver */
}
.seg .s-title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg .s-title .chk { width: 13px; height: 13px; color: var(--ok); flex-shrink: 0; }
.seg .s-when { font-size: 10px; opacity: .82; }
.seg.done { background: var(--ok-soft); color: var(--ok); }
.seg.current { background: var(--surface-3); color: var(--ink); box-shadow: 0 0 0 1.5px var(--accent), var(--shadow); z-index: 2; }
.seg.future { background: transparent; color: var(--ink-3); border: 1px dashed var(--border-2); }
.seg.drift { background: var(--warn-soft); color: var(--warn); box-shadow: 0 0 0 1.5px var(--warn); z-index: 1; }
.seg-tag { position: absolute; top: 7px; right: 9px; font-size: 9px; background: var(--accent); color: var(--on-accent); padding: 1px 5px; border-radius: 4px; letter-spacing: .04em; }
.seg-tag.drift { background: var(--warn); color: var(--warn-ink); }
.baton { position: absolute; top: -16px; bottom: -8px; width: 0; border-left: 1.5px dashed var(--accent-bright); z-index: 3; }
.baton::before { content: ''; position: absolute; top: -2px; left: -4px; width: 9px; height: 9px; background: var(--accent-bright); transform: rotate(45deg); border-radius: 2px; }
.baton .b-lab { position: absolute; top: -17px; left: 8px; font-size: 10px; color: var(--accent-bright); white-space: nowrap; font-weight: 500; }

/* menu forms + danger + rotated chevrons (phase tools) */
.menu-list form { display: block; }
.menu-opt.danger { color: var(--bad); }
.menu-opt.danger:hover { background: var(--bad-soft); }
.menu-opt .icon { width: 14px; height: 14px; }
.rot-up { transform: rotate(-90deg); }
.rot-down { transform: rotate(90deg); }

/* ---- collapsible folds (score, archive) ---------------------------------- */
.fold { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); box-shadow: var(--hi); overflow: hidden; }
.fold > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary .fold-chev { width: 16px; height: 16px; color: var(--ink-3); transition: transform .18s; }   /* ► closed */
.fold[open] > summary .fold-chev { transform: rotate(90deg); }                                              /* ▼ open */
.fold > summary h2 { font-size: 13px; font-weight: 600; }
.fold > summary .eyebrow { margin-left: auto; }
.fold-body { padding: 4px 14px 16px; }

/* ---- phase strip (horizontal, scrollable) -------------------------------- */
.strip-head { display: flex; align-items: center; gap: 12px; margin: 22px 0 12px; }
.strip-head h2 { font-size: 13px; font-weight: 600; }
.strip-head .rule { flex: 1; height: 1px; background: var(--border); }

.phase-strip {
  display: flex; gap: 14px; align-items: flex-start;
  overflow-x: auto; overflow-y: visible;
  padding: 4px 2px 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.phase-strip::-webkit-scrollbar { height: 9px; }
.phase-strip::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; }

.phase {
  flex: 0 0 340px; width: 340px; scroll-snap-align: start;
  display: flex; flex-direction: column; max-height: 62vh;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); box-shadow: var(--shadow), var(--hi);
  transition: border-color .15s, box-shadow .35s ease, transform .35s ease;
}
.phase.current { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow); }
.phase.upcoming { opacity: .82; }
.phase.is-drift { border-color: color-mix(in oklch, var(--warn) 60%, transparent); }
.phase.is-collapsed { max-height: none; }
.phase.is-collapsed .phase-scroll { display: none; }

.phase-head { display: flex; align-items: center; gap: 9px; padding: 11px 12px 11px 10px; border-bottom: 1px solid var(--border); background: var(--surface-1); border-radius: var(--radius) var(--radius) 0 0; }
/* current phase reads from its accent ring + accent num, not a washed head fill */
.phase.current .phase-head { background: var(--surface-1); }
.phase.is-collapsed .phase-head { border-bottom: none; }
.phase-collapse { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--ink-3); flex-shrink: 0; transition: background .12s, color .12s; }
.phase-collapse:hover { background: var(--surface-3); color: var(--ink); }
.phase-collapse .icon { width: 15px; height: 15px; transform: rotate(90deg); transition: transform .18s; }   /* ▼ open */
.phase.is-collapsed .phase-collapse .icon { transform: none; }                                              /* ► collapsed */
.phase-num { font-family: var(--mono); font-size: 11px; color: var(--ink-3); flex-shrink: 0; min-width: 16px; }
.phase.current .phase-num { color: var(--accent-bright); }
.phase-num .donecheck { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--ok); }
.phase-num .donecheck .icon { width: 11px; height: 11px; color: var(--ok-ink); }
.phase-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phase-head .icon-btn { width: 28px; height: 28px; flex-shrink: 0; }
.pill.slip { gap: 5px; }
.pill.slip .icon { width: 12px; height: 12px; }

/* meta strip under the head: dates + status, always visible */
.phase-meta { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.phase.is-collapsed .phase-meta { border-bottom: none; }
.phase-when { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.phase-when .icon { width: 13px; height: 13px; color: var(--ink-3); }
.phase-when.is-drift { color: var(--warn); }
.phase-meta .spacer { flex: 1; }

/* the collapsible body: goal + tasks + add */
.phase-scroll { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.phase-goal { padding: 11px 13px; border-bottom: 1px solid var(--border); background: color-mix(in oklch, var(--surface-1) 60%, transparent); }
.phase-goal .lab { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.phase-goal .lab .icon { width: 12px; height: 12px; }
.phase-goal p { font-size: 12.5px; line-height: 1.45; color: var(--ink); }
.phase-goal p .dim { color: var(--ink-3); }

/* ---- tasks (inside a phase card) ----------------------------------------- */
.tasks-head { display: flex; align-items: center; padding: 9px 12px 4px; }
.tasks-lab { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.tasks-lab .icon { width: 12px; height: 12px; }
.tasks-count { background: var(--surface-3); color: var(--ink-2); border-radius: 999px; padding: 0 6px; font-size: 10px; line-height: 16px; }
.task-list { display: flex; flex-direction: column; gap: 1px; padding: 0 6px; }
.task-row { border-radius: var(--radius-sm); transition: background .12s; }
.task-row:hover { background: var(--surface-3); }
.task-main { display: flex; align-items: center; gap: 9px; padding: 6px 8px 6px 6px; }

.task-check {
  width: 19px; height: 19px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--ink-3); color: transparent;
  transition: border-color .14s, background .14s, color .14s, box-shadow .14s;
}
.task-check .task-tick { width: 12px; height: 12px; }
.task-check.doing { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in oklch, var(--accent) 22%, transparent); }
.task-check.done  { border-color: transparent; background: var(--ok); color: var(--ok-ink); }
.task-check:not(.done):hover { border-color: var(--ok); color: color-mix(in oklch, var(--ok) 60%, transparent); }
.task-check.done:hover { filter: brightness(1.07); }

.task-open { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; text-align: left; transition: color .12s; }
.task-title { font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-open:hover .task-title { color: var(--accent-bright); }
.task-row.is-done .task-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }
.task-spacer { flex: 1; }
.task-badges { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.task-cc { display: inline-flex; align-items: center; gap: 3px; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.task-cc .icon { width: 12px; height: 12px; }
.task-av { width: 21px; height: 21px; font-size: 9px; }
.needs-owner {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  font-size: 10.5px; font-weight: 500; color: var(--warn);
  background: var(--warn-soft); padding: 2px 7px 2px 5px; border-radius: 999px;
}
.needs-owner .icon { width: 11px; height: 11px; }
.needs-owner .no-txt { display: none; }   /* compact in the narrow card — icon carries it */

.task-add { display: flex; align-items: center; gap: 5px; margin: 4px 6px 8px; padding: 2px 2px; }
.task-add-btn { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 6px; color: var(--ink-3); flex-shrink: 0; transition: background .12s, color .12s; }
.task-add-btn:hover { background: var(--surface-3); color: var(--accent-bright); }
.task-add-btn .icon { width: 15px; height: 15px; }
.task-add input {
  flex: 1; min-width: 0; padding: 6px 9px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); font-size: 12.5px; transition: background .14s, border-color .14s;
}
.task-add input::placeholder { color: var(--ink-3); }
.task-add input:hover { background: var(--surface-3); }
.task-add input:focus { outline: none; background: var(--bg); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent); }

/* ---- done phase cards ----------------------------------------------------- */
.phase.done { border-color: color-mix(in oklch, var(--ok) 32%, var(--border)); }
.phase.done .phase-head { background: var(--ok-soft); }
.phase.done .phase-num { color: var(--ok); }   /* .donecheck styling is shared with the strip rule above */
.phase.done .phase-title { color: var(--ink-2); }

/* ---- archive (collapsed accordion of done phase cards) -------------------- */
.archive { margin-top: 16px; }
.archive > summary h2 { color: var(--ink-2); }
.archive .arc-count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; margin-left: 2px; }
.archive .fold-body { padding-bottom: 4px; }
.archive .phase-strip { padding-top: 2px; }

/* ---- fly-off when a phase is marked done --------------------------------- */
@keyframes flyoff { to { opacity: 0; transform: translateY(46px) scale(.55); } }
.phase.is-flying { animation: flyoff .42s cubic-bezier(.4, 0, .7, .4) forwards; pointer-events: none; z-index: 4; }

/* ---- modal (subphase detail) --------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 24px;
  background: color-mix(in oklch, var(--bg) 58%, transparent);
  backdrop-filter: blur(6px);
  animation: modal-fade .18s ease both;
}
.modal {
  width: 100%; max-width: 472px; max-height: calc(100vh - 48px); overflow-y: auto;
  padding: 20px 22px 18px; box-shadow: var(--shadow-lg);
  animation: modal-pop .22s cubic-bezier(.2, .7, .3, 1) both;
}
.modal-head { display: flex; align-items: center; margin-bottom: 16px; }
.modal-head .eyebrow { display: flex; align-items: center; gap: 7px; flex: 1; }
.modal-head .eyebrow .icon { width: 13px; height: 13px; }
.field-lab { display: block; margin-bottom: 4px; }
.modal-title-input { font-size: 16px !important; font-weight: 600; margin-top: 0 !important; }
.modal .field { margin-bottom: 16px; }
.modal .seg-ctl { margin-top: 0; }
.pill.task-status { border: 1px solid transparent; }
.pill.task-status.todo  { background: var(--surface-3); color: var(--ink-2); }
.pill.task-status.doing { background: color-mix(in oklch, var(--accent) 13%, transparent); color: var(--accent-bright); }
.pill.task-status.done  { background: var(--ok-soft); color: var(--ok); }
.sub-dot { width: 7px; height: 7px; border-radius: 50%; }
.sub-dot.todo { background: var(--ink-3); } .sub-dot.doing { background: var(--accent-bright); } .sub-dot.done { background: var(--ok); }

.owner-pick { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.owner-opt { cursor: pointer; }
.owner-opt input { position: absolute; width: 0; height: 0; opacity: 0; }
.owner-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px;
  border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; color: var(--ink-2);
  transition: border-color .14s, background .14s, color .14s;
}
.owner-chip .avatar { width: 22px; height: 22px; font-size: 9.5px; }
.owner-opt.owner-none .owner-chip { padding-left: 9px; }
.owner-x { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--ink-3); }
.owner-x .icon { width: 13px; height: 13px; }
.owner-opt:has(input:checked) .owner-chip { border-color: var(--accent-line); background: var(--surface-3); color: var(--ink); }
.owner-opt input:focus-visible + .owner-chip { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

.modal-foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.modal-tools { display: flex; align-items: center; gap: 2px; }
.modal-tools .icon-btn { width: 32px; height: 32px; }
.modal-tools .icon-btn.danger { color: var(--ink-3); }
.modal-tools .icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.modal-foot .spacer { flex: 1; }

@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- error toast (global HTMX failure feedback) -------------------------- */
#toast-root {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: min(92vw, 440px);
  display: flex; align-items: center; gap: 9px;
  background: var(--bad); color: var(--bad-ink);
  padding: 10px 15px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; line-height: 1.4;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .18);
  animation: toast-in .22s cubic-bezier(.2, .7, .3, 1) both;
}
.toast .icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--bad-ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- overview row: current movement + drift ------------------------------ */
.row-mid { gap: 8px; }
.row-cur { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.cur-mark { display: inline-flex; flex-shrink: 0; }
.cur-mark .icon { width: 14px; height: 14px; color: var(--accent-bright); }
.cur-mark.done .icon { color: var(--ok); }
.cur-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cur-when { color: var(--ink-3); font-size: 11.5px; flex-shrink: 0; }
.row-foot { display: flex; align-items: center; gap: 12px; }

/* ---- focus & motion ------------------------------------------------------ */
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* `backwards` (not `both`): covers the staggered nav delay, but drops the forwards-fill
   that would keep these transform-animated elements acting as a *containing block* for
   position:fixed descendants (which threw the phase/status dropdown menus way off). */
.rise { animation: rise .4s cubic-bezier(.2, .7, .3, 1) backwards; }
.nav-item { animation: rise .35s cubic-bezier(.2,.7,.3,1) backwards; }
.nav-item:nth-child(1) { animation-delay: .03s; }
.nav-item:nth-child(2) { animation-delay: .07s; }

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar-collapse-btn { display: none; }                 /* rail-collapse is a desktop affordance */
  html[data-sidebar="collapsed"] .sidebar { padding: 10px 14px; flex-direction: row; }
  html[data-sidebar="collapsed"] .nav-children,
  html[data-sidebar="collapsed"] .who-meta { display: none; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 8px; padding: 10px 14px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand-row { padding: 0 8px 0 0; }
  .nav { flex-direction: row; }
  .nav-item.active::before { display: none; }
  .nav-item span:not(.count) { display: none; }
  .sidebar-foot { margin-top: 0; margin-left: auto; border-top: none; padding-top: 0; }
  .content { padding: 18px 14px; }
  .topbar { padding: 0 16px; }
  .phase { flex-basis: 86vw; width: 86vw; max-height: none; }
  .field-grid { grid-template-columns: 1fr; }
  .detail-head { flex-direction: column; gap: 12px; }
  .detail-aside { align-items: flex-start; flex-direction: row; width: 100%; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===========================================================================
   Course-correction additions: theme toggle, condensed detail head, score in
   a fold, phase modal, task checkpoint comments.
   ========================================================================== */

/* ---- theme toggle (sidebar foot) ----------------------------------------- */
.theme-toggle .icon { width: 17px; height: 17px; }
.theme-toggle .ico-dark { display: none; }
.theme-toggle .ico-light { display: block; }
[data-theme="dark"] .theme-toggle .ico-dark { display: block; }
[data-theme="dark"] .theme-toggle .ico-light { display: none; }

/* ---- condensed project detail head --------------------------------------- */
.detail-head.compact { gap: 18px; margin-bottom: 14px; align-items: center; }
.detail-head.compact h1 { font-size: 20px; margin-top: 4px; }
.detail-head.compact .detail-id p { margin-top: 2px; font-size: 13px; }

/* score rendered bare inside its fold (the fold supplies the card chrome) */
.fold .score { border: none; box-shadow: none; background: transparent; padding: 8px 0 2px; }

/* ---- phase modal (new/edit) ---------------------------------------------- */
.modal.wide { max-width: 560px; }
.modal .form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal .field-grid { margin-bottom: 16px; }
.modal details.more { margin-bottom: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.modal details.more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.modal details.more > summary::-webkit-details-marker { display: none; }
.modal details.more > summary .icon { width: 14px; height: 14px; color: var(--ink-3); transform: rotate(90deg); transition: transform .16s; }
.modal details.more[open] > summary .icon { transform: rotate(-90deg); }
.modal details.more .more-body { margin-top: 12px; }

/* ---- task checkpoint comments (in the task modal) ------------------------ */
.checkpoints { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 14px; }
.cp-lab { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.cp-lab .icon { width: 13px; height: 13px; }
.cp-lab .cp-n { background: var(--surface-3); color: var(--ink-2); border-radius: 999px; padding: 0 7px; font-size: 10px; line-height: 16px; }

.cp-add { display: flex; gap: 8px; margin-bottom: 14px; }
.cp-add input {
  flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-size: 13px;
}
.cp-add input::placeholder { color: var(--ink-3); }
.cp-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 24%, transparent); }

.cp-list { display: flex; flex-direction: column; gap: 9px; max-height: 230px; overflow-y: auto; }
.cp-item { display: flex; gap: 10px; }
.cp-item .avatar { width: 24px; height: 24px; font-size: 10px; flex-shrink: 0; margin-top: 1px; }
.cp-body { min-width: 0; flex: 1; }
.cp-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 1px; }
.cp-who { font-size: 12.5px; font-weight: 600; }
.cp-time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.cp-text { font-size: 13px; line-height: 1.45; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.cp-empty { font-size: 12.5px; color: var(--ink-3); padding: 2px 0 4px; }

/* score fold when it sits below the phase strip */
.plan-body .fold.score-fold { margin-top: 22px; }

/* ===========================================================================
   Sidebar collapse-to-rail. A toggle rides the right border (shown on hover);
   collapsing narrows the sidebar to an icon rail. State persisted (opus-sidebar),
   applied pre-paint in the <head> no-flash script.
   ========================================================================== */
.sidebar-collapse-btn {
  position: absolute; top: 62px; right: -13px; z-index: 25;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-3);
  border: 1px solid var(--border-2); box-shadow: var(--shadow-sm), var(--hi);
  opacity: 0; transform: translateX(-5px); pointer-events: none;
  transition: opacity .15s, transform .15s, color .14s, background .14s;
}
.sidebar:hover .sidebar-collapse-btn,
.sidebar-collapse-btn:focus-visible { opacity: 1; transform: none; pointer-events: auto; }
.sidebar-collapse-btn:hover { color: var(--ink); background: var(--surface-3); }
.sidebar-collapse-btn .icon { width: 15px; height: 15px; transition: transform .18s; }
html[data-sidebar="collapsed"] .sidebar-collapse-btn .icon { transform: rotate(180deg); }

html[data-sidebar="collapsed"] { --sidebar-w: 64px; }
html[data-sidebar="collapsed"] .sidebar { padding: 16px 9px; }
html[data-sidebar="collapsed"] .brand-row { justify-content: center; padding: 6px 0 16px; }
html[data-sidebar="collapsed"] .brand-name,
html[data-sidebar="collapsed"] .nav-item > span:not(.count),
html[data-sidebar="collapsed"] .nav-summary .nav-chev,
html[data-sidebar="collapsed"] .nav-children,
html[data-sidebar="collapsed"] .who-meta { display: none; }
html[data-sidebar="collapsed"] .nav-item { justify-content: center; padding: 9px; gap: 0; }
html[data-sidebar="collapsed"] .nav-item.active::before { display: none; }
html[data-sidebar="collapsed"] .who { flex-direction: column; gap: 6px; padding: 6px 0; }
html[data-sidebar="collapsed"] .who-out { margin-left: 0; }
html[data-sidebar="collapsed"] .who form { display: grid; place-items: center; }

/* ===========================================================================
   Phase 6 — Targets (KPIs) + Resources tabs.
   ========================================================================== */

/* ---- tab count badge ----------------------------------------------------- */
.tab-count {
  margin-left: 1px; min-width: 18px; padding: 0 6px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; line-height: 1; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-3);
}
.tab.active .tab-count { color: var(--ink-2); }
.tab-count.is-zero { display: none; }

/* ---- targets (KPI cards) ------------------------------------------------- */
.kpi-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.kpi-card {
  text-align: left; padding: 16px 16px 17px;
  display: flex; flex-direction: column; gap: 11px;
  cursor: pointer; transition: border-color .14s, box-shadow .14s, transform .14s;
}
.kpi-card:hover { border-color: var(--border-2); box-shadow: var(--shadow), var(--hi); transform: translateY(-1px); }
.kpi-card:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.kpi-top { display: flex; align-items: baseline; gap: 8px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; flex: 1; min-width: 0; }
.kpi-unit { font-size: 10.5px; color: var(--ink-3); flex-shrink: 0; }
.kpi-values { display: flex; align-items: baseline; gap: 7px; }
.kpi-cur { font-size: 24px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.kpi-sep { color: var(--ink-3); font-size: 15px; }
.kpi-tgt { font-size: 15px; color: var(--ink-2); }
.kpi-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 1px; }
.kpi-bar-fill { height: 100%; border-radius: 999px; background: var(--accent-grad); transition: width .5s cubic-bezier(.2,.7,.3,1); }
.kpi-bar-fill.full { background: var(--ok); }
.kpi-pct { font-size: 11px; color: var(--ink-3); margin-top: -3px; }

/* ---- resources (link list) ----------------------------------------------- */
.res-list { overflow: hidden; }
.res-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  transition: background .14s;
}
.res-row:last-child { border-bottom: none; }
.res-row:hover { background: var(--surface-3); }
.res-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.res-ico { display: grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0;
  border-radius: var(--radius-sm); background: var(--surface-3); color: var(--ink-3); }
.res-ico .icon { width: 16px; height: 16px; }
.res-row:hover .res-ico { color: var(--accent-bright); }
.res-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.res-title { font-size: 13.5px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-url { font-size: 11.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-ext { color: var(--ink-3); opacity: 0; transition: opacity .14s; flex-shrink: 0; }
.res-ext .icon { width: 14px; height: 14px; }
.res-main:hover .res-ext { opacity: 1; }
.res-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.res-meta .avatar { width: 24px; height: 24px; font-size: 10px; }
.res-when { font-size: 11px; color: var(--ink-3); }
.res-meta .icon-btn { width: 30px; height: 30px; }

/* ---- activity feed (read-only timeline) ---------------------------------- */
.activity-feed { position: relative; padding: 4px 0 8px; }
/* the connecting rail runs down the centre of the icon nodes */
.activity-feed::before {
  content: ''; position: absolute; top: 6px; bottom: 6px; left: 15px;
  width: 1px; background: var(--border); z-index: 0;
}
.act-day {
  position: relative; z-index: 1; margin: 18px 0 10px 44px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3);
}
.act-day:first-child { margin-top: 4px; }
.act-item {
  position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 14px;
  padding: 7px 0;
}
.act-node {
  flex-shrink: 0; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--ink-3); box-shadow: var(--shadow-sm);
}
.act-node .icon { width: 15px; height: 15px; }
/* completion is the quiet reward — node glows in the success colour */
.act-item.done .act-node {
  background: var(--ok-soft); border-color: color-mix(in oklch, var(--ok) 45%, transparent);
  color: var(--ok);
}
.act-body {
  flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 12px;
  padding-top: 5px;
}
.act-text { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.act-text .avatar { width: 19px; height: 19px; font-size: 9px; vertical-align: -4px; margin-right: 3px; }
.act-name { font-weight: 600; color: var(--ink); }
.act-when { flex-shrink: 0; font-size: 11px; color: var(--ink-3); white-space: nowrap; }

@media (max-width: 860px) {
  .res-when { display: none; }
  .act-body { flex-direction: column; gap: 2px; }
}

/* ===========================================================================
   Phase 8 — "Needs attention" lens (topbar control + roll-up modal).
   ========================================================================== */

/* ---- topbar attention button --------------------------------------------- */
.attn-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--ink-2); box-shadow: var(--hi);
  cursor: pointer; transition: background .14s, border-color .14s, color .14s, transform .04s;
}
.attn-btn:hover { background: var(--surface-3); }
.attn-btn:active { transform: translateY(.5px); }
.attn-btn .icon { width: 16px; height: 16px; }
.attn-count {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 600;
  line-height: 1; color: #fff;
}
/* clear = recede (neutral + a quiet green check); risk = amber; blocked = red.
   Color is reserved for problems, so the all-clear state stays calm and low-key. */
.attn-btn.is-clear { color: var(--ink-3); }
.attn-btn.is-clear .icon { color: var(--ok); }
.attn-btn.is-risk { color: var(--warn); border-color: color-mix(in oklch, var(--warn) 45%, transparent); background: var(--warn-soft); }
.attn-btn.is-risk .icon { color: var(--warn); }
.attn-btn.is-risk .attn-count { background: var(--warn); color: var(--warn-ink); }
.attn-btn.is-blocked { color: var(--bad); border-color: color-mix(in oklch, var(--bad) 48%, transparent); background: var(--bad-soft); }
.attn-btn.is-blocked .icon { color: var(--bad); }
.attn-btn.is-blocked .attn-count { background: var(--bad); color: var(--bad-ink); }

/* ---- attention modal ----------------------------------------------------- */
.modal.attn-modal { max-width: 500px; }
.attn-modal .modal-head { margin-bottom: 10px; }
.attn-modal .modal-head .cp-n { margin-left: 2px; }
.attn-lead { font-size: 12.5px; color: var(--ink-3); margin: 0 0 14px; line-height: 1.45; }

.attn-list { display: flex; flex-direction: column; gap: 8px; }
.attn-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--ink);
  transition: border-color .14s, background .14s, transform .04s;
}
.attn-item:hover { background: var(--surface-3); transform: translateX(2px); }
.attn-item .chev { width: 16px; height: 16px; color: var(--ink-3); flex-shrink: 0; }
.attn-ico {
  flex-shrink: 0; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%;
}
.attn-ico .icon { width: 15px; height: 15px; }
.attn-item.risk    .attn-ico { background: var(--warn-soft); color: var(--warn); }
.attn-item.blocked .attn-ico { background: var(--bad-soft); color: var(--bad); }
.attn-item.blocked { border-color: color-mix(in oklch, var(--bad) 28%, var(--border)); }
.attn-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.attn-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.attn-proj { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-kind { flex-shrink: 0; font-size: 10px; padding: 1px 7px; }
.attn-text { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; overflow-wrap: anywhere; }

.attn-clear { text-align: center; padding: 18px 8px 14px; }
.attn-clear-mark {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok-soft); color: var(--ok);
}
.attn-clear-mark .icon { width: 23px; height: 23px; }
.attn-clear h3 { font-size: 15px; margin: 0 0 4px; }
.attn-clear p { font-size: 12.5px; color: var(--ink-3); margin: 0; line-height: 1.5; }

/* ============================================================================
   ⌘K command palette + topbar search trigger
   ========================================================================== */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 11px; font-weight: 500; line-height: 1; white-space: nowrap;
  color: var(--ink-3); background: var(--surface-3);
  border: 1px solid var(--border); border-radius: 5px;
  font-variant-numeric: tabular-nums;
}

.topbar-search {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 8px 0 11px; min-width: 196px; max-width: 240px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface-1); color: var(--ink-3); box-shadow: var(--hi);
  transition: background .14s, border-color .14s, color .14s;
}
.topbar-search:hover { background: var(--surface-2); border-color: var(--accent-line); color: var(--ink-2); }
.topbar-search .icon { width: 15px; height: 15px; color: var(--ink-3); flex-shrink: 0; }
.topbar-search .ts-label { flex: 1; text-align: left; font-size: 13px; }
.topbar-search .ts-kbd { flex-shrink: 0; }

.palette-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: start center; padding: 13vh 20px 24px;
  background: color-mix(in oklch, var(--bg) 50%, transparent);
  backdrop-filter: blur(7px); opacity: 0; transition: opacity .14s ease;
}
/* `hidden` alone is display:none, but the rule above outranks it — restore it explicitly
   so the overlay isn't permanently on top of the page swallowing every click. */
.palette-overlay[hidden] { display: none; }
.palette-overlay.is-open { opacity: 1; }
.palette-card {
  width: 100%; max-width: 560px; overflow: hidden; padding: 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(-10px) scale(.985);
  transition: transform .18s cubic-bezier(.2, .7, .3, 1);
}
.palette-overlay.is-open .palette-card { transform: none; }
.palette-input-row { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-search-ico { width: 18px; height: 18px; color: var(--ink-3); flex-shrink: 0; }
.palette-input { flex: 1; border: none; background: none; outline: none; font-size: 15px; color: var(--ink); }
.palette-input::placeholder { color: var(--ink-3); }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; border-radius: var(--radius-sm); text-align: left;
  color: var(--ink); transition: background .1s;
}
.palette-item.is-sel { background: var(--surface-3); }
.pi-ico {
  display: grid; place-items: center; width: 27px; height: 27px;
  border-radius: 7px; background: var(--surface-3); color: var(--ink-2); flex-shrink: 0;
}
.palette-item.is-sel .pi-ico { background: var(--surface-1); color: var(--accent-bright); }
.pi-ico .icon { width: 15px; height: 15px; }
.pi-label { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-hint { flex-shrink: 0; font-size: 11.5px; color: var(--ink-3); }
.palette-empty { padding: 26px; text-align: center; color: var(--ink-3); font-size: 13px; }

@media (max-width: 720px) {
  .topbar-search { min-width: 0; max-width: none; padding: 0 9px; }
  .topbar-search .ts-label, .topbar-search .ts-kbd { display: none; }
}

/* ============================================================================
   Share modal (enable / copy / revoke the read-only link)
   ========================================================================== */
.share-explain { display: flex; gap: 13px; margin-bottom: 18px; }
.share-glyph {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in oklch, var(--accent) 12%, transparent); color: var(--accent-bright);
}
.share-glyph .icon { width: 20px; height: 20px; }
.share-explain p { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.share-lead { font-size: 13px; line-height: 1.5; margin-bottom: 14px; }
.share-enable-form { display: flex; justify-content: flex-end; gap: 10px; }
.share-link-row { display: flex; gap: 8px; margin-bottom: 14px; }
.share-link-input {
  flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); background: var(--surface-1); color: var(--ink); font-size: 12.5px;
}
.share-link-input:focus { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
.btn.is-copied { color: var(--ok); border-color: color-mix(in oklch, var(--ok) 45%, transparent); }
.btn.is-copied .icon { color: var(--ok); }
.share-actions { display: flex; align-items: center; gap: 8px; }
.share-actions .spacer { flex: 1; }
.share-revoke { color: var(--bad); border-color: color-mix(in oklch, var(--bad) 30%, var(--border-2)); }
.share-revoke .icon { color: var(--bad); }
.share-revoke:hover { background: var(--bad-soft); }

/* ============================================================================
   Public read-only share page
   ========================================================================== */
.share-page { background: var(--bg); min-height: 100vh; }
.share-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 22px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 72%, transparent); backdrop-filter: blur(12px) saturate(1.4);
}
.share-top .brand-row { padding: 0; }
.share-top .spacer { flex: 1; }
.share-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--border);
}
.share-badge .icon { width: 13px; height: 13px; }
.share-main { max-width: 1100px; margin: 0 auto; padding: 24px 26px 60px; }
.share-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--ink-3);
}
.share-main .detail-aside .status-control { display: flex; }

/* read-only: neutralize interactive affordances inherited from the app components */
.phase.is-static .phase-head, .kpi-card.is-static { cursor: default; }
.task-open.as-static { width: 100%; cursor: default; }
.task-open.as-static:hover .task-title { color: inherit; }
.task-row.is-static .task-check { cursor: default; }
.task-row.is-static .task-check:not(.done):hover { border-color: var(--border-2); color: inherit; }
.kpi-card.is-static:hover { transform: none; box-shadow: var(--shadow), var(--hi); border-color: var(--border); }
.task-empty { font-size: 12.5px; color: var(--ink-3); padding: 4px 8px 8px; }
