/* ═══════════════════════════════════════════════════════════════
   SCREENS-DETAIL CSS — drill-down panels for Ledger, Quarantine, Shield
   ═══════════════════════════════════════════════════════════════ */

/* ─── shared drawer ─────────────────────────────────── */
.dd-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(720px, 55vw);
  background: var(--s1);
  border-left: 1px solid var(--b2);
  border-radius: var(--r) 0 0 var(--r);
  z-index: 800;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform .28s cubic-bezier(0.22,0.9,0.32,1);
  overflow: hidden;
}
.dd-drawer.open { transform: translateX(0); }
.dd-backdrop {
  position: fixed; inset: 0;
  background: var(--scrim);
  z-index: 799;
  opacity: 0; pointer-events: none;
  transition: opacity .22s;
}
.dd-backdrop.open { opacity: 1; pointer-events: auto; }

.dd-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--b2);
  background: var(--s1);
}
.dd-head .dd-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  padding: 4px 9px;
  background: var(--t1);
  color: var(--bg);
  text-transform: uppercase;
  border-radius: var(--r-chip);
}
.dd-head .dd-tag.signal { background: var(--fail); color: var(--bg); }
.dd-head .dd-tag.amber  { background: var(--hold); color: var(--bg); }
.dd-head .dd-tag.blue   { background: var(--t1); color: var(--bg); }
.dd-head .dd-title {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.dd-head .dd-title .sub {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--t3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 4px;
}
.dd-close {
  background: transparent;
  border: 1px solid var(--b2);
  color: var(--t2);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 6px 10px;
  cursor: pointer;
  transition: all .12s;
  border-radius: var(--r-c);
}
.dd-close:hover { border-color: var(--t1); color: var(--t1); }

.dd-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 22px 80px;
}
.dd-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--b2);
  background: var(--s2);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ─── section heads inside drawer ───────────────────── */
.dd-sec {
  margin-bottom: 22px;
}
.dd-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--b1);
}
.dd-sec-head .ttl {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--t1);
}
.dd-sec-head .sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ─── key/value grid ────────────────────────────────── */
.dd-kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px 18px;
  font-size: 13px;
}
.dd-kv dt {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 5px 0;
  border-top: 1px solid var(--b1);
}
.dd-kv dd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--t1);
  padding: 5px 0;
  border-top: 1px solid var(--b1);
  word-break: break-all;
}
.dd-kv dt:first-of-type, .dd-kv dd:first-of-type { border-top: 0; }

/* ─── ledger block-detail: decisions list ───────────── */
.dd-dec {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--b1);
  align-items: start;
}
.dd-dec:last-child { border-bottom: 0; }
.dd-dec .idx {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--t3);
  letter-spacing: 0.1em;
  padding-top: 2px;
}
.dd-dec .body .op {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--t1);
  line-height: 1.35;
}
.dd-dec .body .meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.08em;
  margin-top: 3px;
}
.dd-dec .body .meta a {
  color: var(--t1);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
  cursor: pointer;
}
.dd-dec .verify {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--mint);
  padding-top: 2px;
}

/* ─── replay viewer ─────────────────────────────────── */
.dd-replay {
  background: var(--s2);
  border: 1px solid var(--b2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  padding: 14px 16px;
  color: var(--t2);
  max-height: 360px;
  overflow-y: auto;
  border-radius: var(--r-c);
}
.dd-replay .line { display: block; padding: 1px 0; }
.dd-replay .t  { color: var(--t3); margin-right: 10px; }
.dd-replay .ok { color: var(--mint); }
.dd-replay .warn { color: var(--hold); }
.dd-replay .err { color: var(--fail); }
.dd-replay .hilo { color: var(--t1); }
.dd-replay .dim { color: var(--t3); }
.dd-replay .cursor {
  display: inline-block;
  width: 8px; height: 13px;
  background: var(--t1);
  vertical-align: -2px;
  animation: ddBlink 1s steps(2) infinite;
}
@keyframes ddBlink { 0%,49%{opacity:1} 50%,100%{opacity:0} }

.dd-replay-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.dd-replay-controls .scrub {
  flex: 1;
  height: 6px;
  background: var(--b2);
  position: relative;
  cursor: pointer;
}
.dd-replay-controls .scrub-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--t1);
  transition: width .12s linear;
}
.dd-replay-controls .scrub-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.1em;
  min-width: 60px;
  text-align: right;
}

/* ─── clickable block row in main list ──────────────── */
.ledger { cursor: pointer; transition: background .12s; }
.ledger:hover { background: var(--s2); }
.ledger.dd-focused { background: var(--s3); }

/* ─── quarantine incident-detail ────────────────────── */
.q-row { cursor: pointer; transition: background .12s; }
.q-row:hover { background: var(--s2); }
.q-row.dd-focused { background: var(--s3); }

/* timeline */
.dd-tl {
  position: relative;
  padding-left: 26px;
  border-left: 1px solid var(--b2);
  margin-left: 8px;
}
.dd-tl-step {
  position: relative;
  padding: 8px 0 12px;
}
.dd-tl-step::before {
  content: "";
  position: absolute;
  left: -33px;
  top: 12px;
  width: 12px; height: 12px;
  background: var(--bg);
  border: 2px solid var(--t3);
  border-radius: 50%;
}
.dd-tl-step.ok::before    { border-color: var(--mint); background: var(--mint); }
.dd-tl-step.warn::before  { border-color: var(--hold); background: var(--hold); }
.dd-tl-step.err::before   { border-color: var(--fail); background: var(--fail); }
.dd-tl-step.info::before  { border-color: var(--t2); background: var(--t2); }
.dd-tl-step .t {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.dd-tl-step .l {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-top: 2px;
}
.dd-tl-step .d {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t2);
  margin-top: 4px;
  line-height: 1.45;
}

/* retry chart */
.dd-retry {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 70px;
  padding: 10px 0 0;
  border-bottom: 1px solid var(--b2);
  margin-bottom: 4px;
}
.dd-retry .bar {
  flex: 1;
  background: var(--b3);
  min-height: 2px;
  transition: background .2s;
}
.dd-retry .bar.spike { background: var(--fail); }
.dd-retry .bar.warn  { background: var(--hold); }
.dd-retry .bar.trip  { background: var(--fail); }

/* stack excerpt */
.dd-stack {
  background: var(--s2);
  border: 1px solid var(--b2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t2);
  padding: 12px 14px;
  line-height: 1.55;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre;
  border-radius: var(--r-c);
}
.dd-stack .err { color: var(--fail); font-weight: 700; }
.dd-stack .fn  { color: var(--t1); }
.dd-stack .file { color: var(--t3); }

/* breaker matrix */
.dd-brk-matrix {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.dd-brk {
  padding: 12px;
  border: 1px solid var(--b2);
  background: var(--bg);
  position: relative;
  border-radius: var(--r-c);
}
.dd-brk .id {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--t3);
}
.dd-brk .val {
  font-family: var(--sans);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: 6px;
}
.dd-brk .lbl {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--t3);
  margin-top: 4px;
}
.dd-brk.tripped {
  border-color: var(--fail);
}
.dd-brk.tripped .val { color: var(--fail); }
.dd-brk.tripped::after {
  content: "TRIPPED";
  position: absolute;
  top: 8px; right: 8px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--fail);
}
.dd-brk.warn {
  border-color: var(--hold);
}
.dd-brk.warn .val { color: var(--hold); }

/* ─── shield: intercept feed + rule detail ──────────── */
.shield-rule { cursor: pointer; }
.shield-rule.dd-focused { background: var(--s3); }

.shield-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  align-items: start;
}
.shield-feed {
  position: sticky;
  top: 76px;
  background: var(--bg);
  border: 1px solid var(--b2);
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r);
}
.shield-feed .head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--b2);
  background: var(--s2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.shield-feed .head .ttl {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.shield-feed .head .live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--t1);
}
.shield-feed .head .live::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--t1);
  border-radius: 50%;
  box-shadow: var(--glow);
  animation: ddBlink 1.6s infinite;
}
.shield-feed-stream {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.sf-row {
  display: grid;
  grid-template-columns: auto 40px 1fr auto;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--b1);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  align-items: start;
  animation: sfIn .28s ease-out;
}
@keyframes sfIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sf-row .t { color: var(--t3); font-size: 10px; }
.sf-row .v {
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--bg);
  background: var(--mint);
  padding: 1px 5px;
  text-align: center;
  line-height: 1.5;
  height: fit-content;
  border-radius: var(--r-chip);
}
.sf-row .v.pass  { background: var(--mint); }
.sf-row .v.block { background: var(--fail); }
.sf-row .v.esc   { background: var(--hold); color: var(--bg); }
.sf-row .msg {
  color: var(--t2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sf-row .msg .ag { color: var(--t1); font-weight: 600; }
.sf-row .rule { color: var(--t1); font-size: 10px; }

/* rule history sparkline */
.dd-hit-chart {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 52px;
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--b1);
}
.dd-hit-chart .bar {
  flex: 1;
  background: var(--b3);
  min-height: 1px;
}
.dd-hit-chart .bar.hit { background: var(--t2); }
.dd-hit-chart .bar.block { background: var(--fail); }

/* yaml block */
.dd-yaml {
  background: var(--s2);
  border: 1px solid var(--b2);
  border-left: 3px solid var(--b3);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  padding: 14px 16px;
  color: var(--t1);
  white-space: pre;
  overflow-x: auto;
  border-radius: var(--r-c);
}
.dd-yaml .k { color: var(--t2); }
.dd-yaml .s { color: var(--t1); }
.dd-yaml .c { color: var(--t3); font-style: italic; }
.dd-yaml .n { color: var(--t1); font-weight: 600; }

/* what-if tester */
.dd-whatif {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--s2);
  border: 1px solid var(--b2);
  margin-top: 10px;
  border-radius: var(--r-c);
}
.dd-whatif input {
  background: transparent;
  border: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--t1);
  outline: none;
  width: 100%;
}
.dd-whatif .verdict {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 4px 8px;
  border-radius: var(--r-chip);
}
.dd-whatif .verdict.pass  { background: var(--mint);  color: var(--bg); }
.dd-whatif .verdict.block { background: var(--fail); color: var(--bg); }
.dd-whatif .verdict.none  { background: var(--b2);   color: var(--t3); }

/* shield responsive — collapse feed under main when narrow */
@media (max-width: 1280px) {
  .shield-layout { grid-template-columns: 1fr; }
  .shield-feed { position: static; max-height: 420px; }
}
@media (max-width: 960px) {
  .dd-brk-matrix { grid-template-columns: repeat(2, 1fr); }
  .dd-drawer { width: 94vw; }
}

/* ─── RAG store inspector ───────────────────────────── */
.dd-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 4px 0 10px;
}
.dd-kpi {
  padding: 10px 12px;
  border: 1px solid var(--b2);
  background: var(--bg);
  border-radius: var(--r-c);
}
.dd-kpi .k {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--t3);
}
.dd-kpi .v {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: 6px;
  color: var(--t1);
}
.dd-kpi .v.blue { color: var(--t1); }
.dd-kpi .v.green { color: var(--t1); }
.dd-kpi .v.amber { color: var(--hold); }
.dd-kpi .f {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* chunk row */
.dd-chunk {
  padding: 10px 12px;
  border: 1px solid var(--b1);
  border-left: 3px solid var(--b3);
  background: var(--s2);
  margin-bottom: 6px;
  border-radius: var(--r-c);
}
.dd-chunk .head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.dd-chunk .head .score { color: var(--t1); font-weight: 700; }
.dd-chunk .body {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t1);
  line-height: 1.5;
  white-space: pre-wrap;
}
.dd-chunk .body .hl { background: var(--b2); color: var(--t1); padding: 0 2px; }

/* query playground */
.dd-qp {
  border: 1px solid var(--b2);
  background: var(--s2);
  border-radius: var(--r-c);
  overflow: hidden;
}
.dd-qp-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  border-bottom: 1px solid var(--b2);
}
.dd-qp-input input {
  background: transparent;
  border: 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--t1);
  outline: none;
}
.dd-qp-input button {
  background: var(--t1);
  border: 0;
  color: var(--bg);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 0 18px;
  cursor: pointer;
}
.dd-qp-input button:hover { filter: brightness(1.1); }
.dd-qp-meta {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--b2);
}
.dd-qp-meta .path {
  font-weight: 700;
}
.dd-qp-meta .path.fast { color: var(--t1); }
.dd-qp-meta .path.slow { color: var(--t2); }
.dd-qp-results {
  padding: 10px 14px;
  max-height: 320px;
  overflow-y: auto;
}

/* recall sparkline */
.dd-sparkbox {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
}
.dd-spark {
  height: 48px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.dd-spark .b {
  flex: 1;
  background: var(--b3);
  min-height: 2px;
}
.dd-spark .b.up { background: var(--t1); }
.dd-spark .b.dn { background: var(--t3); }

/* ─── Connector detail ──────────────────────────────── */
.dd-conn-head {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--b1);
  margin-bottom: 16px;
}
.dd-conn-head .icn {
  width: 56px; height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  border: 1.5px solid var(--t1);
  background: var(--s2);
  border-radius: var(--r-m);
}
.dd-conn-head .title {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1;
}
.dd-conn-head .ep {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--t3);
  letter-spacing: 0.08em;
  margin-top: 6px;
}

/* 24h call-volume chart */
.dd-volume {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 80px;
  padding: 8px 0;
  border-bottom: 1px solid var(--b1);
}
.dd-volume .bar {
  flex: 1;
  background: var(--t1);
  min-height: 2px;
  opacity: 0.6;
  transition: opacity .12s;
}
.dd-volume .bar:hover { opacity: 1; }
.dd-volume .bar.err { background: var(--fail); opacity: 0.9; }

/* rate-limit meter */
.dd-meter {
  padding: 10px 0;
}
.dd-meter .track {
  position: relative;
  height: 8px;
  background: var(--b2);
  overflow: hidden;
}
.dd-meter .fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, var(--mint) 0%, var(--mint) 60%, var(--hold) 80%, var(--fail) 100%);
}
.dd-meter .lbl {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--t3);
  margin-top: 6px;
  text-transform: uppercase;
}

/* key timeline */
.dd-key-tl {
  position: relative;
  padding: 10px 0 4px;
}
.dd-key-tl .bar {
  position: relative;
  height: 8px;
  background: var(--b2);
}
.dd-key-tl .tick {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 16px;
  background: var(--t1);
}
.dd-key-tl .tick.rotate { background: var(--t2); }
.dd-key-tl .tick.expired { background: var(--fail); }
.dd-key-tl .labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 0.1em;
}

/* call log list */
.dd-call {
  display: grid;
  grid-template-columns: 70px 50px 1fr 50px;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--b1);
  font-family: var(--mono);
  font-size: 11px;
  align-items: baseline;
}
.dd-call:last-child { border-bottom: 0; }
.dd-call .t { color: var(--t3); }
.dd-call .s {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  width: fit-content;
  color: var(--bg);
  border-radius: var(--r-chip);
}
.dd-call .s.s200 { background: var(--mint); }
.dd-call .s.s204 { background: var(--mint); }
.dd-call .s.s400, .dd-call .s.s404 { background: var(--hold); color: var(--bg); }
.dd-call .s.s500, .dd-call .s.s503 { background: var(--fail); color: var(--bg); }
.dd-call .path { color: var(--t1); }
.dd-call .dur { color: var(--t3); text-align: right; }

/* clickable rows */
.rag-row { cursor: pointer; transition: background .12s; }
.rag-row.dd-focused { background: var(--s3); }
.conn-card { cursor: pointer; transition: transform .12s; }
.conn-card.dd-focused { outline: 2px solid var(--t1); outline-offset: -2px; }
