:root {
  color-scheme: dark;
  --bg: oklch(0.12 0.035 272);
  --bg-2: oklch(0.1 0.03 272 / 0.55);
  --surface: oklch(0.21 0.045 272 / 0.42);
  --raised: oklch(0.85 0.05 270 / 0.08);
  --line: oklch(0.85 0.06 270 / 0.11);
  --line-strong: oklch(0.85 0.06 270 / 0.2);
  --glass-blur: blur(22px) saturate(150%);
  --glass-shadow: inset 0 1px 0 oklch(1 0 0 / 0.08), 0 18px 40px -18px oklch(0.05 0.04 275 / 0.7);
  --ink: oklch(0.96 0.012 270);
  --ink-2: oklch(0.85 0.025 270);
  --muted: oklch(0.72 0.035 270);
  --faint: oklch(0.58 0.04 270);
  /* Accent: nebula violet. Used for "your turn" states, selection, and primary actions. */
  --accent: oklch(0.79 0.135 292);
  --accent-hover: oklch(0.85 0.11 292);
  --accent-ink: oklch(0.17 0.06 285);
  --accent-soft: oklch(0.79 0.135 292 / 0.13);
  --accent-line: oklch(0.79 0.135 292 / 0.48);
  --accent-grad: linear-gradient(115deg, oklch(0.8 0.12 232), oklch(0.77 0.14 292) 55%, oklch(0.76 0.15 318));
  /* Live: starlight blue. Used only while a tool is running. */
  --live: oklch(0.8 0.12 228);
  --live-soft: oklch(0.8 0.12 228 / 0.13);
  --live-line: oklch(0.8 0.12 228 / 0.42);
  --danger: oklch(0.74 0.15 18);
  --danger-soft: oklch(0.74 0.15 18 / 0.11);
  --danger-line: oklch(0.74 0.15 18 / 0.45);
  --done: oklch(0.88 0.03 255);
  --tool-claude: oklch(0.77 0.13 50);
  --tool-codex: oklch(0.86 0.07 200);
  --tool-cursor: oklch(0.77 0.13 335);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "IBM Plex Sans Thai", ui-monospace, SFMono-Regular, Menlo, monospace;
  --z-base: 0;
  --z-sticky: 10;
  --z-toast: 40;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--ink);
  font: 400 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
/* Starfield: three tiled layers of different density so the pattern never reads as a grid. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 12% 22%, oklch(1 0 0 / 0.85), transparent 100%),
    radial-gradient(1px 1px at 68% 8%, oklch(0.95 0.04 240 / 0.7), transparent 100%),
    radial-gradient(1.4px 1.4px at 41% 63%, oklch(1 0 0 / 0.75), transparent 100%),
    radial-gradient(1px 1px at 86% 47%, oklch(0.92 0.06 300 / 0.7), transparent 100%),
    radial-gradient(1px 1px at 27% 88%, oklch(1 0 0 / 0.55), transparent 100%),
    radial-gradient(1.8px 1.8px at 57% 34%, oklch(0.95 0.05 230 / 0.9), transparent 100%),
    radial-gradient(1px 1px at 93% 81%, oklch(1 0 0 / 0.6), transparent 100%);
  background-size: 230px 230px, 230px 230px, 340px 340px, 340px 340px, 470px 470px, 610px 610px, 470px 470px;
  opacity: 0.8;
}
body::after {
  content: ""; position: fixed; inset: -10%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(46% 50% at 12% 8%, oklch(0.55 0.16 240 / 0.55), transparent 72%),
    radial-gradient(42% 54% at 92% 30%, oklch(0.48 0.22 295 / 0.55), transparent 72%),
    radial-gradient(34% 32% at 50% 50%, oklch(0.4 0.16 268 / 0.35), transparent 72%),
    radial-gradient(44% 40% at 26% 94%, oklch(0.45 0.18 285 / 0.4), transparent 72%),
    radial-gradient(36% 38% at 80% 92%, oklch(0.5 0.18 325 / 0.32), transparent 72%),
    linear-gradient(155deg, oklch(0.17 0.06 255), oklch(0.1 0.035 272) 50%, oklch(0.15 0.07 295));
  animation: drift 48s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(3%, -2%, 0) scale(1.06); } }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: var(--ink); }
h1, h2, h3 { line-height: 1.3; margin: 0; text-wrap: balance; font-weight: 600; letter-spacing: -0.005em; }
h1 { font-size: 2.25rem; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
p { margin: 0; text-wrap: pretty; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
main { width: 100%; margin: 0 auto; padding: 32px clamp(20px, 3vw, 56px) 96px; outline: none; }

.label {
  font: 500 11.5px/1.4 var(--mono); color: var(--muted); letter-spacing: 0.02em;
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(20px, 3vw, 56px);
  background: oklch(0.135 0.007 275 / 0.94);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; color: var(--ink); text-decoration: none; border-radius: 6px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.logo-glow {
  display: block; flex: none; overflow: visible; fill: oklch(0.99 0.01 260); font-family: var(--font);
  filter: drop-shadow(0 0 1.5px oklch(0.92 0.08 240 / 0.9)) drop-shadow(0 0 6px oklch(0.78 0.15 238 / 0.7)) drop-shadow(0 0 16px oklch(0.68 0.2 295 / 0.55));
  animation: logo-glow 5s ease-in-out infinite;
}
@keyframes logo-glow {
  50% { filter: drop-shadow(0 0 2px oklch(0.95 0.06 240 / 1)) drop-shadow(0 0 9px oklch(0.8 0.15 238 / 0.85)) drop-shadow(0 0 24px oklch(0.7 0.21 300 / 0.7)); }
}
.brand-logo { height: 28px; width: auto; aspect-ratio: 76 / 25; }
.brand-symbol { display: none; height: 26px; width: auto; aspect-ratio: 29 / 25; }
.brand:hover .logo-glow { animation-duration: 1.6s; }
.topnav { display: flex; align-items: center; gap: 20px; }
.sys {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface);
  font: 500 12px/1.3 var(--mono) !important; color: var(--ink-2) !important;
}
.sys-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.sys[data-state="live"] { border-color: var(--live-line); }
.sys[data-state="live"] .sys-dot { background: var(--live); animation: ping 1.8s var(--ease) infinite; }
.sys[data-state="waiting"] { border-color: var(--accent-line); color: var(--accent) !important; }
.sys[data-state="waiting"] .sys-dot { background: var(--accent); }
.sys[data-state="offline"] .sys-dot { background: var(--danger); }
@media (max-width: 640px) { .sys .sys-text { display: none; } .sys { padding: 8px; } }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted);
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .wave { display: none; }
.icon-btn[aria-pressed="true"] { color: var(--live); border-color: var(--live-line); }
.icon-btn[aria-pressed="true"] .wave { display: inline; }
.icon-btn[aria-pressed="true"] .mute { display: none; }
.topnav a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; transition: color 160ms var(--ease); }
.topnav a:not(.btn):hover, .topnav a[aria-current="page"]:not(.btn) { color: var(--ink); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--raised); color: var(--ink);
  font: 500 14px/1 var(--font); text-decoration: none; cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease), opacity 160ms;
}
.btn:hover { background: oklch(0.27 0.011 275); border-color: oklch(0.45 0.012 275); }
.btn:active { background: var(--surface); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-grad); border-color: transparent; color: var(--accent-ink); font-weight: 600; box-shadow: 0 6px 20px -8px oklch(0.7 0.18 290 / 0.7); }
.btn-primary:hover { background: var(--accent-grad); border-color: transparent; filter: brightness(1.07); box-shadow: 0 0 0 4px var(--accent-soft), 0 8px 24px -8px oklch(0.7 0.18 290 / 0.8); }
.btn-primary:active { filter: brightness(0.96); }
.btn-block { width: 100%; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }
.btn-dark:hover { background: oklch(0.88 0.008 275); border-color: oklch(0.88 0.008 275); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.is-loading { pointer-events: none; opacity: 0.7; }
.btn.is-loading::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Layout */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) clamp(372px, 30vw, 560px); gap: 20px; align-items: start; }
@media (max-width: 1023px) { .grid-2 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.section > h2 { margin-bottom: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Crew: one tile per agent */
.crew { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; background: transparent; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
@media (max-width: 767px) {
  .crew { grid-template-columns: 1fr; }
  .crew .agent { padding: 10px 14px; grid-template-columns: auto auto minmax(0, 1fr); gap: 12px; }
  .crew .agent-glyph { grid-row: auto; width: 28px; height: 28px; font-size: 12px; }
  .crew .agent-role { display: none; }
  .crew .agent-state { grid-column: auto; margin: 0; padding: 0; border: 0; }
}
.agent { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 14px 16px; background: var(--surface); }
.agent-glyph {
  grid-row: span 2; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  font: 600 14px/1 var(--mono); color: var(--c); background: color-mix(in oklch, var(--c) 12%, transparent);
  border: 1px solid color-mix(in oklch, var(--c) 35%, transparent);
}
.agent-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.agent-role { font-size: 12.5px; color: var(--muted); }
.agent-state { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink-2); min-width: 0; }
.agent-state span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signal { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.agent[data-state="work"] .signal, .agent[data-state="review"] .signal { background: var(--live); box-shadow: 0 0 0 0 var(--live-line); animation: ping 1.8s var(--ease) infinite; }
.agent[data-state="work"], .agent[data-state="review"] { background: linear-gradient(180deg, var(--live-soft), transparent 70%), var(--surface); }
.agent[data-state="next"] .signal { background: var(--c); }
.meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-left: 2px; }
.meter i { width: 2px; height: 3px; border-radius: 1px; background: var(--line-strong); transform-origin: bottom; }
.agent[data-state="work"] .meter i, .agent[data-state="review"] .meter i { background: var(--live); height: 12px; animation: eq 900ms var(--ease) infinite alternate; }
.agent[data-state="work"] .meter i:nth-child(2), .agent[data-state="review"] .meter i:nth-child(2) { animation-delay: -300ms; }
.agent[data-state="work"] .meter i:nth-child(3), .agent[data-state="review"] .meter i:nth-child(3) { animation-delay: -600ms; }
.agent[data-state="work"] .meter i:nth-child(4), .agent[data-state="review"] .meter i:nth-child(4) { animation-delay: -150ms; }
.agent[data-state="next"] .meter i { background: var(--c); }
@keyframes eq { from { transform: scaleY(0.25); } to { transform: scaleY(1); } }
.agent[data-state="work"] .agent-glyph, .agent[data-state="review"] .agent-glyph { box-shadow: 0 0 0 4px color-mix(in oklch, var(--c) 14%, transparent); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 var(--live-line); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.agent-claude { --c: var(--tool-claude); }
.agent-codex { --c: var(--tool-codex); }
.agent-cursor { --c: var(--tool-cursor); }

/* Attention strip */
.attention { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; }
.attention h2 { display: flex; align-items: center; gap: 10px; font-size: 0.95rem; margin-bottom: 10px; color: var(--accent); }
.attention h2::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.attention ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attention li a { color: var(--ink); font-weight: 500; }

/* Project list */
.list-head { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(160px, 1.5fr) minmax(0, 1.2fr) 150px; gap: 20px; padding: 0 20px 8px; }
.project-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.project-row {
  display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(160px, 1.5fr) minmax(0, 1.2fr) 150px;
  align-items: center; gap: 20px; padding: 16px 20px; color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background-color 160ms var(--ease);
}
.project-row:last-child { border-bottom: 0; }
.project-row:hover { background: var(--raised); }
.project-row[data-state="awaiting_you"] { background: linear-gradient(90deg, var(--accent-soft), transparent 60%); }
.project-row[data-state="blocked"] { background: linear-gradient(90deg, var(--danger-soft), transparent 60%); }
.project-row[data-state="awaiting_you"]:hover, .project-row[data-state="blocked"]:hover { background-color: var(--raised); }
.project-row .name { font-weight: 600; font-size: 1rem; }
.project-row .segbar { height: 8px; }
.project-row .progress-num { font-size: 15px; color: var(--ink); }
.project-row .meta { font: 400 12px/1.5 var(--mono); color: var(--muted); margin-top: 2px; }
.project-row .col-state { display: flex; justify-content: flex-end; }
@media (max-width: 767px) {
  .list-head { display: none; }
  .project-row { grid-template-columns: 1fr auto; gap: 10px 12px; }
  .project-row .col-progress { grid-column: 1 / -1; order: 3; }
  .project-row .col-phase { display: none; }
}

/* Segmented progress: one segment per phase */
.progress { display: flex; align-items: center; gap: 12px; min-width: 0; }
.segcol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.segbar { display: flex; gap: 3px; height: 6px; min-width: 0; }
.seg { flex: 1; border-radius: 2px; background: var(--line); position: relative; overflow: hidden; transition: background-color 300ms var(--ease); }
.seg[data-state="done"] { background: var(--done); }
.seg[data-state="active"] { background: var(--live-line); }
.seg[data-state="active"].is-live::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--live), transparent);
  animation: sweep 1.6s var(--ease) infinite;
}
.seg[data-state="awaiting_you"] { background: var(--accent); }
.seg[data-state="blocked"] { background: var(--danger); }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.progress-num { font: 500 13px/1 var(--mono); min-width: 4ch; text-align: right; color: var(--ink-2); }
/* Mission panel: the project's lead read */
.mission { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); overflow: hidden; transition: border-color 300ms var(--ease); }
.mission[data-state="awaiting_you"] { border-color: var(--accent-line); }
.mission[data-state="blocked"] { border-color: var(--danger-line); }
.mission[data-state="active"] { border-color: var(--live-line); }
.mission-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 36px; align-items: center; padding: 22px 28px 22px 22px; }
.mission-num {
  font: 500 3.6rem/0.9 var(--mono); letter-spacing: -0.06em; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.mission-num small { font-size: 0.36em; letter-spacing: 0; color: var(--muted); margin-left: 2px; vertical-align: top; }
.mission[data-state="awaiting_you"] .mission-num { color: var(--accent); }
.mission[data-state="blocked"] .mission-num { color: var(--danger); }

/* HUD reactor */
.reactor {
  --hud: var(--done); --spin: 80s;
  position: relative; width: 236px; aspect-ratio: 1; flex: none; color: var(--hud);
}
.reactor[data-state="awaiting_you"] { --hud: var(--accent); }
.reactor[data-state="blocked"] { --hud: var(--danger); }
.reactor[data-running="true"] { --hud: var(--live); --spin: 14s; }
.reactor svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.reactor svg * { transform-box: view-box; transform-origin: 100px 100px; }
.r-halo { fill: none; stroke: var(--hud); stroke-opacity: 0.08; stroke-width: 1; }
.r-phase { fill: none; stroke: var(--line-strong); stroke-width: 5; transition: stroke 400ms var(--ease); }
.r-phase[data-state="done"] { stroke: var(--done); stroke-opacity: 0.85; }
.r-phase[data-state="active"] { stroke: var(--live); stroke-opacity: 0.55; }
.r-phase[data-state="awaiting_you"] { stroke: var(--accent); filter: drop-shadow(0 0 4px oklch(0.79 0.135 292 / 0.75)); }
.r-phase[data-state="blocked"] { stroke: var(--danger); filter: drop-shadow(0 0 4px oklch(0.73 0.16 25 / 0.7)); }
.r-phase.is-live { stroke-opacity: 1; animation: arc-pulse 1.4s var(--ease) infinite; filter: drop-shadow(0 0 5px oklch(0.81 0.12 195 / 0.8)); }
@keyframes arc-pulse { 50% { stroke-opacity: 0.35; } }
.r-track { fill: none; stroke: var(--line); stroke-width: 2; }
.r-prog { fill: none; stroke: var(--hud); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 3px currentColor); transition: stroke-dasharray 700ms var(--ease); }
.r-head { fill: var(--ink); filter: drop-shadow(0 0 4px currentColor) drop-shadow(0 0 8px currentColor); }
.reactor[data-running="true"] .r-head { animation: head-pulse 1.2s var(--ease) infinite; }
@keyframes head-pulse { 50% { r: 4.6; } }
.r-ticks line { stroke: var(--line-strong); stroke-width: 1; }
.r-ticks line.major { stroke: var(--hud); stroke-opacity: 0.7; stroke-width: 1.4; }
.r-ticks { animation: spin var(--spin) linear infinite; animation-delay: calc(var(--t) * -1s); }
.r-inner { fill: none; stroke: var(--hud); stroke-opacity: 0.35; stroke-width: 1; stroke-dasharray: 1.5 5; animation: spin calc(var(--spin) * 1.6) linear infinite reverse; animation-delay: calc(var(--t) * -1s); }
.r-cross line { stroke: var(--hud); stroke-opacity: 0.5; stroke-width: 1; }
.r-sweep { color: var(--live); opacity: 0; }
.reactor[data-running="true"] .r-sweep { opacity: 1; animation: spin 2.8s linear infinite; }
.reactor-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.reactor-label { font: 500 10px/1 var(--mono); letter-spacing: 0.18em; color: var(--hud); }
.reactor[data-running="true"] .reactor-label { animation: blink 1.4s var(--ease) infinite; }
.mission-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mission .segbar { height: 14px; gap: 4px; }
.mission .seg { border-radius: 3px; }
.mission .now-text { font-size: 1.05rem; font-weight: 500; color: var(--ink); }
.mission .stats { font: 400 12.5px/1.4 var(--mono); color: var(--muted); }
.mission .crew { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
@media (max-width: 767px) {
  .mission-top { grid-template-columns: 1fr; gap: 18px; padding: 20px; justify-items: center; }
  .mission-main { width: 100%; }
  .reactor { width: 196px; }
}
.seg-legend { display: flex; gap: 4px; }
.seg-legend span { flex: 1; min-width: 0; font: 400 11px/1.3 var(--mono); color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-legend span[data-state="active"] { color: var(--live); }
.seg-legend span[data-state="awaiting_you"] { color: var(--accent); }
.seg-legend span[data-state="blocked"] { color: var(--danger); }
.seg-legend span[data-state="done"] { color: var(--muted); }
@media (max-width: 767px) { .seg-legend { display: none; } }

/* State chips */
.chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 3px 10px; border-radius: 6px; font: 500 12px/1.5 var(--font);
  background: var(--raised); color: var(--ink-2); border: 1px solid var(--line);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-active { background: var(--live-soft); color: var(--live); border-color: var(--live-line); }
.chip-awaiting_you { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.chip-blocked, .chip-changes { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.chip-done { color: var(--done); }
.chip-pending { color: var(--muted); }
.chip-running::before { animation: blink 1.4s var(--ease) infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.tool { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1.4 var(--mono); color: var(--ink-2); }
.tool::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c, var(--muted)); }
.tool-claude { --c: var(--tool-claude); }
.tool-codex { --c: var(--tool-codex); }
.tool-cursor { --c: var(--tool-cursor); }

/* Empty state */
.empty { padding: 48px 32px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty h2 { font-size: 1.25rem; margin-bottom: 8px; }
.empty p { color: var(--muted); max-width: 52ch; margin: 0 0 20px; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0; margin-top: 32px; border-top: 1px solid var(--line); }
.how div { padding: 16px 20px 0 0; font-size: 14px; color: var(--muted); }
.how strong { display: block; margin-bottom: 4px; color: var(--ink); font-weight: 600; }
.how strong span { font: 500 12px/1 var(--mono); color: var(--accent); margin-right: 8px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label, .field legend { font-weight: 500; font-size: 14px; }
.field legend { margin-bottom: 7px; }
.field .hint { font-size: 13px; color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } }
input[type="text"], input[type="url"], input[type="password"], textarea, select {
  width: 100%; padding: 10px 12px; min-height: 42px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--ink); font: 400 15px/1.5 var(--font);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
input:hover, textarea:hover { border-color: oklch(0.45 0.012 275); }
textarea { min-height: 120px; resize: vertical; }
textarea.brief { min-height: 220px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field[data-invalid] input, .field[data-invalid] textarea { border-color: var(--danger); }
.field .error { color: var(--danger); font-size: 13px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 640px) { .segmented { grid-template-columns: 1fr 1fr; } }
.segmented > div, .choice > div { position: relative; display: flex; }
.segmented label, .choice label {
  flex: 1; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-2); font-weight: 500;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}
.segmented label:hover, .choice label:hover { border-color: oklch(0.48 0.012 275); }
.segmented label span, .choice label span { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.segmented input, .choice input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + label, .choice input:checked + label { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.segmented input:focus-visible + label, .choice input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 640px) { .choice { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.side-note { font-size: 14px; color: var(--ink-2); }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.flow li { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding-bottom: 16px; }
.flow li:last-child { padding-bottom: 0; }
.flow li::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 2px; width: 1px; background: var(--line-strong); }
.flow li:last-child::before { display: none; }
.flow .n { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font: 500 12px/1 var(--mono); color: var(--ink-2); background: var(--raised); border: 1px solid var(--line-strong); }
.flow li:last-child .n { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

/* Project header */
.proj-head { display: flex; flex-direction: column; gap: 18px; margin-bottom: 20px; }
.proj-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.crumbs { font: 400 12.5px/1.4 var(--mono); color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.proj-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.proj-meta span { font: 400 12px/1.4 var(--mono); color: var(--ink-2); padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.now-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.now-line .stats { font: 400 12.5px/1.4 var(--mono); color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Callouts: review and blocked */
.callout { position: relative; border-radius: var(--radius); padding: 22px; border: 1px solid; overflow: hidden; }
.callout h2 { font-size: 1.1rem; margin-bottom: 6px; }
.callout p { color: var(--ink-2); }
.callout .label { display: block; margin-bottom: 8px; }
.callout-review { background: linear-gradient(160deg, oklch(0.79 0.135 292 / 0.16), oklch(0.8 0.12 232 / 0.05) 60%), var(--surface); border-color: var(--accent-line); }
.callout-review .label { color: var(--accent); }
.callout-blocked { background: linear-gradient(180deg, oklch(0.73 0.16 25 / 0.09), oklch(0.73 0.16 25 / 0.03)), var(--surface); border-color: var(--danger-line); }
.callout-blocked .label { color: var(--danger); }
.callout-done { background: var(--surface); border-color: var(--line-strong); }
.callout .files { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.callout textarea { min-height: 90px; margin-top: 6px; }
.callout .form-actions { margin-top: 14px; }
.field-label { font-size: 13px; font-weight: 500; }
.blocker-list { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: b; }
.blocker-list li { counter-increment: b; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; }
.blocker-list li::before { content: counter(b, decimal-leading-zero); font: 500 12px/1.9 var(--mono); color: var(--danger); }
.blocker-list li .btn { flex: none; white-space: nowrap; }

.questions { list-style: none; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: q; }
.question { counter-increment: q; position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px 14px 52px; }
.question::before { content: counter(q, decimal-leading-zero); position: absolute; left: 16px; top: 14px; font: 500 13px/1.6 var(--mono); color: var(--danger); }
.q-text { font-weight: 600; color: var(--ink); }
.q-why { font-size: 13px; color: var(--muted); margin-top: 2px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 10px; }
.choice-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; text-align: left;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--raised);
  font: 500 14px/1.4 var(--font); color: var(--ink); cursor: pointer;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}
.choice-btn:hover { border-color: oklch(1 0 0 / 0.3); }
.choice-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-btn .rec { font: 500 11px/1 var(--mono); color: var(--accent-ink); background: var(--accent); border-radius: 4px; padding: 3px 6px; }
.q-answer { width: 100%; }
.changes-list { margin: 14px 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.callout .file-link { font-size: inherit; }
.callout .files { margin-top: 8px; }
.callout input[type="url"] { width: 100%; margin-top: 6px; }
.callout .field-label { display: block; margin-top: 14px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--raised); border-color: var(--line); color: var(--ink); }

/* Approval panel: what is being decided, mockups, checklist */
.gate-summary { margin: 4px 0 14px; color: var(--ink); max-width: 75ch; }
.gate-summary p { color: var(--ink); }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 14px 0; }
.shot {
  display: flex; flex-direction: column; gap: 6px; padding: 6px; cursor: zoom-in; text-align: left;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-2);
  transition: border-color 160ms var(--ease);
}
.shot:hover, .shot[aria-pressed="true"] { border-color: var(--accent); }
.shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 4px; background: oklch(1 0 0 / 0.04); }
.shot span { font: 400 11.5px/1.3 var(--mono); color: var(--muted); padding: 0 2px 2px; overflow-wrap: anywhere; }
.gate-checks { margin: 10px 0; }
.checklist { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 8px 10px; border-radius: 6px; background: var(--bg-2); font-size: 14px; }
.checklist li > div { display: flex; flex-direction: column; gap: 2px; }
.check-mark { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--faint); }
.checklist [data-result="pass"] .check-mark { background: var(--accent); }
.checklist [data-result="fail"] .check-mark, .checklist [data-result="blocked"] .check-mark { background: var(--danger); }
.check-result { font: 500 12px/1.6 var(--mono); color: var(--muted); white-space: nowrap; }
.checklist [data-result="fail"] .check-result, .checklist [data-result="blocked"] .check-result { color: var(--danger); }
.gate-issues ul { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.gate-warn { margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--radius-sm); color: var(--ink) !important; font-size: 14px; }

.callout-paused { background: linear-gradient(180deg, oklch(0.81 0.12 195 / 0.09), oklch(0.81 0.12 195 / 0.03)), var(--surface); border-color: var(--live-line); }
.callout-paused .label { color: var(--live); }
.steps { margin: 12px 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--ink-2); }
.paste-box { position: relative; margin: 12px 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-2); }
.paste-box pre { margin: 0; padding: 14px 16px 52px; max-height: 260px; overflow: auto; white-space: pre-wrap; font: 400 13.5px/1.7 var(--font); color: var(--ink); }
.paste-box .btn { position: absolute; right: 10px; bottom: 10px; }

/* Chat with the team */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chat-log { list-style: none; margin: 0; padding: 4px 2px; display: flex; flex-direction: column; gap: 12px; max-height: min(52vh, 560px); overflow-y: auto; overscroll-behavior: contain; }
.msg { max-width: min(82%, 68ch); display: flex; flex-direction: column; gap: 4px; }
.msg[data-from="user"] { align-self: flex-end; align-items: flex-end; }
.msg-meta { display: flex; gap: 8px; font: 400 11.5px/1.3 var(--mono); color: var(--muted); }
.msg-body { padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); font-size: 14.5px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.msg-body.md > :first-child { margin-top: 0; }
.msg-body.md > :last-child { margin-bottom: 0; }
.msg[data-from="user"] .msg-body { background: var(--accent-soft); border-color: var(--accent-line); border-bottom-right-radius: 4px; }
.msg[data-from="assistant"] .msg-body { border-bottom-left-radius: 4px; }
.msg[data-from="team"] .msg-body { background: var(--live-soft); border-color: var(--live-line); border-bottom-left-radius: 4px; }
.msg-action { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px dashed var(--accent-line); border-radius: 10px; }
.msg-action p { font-size: 13.5px; color: var(--ink-2); }
.msg-done { font: 400 12px/1.4 var(--mono); color: var(--faint); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chat-current { margin-top: 16px; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip-btn { padding: 5px 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; font: 400 12.5px/1.4 var(--font); color: var(--ink-2); cursor: pointer; }
.chip-btn:hover { border-color: var(--accent-line); color: var(--ink); }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.composer textarea { flex: 1; min-height: 48px; max-height: 180px; resize: vertical; }
.btn-attach { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; color: var(--ink-2); }
.btn-attach:hover { color: var(--ink); }
.attach-list { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; }
.attach-list li { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12.5px; color: var(--ink-2); max-width: 260px; }
.attach-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-x { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; }
.btn-x:hover { background: var(--raised); color: var(--ink); }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-thumb { padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-2); cursor: zoom-in; }
.msg-thumb img { display: block; width: 120px; height: 90px; object-fit: cover; }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; opacity: 0.6; } }

.gate-revision { margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--live-line); background: var(--live-soft); border-radius: var(--radius-sm); }
.gate-revision p { color: var(--ink); margin: 0 0 6px; }
.gate-revision .field-label { color: var(--live); margin: 0 0 4px; }
.gate-revision ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }

.usage-bar { height: 6px; border-radius: 999px; background: var(--raised); overflow: hidden; margin: 2px 0 14px; }
.usage-bar span { display: block; height: 100%; background: var(--live); border-radius: inherit; }
.usage-bar span[data-high="true"] { background: var(--accent); }
.usage-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 0 0 12px; }
.usage-stats dt { font: 500 11px/1.4 var(--mono); color: var(--muted); }
.usage-stats dd { margin: 2px 0 0; color: var(--ink); font-size: 14px; }
.usage-tools { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.usage-tools li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }

.file-input { padding: 8px; font-size: 13.5px; color: var(--ink-2); }
.file-input::file-selector-button { margin-right: 10px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--raised); color: var(--ink); font: inherit; cursor: pointer; }
.brief-files { align-items: center; margin-top: 12px; }
.brief-files .field-label { margin: 0 6px 0 0; }

.live-link {
  display: inline-flex; align-items: center; gap: 8px; margin: 6px 0 10px; padding: 10px 16px;
  border: 1px solid var(--accent-line); border-radius: var(--radius-sm); background: var(--accent-soft);
  font: 600 15px/1.3 var(--mono); color: var(--accent); text-decoration: none; overflow-wrap: anywhere;
}
.live-link:hover { background: oklch(0.79 0.135 292 / 0.2); }

.file-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-2);
  font: 500 12.5px/1.2 var(--mono); color: var(--ink); cursor: pointer;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}
.file-btn::before { content: ""; width: 9px; height: 11px; border: 1.5px solid var(--muted); border-radius: 2px; }
.file-btn:hover { border-color: oklch(0.5 0.012 275); background: var(--raised); }
.file-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.file-btn[aria-pressed="true"]::before { border-color: var(--accent); }

/* Project summary: brief and what the team did */
.brief-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 22px; }
.brief-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.brief-text { margin: 0; padding: 0; font-size: 1.05rem; line-height: 1.7; color: var(--ink); max-width: 80ch; }
.brief-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; }
.brief-meta div { display: flex; gap: 8px; font-size: 13px; }
.brief-meta dt { color: var(--muted); }
.brief-meta dd { margin: 0; color: var(--ink-2); }
.more { margin-top: 10px; }
.more > summary { cursor: pointer; font-size: 13px; color: var(--muted); width: fit-content; }
.more > summary:hover { color: var(--ink); }
.more[open] > summary { margin-bottom: 8px; }
.brief-extra { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.brief-extra li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.brief-extra time, .story-head time { font: 400 12px/1.7 var(--mono); color: var(--faint); }
.story { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 12px; }
.story-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--bg-2); min-width: 0; }
.story-item[data-state="active"] { border-color: var(--live-line); }
.story-item[data-state="awaiting_you"] { border-color: var(--accent-line); }
.story-item[data-state="blocked"] { border-color: var(--danger-line); }
.story-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.story-head time { margin-left: auto; }
.story-item .md { font-size: 14px; line-height: 1.7; }
.story-item .md > :last-child { margin-bottom: 0; }
.story-meta { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.story-meta li { font-size: 12.5px; color: var(--ink-2); background: var(--raised); border-radius: 999px; padding: 3px 10px; }
.story-item .files { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Phase timeline */
.phases { list-style: none; margin: 0; padding: 0; position: relative; }
.phase { position: relative; padding: 0 0 20px 38px; }
.phase::before { content: ""; position: absolute; left: 11px; top: 28px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line); }
.phase:last-child { padding-bottom: 0; }
.phase:last-child::before { display: none; }
.phase[data-state="done"]::before { background: var(--line-strong); }
.phase-dot {
  position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center; background: var(--bg-2); border: 1.5px solid var(--line-strong);
  font: 500 10.5px/1 var(--mono); color: var(--faint);
}
.phase[data-state="done"] .phase-dot { background: var(--done); border-color: var(--done); color: transparent; }
.phase[data-state="done"] .phase-dot::after { content: ""; position: absolute; width: 9px; height: 5px; border: 2px solid var(--bg); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.phase[data-state="active"] .phase-dot { border-color: var(--live); color: var(--live); background: var(--live-soft); box-shadow: 0 0 0 4px var(--live-soft); }
.phase[data-state="awaiting_you"] .phase-dot { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px var(--accent-soft); }
.phase[data-state="blocked"] .phase-dot { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.phase-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 26px; }
.phase-name { font-weight: 600; }
.phase[data-state="pending"] .phase-name { color: var(--muted); font-weight: 500; }
.phase-body { margin-top: 8px; }
.phase[data-state="active"] .phase-body, .phase[data-state="awaiting_you"] .phase-body, .phase[data-state="blocked"] .phase-body {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2);
}
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.task { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--ink-2); }
.task-icon { width: 15px; height: 15px; flex: none; border-radius: 4px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; }
.task[data-state="done"] .task-icon { background: var(--done); border-color: var(--done); }
.task[data-state="done"] .task-icon::after { content: ""; width: 7px; height: 4px; border: 2px solid var(--bg); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.task[data-state="active"] .task-icon { border-color: var(--live); }
.task[data-state="active"] .task-icon::after { content: ""; width: 5px; height: 5px; border-radius: 1px; background: var(--live); animation: blink 1.4s var(--ease) infinite; }
.task[data-state="awaiting_you"] .task-icon { background: var(--accent); border-color: var(--accent); }
.task[data-state="changes"] .task-icon { border-color: var(--danger); background: var(--danger-soft); }
.task[data-state="pending"] { color: var(--muted); }
.task-label { min-width: 0; overflow-wrap: anywhere; }
.task .file-link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; cursor: pointer; }
.task .file-link:hover { text-decoration-color: var(--accent); }
.task-note { margin-left: auto; font: 400 11.5px/1.4 var(--mono); color: var(--muted); white-space: nowrap; }
.task[data-state="active"] .task-note { color: var(--live); }
.task[data-state="awaiting_you"] .task-note { color: var(--accent); }
.task[data-state="changes"] .task-note { color: var(--danger); }

/* Activity feed, terminal style */
.terminal { background: var(--bg-2); border-color: var(--line); padding: 0; overflow: hidden; }
.term-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.term-head h2 { font-size: 0.95rem; margin: 0; }
.activity { list-style: none; margin: 0; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; max-height: 440px; overflow: auto; }
.activity li { font-size: 13px; display: grid; grid-template-columns: 44px 1fr; gap: 10px; color: var(--ink-2); line-height: 1.55; }
.activity time { font: 400 11.5px/1.75 var(--mono); color: var(--faint); }
.activity .who { font: 500 12px/1 var(--mono); color: var(--c, var(--muted)); margin-right: 6px; }
.who-claude { --c: var(--tool-claude); }
.who-codex { --c: var(--tool-codex); }
.who-cursor { --c: var(--tool-cursor); }
.who-user { --c: var(--accent); }
details.log summary { cursor: pointer; font-weight: 500; font-size: 14px; padding: 12px 16px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.log summary::-webkit-details-marker { display: none; }
details.log summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform 160ms var(--ease); }
details.log[open] summary::before { transform: rotate(45deg); }
details.log summary .label { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.log-body { margin: 0; max-height: 320px; overflow: auto; padding: 12px 16px; border-top: 1px solid var(--line); background: oklch(0.09 0.03 272); color: oklch(0.86 0.05 235); font: 400 12px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* File viewer */
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -20px -20px 16px; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg-2); border-radius: var(--radius) var(--radius) 0 0; }
.viewer-head code { font: 500 12.5px/1.3 var(--mono); color: var(--ink-2); overflow-wrap: anywhere; }
.viewer-body { max-height: 70vh; overflow: auto; }
.viewer-body pre.log-body { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.viewer-body img, .viewer-body video { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.md { font-size: 14.5px; line-height: 1.75; max-width: 75ch; color: var(--ink-2); }
.md h1, .md h2, .md h3 { color: var(--ink); }
.md h1 { font-size: 1.3rem; margin: 0 0 12px; }
.md h2 { font-size: 1.08rem; margin: 22px 0 8px; }
.md h3 { font-size: 1rem; margin: 16px 0 6px; }
.md strong { color: var(--ink); }
.md p, .md ul, .md ol, .md table, .md pre { margin: 0 0 12px; }
.md ul, .md ol { padding-left: 22px; }
.md code { font: 400 0.88em var(--mono); background: var(--raised); color: var(--ink); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--bg-2); border: 1px solid var(--line); padding: 12px; border-radius: var(--radius-sm); overflow: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.md th { background: var(--raised); color: var(--ink); font-weight: 600; }
.md a { color: var(--accent); }

.file-tree { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 280px; overflow: auto; }
.file-tree button { width: 100%; text-align: left; background: none; border: 0; padding: 5px 8px; border-radius: 6px; font: 400 12.5px/1.4 var(--mono); color: var(--ink-2); cursor: pointer; overflow-wrap: anywhere; transition: background-color 160ms var(--ease), color 160ms var(--ease); }
.file-tree button span { color: var(--faint); }
.file-tree button:hover { background: var(--raised); color: var(--ink); }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, var(--surface), var(--raised), var(--surface)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: 24px; z-index: var(--z-toast);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: oklch(0.18 0.03 25); }

@media (max-width: 640px) {
  main { padding: 24px 16px 80px; }
  .topbar { padding: 10px 16px; }
  .brand-logo { display: none; }
  .brand-symbol { display: block; }
  h1 { font-size: 1.45rem; }
  .progress-lg .progress-num { font-size: 2rem; }
}

/* Sign-in */
body[data-auth="out"] main { min-height: 100vh; display: grid; place-items: center; padding-top: 48px; }
.auth { position: relative; width: min(100%, 420px); display: flex; flex-direction: column; align-items: center; gap: 20px; }
.auth-orbit, .space-orbit { width: 640px; aspect-ratio: 1; pointer-events: none; z-index: -1; }
.auth-orbit { position: absolute; left: 50%; top: 46%; translate: -50% -50%; }
:is(.auth-orbit, .space-orbit) span { position: absolute; inset: 0; border-radius: 50%; border: 1px solid oklch(0.8 0.1 270 / 0.1); }
:is(.auth-orbit, .space-orbit) span:nth-child(2) { inset: 14%; border-color: oklch(0.8 0.12 292 / 0.14); }
:is(.auth-orbit, .space-orbit) span:nth-child(3) { inset: 30%; border-color: oklch(0.8 0.12 232 / 0.18); }
:is(.auth-orbit, .space-orbit) span::after { content: ""; position: absolute; top: 50%; left: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--live); box-shadow: 0 0 12px var(--live); }
/* The outer dot orbits by its own transform-origin, which is tied to the 640px ring size. */
:is(.auth-orbit, .space-orbit) span:nth-child(1)::after { animation: spin 90s linear infinite; transform-origin: 323px 0; }
:is(.auth-orbit, .space-orbit) span:nth-child(2) { animation: spin 60s linear infinite reverse; }
:is(.auth-orbit, .space-orbit) span:nth-child(2)::after { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
:is(.auth-orbit, .space-orbit) span:nth-child(3) { animation: spin 40s linear infinite; }
.space-orbit { position: fixed; }
.space-orbit span { border-color: oklch(0.8 0.1 270 / 0.16); }
.space-orbit span:nth-child(2) { border-color: oklch(0.8 0.12 292 / 0.2); }
.space-orbit span:nth-child(3) { border-color: oklch(0.8 0.12 232 / 0.24); }
.space-orbit span:nth-child(n+2)::before { content: ""; position: absolute; top: 50%; right: -2.5px; width: 5px; height: 5px; border-radius: 50%; background: oklch(0.88 0.08 318); box-shadow: 0 0 10px oklch(0.8 0.14 318); }
.space-orbit-a { top: 0; right: 0; translate: 30% -32%; scale: 1.5; }
.space-orbit-b { bottom: 0; left: 0; translate: -34% 36%; scale: 1.05; opacity: 0.85; }
.space-orbit-b span:nth-child(2) { animation-duration: 75s; }
body:not([data-auth="in"]) .space-orbit { display: none; }
@media (max-width: 640px) { .space-orbit-b { display: none; } .space-orbit-a { scale: 1; } }
.auth-card {
  width: 100%; padding: 32px 28px 28px; border-radius: 20px; border: 1px solid var(--line-strong);
  background: linear-gradient(170deg, oklch(1 0 0 / 0.07), oklch(1 0 0 / 0.015) 60%), var(--surface);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-shadow);
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.auth-brand { display: flex; justify-content: center; margin: 6px 0 12px; }
.auth-brand .logo-glow { height: 52px; width: auto; aspect-ratio: 76 / 25; }
.auth h1 { font-size: 1.5rem; letter-spacing: -0.01em; }
.auth-lead { color: var(--ink-2); font-size: 14.5px; }
.auth-form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.auth-form input { width: 100%; padding: 10px 12px; min-height: 46px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-2); color: var(--ink); font: 400 16px/1.5 var(--font); }
.auth-form .btn { margin-top: 6px; min-height: 46px; }
.auth-error { min-height: 1.4em; color: var(--danger); font-size: 13.5px; }
.auth-error:empty { min-height: 0; }
.auth-hint { font-size: 13px; color: var(--muted); }
.auth-foot { font-size: 12.5px; color: var(--faint); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-live { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 99px; font-size: 12.5px; color: var(--live); background: var(--live-soft); }
.auth-live i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px var(--live-line); }
.auth-or { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }
.auth-steps { list-style: none; margin: 0 0 4px; padding: 0; display: flex; justify-content: center; gap: 8px; counter-reset: s; }
.auth-steps li { counter-increment: s; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--faint); }
.auth-steps li::before { content: counter(s); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font: 500 11px/1 var(--mono); border: 1px solid var(--line-strong); }
.auth-steps li + li::after { order: -1; content: ""; width: 18px; height: 1px; background: var(--line-strong); margin-right: 2px; }
.auth-steps li[aria-current="step"] { color: var(--ink); }
.auth-steps li[aria-current="step"]::before { background: var(--accent-grad); color: var(--accent-ink); border-color: transparent; }
.auth-steps li[data-done]::before { content: "✓"; color: var(--live); border-color: var(--live-line); }

.finger-btn {
  position: relative; align-self: center; width: 156px; aspect-ratio: 1; border-radius: 50%; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; overflow: hidden;
  border: 1px solid var(--accent-line); color: var(--accent);
  background: radial-gradient(circle at 50% 40%, oklch(0.79 0.135 292 / 0.22), oklch(0.8 0.12 232 / 0.06) 70%), var(--bg-2);
  box-shadow: 0 0 0 8px oklch(0.79 0.135 292 / 0.06), 0 18px 40px -14px oklch(0.6 0.2 290 / 0.7);
  font: 500 13px/1.3 var(--font); transition: transform 200ms var(--ease), box-shadow 200ms var(--ease), color 200ms var(--ease);
}
.finger-btn span { color: var(--ink-2); max-width: 11ch; }
.finger-btn .fp { width: 56px; height: 56px; }
.finger-btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 10px oklch(0.79 0.135 292 / 0.1), 0 22px 44px -14px oklch(0.6 0.2 290 / 0.8); }
.finger-btn::after { content: ""; position: absolute; left: 0; right: 0; height: 40%; top: -40%; background: linear-gradient(180deg, transparent, oklch(0.8 0.12 232 / 0.35), transparent); opacity: 0; }
.finger-btn.is-scanning { pointer-events: none; color: var(--live); border-color: var(--live-line); }
.finger-btn.is-scanning::after { opacity: 1; animation: scan 1.3s var(--ease) infinite; }
.finger-btn.is-scanning .fp { animation: blink 1.3s ease-in-out infinite; }
.finger-btn.is-ok { color: var(--live); border-color: var(--live); box-shadow: 0 0 0 10px var(--live-soft), 0 0 40px -6px var(--live); }
@keyframes scan { from { top: -40%; } to { top: 100%; } }

.device-list { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.device-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-2); }
.device-list li > div { display: flex; flex-direction: column; min-width: 0; }
.device-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.device-icon .fp { width: 20px; height: 20px; }
.empty-line { margin: 14px 0; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 14px; }
.form.compact { gap: 12px; margin-top: 12px; }
.section code { font: 400 0.88em var(--mono); background: var(--raised); padding: 1px 5px; border-radius: 4px; color: var(--ink); }

/* Project page: the owner's next step first, the machinery folded away */
.callout-calm { background: var(--surface); border-color: var(--line-strong); }
.callout-calm h2 { display: flex; align-items: center; gap: 10px; }
.callout-calm h2::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px var(--live-soft); }
.action-help { margin-top: 10px; }
.backstage { padding: 0; }
.backstage > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.backstage > summary::-webkit-details-marker { display: none; }
.backstage > summary > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.backstage > summary strong { font-size: 1.05rem; font-weight: 600; }
.backstage > summary::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform 160ms var(--ease); }
.backstage[open] > summary::after { transform: rotate(-135deg); }
.backstage-body { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.backstage .activity { padding: 0; max-height: 360px; }
.backstage details.log { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.sub-h { font-size: 0.85rem; color: var(--muted); font-weight: 500; margin-top: 6px; }

/* Home */
.attention p { margin-bottom: 10px; }
.attention li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--line); }
.attention li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attention li .btn { flex: none; text-decoration: none; }
.all-clear { display: flex; align-items: center; gap: 10px; margin: 0 0 24px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink-2); font-size: 14px; }
.all-clear::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px var(--live-soft); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 0; padding: 0 4px; font-size: 12.5px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend li::before { content: ""; width: 14px; height: 6px; border-radius: 2px; background: var(--line); }
.legend li[data-state="done"]::before { background: var(--done); }
.legend li[data-state="active"]::before { background: var(--live); }
.legend li[data-state="awaiting_you"]::before { background: var(--accent); }
.legend li[data-state="blocked"]::before { background: var(--danger); }

/* Glass: top-level panels blur the gradient backdrop; nested panels stay translucent only */
.topbar, .section, .mission, .callout, .project-list, .attention, .empty {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}
.topbar { background: oklch(0.12 0.04 272 / 0.55); box-shadow: inset 0 -1px 0 oklch(1 0 0 / 0.06); }
body[data-auth="out"] .topbar, body[data-auth="pending"] .topbar { display: none; }
.mission { background: linear-gradient(160deg, oklch(1 0 0 / 0.07), oklch(1 0 0 / 0.015) 55%), var(--surface); }
.mission .agent:not([data-state="work"]):not([data-state="review"]) { background: transparent; }
.mission .agent[data-state="work"], .mission .agent[data-state="review"] { background: linear-gradient(180deg, var(--live-soft), transparent 70%); }
.crew:not(.mission .crew) { -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-shadow); }
.crew .agent + .agent { border-left: 1px solid var(--line); }
.project-row:hover, .file-tree button:hover { background: oklch(1 0 0 / 0.05); }
.terminal { background: oklch(0.09 0.03 272 / 0.55); }
@media (max-width: 767px) { .crew .agent + .agent { border-left: 0; border-top: 1px solid var(--line); } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --surface: oklch(0.2 0.014 240 / 0.94); --bg-2: oklch(0.13 0.012 240 / 0.94); }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --surface: oklch(0.2 0.014 240); --bg-2: oklch(0.13 0.012 240); }
  .topbar, .section, .mission, .callout, .project-list, .attention, .empty { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

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