/* RCT static demo framework.
   Taxonomy follows the AVP HTML demo set: dark header, two-pane shell
   (pipeline left, running narrative right), staged cards, human gates,
   terminal log, and a post-run interactive result panel. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #0D1321;
  --ink2: #374151;
  --ink3: #6B7280;
  --surface: #F8F9FB;
  --white: #fff;
  --border: #E5E7EB;
  --blue: #1251A3;
  --blue-light: #EFF6FF;
  --blue-mid: #BFDBFE;
  --green: #0F6E56;
  --green-light: #E1F5EE;
  --purple: #3C3489;
  --purple-light: #EEEDFE;
  --purple-mid: #C4B5FD;
  --amber: #92400E;
  --amber-light: #FFFBEB;
  --amber-mid: #FCD34D;
  --red: #991B1B;
  --red-light: #FEF2F2;
  --red-mid: #FECACA;
  --rct: #0b6f63;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
}

/* Header */
.hdr {
  background: var(--ink);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 52px;
}
.hdr-logo { font-size: 15px; font-weight: 700; }
.hdr-logo span { color: #5EEAD4; }
.hdr-sub { font-size: 10px; color: #9CA3AF; }
.hdr-right { text-align: right; }
.hdr-title { font-size: 12px; font-weight: 600; color: #fff; }
.hdr-back {
  font-size: 10px;
  color: #9CA3AF;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}
.hdr-back:hover { color: #fff; border-color: rgba(255, 255, 255, .4); }

/* Mock banner - every demo must declare itself */
.mockbar {
  background: var(--amber-light);
  border-bottom: 1px solid var(--amber-mid);
  color: var(--amber);
  font-size: 11px;
  padding: 6px 24px;
  text-align: center;
}

.shell {
  display: grid;
  grid-template-columns: 1fr 390px;
  height: calc(100vh - 52px - 27px);
  overflow: hidden;
}

/* Left pipeline pane */
.pipeline { overflow-y: auto; padding: 18px 20px; border-right: 1px solid var(--border); }
.p-title { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.p-sub { font-size: 11.5px; color: var(--ink3); margin-bottom: 8px; }
.p-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }

.badge { font-size: 10px; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.b-prod { background: var(--green-light); color: var(--green); }
.b-agent { background: var(--purple-light); color: var(--purple); }
.b-human { background: #FBEAF0; color: #993556; }
.b-gov { background: #F1EFE8; color: #444441; border: 1px solid #D1D5DB; }

.trigger {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  padding: 10px 14px;
  margin-bottom: 10px;
  border-radius: 4px;
}
.trigger-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.trigger-facts { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink3); }
.trigger-facts b { color: var(--ink); }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.met { background: #fff; border: 1px solid var(--border); border-radius: 7px; padding: 7px 8px; text-align: center; }
.met-l { font-size: 9.5px; color: var(--ink3); margin-bottom: 2px; }
.met-v { font-size: 15px; font-weight: 700; font-family: Consolas, monospace; }

.track { margin-bottom: 8px; }
.conn { display: flex; justify-content: center; height: 14px; align-items: center; margin-bottom: 7px; }
.conn-line { width: 2px; height: 14px; background: var(--border); border-radius: 2px; transition: background .4s; }
.conn-line.lit { background: var(--blue); }

.stage {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 7px;
  opacity: .25;
  transition: opacity .35s, border-color .25s, box-shadow .25s;
}
.stage.active { opacity: 1; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(18, 81, 163, .12); }
.stage.done { opacity: 1; }
.s-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.s-ic { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.s-nm { font-size: 12.5px; font-weight: 600; flex: 1; }
.s-tick { color: #16A34A; font-size: 13px; opacity: 0; transition: opacity .2s; margin-left: auto; }
.stage.done .s-tick { opacity: 1; }
.s-tools { display: flex; gap: 3px; flex-wrap: wrap; margin-bottom: 5px; }
.s-tool { font-size: 9px; padding: 2px 6px; border-radius: 3px; background: #F8FAFC; color: var(--ink3); border: 1px solid var(--border); font-family: Consolas, monospace; }
.s-desc { font-size: 11px; color: var(--ink3); min-height: 14px; line-height: 1.4; }

.gate-box {
  background: var(--amber-light);
  border: 1px solid var(--amber-mid);
  border-radius: 9px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: none;
}
.gate-box h4 { font-size: 13px; font-weight: 700; color: var(--amber); margin-bottom: 4px; }
.gate-box p { font-size: 11.5px; color: var(--amber); line-height: 1.5; margin-bottom: 10px; }
.gate-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-ap { background: var(--green-light); border: 1px solid #6EE7B7; color: #065F46; padding: 8px 16px; border-radius: 6px; font-weight: 600; font-size: 12px; cursor: pointer; }
.btn-rj { background: var(--red-light); border: 1px solid var(--red-mid); color: var(--red); padding: 8px 16px; border-radius: 6px; font-weight: 600; font-size: 12px; cursor: pointer; }

.run-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.start-btn { background: var(--ink); color: #fff; border: none; padding: 10px 22px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; }
.reset-btn { background: #fff; color: var(--ink2); border: 1px solid var(--border); padding: 10px 18px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; display: none; }
.done-bar {
  background: var(--green-light);
  border: 1px solid #6EE7B7;
  border-radius: 7px;
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 12px;
  color: #065F46;
  font-weight: 600;
  display: none;
}

/* Right narrative pane */
.narrative { background: #fff; overflow-y: auto; display: flex; flex-direction: column; }
.narr-hdr { padding: 13px 18px; border-bottom: 1px solid var(--border); background: #F8FAFC; flex-shrink: 0; }
.narr-hdr-title { font-size: 13px; font-weight: 700; }
.narr-hdr-sub { font-size: 11px; color: var(--ink3); margin-top: 1px; }
.narr-body { flex: 1; padding: 14px 18px; overflow-y: auto; }
.narr-idle { color: var(--ink3); font-size: 12.5px; text-align: center; padding-top: 48px; line-height: 2; }
.narr-item { animation: nfade .35s ease; }
@keyframes nfade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.n-stage-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #94A3B8; margin-bottom: 5px; }
.n-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 20px; margin-bottom: 8px; }
.n-headline { font-size: 14px; font-weight: 700; margin-bottom: 7px; line-height: 1.4; }
.n-text { font-size: 12px; color: var(--ink2); line-height: 1.75; margin-bottom: 10px; }
.n-bullets { list-style: none; margin-bottom: 10px; }
.n-bullets li { font-size: 11.5px; color: var(--ink2); padding: 3px 0 3px 16px; position: relative; line-height: 1.5; }
.n-bullets li::before { content: "\2192"; position: absolute; left: 0; color: var(--blue); font-weight: 700; }
.n-tools { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.n-tool { font-size: 10px; padding: 2px 7px; border-radius: 4px; background: var(--blue-light); color: var(--blue); border: 1px solid var(--blue-mid); font-family: Consolas, monospace; }
.n-tool.agent { background: var(--purple-light); color: var(--purple); border-color: var(--purple-mid); }
.n-tool.human { background: #FBEAF0; color: #993556; border-color: #FBCFE8; }
.n-finding { background: var(--amber-light); border: 1px solid var(--amber-mid); border-radius: 6px; padding: 8px 11px; font-size: 11px; color: var(--amber); margin-bottom: 8px; line-height: 1.55; }
.n-success { background: #F0FDF4; border: 1px solid #86EFAC; border-radius: 6px; padding: 8px 11px; font-size: 11px; color: #065F46; margin-bottom: 8px; line-height: 1.55; }
.n-log { background: #0B1220; border-radius: 7px; padding: 8px 12px; font-family: Consolas, monospace; font-size: 10px; color: #7DD3FC; line-height: 1.9; margin-bottom: 10px; overflow-x: auto; }
.n-log .dim { color: #475569; }
.n-log .ok { color: #86EFAC; }
.n-log .warn { color: #FDE68A; }
.n-log .err { color: #FCA5A5; }
.n-note { margin-top: 4px; padding: 9px 12px; background: #F0F9FF; border-radius: 6px; border-left: 3px solid var(--blue); }
.n-note-lbl { font-size: 9.5px; font-weight: 700; color: var(--blue); margin-bottom: 3px; text-transform: uppercase; letter-spacing: .05em; }
.n-note-txt { font-size: 11.5px; color: #0C4A6E; line-height: 1.65; }
.n-divider { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

/* Post-run interactive result panel */
.result { display: none; margin-top: 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff; overflow: hidden; }
.result.shown { display: block; }
.result-hdr { padding: 10px 14px; border-bottom: 1px solid var(--border); background: #F8FAFC; }
.result-hdr h4 { font-size: 13px; font-weight: 700; }
.result-hdr p { font-size: 11px; color: var(--ink3); margin-top: 2px; }
.result-body { padding: 12px 14px; }

.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.controls label { font-size: 10.5px; color: var(--ink3); font-weight: 600; }
.controls select,
.controls input[type="search"],
.controls input[type="text"] {
  font: inherit;
  font-size: 12px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-width: 120px;
}
.chipset { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink2);
  cursor: pointer;
  font-weight: 600;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

table.data { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.data th {
  text-align: left;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink3);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td { padding: 7px 8px; border-bottom: 1px solid #F1F5F9; vertical-align: top; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: #F8FAFC; }
table.data tbody tr.sel { background: var(--blue-light); }
.mono { font-family: Consolas, monospace; }
.num { text-align: right; font-family: Consolas, monospace; }
.pos { color: #15803D; font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.pill { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: var(--green-light); color: var(--green); }
.pill-warn { background: var(--amber-light); color: var(--amber); }
.pill-err { background: var(--red-light); color: var(--red); }
.pill-info { background: var(--blue-light); color: var(--blue); }
.pill-mute { background: #F1F5F9; color: var(--ink3); }

.detail { margin-top: 10px; padding: 11px 13px; background: #F8FAFC; border: 1px solid var(--border); border-radius: 7px; font-size: 11.5px; line-height: 1.7; color: var(--ink2); }
.detail h5 { font-size: 12px; color: var(--ink); margin-bottom: 5px; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-top: 6px; }
.detail dt { color: var(--ink3); font-size: 10.5px; }
.detail dd { font-family: Consolas, monospace; font-size: 11px; }
.empty { font-size: 11.5px; color: var(--ink3); padding: 14px; text-align: center; }

.bar { height: 6px; border-radius: 3px; background: #E2E8F0; overflow: hidden; min-width: 48px; }
.bar > span { display: block; height: 100%; background: var(--blue); }

.seg {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  background: #fff;
}
.seg:hover { background: #F8FAFC; }
.seg.sel { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(18, 81, 163, .1); }
.seg-top { display: flex; gap: 8px; align-items: center; font-size: 10.5px; color: var(--ink3); margin-bottom: 3px; }
.seg-txt { font-size: 12px; line-height: 1.5; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .pipeline { border-right: none; border-bottom: 1px solid var(--border); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .hdr { height: auto; padding: 10px 16px; flex-wrap: wrap; }
}

/* Business case strip, injected by the engine when a run completes */
.bizbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--blue-mid);
  background: var(--blue-light);
  border-radius: 9px;
}
.bizbar strong { display: block; font-size: 12.5px; color: var(--ink); }
.bizbar span { display: block; font-size: 11px; color: var(--ink3); margin-top: 2px; line-height: 1.5; }
.bizbar a {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.bizbar a:hover { background: #0E4185; }
