/* web/public/css/northstar.css — Northstar design system.
 *
 * Transcribed from the vendored mockup's inline styles verbatim
 * (design-assets/northstar/project/Northstar Flow.dc.html, screens 01-05,
 * plus 06b Drift pause and 07 Handoff added in Task 8): exact colors,
 * paddings, radii, shadows, font sizes. Custom properties carry the
 * palette; classes below are the reusable vocabulary the kickoff.js/
 * shell.js renderers target. New surfaces the mockup lacks (stress card,
 * taste card, prior-art column, login page, dashboard topbar frame, home
 * states, inject popover/toast) are styled in-system: same card grammar
 * (radius, border, shadow scale), new accent only where the mockup itself
 * introduces one (amber = needs-attention, red = blocking).
 */

:root {
  /* Brief-mandated tokens (exact, no space after the colon — matches the
   * wire-contract literal the smoke suite and other tasks grep for). */
  --paper:#f6f5f0;
  --ink:#1c1e21;
  --green:#1f6f54;
  --green-deep:#14503c;
  --muted:#6b7066;
  --amber:#b4690e;
  --red:#b3362c;

  /* Extended palette — every other color used in the mockup's inline styles */
  --canvas: #e3e1d8;
  --text: #3a3c38;
  /* Dim tier darkened from the mockup's #9a998f/#8a897f: those measured
   * 2.6-2.9:1 on paper at 10-12px. Same warm hue, ≥4.5:1 small-text AA. */
  --dim: #6f6e62;
  --dim2: #75746a;
  --line: rgba(28, 30, 33, 0.1);
  --line-soft: rgba(28, 30, 33, 0.06);
  --line-strong: rgba(28, 30, 33, 0.16);
  --line-mid: rgba(28, 30, 33, 0.12);
  --line-btn: rgba(28, 30, 33, 0.25);
  --green-tint: #eef6f1;
  --green-tint-border: #bcd9cc;
  --green-chip-bg: #e7f2ec;
  --amber-deep: #925708;
  --amber-tint: #fbf3ec;
  --amber-tint-border: #e8d5bd;
  --amber-text: #5c4a2e;
  --red-deep: #93261e;
  --red-tint: #fdf0ee;
  --red-tint-border: #f0c9c2;
  --rail-inactive: #cfd0c8;
  --radio-empty: #b6b5ac;
  --ahead-bg: #f0efe8;
  --dock-bg: #1c1e21;
  --dock-text: #e8e6df;
  --dock-body: #c9c8bf;
  --dock-input-bg: #2a2c28;
  --dock-input-border: #3a3c38;
  --dock-muted: #8a8f88; /* 5.1:1 on --dock-bg — muted must stay readable */
  --pulse: #4fae8c;

  --font-sans: "Instrument Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

@keyframes ns-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
}

a { color: var(--green); }
a:hover { color: var(--green-deep); }

button { font-family: var(--font-sans); }

.ns-mono { font-family: var(--font-mono); }

/* ---------------------------------------------------------------------
 * Header + progress rail (7 steps)
 * ------------------------------------------------------------------- */

.ns-header {
  flex: none;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 36px 0;
}

.ns-header__top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.ns-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--green);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green);
  flex: none;
  text-decoration: none;
}

.ns-brand {
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.ns-breadcrumb {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim2);
}

.ns-guidance-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green);
  border: 1px solid var(--green-tint-border);
  background: var(--green-tint);
  border-radius: 4px;
  padding: 2px 7px;
}

.ns-inject-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line-btn);
  background: transparent;
  border-radius: 4px;
  padding: 7px 10px;
  cursor: pointer;
}
.ns-inject-btn:hover { color: var(--ink); border-color: var(--ink); }

#rail {
  display: flex;
}

.ns-rail__step {
  flex: 1;
  padding-bottom: 11px;
  border-bottom: 3px solid var(--rail-inactive);
  color: var(--dim);
  font-size: 12px;
  display: flex;
  gap: 7px;
  align-items: center;
}

.ns-rail__step[data-state="active"] {
  flex: 1.4;
  border-bottom-color: var(--green);
  color: var(--ink);
  font-weight: 600;
}

.ns-rail__step[data-state="done"] { color: var(--dim); }

.ns-rail__num {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-family: var(--font-mono);
  flex: none;
}

.ns-rail__check { color: var(--green); flex: none; }

.ns-rail__here {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--green);
  font-size: 10.5px;
}

/* AHEAD strip */
#ahead {
  flex: none;
  background: var(--ahead-bg);
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 36px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}
#ahead[hidden] { display: none; }

.ns-ahead__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  color: var(--green);
  flex: none;
}

/* ---------------------------------------------------------------------
 * Page shell
 * ------------------------------------------------------------------- */

.ns-app {
  min-height: 100vh; /* fallback */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

#panel {
  flex: 1;
  padding: 34px 80px 40px;
}

.ns-panel__narrow {
  width: 720px;
  max-width: 100%;
  margin: 0 auto;
  padding-top: 14px;
}

.ns-step-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.ns-step-label__note { color: var(--dim); }

.ns-h1 {
  margin: 6px 0 4px;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ns-h1--sm { font-size: 24px; }

.ns-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------------
 * Buttons + chips
 * ------------------------------------------------------------------- */

.ns-btn {
  border-radius: 7px;
  padding: 11px 22px;
  font-family: var(--font-sans);
  font-size: 14px;
  cursor: pointer;
  /* Buttons are rendered as <a> on home/handoff/error — kill the link
   * underline here (ghost/freetext re-add theirs later in the file). */
  text-decoration: none;
  display: inline-block;
}

.ns-btn--primary {
  background: var(--ink);
  color: #fff;
  border: none;
  font-weight: 600;
}

.ns-btn--secondary {
  background: transparent;
  border: 1px solid var(--line-btn);
  color: var(--ink);
  padding: 11px 16px;
}

.ns-btn--lock {
  background: var(--green);
  color: #fff;
  border: none;
  font-weight: 600;
  padding: 12px 20px;
  flex: none;
}

.ns-btn--ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 8px 0; /* tap area; transparent so the inline-link look holds */
}

/* Link-as-button hover guards: the global a:hover (green-deep) otherwise
 * out-specifies these classes and recolors button labels. */
a.ns-btn--primary:hover,
a.ns-btn--lock:hover { color: #fff; }
a.ns-btn--secondary:hover { color: var(--ink); }

.ns-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  align-items: center;
}

.ns-chips { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.ns-chip {
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--text);
}
.ns-chip--filled { background: var(--ink); color: #fff; border: none; }
.ns-chip--dashed { background: transparent; border: 1px dashed var(--line-strong); color: var(--dim); }

/* ---------------------------------------------------------------------
 * Screen 01 — Describe
 * ------------------------------------------------------------------- */

.ns-idea-box {
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 18px 20px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(28, 30, 33, 0.05);
}

.ns-idea-box textarea {
  width: 100%;
  min-height: 96px;
  border: none;
  outline: none;
  resize: vertical;
  font: inherit;
  color: inherit;
  background: transparent;
  font-family: var(--font-sans);
}

.ns-contract {
  margin-top: 22px;
  background: var(--green-tint);
  border: 1px solid var(--green-tint-border);
  border-radius: 10px;
  padding: 14px 18px;
}

.ns-contract__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--green);
  margin-bottom: 8px;
}

.ns-contract__rows {
  display: flex;
  gap: 18px;
  font-size: 12.5px;
  color: #2e4a3e;
  line-height: 1.5;
  flex-wrap: wrap;
}
.ns-contract__rows > div { flex: 1; min-width: 180px; }

/* ---------------------------------------------------------------------
 * Screen 02 — Clarify: question cards
 * ------------------------------------------------------------------- */

.ns-qlist { display: flex; flex-direction: column; gap: 8px; }

.ns-qrow {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.ns-qrow__check { color: var(--green); flex: none; }
.ns-qrow__text { font-size: 13px; flex: 1; }
.ns-qrow__text strong { color: var(--ink); }
.ns-qrow__shaped {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim);
  flex: none;
}

.ns-qactive {
  background: #fff;
  border: 1.5px solid var(--green);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(31, 111, 84, 0.1);
}

.ns-qactive__head { display: flex; align-items: center; gap: 9px; }

.ns-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: ns-pulse 1.6s ease-in-out infinite;
  flex: none;
}

.ns-qactive__text { font-weight: 600; font-size: 15px; }

.ns-qactive__why {
  font-size: 12.5px;
  color: var(--muted);
  margin: 8px 0 14px 17px;
}

.ns-qactive__options {
  display: flex;
  gap: 10px;
  margin-left: 17px;
  flex-wrap: wrap;
  align-items: center;
}

.ns-opt-btn {
  background: #fff;
  border: 1px solid var(--line-btn);
  border-radius: 7px;
  padding: 9px 15px;
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
}
.ns-opt-btn--primary {
  border: 1.5px solid var(--green);
  color: var(--green-deep);
  font-weight: 600;
}
.ns-opt-btn:hover { border-color: var(--green); }

.ns-freetext-toggle {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  padding: 10px 2px; /* tap area without changing the inline-link look */
}

.ns-freetext-row {
  display: flex;
  gap: 8px;
  margin: 10px 0 0 17px;
}
.ns-freetext-row input {
  flex: 1;
  border: 1px solid var(--line-btn);
  border-radius: 7px;
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
}
.ns-freetext-row button {
  border-radius: 7px;
  padding: 9px 15px;
  font-size: 13px;
  border: 1.5px solid var(--green);
  color: var(--green-deep);
  background: #fff;
  cursor: pointer;
}

.ns-progress-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--dim);
}
.ns-progress-dots__marks {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green);
}

/* ---------------------------------------------------------------------
 * Stress card (new — 02 rail; styled in-system)
 * ------------------------------------------------------------------- */

.ns-stress {
  background: #fff;
  border: 1px solid var(--line-mid);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 14px;
}

.ns-stress__head { display: flex; align-items: center; gap: 10px; }
.ns-stress__title { font-weight: 600; font-size: 13px; }

.ns-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}
.ns-pill--proceed { background: var(--green-tint); color: var(--green-deep); border: 1px solid var(--green-tint-border); }
.ns-pill--reshape { background: var(--amber-tint); color: var(--amber-deep); border: 1px solid var(--amber-tint-border); }
.ns-pill--honest-no { background: transparent; color: var(--red); border: 1px solid var(--red); }

.ns-stress__confidence { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--dim); }

.ns-stress__lists { display: flex; gap: 18px; margin-top: 10px; font-size: 12px; color: var(--text); flex-wrap: wrap; }
.ns-stress__lists > div { flex: 1; min-width: 200px; }
.ns-stress__lists h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 400;
}
.ns-stress__lists ul { margin: 0; padding-left: 16px; }

.ns-stress__override {
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red-deep);
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------------------------------------------------------------------
 * Screen 03 — Capability check (4 columns)
 * ------------------------------------------------------------------- */

.ns-cap-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.ns-cap-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.ns-cap-grid {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 22px;
}

.ns-cap-col {
  flex: 1;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--dim);
  border-radius: 10px;
  padding: 16px 18px;
}
.ns-cap-col--ready { flex: 1.15; border-top-color: var(--green); }
.ns-cap-col--setup { border-top-color: var(--amber); }
.ns-cap-col--outscope { border-top-color: var(--red); }
.ns-cap-col--priorart { border-top-color: var(--ink); }

.ns-cap-col__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}
.ns-cap-col--ready .ns-cap-col__head { color: var(--green-deep); }
.ns-cap-col--setup .ns-cap-col__head { color: var(--amber-deep); }
.ns-cap-col--outscope .ns-cap-col__head { color: var(--red-deep); }
.ns-cap-col--priorart .ns-cap-col__head { color: var(--ink); }

.ns-cap-col__count { font-family: var(--font-mono); font-size: 10.5px; color: var(--dim); font-weight: 400; }

.ns-cap-col__list { display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--text); }
.ns-cap-col__list .ns-dim { color: var(--dim); }

.ns-cap-item__row { display: flex; justify-content: space-between; gap: 8px; }
.ns-cap-item__time { font-family: var(--font-mono); font-size: 10px; color: var(--dim); flex: none; }
.ns-cap-item__note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ns-cap-item__instead {
  font-size: 11.5px;
  color: var(--green-deep);
  margin-top: 3px;
  background: var(--green-tint);
  border-radius: 5px;
  padding: 5px 8px;
}

.ns-priorart__stance {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-mid);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 8px;
  display: inline-block;
}
.ns-priorart__why { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.ns-cap-footnote { font-size: 12px; color: var(--dim); }

/* ---------------------------------------------------------------------
 * Screen 04 — Decisions
 * ------------------------------------------------------------------- */

.ns-decision-list { display: flex; flex-direction: column; gap: 10px; }

.ns-decision-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.ns-decision-card[data-recommended="true"] {
  border: 1.5px solid var(--green);
  box-shadow: 0 2px 8px rgba(31, 111, 84, 0.08);
}

.ns-radio {
  width: 17px;
  height: 17px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--radio-empty);
}
.ns-radio--on { border: 5px solid var(--green); }

.ns-decision-card__body { flex: 1; }
.ns-decision-card__label { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ns-decision-card__detail { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.ns-chip-recommended {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--green);
  background: var(--green-chip-bg);
  padding: 2px 7px;
  border-radius: 4px;
}

.ns-status-tag { font-size: 11.5px; flex: none; }
.ns-status-tag--ready { color: var(--green); }
.ns-status-tag--setup { color: var(--amber-deep); }

.ns-limit-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  background: var(--amber-tint);
  border: 1px solid var(--amber-tint-border);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--amber-text);
}
.ns-limit-banner__icon {
  width: 19px;
  height: 19px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}
.ns-limit-banner strong { color: var(--amber-deep); }

/* ---------------------------------------------------------------------
 * Screen 05 — Plan review & lock
 * ------------------------------------------------------------------- */

.ns-plan-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.ns-plan-pane { flex: 1; min-width: 320px; }

.ns-pane-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.ns-pane-head__title { font-weight: 600; font-size: 15px; }
.ns-pane-head__meta { font-family: var(--font-mono); font-size: 10px; color: var(--dim); }

.ns-spec-box { background: #fff; border: 1px solid var(--line-mid); border-radius: 10px; padding: 4px 0; overflow-wrap: anywhere; }
.ns-spec-row {
  padding: 10px 18px;
  display: flex;
  gap: 11px;
  align-items: baseline;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  line-height: 1.5;
}
.ns-spec-row:last-child { border-bottom: none; }
.ns-spec-row__tag { font-family: var(--font-mono); font-size: 10px; color: var(--green); flex: none; }
.ns-spec-row__tag--flag { color: var(--amber); }

.ns-trace-link { font-size: 11.5px; color: var(--muted); margin-top: 10px; }

.ns-taskgraph-box {
  background: #fff;
  border: 1px solid var(--line-mid);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}
.ns-phase-col { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 8px; }
.ns-phase-col__label { font-family: var(--font-mono); font-size: 10px; color: var(--dim); letter-spacing: 0.06em; }
.ns-task-chip {
  background: var(--paper);
  border: 1px solid var(--line-mid);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 11.5px;
}
.ns-task-chip__ref { color: var(--dim); }

.ns-checkpoint {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  color: var(--amber);
}
.ns-checkpoint__label {
  font-family: var(--font-mono);
  font-size: 10px;
  writing-mode: vertical-rl;
  letter-spacing: 0.1em;
  color: var(--amber-deep);
}

.ns-lockbar {
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--line-mid);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.ns-lockbar__body { flex: 1; min-width: 200px; }
.ns-lockbar__title { font-weight: 600; font-size: 13.5px; }
.ns-lockbar__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Taste card (new — beside Lock; styled in-system) */
.ns-taste {
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--line-mid);
  border-radius: 10px;
  padding: 14px 16px;
}
.ns-taste__head { display: flex; align-items: center; gap: 8px; }
.ns-taste__title { font-weight: 600; font-size: 13.5px; }
.ns-taste__tag {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line-btn);
  border-radius: 4px;
  padding: 2px 7px;
}
.ns-taste__axes { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ns-taste__axis { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.ns-taste__axis-name { flex: none; width: 110px; color: var(--text); }
.ns-taste__dots { display: flex; gap: 3px; flex: none; }
.ns-taste__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-mid); }
.ns-taste__dot--on { background: var(--green); }
.ns-taste__axis-note { color: var(--muted); font-size: 11.5px; }
.ns-taste__verdict { margin-top: 10px; font-size: 12.5px; color: var(--text); font-style: italic; }

/* Build-started panel (post-Lock) */
.ns-built {
  width: 620px;
  max-width: 100%;
  margin: 60px auto 0;
  text-align: left;
}
.ns-built__eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--green);
}
.ns-built__box {
  margin-top: 18px;
  background: #fff;
  border: 1px solid var(--line-mid);
  border-radius: 10px;
  padding: 18px 22px;
}

/* ---------------------------------------------------------------------
 * Copilot dock
 * ------------------------------------------------------------------- */

#copilot {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 300px;
  background: var(--dock-bg);
  color: var(--dock-text);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(20, 22, 18, 0.35);
  padding: 14px 16px;
  z-index: 20;
}

.ns-copilot__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ns-copilot__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pulse);
  animation: ns-pulse 2s ease-in-out infinite;
  flex: none;
}
.ns-copilot__title { font-weight: 600; font-size: 12.5px; }
/* Caret is decorative until collapse is wired (kickoff.js has no handler) —
 * a pointer cursor on a dead control promises an interaction that never comes. */
.ns-copilot__caret { margin-left: auto; color: var(--dock-muted); font-size: 11px; cursor: default; }

.ns-copilot__log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 160px;
  overflow-y: auto;
}
.ns-copilot__msg { font-size: 12.5px; line-height: 1.55; color: var(--dock-body); }
.ns-copilot__msg--muted { color: var(--dock-muted); }

.ns-copilot__input {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--dock-input-bg);
  border: 1px solid var(--dock-input-border);
  border-radius: 7px;
  /* Row reads compact but tap area is real: inner input/button carry the
   * vertical padding so both hit ~44px. */
  padding: 0 0 0 11px;
}
.ns-copilot__input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--dock-text);
  font-size: 12px;
  font-family: var(--font-sans);
  padding: 13px 0;
}
.ns-copilot__input input::placeholder { color: var(--dock-muted); }
.ns-copilot__input button {
  background: transparent;
  border: none;
  color: var(--pulse);
  cursor: pointer;
  font-size: 12px;
  padding: 13px 12px;
}

/* ---------------------------------------------------------------------
 * Reconnecting chip (SSE)
 * ------------------------------------------------------------------- */

body[data-sse="reconnecting"] #ahead {
  background: var(--amber-tint);
  color: var(--amber-text);
}
body[data-sse="reconnecting"]::after {
  content: "reconnecting…";
  position: fixed;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--amber-deep);
  background: var(--amber-tint);
  border: 1px solid var(--amber-tint-border);
  border-radius: 4px;
  padding: 3px 8px;
  z-index: 50;
}

/* ---------------------------------------------------------------------
 * Login page (tiny, in-system)
 * ------------------------------------------------------------------- */

.ns-login {
  min-height: 100vh; /* fallback */
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
}
.ns-login__card {
  width: 320px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 28px 26px;
  box-shadow: 0 1px 4px rgba(28, 30, 33, 0.05);
}
.ns-login__brand { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; }
.ns-login__error {
  font-size: 12.5px;
  color: var(--red-deep);
  background: var(--red-tint);
  border: 1px solid var(--red-tint-border);
  border-radius: 7px;
  padding: 8px 12px;
  margin-bottom: 14px;
}
.ns-login__field { margin-bottom: 14px; }
.ns-login__field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.ns-login__field input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
}
.ns-login__submit {
  width: 100%;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 11px 22px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ---------------------------------------------------------------------
 * Dashboard topbar frame (Task 8 — wraps the untouched CRT file)
 * ------------------------------------------------------------------- */

.ns-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  box-shadow: 0 1px 6px rgba(28, 30, 33, 0.08);
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--ink);
}

.ns-topbar__home {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
}
.ns-topbar__home .ns-logo { width: 18px; height: 18px; font-size: 9px; }
.ns-topbar__home .ns-brand { font-size: 12.5px; }

.ns-topbar__label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--dim2);
}

/* ---------------------------------------------------------------------
 * Drift badge (header chip, every shell.js host page)
 * ------------------------------------------------------------------- */

.ns-drift-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--amber-deep);
  background: var(--amber-tint);
  border: 1px solid var(--amber-tint-border);
  border-radius: 20px;
  padding: 3px 10px;
  text-transform: uppercase;
}
/* Inside .ns-header__top (home/handoff), either the badge or the inject
 * button may be the first one with room to spare — whichever is visible
 * first gets pushed to the row's right edge, the other trails it via gap. */
.ns-header__top .ns-drift-badge,
.ns-header__top .ns-inject-btn { margin-left: auto; }
.ns-topbar .ns-drift-badge,
.ns-topbar .ns-inject-btn { margin-left: auto; }

/* ---------------------------------------------------------------------
 * Drift modal (screen 06b — signature moment)
 * ------------------------------------------------------------------- */

.ns-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 30, 33, 0.45);
  display: grid;
  place-items: center;
  z-index: 100;
}
.ns-modal-backdrop[hidden] { display: none; }

.ns-modal-card {
  width: 560px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(20, 22, 18, 0.45);
  overflow: hidden;
}

.ns-modal-head {
  background: var(--ink);
  color: var(--dock-text);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ns-modal-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex: none;
}

.ns-modal-title { font-weight: 600; font-size: 15px; }
.ns-modal-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim2);
  margin-top: 2px;
  text-transform: uppercase;
}

.ns-modal-body { padding: 20px 22px 22px; }

.ns-modal-text { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink); }

.ns-modal-options { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.ns-modal-option {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line-btn);
  border-radius: 9px;
  padding: 12px 15px;
  cursor: pointer;
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 12px;
}
.ns-modal-option:disabled { opacity: 0.6; cursor: default; }
.ns-modal-option--primary { border: 1.5px solid var(--green); }

.ns-modal-option__body { flex: 1; display: flex; flex-direction: column; }
.ns-modal-option__label { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.ns-modal-option__detail { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ns-modal-option__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green);
  flex: none;
  text-align: right;
}

.ns-modal-error {
  margin-top: 10px;
  font-size: 12px;
  color: var(--red-deep);
}
.ns-modal-error[hidden] { display: none; }

.ns-modal-footnote {
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--dim);
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.ns-modal-resolved {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--green-deep);
  padding: 6px 0;
}
.ns-modal-resolved__icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green-tint);
  color: var(--green);
  display: grid;
  place-items: center;
  font-size: 12px;
  flex: none;
}

/* ---------------------------------------------------------------------
 * Inject box: header button -> popover -> toast (every shell.js page)
 * ------------------------------------------------------------------- */

.ns-inject-popover {
  position: fixed;
  top: 56px;
  right: 24px;
  width: 300px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(20, 22, 18, 0.18);
  padding: 14px;
  z-index: 70;
}
.ns-inject-popover[hidden] { display: none; }

.ns-inject-popover__textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line-btn);
  border-radius: 7px;
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
}

.ns-inject-popover__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.ns-inject-popover__actions .ns-btn { padding: 7px 14px; font-size: 12.5px; }

.ns-inject-popover__error {
  margin-top: 8px;
  font-size: 12px;
  color: var(--red-deep);
}
.ns-inject-popover__error[hidden] { display: none; }

.ns-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 320px;
  background: var(--ink);
  color: var(--dock-text);
  border-radius: 9px;
  padding: 11px 16px;
  font-size: 12.5px;
  line-height: 1.5;
  box-shadow: 0 12px 32px rgba(20, 22, 18, 0.35);
  z-index: 70;
}
.ns-toast[hidden] { display: none; }
.ns-toast--ok { background: var(--green-deep); }
.ns-toast--warn { background: var(--amber-deep); }
.ns-toast--muted { background: var(--text); /* same value; dedup the literal */ }
.ns-toast--pending { background: var(--ink); }

/* ---------------------------------------------------------------------
 * Home page (Task 8 — no mockup screen; styled in-system)
 * ------------------------------------------------------------------- */

#home-main,
#handoff-main { flex: 1; padding: 34px 80px 40px; }
#handoff-main { display: flex; justify-content: center; }

.ns-idea-box--placeholder { color: var(--dim); font-style: italic; }

.ns-home-strip {
  width: 720px;
  max-width: 100%;
  margin: 60px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ns-home-strip__row {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ns-home-strip__text { flex: 1; font-size: 14px; }
.ns-home-strip__phase {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  margin-left: 4px;
}
.ns-home-strip__queue { font-size: 12px; color: var(--dim); padding-left: 4px; }
/* Visible companion to the disabled Start-another button — the one-build-
 * at-a-time constraint used to live in a title tooltip nobody hovers. */
.ns-home-strip__hint { font-size: 13px; color: var(--dim); margin-left: 12px; }

.ns-home-resume { width: 620px; max-width: 100%; margin: 60px auto 0; }

/* ---------------------------------------------------------------------
 * Handoff page (screen 07)
 * ------------------------------------------------------------------- */

.ns-handoff { width: 760px; max-width: 100%; }

.ns-handoff-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--green);
}

.ns-handoff-receipt {
  background: #fff;
  border: 1px solid var(--line-mid);
  border-radius: 12px;
  padding: 18px 22px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.ns-handoff-receipt__col { flex: 1; min-width: 240px; }
.ns-handoff-receipt__col--kept { border-right: 1px solid var(--line-soft); padding-right: 24px; }
.ns-handoff-receipt__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.ns-handoff-receipt__rows {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.45;
}
.ns-handoff-check { color: var(--green); margin-right: 4px; }

.ns-handoff-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
}

.ns-handoff-trace,
.ns-handoff-ledger { margin-top: 14px; }

.ns-ledger-row {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  line-height: 1.5;
}
.ns-ledger-row:last-child { border-bottom: none; }

.ns-handoff-later {
  margin-top: 14px;
  background: #fff;
  border: 1px solid var(--line-mid);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  gap: 10px;
  align-items: baseline;
}

/* ---------------------------------------------------------------------
 * Keyboard focus (site-wide) — every interactive element gets a visible,
 * brand-colored ring on keyboard focus; pointer clicks stay ringless.
 * ------------------------------------------------------------------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
/* The idea textarea suppressed outlines entirely; restore for keyboard. */
.ns-idea-box textarea:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
/* Dark copilot dock: ring in the dock accent, and let the input row show
 * focus via its container border (the inner input stays borderless). */
#copilot :focus-visible { outline-color: var(--pulse); }
.ns-copilot__input input:focus-visible { outline: none; }
.ns-copilot__input:focus-within { border-color: var(--pulse); }

/* ---------------------------------------------------------------------
 * Small screens — the mockup was authored at fixed 1280×800 frames, so
 * no responsive intent existed to transcribe. Minimum viable phone pass:
 * breathing gutters, wrapping header, and the 7-step rail becomes a
 * horizontal scroll strip instead of collapsing into overlapped labels.
 * ------------------------------------------------------------------- */

@media (max-width: 720px) {
  .ns-header { padding: 12px 16px 0; }
  .ns-header__top { flex-wrap: wrap; row-gap: 6px; }

  #rail { overflow-x: auto; scrollbar-width: none; }
  .ns-rail__step,
  .ns-rail__step[data-state="active"] { flex: none; }
  .ns-rail__step { padding-right: 16px; white-space: nowrap; }

  #ahead { padding: 8px 16px; }

  /* 190px bottom room keeps the actions row clear of the fixed dock. */
  #panel,
  #home-main,
  #handoff-main { padding: 22px 16px 190px; }
}

@media (max-width: 720px) {
  /* The fixed 300px dock parked itself on top of the primary CTA at
   * phone widths. Full-width at the bottom edge; the panel's 190px
   * bottom padding (above) keeps every action reachable above it. */
  #copilot {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}

/* Respect OS-level motion reduction: the pulse dots are the only looping
 * animation — hold them steady. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* Disabled affordance — render.js/kickoff.js set the attribute on every
 * button flavor, but only .ns-modal-option ever had a visual state. */
.ns-btn:disabled,
.ns-opt-btn:disabled,
.ns-decision-card:disabled,
.ns-freetext-toggle:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* .ns-dim is used unscoped by kickoff.js (plan spec-box) and render.js
 * (handoff empty states); it was only ever defined inside .ns-cap-col__list,
 * so those spots silently rendered full ink. */
.ns-dim { color: var(--dim); }

/* ---------------------------------------------------------------------
 * Public projects archive — a lighter, ungated Northstar shell.
 * ------------------------------------------------------------------- */

#projects {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(rgba(28, 30, 33, 0.025) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 28px;
}

.ns-projects-header {
  min-height: 68px;
  padding: 0 max(28px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
}

.ns-projects-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.ns-projects-brand:hover { color: var(--ink); }
.ns-projects-brand__path {
  margin-left: 5px;
  font: 10.5px var(--font-mono);
  color: var(--dim2);
}

.ns-projects-header__right { display: flex; align-items: center; gap: 18px; }
.ns-projects-built-by {
  color: var(--green);
  font: 10px var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ns-projects-login {
  color: var(--ink);
  font-size: 12.5px;
  text-underline-offset: 3px;
}

.ns-projects-main {
  width: min(1180px, calc(100% - 56px));
  margin: 0 auto;
  padding: 70px 0 90px;
}

.ns-projects-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 64px;
  align-items: end;
  padding: 0 0 54px;
}

.ns-projects-eyebrow {
  margin: 0 0 16px;
  color: var(--green);
  font: 10.5px var(--font-mono);
  letter-spacing: 0.12em;
}
.ns-projects-hero h1 {
  max-width: 780px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 6vw, 72px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.ns-projects-intro {
  max-width: 620px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.ns-projects-tally {
  min-width: 128px;
  padding: 14px 0 6px 20px;
  border-left: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
}
.ns-projects-tally__number {
  color: var(--green-deep);
  font: 500 42px/1 var(--font-mono);
  letter-spacing: -0.06em;
}
.ns-projects-tally__label {
  margin-top: 8px;
  color: var(--dim);
  font: 10px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ns-projects-rule {
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
  color: var(--dim);
  font: 10px var(--font-mono);
  letter-spacing: 0.09em;
}
.ns-projects-rule span:first-child { height: 1px; background: var(--line-strong); }

.ns-projects-status {
  margin: 48px 0;
  color: var(--muted);
  font: 12px var(--font-mono);
}
.ns-projects-status--error { color: var(--red-deep); }

.ns-projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.ns-project-card {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-mid);
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(28, 30, 33, 0.03);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.ns-project-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: 0 16px 36px rgba(28, 30, 33, 0.08);
}

.ns-project-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 75% 18%, rgba(255, 255, 255, 0.72), transparent 28%),
    linear-gradient(145deg, #dfece4 0%, #f0eee3 58%, #d7dcc9 100%);
  border-bottom: 1px solid var(--line);
}
.ns-project-card__media::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(28, 30, 33, 0.09);
  border-radius: 5px;
  pointer-events: none;
  z-index: 2;
}
.ns-project-card__media[data-tint="2"] {
  background:
    radial-gradient(circle at 20% 22%, rgba(255, 255, 255, 0.76), transparent 30%),
    linear-gradient(145deg, #e9dfc9 0%, #f2eee4 56%, #ccdcd4 100%);
}
.ns-project-card__media[data-tint="3"] {
  background:
    radial-gradient(circle at 76% 76%, rgba(255, 255, 255, 0.7), transparent 30%),
    linear-gradient(145deg, #d7e0de 0%, #ece9dd 54%, #d9cfbf 100%);
}
.ns-project-card__initials {
  color: rgba(20, 80, 60, 0.64);
  font: 500 clamp(44px, 6vw, 72px)/1 var(--font-mono);
  letter-spacing: -0.12em;
  transform: translateX(-0.06em);
}
.ns-project-card__image {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--canvas);
}

.ns-project-card__body {
  min-height: 238px;
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
}
.ns-project-card__heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}
.ns-project-card__heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.ns-project-card__index { color: var(--dim); font-size: 10px; }
.ns-project-card__description {
  margin: 12px 0 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}
.ns-project-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 18px;
}
.ns-project-link {
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 600;
  text-underline-offset: 3px;
}
.ns-project-link--quiet { color: var(--muted); font-weight: 500; }
.ns-project-card__history {
  margin: auto 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.025em;
}

.ns-projects-footer {
  min-height: 70px;
  padding: 0 max(28px, calc((100vw - 1180px) / 2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: var(--dim);
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 11px;
}
.ns-projects-footer .ns-mono { font-size: 10px; letter-spacing: 0.08em; }

@media (max-width: 960px) {
  .ns-projects-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .ns-projects-header {
    min-height: 62px;
    padding: 0 18px;
  }
  .ns-projects-built-by { display: none; }
  .ns-projects-main { width: calc(100% - 32px); padding: 48px 0 64px; }
  .ns-projects-hero { grid-template-columns: 1fr; gap: 28px; padding-bottom: 38px; }
  .ns-projects-hero h1 { font-size: clamp(38px, 13vw, 56px); }
  .ns-projects-intro { font-size: 14px; }
  .ns-projects-tally { min-width: 0; flex-direction: row; align-items: baseline; gap: 10px; }
  .ns-projects-tally__number { font-size: 30px; }
  .ns-projects-tally__label { margin: 0; }
  .ns-projects-grid { grid-template-columns: 1fr; }
  .ns-project-card__body { min-height: 220px; }
  .ns-projects-footer { padding: 0 18px; }
  .ns-projects-footer > span:first-child { display: none; }
  .ns-projects-footer { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .ns-project-card { transition: none; }
  .ns-project-card:hover { transform: none; }
}

/* --- Manage projects (/projects/manage) -------------------------------- */
.ns-manage-link { margin-left: auto; font-size: 13px; color: var(--dim); text-decoration: none; }
.ns-manage-link:hover { color: var(--ink); text-decoration: underline; }
/* Hit-area padding + negative margin: the 13px header links measured 49x16px
 * clickable; pad to ~40px tall without moving a pixel visually. */
.ns-manage-link,
.ns-manage-public-link { padding: 12px 8px; margin-top: -12px; margin-bottom: -12px; margin-right: -8px; }
#home .ns-inject-btn { margin-left: 12px; }
.ns-manage-public-link { margin-left: auto; font-size: 13px; color: var(--dim); text-decoration: none; }
.ns-manage-public-link:hover { color: var(--ink); text-decoration: underline; }
.ns-manage-main { padding: 20px 0 40px; }
.ns-manage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.ns-manage-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.ns-manage-card--hidden { opacity: 0.65; }
.ns-manage-card__media { position: relative; aspect-ratio: 16 / 10; background: var(--ahead-bg); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line-soft); }
.ns-manage-card__image { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ns-manage-card__noshot { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.ns-manage-card__badge { position: absolute; top: 8px; right: 8px; font-family: var(--font-mono); font-size: 10.5px; padding: 2px 8px; border-radius: 3px; background: var(--amber-tint); border: 1px solid var(--amber-tint-border); color: var(--amber-deep); }
.ns-manage-card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.ns-manage-card__title { margin: 0; font-family: var(--font-mono); font-size: 13px; color: var(--dim); font-weight: 500; }
.ns-manage-field { display: flex; flex-direction: column; gap: 4px; }
.ns-manage-field__label { font-size: 11.5px; color: var(--dim); }
.ns-manage-input { font: inherit; font-size: 13.5px; color: var(--ink); background: #fff; border: 1px solid var(--line-btn); border-radius: 5px; padding: 6px 8px; }
.ns-manage-input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.ns-manage-textarea { resize: vertical; }
.ns-manage-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ns-manage-card__status { font-size: 12px; color: var(--green-deep); min-height: 1em; }
.ns-manage-card__status--error { color: var(--red-deep); }

/* --- run-controls popover (shares .ns-inject-popover shell) ---------------- */
.ns-controls-popover { width: 21rem; }
.ns-controls-row {
  display: flex; align-items: center; gap: 10px; margin: 0 0 10px;
}
.ns-controls-row__label {
  flex: 0 0 6.5rem; font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; opacity: .65;
}
.ns-controls-seg { display: inline-flex; gap: 0; }
.ns-controls-seg button {
  font: inherit; font-size: .8rem; padding: 5px 10px; cursor: pointer;
  background: transparent; border: 1px solid currentColor; opacity: .75;
}
.ns-controls-seg button + button { border-left: none; }
.ns-controls-seg button:hover { opacity: 1; }
.ns-controls-dial {
  width: 4.5rem; font: inherit; font-size: .85rem; padding: 4px 6px;
  background: transparent; border: 1px solid currentColor; color: inherit;
}
.ns-controls-stop { color: #b4462c; border-color: #b4462c; }
.ns-controls-footnote { font-size: .72rem; opacity: .6; line-height: 1.45; margin-top: 4px; }

/* === Mission control (SWARM Mission Control.dc.html) ======================
   The three-pane operator board at /mission. mc-* only — nothing above this
   line is reused by class-name collision, everything by token. */

#mission { background: var(--paper); color: var(--ink); font-family: var(--font-sans); font-size: 14px; margin: 0; }

.mc-label { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 0.07em; color: var(--dim); }

@keyframes mc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* --- topbar --- */
.mc-topbar { display: flex; align-items: center; gap: 10px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 18px; height: 52px; position: sticky; top: 0; z-index: 30; }
.mc-logo { flex: none; }
.mc-crumb { font-family: var(--font-mono); font-size: 10.5px; color: var(--dim2); }
.mc-clock { margin-left: auto; font-family: var(--font-mono); font-weight: 600; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.mc-topbar__meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.mc-pill { font-family: var(--font-mono); font-size: 10px; border-radius: 4px; padding: 2px 7px; white-space: nowrap; }
.mc-pill--green { color: var(--green); border: 1px solid var(--green-tint-border); background: var(--green-tint); }
.mc-pill--amber { color: var(--amber-deep); border: 1px solid var(--amber-tint-border); background: var(--amber-tint); }
.mc-topbar__btn { font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--green-deep); border: 1px solid var(--green-tint-border); background: var(--green-tint); border-radius: 4px; padding: 7px 10px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.mc-topbar__btn--stop { color: var(--red); border-color: var(--red); background: transparent; }
.mc-topbar__btn--armed { color: var(--red-deep); border-color: var(--red-deep); background: var(--red-tint); }

/* --- grid --- */
.mc-grid { display: grid; grid-template-columns: 272px minmax(0, 1fr) 336px; gap: 14px; padding: 14px 18px; align-items: start; }
@media (max-width: 1100px) { .mc-grid { grid-template-columns: 1fr; } }

/* --- fleet rail --- */
.mc-fleet { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mc-fleet__head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line-soft); }
.mc-fleet__next { font-family: var(--font-mono); font-size: 10.5px; color: var(--green); margin-top: 4px; }
.mc-fleet__list { display: flex; flex-direction: column; }
.mc-fleet__row { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 8px 12px 8px 10px; border: none; border-left: 3px solid transparent; background: transparent; cursor: pointer; font-family: var(--font-sans); border-bottom: 1px solid rgba(28, 30, 33, 0.05); }
.mc-fleet__row--sel { border-left-color: var(--green); background: var(--green-tint); }
.mc-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--rail-inactive); }
.mc-dot--live { background: var(--green); animation: mc-pulse 1.6s ease-in-out infinite; }
.mc-dot--amber { background: var(--amber); }
.mc-dot--ink { background: var(--ink); }
.mc-fleet__main { flex: 1; min-width: 0; }
.mc-fleet__title { display: flex; align-items: baseline; gap: 6px; }
.mc-fleet__id { font-family: var(--font-mono); font-weight: 600; font-size: 12px; color: var(--ink); }
.mc-fleet__cycle { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); }
.mc-fleet__next-mark { font-family: var(--font-mono); font-size: 10px; color: var(--green); }
.mc-fleet__note { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mc-fleet__foot { padding: 10px 14px; font-family: var(--font-mono); font-size: 10px; color: var(--dim2); border-top: 1px solid var(--line-soft); }
.mc-fleet__empty { padding: 14px; font-size: 12.5px; color: var(--dim); }
.mc-phase { font-family: var(--font-mono); font-size: 10px; font-weight: 500; border-radius: 4px; padding: 1px 5px; flex: none; }
.mc-phase--green { color: var(--green-deep); border: 1px solid var(--green-tint-border); background: var(--green-tint); }
.mc-phase--amber { color: var(--amber-deep); border: 1px solid var(--amber-tint-border); background: var(--amber-tint); }
.mc-phase--plain { color: var(--text); border: 1px solid rgba(28, 30, 33, 0.2); background: transparent; }
.mc-phase--dark { color: #fff; border: 1px solid var(--ink); background: var(--ink); }

/* --- console --- */
.mc-console { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 70vh; }
.mc-console__empty { padding: 48px 40px; }
.mc-console__head { padding: 16px 20px 14px; border-bottom: 1px solid rgba(28, 30, 33, 0.08); display: flex; align-items: flex-start; gap: 14px; }
.mc-console__title-wrap { flex: 1; min-width: 0; }
.mc-console__title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mc-console__id { font-family: var(--font-mono); font-weight: 600; font-size: 20px; letter-spacing: -0.02em; }
.mc-console__meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.mc-console__digest { font-size: 12.5px; color: var(--muted); margin-top: 5px; max-width: 56ch; }
.mc-console__wakeup { flex: none; text-align: right; }
.mc-console__wakeup-count { font-family: var(--font-mono); font-weight: 600; font-size: 22px; color: var(--green); line-height: 1.1; font-variant-numeric: tabular-nums; }
.mc-console__last { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); margin-top: 2px; }
.mc-console__body { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }

.mc-wave__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.mc-wave__hint { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); margin-left: auto; }
.mc-agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 10px; }
.mc-agent { border: 1px solid var(--line); border-top: 3px solid var(--rail-inactive); border-radius: 9px; padding: 11px 13px; display: flex; flex-direction: column; gap: 7px; background: #fff; }
.mc-agent--live { border-top-color: var(--green); }
.mc-agent__head { display: flex; align-items: baseline; gap: 8px; }
.mc-agent__status { margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--green); }
.mc-agent__title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.mc-agent__item { font-family: var(--font-mono); font-weight: 400; font-size: 10px; color: var(--dim2); }
.mc-agent__files { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); line-height: 1.5; }
.mc-agent__meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.mc-model { font-family: var(--font-mono); font-size: 10px; font-weight: 500; border-radius: 4px; padding: 2px 7px; }
.mc-model--fable { color: #fff; background: var(--ink); }
.mc-model--opus { color: var(--green-deep); background: var(--green-chip-bg); }
.mc-model--sonnet { color: var(--amber-deep); background: var(--amber-tint); }
.mc-model--haiku { color: var(--text); background: rgba(28, 30, 33, 0.08); }
.mc-agent__esc { margin-left: auto; font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--green); border: 1px solid var(--green-tint-border); background: var(--green-tint); border-radius: 4px; padding: 3px 8px; cursor: pointer; }
.mc-agent__queued { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--amber-deep); }

.mc-drift { border: 1px solid var(--amber-tint-border); background: var(--amber-tint); border-radius: 10px; padding: 16px 18px; }
.mc-drift__head { display: flex; align-items: center; gap: 10px; }
.mc-drift__icon { width: 24px; height: 24px; border-radius: 50%; background: var(--amber); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.mc-drift__title { font-weight: 600; font-size: 14px; }
.mc-drift__age { font-family: var(--font-mono); font-size: 10px; color: var(--amber-deep); margin-left: auto; }
.mc-drift__summary { margin: 12px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.mc-drift__options { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.mc-drift__opt { text-align: left; background: #fff; border: 1px solid var(--line-btn); border-radius: 9px; padding: 12px 15px; cursor: pointer; font-family: var(--font-sans); display: flex; align-items: center; gap: 12px; }
.mc-drift__opt--primary { border: 1.5px solid var(--green); }
.mc-drift__opt-label { display: block; font-weight: 600; font-size: 13.5px; }
.mc-drift__opt-detail { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.mc-drift__rec { color: var(--green); flex: none; margin-left: auto; }
.mc-drift__answered { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--green-deep); margin-top: 12px; }
.mc-drift__foot { margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--dim); }

.mc-done { border: 1px solid var(--green-tint-border); background: var(--green-tint); border-radius: 10px; padding: 16px 18px; }
.mc-done__label { color: var(--green); letter-spacing: 0.08em; }
.mc-done__head { font-weight: 600; font-size: 15px; margin-top: 6px; }
.mc-done__note { font-size: 12.5px; color: #2e4a3e; margin-top: 4px; line-height: 1.55; }
.mc-done__stats { display: flex; gap: 16px; margin-top: 12px; font-family: var(--font-mono); font-size: 10.5px; color: var(--green-deep); flex-wrap: wrap; }

.mc-idle { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 16px 18px; color: var(--dim); }
.mc-idle--stalled { border-color: var(--amber-tint-border); background: var(--amber-tint); color: var(--amber-deep); }
.mc-idle__head { font-size: 13.5px; margin-top: 6px; color: var(--text); }
.mc-idle__note { font-family: var(--font-mono); font-size: 11px; margin-top: 4px; }

.mc-journal__label { margin-bottom: 8px; }
.mc-journal { border: 1px solid rgba(28, 30, 33, 0.08); border-radius: 9px; padding: 4px 0; }
.mc-journal__row { display: flex; gap: 12px; padding: 8px 14px; border-bottom: 1px solid rgba(28, 30, 33, 0.05); font-size: 12px; line-height: 1.5; }
.mc-journal__row:last-child { border-bottom: none; }
.mc-journal__time { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); flex: none; padding-top: 2px; }
.mc-journal__text { color: var(--text); }

.mc-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.mc-chip { font-family: var(--font-mono); font-size: 10.5px; color: var(--text); border: 1px solid var(--line-mid); border-radius: 4px; padding: 4px 9px; }
.mc-chip--green { font-weight: 500; color: var(--green-deep); background: var(--green-tint); border-color: var(--green-tint-border); }
.mc-chip--amber { color: var(--amber-deep); background: var(--amber-tint); border-color: var(--amber-tint-border); }

/* --- levers --- */
.mc-levers { display: flex; flex-direction: column; gap: 12px; }
.mc-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; }
.mc-card__label { margin-bottom: 9px; }
.mc-card__foot { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); margin-top: 9px; line-height: 1.6; }
.mc-card__hint { font-size: 10px; color: var(--dim2); margin: -2px 0 9px 86px; line-height: 1.45; }
.mc-levers__empty { font-size: 12px; color: var(--dim2); font-style: italic; }
.mc-error { font-size: 11.5px; color: var(--red-deep); margin-top: 6px; }

.mc-inject__textarea { width: 100%; min-height: 64px; border: 1px solid var(--line-btn); border-radius: 7px; padding: 9px 11px; font-family: var(--font-sans); font-size: 16px; resize: vertical; margin-top: 9px; box-sizing: border-box; background: #fff; color: var(--ink); }
.mc-inject__actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.mc-inject__send { padding: 7px 14px; font-size: 12.5px; }

.mc-queue { display: flex; flex-direction: column; gap: 6px; }
.mc-queue__row { display: flex; align-items: center; gap: 8px; }
.mc-queue__title { flex: 1; font-size: 12px; color: var(--text); line-height: 1.4; }
.mc-queue__title--vetoed { color: var(--dim2); text-decoration: line-through; }
.mc-queue__id { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); }
.mc-queue__blocked { font-family: var(--font-mono); font-size: 10px; color: var(--amber-deep); }
.mc-queue__effort { font-family: var(--font-mono); font-size: 10px; color: var(--dim2); flex: none; }
.mc-queue__veto { font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--red-deep); background: transparent; border: 1px solid var(--red-tint-border); border-radius: 4px; padding: 2px 7px; cursor: pointer; flex: none; }
.mc-queue__veto--undo { color: var(--dim); border-color: rgba(28, 30, 33, 0.2); }

.mc-lever-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.mc-lever-row__label { flex: 0 0 76px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.mc-seg { display: inline-flex; }
.mc-seg__btn { font-family: var(--font-sans); font-size: 12px; padding: 5px 10px; cursor: pointer; background: transparent; color: var(--text); border: 1px solid rgba(28, 30, 33, 0.35); }
.mc-seg__btn + .mc-seg__btn { margin-left: -1px; }
.mc-seg__btn--on { background: var(--ink); color: #fff; }
.mc-dial { width: 72px; font-family: var(--font-mono); font-size: 16px; padding: 4px 6px; border: 1px solid rgba(28, 30, 33, 0.35); background: transparent; }

.mc-burn { margin-top: 11px; }
.mc-burn__scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--dim2); margin-bottom: 4px; }
.mc-burn__bar { height: 6px; background: rgba(28, 30, 33, 0.08); border-radius: 3px; overflow: hidden; }
.mc-burn__fill { height: 100%; background: var(--green); border-radius: 3px; }

.mc-commands { display: flex; flex-direction: column; gap: 6px; }
.mc-commands__row { display: flex; align-items: baseline; gap: 8px; font-size: 12px; line-height: 1.45; color: var(--text); }
.mc-commands__badge { font-family: var(--font-mono); font-size: 10px; font-weight: 500; color: var(--amber-deep); background: var(--amber-tint); border: 1px solid var(--amber-tint-border); border-radius: 4px; padding: 1px 6px; flex: none; }

.mc-park__btn { width: 100%; font-family: var(--font-sans); font-weight: 600; font-size: 13px; color: var(--red); border: 1px solid var(--red); background: transparent; border-radius: 7px; padding: 10px 14px; cursor: pointer; }
.mc-park__btn--armed { color: var(--red-deep); border-color: var(--red-deep); background: var(--red-tint); }

/* applied-command outcomes (review find: rejected commands must not vanish) */
.mc-commands--applied { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.mc-commands__badge--done { color: var(--green-deep); background: var(--green-tint); border-color: var(--green-tint-border); }
.mc-commands__badge--rejected { color: var(--red-deep); background: var(--red-tint); border-color: var(--red-tint-border); }

/* hover feedback — every mc-* control with cursor:pointer gets a state,
   matching the ns- conventions (.ns-inject-btn:hover etc.) */
.mc-topbar__btn:hover, .mc-agent__esc:hover { border-color: var(--green); }
.mc-topbar__btn--stop:hover { border-color: var(--red-deep); color: var(--red-deep); }
.mc-fleet__row:hover:not(.mc-fleet__row--sel) { background: var(--paper); }
.mc-queue__veto:hover { border-color: var(--red); }
.mc-queue__veto--undo:hover { border-color: var(--dim); }
.mc-drift__opt:hover { border-color: var(--ink); }
.mc-drift__opt--primary:hover { border-color: var(--green-deep); }
.mc-seg__btn:hover:not(.mc-seg__btn--on) { background: rgba(28, 30, 33, 0.04); }
.mc-park__btn:hover { background: var(--red-tint); }

/* narrow viewports: let the topbar wrap instead of clipping, and stop the
   70vh console from burying the levers a screen below the live state */
@media (max-width: 1100px) {
  .mc-topbar { flex-wrap: wrap; height: auto; min-height: 52px; padding: 8px 18px; }
  .mc-clock { margin-left: 0; }
  .mc-console { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mc-dot--live { animation: none; }
}

/* The live dot pulses only for targets with dispatched work (client sets
   mc-dot--live from backlog in_progress, never from heartbeat timing). */
.mc-queue__veto:disabled { color: var(--dim2); border-color: var(--line-mid); cursor: not-allowed; }
