/* Professional Services Automation: project and portfolio management with a built-in assistant.
   Vetted look throughout: white pages, black type and square black buttons, one gold accent,
   black mastheads with a gold rule. Playfair Display for headings, Inter for everything else. */

/* Fonts are bundled with the app (SIL Open Font License) so the LAN install needs no internet. */
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-500-normal.woff2") format("woff2"); font-weight: 500 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-500-italic.woff2") format("woff2"); font-weight: 500 600; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  /* Vetted palette: white pages, black type and buttons, one gold accent. */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f6f2;
  --sunk: #efede7;
  --ink: #141414;
  --ink-2: #3b3b38;
  --muted: #6b6a64;
  --line: #e7e4dd;
  --line-strong: #cfcbc1;
  --gold: #a88a2c;
  --gold-ink: #7d6519;
  --gold-soft: #f6f0dc;
  --accent: #141414;
  --accent-dark: #000000;
  --accent-soft: #f3f1ec;
  --focus: #a88a2c;
  --green: #2e6a45;
  --green-soft: #e6f0e8;
  --amber: #8a5f12;
  --amber-soft: #f8eed6;
  --red: #a3341f;
  --red-soft: #f8e6e1;

  /* Black bands: login panel, kickoff masthead, sticky action bars. */
  --band: #141414;
  --band-fg: #f4f3ef;
  --band-muted: #a9a8a2;
  --band-line: #2b2b29;
  --band-tag-line: #3f3f3c;
  --on-accent: #ffffff;
  --focus-ring: rgba(168, 138, 44, 0.22);
  --field-bg: #fcfcfa;
  /* Resource load shading, light to full. */
  --heat-1: #f3efe2; --heat-2: #e9dcb4; --heat-3: #d9c27d;
  --heat-soft-1: #f8f5ec; --heat-soft-2: #f1e7c8; --heat-soft-3: #e6d396;
  /* Shape: Vetted is square. Themes can round these. */
  --btn-radius: 0;
  --control-radius: 0;
  --heading-weight: 500;
  /* Long-form reading text: assistant answers and ledes. Vetted keeps it in the UI face. */
  --reading: var(--sans);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 2px;
  --r: 3px;
  --r-lg: 14px;
  --rail-w: 268px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.prose a, .lede a, .field-hint a, p > a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.text-link, .card-head a { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-variant-numeric: lining-nums; font-family: var(--serif); font-size: 2.1rem; line-height: 1.15; font-weight: var(--heading-weight); letter-spacing: -0.01em; margin-bottom: 8px; }
h2 { font-size: 1rem; line-height: 1.35; font-weight: 600; margin-bottom: 4px; }
small { font-size: 0.8rem; }
.mono { font-family: var(--mono); font-size: 0.82em; }
.muted { color: var(--muted); }
.block-muted { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.danger-text { color: var(--red); font-weight: 600; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { top: 12px; color: #fff; }

/* ---------- Shell ---------- */
.app { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w);
  background: var(--surface-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
  overflow-y: auto; overscroll-behavior: contain;
}
.rail-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px 20px; }
.wordmark { display: flex; flex-direction: column; gap: 5px; color: var(--ink); text-decoration: none; }
.wordmark:hover { color: var(--ink); text-decoration: none; }
.wordmark-name { font-family: var(--serif); font-size: 1.32rem; font-weight: var(--heading-weight); letter-spacing: -0.01em; line-height: 1.1; }
.wordmark-product { display: flex; align-items: flex-start; gap: 8px; line-height: 1.5; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-ink); }
.wordmark-product::before { content: ""; flex: none; width: 22px; height: 1px; margin-top: 0.75em; background: var(--gold); }
.wordmark-inverse, .wordmark-inverse:hover { color: var(--band-fg); }
.wordmark-mark { display: inline-block; vertical-align: -3px; margin-right: 7px; }
.wordmark-sub { font-size: 0.7rem; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--band-muted); }
.wordmark-dot { color: var(--gold); }
.rail-close, .menu-button { display: none; }

.rail-primary { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 1px; }
.rail-primary form { margin: 0; }
.rail-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border: 0; background: none; border-radius: 8px;
  font: inherit; font-size: 0.9rem; color: var(--ink-2); text-decoration: none; cursor: pointer; text-align: left;
}
.rail-link:hover { background: var(--sunk); color: var(--ink); }
.rail-link.active { background: var(--sunk); color: var(--ink); font-weight: 500; }
.rail-icon { width: 22px; height: 22px; flex: 0 0 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.rail-new { color: var(--ink); font-weight: 500; }
.rail-icon-plus { background: var(--ink); color: #fff; border-radius: 50%; }
.rail-new:hover .rail-icon-plus { background: var(--gold); }
.rail-more summary { list-style: none; }
.rail-more summary::-webkit-details-marker { display: none; }
.rail-sub { display: flex; flex-direction: column; padding: 2px 0 6px 42px; }
.rail-sub a { font-size: 0.86rem; color: var(--ink-2); text-decoration: none; padding: 4px 8px; border-radius: 6px; }
.rail-sub a:hover { background: var(--sunk); color: var(--ink); }
.rail-sub a.active { color: var(--ink); font-weight: 500; background: var(--sunk); }

.rail-recents { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 10px 16px; border-top: 1px solid var(--line); scrollbar-width: thin; }
.rail-heading { font-size: 0.76rem; font-weight: 500; color: var(--muted); padding: 4px 10px 6px; margin: 0; }
.rail-chat {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 8px;
  font-size: 0.88rem; color: var(--ink-2); text-decoration: none;
}
.rail-chat:hover { background: var(--sunk); color: var(--ink); }
.rail-chat.active { background: var(--sunk); color: var(--ink); font-weight: 500; }
.rail-chat-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-chat-code { font-family: var(--mono); font-size: 0.66rem; color: var(--muted); flex: 0 0 auto; }
.rail-empty { font-size: 0.84rem; color: var(--muted); padding: 2px 10px; margin: 0; }

.rail-foot {
  border-top: 1px solid var(--line); padding: 12px 16px;
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
}
.rail-actions { grid-column: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.pw-card { max-width: 460px; }
.pw-error { color: var(--red); font-size: 0.78rem; }
.rail-user { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.rail-user strong { font-size: 0.86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-user small { color: var(--muted); font-size: 0.75rem; }
.rail-user .rail-build { font-family: var(--mono); font-size: 0.66rem; margin-top: 2px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; font-size: 0.75rem; font-weight: 600;
}
.avatar-small { width: 22px; height: 22px; font-size: 0.6rem; background: var(--sunk); color: var(--ink); }
.link-button {
  background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer;
  font: inherit; font-size: 0.82rem; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px;
}
.link-button:hover { text-decoration-color: var(--gold); }
.rail-foot .link-button { color: var(--muted); font-size: 0.76rem; }
.rail-scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; flex: 0 0 56px; display: flex; align-items: center; gap: 16px;
  padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { flex: 1; min-width: 0; font-size: 0.9rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumb-sep { margin: 0 8px; color: var(--line-strong); }
.page-chat .topbar { border-bottom-color: transparent; }
.page-chat .crumbs { color: var(--ink); font-weight: 500; }
.topbar-meta { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted); }
.notification-bell { display: inline-flex; align-items: center; gap: 2px; padding: 6px; color: var(--muted); text-decoration: none; }
.notification-bell:hover, .notification-bell.active { color: var(--ink); }
.notification-bell:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.notification-unread td:first-child { font-weight: 600; }
.content { padding: 36px 40px 64px; max-width: 1360px; width: 100%; margin: 0 auto; }

/* ---------- Page heads ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head h1 { margin-bottom: 6px; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-ink); }
.eyebrow::before { content: ""; flex: none; width: 28px; height: 1px; background: var(--gold); }
.lede { font-family: var(--reading); color: var(--muted); max-width: 64ch; margin-bottom: 0; font-size: 1rem; }
.head-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; font-size: 0.86rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.week-nav { display: flex; align-items: center; gap: 10px; }
.week-label { font-size: 0.86rem; font-weight: 500; color: var(--muted); white-space: nowrap; }

/* ---------- Buttons: square, black primary, outlined secondary ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--ink); background: var(--surface); color: var(--ink);
  padding: 9px 16px; border-radius: var(--btn-radius); font: inherit; font-size: 0.88rem; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--ink); color: #fff; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; color: #fff; box-shadow: inset 0 -2px 0 var(--gold); }
.btn-outline { border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--ink); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: transparent; border-color: transparent; color: var(--red); }
.btn-small { padding: 5px 11px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.text-link { font-size: 0.86rem; font-weight: 500; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; min-width: 0; }
.card-head h2, .stack > .card > h2 { font-family: var(--serif); font-size: 1.2rem; font-weight: var(--heading-weight); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.card-head h2 { margin-bottom: 0; }
.card-head p { margin-bottom: 0; font-size: 0.83rem; }
.split { display: grid; gap: 20px; }
.split-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* Stats sit on one ruled strip rather than four floating cards. */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 22px; overflow: hidden;
}
.stat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { padding: 16px 20px; border-left: 1px solid var(--line); }
.stat-card:first-child { border-left: 0; }
.stat-label { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 500; }
.stat-card strong { display: block; font-family: var(--serif); font-size: 2.2rem; font-weight: var(--heading-weight); letter-spacing: -0.01em; line-height: 1.15; margin: 4px 0 2px; font-variant-numeric: lining-nums tabular-nums; }
.stat-card small { color: var(--muted); font-size: 0.8rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.table th {
  text-align: left; font-size: 0.78rem; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap;
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table-compact th, .table-compact td { padding: 8px 9px; }
.row-actions { text-align: right; }
.table td.mono { word-break: break-all; min-width: 140px; }
.table td.actions-cell { flex-wrap: nowrap; }
.project-link { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.project-link:hover { color: var(--accent); text-decoration: none; }
.project-link span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.project-link small { color: var(--muted); font-weight: 400; font-size: 0.76rem; }
.project-code {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500; color: var(--gold-ink);
  background: var(--gold-soft); border-radius: 4px; padding: 2px 6px; white-space: nowrap;
}
.progress-row { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.progress { height: 6px; background: var(--sunk); border-radius: 3px; overflow: hidden; flex: 1; }
.progress span { display: block; height: 100%; background: var(--gold); }
.progress-large { height: 9px; margin: 9px 0; }
.progress-row small { color: var(--muted); font-size: 0.74rem; min-width: 34px; text-align: right; }

/* ---------- Badges and status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 9px 2px 8px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-on_track, .badge-at_risk, .badge-blocked { padding-left: 7px; }
.badge-on_track::before, .badge-at_risk::before, .badge-blocked::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.badge-on_track { background: var(--green-soft); color: var(--green); }
.badge-at_risk { background: var(--amber-soft); color: var(--amber); }
.badge-blocked { background: var(--red-soft); color: var(--red); }
.badge-soft { background: var(--sunk); color: var(--ink-2); }
.status { display: inline-flex; align-items: center; border-radius: 4px; padding: 1px 7px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.status-not_started, .status-draft { background: var(--sunk); color: var(--ink-2); }
.status-in_progress { background: var(--gold-soft); color: var(--gold-ink); }
.status-blocked, .status-rejected { background: var(--red-soft); color: var(--red); }
.status-complete, .status-approved { background: var(--green-soft); color: var(--green); }
.status-submitted { background: var(--amber-soft); color: var(--amber); }
.chip {
  display: inline-flex; align-items: center; border-radius: 4px; padding: 1px 7px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  font-size: 0.74rem; font-weight: 500; white-space: nowrap;
}
.chip-commitment { background: var(--surface); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
ol.list, ul.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-item:last-child { border-bottom: 0; }
.backlog-item { flex-wrap: wrap; }
.backlog-item .list-body { flex: 1 1 100%; }
.backlog-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.burndown { margin: 0 0 12px; }
.burndown-chart { width: 100%; max-width: 480px; height: auto; display: block; margin: 10px 0 4px; }
.burndown-axis { stroke: var(--line); stroke-width: 1; }
.burndown-ideal { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.burndown-actual { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.burndown-key { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin: 0 4px 0 10px; }
.burndown-key:first-child { margin-left: 0; }
.burndown-key-actual { border-top: 2.5px solid var(--accent); }
.burndown-key-ideal { border-top: 1.5px dashed var(--muted); }
a.list-item:hover { color: var(--accent); text-decoration: none; }
.list-icon, .doc-icon {
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600;
}
.list-icon { background: var(--gold-soft); color: var(--gold-ink); }
.doc-icon { background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.list-body { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.list-body strong { font-size: 0.87rem; font-weight: 600; }
.list-body small { color: var(--muted); font-size: 0.77rem; }
.dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--gold); }
.empty { color: var(--muted); font-size: 0.87rem; padding: 10px 0; margin: 0; }

/* ---------- Forms ---------- */
.composer { margin-bottom: 18px; }
.composer summary { list-style: none; width: fit-content; }
.composer summary::-webkit-details-marker { display: none; }
.composer[open] summary { margin-bottom: 12px; }
.composer-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field[hidden] { display: none; }
.watcher-findings { margin: 4px 0 0; padding-left: 18px; }
.field-wide { grid-column: span 2; }
.field label, .field-row label { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field input, .field select, .field textarea, .run-starter select, .reject-form input, .login-form input, .inline-form input[type="date"] {
  width: 100%; font: inherit; font-size: 0.88rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 7px 10px;
}
.field textarea { resize: vertical; }
/* Checkboxes and radios inside a field keep their own size instead of the text-input width above. */
.field input[type="checkbox"], .field input[type="radio"] { width: auto; padding: 0; border: 0; border-radius: 0; background: none; align-self: flex-start; }
.field input:focus, .field select:focus, .field textarea:focus, .run-starter select:focus,
.reject-form input:focus, .login-form input:focus, .hours-input:focus, .inline-form input:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus-ring);
}
.field-hint { font-size: 0.8rem; color: var(--muted); margin: 0 0 7px; }
.field-error { font-size: 0.8rem; color: var(--red); margin: 0; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--red); }
.field-hint-link { font-size: 0.8rem; margin-top: 2px; }
.composer-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.stack-form { display: flex; flex-direction: column; gap: 16px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.source-picker { display: flex; flex-direction: column; gap: 7px; }
.source-option { display: flex; align-items: flex-start; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.source-option:hover { border-color: var(--line-strong); background: var(--surface-2); }
.source-option:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.source-option input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.source-option span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.source-option strong { font-size: 0.85rem; font-weight: 600; }
.source-option small { color: var(--muted); font-size: 0.76rem; }
.run-starter { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.run-starter h2 { margin-bottom: 2px; }
.run-starter-control { display: flex; align-items: center; gap: 10px; min-width: 320px; }
.run-starter-control label { font-size: 0.8rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.run-starter-control select { max-width: 260px; }
.steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.87rem; }
.steps li { margin-bottom: 7px; }
.muted-card { background: var(--surface-2); border-color: transparent; }
.muted-card p { color: var(--muted); font-size: 0.87rem; margin-bottom: 0; }
.check-line { display: flex; align-items: flex-start; gap: 8px; font-size: 0.87rem; font-weight: 500; color: var(--ink-2); }
.check-line input { flex: none; margin-top: 3px; }
.field .check-line { font-size: 0.87rem; font-weight: 500; }
.check-row { display: flex; gap: 18px; align-items: center; font-size: 0.87rem; flex-wrap: wrap; }
.check-row label { display: flex; gap: 6px; align-items: center; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; scrollbar-width: thin; }
.kanban-col { flex: 0 0 288px; background: var(--sunk); border-radius: var(--r); padding: 10px; min-height: 420px; }
.kanban-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.kanban-head h2 { font-family: var(--sans); font-size: 0.86rem; color: var(--ink-2); margin: 0; }
.count { font-size: 0.74rem; font-weight: 600; color: var(--muted); background: var(--surface); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: var(--r-sm); }
.kanban-cards.drag-over { background: color-mix(in srgb, var(--gold) 8%, transparent); outline: 2px dashed color-mix(in srgb, var(--gold) 50%, transparent); outline-offset: 2px; }
.task-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 11px 9px; cursor: grab; }
.task-card:hover { border-color: var(--line-strong); }
.task-card.dragging { opacity: 0.45; cursor: grabbing; }
.task-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.task-code { font-family: var(--mono); font-size: 0.7rem; color: var(--gold-ink); }
.priority { font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.priority-high, .priority-critical { color: var(--red); }
.task-title { display: block; color: var(--ink); font-weight: 500; font-size: 0.88rem; line-height: 1.35; margin-bottom: 8px; }
.task-title:hover { color: var(--accent); }
.task-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.75rem; color: var(--muted); }
.person { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.due.overdue { color: var(--red); font-weight: 600; }
.task-foot { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.task-blocked { margin-top: 8px; font-size: 0.76rem; color: var(--red); background: var(--red-soft); border-radius: 4px; padding: 4px 7px; }
.kanban-empty { border: 1px dashed var(--line-strong); border-radius: var(--r-sm); padding: 18px 10px; text-align: center; color: var(--muted); font-size: 0.8rem; }
.board-note { margin-top: 16px; font-size: 0.82rem; color: var(--muted); }

/* ---------- Timesheet ---------- */
.timesheet-card { padding: 0; overflow: hidden; }
.timesheet { width: 100%; border-collapse: collapse; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.timesheet th, .timesheet td { border-bottom: 1px solid var(--line); padding: 8px 7px; text-align: center; }
.timesheet thead th { background: var(--surface-2); font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.timesheet thead th span { display: block; }
.timesheet thead th small { font-weight: 400; color: var(--muted); }
.timesheet .task-col { text-align: left; min-width: 230px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.timesheet thead .task-col { background: var(--surface-2); }
.timesheet .task-col a { display: inline-block; margin-right: 6px; font-family: var(--mono); font-size: 0.78rem; }
.timesheet .task-col span { display: block; font-weight: 500; }
.timesheet .task-col small { display: block; color: var(--muted); font-size: 0.74rem; }
.timesheet .total-col { background: var(--surface-2); font-weight: 600; }
.timesheet tfoot td { background: var(--surface-2); border-bottom: 0; }
.timesheet .today { background: var(--gold-soft); }
.hours-input { width: 54px; padding: 5px 4px; text-align: center; border: 1px solid var(--line-strong); border-radius: 4px; font: inherit; font-size: 0.84rem; background: var(--surface); }
.locked-hours { display: inline-block; min-width: 42px; padding: 4px 6px; border-radius: 4px; background: var(--sunk); color: var(--ink-2); font-weight: 600; }
.timesheet-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.actions { display: flex; gap: 8px; }

/* ---------- Prompt output and prose ---------- */
.draft-card { padding: 0; overflow: hidden; }
.draft-note { background: var(--amber-soft); color: #6a460c; font-size: 0.84rem; padding: 10px 22px; border-bottom: 1px solid #ecd6ab; }
.draft-section { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.draft-section:last-child { border-bottom: 0; }
.draft-section h2 { font-family: var(--serif); font-weight: var(--heading-weight); font-size: 1.1rem; color: var(--ink); margin-bottom: 8px; }
.validation-section { background: #fbf6ea; }
.prose { font-family: var(--reading); font-size: 0.97rem; line-height: 1.7; max-width: 72ch; }
.prose p { margin: 0 0 10px; }
.prose ul, .prose ol { margin: 0 0 10px; padding-left: 22px; }
.prose li { margin-bottom: 4px; }
.prose strong { font-weight: 600; }
.prose blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.prose h1, .prose h2, .prose h3 { font-family: var(--serif); font-weight: var(--heading-weight); line-height: 1.2; margin: 18px 0 8px; }
.prose h1 { font-size: 1.3rem; }
.prose h2 { font-size: 1.12rem; }
.prose h3 { font-size: 1rem; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 14px; font-family: var(--sans); font-size: 0.84rem; line-height: 1.45; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.prose th { background: var(--sunk); font-weight: 600; }

/* ---------- Services on a project ---------- */
.service-list { display: grid; gap: 14px; }
.service-item { border: 1px solid var(--line); border-left: 3px solid var(--gold); padding: 14px 16px; }
.service-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.service-item h3 { font-family: var(--serif); font-weight: var(--heading-weight); font-size: 1.05rem; margin: 0 0 2px; }
.service-item-head p { margin: 0; font-size: 0.82rem; }
.service-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px; margin: 12px 0 0; font-size: 0.85rem; }
.service-facts dt { color: var(--muted); font-size: 0.75rem; }
.service-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.service-brief { margin-top: 12px; }
.service-brief summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; }
.service-brief summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.service-brief .prose { margin-top: 10px; max-height: 32rem; overflow-y: auto; padding-right: 6px; }
.meta-list { margin: 0; display: flex; flex-direction: column; gap: 9px; }
.meta-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.meta-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.meta-list dt { color: var(--muted); font-size: 0.8rem; }
.meta-list dd { margin: 0; font-size: 0.84rem; font-weight: 600; text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Budget, callouts, detail ---------- */
.budget-row { display: flex; align-items: center; justify-content: space-between; font-size: 0.84rem; color: var(--muted); }
.budget-row strong { color: var(--ink); }
.budget-split { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 0.78rem; color: var(--muted); }
.budget-split strong { color: var(--ink); }
.budget-cost { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.budget-cost .field-hint { margin: 6px 0 0; }
.budget-forecast { display: grid; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.budget-forecast .field-hint, .budget > .field-hint { margin: 0; }
.callout { display: flex; flex-direction: column; gap: 2px; border-radius: var(--r-sm); padding: 9px 12px; margin-top: 12px; font-size: 0.85rem; border-left: 3px solid currentColor; }
.callout strong { font-size: 0.8rem; font-weight: 600; }
.callout-warn { background: var(--red-soft); color: var(--red); }
.callout-ok { background: var(--green-soft); color: var(--green); }
.detail-grid { display: grid; gap: 16px; }
.detail-grid .label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.detail-grid p { margin: 0; }
.actions-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form input[type="date"] { width: auto; padding: 4px 7px; font-size: 0.82rem; }
.reject-form input { width: 120px; padding: 4px 7px; font-size: 0.8rem; }

/* ---------- Studio, library, connectors ---------- */
.prompt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.prompt-item { align-items: flex-start; }
.prompt-item .btn { margin-left: auto; }
.roadmap { display: flex; flex-direction: column; gap: 11px; }
.roadmap-item { display: flex; gap: 9px; align-items: flex-start; font-size: 0.86rem; }
.roadmap-item span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.roadmap-item small { color: var(--muted); font-size: 0.77rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 9px; }
.status-dot-next { background: var(--line-strong); }
.library-grid, .connector-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.library-card, .connector-card { display: flex; flex-direction: column; gap: 8px; }
.library-card-head { display: flex; gap: 10px; align-items: flex-start; }
.library-card h2, .connector-head h2 { font-size: 0.98rem; margin: 0; }
.library-card p, .connector-card p { font-size: 0.86rem; color: var(--muted); margin: 0; }
.library-details summary, .inline-details summary, .context-details summary { font-size: 0.82rem; font-weight: 500; color: var(--accent); cursor: pointer; }
.library-details pre, .inline-details pre, .context-details pre {
  max-height: 260px; overflow: auto; white-space: pre-wrap; font-family: var(--mono); font-size: 0.72rem; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px; margin-top: 6px;
}
.library-card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.connector-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.connector-foot { margin-top: auto; }
.connector-note { margin-top: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.three-col strong { font-size: 0.84rem; }
.three-col p { font-size: 0.84rem; color: var(--muted); margin: 3px 0 0; }
.plain-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.86rem; }
.plain-list li { margin-bottom: 5px; }
/* Record discussions (#141): one comment per row, oldest first. */
.discussion-list { list-style: none; margin: 0 0 16px; padding: 0; }
.discussion-comment { border-bottom: 1px solid var(--line); padding: 10px 0; }
.discussion-comment p { margin: 0; overflow-wrap: anywhere; }
.discussion-meta { margin-bottom: 4px; font-size: 0.86rem; }

/* ---------- Documents ---------- */
.doc-filters, .list-filters { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.doc-filters .field, .list-filters .field { min-width: 150px; }
.doc-filters .field-grow, .list-filters .field-grow { flex: 1; min-width: 220px; }
.list-filters { margin-bottom: 16px; }
/* Sales filters: keep the search field wide enough for its hint at desktop and let it wrap on a phone. */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-bar input[name="q"] { flex: 1 1 280px; min-width: 200px; }
.filter-bar select { flex: 0 0 auto; }
.card-flush { padding: 4px 8px; }
.doc-link { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; min-width: 240px; }
.doc-link:hover { text-decoration: none; }
.doc-link:hover strong { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.doc-link span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.doc-link strong { font-weight: 500; }
.doc-link small { color: var(--muted); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; }
.doc-table .doc-icon, .list .doc-icon { width: 36px; flex-basis: 36px; font-size: 0.6rem; letter-spacing: 0.02em; font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.wrap { word-break: break-word; text-align: right; }
.doc-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 500; white-space: nowrap; }
.doc-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.doc-status-approved { color: var(--green); }
.doc-status-pending { color: var(--amber); }
.doc-status-superseded { color: var(--muted); }
.doc-status-superseded::before { background: transparent; border: 1px solid currentColor; }
.doc-status-ocr-pending { color: var(--muted); }
.doc-status-ocr-pending::before { background: transparent; border: 1px dashed currentColor; }
.doc-status-ocr-done { color: var(--green); }
.doc-status-ocr-failed { color: var(--red); }
.doc-status-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.row-actions .inline-form + .btn, .row-actions .btn + .inline-form { margin-left: 6px; }
.ocr-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.ocr-state p { margin: 0; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer;
  border: 1px dashed var(--line-strong); background: var(--surface-2); padding: 22px 14px; position: relative;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--gold); background: var(--gold-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-text { font-size: 0.92rem; }
.dropzone small { color: var(--muted); font-size: 0.76rem; }
.dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid-3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.approve-line { margin-top: 2px; }
.notice { border-left: 3px solid var(--line-strong); background: var(--surface-2); padding: 10px 14px; margin: -8px 0 22px; font-size: 0.9rem; color: var(--ink-2); }
.notice-pending { border-left-color: var(--amber); background: var(--amber-soft); color: #5f420c; }
.callout-pending { display: block; background: var(--amber-soft); color: var(--amber); text-decoration: none; margin: 0 0 8px; }
.doc-text {
  white-space: pre-wrap; word-break: break-word; font-family: var(--sans); font-size: 0.88rem; line-height: 1.65;
  background: var(--surface-2); border: 1px solid var(--line); padding: 16px 18px; max-height: 560px; overflow: auto; margin: 0;
}
.doc-notes { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--ink-2); }
.edit-details summary { list-style: none; cursor: pointer; }
.edit-details summary::-webkit-details-marker { display: none; }
.edit-details summary h2 { display: inline; }
.edit-details summary::after { content: "Show"; float: right; font-size: 0.8rem; color: var(--muted); }
.edit-details[open] summary::after { content: "Hide"; }
.edit-details[open] summary { margin-bottom: 14px; }
.btn-danger-text { color: var(--red); padding-left: 0; }
.is-current-row td { background: var(--surface-2); }
.meta-list dd a { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }

.owner-card h2 { font-family: var(--serif); font-size: 1.2rem; font-weight: var(--heading-weight); margin-bottom: 14px; }
.owner-current { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.owner-current .avatar { width: 40px; height: 40px; font-size: 0.85rem; }
.avatar-empty { background: var(--sunk); color: var(--muted); border: 1px dashed var(--line-strong); }
.owner-name { display: flex; flex-direction: column; line-height: 1.3; }
.owner-name strong { font-size: 1rem; font-weight: 600; }
.owner-name small { color: var(--muted); font-size: 0.8rem; }
.owner-form { display: flex; gap: 8px; }
.team-list { list-style: none; padding-left: 0; margin-bottom: 12px; color: var(--ink); }
.team-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.owner-form select {
  flex: 1; min-width: 0; font: inherit; font-size: 0.88rem; padding: 7px 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.task-edit { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.assign-form { display: flex; align-items: flex-end; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.assign-form .field { flex: 1; min-width: 160px; }
.task-edit summary span { font-size: 0.88rem; font-weight: 500; }
.approver-note { margin: 0 0 14px; }
/* ---------- Governance ---------- */
.profile-chip { font-size: 0.8rem; font-weight: 500; padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--ink-2); text-decoration: none; }
.profile-chip:hover { border-color: var(--ink); text-decoration: none; }
.profile-strict { border-color: var(--ink); color: var(--ink); }
.profile-light { border-style: dashed; }
.profile-picker { border: 0; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profile-option { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); padding: 12px 14px; cursor: pointer; }
.profile-option:hover { border-color: var(--line-strong); background: var(--surface-2); }
.profile-option:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 -2px 0 var(--gold); }
.profile-option input { margin-top: 4px; accent-color: var(--ink); }
.profile-option span { display: flex; flex-direction: column; gap: 3px; line-height: 1.35; }
.profile-option strong { font-family: var(--serif); font-size: 1.05rem; font-weight: var(--heading-weight); }
.profile-option small { color: var(--muted); font-size: 0.8rem; }
.rule-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); margin-bottom: 14px; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.rule-row label, .rule-row > span:first-child { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.rule-row strong { font-size: 0.9rem; font-weight: 500; }
.rule-row small { color: var(--muted); font-size: 0.78rem; }
.rule-control { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
.rule-control select { font: inherit; font-size: 0.86rem; padding: 6px 8px; border: 1px solid var(--line-strong); background: var(--surface); min-width: 220px; }
.rule-flag { font-size: 0.72rem; color: var(--gold-ink); }
.rule-locked strong { color: var(--ink-2); }
.rule-lock { font-size: 0.8rem; color: var(--green); font-weight: 500; white-space: nowrap; }
@media (max-width: 900px) {
  .profile-picker { grid-template-columns: 1fr; }
  .rule-row { flex-direction: column; align-items: stretch; }
  .rule-control { align-items: stretch; }
  .rule-control select { min-width: 0; width: 100%; }
}

/* ---------- Gantt ---------- */
.gantt-legend, .resource-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.8rem; color: var(--muted); margin: -8px 0 14px; }
.gantt-legend span, .resource-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 18px; height: 9px; display: inline-block; }
.lg-not_started { background: var(--surface); border: 1px solid var(--line-strong); }
.lg-in_progress { background: var(--gold); }
.lg-blocked { background: var(--red); }
.lg-complete { background: var(--green); }
.lg-overdue { background: var(--surface); border: 2px solid var(--red); }
.lg-holiday { background: repeating-linear-gradient(45deg, var(--sunk) 0 3px, transparent 3px 6px); border: 1px solid var(--line); }
.lg-diamond { width: 9px; height: 9px; background: var(--ink); transform: rotate(45deg); display: inline-block; }
.lg-diamond-base { background: var(--surface); border: 1.5px solid var(--ink); }
.gantt-card { padding: 0; overflow-x: auto; }
.gantt { min-width: 960px; --label: 300px; }
.gantt-head { display: grid; grid-template-columns: var(--label) 1fr; border-bottom: 1px solid var(--line-strong); position: sticky; top: 0; background: var(--surface); z-index: 3; }
.gantt-corner { display: flex; align-items: flex-end; padding: 8px 14px; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.gantt-months, .gantt-weeks { display: flex; }
.gantt-months span { padding: 7px 8px 2px; font-size: 0.8rem; font-weight: 600; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; }
.gantt-weeks span { flex: 1; padding: 2px 6px 6px; font-size: 0.72rem; color: var(--muted); border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.gantt-body { position: relative; }
.gantt-overlay { position: absolute; top: 0; bottom: 0; left: var(--label); right: 0; pointer-events: none;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / var(--weeks)) 100%; opacity: 0.7; }
.gantt-holiday { position: absolute; top: 0; bottom: 0; width: calc(100% / var(--weeks) / 7); background: repeating-linear-gradient(45deg, rgba(20,20,20,0.06) 0 3px, transparent 3px 6px); pointer-events: auto; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--gold); z-index: 2; }
.gantt-scale { position: relative; }
.gantt-today-label { position: absolute; bottom: 0; transform: translateX(-50%); font-size: 0.66rem; font-weight: 600; color: #fff; background: var(--gold); padding: 1px 5px; line-height: 1.3; }
.gantt-row { display: grid; grid-template-columns: var(--label) 1fr; border-bottom: 1px solid var(--line); min-height: 44px; position: relative; }
.gantt-row:hover .gantt-track { background: rgba(20,20,20,0.025); }

.gantt-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 14px; border-right: 1px solid var(--line); min-width: 0; background: var(--surface); position: relative; z-index: 3; }
.gantt-milestones .gantt-label { background: var(--surface-2); }
.gantt-task { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--ink); text-decoration: none; }
.gantt-task:hover .gantt-title { text-decoration: underline; text-decoration-color: var(--gold); }
.gantt-title { font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-people { display: inline-flex; flex: 0 0 auto; }
.gantt-people .avatar { margin-left: -3px; border: 2px solid var(--surface); }
.gantt-people .avatar:first-child { margin-left: 0; }
.avatar-owner { background: var(--ink); color: #fff; }
.gantt-track { position: relative; }
.gantt-bar {
  position: absolute; top: 11px; height: 22px; display: flex; align-items: center; padding: 0 8px; min-width: 6px;
  font-size: 0.72rem; color: #fff; text-decoration: none; overflow: hidden; white-space: nowrap; z-index: 1;
}
.gantt-bar:hover { text-decoration: none; color: #fff; filter: brightness(1.08); }
.gantt-bar span { overflow: hidden; text-overflow: ellipsis; }
.bar-not_started { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-2); }
.bar-not_started:hover { color: var(--ink); }
.bar-in_progress { background: var(--gold); }
.bar-blocked { background: var(--red); }
.bar-complete { background: var(--green); }
.gantt-row-summary .gantt-title { font-weight: 600; }
.gantt-bar.bar-summary { top: 18px; height: 8px; padding: 0; }
.gantt-bar.bar-summary span { display: none; }
.bar-overdue { box-shadow: inset 0 0 0 2px var(--red); }
.bar-in_progress.bar-overdue, .bar-complete.bar-overdue { box-shadow: 0 0 0 2px var(--red); }
.cut-left { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 2px dashed rgba(255,255,255,0.8); }
.cut-right { border-right: 2px dashed rgba(255,255,255,0.8); }
.gantt-milestones { min-height: 40px; }
.gantt-diamond { position: absolute; top: 14px; width: 12px; height: 12px; margin-left: -6px; transform: rotate(45deg); background: var(--ink); z-index: 1; }
.gantt-diamond-baseline { background: var(--surface); border: 1.5px solid var(--ink); }
.gantt-diamond em { position: absolute; transform: rotate(-45deg); left: 14px; top: -6px; font-style: normal; font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.gantt-empty { padding: 24px; color: var(--muted); font-size: 0.9rem; }

/* ---------- Resources ---------- */
.resource-controls { margin-bottom: 18px; }
.resource-controls .page-actions { margin-left: auto; }
.rl { width: 14px; height: 14px; display: inline-block; border: 1px solid var(--line); }
.rl-open { background: var(--surface); }
.rl-light { background: var(--heat-1); }
.rl-busy { background: var(--heat-2); }
.rl-full { background: var(--heat-3); }
.rl-over { background: var(--red-soft); border-color: var(--red); }
.rl-proj { font-family: var(--mono); font-size: 0.72rem; color: var(--gold-ink); }
.resource-grid { width: 100%; border-collapse: collapse; font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.resource-grid th, .resource-grid td { border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 8px 9px; text-align: left; vertical-align: top; }
.resource-grid thead th { font-size: 0.76rem; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom-color: var(--line-strong); }
.resource-grid .rg-person { border-left: 0; min-width: 190px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.resource-grid tbody .rg-person { display: table-cell; }
.rg-person strong { display: block; font-weight: 500; }
.rg-person small { display: block; color: var(--muted); font-size: 0.74rem; font-weight: 400; }
.rg-now { box-shadow: inset 0 2px 0 var(--gold); }
.rg-cell { min-width: 92px; cursor: default; }
.rg-booked { display: block; font-weight: 600; }
.rg-booked small { font-weight: 400; color: var(--muted); font-size: 0.74rem; }
.rg-proj { display: block; font-family: var(--mono); font-size: 0.7rem; color: var(--gold-ink); }
.rg-off, .rg-pending { display: block; font-size: 0.7rem; color: var(--muted); }
.rg-pending { font-style: italic; }
.rg-light { background: var(--heat-soft-1); }
.rg-busy { background: var(--heat-soft-2); }
.rg-full { background: var(--heat-soft-3); }
.rg-over { background: var(--red-soft); }
.rg-over .rg-booked { color: var(--red); }
.sg-over { display: block; font-size: 0.7rem; font-weight: 600; color: var(--red); }
.person-skills { border-top: 1px solid var(--line); padding: 10px 0; }
.person-skills fieldset { border: 0; padding: 0; margin: 0; }
.rg-off.rg-cell, .rg-cell.rg-off { background: repeating-linear-gradient(45deg, var(--sunk) 0 4px, transparent 4px 8px); }

/* ---------- My work ---------- */
.mywork-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.mywork-add { margin: 0; }
.mywork-add[open] { flex-basis: 100%; }
.task-private { background: var(--surface-2); border-style: dashed; }
.private-tag { font-size: 0.72rem; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.private-notes { font-size: 0.78rem; color: var(--ink-2); margin: -4px 0 6px; }
.private-edit summary { font-size: 0.76rem; color: var(--muted); cursor: pointer; }
.private-edit[open] summary { margin-bottom: 8px; }
.private-edit .field label { font-size: 0.74rem; }
.private-edit input, .private-edit select, .private-edit textarea { font-size: 0.8rem; padding: 5px 7px; }
.private-actions { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.chip-owner { border-color: var(--ink); color: var(--ink); }

/* ---------- RACI ---------- */
.raci-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.82rem; color: var(--muted); margin: -6px 0 16px; }
.raci-legend span { display: inline-flex; align-items: center; gap: 7px; }
.raci-chip { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; font-size: 0.78rem; font-weight: 700; font-family: var(--sans); }
.raci-A { background: var(--ink); color: #fff; }
.raci-R { background: var(--gold); color: #fff; }
.raci-C { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.raci-I { background: var(--sunk); color: var(--ink-2); }
.raci-AR { background: linear-gradient(135deg, var(--ink) 50%, var(--gold) 50%); color: #fff; }
.raci-chip.raci-AR { width: auto; min-width: 24px; padding: 0 5px; font-size: 0.7rem; }
.raci-card { overflow: hidden; }
.raci-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.raci-table th, .raci-table td { border-bottom: 1px solid var(--line); padding: 8px 6px; }
.raci-table thead th { vertical-align: bottom; border-bottom-color: var(--line-strong); }
.raci-activity-col { text-align: left; min-width: 280px; position: sticky; left: 0; background: var(--surface); z-index: 1; padding-left: 14px !important; }
.raci-table tbody .raci-activity-col { display: table-cell; }
.raci-activity { display: inline-flex; flex-direction: column; line-height: 1.35; max-width: 340px; vertical-align: middle; }
.raci-activity strong { font-weight: 500; }
.raci-activity small { color: var(--muted); font-size: 0.76rem; font-weight: 400; }
.raci-activity .raci-warn { color: var(--red); font-weight: 500; }
.raci-row-actions { float: right; display: inline-flex; gap: 2px; opacity: 0; transition: opacity 120ms; }
tr:hover .raci-row-actions, .raci-row-actions:focus-within { opacity: 1; }
.raci-row-actions button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 0.9rem; padding: 2px 5px; }
.raci-row-actions button:hover { color: var(--ink); }
.raci-person { text-align: center; min-width: 96px; max-width: 130px; font-weight: 500; }
.raci-person .raci-name { display: block; font-size: 0.82rem; line-height: 1.25; }
.raci-person small { display: block; font-size: 0.7rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.raci-remove { border: 0; background: none; color: var(--muted); font-size: 0.68rem; cursor: pointer; text-decoration: underline; padding: 2px 0 0; }
.raci-remove:hover { color: var(--red); }
.raci-customer { background: var(--surface-2); }
.raci-split { border-left: 2px solid var(--line-strong) !important; }
.raci-groups th { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 6px !important; background: var(--surface); }
.raci-customer-head { background: var(--surface-2) !important; }
.raci-phase th { text-align: left; background: var(--surface-2); font-family: var(--serif); font-weight: var(--heading-weight); font-size: 0.98rem; padding: 7px 14px !important; }
.raci-cell { text-align: center; }
.raci-problem .raci-activity-col { box-shadow: inset 3px 0 0 var(--red); }
.raci-select {
  appearance: none; width: 40px; height: 30px; text-align: center; text-align-last: center; font: inherit; font-weight: 700; font-size: 0.82rem;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; padding: 0;
}
.raci-select:hover { border-color: var(--line-strong); }
.raci-select:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.raci-select.raci-A { background: var(--ink); color: #fff; border-color: var(--ink); }
.raci-select.raci-R { background: var(--gold); color: #fff; border-color: var(--gold); }
.raci-select.raci-C { box-shadow: inset 0 0 0 1px var(--ink); border-color: var(--ink); }
.raci-select.raci-I { background: var(--sunk); color: var(--ink-2); }
.raci-select.raci-AR { background: linear-gradient(135deg, var(--ink) 50%, var(--gold) 50%); color: #fff; border-color: var(--ink); font-size: 0.72rem; }
.raci-select option { background: var(--surface); color: var(--ink); }
.raci-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); margin-bottom: 18px; }
.raci-savebar.is-dirty #raci-dirty { color: var(--gold-ink); font-weight: 500; }
.raci-empty p { color: var(--muted); max-width: 70ch; }
.raci-add { margin-top: 8px; }

/* ---------- Flash messages ---------- */
.messages { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.message { border-radius: var(--r-sm); padding: 9px 12px; font-size: 0.86rem; border: 1px solid var(--line); background: var(--surface); }
.message-success { background: var(--green-soft); border-color: #bfdcc9; color: var(--green); }
.message-error { background: var(--red-soft); border-color: #eec4bb; color: var(--red); }
.message-info { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.message-warning { background: var(--amber-soft); border-color: #ecd6ab; color: var(--amber); }

/* ---------- Chat (home), modeled on the Claude layout ---------- */
.content-chat { max-width: none; padding: 0; margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.content-chat > .messages { margin: 16px 32px 0; }
.page-chat .main { height: 100vh; }

.chat-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 0; transition: grid-template-columns 180ms ease; }
.chat-layout.context-open { grid-template-columns: minmax(0, 1fr) 340px; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 32px 12px; }
.chat-thread { max-width: 740px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }

.chat-msg { display: flex; flex-direction: column; gap: 6px; }
.chat-msg.user { align-items: flex-end; }
.chat-msg.user .chat-bubble {
  max-width: 80%; background: var(--sunk); padding: 10px 16px; border-radius: 14px; font-size: 0.96rem;
}
.chat-msg.assistant .chat-bubble { font-size: 1rem; line-height: 1.72; color: var(--ink); }
.chat-msg.assistant .chat-bubble h1, .chat-msg.assistant .chat-bubble h2, .chat-msg.assistant .chat-bubble h3 {
  font-family: var(--serif); font-size: 1.18rem; font-weight: var(--heading-weight); margin: 20px 0 6px;
}
.chat-msg.assistant .chat-bubble > :first-child { margin-top: 0; }
.chat-msg.error .chat-bubble {
  font-size: 0.92rem; background: var(--red-soft); color: var(--red);
  border-left: 3px solid var(--red); padding: 10px 14px;
}
.chat-meta { font-size: 0.75rem; color: var(--muted); }
/* An action the AI Studio assistant proposed. Nothing runs until the person confirms it here. */
.chat-action {
  border: 1px solid var(--line-strong); border-left: 3px solid var(--gold); border-radius: var(--r-sm);
  background: var(--surface); padding: 14px 16px; font-size: 0.94rem;
}
.chat-action-title { margin: 0 0 8px; font-weight: 600; color: var(--ink); }
.chat-action-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0 0 10px; }
.chat-action-fields div { display: contents; }
.chat-action-fields dt { color: var(--muted); }
.chat-action-fields dd { margin: 0; overflow-wrap: anywhere; }
.chat-action-note { margin: 0 0 10px; font-size: 0.82rem; color: var(--muted); }
.chat-action-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-action-buttons form { margin: 0; }
.chat-action-error { margin: 10px 0 0; color: var(--red); font-size: 0.86rem; }
.chat-action-result { margin: 0; }
.chat-action-links { margin: 6px 0 0; padding-left: 20px; }
.chat-action.is-confirmed { border-left-color: var(--green); }
.chat-action.is-failed { border-left-color: var(--red); background: var(--red-soft); }
.chat-action.is-cancelled { border-left-color: var(--line-strong); color: var(--muted); }
@media (max-width: 640px) {
  .chat-action-fields { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .chat-action-fields dd { margin-bottom: 6px; }
}
.chat-bubble p { margin: 0 0 12px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol { margin: 0 0 12px; padding-left: 22px; }
.chat-bubble li { margin-bottom: 4px; }
.chat-bubble li::marker { color: var(--gold); }
.chat-bubble table { border-collapse: collapse; width: 100%; font-size: 0.88rem; margin: 12px 0; }
.chat-bubble th, .chat-bubble td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; vertical-align: top; }
.chat-bubble th { font-weight: 600; border-bottom-color: var(--ink); }
.chat-bubble code { font-family: var(--mono); background: var(--sunk); padding: 1px 4px; border-radius: 3px; font-size: 0.82em; }
.chat-bubble pre { background: var(--surface-2); border: 1px solid var(--line); padding: 12px; overflow-x: auto; }
.chat-bubble pre code { background: none; padding: 0; }
.chat-bubble blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 2px solid var(--gold); color: var(--ink-2); }
.chat-bubble a { text-decoration-color: var(--gold); }

.typing-dots { display: inline-flex; gap: 5px; padding: 8px 0; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); animation: pulse 1.1s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.35; } 40% { opacity: 1; background: var(--gold); } }

/* The dock holds the welcome, composer, and starters. Empty: centered on the page. In a conversation: pinned to the bottom. */
.chat-dock { padding: 8px 32px 18px; }
.chat-dock > * { max-width: 740px; margin-left: auto; margin-right: auto; }
.chat-welcome, .suggestions, .chat-empty-note { display: none; }
.is-empty .chat-messages { display: none; }
.is-empty .chat-dock { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: 12vh; }
.is-empty .chat-dock > * { width: 100%; }
.is-empty .chat-welcome { display: block; text-align: center; margin-bottom: 28px; }
.is-empty .suggestions { display: flex; }
.is-empty .chat-empty-note { display: block; text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: 18px; }
.chat-welcome h1 { font-size: clamp(2.2rem, 4.2vw, 3.2rem); font-weight: 400; line-height: 1.1; margin-bottom: 12px; }
.chat-welcome p { color: var(--muted); max-width: 54ch; margin: 0 auto; font-size: 1rem; }

.composer-box {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  padding: 14px 14px 10px 18px; box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 6px 22px rgba(20, 20, 20, 0.05);
}
.composer-box:focus-within { border-color: #b9b3a6; box-shadow: 0 0 0 3px var(--focus-ring), 0 6px 22px rgba(20, 20, 20, 0.06); }
.composer-box textarea {
  display: block; width: 100%; border: 0; outline: none; resize: none; background: transparent;
  font: inherit; font-size: 1rem; line-height: 1.55; padding: 2px 0 8px; min-height: 30px; max-height: 220px; color: var(--ink);
}
.is-empty .composer-box textarea { min-height: 56px; }
.composer-box textarea::placeholder { color: #9a978e; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.composer-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.pill, .pill-select {
  display: inline-flex; align-items: center; height: 30px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font: inherit; font-size: 0.8rem; color: var(--ink-2); cursor: pointer; white-space: nowrap; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis;
}
.pill:hover, .pill-select:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.pill-select { appearance: none; padding-right: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236b6a64' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 12px; }
/* The scope control shows and hides composer controls with the hidden attribute, which the display rules here would override. */
.chat-layout [hidden] { display: none !important; }
.pill-static { cursor: default; color: var(--muted); }
.pill-static:hover { background: var(--surface); border-color: var(--line); color: var(--muted); }
.pill-static.is-on { color: var(--green); border-color: #cfe3d5; background: var(--green-soft); }
.model-select {
  appearance: none; border: 0; background: transparent; font: inherit; font-size: 0.82rem; color: var(--muted);
  padding: 4px 22px 4px 6px; cursor: pointer; max-width: 200px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236b6a64' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 4px center; background-size: 12px;
}
.model-select:hover { color: var(--ink); }
.send-button {
  width: 34px; height: 34px; border: 0; border-radius: 9px; background: var(--ink); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.send-button:hover { background: var(--gold); }
.send-button:disabled { opacity: 0.4; cursor: progress; }
.composer-hint { font-size: 0.74rem; color: var(--muted); text-align: center; margin: 8px auto 0; }
.is-empty .composer-hint { display: none; }

.suggestions { flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.suggestion {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 7px 13px; font: inherit; font-size: 0.86rem; color: var(--ink-2); cursor: pointer;
}
.suggestion:hover { border-color: var(--ink); color: var(--ink); }

.chat-context {
  border-left: 1px solid var(--line); background: var(--surface-2); overflow-y: auto; min-width: 0;
  padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 16px; visibility: hidden;
}
/* A closed context panel still sat in the zero-width grid column, and its padding pushed the page 41px wide. */
.chat-layout:not(.context-open) .chat-context { padding-left: 0; padding-right: 0; border-left: 0; overflow: hidden; }
.context-open .chat-context { visibility: visible; }
.chat-context-head { display: flex; align-items: center; justify-content: space-between; }
.chat-context-head h2 { margin: 0; font-family: var(--serif); font-size: 1.25rem; font-weight: var(--heading-weight); }
.context-intro { font-size: 0.84rem; color: var(--muted); margin: -10px 0 0; }
.chat-context select { font-size: 0.86rem; padding: 7px 8px; }
.chat-source-picker { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.source-option.compact { padding: 8px 9px; gap: 8px; }
.source-option.compact strong { font-size: 0.83rem; }
.source-option.compact small { font-size: 0.73rem; }
.context-details { border-top: 1px solid var(--line); padding-top: 12px; }
.context-details > summary { cursor: pointer; font-weight: 500; }
.studio-form { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.studio-form label { font-size: 0.8rem; font-weight: 500; color: var(--ink-2); }
.studio-form textarea, .studio-form input[type=text], .studio-form select { width: 100%; }
.studio-form .btn { align-self: flex-start; margin-top: 4px; }
.studio-notes { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.studio-note { border-top: 1px solid var(--line); padding-top: 8px; font-size: 0.8rem; overflow-wrap: anywhere; }
.studio-note small { display: block; color: var(--muted); }
.studio-note form { margin-top: 4px; }

.crumb-title::before { content: "/ "; }

/* AI Studio landing page: the assistant card above the stat strips. */
.studio-assistant-card { margin-bottom: 18px; }
.studio-tools { margin: 0 0 22px; justify-content: flex-start; }
.studio-assistant-card .card-head { flex-wrap: wrap; align-items: center; }
.studio-assistant-card .card-head .btn { text-decoration: none; }
.studio-assistant-card h3 { font-size: 0.86rem; margin: 14px 0 6px; }

/* ---------- Login ---------- */
.login-body { background: var(--bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 16px; }
.login-shell { display: grid; grid-template-columns: 1.15fr 0.85fr; max-width: 980px; width: 100%; background: var(--surface); border: 1px solid var(--line); }
.login-brand { background: var(--band); color: var(--band-fg); padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.login-brand .wordmark-name { font-size: 1.5rem; }
.login-brand h1 { color: var(--band-fg); }
.login-brand p { color: var(--band-muted); }
.login-rule { display: flex; align-items: center; gap: 12px; margin: 34px 0 10px; color: var(--gold); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.login-rule::before { content: ""; width: 40px; height: 1px; background: var(--gold); }
.login-brand h1 { font-size: 2.7rem; font-weight: 400; line-height: 1.08; margin: 0 0 16px; }
.login-brand h1 em { color: var(--gold); font-style: italic; }
.login-brand p { color: var(--muted); max-width: 38ch; font-size: 1rem; }
.login-card { padding: 56px 44px; }
.login-card h2 { font-family: var(--serif); font-size: 1.6rem; font-weight: var(--heading-weight); margin-bottom: 4px; }
.login-card .muted { margin-bottom: 20px; }
.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form label { font-size: 0.8rem; font-weight: 500; color: var(--ink-2); margin-top: 4px; }
.login-form .btn { margin-top: 14px; width: 100%; padding: 11px 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .split-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1180px) {
  .chat-layout, .chat-layout.context-open { grid-template-columns: minmax(0, 1fr); position: relative; }
  .chat-context {
    position: fixed; top: 56px; right: 0; bottom: 0; width: min(340px, 100vw); z-index: 30;
    transform: translateX(100%); transition: transform 180ms ease, visibility 180ms;
  }
  .context-open .chat-context { transform: none; box-shadow: -12px 0 30px rgba(20, 20, 20, 0.12); }
}
@media (max-width: 1100px) {
  .stat-grid, .stat-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card:nth-child(3) { border-left: 0; }
  .stat-card:nth-child(n+3) { border-top: 1px solid var(--line); }
  .prompt-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); visibility: hidden;
    transition: transform 180ms ease, visibility 180ms;
    height: auto; /* top and bottom set the height; 100vh runs past a phone's visible screen */
  }
  /* The whole drawer scrolls on a phone, so the nav, Recents, and sign out are all reachable. */
  .rail-recents { flex: none; overflow: visible; }
  body.rail-open { overflow: hidden; }
  .rail-open .rail { transform: none; visibility: visible; box-shadow: 12px 0 30px rgba(20, 20, 20, 0.14); }
  .rail-open .rail-scrim { display: block; position: fixed; inset: 0; background: rgba(20, 20, 20, 0.3); z-index: 35; }
  .rail-close, .menu-button {
    display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; cursor: pointer;
  }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .content-chat { padding: 0; }
  .chat-messages { padding: 18px 16px 10px; }
  .chat-dock { padding: 6px 12px 12px; }
  h1 { font-size: 1.8rem; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .run-starter { flex-direction: column; align-items: flex-start; }
  .run-starter-control { min-width: 0; width: 100%; }
  .run-starter-control select { max-width: none; flex: 1; }
  .library-grid, .connector-grid, .three-col { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { border-right: 0; border-bottom: 1px solid var(--line); padding: 30px 24px; }
  .login-card { padding: 30px 24px; }
  .kanban-col { flex-basis: 260px; }
}
@media (max-width: 600px) {
  .stat-grid, .stat-grid-4 { grid-template-columns: 1fr; }
  .stat-card { border-left: 0; border-top: 1px solid var(--line); }
  .stat-card:first-child { border-top: 0; }
  .pill-static, .model-select { display: none; }
  .topbar-meta .btn-quiet { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Meetings, review queue, RAID and decision logs ---------- */
.mt-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 22px; flex-wrap: wrap; }
.mt-tabs a { padding: 9px 14px; font-size: 0.9rem; font-weight: 500; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.mt-tabs a:hover { color: var(--ink); }
.mt-tabs a.active { color: var(--ink); border-bottom-color: var(--gold); }
.mt-count { display: inline-flex; align-items: center; justify-content: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--gold); color: var(--on-accent); font-size: 0.7rem; font-weight: 600; margin-left: 4px; }
.mt-h2 { font-family: var(--serif); font-size: 1.15rem; font-weight: var(--heading-weight); margin-bottom: 10px; }
.mt-form .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt-people { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.mt-people legend { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); padding: 0 6px; }
.mt-people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.mt-people-narrow { grid-template-columns: 1fr; }
.mt-transcript { font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; }

.mt-item { border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 12px; background: var(--surface); }
.mt-kind-action { border-left-color: var(--ink); }
.mt-kind-decision { border-left-color: var(--green); }
.mt-kind-risk, .mt-kind-issue { border-left-color: var(--amber); }
.mt-kind-scope_change { border-left-color: var(--red); }
.mt-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.mt-item select, .mt-item input, .mt-item textarea, .mt-add-form select, .mt-add-form input, .mt-add-form textarea, .mt-raid-form select, .mt-raid-form input, .mt-raid-form textarea {
  font: inherit; font-size: 0.86rem; color: var(--ink); background: var(--field-bg); border: 1px solid var(--line-strong); border-radius: var(--control-radius); padding: 6px 9px; width: 100%;
}
.mt-item select:focus, .mt-item input:focus, .mt-item textarea:focus, .mt-add-form :is(select, input, textarea):focus, .mt-raid-form :is(select, input, textarea):focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus-ring); }
.mt-kind { width: auto !important; font-weight: 600; }
.mt-origin { font-size: 0.76rem; color: var(--muted); text-align: right; }
.mt-title { font-weight: 600; font-size: 0.95rem !important; margin-bottom: 6px; }
.mt-title-static { display: block; margin-bottom: 4px; }
.mt-item textarea { resize: vertical; }
.mt-evidence { margin: 8px 0 0; padding: 6px 10px; border-left: 2px solid var(--gold); background: var(--surface-2); font-family: var(--reading); font-size: 0.86rem; color: var(--ink-2); }
.mt-item-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.mt-item-fields label[hidden] { display: none; }
.mt-item-fields label, .mt-raid-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.76rem; font-weight: 600; color: var(--ink-2); }
.mt-item-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mt-becomes { font-size: 0.8rem; margin-left: auto; }
.mt-kind-label { display: inline-block; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); min-width: 92px; }
.mt-add { margin-top: 6px; }
.mt-add summary { list-style: none; display: inline-flex; }
.mt-add summary::-webkit-details-marker { display: none; }
.mt-add-form { display: grid; grid-template-columns: 170px minmax(0, 1fr) 170px 150px; gap: 8px; margin-top: 12px; align-items: start; }
.mt-add-form textarea { grid-column: 1 / -1; }
.mt-add-form button { justify-self: start; }
.mt-decided { list-style: none; margin: 0; padding: 0; font-size: 0.88rem; }
.mt-decided li { display: flex; gap: 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); }
.mt-decided li:last-child { border-bottom: 0; }
.mt-decided li > span:nth-child(2) { flex: 1; }
.mt-transcript-view summary { display: flex; align-items: baseline; justify-content: space-between; cursor: pointer; list-style: none; }
.mt-transcript-view summary::-webkit-details-marker { display: none; }
.mt-transcript-view summary .mt-h2 { margin: 0; }
.mt-transcript-text { white-space: pre-wrap; font-family: var(--mono); font-size: 0.78rem; line-height: 1.55; max-height: 560px; overflow: auto; background: var(--surface-2); padding: 14px; border-radius: var(--r-sm); margin: 12px 0 0; }
.mt-attendees { margin: 0 0 8px; padding-left: 18px; font-size: 0.88rem; }
.mt-edit { margin-top: 8px; }
.mt-edit summary { cursor: pointer; list-style: none; margin-bottom: 10px; }

.mt-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.mt-filters .pill { text-decoration: none; }
.mt-filters .pill.is-active { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.mt-filters .pill.is-active .mt-count { background: var(--surface); color: var(--ink); }
.mt-filter-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.mt-sub { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.mt-high td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.mt-muted-row td { color: var(--muted); }
.mt-row-edit summary { list-style: none; }
.mt-row-edit summary::-webkit-details-marker { display: none; }
.mt-row-edit[open] { position: relative; }
.mt-row-edit[open] form { position: absolute; right: 0; top: 36px; z-index: 10; width: min(720px, 80vw); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12); }
.mt-raid-form { display: flex; flex-direction: column; gap: 12px; }
.mt-raid-form button { align-self: flex-start; }
.mt-raid-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; }
.mt-span2 { grid-column: span 2; }
.mt-span4 { grid-column: 1 / -1; }
.mt-new-raid { margin-top: 20px; }
.mt-row-edit[open] form { max-height: 80vh; overflow-y: auto; }
.mt-raid-customer { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.mt-raid-customer legend { font-size: 0.82rem; font-weight: 700; padding: 0 4px; }
.mt-raid-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 900px) {
  .mt-item-fields, .mt-raid-grid, .mt-add-form, .mt-form .form-grid { grid-template-columns: 1fr; }
  .mt-span2 { grid-column: auto; }
}

/* ---------- Connect Claude ---------- */
.tk-new { border-left: 3px solid var(--gold); margin-bottom: 20px; }
.tk-copy { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.tk-copy code { flex: 1; font-family: var(--mono); font-size: 0.86rem; background: var(--surface-2); padding: 9px 12px; border-radius: var(--r-sm); overflow-wrap: anywhere; }
.tk-block { align-items: flex-start; }
.tk-block pre { flex: 1; margin: 0; font-family: var(--mono); font-size: 0.78rem; line-height: 1.5; background: var(--surface-2); padding: 12px 14px; border-radius: var(--r-sm); overflow-x: auto; }
.tk-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; font-size: 0.92rem; }
.tk-steps code, .tk-note code { font-family: var(--mono); font-size: 0.82rem; }
.tk-note { margin: 16px 0 0; font-size: 0.86rem; }
.tk-h3 { font-size: 0.95rem; margin: 22px 0 4px; }
.tk-note-plain { font-size: 0.9rem; margin: 0 0 4px; }
.tk-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tk-tools h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 6px; }
.tk-tools ul { margin: 0; padding-left: 18px; font-size: 0.88rem; display: flex; flex-direction: column; gap: 4px; }
.tk-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tk-row:last-child { border-bottom: 0; }
.tk-row > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tk-row code { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); }
.tk-row form { margin-top: 2px; }
.tk-dead { opacity: 0.55; }
@media (max-width: 900px) { .tk-tools { grid-template-columns: 1fr; } }

/* ---------- Kickoff intake (ported from the standalone Vetted form) ---------- */
.content-kickoff { max-width: 1120px; }
.ko-masthead { background: var(--band); color: var(--band-fg); padding: clamp(28px, 4vw, 48px) clamp(22px, 4vw, 44px); margin-bottom: 0; }
.ko-masthead h1 { color: var(--band-fg); font-size: clamp(2rem, 1.4rem + 2.2vw, 2.8rem); line-height: 1.06; max-width: 22ch; margin: 0; }
.ko-lede { margin: 16px 0 0; color: var(--band-muted); font-size: 1.02rem; line-height: 1.6; max-width: 66ch; }
.ko-lede strong { color: var(--band-fg); font-weight: 600; }
.ko-eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.ko-eyebrow::before { content: ""; flex: none; width: 40px; height: 1px; background: var(--gold); }
.ko-tag { margin-left: auto; font-size: 0.6875rem; letter-spacing: 0.14em; color: var(--band-fg); border: 1px solid var(--band-tag-line); padding: 3px 9px; white-space: nowrap; }
.ko-errors { border-left: 3px solid var(--red); background: var(--red-soft); color: #5e1d10; padding: 12px 16px; margin: 20px 0 0; font-size: 0.9rem; }
.ko-errors ul { margin: 6px 0 0; padding-left: 18px; }

.ko .toc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; list-style: none; margin: 24px 0 20px; padding: 0; }
.ko .toc a { display: block; text-align: center; font-size: 0.8125rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 8px 12px; text-decoration: none; }
.ko .toc a:hover { color: var(--ink); border-color: var(--gold); background: var(--gold-soft); }

.ko .card { padding: clamp(22px, 2.4vw, 34px); margin-bottom: 18px; border-radius: 0; scroll-margin-top: 16px; }
.ko .card h2 { display: flex; align-items: baseline; gap: 12px; font-size: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem); line-height: 1.15; margin: 0; }
.ko .card h2 .num { font-family: var(--sans); font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.12em; color: var(--gold-ink); }
.ko .hint { margin: 8px 0 24px; color: var(--muted); font-size: 0.875rem; line-height: 1.55; max-width: 72ch; }
.ko .card h2 + .grid { margin-top: 24px; }
.ko .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px 26px; }
.ko .grid-gap { margin-top: 18px; }
.ko .wide { grid-column: 1 / -1; }
.ko .field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.ko .field.check { flex-direction: row; align-items: center; gap: 9px; }
/* Scrum-only and plan-only parts of the form are switched with the hidden attribute. */
.ko [hidden] { display: none !important; }
.ko .field label { display: block; min-height: 2.7em; font-size: 0.8125rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.ko .field.check label { min-height: 0; font-weight: 500; }
.ko .field small { font-size: 0.75rem; line-height: 1.5; color: var(--muted); }
.ko .req { color: var(--gold-ink); }
.ko .field input, .ko .field select, .ko .field textarea {
  width: 100%; font: inherit; font-size: 0.9375rem; color: var(--ink); background: var(--field-bg);
  border: 1px solid var(--line); border-radius: var(--control-radius); padding: 9px 12px; transition: border-color 0.15s, background-color 0.15s;
}
.ko .field input:not([type=checkbox]), .ko .field select { min-height: 2.8rem; line-height: 1.5; }
.ko .field input:hover, .ko .field select:hover, .ko .field textarea:hover { border-color: var(--line-strong); }
.ko .field input:focus, .ko .field select:focus, .ko .field textarea:focus { outline: 2px solid var(--ink); outline-offset: 2px; border-color: var(--gold); box-shadow: none; }
.ko .field input[readonly] { background: var(--sunk); color: var(--muted); }
.ko .field textarea { min-height: 5rem; resize: vertical; line-height: 1.55; }
.ko .field input[type=checkbox] { width: 17px; height: 17px; flex: none; margin: 0; accent-color: var(--ink); }
.ko .mono { font-family: var(--mono); font-size: 0.86rem; }
.ko .invalid { border-color: var(--red) !important; background: var(--red-soft) !important; }

.ko .rows { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.ko .row { position: relative; border: 1px solid var(--line); border-left: 3px solid var(--gold); background: var(--field-bg); padding: 42px 16px 16px; }
.ko .row .rm { position: absolute; top: 10px; right: 10px; }
.ko .row .legacy-contact { margin: 14px 0 0; font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.ko .row .svc-origin { margin: 0 0 14px; font-size: 0.8125rem; color: var(--ink-2); overflow-wrap: anywhere; }
.ko .hint + .hint { margin-top: -16px; }
.ko-total { margin: 8px 0 16px; font-size: 0.88rem; }

.ko button { font: inherit; font-size: 0.8125rem; font-weight: 500; cursor: pointer; background: transparent; color: var(--ink); border: 1px solid var(--ink); border-radius: var(--btn-radius); padding: 8px 15px; transition: background-color 0.18s, border-color 0.18s, color 0.18s; }
.ko button:hover { border-color: var(--gold); background: var(--gold); color: var(--ink); }
.ko button.small { font-size: 0.75rem; padding: 5px 11px; }
.ko .row .rm { border-color: var(--line); color: var(--muted); }
.ko .row .rm:hover { border-color: var(--red); background: var(--red); color: #fff; }

.ko-bar { position: sticky; bottom: 0; z-index: 6; background: var(--band); border-top: 1px solid var(--band-line); padding: 12px 18px; margin-top: 8px; }
.ko-bar .inner { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ko .ko-bar button { border-color: var(--band-fg); color: var(--band-fg); }
.ko .ko-bar button:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.ko .ko-bar button.primary { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 600; }
.ko .ko-bar button.primary:hover { background: var(--band-fg); border-color: var(--band-fg); color: var(--ink); }
.ko .ko-bar button:disabled { opacity: 0.55; cursor: progress; }
.ko-bar .status { flex: 1 1 0; min-width: 0; text-align: right; font-size: 0.8125rem; color: var(--band-muted); }
.ko-bar .status.err { color: var(--gold); }
.ko-bar .status.good { color: #9cc0a6; }

.ko-dialog { border: 1px solid var(--line-strong); border-top: 3px solid var(--gold); border-radius: 0; padding: 26px 28px; width: min(640px, calc(100vw - 32px)); color: var(--ink); }
.ko-dialog::backdrop { background: rgba(10, 10, 10, 0.45); }
.ko-dialog h2 { font-size: 1.45rem; margin: 0 0 16px; }
.ko-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 16px; font-size: 0.92rem; }
.ko-facts dt { color: var(--muted); }
.ko-facts dd { margin: 0; font-weight: 500; }
.ko-counts { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 0.88rem; }
.ko-counts li { border: 1px solid var(--line); padding: 8px 10px; }
.ko-counts strong { font-family: var(--serif); font-size: 1.2rem; font-weight: var(--heading-weight); margin-right: 4px; }
.ko-dialog .table { margin-bottom: 14px; }
.ko-dialog p { font-size: 0.84rem; }
.ko-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.ko-dialog-wide { width: min(880px, calc(100vw - 32px)); }
.ko-dialog .prose { max-width: none; margin-bottom: 14px; }
.ko-subhead { font-size: 1rem; margin: 4px 0 8px; }
.ko-services { margin: 0 0 16px; padding-left: 18px; font-size: 0.86rem; line-height: 1.5; }
.ko-services li { margin-bottom: 6px; }

/* Services in the kickoff form: the catalog picker and the chosen rows. */
.ko .svc-family { font-family: var(--sans); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.ko .svc-picker { margin-bottom: 24px; }
.ko .svc-cards { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ko .svc-card { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); background: var(--field-bg); padding: 14px; }
.ko .svc-name { margin: 0; font-weight: 600; font-size: 0.9rem; line-height: 1.35; }
.ko .svc-summary { margin: 0; font-size: 0.82rem; line-height: 1.5; color: var(--ink-2); flex: 1; }
.ko .svc-facts { margin: 0; font-size: 0.78rem; color: var(--muted); }
.ko .svc-actions { display: flex; gap: 8px; margin-top: 4px; }
.ko .svc-row-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-bottom: 14px; padding-right: 80px; }
.ko .svc-row-head .svc-facts, .ko .svc-state { flex-basis: 100%; }
.ko .svc-state { margin: 0; font-size: 0.8rem; color: var(--ink-2); }
.ko .svc-details { margin-top: 4px; }
.ko .svc-empty { margin: 0 0 12px; }
.ko .svc-total { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 0.88rem; }

.ko-record { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ko-record-wide { grid-column: 1 / -1; }
.ko-record-card h2 { font-family: var(--serif); font-size: 1.2rem; font-weight: var(--heading-weight); margin-bottom: 12px; }
.ko-dl { display: grid; grid-template-columns: minmax(150px, 40%) 1fr; gap: 8px 16px; margin: 0; font-size: 0.88rem; }
.ko-dl dt { color: var(--muted); }
.ko-dl dd { margin: 0; overflow-wrap: anywhere; }
.ko-questions { margin: 0 0 10px; padding-left: 18px; }

@media (max-width: 900px) {
  .ko .toc { grid-template-columns: repeat(2, 1fr); }
  .ko-record { grid-template-columns: 1fr; }
  .ko-bar { margin-inline: -16px; }
  .ko-bar .status { flex-basis: 100%; text-align: left; }
}
@media print {
  .rail, .topbar, .ko-bar, .ko .toc, .ko button, .ko-errors { display: none !important; }
  .ko-masthead { background: #fff; color: #000; border-bottom: 1px solid #999; }
  .ko-masthead h1 { color: #000; }
  .ko-lede, .ko-tag { color: #444; }
  .ko .card { break-inside: avoid; border-color: #bbb; }
}

/* ---------- Users ---------- */
.users-access { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.users-access legend { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; padding: 0; }

/* Internal projects and utilization (#38) */
.card-subhead { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.card-subhead h3 { margin: 0; font-size: 1rem; }
.util-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.util-period { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Billing (#44) */
.billing-cadence { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-start; margin-bottom: 16px; }
.billing-cadence .field { min-width: 200px; }
.billing-cadence .field-action { align-self: flex-start; padding-top: 22px; }
.billing-cadence .field-hint { margin: 4px 0 0; }

/* Margin (#40) */
.margin-gaps { font-size: 0.83rem; color: var(--ink-2); }
.margin-gaps summary { cursor: pointer; }
.margin-gaps ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.customer-projects { display: block; margin-top: 2px; }

/* Customer views and share links (#119). The sheet reads the same on screen, on a shared page, and on paper. */
.cf-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.cf-toolbar p { margin: 0; max-width: 70ch; font-size: 0.88rem; }
.cf-toolbar form { margin: 0; }
.cf-warning { margin: 0 0 12px; }
.cf-share { margin-bottom: 20px; }
.cf-share h2 { font-family: var(--serif); font-size: 1.1rem; font-weight: var(--heading-weight); }
.cf-sheet { max-width: 920px; display: flex; flex-direction: column; gap: 16px; }
.cf-sheet-head { padding-bottom: 14px; border-bottom: 2px solid var(--ink); margin-bottom: 4px; }
.cf-eyebrow { margin: 0 0 4px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cf-sheet-head h1 { margin-bottom: 4px; }
.cf-asof { margin: 0; color: var(--muted); font-size: 0.88rem; }
.cf-card h2 { font-family: var(--serif); font-size: 1.15rem; font-weight: var(--heading-weight); margin-bottom: 10px; }
.cf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.cf-card-head h2 { margin: 0; }
.cf-card-head h2 a { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.cf-health { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin: 0; }
.cf-health .badge { font-size: 0.82rem; }
.cf-next { margin: 10px 0 0; font-size: 0.9rem; }
.cf-prose { font-family: var(--reading); margin: 0; max-width: 72ch; }
.cf-note { margin: 10px 0 0; font-size: 0.8rem; color: var(--muted); }
.cf-evidence { font-family: var(--sans, inherit); font-size: 0.78rem; color: var(--muted); text-decoration: underline; white-space: nowrap; }
.cf-evidence:hover, .cf-evidence:focus-visible { color: inherit; }
.cf-list { list-style: none; margin: 0; padding: 0; }
.cf-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.cf-list li:last-child { border-bottom: 0; }
.cf-sheet .table tbody tr:hover { background: transparent; }
.cf-sheet .status-achieved, .cf-sheet .status-accepted, .cf-sheet .status-deemed_accepted { background: var(--green-soft); color: var(--green); }
.cf-sheet .status-waived { background: var(--sunk); color: var(--ink-2); }
.cf-shared-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 40px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 0.85rem; }
.cf-shared-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cf-shared-note { color: var(--muted); }
.cf-shared-main { max-width: 1000px; }
/* Health by dimension and status updates on the sheet (#131, #132), and the manager page that publishes them. */
.badge-complete { background: var(--green-soft); color: var(--green); }
.badge-not_assessed { background: var(--sunk); color: var(--ink-2); }
.badge-stale, .badge-draft { background: transparent; color: var(--amber); border: 1px solid currentColor; padding: 1px 8px; }
.cf-dim-label { font-weight: 600; font-size: 0.88rem; }
.cf-health .cf-dim-label { min-width: 9.5rem; }
.cf-dims { list-style: none; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--line); }
.cf-dim { display: grid; grid-template-columns: 9.5rem 11rem minmax(0, 1fr); gap: 4px 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.cf-dim:last-child { border-bottom: 0; }
.cf-dim-state { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-dim-detail { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cf-dim-detail .cf-prose { font-size: 0.92rem; }
.cf-dim-detail small { font-size: 0.78rem; }
.cf-update { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cf-update:first-of-type { padding-top: 0; }
.cf-update:last-of-type { border-bottom: 0; padding-bottom: 0; }
.cf-update h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 1rem; }
.cf-update-meta { margin: 2px 0 8px; font-size: 0.8rem; }
.cf-update-sections { margin: 0; display: grid; gap: 4px; }
.cf-update-sections dt { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.cf-update-sections dd { margin: 0; }
.cu-card { margin-bottom: 20px; }
.cu-card .meta-list { margin-bottom: 8px; }
.cu-dimension { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.cu-dimension legend { font-weight: 600; font-size: 0.95rem; padding: 0 6px; margin-left: -6px; }
.cu-dimension-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; font-size: 0.82rem; }
.cu-dimension-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.cu-dimension-grid .cu-explanation { grid-column: 1 / -1; }
.cu-dimension .field textarea[aria-invalid="true"], .cu-update-form .field textarea[aria-invalid="true"] { border-color: var(--red); }
.cu-publish { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 16px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--amber-soft); color: var(--amber); }
.cu-publish p { margin: 0; font-size: 0.88rem; }
.cu-updates { list-style: none; margin: 0; padding: 0; }
.cu-updates > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cu-updates > li:last-child { border-bottom: 0; }
.cu-update-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; }
.cu-update-head strong { margin-right: 6px; }
.cu-update-head p { margin: 2px 0 0; font-size: 0.82rem; }
.cu-update-head .row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cu-update-body summary { cursor: pointer; font-size: 0.85rem; margin-top: 6px; }
.cu-update-body dl { margin: 8px 0 0; display: grid; gap: 4px; }
.cu-update-body dt { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.cu-update-body dd { margin: 0 0 6px; font-size: 0.9rem; }
.cu-update-form { max-width: 820px; }
@media (max-width: 760px) {
  .cf-dim { grid-template-columns: 1fr auto; }
  .cf-dim-detail { grid-column: 1 / -1; }
  .cf-health .cf-dim-label { min-width: 0; }
  .cu-dimension-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .cf-shared-bar { padding: 12px 16px; }
  .cf-shared-main { padding: 24px 16px 48px; }
  .cf-card-head { flex-wrap: wrap; }
}
@media print {
  @page { margin: 16mm 14mm; }
  .cf-page .rail, .cf-page .rail-scrim, .cf-page .topbar, .cf-page .skip-link, .cf-page .cf-toolbar, .cf-page .list-filters,
  .cf-page .cf-share, .cf-page .cf-warning, .cf-page .messages, .cf-page .cf-shared-bar, .cf-page .portal-bar, .cf-page .cf-evidence, .cf-page .cf-evidence-note, .cf-page button { display: none !important; }
  html, body.cf-page, .cf-page .app, .cf-page .main, .cf-page .content { background: #fff !important; color: #000 !important; }
  .cf-page .content { padding: 0 !important; max-width: none !important; }
  .cf-page .cf-sheet { max-width: none; gap: 10px; color: #000; }
  .cf-page .cf-sheet-head { border-bottom-color: #000; }
  .cf-page .cf-eyebrow, .cf-page .cf-asof, .cf-page .cf-note, .cf-page .muted { color: #444 !important; }
  .cf-page .card { background: #fff !important; color: #000 !important; border: 1px solid #999 !important; box-shadow: none !important; break-inside: avoid; page-break-inside: avoid; padding: 14px 16px; }
  .cf-page .cf-sheet h1, .cf-page .cf-sheet h2, .cf-page .cf-sheet a { color: #000 !important; text-decoration: none !important; }
  .cf-page .table th { color: #000 !important; border-bottom: 1px solid #000 !important; background: #fff !important; }
  .cf-page .table td, .cf-page .cf-list li { border-bottom-color: #ccc !important; }
  .cf-page .table tr { break-inside: avoid; }
  .cf-page .badge, .cf-page .status { background: #fff !important; color: #000 !important; border: 1px solid #000; }
  .cf-page .badge-stale { border-style: dashed; }
  .cf-page .cf-dims, .cf-page .cf-dim, .cf-page .cf-update { border-color: #ccc !important; }
  .cf-page .cf-dim, .cf-page .cf-update { break-inside: avoid; page-break-inside: avoid; }
  .cf-page .cf-dim { grid-template-columns: 9.5rem 11rem minmax(0, 1fr); }
  .cf-page .cf-dim-detail { grid-column: auto; }
  /* A long run of updates may span pages; each update stays whole. */
  .cf-page .cf-updates-card { break-inside: auto; page-break-inside: auto; }
}

/* Customer contacts and the customer portal (#121). The portal reuses the customer-facing sheet and its print rules. */
.contacts-card { margin-top: 20px; }
.contacts-card .card-head { align-items: center; }
.contacts-card .card-head h2 { margin: 0; }
.contacts-card .card-head .btn { text-decoration: none; }
.contact-projects, .contact-login { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.contact-projects legend, .contact-login legend { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.portal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 14px 40px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 0.85rem; }
.portal-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); text-decoration: none; }
.portal-who { display: flex; flex-wrap: wrap; gap: 4px 12px; flex: 1; min-width: 0; color: var(--ink-2); }
.portal-company { font-weight: 600; color: var(--ink); }
.portal-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.portal-actions form { margin: 0; }
.portal-main { max-width: 1000px; }
@media (max-width: 600px) {
  .portal-bar { padding: 12px 16px; }
  .portal-who { flex-basis: 100%; order: 3; }
  .portal-main { padding: 24px 16px 48px; }
}

/* Online acceptance signoff: the customer's response on the project page, the signer list, and the portal forms. */
.signoff-response { margin-top: 6px; display: grid; gap: 6px; min-width: 220px; }
.signoff-response p { margin: 0; }
.signoff-note { white-space: normal; padding: 6px 8px; border-left: 2px solid var(--line-strong); color: var(--ink-2); }
.signoff-return summary { cursor: pointer; font-size: 0.85rem; }
.signoff-signers { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.signoff-signers h3 { margin: 0 0 4px; font-size: 0.95rem; }
.check-list { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.check-list legend { font-weight: 600; font-size: 0.87rem; margin-bottom: 4px; }
.portal-signoff { margin-bottom: 20px; }
.portal-signoff-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.portal-signoff-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.portal-signoff-list p { margin: 4px 0 0; }
.portal-signoff-form { max-width: 680px; }
/* The customer action center (#133): action statuses, in the portal and on the internal list. */
.status-open { background: var(--gold-soft); color: var(--gold-ink); }
.status-overdue { background: var(--red-soft); color: var(--red); }
.status-done { background: var(--green-soft); color: var(--green); }
.status-cancelled { background: var(--sunk); color: var(--ink-2); }
.portal-action-center { max-width: none; }
/* Readiness items (#143): the go/no-go statuses, on the customer sheet and the internal list. */
.status-go { background: var(--green-soft); color: var(--green); }
.status-no_go { background: var(--red-soft); color: var(--red); }
.status-not_applicable { background: var(--sunk); color: var(--ink-2); }
/* The account page (#138): the totals strip, and the approach and owner line on each project card. */
.portal-portfolio dl, .portal-portfolio dd { margin: 0; }
.portal-portfolio .stat-grid { margin-bottom: 20px; }
.portal-matching { margin: 0 0 16px; font-size: 0.88rem; }
.cf-facts { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 8px 0 0; font-size: 0.9rem; }
.signoff-signers .btn { align-self: flex-start; justify-self: start; }
.effects-fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.effects-fieldset legend { font-weight: 600; font-size: 0.95rem; padding: 0 6px; margin-left: -6px; }
.baseline-was { color: var(--amber); }
.row-actions form + form { margin-top: 6px; }
.mail-fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px 14px; margin: 0; }
.mail-fieldset legend { font-weight: 600; font-size: 0.95rem; padding: 0 6px; margin-left: -6px; }
.mail-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 220px; }
.mail-actions .inline-form input[type="email"] { width: 170px; }
.mail-message + .mail-message { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.mail-message h2 { font-size: 0.98rem; margin: 0 0 4px; }
