/* Agents page.
 *
 * Reads the tokens from theme.css. No colour literals below except where a
 * value is derived from a token and CSS cannot express it (the translucent
 * status washes), and those are written as colour-mix on the token so a palette
 * change carries.
 *
 * STATUS IS NEVER COLOUR ALONE. Each state has a distinct glyph as well as a
 * hue: acting ▲, watching ●, escalating ◆, blocked ■, disabled ○. About 1 in 12
 * men has a red-green deficiency, and "blocked" vs "acting" is exactly the
 * distinction that pair collapses.
 */

.dt-agents {
  --gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

/* ── Page header ───────────────────────────────────────────────────────── */

.dt-agents__intro h1 {
  font-size: clamp(26px, 3.2vw, 34px);
  margin: 0 0 10px;
}

.dt-agents__lede {
  color: var(--text-2);
  max-width: 62ch;
  line-height: 1.55;
  margin: 0;
}

.dt-freshness {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 14px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-2);
}

.dt-freshness__label {
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 11px;
}

/* ── Pipeline strip ────────────────────────────────────────────────────── */

.dt-pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
  margin: 24px 0 32px;
}

.dt-pipeline__node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.dt-pipeline__title {
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 10px;
  font-family: var(--font-body);
  font-weight: 600;
}

.dt-pipeline__figure {
  font-family: var(--font-head);
  font-size: 24px;
  color: var(--text);
  margin: 0 0 4px;
}

.dt-pipeline__note {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
}

.dt-pipeline__breakdown {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-size: 13px;
  color: var(--text-2);
}

.dt-pipeline__breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
}

.dt-pipeline__breakdown b {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--text);
}

/* ── Status legend and badges ──────────────────────────────────────────── */

.dt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-2);
}

.dt-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.dt-status::before {
  font-size: 10px;
  line-height: 1;
}

.dt-status--acting {
  color: var(--mint);
  border-color: color-mix(in srgb, var(--mint) 40%, transparent);
  background: color-mix(in srgb, var(--mint) 11%, transparent);
}
.dt-status--acting::before { content: "\25B2"; }      /* ▲ */

.dt-status--watching {
  color: var(--cyan);
  border-color: color-mix(in srgb, var(--cyan) 40%, transparent);
  background: color-mix(in srgb, var(--cyan) 11%, transparent);
}
.dt-status--watching::before { content: "\25CF"; }    /* ● */

.dt-status--escalating {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 42%, transparent);
  background: color-mix(in srgb, var(--amber) 12%, transparent);
}
.dt-status--escalating::before { content: "\25C6"; }  /* ◆ */

.dt-status--blocked {
  color: var(--coral);
  border-color: color-mix(in srgb, var(--coral) 42%, transparent);
  background: color-mix(in srgb, var(--coral) 12%, transparent);
}
.dt-status--blocked::before { content: "\25A0"; }     /* ■ */

/* The viewer's own workspace could not be reached on the last run. A failure,
 * so coral like blocked; its own glyph, because colour is never the only
 * signal. */
.dt-status--unreachable {
  color: var(--coral);
  border-color: color-mix(in srgb, var(--coral) 42%, transparent);
  background: color-mix(in srgb, var(--coral) 12%, transparent);
}
.dt-status--unreachable::before { content: "\2715"; }   /* ✕ */

.dt-status--disabled,
.dt-status--unknown {
  color: var(--text-3);
  border-color: var(--axis);
  background: var(--inset);
}
.dt-status--disabled::before { content: "\25CB"; }    /* ○ */
.dt-status--unknown::before { content: "?"; font-weight: 700; }

/* ── Agent cards ───────────────────────────────────────────────────────── */

.dt-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: var(--gap);
}

.dt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dt-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dt-card__name {
  font-family: var(--font-head);
  font-size: 18px;
  margin: 0;
}

.dt-card__cadence {
  font-size: 12px;
  color: var(--text-3);
  margin: 4px 0 0;
}

.dt-card__what {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

.dt-card__reason {
  margin: 0;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--inset);
  border-left: 3px solid var(--axis);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
}

.dt-card__reason--blocked {
  border-left-color: var(--coral);
}

.dt-card__reason--escalating {
  border-left-color: var(--amber);
}

.dt-card__reason code {
  font-size: 12.5px;
  color: var(--text);
  word-break: break-word;
}

.dt-facts {
  display: grid;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

.dt-facts div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
}

.dt-facts dt {
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding-top: 2px;
}

.dt-facts dd {
  margin: 0;
  color: var(--text-2);
  line-height: 1.5;
}

.dt-facts dd .dt-mono {
  color: var(--text);
}

/* ── Chart panels and their empty states ───────────────────────────────── */

.dt-panel {
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.dt-panel__title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 10px;
  font-weight: 600;
}

.dt-panel__canvas {
  position: relative;
  height: 150px;
}

/* The honest empty state. Deliberately NOT a chart with no data: an empty line
 * chart renders as a flat line along the axis, which reads as a cluster at 0%
 * CPU — and 0% CPU is the state this product responds to by hibernating. */
.dt-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  padding: 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.55;
  border: 1px dashed var(--axis);
  border-radius: var(--radius-sm);
  background: transparent;
}

.dt-empty--error {
  color: var(--coral);
  border-color: color-mix(in srgb, var(--coral) 45%, transparent);
  border-style: solid;
}

/* ── Recent decisions ──────────────────────────────────────────────────── */

.dt-section {
  margin-top: 40px;
}

.dt-section > h2 {
  font-size: 21px;
  margin: 0 0 6px;
}

.dt-section__note {
  color: var(--text-2);
  font-size: 14px;
  margin: 0 0 16px;
  max-width: 68ch;
  line-height: 1.55;
}

.dt-decisions {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.dt-decisions li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 13px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
}

.dt-decisions li:last-child {
  border-bottom: 0;
}

.dt-decisions__op {
  color: var(--text);
  font-weight: 600;
}

.dt-decisions__target {
  font-family: var(--font-mono);
  color: var(--text-2);
}

.dt-decisions__codes {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.dt-decisions__at {
  margin-left: auto;
  color: var(--text-3);
  font-size: 12.5px;
  white-space: nowrap;
}

/* ── Ledger ────────────────────────────────────────────────────────────── */

.dt-ledger {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.dt-ledger__chain {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.dt-ledger__link {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 5px 9px;
  border-radius: var(--radius-xs);
  background: var(--inset);
  border: 1px solid var(--axis);
  color: var(--text-2);
}

.dt-ledger__link--head {
  color: var(--mint);
  border-color: color-mix(in srgb, var(--mint) 45%, transparent);
}

.dt-ledger__joint {
  color: var(--text-3);
}

.dt-ledger__note {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  max-width: 70ch;
}

/* ── Disabled roster ───────────────────────────────────────────────────── */

.dt-roster summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 14px;
  padding: 4px 0;
}

.dt-roster__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
}

.dt-roster__list li {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-3);
  background: var(--inset);
  border: 1px solid var(--axis);
  border-radius: var(--radius-xs);
  padding: 4px 9px;
}

/* ── Scope notice ──────────────────────────────────────────────────────── */

.dt-scope {
  margin-top: 28px;
  padding: 12px 15px;
  border: 1px solid var(--axis);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.6;
}

.dt-error {
  color: var(--coral);
  border: 1px solid color-mix(in srgb, var(--coral) 45%, transparent);
  background: color-mix(in srgb, var(--coral) 9%, transparent);
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
}

.dt-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .dt-agents { padding: 20px 16px 56px; }
  .dt-facts div { grid-template-columns: 1fr; gap: 2px; }
  .dt-decisions__at { margin-left: 0; width: 100%; }
}
