* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f6f7fb;
  color: #1f2937;
}

[hidden] { display: none !important; }

body:not(.advanced-mode) .poc-only { display: none !important; }
body.advanced-mode .simple-only { display: none !important; }

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 360px);
  display: grid;
  gap: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.auth-card label {
  display: grid;
  gap: 6px;
}

.auth-card button {
  justify-self: start;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.top-titles { flex: 1; min-width: 0; }
.top-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }

.session-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.session-summary > span:first-child {
  color: #475569;
  font-size: 13px;
}

.advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #475569;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  user-select: none;
}
.advanced-toggle input { margin: 0; }

body.advanced-mode .advanced-toggle {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
}

.recording-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.recording-stage::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.recording-stage.wait {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}
.recording-stage.wait::before {
  background: #f59e0b;
  animation: pulse 1.2s ease-in-out infinite;
}
.recording-stage.act {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}
.recording-stage.done {
  background: #e0e7ff;
  border-color: #c7d2fe;
  color: #3730a3;
}
.recording-stage.err {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}
.recording-stage.idle {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.recording-hint {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.upload-progress {
  margin-top: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  max-width: 480px;
}
.upload-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #475569;
  margin-bottom: 6px;
}
.upload-progress-header strong { color: #1e293b; }
.upload-progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.15s linear;
}
.upload-progress.indeterminate .upload-progress-bar {
  width: 30%;
  animation: upload-slide 1.2s ease-in-out infinite;
}
.upload-progress.done .upload-progress-bar {
  background: #16a34a;
}
.upload-progress.error .upload-progress-bar {
  background: #dc2626;
}

button.danger {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}
button.danger:hover:not(:disabled) {
  background: #fecaca;
  border-color: #f87171;
}

.status-card-hint {
  margin: 0 0 12px;
  color: #475569;
  font-size: 13px;
}
.simple-actions {
  margin-top: 12px;
}
body:not(.advanced-mode) .simple-actions {
  display: none;
}
body:not(.advanced-mode) #experiment-run-panel .experiment-stages {
  padding: 14px 16px;
  background: #f1f5f9;
  border-radius: 8px;
  margin: 8px 0 0;
}
body:not(.advanced-mode) #experiment-run-panel .experiment-stages:empty {
  display: none;
}

@keyframes upload-slide {
  0% { margin-left: -30%; }
  100% { margin-left: 100%; }
}

.page {
  width: min(100% - 24px, 1760px);
  margin: 12px auto;
  padding: 0 0 32px;
}

.top,
.page > .card:not(.primary-slicing):not(.slicing-poc):not(.legacy-fragments):not(.validation-batches) {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.top { margin-bottom: 16px; }
h1 { margin: 0 0 6px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.section-header h2 { margin: 0; }

.status-pill {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.section-intro {
  margin: 0 0 12px;
  color: #475569;
  font-size: 14px;
  line-height: 1.45;
}

.row, .grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.grid label,
.row label {
  display: grid;
  gap: 6px;
  min-width: 200px;
}

input, select, button, textarea {
  font: inherit;
}

input, select { padding: 8px; border: 1px solid #cbd5e1; border-radius: 6px; }
button { padding: 8px 12px; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

input[type="range"] {
  min-width: 180px;
}

.inline-feedback {
  display: inline-block;
  min-height: 1.2em;
  font-size: 13px;
  line-height: 1.2;
  margin-left: 4px;
  color: #334155;
}

.inline-feedback.ok { color: #166534; }
.inline-feedback.err { color: #b91c1c; }
.inline-feedback.warn { color: #92400e; }

.live-services-scope {
  margin: -2px 0 12px;
  color: #475569;
  font-size: 13px;
  line-height: 1.4;
}

.live-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  align-items: end;
}

.live-services-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.live-services-grid .compact-check {
  align-self: center;
  display: flex;
  min-height: 38px;
}

.live-services-readonly {
  display: grid;
  gap: 6px;
  min-height: 38px;
  align-content: center;
  color: #475569;
  font-size: 13px;
}

.live-services-readonly strong {
  color: #1f2937;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.live-services-actions {
  margin-top: 10px;
}

.primary-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
}

.primary-settings {
  display: grid;
  gap: 12px;
}

.primary-grid label {
  min-width: 148px;
}

.primary-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
}

.primary-rules > label:not(.compact-check) {
  display: grid;
  gap: 6px;
  min-width: 160px;
}

.processing-preview {
  border-left: 3px solid #0f766e;
  background: #f8fafc;
  padding: 10px 12px;
}

.processing-preview h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.processing-preview ol {
  margin: 0;
  padding-left: 20px;
}

.processing-preview li {
  margin: 0 0 8px;
  color: #334155;
  font-size: 13px;
  line-height: 1.4;
}

.primary-actions {
  margin-top: 12px;
}

.primary-action {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.primary-action:disabled {
  background: #94a3b8;
  border-color: #94a3b8;
}

body:not(.advanced-mode) .primary-slicing {
  border-color: #bbf7d0;
  background: #f8fffb;
}

body:not(.advanced-mode) .primary-slicing .section-intro {
  margin-bottom: 12px;
}

body:not(.advanced-mode) .primary-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #ffffff;
}

body:not(.advanced-mode) .primary-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

body:not(.advanced-mode) .primary-grid label {
  min-width: 0;
}

body:not(.advanced-mode) .primary-rules {
  gap: 8px 12px;
  border-top-color: #d1fae5;
}

body:not(.advanced-mode) .processing-preview {
  border-left-color: #2563eb;
  background: #eff6ff;
}

body:not(.advanced-mode) .primary-actions {
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
}

body:not(.advanced-mode) #action-slice:not(:disabled),
body:not(.advanced-mode) #exp-open-review:not(:disabled),
body:not(.advanced-mode) #slice-export-clips:not(:disabled),
body:not(.advanced-mode) #simple-export-clips:not(:disabled),
body:not(.advanced-mode) #action-submit:not(:disabled) {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

body:not(.advanced-mode) #exp-open-review:not(:disabled),
body:not(.advanced-mode) #slice-export-clips:not(:disabled),
body:not(.advanced-mode) #simple-export-clips:not(:disabled) {
  border-color: #1d4ed8;
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.simple-results-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(320px, 1.28fr);
  gap: 12px;
  margin: 10px 0 12px;
}

.simple-export-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.simple-export-panel h3 {
  margin: 0 0 3px;
  font-size: 16px;
  color: #1e3a8a;
}

.simple-export-panel p {
  margin: 0;
  color: #334155;
  font-size: 13px;
}

.simple-export-panel button {
  min-width: 150px;
}

.simple-submissions-panel {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fafc;
}

.simple-submissions-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.simple-submissions-panel h3 {
  margin: 0 0 3px;
  font-size: 16px;
  color: #1e293b;
}

.simple-submissions-panel p {
  margin: 0;
  color: #475569;
  font-size: 13px;
}

.simple-submissions-panel button {
  padding: 6px 10px;
}

.simple-submissions-table {
  margin: 0;
}

.simple-submissions-table th,
.simple-submissions-table td {
  font-size: 13px;
}

.submission-file-missing {
  color: #b45309;
  font-weight: 600;
}

@media (max-width: 900px) {
  .simple-results-panel {
    grid-template-columns: 1fr;
  }
}

.selected-recording-meta {
  margin-top: 8px;
  color: #334155;
  font-size: 14px;
}

/* Experiment run panel */
.experiment-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.exp-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  min-width: 96px;
  background: #f8fafc;
  font-size: 12px;
}

.exp-stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}

.exp-stage-label {
  font-weight: 500;
  color: #475569;
  text-align: center;
}

.exp-stage-status {
  color: #94a3b8;
  font-size: 11px;
}

.exp-stage.ok { border-color: #bbf7d0; background: #f0fdf4; }
.exp-stage.ok .exp-stage-dot { background: #22c55e; }
.exp-stage.ok .exp-stage-label { color: #15803d; }
.exp-stage.ok .exp-stage-status { color: #16a34a; }

.exp-stage.pending { border-color: #fde68a; background: #fffbeb; }
.exp-stage.pending .exp-stage-dot { background: #f59e0b; animation: exp-pulse 1.2s ease-in-out infinite; }
.exp-stage.pending .exp-stage-label { color: #92400e; }
.exp-stage.pending .exp-stage-status { color: #b45309; }

.exp-stage.failed { border-color: #fecaca; background: #fef2f2; }
.exp-stage.failed .exp-stage-dot { background: #ef4444; }
.exp-stage.failed .exp-stage-label { color: #b91c1c; }
.exp-stage.failed .exp-stage-status { color: #dc2626; }

@keyframes exp-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.experiment-actions {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.phase-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
}

.experiment-runbook {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.experiment-runbook code {
  display: block;
  margin: 6px 0;
  padding: 6px 10px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 4px;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

.qwen-progress-panel {
  display: grid;
  gap: 8px;
}

.qwen-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.qwen-progress-head span,
.qwen-progress-batch {
  color: #475569;
  font-size: 12px;
}

.qwen-progress-batch {
  overflow-wrap: anywhere;
}

.qwen-window-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px;
}

.qwen-window {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
}

.qwen-window-index {
  font-weight: 700;
  color: #334155;
}

.qwen-window-range {
  color: #475569;
  font-size: 12px;
}

.qwen-window-status {
  color: #64748b;
  font-size: 12px;
}

.qwen-window-timer {
  grid-column: 1 / -1;
  color: #92400e;
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 12px;
}

.qwen-window.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.qwen-window.done .qwen-window-timer,
.qwen-window.done .qwen-window-status {
  color: #15803d;
}

.qwen-window.split {
  border-color: #fed7aa;
  background: #fff7ed;
}

.qwen-window.split .qwen-window-timer,
.qwen-window.split .qwen-window-status {
  color: #c2410c;
}

.qwen-window.failed {
  border-color: #fecaca;
  background: #fef2f2;
}

.qwen-window.failed .qwen-window-timer,
.qwen-window.failed .qwen-window-status {
  color: #b91c1c;
}

.waveform-progress {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.waveform-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #1e3a8a;
  font-size: 13px;
}

.waveform-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.waveform-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
  transition: width 160ms ease;
}

.waveform-progress.indeterminate .waveform-progress-bar {
  width: 36%;
  animation: waveform-progress-slide 1.1s ease-in-out infinite;
}

@keyframes waveform-progress-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(300%); }
}

.slice-mode-label {
  font-size: 12px;
  color: #64748b;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  white-space: nowrap;
}

.slice-mode-label.has-candidates { color: #15803d; background: #f0fdf4; }

.waveform {
  min-height: 190px;
  margin-top: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  background: #fbfdff;
  overflow: hidden;
}

.timeline {
  min-height: 24px;
}

.artifact-panel {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.artifact-header {
  margin-bottom: 6px;
  cursor: pointer;
  list-style: none;
}

.artifact-header::-webkit-details-marker {
  display: none;
}

.artifact-header::before {
  content: ">";
  color: #64748b;
  font-size: 13px;
}

.artifact-panel[open] .artifact-header::before {
  content: "v";
}

.artifact-title {
  font-size: 16px;
  font-weight: 650;
  margin-right: auto;
}

.artifact-actions {
  margin-bottom: 8px;
}

.artifact-summary,
.artifact-detail {
  font-size: 13px;
  color: #334155;
}

.artifact-summary table,
.artifact-detail table {
  margin-top: 6px;
}

.artifact-summary th,
.artifact-summary td,
.artifact-detail th,
.artifact-detail td {
  font-size: 13px;
  vertical-align: top;
}

.artifact-summary button {
  padding: 5px 8px;
}

.artifact-fallback-note {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fffbeb;
  color: #78350f;
  line-height: 1.35;
}

.artifact-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 6px;
}

.artifact-detail-section {
  margin-top: 8px;
}

.artifact-detail-section h4 {
  margin: 0 0 4px;
  font-size: 14px;
  color: #1f2937;
}

.artifact-evidence {
  max-width: 300px;
  white-space: normal;
}

.region-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.region-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: auto;
  white-space: nowrap;
}

.compact-check input {
  margin: 0;
}

.region-table-wrap {
  max-height: min(70vh, 760px);
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-top: 8px;
}

.regions-table {
  table-layout: fixed;
  width: 100%;
  min-width: 1120px;
  margin-top: 0;
}

.regions-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
}

.regions-table th,
.regions-table td {
  vertical-align: top;
}

.regions-table th:first-child,
.regions-table td:first-child {
  width: 52px;
}

.regions-table th:nth-child(2),
.regions-table td:nth-child(2) {
  width: 230px;
}

.regions-table th:nth-child(3),
.regions-table td:nth-child(3) {
  width: 82px;
}

.regions-table th:nth-child(4),
.regions-table td:nth-child(4) {
  width: 96px;
}

.regions-table th:nth-child(5),
.regions-table td:nth-child(5) {
  width: 560px;
}

.regions-table th:last-child {
  width: 98px;
  text-align: right;
}

.region-review-row td {
  border-bottom: 0;
}

.region-review-row {
  cursor: pointer;
}

.region-review-row:focus-within {
  cursor: default;
}

.region-review-row.active-region-row {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 #2563eb;
}

.region-review-row.active-region-row + .region-detail-row td {
  background: #f8fbff;
}

.region-detail-row td {
  padding-top: 0;
  border-top: 0;
}

.region-ok { color: #166534; }
.region-warn { color: #92400e; }
.region-bad { color: #b91c1c; }

.region-index {
  font-weight: 700;
  color: #334155;
}

.region-timing {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 210px;
}

.region-timing label {
  display: grid;
  gap: 3px;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
}

.time-input {
  width: 92px;
  padding: 5px 6px;
  font-size: 13px;
}

.region-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.region-actions button {
  padding: 5px 8px;
}

.region-review-cell {
  min-width: 0;
}

.review-status-control,
.inline-transcript-correction,
.operator-review-form label {
  display: grid;
  gap: 4px;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
}

.review-status-control select,
.operator-review-form select {
  width: 100%;
  padding: 5px 6px;
  font-size: 13px;
  text-transform: none;
}

.inline-transcript-correction {
  margin-top: 6px;
}

.inline-transcript-correction textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px;
  color: #1f2937;
  font-size: 12px;
  line-height: 1.35;
  text-transform: none;
}

.operator-review-form {
  display: grid;
  gap: 7px;
}

.operator-review-form textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 7px;
  color: #1f2937;
  font-size: 13px;
  line-height: 1.35;
  text-transform: none;
}

.region-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.region-chip-row {
  margin-bottom: 5px;
}

.region-chip-row .feedback-chip {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evidence-summary,
.review-summary {
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.edge-silence-summary.warn {
  color: #92400e;
  font-weight: 600;
}

.review-summary {
  margin-top: 6px;
}

.review-details {
  margin: 0 0 8px 52px;
  border-left: 3px solid #cbd5e1;
  padding-left: 10px;
}

.review-details summary {
  cursor: pointer;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.region-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.review-panel {
  min-width: 0;
}

.review-panel h4 {
  margin: 0 0 4px;
  color: #1f2937;
  font-size: 13px;
}

.review-panel p,
.review-panel li {
  color: #334155;
  font-size: 13px;
  line-height: 1.4;
}

.review-panel p {
  margin: 0 0 6px;
}

.review-panel ul {
  margin: 0;
  padding-left: 18px;
}

.evidence-line {
  margin-bottom: 8px;
}

.evidence-line:last-child {
  margin-bottom: 0;
}

.evidence-label {
  color: #64748b;
  font-size: 12px;
}

.operator-note {
  color: #64748b;
  font-size: 12px;
  margin-top: 5px;
}

.region-overlap {
  background: #fef2f2;
}

.legacy-fragments {
  padding: 0;
}

.legacy-fragments-panel {
  padding: 12px;
}

.legacy-fragments-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-size: 20px;
  font-weight: 650;
}

.legacy-fragments-panel > .row {
  margin-top: 12px;
}

.manifest-output {
  width: 100%;
  min-height: 130px;
  margin-top: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.artifact-actions-cell,
.artifact-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.artifact-actions-cell button,
.artifact-detail-actions button {
  padding: 5px 8px;
  font-size: 13px;
}

.artifact-detail-actions {
  margin: 8px 0;
}

.validation-batches .status-pill {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.validation-batch-form label {
  min-width: 160px;
}

.validation-batch-form label:last-child {
  flex: 1 1 300px;
}

.validation-statuses {
  margin-top: 10px;
}

.validation-table-wrap {
  overflow: auto;
}

.validation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.validation-actions button {
  padding: 5px 8px;
  font-size: 13px;
}

.validation-feedback-cell {
  min-width: 180px;
}

.validation-feedback-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.feedback-chip {
  display: inline-block;
  border: 1px solid #dbe3ef;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.validation-feedback-panel {
  margin-top: 10px;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
}

.validation-feedback-header {
  margin-bottom: 6px;
}

.validation-feedback-header h3 {
  margin: 0;
  font-size: 16px;
}

.validation-feedback-summary,
.validation-feedback-items {
  font-size: 13px;
  color: #334155;
}

.validation-feedback-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.validation-feedback-item {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px;
  margin-top: 6px;
  background: #fbfdff;
}

.validation-feedback-item strong {
  color: #1f2937;
}

.validation-feedback-item p {
  margin: 4px 0 0;
}

.validation-feedback-form {
  align-items: stretch;
  margin-top: 10px;
}

.validation-feedback-form label {
  min-width: 150px;
}

.validation-feedback-form textarea {
  min-height: 58px;
}

.validation-feedback-action,
.validation-feedback-notes {
  flex: 1 1 260px;
}

.validation-feedback-form button {
  align-self: end;
}

.validation-json-box {
  margin-top: 10px;
}

.validation-json-box summary {
  cursor: pointer;
  color: #334155;
  font-size: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
th, td {
  text-align: left;
  border-top: 1px solid #e5e7eb;
  padding: 8px;
  font-size: 14px;
}

.fragment {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px;
  margin: 10px 0;
}

.fragment h3 { margin: 0 0 8px; }
.fragment textarea {
  width: 100%;
  min-height: 70px;
}

.review-field {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.review-grid label {
  display: grid;
  gap: 6px;
}

.review-grid textarea {
  min-height: 54px;
}

.review-grid-wide {
  grid-template-columns: 2fr 1fr 2fr;
}

@media (max-width: 760px) {
  .page {
    width: min(100% - 16px, 1760px);
    margin-top: 8px;
  }

  .primary-layout {
    grid-template-columns: 1fr;
  }

  .region-review-grid {
    grid-template-columns: 1fr;
  }

  .review-details {
    margin-left: 0;
  }

  .region-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-grid-wide {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1280px) {
  .region-review-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr) minmax(240px, 0.9fr) minmax(240px, 0.9fr);
  }

  .region-table-wrap {
    max-height: min(72vh, 820px);
  }
}

.fragment-history {
  margin-top: 8px;
}

.history-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.history-list li {
  margin-bottom: 8px;
}
