/* Sadhguru Archive Studio · Review & Agent Harness UI (harness.css)
   Shares tokens with search.css (--bg, --panel, --border, --text, --accent, etc.). */

:root {
  --cat-framing: #d97706;
  --cat-caption: #2563eb;
  --cat-broll: #059669;
  --cat-audio: #7c3aed;
  --cat-music: #db2777;
  --cat-pacing: #ea580c;
  --cat-content: #dc2626;
  --cat-colour: #0891b2;
  --cat-text: #4f46e5;
  --cat-other: #6d6358;

  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.11);
  --warn-border: rgba(217, 119, 6, 0.38);
  --ok-soft: rgba(61, 139, 90, 0.11);
  --ok-border: rgba(61, 139, 90, 0.38);
  --danger-border: rgba(196, 61, 47, 0.42);
  --diff-add-bg: rgba(61, 139, 90, 0.12);
  --diff-add-fg: #25613b;
  --diff-del-bg: rgba(196, 61, 47, 0.11);
  --diff-del-fg: #9e2a1f;
}

:root[data-theme="dark"] {
  --cat-framing: #f59e0b;
  --cat-caption: #60a5fa;
  --cat-broll: #34d399;
  --cat-audio: #a78bfa;
  --cat-music: #f472b6;
  --cat-pacing: #fb923c;
  --cat-content: #f87171;
  --cat-colour: #22d3ee;
  --cat-text: #818cf8;
  --cat-other: #9ca3af;

  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.15);
  --warn-border: rgba(245, 158, 11, 0.45);
  --ok-soft: rgba(95, 176, 124, 0.16);
  --ok-border: rgba(95, 176, 124, 0.45);
  --danger-border: rgba(229, 103, 90, 0.48);
  --diff-add-bg: rgba(95, 176, 124, 0.16);
  --diff-add-fg: #9be2b4;
  --diff-del-bg: rgba(229, 103, 90, 0.16);
  --diff-del-fg: #f7a69e;
}

/* ---------- Shell view containers ---------- */
body[data-view="review"],
body[data-view="agent"] {
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
}
#view-review,
#view-agent {
  grid-row: 2 / -1;
  min-width: 0;
  min-height: 0;
  height: calc(100vh - var(--topbar-h));
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

#view-review .seg button,
#view-agent .seg button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
#view-review .seg button > span:not(.count-badge),
#view-agent .seg button > span:not(.count-badge) {
  display: inline;
  height: auto;
  line-height: inherit;
  padding: 0;
  background: transparent !important;
  box-shadow: none !important;
}
#view-review .seg button > .count-badge,
#view-agent .seg button > .count-badge {
  display: inline-grid;
  place-items: center;
  height: 17px;
  min-width: 17px;
  line-height: 1;
  padding: 0 5px;
}
#view-review .seg button .i,
#view-agent .seg button .i {
  width: 14px;
  height: 14px;
}

#view-review .badge,
#view-agent .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
#view-review .badge .i,
#view-agent .badge .i {
  width: 12px;
  height: 12px;
}

/* ---------- Shared HX Primitives ---------- */
.hx-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.hx-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}
.hx-status.s-active,
.hx-status.s-done,
.hx-status.s-resolved,
.hx-status.s-approved,
.hx-status.s-passed {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: var(--ok-border);
}
.hx-status.s-running,
.hx-status.s-in_progress,
.hx-status.s-decoding,
.hx-status.s-claimed {
  background: var(--ai-soft);
  color: var(--ai-fg);
  border-color: rgba(107, 91, 210, 0.35);
}
.hx-status.s-running::before,
.hx-status.s-decoding::before {
  animation: hx-pulse-dot 1.2s infinite ease-in-out;
}
@keyframes hx-pulse-dot {
  0%, 100% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.25); opacity: 1; }
}
.hx-status.s-waiting_approval,
.hx-status.s-candidate,
.hx-status.s-proposed,
.hx-status.s-pending,
.hx-status.s-queued,
.hx-status.s-open,
.hx-status.s-draft {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: var(--warn-border);
}
.hx-status.s-failed,
.hx-status.s-rejected,
.hx-status.s-error,
.hx-status.s-hard {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}
.hx-status.s-retired,
.hx-status.s-archived,
.hx-status.s-wontfix,
.hx-status.s-cancelled {
  background: var(--panel-2);
  color: var(--muted);
  border-color: var(--border);
}

.hx-bar {
  display: inline-block;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: var(--panel-3);
  overflow: hidden;
  vertical-align: middle;
}
.hx-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.hx-bar.ok > span { background: var(--ok); }
.hx-bar.ai > span { background: var(--ai); }

.hx-av {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: hsl(var(--h, 28) 55% 44%);
  flex: none;
}
.hx-av.ai {
  background: var(--ai-soft);
  color: var(--ai-fg);
  border: 1px solid rgba(107, 91, 210, 0.32);
}
.hx-av.ai .i { width: 14px; height: 14px; }

.hx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}
.hx-empty > .i {
  width: 28px;
  height: 28px;
  color: var(--muted);
  opacity: 0.65;
}
.hx-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.hx-empty-text {
  font-size: 12.5px;
  max-width: 380px;
  line-height: 1.5;
  color: var(--text-2);
}

.btn.hx-danger {
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn.hx-danger:hover {
  background: var(--danger-soft);
}
.btn.ai-cta {
  background: linear-gradient(135deg, var(--accent) 0%, #b54e0b 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-xs);
}
.btn.ai-cta:hover {
  filter: brightness(1.06);
}

/* ---------- Modal ---------- */
.hx-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 13, 11, 0.52);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
  animation: hx-fade-in 0.14s ease-out;
}
@keyframes hx-fade-in { from { opacity: 0; } to { opacity: 1; } }
.hx-modal {
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  overscroll-behavior: contain;
}
.hx-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.hx-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.hx-modal-body {
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 13.5px;
}
.hx-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.hx-form-grid {
  display: grid;
  gap: 12px;
}
.hx-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hx-field > label,
.hx-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.hx-textarea {
  width: 100%;
  min-height: 76px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  font: 13px/1.45 var(--font-ui);
  resize: vertical;
}
.hx-textarea.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.hx-textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* ---------- Markdown & Diff ---------- */
.hx-md {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
}
.hx-md h2, .hx-md h3, .hx-md h4, .hx-md h5 {
  margin: 14px 0 6px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.hx-md h2 { font-size: 16px; border-bottom: 1px solid var(--border-soft); padding-bottom: 4px; }
.hx-md h3 { font-size: 14.5px; }
.hx-md h4 { font-size: 13.5px; color: var(--text-2); }
.hx-md p { margin: 0 0 8px; }
.hx-md ul, .hx-md ol { margin: 0 0 10px; padding-left: 20px; }
.hx-md li { margin-bottom: 3px; }
.hx-md pre {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  overflow-x: auto;
  font: 12px/1.5 var(--font-mono);
}
.hx-md blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-softer);
  border-radius: 0 6px 6px 0;
  color: var(--text-2);
}
.hx-md-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  padding: 8px 12px;
  margin: 0 0 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
}
.hx-md-meta dt { font-weight: 600; color: var(--muted); }
.hx-md-meta dd { margin: 0; font-family: var(--font-mono); color: var(--text-2); }

.hx-diff {
  width: 100%;
  border-collapse: collapse;
  font: 12px/1.55 var(--font-mono);
  table-layout: fixed;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.hx-diff td {
  padding: 2px 8px;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
  border-bottom: 1px solid var(--border-soft);
}
.hx-diff .hx-dn {
  width: 38px;
  text-align: right;
  color: var(--muted);
  background: var(--panel-2);
  user-select: none;
  border-right: 1px solid var(--border);
  font-size: 11px;
}
.hx-diff .hx-dc.add {
  background: var(--diff-add-bg);
  color: var(--diff-add-fg);
}
.hx-diff .hx-dc.del {
  background: var(--diff-del-bg);
  color: var(--diff-del-fg);
  text-decoration: none;
}
.hx-diff .hx-dc.empty {
  background: var(--panel-2);
  opacity: 0.5;
}
.hx-diff .hx-fold td {
  padding: 4px 10px;
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 11.5px;
  text-align: center;
}
.hx-diff .hx-fold .i {
  display: inline-block;
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 4px;
}

/* =========================================================================
   REVIEW VIEW (#view-review)
   ========================================================================= */
.rv-shell {
  display: grid;
  grid-template-rows: 52px auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  background: var(--bg);
}

.rv-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.rv-topbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rv-topbar-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rv-select {
  width: auto;
  min-width: 170px;
  max-width: 280px;
  height: 32px;
  font-weight: 500;
}
.rv-ver-select {
  min-width: 185px;
}
.rv-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
  flex: none;
}
.rv-score-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.rv-score-num {
  font: 700 13px var(--font-mono);
  color: var(--ok);
}
.rv-score-num.warn { color: var(--warn); }
.rv-score-num.bad { color: var(--danger); }
.rv-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* Live AI Fix run banner inside Review */
.rv-run-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--ai-soft);
  border-bottom: 1px solid rgba(107, 91, 210, 0.3);
  font-size: 13px;
}
.rv-run-banner.done {
  background: var(--ok-soft);
  border-bottom-color: var(--ok-border);
}
.rv-run-banner-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rv-run-banner-step {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Review Workspace Split */
.rv-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
@media (max-width: 1260px) {
  .rv-workspace {
    grid-template-columns: minmax(0, 1fr) 370px;
  }
}

/* Left Player Column */
.rv-left {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  min-width: 0;
  min-height: 0;
  padding: 12px 14px 10px 16px;
  gap: 8px;
  overflow: hidden;
}

/* Stage Container */
.rv-stage-wrap {
  position: relative;
  min-height: 0;
  min-width: 0;
  display: flex;
   flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #221f1b 0%, #12100e 85%);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
  padding: 12px;
  box-shadow: var(--shadow-sm);
}
.rv-stage-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.rv-stage-hud > * {
  pointer-events: auto;
}
.rv-hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(18, 16, 14, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f3efe9;
  font-size: 12px;
  font-weight: 500;
}
.rv-hud-pill code {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
}

/* Video Frame Box with true aspect ratio */
.rv-frame {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  height: 100%;
  width: auto;
  background: #0d0c0a;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.1);
  user-select: none;
}
.rv-frame[data-aspect="16:9"] {
  aspect-ratio: 16 / 9;
  width: min(100%, calc((100vh - 330px) * 16 / 9));
  height: auto;
}
.rv-frame[data-aspect="1:1"] {
  aspect-ratio: 1 / 1;
  height: 100%;
  width: auto;
}
.rv-frame video,
.rv-frame canvas.rv-synth-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.rv-frame video.rv-video-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Safe zone guide overlay */
.rv-safe-guide {
  position: absolute;
  inset: 8% 15% 20% 10%;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  pointer-events: none;
  z-index: 3;
}
.rv-safe-guide::after {
  content: "9:16 Safe Zone";
  position: absolute;
  top: 4px;
  right: 6px;
  font: 500 10px var(--font-mono);
  color: rgba(255, 255, 255, 0.45);
}

/* Annotation Drawing & Boxes Overlay */
.rv-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: crosshair;
  touch-action: none;
}
.rv-box {
  position: absolute;
  border: 2px solid var(--box-c, var(--accent));
  background: color-mix(in srgb, var(--box-c, var(--accent)) 16%, transparent);
  border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: box-shadow 0.12s, transform 0.12s;
}
.rv-box:hover,
.rv-box.selected {
  background: color-mix(in srgb, var(--box-c, var(--accent)) 26%, transparent);
  box-shadow: 0 0 0 2px #fff, 0 4px 14px rgba(0, 0, 0, 0.5);
  z-index: 6;
}
.rv-box.draft {
  border-style: dashed;
  border-color: #fff;
  background: rgba(200, 102, 15, 0.24);
  pointer-events: none;
}
.rv-box-tag {
  position: absolute;
  top: -22px;
  left: -2px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px 4px 4px 0;
  background: var(--box-c, var(--accent));
  color: #fff;
  font: 600 11px/20px var(--font-ui);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.rv-box-tag b {
  font-family: var(--font-mono);
}

/* Compare Mode (Side-by-side & A/B Wipe) */
.rv-compare-bar {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(20, 18, 15, 0.86);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f3efe9;
  font-size: 12.5px;
}
.rv-compare-bar .select {
  height: 28px;
  width: auto;
  min-width: 150px;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
}
.rv-compare-bar .select option {
  background: var(--panel);
  color: var(--text);
}
.rv-compare-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
  height: 100%;
  padding-top: 38px;
}
.rv-compare-pane {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.rv-compare-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 7;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(15, 13, 11, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font: 600 11.5px var(--font-ui);
}
.rv-compare-label.ver-b {
  left: auto;
  right: 10px;
  background: rgba(61, 139, 90, 0.88);
}

/* A/B Wipe container */
.rv-wipe-stage {
  position: relative;
  height: calc(100% - 40px);
  margin-top: 36px;
  aspect-ratio: 9 / 16;
  background: #0d0c0a;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12);
  user-select: none;
}
.rv-wipe-stage[data-aspect="16:9"] {
  aspect-ratio: 16 / 9;
  width: min(100%, calc((100vh - 360px) * 16 / 9));
  height: auto;
}
.rv-wipe-layer {
  position: absolute;
  inset: 0;
}
.rv-wipe-layer.layer-b {
  clip-path: inset(0 0 0 var(--wipe-pct, 50%));
}
.rv-wipe-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--wipe-pct, 50%);
  width: 2px;
  background: #fff;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.7);
  z-index: 8;
  cursor: ew-resize;
}
.rv-wipe-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  font: 700 11px var(--font-mono);
}

/* Mini Timeline under player */
.rv-minitl {
  position: relative;
  height: 76px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
}
.rv-mtl-ruler {
  position: relative;
  height: 18px;
  background: var(--tl-strip);
  border-bottom: 1px solid var(--border-soft);
  font: 10.5px/18px var(--font-mono);
  color: var(--muted);
}
.rv-mtl-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--tl-tick-minor);
  padding-left: 4px;
  pointer-events: none;
}
.rv-mtl-tracks {
  position: relative;
  height: 34px;
  background: var(--tl-track);
  border-bottom: 1px solid var(--border-soft);
}
.rv-mtl-shot {
  position: absolute;
  top: 18px;
  height: 14px;
  border-radius: 3px;
  background: var(--panel-3);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  padding: 0 5px;
  font-size: 10px;
  line-height: 12px;
  color: var(--text-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rv-mtl-shot.broll {
  top: 2px;
  height: 14px;
  z-index: 2;
  background: rgba(5, 150, 105, 0.16);
  border-color: rgba(5, 150, 105, 0.42);
  color: var(--cat-broll);
}
.rv-mtl-notes {
  position: relative;
  height: 22px;
  background: var(--panel);
}
.rv-mtl-pin {
  position: absolute;
  top: 4px;
  height: 14px;
  min-width: 10px;
  border-radius: 4px;
  background: var(--pin-c, var(--accent));
  opacity: 0.88;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.6);
  transition: transform 0.12s, opacity 0.12s;
}
.rv-mtl-pin:hover,
.rv-mtl-pin.active {
  opacity: 1;
  transform: scaleY(1.18);
  z-index: 3;
  box-shadow: 0 0 0 2px var(--accent-soft-2);
}
.rv-mtl-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--tl-sel);
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  pointer-events: none;
  z-index: 3;
}
.rv-mtl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--playhead);
  z-index: 6;
  pointer-events: none;
}
.rv-mtl-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  border: 6px solid transparent;
  border-top: 7px solid var(--playhead);
}

/* Per-shot quick reaction strip (👍 / 👎) */
.rv-shot-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.rv-shot-strip-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  padding: 0 4px;
}
.rv-shot-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 4px 0 9px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
  flex: none;
  transition: border-color 0.12s, background-color 0.12s;
}
.rv-shot-pill.active {
  border-color: var(--accent-border);
  background: var(--accent-softer);
}
.rv-shot-pill-title {
  cursor: pointer;
  color: var(--text);
  font-weight: 500;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rv-shot-pill-tc {
  font: 11px var(--font-mono);
  color: var(--muted);
}
.rv-shot-react {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.rv-shot-react .i { width: 13px; height: 13px; }
.rv-shot-react:hover { background: var(--panel); color: var(--text); }
.rv-shot-react.up.on { color: var(--ok); background: var(--ok-soft); }
.rv-shot-react.down.on { color: var(--danger); background: var(--danger-soft); }

/* Transport Bar */
.rv-transport {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.rv-tc-readout {
  font: 600 15px/1 var(--font-mono);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 138px;
}
.rv-tc-readout small {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}
.rv-shuttle-pill {
  font: 600 11px var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--panel-2);
  color: var(--muted);
}
.rv-shuttle-pill.live {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.rv-tools-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Right Column: Annotation Composer & List */
.rv-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--panel);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

/* Composer Card */
.rv-composer {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.rv-comp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.rv-comp-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.rv-comp-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rv-comp-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  font: 500 11.5px var(--font-mono);
  color: var(--accent-text);
}
.rv-comp-chip button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.rv-comp-chip button .i { width: 12px; height: 12px; }
.rv-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.rv-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}
.rv-cat-btn::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, var(--muted));
}
.rv-cat-btn:hover {
  border-color: var(--border-stronger);
  color: var(--text);
}
.rv-cat-btn.active {
  background: color-mix(in srgb, var(--c, var(--accent)) 15%, var(--panel));
  border-color: var(--c, var(--accent));
  color: var(--text);
  font-weight: 600;
}
.rv-comp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.rv-comp-input {
  width: 100%;
  min-height: 54px;
  max-height: 110px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  font: 13px/1.45 var(--font-ui);
  resize: vertical;
}
.rv-comp-input:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

/* Filter bar for annotations */
.rv-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.rv-notes-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rv-note-card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, background-color 0.12s;
}
.rv-note-card:hover {
  border-color: var(--border-strong);
}
.rv-note-card.active {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: var(--accent-softer);
}
.rv-note-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.rv-note-idx {
  font: 700 11px/18px var(--font-mono);
  padding: 0 5px;
  border-radius: 4px;
  background: var(--panel-3);
  color: var(--text-2);
}
.rv-note-tc {
  font: 600 12px/20px var(--font-mono);
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.rv-note-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  color: var(--c, var(--accent-text));
}
.rv-note-sev {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
}
.rv-note-sev.sev-high { background: var(--danger-soft); color: var(--danger); }
.rv-note-sev.sev-med { background: var(--warn-soft); color: var(--warn); }
.rv-note-sev.sev-low { background: var(--panel-2); color: var(--muted); }
.rv-ver-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--ok-soft);
  border: 1px solid var(--ok-border);
  color: var(--ok);
  font: 600 11px/16px var(--font-ui);
}
.rv-note-text {
  margin: 6px 0 6px;
  font-size: 13.5px;
  line-height: 1.48;
  color: var(--text);
}
.rv-note-reply {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ai-soft);
  border-left: 3px solid var(--ai);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
}
.rv-note-reply-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ai-fg);
  margin-bottom: 3px;
}
.rv-note-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--muted);
}
.rv-note-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rv-note-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* =========================================================================
   AGENT (HARNESS) VIEW (#view-agent)
   ========================================================================= */
.ag-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

/* Left Navigation Sidebar */
.ag-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 14px 10px 12px;
  min-height: 0;
  overflow-y: auto;
}
.ag-brand-box {
  padding: 2px 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 10px;
}
.ag-brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.ag-brand-title .i {
  color: var(--accent);
  width: 19px;
  height: 19px;
}
.ag-brand-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.ag-nav-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ag-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}
.ag-nav-btn .i {
  width: 17px;
  height: 17px;
  color: var(--muted);
}
.ag-nav-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.ag-nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.ag-nav-btn.active .i {
  color: var(--accent-text);
}
.ag-nav-badge {
  margin-left: auto;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
  font: 600 11px/18px var(--font-mono);
}
.ag-nav-badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.ag-nav-badge.live {
  background: var(--ai-soft);
  color: var(--ai-fg);
}
.ag-sidebar-foot {
  margin-top: auto;
  padding: 10px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
}
.ag-ed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Main Content Area */
.ag-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 20px 24px 32px;
}
.ag-main.no-pad {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ag-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.ag-page-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.ag-page-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
}
.ag-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- 1. Dashboard ---------- */
.ag-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.ag-kpi-card {
  padding: 14px 16px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}
.ag-kpi-card:hover {
  border-color: var(--accent-border);
}
.ag-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.ag-kpi-val {
  font: 700 26px/1.15 var(--font-mono);
  color: var(--text);
  margin: 8px 0 4px;
}
.ag-kpi-meta {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ag-dash-cols {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}
@media (max-width: 1200px) {
  .ag-dash-cols { grid-template-columns: 1fr; }
}
.ag-panel-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
}
.ag-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.ag-panel-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.ag-learning-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
}
.ag-learning-item + .ag-learning-item {
  margin-top: 8px;
}
.ag-learning-body {
  flex: 1;
  min-width: 0;
}
.ag-learning-rule {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.ag-learning-why {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
}

/* ---------- 2. Console (Runs + Subagents + Approvals) ---------- */
.ag-console-layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.ag-con-left {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--panel);
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
  gap: 12px;
}
.ag-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.ag-preset-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.ag-preset-btn .i { width: 15px; height: 15px; color: var(--accent-text); }
.ag-preset-btn:hover { border-color: var(--border-stronger); color: var(--text); }
.ag-preset-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
  font-weight: 600;
}
.ag-mcp-callout {
  padding: 12px;
  border-radius: 10px;
  background: var(--ai-soft);
  border: 1px solid rgba(107, 91, 210, 0.35);
  font-size: 12.5px;
  line-height: 1.5;
}
.ag-mcp-callout-title {
  font-weight: 600;
  color: var(--ai-fg);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ag-run-hist-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ag-run-item {
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.12s, background-color 0.12s;
}
.ag-run-item:hover { border-color: var(--border-strong); }
.ag-run-item.active {
  background: var(--accent-softer);
  border-color: var(--accent-border);
}

/* Right Live Run Trace */
.ag-con-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}
.ag-run-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.ag-run-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Pending Approval Card */
.ag-approval-card {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.ag-approval-info {
  flex: 1;
  min-width: 0;
}
.ag-approval-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 7px;
}
.ag-approval-title .i { color: var(--warn); }

/* Parallel Child Agent Lanes */
.ag-lanes-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
}
.ag-lanes-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ag-lanes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 10px;
}
.ag-lane-card {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ag-lane-card.running {
  border-color: rgba(107, 91, 210, 0.48);
  box-shadow: inset 0 0 0 1px rgba(107, 91, 210, 0.16);
}
.ag-lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.ag-lane-role {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ag-lane-task {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
}
.ag-lane-steps {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-2);
}

/* Steps Timeline */
.ag-steps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ag-step {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 10px 14px;
  font-size: 13px;
}
.ag-step.st-thought {
  background: var(--panel-2);
  border-style: dashed;
  padding: 7px 12px;
}
.ag-step.st-thought summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
}
.ag-step.st-thought summary::-webkit-details-marker,
.ag-step.st-tool summary::-webkit-details-marker {
  display: none;
}
.ag-step.st-thought summary .i,
.ag-step.st-tool summary .i {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.ag-step.st-tool {
  padding: 8px 12px;
}
.ag-step.st-tool summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  list-style: none;
}
.ag-step.st-guardrail,
.ag-step.st-error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}
.ag-guardrail-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 4px;
}
.ag-tool-pre {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font: 11.5px/1.45 var(--font-mono);
  max-height: 200px;
  overflow: auto;
}
.ag-chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

/* ---------- 3. Memory ---------- */
.ag-mem-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ag-mem-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ag-mem-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.12s;
}
.ag-mem-card:hover { border-color: var(--border-strong); }
.ag-mem-card.has-conflict {
  border-color: var(--warn-border);
  background: color-mix(in srgb, var(--warn) 4%, var(--panel));
}
.ag-conflict-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 10px;
  border-radius: 7px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
}
.ag-mem-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.ag-mem-text {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
}
.ag-mem-rationale {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.5;
}
.ag-mem-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--muted);
}
.ag-prov-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
}
.ag-prov-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.ag-prov-row + .ag-prov-row {
  border-top: 1px dashed var(--border);
}

/* ---------- 4. Skills ---------- */
.ag-skills-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.ag-sk-list {
  border-right: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ag-sk-item {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
}
.ag-sk-item:hover { border-color: var(--border-strong); background: var(--panel-2); }
.ag-sk-item.active {
  border-color: var(--accent-border);
  background: var(--accent-softer);
}
.ag-sk-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding: 18px 24px 28px;
}
.ag-prop-banner {
  padding: 14px 16px;
  border-radius: 11px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* ---------- 5. Guardrails ---------- */
.ag-gr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 12px;
}
.ag-gr-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ag-gr-card.hard {
  border-left: 3px solid var(--danger);
}
.ag-gr-card.soft {
  border-left: 3px solid var(--warn);
}

/* ---------- 6. Samples & Styles ---------- */
.ag-smp-ingest {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 14px;
  margin-bottom: 18px;
}
.ag-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border-radius: 11px;
  border: 1.5px dashed var(--border-stronger);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
}
.ag-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-softer);
}
.ag-stats-viz-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 1280px) {
  .ag-stats-viz-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.ag-viz-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px 16px;
}
.ag-viz-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Histogram bars */
.ag-hist {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 92px;
  padding-top: 12px;
  border-bottom: 1px solid var(--border);
}
.ag-hist-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 4px;
}
.ag-hist-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  min-height: 4px;
  transition: height 0.25s ease;
}
.ag-hist-val {
  font: 600 10.5px var(--font-mono);
  color: var(--text-2);
}
.ag-hist-lbl {
  font: 10.5px var(--font-mono);
  color: var(--muted);
  margin-top: 4px;
}
/* Swatches */
.ag-swatches {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.ag-swatch {
  flex: 1;
  height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
}
.ag-swatch span {
  font: 600 10px/14px var(--font-mono);
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}
/* Framing Heatmap */
.ag-heatmap-box {
  position: relative;
  width: 96px;
  aspect-ratio: 9 / 16;
  border-radius: 7px;
  background: #181614;
  border: 1px solid var(--border-strong);
  overflow: hidden;
  flex: none;
}
.ag-heatmap-safe {
  position: absolute;
  inset: 10% 10% 18% 10%;
  border: 1px dashed rgba(255, 255, 255, 0.28);
}
.ag-heatmap-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(234, 138, 53, 0.85) 0%, rgba(200, 102, 15, 0.35) 55%, transparent 75%);
  pointer-events: none;
}

/* ---------- 7. Generation Queue ---------- */
.ag-gq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 12px;
}
.ag-gq-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ag-gq-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.ag-gq-thumb {
  aspect-ratio: 9 / 16;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel-3);
  border: 1px solid var(--border);
}
.ag-gq-thumb.wide { aspect-ratio: 16 / 9; }
.ag-gq-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- 8. Settings ---------- */
.ag-set-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 1180px) {
  .ag-set-grid { grid-template-columns: 1fr; }
}
.ag-prov-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.ag-prov-row + .ag-prov-row { margin-top: 8px; }
.ag-role-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ag-role-table th,
.ag-role-table td {
  padding: 8px 6px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}
.ag-role-table th {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
