/* cplan manager GUI shell.
   Tokens and layout follow the accepted mockups in output/gui-preview/.
   Sections marked "legacy" keep pre-polish templates readable until they are
   migrated to the shell classes above them. */

:root {
  --bg: #f7f7f6;
  --surface: #ffffff;
  --ink: #17181a;
  --ink-2: #55585e;
  --ink-3: #83878e;
  --line: #e3e2df;
  --line-2: #efeeec;
  --accent: #0a5c9e;
  --accent-hover: #084c84;
  --accent-soft: #eaf2f9;
  --ok: #1f6b43;
  --ok-soft: #eef6f1;
  --warn: #8a5300;
  --warn-soft: #fdf4e6;
  --danger: #8b1e1e;
  --danger-soft: #fdf0f0;
  --radius: 8px;
  --radius-sm: 6px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  min-height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand {
  font-weight: 650;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-bar { display: flex; gap: 2px; align-self: stretch; }

.nav-bar a {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.nav-bar a:hover { color: var(--ink); }

.nav-bar a.nav-current,
.nav-bar a[aria-current="page"] {
  color: var(--accent);
  font-weight: 550;
  border-bottom-color: var(--accent);
}

.nav-switch {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.allocation-grid-scroll { overflow-x: auto; }
.allocation-grid-table { min-width: 760px; }
.allocation-grid-table th { white-space: nowrap; }
.allocation-grid-table .grid-pct {
  width: 64px;
  text-align: right;
}
.grid-total.bad { color: var(--danger); font-weight: 650; }
.danger-link { color: var(--danger); margin-left: 8px; }

/* ---------- controls ---------- */

select,
textarea,
input[type="text"],
input[type="number"],
input[type="search"] {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  width: auto;
  max-width: 100%;
}

textarea { width: 100%; }

select:focus-visible,
input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-xs { width: 4rem; }
.field-sm { width: 7rem; }
.field-md { width: 20rem; }

button,
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  width: auto;
}

button:hover,
.btn:hover { background: var(--accent-hover); }

button:disabled,
.btn:disabled { opacity: 0.65; cursor: wait; }

.btn-secondary,
button.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.btn-secondary:hover,
button.secondary:hover { background: #fafaf9; border-color: #d5d4d0; }

.btn-link {
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 550;
  font-size: 13.5px;
  text-decoration: none;
  padding: 0;
}

.btn-link:hover { text-decoration: underline; background: none; }

/* ---------- layout ---------- */

main { max-width: 1240px; margin: 0 auto; padding: 20px 24px 64px; }

.crumb {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0 0 14px;
}

.crumb a { color: var(--ink-2); text-decoration: none; }
.crumb a:hover { color: var(--accent); }

.back-link { color: var(--accent); font-weight: 550; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.page-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-3); }

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.head-actions form { margin: 0; }

h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

h3 { margin: 0; font-size: 13.5px; font-weight: 600; }

.section { margin-bottom: 28px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-note { margin: 0; font-size: 12.5px; color: var(--ink-3); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.card-pad { padding: 18px 20px; }

/* ---------- stat strip ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat { padding: 16px 20px; border-left: 1px solid var(--line-2); }
.stat:first-child { border-left: 0; }

.stat-label {
  margin: 0;
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.stat-value {
  margin: 6px 0 0;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value.over { color: var(--warn); }
.stat-value.good { color: var(--ok); }
.stat-foot { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

/* ---------- callouts ---------- */

.callout,
.flash,
.error {
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  background: var(--surface);
  margin: 0 0 20px;
  display: block;
}

.callout-warn {
  border-color: #f0e2c9;
  border-left-color: var(--warn);
  background: var(--warn-soft);
}
.callout-ok,
.flash {
  border-color: #d5e7dc;
  border-left-color: var(--ok);
  background: var(--ok-soft);
}
.callout-flat { border-left-color: var(--ink-3); }
.error {
  border-color: #f0b4b4;
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.callout-title { margin: 0; font-size: 13.5px; font-weight: 600; }
.callout p { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-2); }
.callout a { color: var(--accent); }

details.raw { margin-top: 10px; }

details.raw summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 550;
  list-style: none;
}

details.raw summary::-webkit-details-marker { display: none; }
details.raw summary::before { content: "\25B8  "; color: var(--ink-3); }
details.raw[open] summary::before { content: "\25BE  "; }

details.raw pre,
.result {
  margin: 8px 0 0;
  padding: 10px 12px;
  background: #fafaf9;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  overflow: auto;
  white-space: pre-wrap;
}

.validation-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-2);
}

.validation-list li { margin: 3px 0; }

.sev {
  display: inline-block;
  min-width: 58px;
  margin-right: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sev-error { color: var(--danger); }
.sev-warning { color: var(--warn); }

#page-status:focus,
#action-status:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- charts ---------- */

.chart-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.chart-card.chart-wide { grid-column: 1 / -1; }
.chart-card .cap { margin: 2px 0 12px; font-size: 12px; color: var(--ink-3); }

/* Sits under the quarter donut, so it trails rather than leads its chart. */
.chart-card .cap.maint-note { margin: 10px 0 0; color: var(--ink-2); }

/* Donut beside its key, as the published PNG lays it out. Below the card
   breakpoint the key drops under the ring rather than squeezing it. */
.donut { display: flex; align-items: center; gap: 16px; }
.donut .donut-ring { flex: 1 1 55%; min-width: 12rem; }

.donut-key {
  flex: 1 1 45%;
  min-width: 11rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--ink-2);
}

.donut-key li { display: flex; gap: 7px; margin-bottom: 9px; }
.donut-key li:last-child { margin-bottom: 0; }
.donut-key .dot { margin-top: 4px; }
.donut-key .k-title { display: block; }
.donut-key .k-num { display: block; color: var(--ink-3); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .donut { flex-direction: column; align-items: stretch; }
}

.chart-wrap { position: relative; height: 210px; }
.chart-wrap-sm { height: 160px; }
.chart-wrap-tall { height: 300px; }
.chart-wrap-xtall { height: 380px; }
.chart-wrap-member-sp { height: 340px; }
.chart-wrap-scope-sp { height: 220px; }

.mix { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.mix .chart-wrap { height: 150px; width: 150px; flex: none; }
.mix-legend { flex: 1; min-width: 12rem; }

.mix-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}

.mix-row:last-child { border-bottom: 0; }
.mix-row .n { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }

.dot { width: 8px; height: 8px; border-radius: 2px; flex: none; align-self: center; }

.share-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}

.share-head {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
}

.share-bar {
  display: flex;
  gap: 2px;
  height: 15px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--line-2);
}

/* Gaps let the track show through, so a boundary stays visible even where two
   segments land on neighbouring shades of the ramp. */
.share-seg { min-width: 3px; }

.share-hint { font-weight: 400; color: var(--ink-3); }

.share-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 9px 0 0;
  font-size: 12px;
  color: var(--ink-2);
}

.share-legend span { display: inline-flex; align-items: center; gap: 6px; }

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--ink-2);
}

.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

.member-sp-legend { gap: 8px 16px; }
.member-sp-swatch {
  width: 12px;
  height: 9px;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  flex: none;
}
.member-sp-committed { background: color-mix(in srgb, var(--accent) 30%, transparent); }
.member-sp-completed { background: var(--accent); }
.chart-card .cap.member-sp-unassigned { margin-top: 10px; }

.legend-dash {
  width: 14px;
  height: 0;
  border-top: 2px dashed var(--warn);
  flex: none;
}

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfbfa; }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.col-num {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
  white-space: nowrap;
}

.t-title { font-weight: 500; }
.t-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.t-warn { color: var(--warn); }

table.compact th { padding: 0 8px 6px; }
table.compact td { padding: 7px 8px; font-size: 13px; }

.bar-cell { width: 132px; }

.bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--line-2);
  overflow: hidden;
}

.bar span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: 3px;
}

.bar.soft span { background: #9bc7e6; }

/* Completion cell: filled portion, the share carried in from the previous
   sprint, and a dashed marker at the even-cadence position. */

.pct-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.pct-cell .bar { flex: 1; height: 8px; border-radius: 4px; }

.pct-cell .fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: 4px;
}

.pct-cell .prev {
  position: absolute;
  inset: 0 auto 0 0;
  background: #9bc7e6;
  border-radius: 4px;
}

.pct-cell .cadence-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 0;
  border-left: 2px dashed var(--warn);
}

.pct-num {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  min-width: 2.6rem;
  text-align: right;
}

.pct-input {
  display: inline-block;
  width: 4.5rem !important;
  margin-top: 6px;
}

.clear-pct {
  margin-left: 5px;
  color: var(--ink-3);
  font-size: 11.5px;
  white-space: nowrap;
}

.bulk-completion-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.bulk-completion-actions label {
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 550;
}

.progress-summaries {
  display: grid;
  gap: 10px;
}

.summary-disclosure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary-disclosure > summary {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  list-style: none;
  color: var(--ink);
}

.summary-disclosure > summary::-webkit-details-marker { display: none; }
.summary-disclosure > summary::before {
  content: "\25B8";
  margin-right: 8px;
  color: var(--ink-3);
  font-size: 11px;
}
.summary-disclosure[open] > summary::before { content: "\25BE"; }
.summary-disclosure > summary h2 { margin: 0; }
.summary-body {
  padding: 0 16px 16px 35px;
  border-top: 1px solid var(--line-2);
}
.summary-text { margin: 0; white-space: pre-wrap; color: var(--ink-2); }
.report-markdown {
  max-height: 560px;
  margin: 0;
  overflow: auto;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
  background: transparent;
}
.report-markdown h1,
.report-markdown h2,
.report-markdown h3 {
  color: var(--ink);
  line-height: 1.25;
}
.report-markdown h1 { font-size: 20px; }
.report-markdown h2 { font-size: 17px; }
.report-markdown h3 { font-size: 15px; }
.report-markdown table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
}
.report-markdown th,
.report-markdown td {
  padding: 7px 9px;
  border: 1px solid var(--line-2);
  text-align: left;
  vertical-align: top;
}
.report-markdown pre {
  overflow: auto;
  padding: 10px;
  border-radius: 6px;
  background: var(--surface-2);
}
.sprint-summary-item + .sprint-summary-item {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
}
.sprint-summary-item p { margin: 0 0 5px; }
.sprint-summary-item ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-2);
}

.chart-wrap-hero { height: 340px; }

tfoot td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 550;
}

.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 550;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--line-2); color: var(--ink-2); }
.pill-neutral { background: var(--line-2); color: var(--ink-3); }
.pill-flat { background: var(--line-2); color: var(--ink-2); }

.stat-value.stat-value-text {
  font-size: 20px;
  line-height: 1.25;
}

.delta-up { color: var(--ok); font-variant-numeric: tabular-nums; }
.delta-flat { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- publish thumbs ---------- */

/* Collapsed by default: these PNGs restate the live charts above and exist
   to verify what gets published, so they must not compete with analysis. */
details.publish > summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  list-style: none;
  color: inherit;
  font-weight: inherit;
}

details.publish > summary::-webkit-details-marker { display: none; }

details.publish > summary::before {
  content: "\25B8";
  color: var(--ink-3);
  font-size: 11px;
}

details.publish[open] > summary::before { content: "\25BE"; }

details.publish > summary h2 { margin: 0; }

details.publish[open] .thumbs { margin-top: 14px; }

.thumbs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.thumb { margin: 0; }

.thumb figcaption {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.thumb a,
.thumb .thumb-frame {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.thumb img { display: block; width: 100%; height: auto; }

/* ---------- highlight cards ---------- */

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.highlight {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.highlight-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

.highlight-head .col-num { margin-right: 2px; }
.highlight-head .n { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.highlight ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.highlight li { margin-bottom: 4px; }

/* ---------- inline forms ---------- */

details.newform summary { list-style: none; display: inline-flex; cursor: pointer; }
details.newform summary::-webkit-details-marker { display: none; }

.newform-body {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  flex-wrap: wrap;
}

.newform-body label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.newform-body label input { display: block; margin-top: 4px; }

.empty {
  padding: 28px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13.5px;
}

.empty code { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }

/* ---------- legacy: pre-polish form and card markup ---------- */

.hint,
.readonly,
.muted-sm,
.muted p { font-size: 12.5px; color: var(--ink-3); }
.hint-warn { color: var(--warn); }

.card.muted { opacity: 0.9; }

.grid3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.stack label,
form.card label { display: block; margin-bottom: 12px; }
.stack input,
.stack select,
.stack textarea { display: block; margin-top: 4px; width: 100%; }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row label { font-size: 12.5px; color: var(--ink-2); font-weight: 550; }
.row label select,
.row label input { display: block; margin-top: 4px; }

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
  padding: 12px 16px;
}

legend { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }

details > summary { cursor: pointer; color: var(--accent); font-weight: 550; }

.inline { display: inline; }
.inline button { width: auto; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.chart {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--surface);
}

.chart.chart-wide { grid-column: 1 / -1; }

.chart figcaption {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.chart img { display: block; width: 100%; height: auto; }

.plan-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 0 0 16px;
}

.plan-metric h3 { margin: 0 0 6px; }
.metric-value { font-size: 21px; font-weight: 650; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.plan-charts .chart-wide { grid-column: 1 / -1; }
.plan-charts .chart { cursor: default; }
.plan-charts canvas,
.chart-card canvas.clickable { cursor: pointer; }

.agent-chat .agent-log {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fafaf9;
  margin-bottom: 16px;
}

.agent-msg { margin-bottom: 16px; }

.agent-msg pre {
  white-space: pre-wrap;
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
}

.agent-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.agent-provider {
  font-size: 11px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}

.agent-user-text {
  margin: 0;
  white-space: pre-wrap;
}

/* Model replies are markdown, so they get prose spacing rather than <pre>. */
.agent-md > :first-child { margin-top: 0; }
.agent-md > :last-child { margin-bottom: 0; }
.agent-md p { margin: 0 0 8px; }
.agent-md ul,
.agent-md ol { margin: 0 0 8px; padding-left: 20px; }
.agent-md li { margin-bottom: 2px; }
.agent-md h1,
.agent-md h2,
.agent-md h3,
.agent-md h4 {
  font-size: 14px;
  margin: 12px 0 6px;
}
.agent-md table {
  border-collapse: collapse;
  margin: 0 0 8px;
  font-size: 12.5px;
}
.agent-md th,
.agent-md td {
  border: 1px solid var(--line);
  padding: 3px 8px;
  text-align: left;
}
.agent-md code {
  font-family: var(--mono);
  font-size: 12.5px;
}

/* Verbatim tool output (heuristic router, Apply results). */
.agent-pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-x: auto;
  font-size: 12px;
}

/* Streamed text before the page reloads with the rendered markdown. */
.agent-live {
  margin: 0;
  white-space: pre-wrap;
}

.agent-status {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--ink-2);
}

.agent-error-text {
  margin: 6px 0 0;
  color: var(--danger);
}

.agent-traces { margin-top: 6px; }

.agent-traces summary {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--ink-2);
}

.agent-trace { margin-top: 6px; }

.agent-trace pre {
  max-height: 220px;
  overflow: auto;
  color: var(--ink-2);
  font-size: 11.5px;
}

.agent-user strong { color: var(--accent); }
.agent-compose textarea { width: 100%; }

.workflow-steps {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}
.workflow-steps li {
  display: grid;
  grid-template-columns: 20px 110px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  color: var(--ink-2);
}
.workflow-steps li.complete > span:first-child { color: var(--accent); }
.workflow-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.proposal-list { list-style: none; padding: 0; margin: 0; }

.proposal-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
}

.proposal-summary { flex: 1 1 100%; }
.proposal-diff { flex: 1 1 100%; }
.proposal-diff pre {
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 12px;
}

.proposal-list li:last-child { border-bottom: 0; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .chart-row { grid-template-columns: minmax(0, 1fr); }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding: 16px 16px 48px; }
  .top { padding: 0 16px; }
}
