/* =========================================================
   ADLC deep dives — Verify, Review, Release, Observe
   Builds on adlc-phase.css (scene, beats, panels, pills, logs)
   ========================================================= */

.role-agent { --role: var(--agent); }
.role-gate  { --role: var(--gate); }

/* =========================== Verify =========================== */

.runners {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.runner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  transition: border-color 0.3s ease;
}

.runner.ready {
  border-style: solid;
  border-color: color-mix(in srgb, var(--gate) 50%, var(--border));
}

.runner-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

.runner.ready .runner-dot {
  background: var(--gate);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gate) 22%, transparent);
}

.runner-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.runner-text b {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
}

.runner-text span {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.matrix-wrap {
  overflow-x: auto;
}

.matrix {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.matrix th,
.matrix td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-weight: 500;
}

.matrix thead th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.matrix tbody tr:last-child th,
.matrix tbody tr:last-child td {
  border-bottom: none;
}

.matrix .pr-col {
  text-align: left;
  padding-left: 14px;
  white-space: nowrap;
}

.matrix tbody .pr-col b {
  font-family: var(--font-mono);
  font-weight: 500;
  margin-right: 6px;
}

.matrix tbody .pr-col span {
  color: var(--text-muted);
}

.matrix .status-col {
  text-align: right;
  padding-right: 14px;
}

.matrix tr.looping {
  background: color-mix(in srgb, var(--human) 7%, transparent);
}

.cell i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-style: normal;
  font-size: 13px;
  font-weight: 700;
  background: var(--code-bg);
  color: var(--text-muted);
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.cell.st-run i {
  background: var(--accent-soft);
  animation: cell-spin 0.9s linear infinite;
}

.cell.st-run i::after { content: "◌"; color: var(--accent-strong); }
.cell.st-pass i { background: color-mix(in srgb, var(--gate) 18%, transparent); color: var(--gate); }
.cell.st-pass i::after { content: "✓"; }
.cell.st-fail i { background: color-mix(in srgb, var(--fail) 18%, transparent); color: var(--fail); transform: scale(1.12); }
.cell.st-fail i::after { content: "✗"; }
.cell.st-warn i { background: color-mix(in srgb, var(--human) 20%, transparent); color: var(--human); transform: scale(1.12); }
.cell.st-warn i::after { content: "!"; }

@keyframes cell-spin {
  to { transform: rotate(360deg); }
}

.finding-meta {
  padding: 10px 14px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.finding-panel .codebox {
  min-height: 140px;
}

.finding-note {
  margin: 0;
  padding: 0 14px 14px;
  font-size: 13.5px;
  line-height: 1.5;
}

.ledger {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.ledger-item {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--code-bg);
}

.ledger-item b {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ledger-item span {
  font-size: 12px;
  color: var(--text-muted);
}

.ledger-item.human b {
  color: var(--human);
}

.mutation {
  margin-bottom: 12px;
}

.mutation-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  margin-bottom: 6px;
}

.mutation-label em {
  font-style: normal;
  color: var(--text-muted);
}

.mutation-label b {
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
}

.mutation-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--code-bg);
}

.mutation-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: background 0.3s ease;
}

.mutation-bar i.ok {
  background: var(--gate);
}

.mut-min {
  position: absolute;
  left: 80%;
  top: -3px;
  bottom: -3px;
  border-left: 2px dashed var(--text-muted);
}

/* =========================== Review =========================== */

.pr-title {
  margin: 0 0 10px;
  font-size: 15px;
}

.pr-title b {
  font-family: var(--font-mono);
  font-weight: 500;
  margin-right: 4px;
}

.pr-title .mono {
  color: var(--text-muted);
  font-size: 12px;
}

.risk {
  margin-top: 14px;
}

.risk-head,
.attention-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.risk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.risk-row {
  --c: var(--gate);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 70px;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
  transition: opacity 0.3s ease;
}

.risk-row:not(.shown) { display: none; }
.risk-row.shown { animation: log-in 0.35s ease-out; }
.risk-row.lvl-2 { --c: var(--human); }
.risk-row.lvl-3 { --c: var(--fail); }

.risk-file {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-why {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.risk-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--code-bg);
  overflow: hidden;
}

.risk-bar i {
  display: block;
  height: 100%;
  background: var(--c);
  border-radius: inherit;
}

.attention {
  margin-top: 14px;
}

.attention-label {
  display: flex;
  justify-content: space-between;
}

.attention-label b {
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--human);
}

.attention-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--code-bg);
  overflow: hidden;
}

.attention-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--human);
  border-radius: inherit;
}

.diff-panel .codebox {
  min-height: 250px;
}

.thread {
  padding: 0 14px 14px;
}

#spec-lines .ln:not(.shown) {
  display: none;
}

#spec-lines .ln {
  white-space: pre-wrap;
}

#spec-lines .spec-h {
  color: var(--accent-strong);
  font-weight: 600;
}

#spec-lines {
  min-height: 112px;
}

.spec-delta,
.merge,
.proposal,
.loop-panel {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.spec-delta.live,
.proposal.live,
.loop-panel.live {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.delta-note {
  margin: 0;
  padding: 0 14px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.merge-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.merge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.merge-row.merged {
  border-color: color-mix(in srgb, var(--gate) 45%, var(--border));
  background: color-mix(in srgb, var(--gate) 7%, transparent);
}

.merge-title b {
  font-family: var(--font-mono);
  font-weight: 500;
  margin-right: 6px;
}

.merge-title span {
  color: var(--text-muted);
}

.risk-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 5px;
}

.risk-tag.risk-low { color: var(--gate); background: color-mix(in srgb, var(--gate) 12%, transparent); }
.risk-tag.risk-high { color: var(--fail); background: color-mix(in srgb, var(--fail) 12%, transparent); }

.approvals {
  display: inline-flex;
  gap: 4px;
}

.approval {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 5px;
  color: var(--human);
  background: color-mix(in srgb, var(--human) 14%, transparent);
  animation: log-in 0.35s ease-out;
}

.verify-dots {
  display: none;
  gap: 3px;
}

.verify-dots.shown {
  display: inline-flex;
}

.verify-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s ease;
}

.verify-dots i.run { background: var(--accent); }
.verify-dots i.ok { background: var(--gate); }

.merge-row .pill {
  margin-left: auto;
}

.review-time {
  font-size: 13px;
  color: var(--text-muted);
}

.review-time b {
  color: var(--human);
  font-family: var(--font-mono);
  font-weight: 500;
}

/* =========================== Release =========================== */

.release-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 1000px) {
  .release-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
}

.digest {
  margin: 0 0 10px;
  font-size: 12.5px;
  word-break: break-all;
}

.stages {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
}

.stage {
  position: relative;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.stage.done {
  color: var(--gate);
  border-color: color-mix(in srgb, var(--gate) 45%, var(--border));
}

.stage.done::before { content: "✓ "; }

.stage.active {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.stage.rolled {
  color: var(--fail);
  border-color: var(--fail);
  border-style: dashed;
  text-decoration: line-through;
}

.flag {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
}

.flag-switch {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.3s ease;
}

.flag-switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.flag.partial .flag-switch { background: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.flag.partial .flag-switch i { transform: translateX(8px); }
.flag.on .flag-switch { background: var(--gate); }
.flag.on .flag-switch i { transform: translateX(16px); }

.flag-state {
  color: var(--text-muted);
  font-size: 12.5px;
}

.traffic {
  margin-top: 12px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.traffic.incident {
  border-color: var(--fail);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--fail) 12%, transparent);
}

.split {
  display: flex;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.split > div {
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}

.split-stable {
  width: 100%;
  background: var(--code-bg);
  color: var(--text-muted);
}

.split-canary {
  width: 0;
  justify-content: flex-end;
  background: var(--accent);
  color: #fff;
}

.split-stable span {
  padding: 0 12px;
}

.split-canary span {
  padding: 0 10px;
}

.traffic.incident .split-canary {
  background: var(--fail);
}

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

.region {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.region-dot {
  grid-row: span 2;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gate);
}

.region b {
  font-family: var(--font-mono);
  font-weight: 500;
}

.region-ver {
  grid-column: 2;
  font-size: 11px;
  color: var(--text-muted);
}

.region-err {
  grid-column: 3;
  grid-row: 1 / span 2;
  font-size: 12px;
  color: var(--gate);
}

.region.bad {
  border-color: var(--fail);
  background: color-mix(in srgb, var(--fail) 8%, transparent);
}

.region.bad .region-dot {
  background: var(--fail);
  animation: blink 0.8s ease-in-out infinite;
}

.region.bad .region-err {
  color: var(--fail);
  font-weight: 600;
}

.chart + .chart {
  margin-top: 14px;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chart-head b {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--text);
}

.chart-head b.bad {
  color: var(--fail);
}

.chart svg {
  display: block;
  width: 100%;
  height: 90px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(var(--code-bg), transparent);
  border-radius: 6px 6px 0 0;
}

.chart .slo {
  stroke: var(--fail);
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
}

.chart .series {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart .series.err { stroke: var(--pm); }
.chart .series.lat { stroke: var(--accent); }

.chart-foot {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fail);
  margin-top: 3px;
}

/* =========================== Observe =========================== */

.wait-panel {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.wait-panel.alert {
  border-color: color-mix(in srgb, var(--human) 60%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--human) 12%, transparent);
}

.wait-chart {
  position: relative;
  height: 170px;
  margin-top: 16px;
  border-bottom: 1px solid var(--border);
}

.wait-bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.wbar {
  flex: 1;
  height: var(--h);
  border-radius: 3px 3px 0 0;
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  transform-origin: bottom;
  transform: scaleY(0);
  transition: transform 0.35s ease, background 0.3s ease;
}

.wbar.on {
  transform: scaleY(1);
}

.offpeak.on ~ .wait-bars .wbar.off {
  background: var(--human);
}

.abandon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.abandon polyline {
  fill: none;
  stroke: var(--fail);
  stroke-width: 2.2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.offpeak {
  position: absolute;
  top: -6px;
  bottom: 0;
  left: 0;
  width: 25%;
  border-radius: 8px;
  background: color-mix(in srgb, var(--human) 12%, transparent);
  border: 1.5px dashed color-mix(in srgb, var(--human) 60%, transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.offpeak span {
  position: absolute;
  top: -18px;
  left: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--human);
}

.offpeak.on {
  opacity: 1;
}

.wait-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.wait-legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.wait-legend span::before {
  content: "";
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.lg-bar::before { width: 10px; height: 10px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.lg-line::before { width: 14px; height: 2px; background: var(--fail); }

.observe-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.proposal .codebox {
  min-height: 300px;
  white-space: normal;
}

.proposal .codebox .ln {
  white-space: pre-wrap;
}

.proposal .codebox .ln::before {
  content: "";
}

.int-lines .ln:not(.shown),
#int-lines .ln:not(.shown) {
  display: none;
}

.int-h1 { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text); }
.int-meta { color: var(--text-muted); font-size: 11.5px; }
.int-h { color: var(--accent-strong); font-weight: 600; margin-top: 4px; }

.quotes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quote {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--code-bg);
  font-size: 13px;
}

.quote:not(.shown) { display: none; }
.quote.shown { animation: log-in 0.35s ease-out; }

.stars {
  color: var(--human);
  font-size: 12px;
  letter-spacing: 1px;
}

.quote-src {
  font-size: 11.5px;
  color: var(--text-muted);
}

.mini-loop {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  overflow: visible;
}

.ml-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 4;
}

.ml-close {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  transition: stroke-dashoffset 1.2s ease;
}

.mini-loop.closing .ml-close {
  stroke-dashoffset: 0;
}

.ml-node circle {
  fill: var(--bg-elevated);
  stroke: var(--text-muted);
  stroke-width: 2;
}

.ml-node text {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-muted);
}

.ml-node.is-observe circle { stroke: var(--agent); fill: var(--agent); }
.ml-node.is-observe text { fill: var(--text); }
.mini-loop.closing .ml-node.is-intent circle { stroke: var(--human); fill: var(--human); }
.mini-loop.closing .ml-node.is-intent text { fill: var(--text); }

.ml-center {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  fill: var(--text);
  opacity: 0;
  transition: opacity 0.6s ease 0.6s;
}

.ml-center-sub {
  font-size: 10.5px;
  fill: var(--text-muted);
  opacity: 0;
  transition: opacity 0.6s ease 0.8s;
}

.mini-loop.closing .ml-center,
.mini-loop.closing .ml-center-sub {
  opacity: 1;
}

/* =========================== Small screens =========================== */

@media (max-width: 760px) {
  .runners,
  .regions { grid-template-columns: 1fr; }
  .risk-row { grid-template-columns: minmax(0, 1fr) 60px; }
  .risk-why { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cell.st-run i,
  .region.bad .region-dot,
  .risk-row.shown,
  .approval,
  .quote.shown {
    animation: none !important;
  }
}
