:root {
  --bg-body: #f8f9fa;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-turn: #fafafa;
  --bg-transcript: #f8f9fa;
  --text-primary: #1a1a2e;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-color: #cbd5e1;
  --border-subtle: #e2e8f0;
  --table-th-bg: #2c3e50;
  --table-th-text: #ffffff;
  --table-hover: #eef2ff;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  --pl-drawer-bg: #f0f9ff;
  --pl-drawer-border: #0284c7;
  --pl-drawer-text: #0c4a6e;
}

body.dark-mode {
  --bg-body: #121212;
  --bg-card: #1e1e1e;
  --bg-subtle: #2a2a2a;
  --bg-turn: #252525;
  --bg-transcript: #222222;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-color: #3f3f46;
  --border-subtle: #333338;
  --table-th-bg: #2d2638;
  --table-th-text: #f8fafc;
  --table-hover: #27273a;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  --pl-drawer-bg: #112233;
  --pl-drawer-border: #38bdf8;
  --pl-drawer-text: #e0f2fe;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-subtle: #2a2a2a;
    --bg-turn: #252525;
    --bg-transcript: #222222;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #3f3f46;
    --border-subtle: #333338;
    --table-th-bg: #2d2638;
    --table-th-text: #f8fafc;
    --table-hover: #27273a;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
    --pl-drawer-bg: #112233;
    --pl-drawer-border: #38bdf8;
    --pl-drawer-text: #e0f2fe;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.45;
}

h1 {
  color: var(--text-primary);
  border-bottom: 3px solid #e94560;
  padding-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.theme-toggle-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.48em;
  font-weight: 600;
  transition: all 0.15s;
}

.theme-toggle-btn:hover {
  background: var(--bg-subtle);
  border-color: #3498db;
}

h2 {
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 10px;
}

h3 {
  color: var(--text-primary);
  margin: 14px 0 6px 0;
  font-size: 0.95em;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-subtle);
  color: var(--text-primary);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Scorecard summary cards */
.summary {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid var(--border-subtle);
}

.summary-top {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.summary .big {
  font-size: 2em;
  font-weight: bold;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.summary-card {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  text-align: center;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s;
}

.summary-card:hover {
  border-color: #3498db;
}

.summary-card .label {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.summary-card .value {
  font-size: 1.3em;
  font-weight: bold;
  margin-top: 2px;
}

.pass {
  color: #16a34a;
}

.fail {
  color: #dc2626;
}

.mixed,
.warn,
.error {
  color: #d97706;
}

body.dark-mode .pass {
  color: #4ade80;
}

body.dark-mode .fail {
  color: #f87171;
}

body.dark-mode .mixed,
body.dark-mode .warn,
body.dark-mode .error {
  color: #fbbf24;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .pass {
    color: #4ade80;
  }
  body:not(.light-mode) .fail {
    color: #f87171;
  }
  body:not(.light-mode) .mixed,
  body:not(.light-mode) .warn,
  body:not(.light-mode) .error {
    color: #fbbf24;
  }
}

/* Failure patterns section */
.failure-group {
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 15px 0;
  padding: 16px;
  border: 1px solid var(--border-subtle);
}

.failure-group h3 {
  margin: 0 0 8px 0;
  color: #c0392b;
  font-size: 0.95em;
}

body.dark-mode .failure-group h3 {
  color: #cf6679;
}

.failure-group .affected {
  font-size: 0.85em;
  color: var(--text-secondary);
  margin: 4px 0;
}

.failure-group .affected-item {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px;
  border-radius: 4px;
  background: #fdecea;
  color: #721c24;
  font-size: 0.8em;
  cursor: pointer;
}

body.dark-mode .failure-group .affected-item {
  background: #331e1e;
  color: #e57373;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .failure-group h3 {
    color: #cf6679;
  }
  body:not(.light-mode) .failure-group .affected-item {
    background: #331e1e;
    color: #e57373;
  }
}

/* Master Index Table */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  background: var(--bg-card);
  color: var(--text-primary);
}

th,
td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.88em;
}

th {
  background: var(--table-th-bg);
  color: var(--table-th-text);
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover {
  background: var(--table-hover);
}

/* Card layout details */
.eval-card {
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 15px 0;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.eval-header {
  padding: 12px 16px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}

.eval-header.pass-bg {
  background: #d4edda;
  border-left: 4px solid #27ae60;
  color: #155724;
}

.eval-header.fail-bg {
  background: #f8d7da;
  border-left: 4px solid #e74c3c;
  color: #721c24;
}

body.dark-mode .eval-header.pass-bg {
  background: #1b382b;
  border-left-color: #27ae60;
  color: #e0e0e0;
}

body.dark-mode .eval-header.fail-bg {
  background: #3d1e22;
  border-left-color: #e74c3c;
  color: #e0e0e0;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .eval-header.pass-bg {
    background: #1b382b;
    border-left-color: #27ae60;
    color: #e0e0e0;
  }
  body:not(.light-mode) .eval-header.fail-bg {
    background: #3d1e22;
    border-left-color: #e74c3c;
    color: #e0e0e0;
  }
}

.eval-body {
  padding: 0 16px 16px;
  color: var(--text-primary);
}

/* Modality status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78em;
  font-weight: bold;
}

.badge.pass,
.badge.met {
  background: #d4edda;
  color: #155724;
}

.badge.fail,
.badge.not-met {
  background: #f8d7da;
  color: #721c24;
}

.badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.badge.neutral {
  background: #e2e8f0;
  color: #334155;
}

.badge.golden {
  background: #fff3e0;
  color: #e65100;
}

.badge.sim {
  background: #e8eaf6;
  color: #283593;
}

.badge.tool {
  background: #e0f2f1;
  color: #004d40;
}

.badge.callback {
  background: #fce4ec;
  color: #880e4f;
}

body.dark-mode .badge.pass,
body.dark-mode .badge.met {
  background: #1b382b;
  color: #81c784;
}

body.dark-mode .badge.fail,
body.dark-mode .badge.not-met {
  background: #3d1e22;
  color: #e57373;
}

body.dark-mode .badge.warn {
  background: #3b2a10;
  color: #fcd34d;
}

body.dark-mode .badge.neutral {
  background: #334155;
  color: #cbd5e1;
}

body.dark-mode .badge.golden {
  background: #332211;
  color: #ffb74d;
}

body.dark-mode .badge.sim {
  background: #1a237e;
  color: #9fa8da;
}

body.dark-mode .badge.tool {
  background: #004d40;
  color: #80cbc4;
}

body.dark-mode .badge.callback {
  background: #880e4f;
  color: #f48fb1;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .badge.pass,
  body:not(.light-mode) .badge.met {
    background: #1b382b;
    color: #81c784;
  }
  body:not(.light-mode) .badge.fail,
  body:not(.light-mode) .badge.not-met {
    background: #3d1e22;
    color: #e57373;
  }
  body:not(.light-mode) .badge.warn {
    background: #3b2a10;
    color: #fcd34d;
  }
  body:not(.light-mode) .badge.neutral {
    background: #334155;
    color: #cbd5e1;
  }
  body:not(.light-mode) .badge.golden {
    background: #332211;
    color: #ffb74d;
  }
  body:not(.light-mode) .badge.sim {
    background: #1a237e;
    color: #9fa8da;
  }
  body:not(.light-mode) .badge.tool {
    background: #004d40;
    color: #80cbc4;
  }
  body:not(.light-mode) .badge.callback {
    background: #880e4f;
    color: #f48fb1;
  }
}

.meta {
  color: var(--text-secondary);
  font-size: 0.85em;
}

details {
  margin: 4px 0;
  color: var(--text-primary);
}

summary {
  cursor: pointer;
  font-weight: bold;
  padding: 4px 0;
  color: var(--text-primary);
}

/* Run indicator dots */
.run-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 3px;
  cursor: pointer;
  border: 2px solid transparent;
  vertical-align: middle;
  transition: border-color 0.15s;
}

.run-dot:hover {
  border-color: var(--text-primary);
}

.run-dot.p {
  background: #27ae60;
}

.run-dot.f {
  background: #e74c3c;
}

.run-dot.e {
  background: #e67e22;
}

.session-link {
  font-size: 0.85em;
  color: #3498db;
  margin: 4px 0;
}

.session-link a {
  color: #3498db;
  text-decoration: none;
}

.session-link a:hover {
  text-decoration: underline;
}

/* dialogue turns details */
.turn-row {
  margin: 6px 0;
  padding: 10px;
  background: var(--bg-turn);
  color: var(--text-primary);
  border-radius: 6px;
  border-left: 3px solid #bbb;
  font-size: 0.85em;
}

.turn-row.match {
  border-left-color: #27ae60;
}

.turn-row.mismatch {
  border-left-color: #e74c3c;
  background: #fef5f5;
}

body.dark-mode .turn-row.mismatch {
  background: #2d1f21;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .turn-row.mismatch {
    background: #2d1f21;
  }
}

.turn-header {
  font-weight: bold;
  margin-bottom: 4px;
}

.comparison {
  margin: 4px 0;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-primary);
}

.comparison.pass-bg {
  background: #edf7ed;
}

.comparison.fail-bg {
  background: #fdecea;
}

body.dark-mode .comparison.pass-bg {
  background: #1b382b;
}

body.dark-mode .comparison.fail-bg {
  background: #3d1e22;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .comparison.pass-bg {
    background: #1b382b;
  }
  body:not(.light-mode) .comparison.fail-bg {
    background: #3d1e22;
  }
}

.comp-label {
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.comp-text {
  margin-top: 2px;
}

.sem-score {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.75em;
  font-weight: bold;
}

.sem-4,
.sem-3 {
  background: #d4edda;
  color: #155724;
}

.sem-2 {
  background: #fff3cd;
  color: #856404;
}

.sem-1,
.sem-0 {
  background: #f8d7da;
  color: #721c24;
}

body.dark-mode .sem-4,
body.dark-mode .sem-3 {
  background: #1b382b;
  color: #81c784;
}

body.dark-mode .sem-2 {
  background: #332c00;
  color: #ffd54f;
}

body.dark-mode .sem-1,
body.dark-mode .sem-0 {
  background: #3d1e22;
  color: #e57373;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .sem-4,
  body:not(.light-mode) .sem-3 {
    background: #1b382b;
    color: #81c784;
  }
  body:not(.light-mode) .sem-2 {
    background: #332c00;
    color: #ffd54f;
  }
  body:not(.light-mode) .sem-1,
  body:not(.light-mode) .sem-0 {
    background: #3d1e22;
    color: #e57373;
  }
}

/* Transcript event bubbles */
.transcript {
  background: var(--bg-transcript);
  border-radius: 6px;
  padding: 12px;
  margin: 8px 0;
  font-size: 0.9em;
  border: 1px solid var(--border-subtle);
}

.transcript .user {
  color: #1d4ed8;
  margin: 8px 0 4px;
}

.transcript .agent {
  color: #15803d;
  margin: 4px 0;
}

.transcript .system {
  color: #d97706;
  margin: 4px 0;
  font-size: 0.85em;
}

body.dark-mode .transcript .user {
  color: #64b5f6;
}

body.dark-mode .transcript .agent {
  color: #81c784;
}

body.dark-mode .transcript .system {
  color: #ffb74d;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .transcript .user {
    color: #64b5f6;
  }
  body:not(.light-mode) .transcript .agent {
    color: #81c784;
  }
  body:not(.light-mode) .transcript .system {
    color: #ffb74d;
  }
}

.expectation {
  margin: 6px 0;
  padding: 8px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-radius: 4px;
}

.step {
  margin: 6px 0;
  padding: 8px;
  border-left: 3px solid #3498db;
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* Audio playback */
.audio-player {
  margin: 8px 0 10px;
  padding: 6px 10px;
  background: var(--bg-subtle);
  border-radius: 4px;
  border-left: 3px solid #3498db;
}

.audio-label {
  display: block;
  font-size: 0.75em;
  font-weight: bold;
  color: #3498db;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.audio-player audio {
  width: 100%;
  max-width: 480px;
  height: 32px;
  vertical-align: middle;
}

.turn-audio {
  display: block;
  width: 100%;
  max-width: 340px;
  height: 28px;
  margin: 4px 0 2px;
}

/* Tool interactions */
.tool-details {
  margin: 4px 0;
  padding: 4px 8px;
  background: #f3e8ff;
  border-radius: 4px;
  border-left: 3px solid #8e44ad;
  color: #3b0764;
}

.tool-summary {
  font-weight: normal;
  font-size: 0.88em;
  color: #6c3483;
  padding: 2px 0;
}

.tool-data {
  margin: 4px 0;
  padding: 8px;
  background: #faf5ff;
  color: #1e1b4b;
  border-radius: 4px;
  font-size: 0.8em;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.tool-section {
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-top: 6px;
}

body.dark-mode .tool-details {
  background: #2c1d3a;
  border-left-color: #8e44ad;
  color: #e9d5ff;
}

body.dark-mode .tool-summary {
  color: #d1c4e9;
}

body.dark-mode .tool-data {
  background: #1f1425;
  color: #e0e0e0;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .tool-details {
    background: #2c1d3a;
    border-left-color: #8e44ad;
    color: #e9d5ff;
  }
  body:not(.light-mode) .tool-summary {
    color: #d1c4e9;
  }
  body:not(.light-mode) .tool-data {
    background: #1f1425;
    color: #e0e0e0;
  }
}

/* Interactive controls panel */
.controls {
  display: flex;
  gap: 8px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.controls button {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.15s;
}

.controls button:hover {
  background: var(--bg-subtle);
}

.controls button.active {
  background: #e94560;
  color: #ffffff;
  border-color: #e94560;
}

tr.hidden-row {
  display: none;
}

.eval-card.hidden-card {
  display: none;
}

.user-bubble {
  color: #2980b9;
  margin: 4px 0;
  padding: 4px 8px;
  background: #eef5ff;
  border-radius: 4px;
}

body.dark-mode .user-bubble {
  background: #1a2a3a;
  color: #64b5f6;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .user-bubble {
    background: #1a2a3a;
    color: #64b5f6;
  }
}

.tool-call-args-details {
  margin-top: 4px;
}

.tool-call-args-summary {
  cursor: pointer;
  font-size: 0.85em;
  color: var(--text-secondary);
}

.tool-call-args-body {
  font-size: 0.82em;
  background: var(--bg-subtle);
  padding: 6px 10px;
  border-radius: 4px;
  margin-top: 4px;
}

.tool-call-args-pre {
  margin: 2px 0;
  white-space: pre-wrap;
}

/* =====================================================================
   COLLAPSED-BY-DEFAULT PERCEIVED LATENCY DRAWERS (UNOBTRUSIVE)
   ===================================================================== */
.pl-suite-details {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid #0284c7;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 14px 0;
  padding: 10px 16px;
}

.pl-suite-details > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.95em;
  color: var(--text-primary);
  list-style: none;
}

.pl-suite-details > summary::-webkit-details-marker {
  display: none;
}

.pl-arrow {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.85em;
  color: var(--pl-drawer-border);
  transition: transform 0.18s ease;
}

.pl-suite-details[open] > summary .pl-arrow,
.pl-conv-details[open] > summary .pl-arrow,
.pl-turn-details[open] > summary .pl-arrow {
  transform: rotate(90deg);
}

.pl-conv-details {
  margin: 6px 0;
  padding: 4px 10px;
  background: var(--pl-drawer-bg);
  border-left: 3px solid var(--pl-drawer-border);
  border-radius: 4px;
  color: var(--text-primary);
}

.pl-conv-details > summary {
  font-weight: normal;
  font-size: 0.86em;
  color: var(--pl-drawer-text);
  padding: 2px 0;
  list-style: none;
}

.pl-conv-details > summary::-webkit-details-marker {
  display: none;
}

.pl-turn-details {
  margin: 3px 0 8px 0;
  padding: 3px 8px;
  background: var(--bg-subtle);
  border-left: 3px solid #64748b;
  border-radius: 4px;
  font-size: 0.84em;
  color: var(--text-primary);
}

.pl-turn-details.pl-fast {
  border-left-color: #22c55e;
}

.pl-turn-details.pl-warn {
  border-left-color: #f59e0b;
}

.pl-turn-details.pl-slow {
  border-left-color: #ef4444;
}

.pl-turn-details > summary {
  font-weight: normal;
  font-size: 0.92em;
  color: var(--text-secondary);
  padding: 1px 0;
  list-style: none;
}

.pl-turn-details > summary::-webkit-details-marker {
  display: none;
}

.pl-slice-btn {
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.8em;
  transition: all 0.15s;
}

.pl-slice-btn.active {
  border-color: #0284c7;
  background: #0284c7;
  color: #ffffff;
  font-weight: bold;
}

.pl-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.pl-kpi-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-primary);
}

.pl-kpi-box .kpi-label {
  font-size: 0.7em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}

.pl-kpi-box .kpi-val {
  font-size: 1.25em;
  font-weight: bold;
  margin: 2px 0;
}

.pl-kpi-box .kpi-sub {
  font-size: 0.75em;
  color: var(--text-secondary);
}

.pl-stack-container {
  background: var(--bg-subtle);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  margin: 10px 0;
  color: var(--text-primary);
}

.pl-stack-bar {
  display: flex;
  height: 16px;
  border-radius: 4px;
  overflow: hidden;
  font-size: 0.74em;
  font-weight: 600;
  color: #ffffff;
  margin: 6px 0;
  background: var(--border-subtle);
}

.pl-stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-top: 6px;
  font-size: 0.78em;
  color: var(--text-primary);
}

.pl-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.pl-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.pl-legend-dot.cb {
  background: #7c3aed;
}

.pl-legend-dot.tool {
  background: #d97706;
}

.pl-legend-dot.sllm {
  background: #2563eb;
}

.pl-legend-dot.ttfa {
  background: #059669;
}

.pl-legend-dot.gap {
  background: #64748b;
}

.pl-seg-cb {
  background: #7c3aed;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.pl-seg-tool {
  background: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.pl-seg-sllm {
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.pl-seg-ttfa {
  background: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.pl-seg-gap {
  background: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.pl-seg-filler {
  background: #0d9488;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.pl-seg-vad {
  background: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.wf-row {
  display: grid;
  grid-template-columns: 260px 1fr 80px;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 0.82em;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.wf-row > div:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}

.wf-row:last-child {
  border-bottom: none;
}

.wf-header-row {
  padding: 2px 0 4px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.74em;
  color: var(--text-secondary);
}

.wf-header-col {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.wf-axis-track {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.wf-axis-zone {
  font-size: 0.92em;
  color: var(--text-secondary);
  white-space: nowrap;
}

.wf-axis-post {
  margin-left: auto;
}

.wf-fa-pin {
  position: absolute;
  top: 1px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.92em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  z-index: 6;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.wf-stream-bar {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.18),
    rgba(255, 255, 255, 0.18) 4px,
    transparent 4px,
    transparent 8px
  );
}

.wf-track {
  position: relative;
  height: 12px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.wf-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 2px;
}

.wf-first-audio-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 5;
}

.wf-vad-end-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #0284c7;
  z-index: 4;
}

.wf-dur {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
}

.pl-overview-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 10px 0;
  color: var(--text-primary);
}

.pl-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.pl-kpi-item .kpi-label {
  font-size: 0.7em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}

.pl-kpi-item .kpi-val {
  font-size: 1.18em;
  font-weight: bold;
  margin: 2px 0;
}

.pl-kpi-item .kpi-sub {
  font-size: 0.75em;
  color: var(--text-secondary);
}

.pl-stack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8em;
  margin-bottom: 4px;
}

.wf-cb-details {
  border-bottom: 1px solid var(--border-subtle);
}

.wf-cb-details > summary.wf-cb-summary {
  padding: 3px 0;
  font-weight: normal;
  cursor: pointer;
  list-style: none;
}

.wf-cb-details > summary.wf-cb-summary::-webkit-details-marker {
  display: none;
}

.wf-cb-details[open] > summary .pl-arrow,
.cb-sub-details[open] > summary .pl-arrow,
.cb-spans-details[open] > summary .pl-arrow {
  transform: rotate(90deg);
}

.cb-spans-details {
  margin: 4px 0;
}

.cb-spans-details > summary {
  cursor: pointer;
  font-weight: normal;
  font-size: 0.85em;
  color: #d97706;
  padding: 2px 0;
  list-style: none;
}

.cb-spans-details > summary::-webkit-details-marker {
  display: none;
}

body.dark-mode .cb-spans-details > summary {
  color: #ffb74d;
}

@media (prefers-color-scheme: dark) {
  body:not(.light-mode) .cb-spans-details > summary {
    color: #ffb74d;
  }
}

.cb-spans-list {
  margin: 2px 0 4px 10px;
  padding-left: 8px;
  border-left: 2px solid #d97706;
}

.wf-cb-list {
  background: var(--bg-card);
  margin: 2px 0 6px 0;
  padding: 2px 0;
}

.wf-sub-row {
  font-size: 0.79em;
  border-bottom: 1px dashed var(--border-subtle);
}

.wf-sub-row > div:first-child {
  margin-left: 10px;
  padding-left: 8px;
  border-left: 2px solid #7c3aed;
}

.wf-sub-row:last-child {
  border-bottom: none;
}

.cb-sub-details {
  margin-top: 4px;
}

.cb-sub-details > summary {
  font-size: 0.78em;
  font-weight: 600;
  color: var(--link-color);
  cursor: pointer;
  padding: 1px 0;
  list-style: none;
}

.cb-sub-details > summary::-webkit-details-marker {
  display: none;
}

.cb-sub-list {
  margin-top: 4px;
  padding: 4px 8px;
  background: var(--bg-subtle);
  border-left: 2px solid #7c3aed;
  border-radius: 0 4px 4px 0;
}

.cb-sub-item {
  font-size: 0.78em;
  padding: 2px 0;
  border-bottom: 1px dashed var(--border-subtle);
}

.cb-sub-item:last-child {
  border-bottom: none;
}

.cb-seq-badge {
  display: inline-block;
  background: #ede9fe;
  color: #5b21b6;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
  margin-right: 3px;
}

[data-theme="dark"] .cb-seq-badge {
  background: #4c1d95;
  color: #ddd6fe;
}
