/* ─────────────────────────────────────────────────────────────
   AI GOVERNANCE TRACKER — "grid status" presentation layer.
   Status semantics run on the series two-accent system:
     solid red          = the clamp is live        (ACTIVE)
     solid amber        = the turn is coming       (APPROACHING)
     hollow/hatch amber = scheduled, not energized (FUTURE)
     severed dark red   = struck instruments       (REVOKED)
     gray               = unclassified             (OTHER)
   Scoped .agt-*. JS contract preserved exactly: .agt-table,
   .agt-hidden, tr[data-agt-status], chip classes agt-on-<key>.
   ───────────────────────────────────────────────────────────── */

[x-cloak] { display: none !important; }

.agt-wrap {
  --ground: #0C0C0F;
  --panel: #14141A;
  --panel2: #1B1B22;
  --line: #2A2A33;
  --tx: #E6E4DE;
  --mut: #84838F;
  --red: #CC0000;
  --red-dim: #881111;
  --amber: #E8A33D;
  --mono: ui-monospace, "JetBrains Mono", Consolas, monospace;
  color: var(--tx);
  margin: 1.6rem 0;
}

/* ─── Thesis lead — first paragraph of the body ──────────── */
.agt-wrap > p:first-of-type {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.5;
  color: var(--tx);
  margin: 2.1rem 0 1.1rem;
}

/* ─── Field labels — leading <strong> in prose notes ─────── */
.agt-wrap > p > strong:first-child {
  font-family: var(--mono);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

/* ─── Section headers — instrument panel labels ──────────── */
.agt-wrap h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--tx);
  border-bottom: none;
  padding-bottom: 0;
  position: static;
  margin: 3.2rem 0 0.9rem;
}
.agt-wrap h2::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--red);
  box-shadow: 0 0 8px rgba(204, 0, 0, 0.55);
}
.agt-wrap h2::after {
  content: "";
  position: static;
  flex: 1 1 auto;
  width: auto;
  height: 1px;
  background: var(--line);
}

/* ─── Grid-status console ────────────────────────────────── */
.agt-console {
  background-color: var(--panel);
  background-image: radial-gradient(rgba(230, 228, 222, 0.04) 1px, transparent 1px);
  background-size: 12px 12px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--red);
  padding: 0.95rem 1.1rem 1rem;
}
.agt-console-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.agt-console-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--tx);
}
.agt-console-readout {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mut);
  margin-left: auto;
}
.agt-console-readout strong { color: var(--tx); font-weight: 700; }

.agt-btn {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--ground);
  color: var(--tx);
  border: 1px solid var(--line);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}
.agt-btn:hover { border-color: var(--mut); background: var(--panel2); }
.agt-btn:focus-visible,
.agt-chip:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ─── Energization bar — share of rows per status ────────── */
.agt-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  margin: 0.8rem 0 0.85rem;
  transform-origin: left center;
  animation: agtEnergize 0.7s cubic-bezier(0.25, 0.8, 0.3, 1) both;
}
@keyframes agtEnergize {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.agt-seg { flex: 0 1 0%; min-width: 0; transition: opacity 0.2s; }
.agt-seg-active { background: var(--red); box-shadow: 0 0 8px rgba(204, 0, 0, 0.35); }
.agt-seg-approaching { background: var(--amber); }
.agt-seg-future {
  background: repeating-linear-gradient(45deg,
    rgba(232, 163, 61, 0.5) 0 3px, rgba(232, 163, 61, 0.12) 3px 6px);
}
.agt-seg-revoked {
  background: repeating-linear-gradient(-45deg,
    var(--red-dim) 0 2px, var(--panel2) 2px 6px);
}
.agt-seg-other { background: var(--line); }
.agt-seg-off { opacity: 0.15; }

/* ─── Status chips — labelled LEDs ───────────────────────── */
.agt-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.agt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--ground);
  color: var(--mut);
  border: 1px solid var(--line);
  padding: 0.38rem 0.7rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.agt-chip:hover { color: var(--tx); border-color: var(--mut); }
.agt-chip-count { opacity: 0.55; }

/* LED socket — dark when the status is filtered off */
.agt-led {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line);
}

/* Lit states (chip visible = status shown).
   Active label uses the site's --link-hover red: #CC0000 is too dark
   for 0.72rem text on near-black — the lit state must outshine the off state. */
.agt-chip.agt-on-active { color: #FF2222; border-color: rgba(204, 0, 0, 0.6); background: rgba(204, 0, 0, 0.09); }
.agt-chip.agt-on-approaching { color: var(--amber); border-color: rgba(232, 163, 61, 0.5); background: rgba(232, 163, 61, 0.07); }
.agt-chip.agt-on-future { color: var(--amber); border-color: rgba(232, 163, 61, 0.3); }
.agt-chip.agt-on-revoked { color: var(--tx); border-color: rgba(136, 17, 17, 0.65); }
.agt-chip.agt-on-other { color: var(--tx); border-color: var(--mut); }

.agt-on-active .agt-led { background: var(--red); border-color: transparent; box-shadow: 0 0 6px rgba(204, 0, 0, 0.7); }
.agt-on-approaching .agt-led { background: var(--amber); border-color: transparent; box-shadow: 0 0 6px rgba(232, 163, 61, 0.6); }
.agt-on-future .agt-led { background: transparent; border-color: rgba(232, 163, 61, 0.7); }
.agt-on-revoked .agt-led {
  border-color: var(--red-dim);
  background: linear-gradient(135deg,
    transparent 38%, var(--red-dim) 38%, var(--red-dim) 62%, transparent 62%);
}
.agt-on-other .agt-led { background: var(--mut); border-color: transparent; }

.agt-legend {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  line-height: 1.7;
  color: var(--mut);
  margin: 0.85rem 0 0;
}

/* ─── Tables — instrument readouts ───────────────────────── */
.agt-wrap table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  margin: 1.1rem 0 2.4rem;
}
.agt-wrap th {
  background: var(--panel2);
  border: none;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mut);
  padding: 0.5rem 0.8rem;
  text-align: left;
}
.agt-wrap td {
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.58rem 0.8rem;
  font-size: 0.88rem;
  line-height: 1.55;
  vertical-align: top;
}
.agt-wrap tbody tr:last-child td { border-bottom: none; }
.agt-wrap tbody tr:hover td { background: var(--panel2); }
.agt-wrap td:first-child { font-family: var(--mono); font-size: 0.78rem; color: var(--tx); white-space: nowrap; }

/* Table links: quiet steel with underline — red stays reserved
   for status. Prose links keep the site default. */
.agt-wrap td a {
  color: var(--tx);
  text-decoration: underline;
  text-decoration-color: rgba(230, 228, 222, 0.3);
  text-underline-offset: 2px;
}
.agt-wrap td a:hover { color: var(--red); text-decoration-color: var(--red); }

/* ─── Row status — left edge + LED (set by JS classifier) ── */
.agt-table tbody tr { transition: background-color 0.15s; }
.agt-table tbody tr td:first-child { border-left: 3px solid transparent; }
.agt-table tbody tr[data-agt-status="active"] td:first-child { border-left-color: var(--red); }
.agt-table tbody tr[data-agt-status="approaching"] td:first-child { border-left-color: var(--amber); }
.agt-table tbody tr[data-agt-status="future"] td:first-child { border-left-color: rgba(232, 163, 61, 0.35); }
.agt-table tbody tr[data-agt-status="revoked"] td:first-child { border-left-style: dashed; border-left-color: var(--red-dim); }
.agt-table tbody tr[data-agt-status="other"] td:first-child { border-left-color: var(--line); }

.agt-table tbody tr[data-agt-status="active"] {
  background: linear-gradient(90deg, rgba(204, 0, 0, 0.05), transparent 45%);
}
.agt-table tbody tr[data-agt-status="revoked"] td,
.agt-table tbody tr[data-agt-status="revoked"] td a { color: var(--mut); }

.agt-table tbody tr td:first-child::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.55rem;
  vertical-align: 1px;
  background: var(--line);
}
.agt-table tbody tr[data-agt-status="active"] td:first-child::before {
  background: var(--red);
  box-shadow: 0 0 6px rgba(204, 0, 0, 0.6);
}
.agt-table tbody tr[data-agt-status="approaching"] td:first-child::before {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(232, 163, 61, 0.5);
}
.agt-table tbody tr[data-agt-status="future"] td:first-child::before {
  background: transparent;
  border: 1px solid rgba(232, 163, 61, 0.65);
}
.agt-table tbody tr[data-agt-status="revoked"] td:first-child::before {
  border: 1px solid var(--red-dim);
  background: linear-gradient(135deg,
    transparent 38%, var(--red-dim) 38%, var(--red-dim) 62%, transparent 62%);
}

.agt-table tbody tr.agt-hidden { display: none; }

/* ─── Motion + small screens ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .agt-bar { animation: none; }
  .agt-chip, .agt-seg, .agt-table tbody tr { transition: none; }
}

@media (max-width: 700px) {
  .agt-wrap table { display: block; overflow-x: auto; }
  .agt-wrap > p:first-of-type { font-size: 1.1rem; }
  .agt-console-readout { margin-left: 0; }
}
