:root {
  --primary: #6C5CE7;
  --primary-light: #EEF0FF;
  --sidebar-bg: #FFFFFF;
  --sidebar-border: #F0F0F5;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 72px;
  --bg: #F8F9FD;
  --card-bg: #FFFFFF;
  --text-primary: #1A1A2E;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --font-mono: "Cascadia Code", "Consolas", "Courier New", monospace;
  --success: #00B894;
  --warning: #FDCB6E;
  --danger: #E17055;
  --border: #E5E7EB;
  --accuracy-high: #00B894;
  --accuracy-med: #6C5CE7;
  --accuracy-warn: #FDCB6E;
  --accuracy-low: #E17055;
  --clinical-correct: #22863a;
  --clinical-missed: #cb2431;
  --clinical-wrong: #cb2431;
  --clinical-invented: #6f42c1;
  --clinical-pass: #22863a;
  --clinical-review: #bf8700;
  --clinical-fail: #cb2431;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  max-width: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 20;
  transition: width 0.2s ease, padding 0.2s ease;
  cursor: pointer;
}

.app-body {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.2s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  font-weight: 700;
  font-size: 20px;
  min-height: 32px;
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
}

.logo:hover { color: var(--primary); }
.logo:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.logo-icon { font-size: 24px; flex-shrink: 0; }
.logo-text { white-space: nowrap; overflow: hidden; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s, padding 0.2s;
  white-space: nowrap;
  cursor: pointer;
}

.nav-icon {
  flex-shrink: 0;
  width: 1.25em;
  text-align: center;
}

.nav-label {
  overflow: hidden;
  white-space: nowrap;
}

.nav-item:hover { background: var(--primary-light); color: var(--primary); }

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.app-shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  padding: 16px 8px;
}

.app-shell.sidebar-collapsed .logo {
  justify-content: center;
  padding: 0 0 24px;
}

.app-shell.sidebar-collapsed .logo-text,
.app-shell.sidebar-collapsed .nav-label {
  display: none;
}

.app-shell.sidebar-collapsed .nav-item,
.app-shell.sidebar-collapsed .logout-btn {
  justify-content: center;
  padding: 12px 8px;
  gap: 0;
}

.app-shell.sidebar-collapsed .app-body {
  margin-left: var(--sidebar-collapsed-width);
}

.page-view { display: none; }
.page-view.is-active { display: block; }

.header-actions .how-it-works-open {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.hiw-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1.5rem 2rem;
  overflow: auto;
}
.hiw-backdrop[hidden] { display: none; }
.hiw-dialog {
  width: min(720px, 100%);
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem 1.5rem;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
}
.hiw-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
}
.hiw-dialog-header h2 {
  margin: 0;
  font-size: 20px;
}
.hiw-steps {
  margin: 0;
  padding-left: 1.25rem;
}
.hiw-steps li {
  margin-bottom: 0.85rem;
}
.hiw-steps li strong { display: block; margin-bottom: 0.25rem; }
.hiw-steps li p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.sidebar-footer { padding-top: 16px; }

.logout-btn {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
}

.main-content {
  flex: 1;
  padding: 32px;
  max-width: 1400px;
  min-width: 0;
  overflow-x: auto;
  position: relative;
  z-index: 0;
}

.page-header, .detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1, .detail-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.main-content:has(#dashboard-view.is-active) {
  padding-top: 16px;
}

#dashboard-view .dashboard-page-header {
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

#dashboard-view .dashboard-page-header h1 {
  font-size: 18px;
  font-weight: 650;
  margin: 0;
  line-height: 1.2;
}

#dashboard-view .dashboard-page-header .how-it-works-open {
  padding: 6px 12px;
  font-size: 13px;
}

.select-input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 14px;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.config-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 80px;
}
.config-input {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--card-bg);
}
.config-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.15);
}
.config-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.model-desc-text {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  max-width: 320px;
  line-height: 1.4;
  margin-top: 0.25rem;
  flex-basis: 100%;
  margin-left: 80px;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.results-toolbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.results-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.results-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.empty-state-cell { text-align: center; padding: 3rem 1rem !important; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.empty-icon  { font-size: 2rem; }
.empty-state p { color: var(--text-secondary); font-size: 14px; margin: 0; }
.empty-sub   { font-size: 12px !important; color: var(--text-muted) !important; }

.dashboard-filters {
  position: relative;
  z-index: 40;
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: visible;
}

.batch-overview {
  margin: 0 0 1.25rem;
  padding: 0;
  background: transparent;
  border: none;
}

.batch-overview-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.45rem;
  padding: 0.85rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  font-size: 14px;
  color: var(--text-primary);
}

.batch-overview-item {
  white-space: nowrap;
}

.batch-overview-item [data-overview-field="recordings_label"] {
  margin-left: 0.25em;
}

.batch-overview-meta strong {
  font-weight: 650;
}

.batch-overview-sep {
  color: var(--text-muted);
}

.batch-overview-asr {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem 0.45rem;
}

.batch-overview-asr[hidden] {
  display: none;
}

.batch-overview-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 0.75rem;
}

.batch-kpi {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.2rem 1rem;
  min-width: 0;
}

.batch-kpi-value {
  font-size: 32px;
  font-weight: 750;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 0.55rem;
}

.batch-kpi.is-pass .batch-kpi-value { color: #1F8A4C; }
.batch-kpi.is-fail .batch-kpi-value { color: #C17A3A; }
.batch-kpi.is-safety .batch-kpi-value { color: #D63031; }

.batch-kpi-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.batch-kpi-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.batch-kpi.is-pass .batch-kpi-icon { background: #1F8A4C; }
.batch-kpi.is-fail .batch-kpi-icon { background: #C17A3A; }
.batch-kpi.is-safety .batch-kpi-icon {
  background: #D63031;
  border-radius: 5px;
}

.batch-kpi-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.accuracy-table-section {
  margin-top: 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.2rem 1.15rem;
}

.accuracy-table-section[hidden] {
  display: none;
}

.accuracy-table-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.accuracy-table-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--text-primary);
}

.accuracy-table-sub {
  margin: 0.2rem 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.accuracy-details-btn {
  flex-shrink: 0;
}

.accuracy-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.accuracy-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
}

.accuracy-stat-value {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.accuracy-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.accuracy-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.clinical-accuracy-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 13px;
}

.clinical-accuracy-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-secondary);
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.clinical-accuracy-table td {
  padding: 0.7rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.clinical-accuracy-table .category-row {
  cursor: default;
}

.clinical-accuracy-table .category-row:hover td,
.clinical-accuracy-table .category-row.is-expanded td {
  background: #F8FAFF;
}

.clinical-accuracy-table .category-row.is-total td {
  font-weight: 650;
  background: #F3F4F8;
}

.clinical-accuracy-table .col-category {
  font-weight: 600;
  color: var(--text-primary);
}

.metric-value.correct { color: inherit; font-weight: 650; }
.metric-value.missed { color: inherit; font-weight: 650; }
.metric-value.wrong { color: inherit; font-weight: 650; }
.metric-value.invented { color: inherit; font-weight: 650; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 12px;
  font-weight: 650;
  color: #fff;
  white-space: nowrap;
}

.status-pass { background: #22863a; }
.status-review { background: #bf8700; }
.status-fail { background: #cb2431; }
.status-na {
  background: #E5E7EB;
  color: #4B5563;
}

.detail-row td {
  background: #F8FAFF;
  padding: 0 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.detail-row-body {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.pass-rule {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  background: #F8F9FD;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.accuracy-table-note,
.accuracy-table-message {
  margin: 0.75rem 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.accuracy-table-message.is-error {
  color: #cb2431;
}

@media (max-width: 900px) {
  .accuracy-summary-stats { grid-template-columns: 1fr; }
  .accuracy-table-toolbar { flex-direction: column; }
}

@media (max-width: 768px) {
  .clinical-accuracy-table { min-width: 520px; }
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.batch-multi-filter {
  position: relative;
  z-index: 41;
  min-width: 260px;
}

.batch-filter-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 10px;
}

.batch-filter-toggle-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-filter-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.batch-filter-toggle[aria-expanded="true"] .batch-filter-caret {
  transform: rotate(180deg);
}

.batch-filter-panel {
  position: absolute;
  z-index: 50;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.batch-filter-panel[hidden] {
  display: none !important;
}
.batch-filter-empty {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.batch-filter-option {
  border-bottom: 1px solid var(--border);
}

.accuracy-chart-wrap {
  overflow-x: auto;
}

.accuracy-chart-wrap canvas {
  min-width: 100%;
}

.accuracy-chart-legend {
  max-height: 132px;
  overflow-y: auto;
  margin-top: 12px;
}

.chart-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

.latency-dash-table {
  width: 100%;
  min-width: 48rem;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}
.latency-dash-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.latency-dash-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
}
.latency-dash-table tr:hover { background: var(--bg); }
.total-latency { font-weight: 600; color: var(--primary); }
.tc-ref-cell   { font-family: var(--font-mono); font-size: 12px; color: var(--primary); }
.dashboard-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}
.dashboard-card.full-width {
  grid-column: 1 / -1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 28px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: white;
  border: 1px solid #E74C3C;
  color: #E74C3C;
  white-space: nowrap;
}
.btn-danger-outline:hover { background: #FDEDEC; }
.btn-danger-outline .icon-trash {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.btn-secondary, .btn-outline {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  background: white;
}

.btn-secondary {
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.btn-outline {
  border: 1px solid var(--primary);
  color: var(--primary);
}

.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.stat-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-sublabel,
.stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.charts-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.chart-card canvas {
  max-height: 260px;
}

.distribution-legend {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.batch-status {
  font-size: 13px;
  color: var(--text-secondary);
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.results-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.table-toolbar-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.table-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: visible;
}

.run-summary {
  margin-top: 0;
}

.run-summary .stat-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.run-summary .stat-label {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.run-summary-body {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
}

.run-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.25rem 1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.quality-bands {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 280px;
  padding: 0 0 0 24px;
  border-left: 1px solid var(--border);
}

.quality-bands-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 10px;
}

.quality-bands-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quality-bands-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text-primary);
}

.quality-band-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.quality-band-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.quality-band-name {
  font-weight: 500;
}

.quality-band-range {
  flex-shrink: 0;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  white-space: nowrap;
}

.quality-band-dot.quality-acceptable { background: #087443; }
.quality-band-dot.quality-minor { background: #175cd3; }
.quality-band-dot.quality-moderate { background: #b54708; }
.quality-band-dot.quality-major { background: #b42318; }

.run-summary-meta {
  margin: 1rem 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.latency-analysis-panel {
  margin-top: 0;
}

.table-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: visible;
  margin-bottom: 20px;
}

.table-tabs {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}

.table-tabs-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.75rem;
}

.table-tab {
  padding: 0.65rem 1.25rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.table-tab:hover {
  color: var(--text-primary);
}

.table-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.table-tab-content {
  padding: 0;
}

.table-panel .runs-table {
  width: 100%;
  min-width: 52rem;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

.table-panel .runs-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 0.65rem 1rem;
  background: var(--bg);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table-panel .runs-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-panel .runs-table tr:last-child td { border-bottom: none; }
.table-panel .runs-table tbody tr:hover td { background: var(--bg); }

.tc-ref-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

.total-latency-cell {
  font-weight: 700;
  color: var(--primary);
}

.latency-unavailable {
  color: var(--text-muted);
  font-style: italic;
}

.latency-note {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0;
}

.latency-note[hidden] {
  display: none;
}

.table-row-filter {
  max-width: 220px;
  font-size: 13px;
}

.table-pager {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  padding: 0.5rem 1rem 0.75rem;
  font-size: 13px;
  color: var(--text-secondary);
}

.table-pager:empty {
  display: none;
}

.table-pager button {
  padding: 0.25rem 0.65rem;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-primary);
  cursor: pointer;
}

.table-pager button:disabled {
  opacity: 0.5;
  cursor: default;
}

.table-panel .runs-table th[data-sort-key] {
  cursor: pointer;
}

.table-panel .runs-table th.is-sorted {
  color: var(--primary);
}

.batch-status-bar {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  min-height: 36px;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
}
.batch-status-bar:empty { display: none; }

.runs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.runs-table th {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.runs-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.runs-table tbody tr:hover {
  background: var(--primary-light);
}

.empty-row {
  text-align: center;
  color: var(--text-secondary);
  padding: 32px !important;
}

.accuracy-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
}

.accuracy-badge.high { background: #D1FAE5; color: var(--accuracy-high); }
.accuracy-badge.med { background: var(--primary-light); color: var(--accuracy-med); }
.accuracy-badge.warn { background: #FEF3C7; color: #B45309; }
.accuracy-badge.low { background: #FEE2E2; color: var(--accuracy-low); }
.accuracy-badge.error { background: #FEE2E2; color: var(--danger); font-size: 11px; }
.accuracy-badge.muted { background: #F3F4F6; color: var(--text-secondary); }

.ai-warning-banner {
  background: #FFF3CD;
  color: #856404;
  border: 1px solid #FFE69C;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
}

.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.diff-grid h4 {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.text-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  font-family: inherit;
}

.diff-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.diff-list li {
  padding: 10px 14px;
  background: var(--bg);
  border-left: 3px solid var(--warning);
  border-radius: 0 8px 8px 0;
  font-size: 13px;
}

.med-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}

.med-table th, .med-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.med-table th { background: var(--bg); font-weight: 600; }

.med-table td.changed {
  background: #FEF3C7;
  font-weight: 600;
}

.med-diff {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  background: var(--bg);
}

.med-diff.high { border-left: 3px solid var(--danger); }
.med-diff.medium { border-left: 3px solid var(--warning); }
.med-diff.low { border-left: 3px solid var(--text-secondary); }

.severity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
}

.severity-badge.high { background: #FEE2E2; color: var(--danger); }
.severity-badge.medium { background: #FEF3C7; color: #B45309; }
.severity-badge.low { background: #E5E7EB; color: var(--text-secondary); }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

.badge.danger { background: #FEE2E2; color: var(--danger); }
.badge.success { background: #D1FAE5; color: var(--success); }

.status-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-chip.status-fail,
.status-chip.status-error {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
}
.status-chip.status-pass,
.status-chip.status-complete,
.status-chip.status-completed,
.status-chip.status-done,
.status-chip.status-high-accuracy {
  color: #087443;
  background: #edfaf3;
  border-color: #aaefc6;
}
.status-chip.status-review,
.status-chip.status-needs-review {
  color: #b54708;
  background: #fffaeb;
  border-color: #fedf89;
}
.status-chip.status-low-accuracy {
  color: #b54708;
  background: #fef6ee;
  border-color: #f9dbaf;
}
.status-chip.status-not-scored,
.status-chip.status-pending,
.status-chip.status-not-evaluated,
.status-chip.status-muted,
.status-chip.status-no-eval {
  color: #667085;
  background: #f8f9fc;
  border-color: #e4e7ec;
}
.status-chip.status-skipped {
  color: #667085;
  background: #f8f9fc;
  border-color: #e4e7ec;
}
.status-chip.status-running {
  color: #5925dc;
  background: #f4f3ff;
  border-color: #d9d6fe;
}

.status-pair,
.soap-eval-chip,
.detail-meta-chips {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.detail-meta-chips {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}
.eval-percent {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
}
.eval-facts {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: normal;
  max-width: 220px;
  line-height: 1.3;
}

td[data-col="soap-accuracy"],
td[data-col="clinical-quality"],
td[data-col="execution"] {
  white-space: nowrap;
  vertical-align: middle;
  overflow: visible;
  text-overflow: clip;
}
.table-panel .runs-table th[data-sort-key="SOAP accuracy"] { width: 10.75rem; }
.table-panel .runs-table th[data-sort-key="Clinical Quality"] { width: 12.25rem; }
.table-panel .runs-table th[data-sort-key="Execution Status"] { width: 9.25rem; }
td[data-col="soap-accuracy"] .pill-label {
  display: none;
}
.runs-table td[data-col="soap-accuracy"] .score-pill,
.runs-table .quality-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  border: 1px solid;
  box-shadow: none;
}
.runs-table td[data-col="soap-accuracy"] .score-pill:hover {
  box-shadow: none;
}
.soap-acc-chip .acc-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.soap-acc-chip .acc-unit {
  margin-left: 5px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.7;
}
.runs-table td[data-col="soap-accuracy"] .score-pill.high {
  color: #087443;
  background: #edfaf3;
  border-color: #aaefc6;
}
.runs-table td[data-col="soap-accuracy"] .score-pill.med {
  color: #175cd3;
  background: #eff8ff;
  border-color: #b2ddff;
}
.runs-table td[data-col="soap-accuracy"] .score-pill.warn {
  color: #b54708;
  background: #fffaeb;
  border-color: #fedf89;
}
.runs-table td[data-col="soap-accuracy"] .score-pill.low {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
}

.quality-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0;
}
.quality-chip.quality-acceptable {
  color: #087443;
  background: #edfaf3;
  border-color: #aaefc6;
}
.quality-chip.quality-minor {
  color: #175cd3;
  background: #eff8ff;
  border-color: #b2ddff;
}
.quality-chip.quality-moderate {
  color: #b54708;
  background: #fffaeb;
  border-color: #fedf89;
}
.quality-chip.quality-major {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
}
.quality-empty,
.table-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.runs-table .lang-badge {
  border-radius: 4px;
  font-weight: 600;
  padding: 2px 7px;
}

.soap-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.soap-tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 13px;
}

.soap-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.errors-box {
  background: #FEE2E2;
  color: var(--danger);
  padding: 16px;
  border-radius: 8px;
  font-size: 13px;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-primary);
  color: white;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.toast.toast-warning {
  background: #92400E;
}
.toast.toast-success {
  background: #047857;
}
.toast.toast-error {
  background: #B91C1C;
}

@media (max-width: 1400px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .run-summary-body { flex-direction: column; }
  .quality-bands {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    border-left: none;
    padding: 16px 0 0;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 1200px) {
  .stat-cards-grid { grid-template-columns: repeat(4, 1fr); }
  .run-summary-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .diff-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .main-content {
    padding: 16px;
  }
  .batch-overview-kpis { grid-template-columns: 1fr; }
  .accuracy-summary-stats { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-cards-grid { grid-template-columns: repeat(2, 1fr); }
  .run-summary-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Detail view sections */
.section-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.diff-col {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.diff-col-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.diff-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.diff-highlight {
  background: #FFF3CD;
  border-bottom: 2px solid #E17055;
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 500;
}

.generated-col .diff-highlight {
  background: #FFE8E8;
  border-bottom: 2px solid #E17055;
}

.translation-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.soap-tabs { display: flex; gap: 0.5rem; margin: 1rem 0 0; border-bottom: 2px solid var(--border); }
.soap-tab { padding: 0.5rem 1rem; border: none; background: none; cursor: pointer;
            font-size: 13px; color: var(--text-secondary); border-bottom: 2px solid transparent;
            margin-bottom: -2px; }
.soap-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.soap-content { display: none; padding: 1rem 0; }
.soap-content.active { display: block; }
.soap-field { display: grid; grid-template-columns: 180px 1fr; gap: 0.5rem;
              padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.soap-field-label { font-weight: 500; color: var(--text-secondary); text-transform: capitalize; }
.soap-na { color: var(--text-muted); font-style: italic; }
.soap-nested { padding-left: 0.75rem; border-left: 2px solid var(--border); }
.soap-summary-text { font-size: 14px; color: var(--text-secondary); padding: 0.75rem;
                     background: var(--primary-light); border-radius: 6px; margin-bottom: 1rem; }

.med-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 0.75rem; }
.med-table th { background: var(--bg); padding: 0.5rem 0.75rem; text-align: left;
                font-size: 11px; text-transform: uppercase; color: var(--text-secondary); }
.med-table td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); }
.med-drug-name { font-weight: 600; color: var(--text-primary); vertical-align: top; }
.med-field-name { color: var(--text-secondary); text-transform: capitalize; }
.med-changed { background: #FFF3CD; color: #856404; }
.med-diff-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 6px;
                  border-radius: 3px; margin-left: 6px; text-transform: uppercase; }
.med-diff-badge.high, .med-diff-badge.critical { background: #FFE8E8; color: #E17055; }
.med-diff-badge.medium { background: #FFF3CD; color: #856404; }
.med-diff-badge.low { background: #E8F5E9; color: #2E7D32; }
.med-diff-summary { padding: 0.5rem 0.75rem; border-radius: 6px; font-size: 13px; margin-bottom: 0.75rem; }
.med-diff-summary.warning { background: #FFF3CD; color: #856404; }
.med-diff-summary.success { background: #E8F5E9; color: #2E7D32; }

.med-diff-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.med-diff-type {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.diff-type-label {
  font-size: 13px;
  font-weight: 500;
  text-transform: capitalize;
}

.med-diff-values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: start;
  font-size: 13px;
}

.diff-value {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.diff-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.diff-arrow {
  color: var(--text-muted);
  padding-top: 18px;
}

.no-diffs {
  color: var(--success);
  font-size: 14px;
  padding: 8px 0;
}

.comparison-summary {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.accuracy-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

.accuracy-pill.high { background: #D1FAE5; color: var(--accuracy-high); }
.accuracy-pill.med { background: var(--primary-light); color: var(--accuracy-med); }
.accuracy-pill.warn { background: #FEF3C7; color: #B45309; }
.accuracy-pill.low { background: #FEE2E2; color: var(--accuracy-low); }

.severity-badge.critical { background: #FEE2E2; color: var(--danger); }

.tc-ref {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.03em;
}

.run-id-cell {
  white-space: nowrap;
}

.run-ref-small {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 10px;
}

.detail-ids {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.lang-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
}

.lang-hindi, .lang-hi       { background: #FFF0E6; color: #E65C00; }
.lang-english, .lang-en     { background: #E6F0FF; color: #0055CC; }
.lang-malayalam, .lang-ml   { background: #E6FFE6; color: #006600; }
.lang-tamil, .lang-ta       { background: #FFF6E6; color: #CC7700; }
.lang-telugu, .lang-te      { background: #F0E6FF; color: #6600CC; }

.accuracy-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.acc-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  min-width: 90px;
  border: 1px solid var(--border);
}
.acc-chip.high   { background: #E8F5E9; border-color: #A5D6A7; }
.acc-chip.med    { background: #E3F2FD; border-color: #90CAF9; }
.acc-chip.warn   { background: #FFF8E1; border-color: #FFE082; }
.acc-chip.low    { background: #FFEBEE; border-color: #EF9A9A; }
.acc-chip.muted  { background: var(--bg); border-color: var(--border); }
.acc-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.acc-score {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.soap-three-way {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .soap-three-way { grid-template-columns: 1fr; }
}
.soap-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  background: var(--bg);
}
.soap-panel.high { background: #E8F5E9; border-color: #A5D6A7; }
.soap-panel.med  { background: #E3F2FD; border-color: #90CAF9; }
.soap-panel.warn { background: #FFF8E1; border-color: #FFE082; }
.soap-panel.low  { background: #FFEBEE; border-color: #EF9A9A; }
.soap-panel.muted { background: var(--bg); border-color: var(--border); }
.soap-panel-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.soap-panel-score {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 8px;
}

/* Score pills + reasoning */
.score-pill-wrapper,
.score-pill-wrap {
  position: relative;
  display: inline-block;
}
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: default;
  border: 1px solid transparent;
  transition: box-shadow 0.15s;
  user-select: none;
}
.score-pill:hover {
  box-shadow: 0 0 0 2px currentColor;
}
.score-pill.high  { background: #E8F5E9; color: #2E7D32; border-color: #A5D6A7; }
.score-pill.med   { background: #E3F2FD; color: #1565C0; border-color: #90CAF9; }
.score-pill.warn  { background: #FFF8E1; color: #F57F17; border-color: #FFE082; }
.score-pill.low   { background: #FFEBEE; color: #C62828; border-color: #EF9A9A; }
.score-pill.muted { background: var(--bg); color: var(--text-muted); cursor: default; }
.score-pill[onclick] { cursor: pointer; }
.pill-label {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.8;
}

.reason-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 260px;
  max-width: 360px;
  background: #1a1a2e;
  color: #e0e0e0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 12px;
  line-height: 1.6;
  z-index: 1;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  pointer-events: none;
  white-space: normal;
  text-align: left;
  font-weight: 400;
}

/* In-flow copies stay hidden; the body portal is the visible tooltip. */
.score-pill-wrapper:hover .reason-popup,
.stat-card-tip:hover .stat-tip-popup {
  display: none;
}

.medsum-tooltip-layer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}
.medsum-tooltip-layer[hidden] {
  display: none;
}
.medsum-tooltip-layer .medsum-tooltip-popup {
  display: block;
  position: fixed;
  bottom: auto;
  left: 0;
  top: 0;
  transform: none;
  z-index: 10000;
  max-width: min(360px, calc(100vw - 16px));
}

.reason-popup::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1a1a2e;
}

.medsum-tooltip-popup[data-placement="bottom"]::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: #1a1a2e;
}

.reason-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #90CAF9;
  margin-bottom: 0.4rem;
}

.reason-text {
  color: #e0e0e0;
  white-space: pre-wrap;
  font-size: 12px;
}

.accuracy-tip p { margin: 0 0 0.35rem; }
.accuracy-tip p:last-child { margin-bottom: 0; }
.accuracy-tip .tip-note { color: #FDCB6E; }
.accuracy-tip .tip-pieces {
  margin: 0.35rem 0;
  padding-left: 1.1rem;
}
.accuracy-tip .tip-not-scored { color: #FDCB6E; }
.accuracy-tip .tip-scored { color: #A5D6A7; }
.accuracy-tip .tip-why { margin-top: 0.35rem; }
.accuracy-tip .tip-hint {
  margin-top: 0.45rem;
  color: #90CAF9;
  font-size: 11px;
}

.stat-card-tip { position: relative; }
.stat-card-tip .stat-tip-popup {
  min-width: 280px;
  max-width: 360px;
}

.score-pill-wrapper:last-child .reason-popup,
.score-pill-wrapper:nth-last-child(-n+2) .reason-popup {
  left: auto;
  right: 0;
  transform: none;
}
.score-pill-wrapper:last-child .reason-popup::after,
.score-pill-wrapper:nth-last-child(-n+2) .reason-popup::after {
  left: auto;
  right: 16px;
  transform: none;
}

.reason-box {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  max-width: 380px;
  z-index: 999;
  background: #1a1a2e;
  color: #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  right: auto;
}
.reason-box.align-right {
  left: auto;
  right: 0;
}
.reason-close {
  background: none;
  border: none;
  color: #90CAF9;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}

#accuracy-summary,
.acc-bar-chips,
.collapsible-header {
  overflow: visible;
}

#accuracy-summary {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0.75rem;
}
.acc-bar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.acc-bar-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.collapsible-section { margin-bottom: 0.75rem; }
.collapsible-section .collapsible-section { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.1s;
}
.collapsible-header:hover { background: var(--bg); }
.collapsible-section .collapsible-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 1rem;
  background: var(--card-bg);
}
.collapsible-arrow {
  font-size: 11px;
  color: var(--text-muted);
  width: 14px;
  flex-shrink: 0;
}
.collapsible-title { flex: 1; }

.collapsible-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.header-time-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: #E8EAF6;
  color: #3949AB;
  border: 1px solid #C5CAE9;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}

.soap-three-scores {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.soap-score-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.soap-score-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.soap-compare-table {
  width: 100%;
  min-width: 40rem;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 13px;
}
.soap-compare-table th:nth-child(1),
.soap-compare-table td:nth-child(1) { width: 25%; }
.soap-compare-table th:nth-child(2),
.soap-compare-table td:nth-child(2) { width: 37%; }
.soap-compare-table th:nth-child(3),
.soap-compare-table td:nth-child(3) { width: 33%; }
.soap-compare-table th:nth-child(4),
.soap-compare-table td:nth-child(4) { width: 14%; text-align: left; }
.soap-compare-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  background: var(--bg);
  text-align: left;
  word-wrap: break-word;
}
.soap-compare-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.soap-field-name {
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
}
.cell-gt-correct,
.cell-correct-gt {
  background: #F0FDF4;
  color: #166534;
  font-weight: 500;
}
.cell-gen-wrong,
.cell-incorrect-gen {
  background: #FEE2E2;
  color: #B91C1C;
  font-weight: 500;
}

/* Missing: present in GT but absent in Generated */
.diff-missing-gt {
  background: #FFF3CD;
  border-bottom: 2px solid #F59E0B;
  border-radius: 2px;
  padding: 0 2px;
  color: #92400E;
  font-weight: 500;
}
.cell-missing-gt {
  background: #FFF3CD;
  color: #92400E;
  font-weight: 500;
}

.diff-missing-gen-placeholder {
  color: #D1D5DB;
  font-style: italic;
  font-size: 11px;
}
.cell-missing-gen {
  background: #FEF3F2;
  color: #9CA3AF;
  font-style: italic;
  border: 1px dashed #EF4444;
}

.cell-na {
  color: var(--text-muted);
  font-style: italic;
  background: transparent;
  font-weight: 400;
}

.cell-hallucination-gt {
  background: #F5F3FF;
  color: var(--text-muted);
}

.cell-hallucination-gen {
  background: #EDE9FE;
  color: #5B21B6;
  font-weight: 500;
}

.soap-section-heading {
  margin: 1rem 0 0.5rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.soap-na-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.soap-result-correct { color: #166534; font-weight: 600; }
.soap-result-incorrect { color: #B91C1C; font-weight: 600; }
.soap-result-missing { color: #92400E; font-weight: 600; }
.soap-result-hallucination { color: #5B21B6; font-weight: 600; }
.soap-result-na { color: var(--text-muted); font-weight: 500; font-style: italic; }

tr.soap-result-incorrect td { background: #FEF2F2; }
tr.soap-result-missing td { background: #FFFBEB; }
tr.soap-result-hallucination td { background: #F5F3FF; }

#detail-comparison-tabs {
  margin-bottom: 1.25rem;
}

#detail-cmp-summary,
#detail-cmp-detail {
  padding: 0.75rem 1rem 1rem;
}

#detail-cmp-detail[hidden],
#detail-cmp-summary[hidden] {
  display: none !important;
}

.gt-cmp-inline-hallucination {
  background: #EDE9FE;
  color: #5B21B6;
}

.gt-cmp-inline-incorrect {
  background: #FEE2E2;
  color: #B91C1C;
}

.diff-incorrect-gen {
  background: #FEE2E2;
  border-bottom: 2px solid #EF4444;
  border-radius: 2px;
  padding: 0 2px;
  color: #B91C1C;
  font-weight: 500;
}
.cell-warn {
  background: #FFF8E1;
  color: #E65100;
  font-weight: 500;
}
.col-gt-correct {
  border-left: 3px solid #4CAF50 !important;
  background: #F9FBE7;
}
.col-gen-wrong {
  border-left: 3px solid #EF5350 !important;
  background: #FFF5F5;
}
.diff-flag-cell {
  text-align: center;
  color: #E65100;
  font-size: 12px;
  width: 24px;
}
.med-drug-has-diff {
  border-color: #FFCC80 !important;
}
.section-score-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.note-text {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.med-compare-table {
  width: 100%;
  min-width: 36rem;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 0.25rem;
}
.med-compare-table th:nth-child(1),
.med-compare-table td:nth-child(1) { width: 20%; }
.med-compare-table th:nth-child(2),
.med-compare-table td:nth-child(2) { width: 26%; }
.med-compare-table th:nth-child(3),
.med-compare-table td:nth-child(3) { width: 26%; }
.med-compare-table th:nth-child(4),
.med-compare-table td:nth-child(4) { width: 26%; }
.med-compare-table th {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  background: var(--bg);
  text-align: left;
  word-wrap: break-word;
}
.med-compare-table td {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.med-field {
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
}
.diff-legend-row {
  display: flex;
  gap: 1rem;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.legend-swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 3px;
  vertical-align: middle;
}
.legend-swatch.missing { background: #F59E0B; }
.legend-swatch.wrong   { background: #EF4444; }
.diff-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 12px;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  margin: 0.2rem 0;
  flex-wrap: wrap;
}
.diff-item.high, .diff-item.critical { background: #FFEBEE; }
.diff-item.medium { background: #FFF8E1; }
.diff-item.low    { background: #F3E5F5; }
.diff-item-plain  { font-size: 12px; color: var(--text-secondary); padding: 0.2rem 0; }
.sev-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.sev-badge.high, .sev-badge.critical { background: #FFCDD2; color: #B71C1C; }
.sev-badge.medium { background: #FFF9C4; color: #F57F17; }
.sev-badge.low    { background: #E8EAF6; color: #283593; }
.diff-type { font-weight: 500; color: var(--text-secondary); text-transform: capitalize; }
.diff-gt  { color: var(--text-secondary); }
.diff-gen { color: #C62828; font-weight: 500; }
.arrow    { color: var(--text-muted); }

.diff-missing,
.diff-missing-gt {
  background: #FFF3CD;
  border-bottom: 2px solid #F59E0B;
  border-radius: 2px;
  padding: 0 2px;
  color: #92400E;
  font-weight: 500;
}
.diff-wrong,
.diff-incorrect-gen {
  background: #FEE2E2;
  border-bottom: 2px solid #EF4444;
  border-radius: 2px;
  padding: 0 2px;
  color: #B91C1C;
  font-weight: 500;
}
.diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.75rem;
}
.diff-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}
.diff-col-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}
.diff-text {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}
.diff-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0.75rem 0 0.25rem;
  letter-spacing: 0.04em;
}

.runs-table .reason-popup,
.runs-table .reason-box {
  text-align: left;
  font-weight: 400;
}

@media (max-width: 1100px) {
  .diff-grid { grid-template-columns: 1fr; }
  .rx-cols { grid-template-columns: 1fr; }
  .rx-med-field { grid-template-columns: 100px 1fr; }
  .rx-arrow { display: none; }
}

/* Prescription Comparison */
.rx-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.rx-row:last-child { border-bottom: none; }

.rx-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.rx-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.rx-col {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.rx-col-header {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}
.rx-value {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

.rx-meds-list { margin-top: 0.25rem; }

.rx-med-item {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.rx-med-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.rx-med-field {
  display: grid;
  grid-template-columns: 18% 35% 4% 35% 8%;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.rx-med-field:last-child { border-bottom: none; }

.rx-med-key {
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
}
.rx-med-gt  { color: var(--text-secondary); }
.rx-arrow   { color: var(--text-muted); font-size: 10px; }
.rx-med-gen { color: var(--text-primary); }

em.na { color: var(--text-muted); font-style: italic; }

.rx-meds-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 1rem 0 0.5rem;
}

.latency-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.875rem 1.25rem;
  margin-bottom: 1rem;
}
.latency-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.latency-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 120px;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.latency-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-align: center;
  margin-bottom: 4px;
}
.latency-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}
.latency-audio {
  color: var(--text-secondary);
  font-size: 15px;
}

.diff-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  background: #FEE2E2;
  color: #B91C1C;
  border-radius: 4px;
  white-space: nowrap;
}
.match-badge {
  color: #16A34A;
  font-weight: 700;
}

#acc-doctor-table td {
  vertical-align: middle;
}
.acc-patient-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 220px;
}
.acc-patient-legacy-note {
  font-size: 12px;
  line-height: 1.4;
  color: #B45309;
  background: #FEF3C7;
  padding: 8px 10px;
  border-radius: 6px;
}
.acc-patient-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.acc-patient-chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}
.acc-assigned-patient {
  display: inline-flex;
  align-items: center;
  min-width: 88px;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
  line-height: 1.2;
}
@keyframes acc-patient-saved-flash {
  0% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0); }
}
.acc-assigned-patient.acc-patient-just-saved {
  animation: acc-patient-saved-flash 0.85s ease;
}
.acc-patient-saved-cue {
  flex-shrink: 0;
}
.acc-patient-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  white-space: nowrap;
}
.acc-patient-link:hover { text-decoration: underline; }
.acc-patient-link-danger { color: var(--danger); }
.acc-legacy-patient-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.acc-patient-actions,
.acc-patient-add {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.acc-patient-add input {
  flex: 1;
  min-width: 88px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}
.acc-patient-add input.acc-patient-input-error {
  border-color: var(--danger);
  background: #FEF2F2;
}
.acc-patient-error {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #B91C1C;
}
.acc-add-patient-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}
.acc-setup-input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.2;
  color: var(--text-primary);
  background: #fff;
  box-sizing: border-box;
}
.acc-password-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}
.acc-password-cell .acc-setup-input {
  flex: 1;
  min-width: 0;
  width: auto;
}
.acc-pwd-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  padding: 0;
  line-height: 1;
}
/* Hide browser-native reveal (Edge/Chrome) — custom 👁 button is used instead */
.acc-password-cell input[type="password"]::-ms-reveal,
.acc-password-cell input[type="password"]::-ms-clear,
#lt-doctor-tbody input[type="password"]::-ms-reveal,
#lt-doctor-tbody input[type="password"]::-ms-clear {
  display: none;
}
.acc-credentials-saved-badge {
  font-size: 11px;
  font-weight: 700;
  color: #065F46;
  background: #D1FAE5;
  border: 1px solid #A7F3D0;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.acc-field-saved,
.acc-doctor-credentials-saved .acc-setup-input,
.acc-doctor-credentials-saved .acc-assigned-patient,
.acc-assigned-patient.acc-field-saved,
.acc-assigned-patient.acc-patient-just-saved {
  border-color: #00B894 !important;
  background-color: #ECFDF5 !important;
  background-image: none !important;
  color: #065F46 !important;
  box-shadow: none !important;
}
.acc-doctor-credentials-saved .acc-setup-input:-webkit-autofill,
.acc-doctor-credentials-saved .acc-setup-input:-webkit-autofill:hover,
.acc-doctor-credentials-saved .acc-setup-input:-webkit-autofill:focus,
.acc-field-saved:-webkit-autofill,
.acc-field-saved:-webkit-autofill:hover,
.acc-field-saved:-webkit-autofill:focus {
  -webkit-text-fill-color: #065F46 !important;
  caret-color: #065F46;
  border-color: #00B894 !important;
  box-shadow: 0 0 0 1000px #ECFDF5 inset !important;
  transition: background-color 99999s ease-out;
}
.acc-doctor-credentials-saved .acc-credentials-saved-badge,
.acc-doctor-credentials-saved .acc-patient-saved-cue {
  color: #065F46;
  background: #A7F3D0;
  border-color: #00B894;
}

.run-model-sticky {
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--primary-light);
  border: 1px solid #D0C9F5;
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
}
.run-model-sticky-live {
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  z-index: 4;
}

.multi-audio-picker {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin: 0;
  position: static;
}

.multi-audio-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.multi-audio-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.multi-audio-toolbar .config-input {
  flex: 1 1 180px;
  min-width: 160px;
}

.multi-audio-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.multi-checkbox-list {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  background: var(--card-bg);
  min-width: 0;
}

.multi-audio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  margin: 0;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.multi-audio-label:last-child {
  border-bottom: none;
}

.multi-audio-label:hover {
  background: var(--primary-light);
}

.multi-audio-label:focus-within {
  background: var(--primary-light);
  box-shadow: inset 0 0 0 2px rgba(108, 92, 231, 0.25);
}

.multi-audio-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--primary);
}

.multi-audio-label[hidden] {
  display: none;
}

.drive-orphan-warning {
  margin-top: 10px;
  padding: 10px 12px;
  background: #FFF8E8;
  border: 1px solid #FFE69C;
  border-radius: 8px;
  color: #856404;
  font-size: 13px;
}

.drive-orphan-warning[hidden] {
  display: none;
}

.drive-orphan-heading {
  margin: 0 0 6px;
  font-weight: 600;
}

.drive-orphan-list {
  margin: 0;
  padding-left: 18px;
}

.drive-orphan-list li {
  margin: 2px 0;
  word-break: break-word;
}

.skip-reason-banner {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--bg);
  border-left: 3px solid var(--warning);
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.soap-acc-skipped {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: bottom;
  font-size: 12px;
}

.upload-gt-card h3,
.ai-settings-card h3 {
  margin-bottom: 4px;
  font-size: 16px;
  color: var(--text-primary);
}
.upload-gt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.upload-gt-header .subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.upload-gt-tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.source-tabs {
  display: inline-flex;
  background: #F3F4F6;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.source-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.source-tab svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.source-tab.active {
  background: var(--primary);
  color: #fff;
}
.files-selected-badge {
  display: inline-flex;
  align-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
}
.upload-gt-body {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 16px;
  align-items: stretch;
  height: min(560px, 58vh);
  min-height: 360px;
}
@media (max-width: 960px) {
  .upload-gt-body {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .upload-source-pane:not([hidden]),
  .selected-files-panel {
    min-height: 280px;
    height: min(420px, 50vh);
  }
}
.upload-source-pane {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.upload-source-pane[hidden] {
  display: none !important;
}
.upload-source-pane .multi-audio-picker,
.upload-source-pane .multi-audio-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.gt-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px 16px;
  border: 2px dashed #D1D5DB;
  border-radius: 12px;
  background: #FAFBFF;
  cursor: pointer;
}
.gt-drop-zone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.gt-drop-icon {
  width: 40px;
  height: 40px;
  fill: var(--primary);
}
.gt-drop-primary {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 220px;
}
.gt-drop-secondary {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.gt-browse-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}
.gt-drop-caption {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}
.selected-files-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: white;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.selected-files-panel.is-back-focus {
  border-color: #93C5FD;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}
.selected-files-panel .selected-files-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.selected-files-panel #run-file-empty {
  margin: 12px;
}
.selected-files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.selected-files-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFF;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.selected-files-table th:nth-child(1),
.selected-files-table td:nth-child(1) { width: 44px; }
.selected-files-table th:nth-child(2),
.selected-files-table td:nth-child(2) { width: 28%; }
.selected-files-table th:nth-child(3),
.selected-files-table td:nth-child(3) { width: 88px; }
.selected-files-table th:nth-child(4),
.selected-files-table td:nth-child(4) { width: 26%; }
.selected-files-table th:nth-child(5),
.selected-files-table td:nth-child(5) { width: 140px; }
.selected-files-table th:nth-child(6),
.selected-files-table td:nth-child(6) { width: 110px; }
.selected-files-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.selected-files-table td:nth-child(2),
.selected-files-table td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.selected-files-table td:nth-child(2) .run-audio-file-cell,
.selected-files-table td:nth-child(4).gt-cell {
  white-space: normal;
}
.selected-files-table tr:last-child td { border-bottom: none; }
.run-audio-file-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.run-lang-select {
  min-width: 148px;
  max-width: 100%;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-primary);
}
.run-lang-select:focus {
  outline: 2px solid #4338CA;
  outline-offset: 1px;
}
.gt-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.gt-status-pill.complete { background: #E7F8F3; color: #00B894; }
.gt-status-pill.missing_language { background: #EEF2FF; color: #4338CA; }
.gt-status-pill.missing_soap { background: #FFF4E5; color: #E67E22; }
.gt-status-pill.missing_translation { background: #FDEEEA; color: #E17055; }
.gt-status-pill.missing_transcript { background: #EAF2FF; color: #3B82F6; }
.gt-status-pill.missing_json { background: #FDE8F3; color: #E84393; }
.gt-status-pill.missing_gt_all { background: #FDECEC; color: #C0392B; }
.selected-file-actions {
  display: inline-flex;
  gap: 6px;
}
.icon-action {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.icon-action svg { width: 16px; height: 16px; }
.icon-action.view { color: #5B6B7C; }
.icon-action.view svg { fill: currentColor; }
.icon-action.edit { color: #6C5CE7; }
.icon-action.edit svg { fill: currentColor; }
.icon-action.delete { color: #E74C3C; }
.icon-action.delete svg { fill: currentColor; }
.icon-action:hover { background: var(--primary-light); }
.icon-action.delete:hover { background: #FDEDEC; }
.gt-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.manual-gt-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #EEF0FF;
  color: #6C5CE7;
}
.enter-manual-gt {
  border: none;
  background: none;
  padding: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.enter-manual-gt:hover { text-decoration: underline; }
.gt-edit-dialog {
  width: min(760px, 100%);
}
.gt-edit-filename {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.gt-edit-hint {
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.gt-edit-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 6px;
}
.gt-edit-textarea,
.gt-edit-soap-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
}
.gt-edit-soap {
  margin: 16px 0 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px 12px;
}
.gt-edit-soap legend {
  font-size: 13px;
  font-weight: 700;
  padding: 0 6px;
}
.gt-edit-soap-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}
.gt-edit-soap-toggle {
  display: inline-flex;
  background: #F3F4F6;
  border-radius: 8px;
  padding: 3px;
  gap: 3px;
}
.gt-edit-soap-toggle button {
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.gt-edit-soap-toggle button.is-active {
  background: var(--primary);
  color: #fff;
}
.gt-edit-json {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  min-height: 220px;
}
.gt-edit-json.is-invalid {
  border-color: var(--danger);
}
.gt-edit-json-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.gt-edit-json-hint code {
  font-family: var(--font-mono);
  font-size: 11px;
}
.gt-edit-soap-messages {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
}
.gt-edit-soap-errors,
.gt-edit-soap-warnings {
  margin: 0;
  padding-left: 18px;
}
.gt-edit-soap-errors {
  color: var(--danger);
}
.gt-edit-soap-warnings {
  color: #9A7200;
  margin-top: 6px;
}
.gt-edit-soap-messages[hidden] {
  display: none;
}
.gt-edit-soap-section {
  margin-top: 10px;
}
.gt-edit-soap-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.gt-edit-soap-field {
  margin-bottom: 8px;
}
.gt-edit-soap-field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: capitalize;
  margin-bottom: 4px;
}
.gt-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.status-legend {
  margin-top: 16px;
}
.status-legend-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
.status-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.legend-complete { background: #00B894; }
.legend-missing-language { background: #4338CA; }
.legend-missing-soap { background: #F5A623; }
.legend-missing-translation { background: #E67E22; }
.legend-missing-transcript { background: #3B82F6; }
.legend-missing-json { background: #E84393; }
.legend-missing-all { background: #C0392B; }
.ai-settings-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.ai-model-field { min-width: 220px; }
.ai-run-field {
  text-align: right;
  margin-left: auto;
}
.btn-run-batch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-run-batch .icon-play {
  width: 12px;
  height: 12px;
  fill: currentColor;
}
.ai-run-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 280px;
}

.view-btn {
  display: inline-block;
  margin-left: 8px;
  background: none;
  border: 1px solid var(--border);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
}
.view-btn:hover { background: var(--primary-light); }
.view-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.run-id-cell .tc-ref { margin-right: 4px; }

.row-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.row-actions .view-btn { margin-left: 0; }

.detail-materials { margin-bottom: 1rem; }
.detail-materials h3 { margin-bottom: 12px; }
#detail-case-materials[hidden] { display: none !important; }
.detail-audio-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
  width: 100%;
  min-width: 0;
}
.detail-audio-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 4px 8px;
  margin-bottom: 0;
  min-width: 0;
}
.detail-audio-player-wrap {
  margin-left: 0;
  flex: none;
  min-width: 0;
  max-width: none;
  width: 100%;
}
.detail-audio-player {
  width: 100%;
  height: 28px;
}
.detail-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.detail-field-value { font-size: 14px; }
.detail-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.detail-field-pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  max-height: 220px;
  overflow: auto;
}
.gt-source-chip {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 999px;
  padding: 1px 8px;
}

.gt-comparison-field {
  grid-column: 1 / -1;
}

.gt-cmp {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gt-cmp-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.gt-cmp-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.gt-cmp-filter select,
.gt-cmp-filter input[type="search"] {
  min-width: 160px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
}

.gt-cmp-filter-search {
  flex: 1;
  min-width: 200px;
}

.gt-cmp-search-wrap {
  position: relative;
  display: block;
}

.gt-cmp-search-wrap input {
  width: 100%;
  padding-right: 36px;
}

.gt-cmp-search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.gt-cmp-search-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}

.gt-cmp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.gt-cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.gt-cmp-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.gt-cmp-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-primary);
}

.gt-cmp-table tbody tr.gt-cmp-row:last-of-type td {
  border-bottom: none;
}

.gt-cmp-col-section { width: 18%; }
.gt-cmp-col-gt, .gt-cmp-col-gen, .gt-cmp-col-raw { width: 20%; }
.gt-cmp-col-notes { width: 22%; }

.gt-cmp-section-name {
  font-weight: 700;
  margin-bottom: 6px;
}

.gt-cmp-sev {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.gt-cmp-sev-critical { background: #FEE2E2; color: #B91C1C; }
.gt-cmp-sev-major { background: #FEF3C7; color: #B45309; }
.gt-cmp-sev-minor { background: #E0E7FF; color: #3730A3; }

.gt-cmp-inline-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}

.gt-cmp-inline-missing { background: #FECACA; color: #991B1B; }
.gt-cmp-inline-format { background: #DBEAFE; color: #1D4ED8; }
.gt-cmp-inline-dose { background: #FDE68A; color: #92400E; }
.gt-cmp-inline-other { background: #E5E7EB; color: #374151; }

.gt-cmp-notes-none {
  color: var(--success);
  font-weight: 600;
  margin-bottom: 8px;
}

.gt-cmp-notes {
  color: var(--text-primary);
  margin-bottom: 8px;
}

.gt-cmp-notes-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gt-cmp-view-diff {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  padding: 0;
  color: #2563EB;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.gt-cmp-view-diff:hover { text-decoration: underline; }

.gt-cmp-eye {
  width: 16px;
  height: 16px;
}

.gt-cmp-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: #2563EB;
  cursor: pointer;
  border-radius: 6px;
}

.gt-cmp-icon-btn:hover { background: var(--primary-light); }

.gt-cmp-chevron {
  width: 16px;
  height: 16px;
}

.gt-cmp-details-row td {
  padding: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.gt-cmp-details {
  margin: 0 12px 12px;
  border: 1px solid #E4DDFF;
  border-radius: 10px;
  overflow: hidden;
  background: #FAF8FF;
}

.gt-cmp-details-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #EDE7FF;
  color: #4C1D95;
  font-weight: 700;
  font-size: 13px;
}

.gt-cmp-details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px;
}

.gt-cmp-details-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 88px;
}

.gt-cmp-details-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.gt-cmp-details-body {
  font-size: 13px;
  line-height: 1.45;
}

.gt-cmp-hl-gt,
.gt-cmp-hl-gen {
  background: #D1FAE5;
  color: #065F46;
  padding: 0 2px;
  border-radius: 3px;
}

.gt-cmp-hl-raw {
  background: #FECACA;
  color: #991B1B;
  padding: 0 2px;
  border-radius: 3px;
}

.gt-cmp-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #EFF6FF;
  border-radius: 8px;
  font-size: 12px;
  color: #1E3A8A;
}

.gt-cmp-legend-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3B82F6;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  flex-shrink: 0;
}

.gt-cmp-empty td {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px 12px;
}

@media (max-width: 800px) {
  .detail-field-grid { grid-template-columns: 1fr; }
  .gt-cmp-details-grid { grid-template-columns: 1fr; }
}

/* Detail header: info bar + stat row + compact latency (single-source metrics) */
.detail-info-bar {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  padding: 8px 0 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.detail-back-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}
.detail-info-pairs {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  min-width: 0;
  margin: 0;
}
.detail-info-pair {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.detail-info-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.detail-info-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-info-actions { margin-left: auto; flex-shrink: 0; }
.export-dropdown { position: relative; }
.export-dropdown .export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 220px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(26, 26, 46, 0.12);
  z-index: 20;
  padding: 4px;
}
.export-dropdown:not(.open) .export-menu { display: none; }
.export-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
}
.export-menu-item:hover { background: var(--primary-light); color: var(--primary); }
.export-menu-divider {
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
}

.soap-gt-report { padding: 0.75rem 0 1.25rem; }
.soap-gt-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.soap-gt-toolbar-meta p {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}
.soap-gt-downloads { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.soap-gt-dl-btn { font-size: 12px; padding: 4px 10px; }
.soap-gt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
}
.soap-gt-badge-pass { background: #d1fae5; color: #166534; }
.soap-gt-badge-fail { background: #fecaca; color: #991b1b; }
.soap-gt-badge-partial { background: #fef3c7; color: #92400e; }
.soap-gt-report-table { min-width: 72rem; }
.soap-gt-report-table th:nth-child(1),
.soap-gt-report-table td:nth-child(1) { width: 16%; }
.soap-gt-report-table th:nth-child(2),
.soap-gt-report-table td:nth-child(2),
.soap-gt-report-table th:nth-child(3),
.soap-gt-report-table td:nth-child(3) { width: 16%; }
.soap-gt-report-table th:nth-child(4),
.soap-gt-report-table td:nth-child(4),
.soap-gt-report-table th:nth-child(5),
.soap-gt-report-table td:nth-child(5),
.soap-gt-report-table th:nth-child(7),
.soap-gt-report-table td:nth-child(7) { width: 8%; }
.soap-gt-report-table th:nth-child(6),
.soap-gt-report-table td:nth-child(6) { width: 20%; }
.soap-gt-row-pass td { background: #f0fdf4; }
.soap-gt-row-fail td { background: #fef2f2; }
.soap-gt-error-mark, .soap-gt-status { font-weight: 600; white-space: nowrap; }
.soap-gt-summary {
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.soap-gt-breakdown, .soap-gt-actions { margin: 0.5rem 0 0; padding-left: 1.25rem; }

.detail-stat-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.65fr) minmax(200px, 1.2fr) minmax(140px, 0.9fr) minmax(0, 1.1fr);
  gap: 8px;
  align-items: stretch;
}
.detail-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 0;
  overflow: hidden;
}
.detail-stat-overall { grid-column: auto; min-width: 0; }
.detail-overall-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.detail-stat-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 2px;
}
.detail-stat-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.detail-stat-count {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
}
.detail-stat-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
}
.detail-stat-breakdown {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  margin-top: 4px;
  overflow: hidden;
}
.detail-stat-overall .detail-meta-chips { margin-top: 0; }
.detail-stat-overall .score-pill {
  font-size: 11px;
  padding: 2px 6px;
}
.detail-stat-overall .pill-label { font-size: 9px; }
.detail-med-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.detail-med-card.score-pill,
.detail-materials-card.score-pill {
  height: auto;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 8px;
}
.detail-materials-card.score-pill:hover { box-shadow: none; }
.detail-materials-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  font: inherit;
  cursor: default;
  min-width: 0;
}
.detail-materials-card .detail-stat-label { margin-bottom: 4px; }
.detail-materials-card .detail-field-label {
  font-size: 9px;
  margin-bottom: 0;
}
.detail-materials-card .detail-field-value {
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.detail-latency-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.detail-latency-card .latency-mini-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px 8px;
  width: 100%;
}
.detail-latency-card .latency-mini {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.detail-latency-card .latency-mini .latency-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-latency-card .latency-mini .latency-value {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.detail-latency-card .latency-mini-empty {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
}
.detail-eval-metrics-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.detail-eval-metrics-card .eval-metrics-mini-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px 8px;
  width: 100%;
}
.detail-eval-metrics-card .eval-metrics-mini {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.detail-eval-metrics-card .eval-metrics-mini .eval-metrics-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-eval-metrics-card .eval-metrics-mini .eval-metrics-value {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.detail-fact-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
}
.detail-fact-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  border-left-width: 3px;
}
.detail-fact-card[data-soap-fact="Correct"] { border-left-color: #00B894; }
.detail-fact-card[data-soap-fact="Incorrect"] { border-left-color: #E17055; }
.detail-fact-card[data-soap-fact="Missing"] { border-left-color: #F5A623; }
.detail-fact-card[data-soap-fact="Hallucination"] { border-left-color: #6C5CE7; }
.detail-status-legend {
  margin: 8px 0 12px;
  padding: 8px 0 0;
}
.detail-status-legend .status-legend-title {
  font-size: 11px;
  margin-bottom: 6px;
}
.detail-status-legend .status-legend-items {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.legend-fact-correct { background: #00B894; }
.legend-fact-incorrect { background: #E17055; }
.legend-fact-missing { background: #F5A623; }
.legend-fact-hallucination { background: #6C5CE7; }

#latency-section {
  display: none !important;
}
.latency-strip-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.latency-strip-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
}
.latency-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.latency-inline .latency-label {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
  text-align: left;
}
.latency-inline .latency-value {
  font-size: 13px;
  font-weight: 700;
}

#latency-section.latency-strip {
  display: block;
  margin: 8px 0 12px;
}
.detail-latency-strip {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.detail-latency-strip .detail-stat-label {
  margin-bottom: 0;
}
.detail-latency-strip .latency-strip-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
#detail-case-materials {
  display: none !important;
}

.detail-table-scroll {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.gt-cmp-table {
  min-width: 44rem;
}

@media (max-width: 1280px) {
  .detail-stat-row {
    grid-template-columns: minmax(120px, 0.65fr) minmax(180px, 1.2fr) minmax(130px, 0.9fr) minmax(0, 1.1fr);
  }
  .detail-stat-overall { grid-column: auto; }
}

@media (max-width: 1024px) {
  .detail-info-bar { align-items: flex-start; }
  .detail-info-actions { margin-left: 0; }
  .detail-stat-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .detail-stat-overall { grid-column: auto; }
  .table-panel .runs-table { min-width: 44rem; }
}

@media (max-width: 768px) {
  .detail-info-value { max-width: 160px; }
  .detail-stat-row { grid-template-columns: minmax(0, 1fr); }
  .detail-back-btn { width: 100%; }
  .detail-materials-card { grid-column: auto; }
  .detail-audio-meta { grid-template-columns: minmax(0, 1fr); }
}

/* Summary SOAP field navigator */
#detail-cmp-summary {
  padding: 12px 12px 16px;
}
.soap-nav {
  --soap-nav-accent: #2563EB;
  --soap-nav-accent-soft: #EFF6FF;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.soap-nav-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.soap-nav-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.soap-nav-pill {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.soap-nav-pill:hover { border-color: var(--soap-nav-accent); color: var(--soap-nav-accent); }
.soap-nav-pill.is-active {
  background: var(--soap-nav-accent);
  border-color: var(--soap-nav-accent);
  color: #fff;
}
.soap-nav-search {
  position: relative;
  flex: 1 1 220px;
  min-width: 200px;
}
.soap-nav-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.soap-nav-search-icon svg {
  display: block;
  width: 16px;
  height: 16px;
}
.soap-nav-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: var(--text-primary);
}
.soap-nav-search input:focus {
  outline: none;
  border-color: var(--soap-nav-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.soap-nav-expand-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.soap-nav-ghost {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #BFDBFE;
  background: #fff;
  color: var(--soap-nav-accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.soap-nav-ghost:hover { background: var(--soap-nav-accent-soft); }
.soap-nav-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: min(70vh, 640px);
  align-items: stretch;
}
.soap-nav-sidebar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px 12px;
  min-height: 0;
  min-width: 0;
  max-height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.soap-nav-section-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.soap-nav-sidebar-head {
  padding: 2px 6px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.soap-nav-sidebar-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}
.soap-nav-sidebar-head p {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
}
.soap-nav-section-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  text-align: left;
  color: var(--text-primary);
}
.soap-nav-section-btn:hover { background: #F8FAFC; }
.soap-nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.soap-nav-icon svg { width: 16px; height: 16px; }
.soap-nav-icon-subjective { background: #DBEAFE; color: #2563EB; }
.soap-nav-icon-objective { background: #DCFCE7; color: #16A34A; }
.soap-nav-icon-assessment { background: #FFEDD5; color: #EA580C; }
.soap-nav-icon-plan { background: #EDE9FE; color: #7C3AED; }
.soap-nav-section-copy { flex: 1 1 auto; min-width: 0; }
.soap-nav-section-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.soap-nav-pct {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.soap-nav-pct-high { background: #DCFCE7; color: #15803D; }
.soap-nav-pct-good { background: #CCFBF1; color: #0F766E; }
.soap-nav-pct-mid { background: #FFEDD5; color: #C2410C; }
.soap-nav-pct-empty { background: #F3F4F6; color: var(--text-muted); }
.soap-nav-section-count {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.soap-nav-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.soap-nav-leaves {
  display: flex;
  flex-direction: column;
  padding: 0 4px 6px 40px;
}
.soap-nav-leaf {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 6px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  color: var(--text-primary);
  font-size: 13px;
}
.soap-nav-leaf:hover { background: #F8FAFC; }
.soap-nav-leaf.is-selected {
  background: var(--soap-nav-accent-soft);
  color: var(--soap-nav-accent);
}
.soap-nav-leaf-label { flex: 1 1 auto; min-width: 0; }
.soap-nav-leaf-count {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.soap-nav-leaf.is-selected .soap-nav-leaf-count { color: var(--soap-nav-accent); }
.soap-nav-main {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  min-height: 0;
  min-width: 0;
  display: flex;
  overflow: hidden;
}
.soap-nav-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 32px;
  min-height: 0;
  overflow: auto;
}
.soap-nav-empty-ring {
  width: 96px;
  height: 96px;
  border: 2px dashed #BFDBFE;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60A5FA;
  margin-bottom: 18px;
}
.soap-nav-empty-ring svg { width: 56px; height: 56px; }
.soap-nav-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: #1E293B;
  margin-bottom: 8px;
}
.soap-nav-empty-body {
  max-width: 360px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.soap-nav-selected {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}
.soap-nav-compare-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 12px;
  padding: 14px 14px 0;
  background: #fff;
  overflow: hidden;
}
.soap-nav-compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.soap-nav-compare-head h4 {
  font-size: 14px;
  font-weight: 700;
}
.soap-nav-result-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.soap-nav-badge-match { background: #DCFCE7; color: #15803D; }
.soap-nav-badge-missing { background: #FFEDD5; color: #C2410C; }
.soap-nav-badge-hallucinated { background: #EDE9FE; color: #6D28D9; }
.soap-nav-badge-incorrect { background: #FEE2E2; color: #B91C1C; }
.soap-nav-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.soap-nav-compare-col {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 88px;
}
.soap-nav-compare-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.soap-nav-compare-value {
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.soap-nav-compare-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.soap-nav-close {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
}
.soap-nav-close:hover { background: #F3F4F6; color: var(--text-primary); }
.soap-nav-compare-col.is-empty .soap-nav-compare-value {
  color: var(--text-muted);
  font-style: italic;
}
.soap-nav-hl {
  background: #FECACA;
  color: #991B1B;
  padding: 0 2px;
  border-radius: 3px;
}
.soap-nav-difference {
  margin: 12px 0;
  font-size: 13px;
  color: var(--text-primary);
}
.soap-nav-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.soap-nav-meta div { min-width: 0; }
.soap-nav-meta dt {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.soap-nav-meta dd { font-size: 13px; font-weight: 600; }
.soap-nav-sig {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.soap-nav-sig-high, .soap-nav-sig-critical { background: #FEE2E2; color: #B91C1C; }
.soap-nav-sig-normal { background: #E0E7FF; color: #3730A3; }
.soap-nav-seq {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 10px 0 12px;
  margin-top: 8px;
}
.soap-nav-compare-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.soap-nav-med-block {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.soap-nav-med-head {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 28px;
  padding: 0 2px 0 8px;
  background: #F8FAFC;
}
.soap-nav-med-block:not(.is-collapsed) .soap-nav-med-head {
  border-bottom: 1px solid var(--border);
}
.soap-nav-med-toggle {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 28px;
  margin: 0;
  padding: 0 4px 0 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.soap-nav-med-toggle:hover { background: transparent; }
.soap-nav-med-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.soap-nav-med-head .soap-nav-result-badge {
  flex-shrink: 0;
  font-size: 10px;
  padding: 1px 6px;
}
.soap-nav-med-head .soap-nav-chevron {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}
.soap-nav-med-close {
  width: 22px;
  height: 22px;
  font-size: 16px;
  flex-shrink: 0;
}
.soap-nav-med-body { padding: 0; }
.soap-nav-med-block.is-collapsed .soap-nav-med-body { display: none; }
.soap-nav-med-table {
  min-width: 32rem;
}
.soap-nav-med-table th,
.soap-nav-med-table td {
  padding: 6px 8px;
  font-size: 12px;
}
.soap-nav-badge-modified { background: #FFEDD5; color: #C2410C; }
.soap-nav-group-scroll {
  padding: 0 4px 12px;
}
.soap-nav-group-table {
  min-width: 0;
}
.soap-nav-group-table th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1E3A5F;
  background: #fff;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.soap-nav-group-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: #1E293B;
  border-bottom: 1px solid #E8EEF5;
  vertical-align: middle;
}
.soap-nav-group-field {
  font-weight: 600;
  color: #0F172A;
}
.soap-nav-group-table tbody tr[data-soap-nav-pick] {
  cursor: pointer;
}
.soap-nav-group-table tbody tr:hover td {
  background: #F8FBFF;
}
.soap-nav-group-table tbody tr.is-mismatch td,
.soap-nav-group-table tbody tr.is-selected td {
  background: #EEF4FF;
}
.soap-nav-group-table .soap-result-cell {
  white-space: nowrap;
}
.soap-nav-seq-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.soap-nav-subleaves {
  padding-left: 12px;
}
.soap-nav-ghost:disabled {
  opacity: 0.45;
  cursor: default;
}
@media (max-width: 900px) {
  .soap-nav-body { grid-template-columns: 1fr; }
  .soap-nav-expand-btns { margin-left: 0; }
  .soap-nav-compare-grid { grid-template-columns: 1fr; }
  .soap-nav-meta { grid-template-columns: 1fr 1fr; }
}

/* Clinical Fact Accuracy table */
.accuracy-table-section {
  margin: 0 0 1.25rem;
  padding: 1.15rem 1.25rem 1.2rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.accuracy-table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.accuracy-table-section h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.accuracy-table-sub,
.accuracy-table-note {
  margin: 0.2rem 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.accuracy-table-note { margin: 0 0 0.75rem; }
.accuracy-details-toggle {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 13px;
}
.accuracy-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.accuracy-stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
}
.accuracy-stat-value {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.accuracy-stat-label {
  margin-top: 0.2rem;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.accuracy-table-wrap {
  overflow-x: auto;
}
.accuracy-table-section .clinical-accuracy-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 13px;
}
.accuracy-table-section .clinical-accuracy-table th,
.accuracy-table-section .clinical-accuracy-table td {
  padding: 0.75rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.accuracy-table-section .clinical-accuracy-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg);
}
.accuracy-table-section .clinical-accuracy-table th:first-child,
.accuracy-table-section .clinical-accuracy-table td:first-child {
  width: 28%;
  padding-left: 1rem;
  padding-right: 1.5rem;
}
.accuracy-table-section .clinical-accuracy-table th:not(:first-child),
.accuracy-table-section .clinical-accuracy-table td:not(:first-child) {
  width: 14.4%;
  text-align: center;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.clinical-accuracy-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 13px;
}
.clinical-accuracy-table th,
.clinical-accuracy-table td {
  padding: 0.7rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.clinical-accuracy-table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg);
}
.clinical-accuracy-table th:not(:first-child),
.clinical-accuracy-table td:not(:first-child) {
  text-align: center;
}
.category-row {
  cursor: default;
}
.category-row:hover td { background: var(--bg); }
.category-row.is-open td,
.category-row.is-expanded td { background: #F8FAFF; }
.category-row.is-total td {
  font-weight: 700;
  background: #F3F4F8;
}
.category-name { font-weight: 650; }
.col-category {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.safety-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #6f42c1;
  background: #F3E8FF;
  border-radius: 999px;
  padding: 1px 7px;
}
.metric-value { font-variant-numeric: tabular-nums; font-weight: 650; }
.metric-value.correct,
.metric-value.missed,
.metric-value.wrong,
.metric-value.invented { color: inherit; }
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 4.6rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--text-muted);
}
.status.pass { background: var(--clinical-pass); }
.status.review { background: var(--clinical-review); }
.status.fail { background: var(--clinical-fail); }
.status.na { background: #9CA3AF; }
.detail-row td {
  background: #F8FAFF;
  padding: 0;
}
.detail-row[hidden] { display: none; }
.detail-row-inner {
  padding: 0.75rem 0.9rem 0.9rem 1.1rem;
}
.detail-title {
  margin: 0 0 0.35rem;
  font-size: 13px;
  font-weight: 700;
}
.detail-row-inner ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-secondary);
}
.detail-note {
  margin: 0.45rem 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.pass-rule {
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}
.pass-rule p { margin: 0; }
.accuracy-table-state {
  padding: 1.25rem 0.25rem 0.4rem;
  color: var(--text-secondary);
  font-size: 14px;
}
.accuracy-table-state.is-error { color: var(--clinical-fail); }

@media (max-width: 1100px) {
  .accuracy-summary-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .accuracy-table-section { padding: 1rem; }
  .accuracy-table-head { flex-direction: column; align-items: stretch; }
  .accuracy-summary-stats { grid-template-columns: 1fr; }
  .clinical-accuracy-table { min-width: 640px; }
}
@media (max-width: 480px) {
  .accuracy-stat-value { font-size: 20px; }
}

.recordings-table-section {
  margin-top: 0;
}
.recordings-table-section.is-back-focus,
.table-panel[data-results-source="history"].is-back-focus {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 4px;
  border-radius: 12px;
}
.recordings-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  padding: 0.35rem 0.7rem;
  background: #F3F6FA;
  border: 1px solid #E5EAF1;
  border-radius: 999px;
}
.recordings-view-label {
  font-size: 13px;
  font-weight: 600;
  color: #94A3B8;
  white-space: nowrap;
}
.recordings-view-label.is-active {
  color: #334155;
}
.recordings-view-switch {
  position: relative;
  width: 36px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #CBD5E1;
  cursor: pointer;
  flex-shrink: 0;
}
.recordings-view-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s ease;
}
.recordings-view-switch.is-detailed {
  background: #3B82F6;
}
.recordings-view-switch.is-detailed .recordings-view-knob {
  transform: translateX(16px);
}
.recordings-subtitle {
  margin: 0.2rem 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.recordings-head {
  align-items: center;
}
.recordings-head-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.recordings-head-left h3 {
  margin: 0;
}
.recordings-subtitle-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: #E8F1FF;
  color: #3B5BDB;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}
.recordings-detailed-panel {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.recordings-columns-box {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid #EDF2F7;
}
.recordings-columns-box.is-open {
  padding-bottom: 0.7rem;
}
.recordings-columns-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.15rem 0;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: #1A202C;
  cursor: pointer;
}
.recordings-columns-caret {
  font-size: 11px;
  color: #64748B;
}
.recordings-columns-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.15rem;
  margin-top: 0.55rem;
}
.recordings-columns-grid[hidden] {
  display: none;
}
.recordings-col-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 13px;
  color: #2D3748;
  white-space: nowrap;
  cursor: pointer;
}
.recordings-col-option input {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: #2B6CB0;
}
.recordings-detailed-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.25rem;
  margin: 0;
  padding: 0.75rem 1rem;
  background: #EAF3FF;
  border-bottom: 1px solid #D6E6FF;
  font-size: 13px;
  color: #334155;
}
.recordings-detailed-summary strong {
  font-weight: 700;
  color: #1E293B;
}
.recordings-table-wrap-detailed {
  max-height: 480px;
  border: none;
  border-radius: 0;
}
.recordings-table-detailed {
  min-width: 1280px;
}
.recordings-table-detailed th {
  white-space: normal;
  max-width: 7.25rem;
  line-height: 1.25;
  vertical-align: bottom;
  background: #F7FAFC;
  font-weight: 650;
  color: #2D3748;
}
.recordings-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
}
.recordings-filter-btn {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-primary);
  cursor: pointer;
}
.recordings-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.recordings-filter-btn.active {
  background: #2b6cb0;
  border-color: #2b6cb0;
  color: #fff;
}
.recordings-count {
  margin: 0 0 0.65rem;
  font-size: 13px;
  color: var(--text-secondary);
}
.recordings-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.recordings-table {
  min-width: 760px;
}
.recordings-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fafc;
}
.recordings-table tbody tr:hover td {
  background: #f7fafc;
}
.recordings-table tbody tr.recording-row.is-clickable {
  cursor: pointer;
}
/* Flag is first-child; override accuracy-table 28% first-column width */
.accuracy-table-section .recordings-table th.flag-col,
.accuracy-table-section .recordings-table td.flag-col,
.recordings-table .flag-col {
  width: 2.75rem;
  max-width: 2.75rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
.accuracy-table-section .recordings-table th:nth-child(2),
.accuracy-table-section .recordings-table td:nth-child(2) {
  width: 28%;
  text-align: left;
  padding-left: 1rem;
  padding-right: 1.5rem;
}
.flag-header-stack {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
/* Detailed View: flag above sort caret (must beat .flag-header-stack row) */
.flag-header-stack.flag-header-stack-vertical {
  flex-direction: column;
  gap: 2px;
}
.recordings-flag-sort {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 14px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.recordings-flag-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid #1E3A8A;
}
.recordings-flag-sort.is-down .recordings-flag-caret {
  border-bottom: none;
  border-top: 6px solid #1E3A8A;
}
.recordings-flag-header {
  font-size: 13px;
  line-height: 1;
}
.recordings-table-detailed .flag-col {
  width: 2.5rem;
  max-width: 2.5rem;
  vertical-align: bottom;
}
.recording-name {
  font-weight: 700;
}
.recording-name a {
  color: #2b6cb0;
  text-decoration: none;
}
.recording-name a:hover {
  text-decoration: underline;
}
.recordings-table .metrics .correct { color: inherit; font-weight: 700; }
.recordings-table .metrics .separator { color: #718096; }
.recordings-table .metrics .total { color: #4a5568; }
.recordings-table .missed,
.recordings-table .wrong,
.recordings-table .invented { color: inherit; font-weight: 650; }
.recording-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.recording-badge.status-pass {
  background: #e6f8e6;
  color: #22863a;
}
.recording-badge.status-review {
  background: #fff3cd;
  color: #bf8700;
}
.recording-badge.status-safety,
.recording-badge.status-fail {
  background: #ffeef0;
  color: #cb2431;
}
.recording-badge.status-na {
  background: #E5E7EB;
  color: #4B5563;
}
.recordings-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 1.25rem 0.65rem;
}

/* Case details shell (matches MedSum v2.3 mockup) */
#detail-view.page-view.is-active,
#detail-view.page-view {
  max-width: none;
}
.case-top-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  padding: 0.35rem 0 0.9rem;
}
.case-back-btn {
  appearance: none;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #334155;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
  cursor: pointer;
  line-height: 1.2;
}
.case-back-btn:hover {
  border-color: #94a3b8;
  background: #F8FAFC;
}
.case-top-tc {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}
.case-top-lang {
  font-size: 0.88rem;
  color: #64748B;
}
.case-top-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}
.case-top-deid {
  background: #DCFCE7;
  color: #166534;
}
.case-top-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.case-top-status.is-review {
  background: #FFEDD5;
  color: #c2410c;
}
.case-top-status.is-pass {
  background: #DCFCE7;
  color: #166534;
}
.case-top-status.is-fail {
  background: #FEE2E2;
  color: #b91c1c;
}
.case-top-status.is-na {
  background: #F1F5F9;
  color: #475569;
}

.case-detail-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: visible;
}
.case-detail-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.25rem;
  padding: 1rem 1.15rem 0.85rem;
}
.case-header-left {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem 0.85rem;
  min-width: 0;
}
.case-header-tc {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.case-header-meta {
  font-size: 0.88rem;
  color: #64748B;
}
.case-header-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
}
.case-hstat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}
.case-hstat::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.case-hstat-correct { color: #15803d; }
.case-hstat-correct::before {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  background: #16a34a;
  clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 18%, 80% 0, 38% 62%);
}
.case-hstat-missed { color: #a16207; }
.case-hstat-missed::before { background: #eab308; }
.case-hstat-wrong { color: #b91c1c; }
.case-hstat-wrong::before { background: #ef4444; }
.case-hstat-invented { color: #7e22ce; }
.case-hstat-invented::before { background: #a855f7; }
.case-hstat-safety { color: #b91c1c; }
.case-hstat-safety::before {
  content: "⚑";
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  font-size: 0.85rem;
  line-height: 1;
}

.case-detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.1rem;
  padding: 0 1rem;
  border-bottom: 1px solid #E2E8F0;
}
.case-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #64748B;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.case-tab:hover {
  color: #0f172a;
}
.case-tab.is-active {
  color: #0f172a;
  font-weight: 600;
  border-bottom-color: #1e3a8a;
}
.case-tab-panel {
  padding: 0;
}
.case-tab-panel[hidden] {
  display: none !important;
}
#case-panel-soap,
#case-panel-translation,
#case-panel-transcription,
#case-panel-audio {
  padding: 1rem 1.1rem 1.15rem;
}

/* Clinical Facts lives inside the case card — no nested card chrome */
#recording-clinical-detail {
  margin: 0;
}
#recording-clinical-detail .cf-panel,
#recording-clinical-detail .recording-clinical-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}
#recording-clinical-detail .cf-filters {
  padding: 0.85rem 1.15rem 0.35rem;
}
#recording-clinical-detail .cf-summary-line {
  margin: 0 1.15rem 0.75rem;
}
#recording-clinical-detail .cf-table-wrap {
  border-top: 1px solid #E2E8F0;
}

@media (max-width: 900px) {
  .case-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .case-top-status {
    margin-left: 0;
  }
}

/* Per-recording clinical fact panel (detail page) */
#recording-clinical-detail {
  margin: 0 0 1.25rem;
}
.recording-clinical-panel {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.recording-clinical-head {
  padding: 0.9rem 1.1rem 0.35rem;
}
.recording-clinical-head h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #1A202C;
}
.recording-clinical-sub {
  margin: 0.25rem 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}
.recording-detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.35rem;
  margin: 0.65rem 1.1rem 1rem;
  padding: 0.75rem 1rem;
  background: #F0F8F4;
  border-left: 4px solid #22863a;
  border-radius: 6px;
  font-size: 0.92rem;
}
.recording-detail-summary strong {
  color: #2D3748;
  font-weight: 600;
}
.recording-detail-table-wrap {
  overflow-x: auto;
  border-top: 1px solid #E2E8F0;
}
.recording-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 1100px;
}
.recording-detail-table th {
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #2D3748;
  background: #F7FAFC;
  border-bottom: 1px solid #E2E8F0;
  white-space: nowrap;
  font-size: 0.8rem;
}
.recording-detail-table td {
  padding: 0.85rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid #EDF2F7;
  white-space: nowrap;
}
.recording-detail-table td:first-child {
  text-align: left;
  font-weight: 600;
}
.recording-detail-cat,
.recording-detail-missed,
.recording-detail-wrong,
.recording-detail-invented {
  cursor: pointer;
  transition: background 0.15s;
}
.recording-detail-cat:hover,
.recording-detail-missed:hover,
.recording-detail-wrong:hover,
.recording-detail-invented:hover,
.recording-detail-cat.is-open,
.recording-detail-missed.is-open,
.recording-detail-wrong.is-open,
.recording-detail-invented.is-open {
  background: #EDF2F7;
}
.recording-fact-panel {
  margin: 0;
  padding: 1.1rem 1.15rem 1.25rem;
  border-top: 1px solid #E2E8F0;
  background: #F7FAFC;
}
.recording-fact-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: #1A202C;
}
.recording-fact-summary {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: #4A5568;
}
.recording-fact-section {
  margin-bottom: 1rem;
}
.recording-fact-heading {
  margin: 0 0 0.55rem;
  font-size: 0.92rem;
  font-weight: 600;
}
.recording-fact-heading.missed,
.missed-fact {
  color: #cb2431;
}
.recording-fact-heading.wrong,
.wrong-fact {
  color: #7d3c1a;
}
.recording-fact-heading.invented,
.invented-fact {
  color: #6f42c1;
}
.recording-fact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  overflow: hidden;
}
.recording-fact-list li {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #E2E8F0;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
  white-space: normal;
}
.recording-fact-list li:last-child {
  border-bottom: none;
}
.missed-fact {
  background: #ffeef0;
}
.wrong-fact {
  background: #fff3cd;
}
.invented-fact {
  background: #f3f0ff;
}
.recording-fact-cat {
  display: inline-block;
  margin-right: 0.45rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  background: #E2E8F0;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 600;
}
.recording-fact-empty {
  margin: 0;
  color: #64748B;
  font-size: 0.9rem;
}
.recording-clinical-state {
  padding: 1rem 1.1rem;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #fff;
  color: #64748B;
  font-size: 0.92rem;
}
.recording-clinical-state.is-error {
  color: #cb2431;
  background: #ffeef0;
  border-color: #FECACA;
}

/* Clinical Facts comparison (Case Details filter + table) */
.cf-panel {
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  background: #fff;
  overflow: visible;
}
.cf-ribbon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin: 0.85rem 1.1rem;
  padding: 0.8rem 1rem;
  background: #EAF3FB;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #334155;
}
.cf-ribbon-meta,
.cf-ribbon-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  align-items: center;
}
.cf-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
}
.cf-stat-correct { color: #15803d; }
.cf-stat-missed { color: #a16207; }
.cf-stat-wrong { color: #b91c1c; }
.cf-stat-invented { color: #7e22ce; }
.cf-stat-safety { color: #b91c1c; }
.cf-stat-correct::before,
.cf-stat-missed::before,
.cf-stat-wrong::before,
.cf-stat-invented::before,
.cf-stat-safety::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.cf-stat-correct::before {
  background: #16a34a;
  box-shadow: inset 0 0 0 1px #16a34a;
  border-radius: 2px;
  width: 0.65rem;
  height: 0.65rem;
  clip-path: polygon(14% 44%, 0 65%, 40% 100%, 100% 18%, 80% 0, 38% 62%);
}
.cf-stat-safety::before {
  content: "⚑";
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  font-size: 0.85rem;
  line-height: 1;
}

.cf-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.65rem;
  padding: 0 1.1rem 0.55rem;
  position: relative;
  z-index: 5;
}
.cf-filters-label {
  font-size: 0.92rem;
  color: #64748B;
  font-weight: 500;
  margin-right: 0.15rem;
}
.cf-filter-dd {
  position: relative;
  min-width: 10.5rem;
}
.cf-filter-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  min-width: 10.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 0.9rem;
  line-height: 1.25;
  cursor: pointer;
  text-align: left;
  box-shadow: none;
}
.cf-filter-dd.is-open .cf-filter-trigger,
.cf-filter-trigger:focus {
  outline: none;
  border-color: #1e3a8a;
  box-shadow: 0 0 0 1px #1e3a8a;
}
.cf-filter-trigger-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cf-filter-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #334155;
  flex-shrink: 0;
}
.cf-filter-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 100%;
  max-height: 18rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.2rem 0;
  background: #fff;
  border: 1px solid #94a3b8;
  border-radius: 2px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.14);
  z-index: 20;
}
.cf-filter-menu-tags {
  min-width: 16rem;
  max-height: 22rem;
}
.cf-filter-option {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  border: 0;
  background: transparent;
  color: #0f172a;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  line-height: 1.35;
}
.cf-filter-option:hover,
.cf-filter-option.is-selected {
  background: #4b5563;
  color: #fff;
}
.cf-filter-group {
  padding: 0.45rem 0.75rem 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748B;
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  border-bottom: 1px solid #E2E8F0;
  margin-top: 0.15rem;
}
.cf-clear-filters {
  border: 0;
  background: transparent;
  color: #2563eb;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0.35rem 0.4rem;
  font-weight: 500;
}
.cf-clear-filters:hover:not(:disabled) {
  text-decoration: underline;
}
.cf-clear-filters.is-disabled,
.cf-clear-filters:disabled {
  color: #94a3b8;
  cursor: default;
  text-decoration: none;
}
.cf-summary-line {
  margin: 0 1.1rem 0.75rem;
  font-size: 0.82rem;
  color: #64748B;
}

.cf-table-wrap {
  overflow-x: auto;
  border-top: 1px solid #E2E8F0;
}
.cf-table {
  width: auto;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.88rem;
  min-width: 0;
}
.cf-table th {
  position: relative;
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #475569;
  background: #F8FAFC;
  border-bottom: 1px solid #E2E8F0;
  border-right: 1px solid #CBD5E1;
  white-space: nowrap;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.cf-table th:last-child,
.cf-table td:last-child {
  border-right: 0;
}
.cf-th-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cf-col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}
.cf-col-resizer::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: #94A3B8;
  border-radius: 1px;
  opacity: 0.85;
}
.cf-col-resizer:hover::after,
.cf-col-resizing .cf-col-resizer::after {
  background: #1e3a8a;
  opacity: 1;
}
body.cf-col-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.cf-col-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
.cf-table td {
  padding: 0.7rem 0.75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #EDF2F7;
  border-right: 1px solid #E2E8F0;
  color: #0f172a;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.cf-table tr.cf-row-wrong td {
  background: #fff1f2;
}
.cf-table tr.cf-row-missing td {
  background: #fffbeb;
}
.cf-table tr.cf-row-invented td {
  background: #faf5ff;
}
.cf-table tr.cf-row-partial td {
  background: #f0f9ff;
}
.cf-empty td {
  text-align: center;
  color: #64748B;
  padding: 1.25rem 0.75rem;
}

.cf-result {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  white-space: nowrap;
}
.cf-result-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.cf-result-correct { color: #15803d; }
.cf-result-correct .cf-result-dot { background: #16a34a; }
.cf-result-missing { color: #a16207; }
.cf-result-missing .cf-result-dot { background: #eab308; }
.cf-result-wrong { color: #b91c1c; }
.cf-result-wrong .cf-result-dot { background: #ef4444; }
.cf-result-partial { color: #0369a1; }
.cf-result-partial .cf-result-dot { background: #0ea5e9; }
.cf-result-invented { color: #7e22ce; }
.cf-result-invented .cf-result-dot { background: #a855f7; }

.cf-safety {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 8rem;
}
.cf-safety-check input {
  accent-color: #dc2626;
  width: 1rem;
  height: 1rem;
}
.cf-safety-auto {
  font-size: 0.75rem;
  color: #c2410c;
  font-weight: 500;
}
.cf-safety-select {
  font-size: 0.78rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid #CBD5E1;
  border-radius: 4px;
  background: #fff;
  color: #475569;
  max-width: 8.5rem;
}

.cf-error-tag {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}
.cf-error-tag-name {
  color: #0f172a;
  font-size: 0.88rem;
}
.cf-error-source {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: #DBEAFE;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
}

@media (max-width: 768px) {
  .recording-detail-summary {
    gap: 0.55rem 0.9rem;
    font-size: 0.82rem;
  }
  .recording-detail-table {
    font-size: 0.75rem;
  }
  .recording-detail-table th,
  .recording-detail-table td {
    padding: 0.5rem;
  }
  .cf-ribbon {
    flex-direction: column;
  }
  .cf-filters {
    align-items: stretch;
  }
  .cf-filter-dd,
  .cf-filter-trigger {
    min-width: 0;
    width: 100%;
  }
}

/* Translation quality metrics — compact METRIC / VALUE table (always white) */
.tq-metrics,
.translation-quality-metrics {
  margin-top: 1rem;
  width: 100%;
  max-width: 28rem;
  padding: 16px;
  background: #ffffff !important;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  color: #222;
  box-sizing: border-box;
}
.tq-metrics-head,
.metrics-title {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  position: relative;
  margin: 0 0 12px;
  padding: 0 0 12px;
  border-bottom: 1px solid #e0e0e0;
  background: #ffffff !important;
}
.tq-metrics-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #222;
  letter-spacing: 0;
  line-height: 1.4;
}
.tq-metrics-info,
.info-icon {
  width: 16px;
  height: 16px;
  margin-left: 0;
  border-radius: 50%;
  border: 1px solid #c5c5c5;
  background: #ffffff !important;
  color: #999;
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  padding: 0;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}
.tq-metrics-info:hover,
.tq-metrics-head.is-open .tq-metrics-info,
.info-icon:hover {
  opacity: 1;
  border-color: #999;
  color: #666;
  background: #ffffff !important;
}
.tq-metrics-popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  width: min(28rem, calc(100vw - 2rem));
  max-height: none;
  height: auto;
  overflow: visible;
  padding: 0.9rem 1rem;
  background: #0b1f3a;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.25);
}
.tq-metrics-popover-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
}
.tq-metrics-defs {
  margin: 0;
  display: grid;
  gap: 0.7rem;
}
.tq-metrics-defs > div {
  display: block;
  font-size: 0.8rem;
  line-height: 1.4;
}
.tq-metrics-defs dt {
  display: inline;
  font-weight: 700;
  font-size: inherit;
  margin-right: 0.2rem;
}
.tq-metrics-defs dd {
  display: inline;
  margin: 0;
  font-size: inherit;
  line-height: inherit;
  color: rgba(255, 255, 255, 0.92);
}
.tq-metrics-table,
.metrics-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 13px;
  line-height: 1.4;
  background: #ffffff !important;
}
.tq-metrics-table th,
.metrics-table th {
  padding: 6px 0;
  background: #ffffff !important;
  color: #999;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid #e0e0e0;
}
.tq-metrics-table th:first-child,
.metric-column {
  width: auto;
  text-align: left;
  padding-right: 12px;
}
.tq-metrics-table th:last-child,
.value-column {
  width: 1%;
  text-align: right;
  white-space: nowrap;
  padding-left: 12px;
}
.tq-metrics-table td,
.metrics-table td {
  padding: 0;
  border: 0;
  vertical-align: middle;
  background: #ffffff !important;
}
.tq-metrics-table tbody tr,
.metric-row {
  border-bottom: 1px solid #e8e8e8;
  background: #ffffff !important;
}
.tq-metrics-table tbody tr:last-child,
.metric-row:last-child {
  border-bottom: none;
}
.tq-metrics-table tbody tr:hover,
.metric-row:hover {
  background: #ffffff !important;
}
.tq-metric-name,
.metric-label {
  padding: 8px 12px 8px 0;
  color: #666;
  font-weight: 400;
  font-size: 13px;
  text-align: left;
  line-height: 1.4;
  min-height: 32px;
  background: #ffffff !important;
}
.tq-metric-value,
.metric-value {
  padding: 8px 0 8px 12px;
  color: #222;
  font-weight: 500;
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  min-height: 32px;
  width: 1%;
  background: #ffffff !important;
}

@media (max-width: 768px) {
  .tq-metrics,
  .translation-quality-metrics {
    padding: 14px;
  }
  .tq-metrics-title {
    font-size: 14px;
  }
  .tq-metric-name,
  .metric-label,
  .tq-metric-value,
  .metric-value {
    font-size: 12px;
    padding: 7px 0;
  }
}

@media (max-width: 480px) {
  .tq-metrics,
  .translation-quality-metrics {
    padding: 12px;
    border-radius: 3px;
  }
  .tq-metrics-head,
  .metrics-title {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }
  .tq-metrics-title {
    font-size: 13px;
  }
  .tq-metrics-info,
  .info-icon {
    width: 14px;
    height: 14px;
    font-size: 10px;
  }
  .tq-metric-name,
  .metric-label,
  .tq-metric-value,
  .metric-value {
    font-size: 12px;
    padding: 6px 0;
    min-height: 28px;
  }
}

/* SOAP comparison tab (case detail) */
.soap-cmp-panel {
  padding: 0;
  margin: -0.35rem -0.15rem 0;
}
.soap-cmp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  padding: 0.1rem 0 0.85rem;
}
.soap-cmp-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.soap-cmp-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #eef4ff;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}
.soap-cmp-filters {
  padding-left: 0;
  padding-right: 0;
}
.soap-cmp-clear {
  margin-left: 0.15rem;
  padding: 0.42rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.25;
}
.soap-cmp-clear:hover:not(:disabled) {
  border-color: #94a3b8;
  background: #f8fafc;
}
.soap-cmp-clear.is-disabled,
.soap-cmp-clear:disabled {
  opacity: 0.55;
  cursor: default;
}
.soap-cmp-count {
  margin: 0.15rem 0 0.75rem;
  font-size: 0.82rem;
  color: #64748b;
}
.soap-cmp-table-wrap {
  margin: 0;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.soap-cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 920px;
}
.soap-cmp-table th {
  padding: 0.7rem 0.85rem;
  text-align: left;
  font-weight: 700;
  color: #1e3a5f;
  background: #eef2ff;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  font-size: 0.82rem;
}
.soap-cmp-table td {
  padding: 0.75rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #edf2f7;
  color: #0f172a;
  line-height: 1.45;
}
.soap-cmp-table tbody tr:last-child td {
  border-bottom: none;
}
.soap-cmp-cat {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}
.soap-cmp-sub {
  color: #334155;
  white-space: nowrap;
}
.soap-cmp-row-correct td {
  background: #f0fdf4;
}
.soap-cmp-row-wrong td {
  background: #fff1f2;
}
.soap-cmp-row-missing td {
  background: #fffbeb;
}
.soap-cmp-row-invented td {
  background: #faf5ff;
}
.soap-cmp-row-partial td {
  background: #f0f9ff;
}
.soap-cmp-empty td {
  text-align: center;
  color: #64748b;
  padding: 1.35rem 0.85rem;
  background: #fff;
}
.soap-cmp-review {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem 0.2rem 0.3rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.84rem;
  white-space: nowrap;
  line-height: 1.2;
}
.soap-cmp-review-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 3px;
  background: #16a34a;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.soap-cmp-review-dot {
  width: 0.55rem;
  height: 0.55rem;
  margin: 0 0.2rem;
  border-radius: 50%;
  background: #94a3b8;
  flex-shrink: 0;
}
.soap-cmp-review-correct {
  background: #dcfce7;
  color: #15803d;
}
.soap-cmp-review-missing {
  background: #fef3c7;
  color: #a16207;
}
.soap-cmp-review-missing .soap-cmp-review-dot { background: #eab308; }
.soap-cmp-review-wrong {
  background: #fee2e2;
  color: #b91c1c;
}
.soap-cmp-review-wrong .soap-cmp-review-dot { background: #ef4444; }
.soap-cmp-review-partial {
  background: #e0f2fe;
  color: #0369a1;
}
.soap-cmp-review-partial .soap-cmp-review-dot { background: #0ea5e9; }
.soap-cmp-review-invented {
  background: #f3e8ff;
  color: #7e22ce;
}
.soap-cmp-review-invented .soap-cmp-review-dot { background: #a855f7; }
.soap-cmp-state {
  padding: 0.5rem 0;
  color: #64748b;
  font-size: 0.92rem;
}
.soap-cmp-state.is-error {
  color: #b91c1c;
}

@media (max-width: 768px) {
  .soap-cmp-title {
    font-size: 1.05rem;
  }
}
