/* ===========================
   Oblex - Task Pane Styles (Platform-aligned)
   =========================== */

:root {
  --oblex-900: #172d32;
  --oblex-800: #1c393c;
  --oblex-700: #1f5152;
  --oblex-600: #25706c;
  --oblex-500: #2c8b7f;
  --oblex-100: #e6f1f0;

  --bg: #f4f6f7;
  --surface: #ffffff;
  --border: #e2e8f0;
  --muted: #6b7280;
  --text: #0f172a;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Geist", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: radial-gradient(circle at top, #f8fafc 0%, #f4f6f7 60%, #eef2f4 100%);
}

#root {
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.task-pane {
  min-height: 100%;
  padding: 16px;
}

.task-pane__workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.task-pane--review-open .task-pane__workspace {
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
}

.task-pane__inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #eef2f7;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff 0%, #f6fbfa 100%);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.brand__mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.brand__mark img {
  width: 28px;
  height: 28px;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand__meta {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 700;
  margin-bottom: 2px;
}

.brand__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand__subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.brand__mark {
  text-decoration: none;
}

.banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.banner--error {
  background: #fee2e2;
  border-color: #fecaca;
  color: #991b1b;
}

.banner--success {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.banner__dismiss {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: inherit;
}

.banner__details {
  margin: 0;
  white-space: pre-wrap;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  color: inherit;
}

.panel {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.panel__header h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.panel__header p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.panel__body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel--action .panel__body {
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 14px;
  transition: all 0.2s ease;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn--primary {
  background: var(--oblex-700);
  color: white;
  border-color: var(--oblex-700);
  box-shadow: 0 8px 16px rgba(37, 112, 108, 0.2);
}

.btn--primary:hover:not(:disabled) {
  background: var(--oblex-600);
  border-color: var(--oblex-600);
}

.btn--secondary {
  background: white;
  color: var(--oblex-700);
  border-color: var(--border);
}

.btn--secondary:hover:not(:disabled) {
  background: #f8fafc;
}

.btn--ghost {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: var(--text);
  width: 100%;
}

.range-selector {
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed #d0d7de;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.range-selector--question {
  border-color: #f1b6b6;
  background: #fff5f5;
}

.range-selector--answer {
  border-color: #a7e3bf;
  background: #f0fdf4;
}

.range-selector__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.range-selector__selected {
  font-size: 12px;
  color: var(--oblex-700);
  font-weight: 600;
}

.range-selector--question .range-selector__selected {
  color: #b91c1c;
}

.range-selector--answer .range-selector__selected {
  color: #15803d;
}

.range-selector__selected span {
  font-family: "Menlo", "Consolas", monospace;
  color: var(--oblex-800);
}

.document-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.document-list .btn--secondary {
  width: 100%;
}

.document-list__items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}

.document-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f9fafb;
  transition: all 0.2s ease;
}

.document-item:hover {
  border-color: #cbd5e1;
  background: #f3f6f7;
}

.document-item--selected {
  border-color: var(--oblex-600);
  background: var(--oblex-100);
}

.document-item__check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.document-item__check input {
  display: none;
}

.document-item__check span {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
  position: relative;
}

.document-item__check input:checked + span {
  border-color: var(--oblex-600);
  background: var(--oblex-600);
}

.document-item__check input:checked + span::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: white;
  border-radius: 2px;
}

.document-item__info {
  flex: 1;
  min-width: 0;
}

.document-item__name {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-item__meta {
  font-size: 11px;
  color: var(--muted);
}

.icon-button {
  border: none;
  background: none;
  color: #b42318;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.selection-note {
  font-size: 12px;
  font-weight: 600;
  color: var(--oblex-700);
}

.spinner {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.spinner__ring {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid #d1d5db;
  border-top-color: var(--oblex-600);
  animation: spin 1s linear infinite;
}

.spinner__label {
  font-weight: 600;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.analysis-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analysis-results__block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analysis-results__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.analysis-results__content {
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.analysis-results__confidence {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.analysis-results__note {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.evidence-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
  color: #111827;
}

.evidence-panel--empty {
  color: var(--muted);
}

.evidence-panel__title {
  font-weight: 700;
  font-size: 14px;
}

.evidence-panel__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #374151;
}

.evidence-panel__block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evidence-panel__label {
  font-weight: 600;
  font-size: 12px;
  color: #374151;
}

.evidence-panel__content {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #111827;
  white-space: pre-wrap;
}

.evidence-panel__citations {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.evidence-panel__citation-doc {
  font-weight: 600;
  color: #111827;
  font-size: 12px;
}

.evidence-panel__citation-quote {
  font-size: 12px;
  color: #1f2937;
  margin-top: 4px;
}

.evidence-panel__citation-page {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.empty-state {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed #d1d5db;
  background: #f8fafc;
  text-align: center;
}

.empty-state__text {
  font-size: 12px;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

@media (max-width: 360px) {
  .task-pane {
    padding: 12px;
  }

  .brand {
    padding: 10px 12px;
  }
}

/* ===========================
   Lattice Testing – New Styles
   =========================== */

/* ── Scope bar ── */
.scope-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f0f9f8;
  border: 1px solid #c6e8e5;
  border-radius: 10px;
  gap: 8px;
}

.scope-bar__sheet {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--oblex-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scope-bar__badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--oblex-600);
  white-space: nowrap;
  background: #d4f0ec;
  border-radius: 6px;
  padding: 2px 6px;
}

/* ── Warning banner ── */
.banner--warning {
  background: #fef9c3;
  border-color: #fde047;
  color: #854d0e;
}

/* ── Button utilities ── */
.btn--full { width: 100%; }

.btn--link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
}
.btn--link:hover { color: var(--oblex-700); }

.btn--sm { height: 28px; font-size: 12px; padding: 0 10px; }

/* ── Idle safety note ── */
.idle-safety-note {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border);
  line-height: 1.5;
}

/* ── Secondary actions ── */
.secondary-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.secondary-actions .btn { flex: 1; min-width: 100px; }

/* ── Summary cards ── */
.summary-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.summary-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  text-align: center;
}

.summary-card--warn {
  border-color: #fde047;
  background: #fefce8;
}

.summary-card__value {
  font-size: 22px;
  font-weight: 800;
  color: var(--oblex-700);
  line-height: 1;
}

.summary-card--warn .summary-card__value { color: #b45309; }

.summary-card__label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 4px;
  text-align: center;
}

/* ── Run progress ── */
.run-progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.run-progress__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.run-progress__status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot--running {
  background: var(--oblex-500);
  animation: pulse 1.4s ease-in-out infinite;
}

.status-dot--paused { background: #94a3b8; }

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

.run-progress__count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.run-progress__bar-wrap {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.run-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--oblex-600), var(--oblex-500));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.run-progress__pct {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.run-progress__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.run-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.run-stat--inline {
  background: none;
  border: none;
  padding: 4px 6px;
}

.run-stat__value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.run-stat__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-top: 3px;
  text-align: center;
}

.run-progress__actions {
  display: flex;
  gap: 8px;
}

.cell-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.cell-progress-grid__cell {
  min-height: 28px;
  border: 1px solid;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 800;
}

.run-summary-stats {
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  margin-bottom: 4px;
}

.complete-instruction {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* ── Status badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Cell detail panel ── */
.cell-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cell-detail__main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.cell-detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.cell-detail__address {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cell-address-badge {
  font-family: "Menlo", "Consolas", monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--oblex-800);
  background: var(--oblex-100);
  padding: 2px 7px;
  border-radius: 6px;
  display: inline-block;
}

.cell-detail__sample {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.cell-detail__check {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.cell-detail__answer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.cell-detail__answer {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.cell-detail__conf {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.cell-detail__block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cell-detail__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0;
}

.cell-detail__text {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  margin: 0;
}

.cell-detail__comparison {
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.comparison-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
}

.comparison-row span {
  color: var(--muted);
  font-weight: 700;
}

.comparison-row strong {
  color: var(--text);
  word-break: break-word;
}

.cell-detail__trace-toggle {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  text-align: left;
}
.cell-detail__trace-toggle:hover { color: var(--text); }

.cell-detail__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Evidence list ── */
.evidence-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.evidence-item {
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.evidence-item__source {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.evidence-item__file {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evidence-item__page {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

.evidence-item__quote {
  margin: 0;
  font-size: 12px;
  color: var(--oblex-800);
  font-style: italic;
  line-height: 1.5;
  padding-left: 10px;
  border-left: 3px solid var(--oblex-500);
}

.evidence-item__view-pdf {
  margin-left: auto;
  flex-shrink: 0;
  width: auto;
  height: 24px;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
}

.evidence-review {
  position: sticky;
  top: 12px;
  height: calc(100vh - 32px);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.evidence-review__header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.evidence-review__title-group {
  min-width: 0;
}

.evidence-review__close {
  width: auto;
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  flex-shrink: 0;
}

.evidence-review__title-group h3 {
  margin: 2px 0 2px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  word-break: break-word;
}

.evidence-review__title-group p:last-child {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.evidence-review__quote {
  margin: 0 14px;
  padding: 9px 12px;
  background: #fef9c3;
  border-left: 3px solid #eab308;
  border-radius: 6px;
  color: #713f12;
  font-size: 12px;
  line-height: 1.5;
}

.evidence-review__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
}

.evidence-review__toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.evidence-review__toolbar .btn {
  width: auto;
  min-height: 26px;
  height: 26px;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 999px;
}

.evidence-review__pdf {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 14px;
  background: #e5e7eb;
}

.evidence-review__pdf .react-pdf__Page {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.evidence-review__pdf mark {
  background: rgba(250, 204, 21, 0.55);
  border-radius: 2px;
}

.evidence-review__fallback {
  margin: 0 14px 14px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .task-pane--review-open .task-pane__workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .evidence-review {
    position: static;
    height: 72vh;
    min-height: 420px;
  }
}

.evidence-preview {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.evidence-preview__doc {
  border-bottom: 1px solid var(--border);
}

.evidence-preview__doc:last-child { border-bottom: none; }

.evidence-preview__title {
  margin: 0;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.evidence-preview__body {
  margin: 0;
  padding: 10px;
  white-space: pre-wrap;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text);
}

.evidence-preview__highlight {
  background: #fef08a;
  color: #713f12;
  border-radius: 3px;
  padding: 1px 2px;
}

/* ── Agent trace ── */
.agent-trace {
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-trace__row {
  display: flex;
  gap: 8px;
  font-size: 12px;
}

.agent-trace__key {
  font-weight: 700;
  color: var(--muted);
  width: 72px;
  flex-shrink: 0;
}

.agent-trace__val {
  color: var(--text);
  word-break: break-all;
}

.agent-trace__steps { display: flex; flex-direction: column; gap: 4px; }

.agent-trace__steps-list {
  margin: 4px 0 0 14px;
  padding: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text);
}

/* ── Override input ── */
.override-input {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.override-input__field {
  flex: 1;
  min-width: 100px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
  background: white;
}
.override-input__field:focus { border-color: var(--oblex-500); }

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: stretch;
}

.modal {
  background: white;
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.modal__header {
  padding: 14px 16px 0;
  border-bottom: 1px solid var(--border);
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal__close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}
.modal__close:hover { color: var(--text); }

.modal__body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

/* ── Step indicator ── */
.step-indicator {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 12px;
}

.step-indicator__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 56px;
  position: relative;
  gap: 4px;
}

.step-indicator__item::after {
  content: '';
  position: absolute;
  top: 13px;
  left: calc(50% + 13px);
  right: calc(-50% + 13px);
  height: 1px;
  background: var(--border);
}

.step-indicator__item:last-child::after { display: none; }

.step-indicator__num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  z-index: 1;
}

.step-indicator__item--active .step-indicator__num {
  border-color: var(--oblex-600);
  background: var(--oblex-600);
  color: white;
}

.step-indicator__item--done .step-indicator__num {
  border-color: #16a34a;
  background: #16a34a;
  color: white;
}

.step-indicator__item--done::after { background: #16a34a; }

.step-indicator__label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}

.step-indicator__item--active .step-indicator__label { color: var(--oblex-700); }

/* ── Step body (shared step container) ── */
.step-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.step-note {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.step-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-callout {
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.step-callout--success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.step-callout--warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.step-callout__title {
  font-size: 12.5px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}

.step-callout__body {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.step-safety-note {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 12px;
  background: #f0f9f8;
  border-radius: 10px;
  border: 1px solid #c6e8e5;
  line-height: 1.5;
}

/* ── Scan summary ── */
.scan-summary {
  padding: 12px;
  background: #f0f9f8;
  border: 1px solid #c6e8e5;
  border-radius: 10px;
}

.scan-summary__title {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}

.scan-summary__list {
  margin: 0;
  padding: 0 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.scan-summary__list li {
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}

/* ── Column mapping table ── */
.column-map-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: 12px;
}

.column-map-table__head {
  display: grid;
  grid-template-columns: 28px 1fr 112px 42px;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  background: #f1f5f9;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.column-map-table__body {
  max-height: 280px;
  overflow-y: auto;
}

.column-map-row {
  display: grid;
  grid-template-columns: 28px 1fr 112px 42px;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
}

.column-map-row:hover { background: #f8fafc; }

.column-map-row__letter {
  font-family: "Menlo", "Consolas", monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--oblex-700);
}

.column-map-row__header {
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.column-map-row__select {
  font-size: 11px;
  padding: 3px 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  outline: none;
  width: 100%;
}

.column-map-row__select:focus { border-color: var(--oblex-500); }

.column-map-row__conf {
  font-size: 10.5px;
  font-weight: 700;
  text-align: right;
}

.muted { color: var(--muted); }

/* ── Understand Workpaper ── */
.step-body--wide {
  gap: 14px;
}

.workpaper-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.workpaper-section h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.workpaper-summary {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.status-grid div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e8eef4;
  border-radius: 8px;
  background: #f8fafc;
}

.status-grid span {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-grid strong {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.setup-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 11px;
}

.setup-table__head,
.setup-table__row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
}

.setup-table__head {
  background: #f1f5f9;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.setup-table__row {
  border-top: 1px solid var(--border);
}

.setup-table--sample .setup-table__head,
.setup-table--sample .setup-table__row {
  grid-template-columns: 70px minmax(120px, 1fr) 100px 90px 60px 70px;
}

.setup-table--protected .setup-table__head,
.setup-table--protected .setup-table__row {
  grid-template-columns: 80px minmax(120px, 1fr) 2fr;
}

.lattice-map-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 11px;
}

.lattice-map-table__head,
.lattice-map-row {
  display: grid;
  grid-template-columns: 34px 38px minmax(120px, 1fr) 112px 52px 46px 110px 130px 120px 52px;
  gap: 7px;
  align-items: center;
  min-width: 980px;
  padding: 7px 9px;
}

.lattice-map-table__head {
  background: #f1f5f9;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lattice-map-row {
  border-top: 1px solid var(--border);
}

.lattice-map-row input,
.lattice-map-row select,
.lattice-map-row textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  background: white;
}

.lattice-map-row__instruction {
  grid-column: 3 / -1;
  min-height: 48px;
  resize: vertical;
}

.compact-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.compact-check input {
  display: none;
}

.compact-check span {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid #cbd5e1;
  background: white;
}

.compact-check input:checked + span {
  background: var(--oblex-600);
  border-color: var(--oblex-600);
}

.compact-check input:checked + span::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 4px;
  border-radius: 2px;
  background: white;
}

.mono {
  font-family: "Menlo", "Consolas", monospace;
  font-weight: 700;
  color: var(--oblex-700);
}

.warning-list {
  margin: 0;
  padding-left: 18px;
  color: #92400e;
  font-size: 12px;
  line-height: 1.5;
}

.workpaper-visual-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.workpaper-visual-summary h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
}

.workpaper-visual-summary p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.workpaper-warning-strip {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}

.workpaper-review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 12px;
  min-height: 430px;
}

.spreadsheet-preview-panel,
.lattice-column-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.spreadsheet-preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.spreadsheet-preview-panel__header,
.lattice-column-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  font-size: 12px;
  font-weight: 800;
}

.spreadsheet-preview-panel__header span:last-child,
.lattice-column-panel__header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.lattice-column-panel__header h3 {
  margin: 0;
  font-size: 12px;
}

.spreadsheet-scroll-viewport {
  flex: 1;
  min-height: 0;
  max-height: 450px;
  overflow: auto;
  padding: 10px;
}

.spreadsheet-grid {
  display: grid;
  grid-template-columns: 42px repeat(var(--preview-columns, 18), minmax(86px, max-content));
  grid-template-rows: 28px repeat(var(--preview-rows, 20), minmax(30px, auto));
  grid-auto-rows: minmax(30px, auto);
  align-items: stretch;
  width: max-content;
  min-width: max(100%, calc(42px + var(--preview-columns, 18) * 86px));
}

.spreadsheet-grid__corner,
.spreadsheet-grid__col-header,
.spreadsheet-grid__row-header,
.spreadsheet-cell {
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.spreadsheet-grid__corner,
.spreadsheet-grid__col-header,
.spreadsheet-grid__row-header {
  position: sticky;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  background: #eef2f7;
  color: #475569;
  font-size: 10.5px;
  font-weight: 800;
}

.spreadsheet-grid__corner {
  grid-column: 1;
  grid-row: 1;
  left: 0;
  top: 0;
  z-index: 4;
}

.spreadsheet-grid__col-header {
  top: 0;
}

.spreadsheet-grid__row-header {
  left: 0;
  z-index: 3;
}

.spreadsheet-cell {
  min-width: 86px;
  max-width: 180px;
  min-height: 30px;
  padding: 6px 8px;
  background: white;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  line-height: 1.35;
}

.spreadsheet-cell--header {
  background: #f8fafc;
  font-weight: 700;
}

.spreadsheet-cell--formula {
  background: #fefce8;
}

.spreadsheet-cell--lattice {
  box-shadow: inset 0 0 0 1px #bae6fd;
}

.spreadsheet-cell--selected {
  position: relative;
  z-index: 1;
  background: #e0f2fe;
  box-shadow: inset 0 0 0 2px #0284c7;
}

.lattice-column-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.lattice-column-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  overflow-y: auto;
  min-height: 0;
  max-height: 300px;
}

.lattice-column-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.lattice-column-item--active {
  border-color: #0284c7;
  background: #f0f9ff;
}

.lattice-column-item__top {
  display: grid;
  grid-template-columns: 22px 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.lattice-column-item__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 750;
}

.lattice-column-item__kind {
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2f7;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  text-transform: capitalize;
  white-space: nowrap;
}

.lattice-column-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 10px 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.lattice-column-details__heading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.lattice-column-details__heading strong {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.lattice-column-details dl {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
}

.lattice-column-details dl div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
}

.lattice-column-details dt,
.lattice-column-details__field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lattice-column-details dd {
  margin: 0;
  min-width: 0;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.35;
}

.lattice-column-details__field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 7px;
  background: white;
  color: var(--text);
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0;
}

.lattice-column-item--disabled {
  opacity: 0.72;
}

/* ── GL Choice Cards (Step 2) ── */
.gl-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 4px 0 8px;
}

.gl-choice__card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.gl-choice__card:hover {
  border-color: #94a3b8;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.07);
}

.gl-choice__icon {
  font-size: 22px;
  line-height: 1;
}

.gl-choice__card h3 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.gl-choice__card p {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

/* ── File-as-sample list (Step 3, no-GL mode) ── */
.file-sample-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0;
}

.file-sample-list__hint {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 2px;
}

.file-sample-row {
  display: grid;
  grid-template-columns: 14px 22px 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: background 0.1s, border-color 0.1s;
}

.file-sample-row--drag-over {
  border-color: #3b82f6;
  background: #eff6ff;
}

.file-sample-row--dragging {
  opacity: 0.35;
}

.file-sample-row__handle {
  color: #cbd5e1;
  cursor: grab;
  font-size: 13px;
  line-height: 1;
  user-select: none;
}

.file-sample-row__handle:active { cursor: grabbing; }

.file-sample-row__index {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.file-sample-row__name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ── GL Preview ── */
.gl-preview { display: flex; flex-direction: column; gap: 8px; min-height: 0; }

.gl-preview__summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.gl-preview__summary > div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fafc;
}

.gl-preview__metric {
  display: block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.gl-preview__metric-label {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--muted);
}

.gl-preview__mapping {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 58px;
  overflow-y: auto;
}

.gl-preview__pill {
  display: inline-flex;
  gap: 4px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  background: white;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.gl-preview__pill strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gl-preview__compact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 205px;
  overflow-y: auto;
}

.gl-preview__sample {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px;
  background: white;
}

.gl-preview__sample-index {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.gl-preview__sample-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 8px;
}

.gl-preview__field {
  min-width: 0;
}

.gl-preview__field span {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.2;
}

.gl-preview__field strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gl-preview__scroll {
  overflow-x: auto;
  max-height: 145px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.gl-preview__table {
  border-collapse: collapse;
  font-size: 11px;
  white-space: nowrap;
  min-width: 100%;
}

.gl-preview__table th,
.gl-preview__table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.gl-preview__table th {
  background: #f1f5f9;
  font-weight: 700;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
}

.gl-preview__table tr:last-child td { border-bottom: none; }

/* ── Drop zone ── */
.drop-zone {
  border: 2px dashed #d0d7de;
  border-radius: 14px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f8fafc;
}

.drop-zone:hover,
.drop-zone--active {
  border-color: var(--oblex-500);
  background: var(--oblex-100);
}

.drop-zone__icon { font-size: 22px; margin-bottom: 6px; }

.drop-zone__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}

.drop-zone__hint {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

/* ── Evidence files list ── */
.evidence-files { display: flex; flex-direction: column; gap: 8px; }

.evidence-files__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.evidence-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f9fafb;
  font-size: 12px;
}

.evidence-file-item__name {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.evidence-file-item__size { color: var(--muted); flex-shrink: 0; font-size: 11px; }

/* ── Evidence setup staged flow ── */
.evidence-setup { min-height: 0; }

.evidence-stage-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.evidence-stage-tabs__item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.evidence-stage-tabs__item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 10px;
}

.evidence-stage-tabs__item--active {
  border-color: var(--oblex-500);
  background: var(--oblex-100);
  color: var(--oblex-800);
}

.evidence-stage-tabs__item--active span {
  background: var(--oblex-600);
  color: white;
}

.evidence-stage-tabs__item:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.evidence-classification {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
}

.evidence-classification__header,
.match-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.match-toolbar__auto-match {
  min-width: 168px;
  min-height: 36px;
  padding-inline: 16px;
  flex-shrink: 0;
  font-weight: 800;
}

.evidence-doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.evidence-doc-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 26px;
  gap: 7px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: white;
}

.evidence-doc-card__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.evidence-doc-card__name {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-doc-card__meta,
.evidence-doc-card__empty {
  color: var(--muted);
  font-size: 10.5px;
}

.evidence-doc-card__select,
.evidence-detail-modal__select {
  width: 100%;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 7px;
  background: white;
  color: var(--text);
  font-size: 11px;
}

.evidence-doc-card__remove {
  grid-column: 3;
  grid-row: 1;
}

.empty-panel {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.unmatched-docs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.unmatched-docs__label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.unmatched-docs__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 26px;
}

.unmatched-doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 260px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  background: white;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
}

.unmatched-doc-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unmatched-doc-chip small {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 10px;
}

.match-grid {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.match-grid__header,
.match-grid__row {
  display: grid;
  grid-template-columns: 34px minmax(135px, 0.8fr) minmax(0, 1.2fr);
  gap: 8px;
}

.match-grid__header {
  border-bottom: 1px solid var(--border);
  padding: 7px 9px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.match-grid__body {
  max-height: 285px;
  overflow-y: auto;
}

.match-grid__row {
  align-items: start;
  border-bottom: 1px solid var(--border);
  padding: 8px 9px;
}

.match-grid__row:last-child { border-bottom: 0; }

.match-grid__index {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.match-grid__sample {
  min-width: 0;
}

.match-grid__sample strong,
.match-grid__sample span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.match-grid__sample strong {
  color: var(--text);
  font-size: 12px;
}

.match-grid__sample span,
.match-grid__empty {
  color: var(--muted);
  font-size: 10.5px;
}

.match-grid__docs {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.mapped-doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  gap: 5px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px;
  background: #f8fafc;
}

.mapped-doc__open {
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.mapped-doc__reason {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.45);
}

.evidence-detail-modal {
  width: min(920px, 96vw);
  max-height: min(720px, 92vh);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
}

.evidence-detail-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
}

.evidence-detail-modal__header h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.evidence-detail-modal__header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.evidence-detail-modal__body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 0;
  max-height: calc(min(720px, 92vh) - 62px);
}

.evidence-detail-modal__side {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 12px;
}

.evidence-detail-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evidence-match-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evidence-match-breakdown__item {
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  padding: 7px 8px;
  background: #eff6ff;
}

.evidence-match-breakdown__item span,
.evidence-match-breakdown__item small {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.evidence-match-breakdown__item strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
}

.evidence-match-breakdown__item small {
  margin-top: 3px;
  font-weight: 700;
  text-transform: none;
}

.evidence-detail-field {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 8px;
}

.evidence-detail-field--matched {
  border-color: #86efac;
  background: #f0fdf4;
}

.evidence-detail-field span {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.evidence-detail-field strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
}

.evidence-detail-modal__content {
  min-width: 0;
  padding: 12px;
}

.evidence-detail-modal__content pre {
  max-height: calc(min(720px, 92vh) - 116px);
  overflow: auto;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  color: var(--text);
  font-family: "Menlo", "Consolas", monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* ── Match table ── */
.match-table { display: flex; flex-direction: column; gap: 8px; }

.match-table__warning { font-weight: 600; }

.match-table__rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.match-row {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: white;
}

.match-row__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.match-row__id {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  font-family: "Menlo", "Consolas", monospace;
}

.match-row__meta {
  font-size: 11px;
  color: var(--muted);
}

.match-row__file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.match-row__file-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.match-row__file-check input { width: 14px; height: 14px; accent-color: var(--oblex-600); flex-shrink: 0; }

.match-row__file-name {
  font-size: 11.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge--warning {
  background: #fef9c3;
  color: #854d0e;
}

.badge--success {
  background: #dcfce7;
  color: #166534;
}

/* ── Confirm table (step 4) ── */
.confirm-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

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

.confirm-row--highlight { background: #f0f9f8; }

.confirm-row--warn { background: #fefce8; }

.confirm-row__label { color: var(--muted); font-weight: 600; flex-shrink: 0; }

.confirm-row__value {
  font-weight: 700;
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

/* ── Draggable doc pill ── */
.doc-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 240px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px 3px 6px;
  background: white;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.doc-pill:active { cursor: grabbing; }
.doc-pill:hover { box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12); }

.doc-pill--invoice          { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.doc-pill--bank-statement   { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.doc-pill--payment-remittance { background: #fdf4ff; border-color: #e9d5ff; color: #7e22ce; }
.doc-pill--contract         { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }

.doc-pill--dragging { opacity: 0.35; }

.doc-pill__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-pill__type {
  flex-shrink: 0;
  opacity: 0.65;
  font-size: 10px;
}

/* ── Mapped doc drag state ── */
.mapped-doc { cursor: grab; }
.mapped-doc:active { cursor: grabbing; }
.mapped-doc--dragging { opacity: 0.35; }

/* ── Drop zone highlights ── */
.match-grid__docs--drag-over {
  outline: 2px dashed var(--oblex-500);
  outline-offset: -2px;
  background: var(--oblex-100);
  border-radius: 6px;
  padding: 3px;
}

.unmatched-docs--drag-over {
  border-color: var(--oblex-500);
  background: var(--oblex-100);
}

/* ── Drop hint labels ── */
.drop-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
  pointer-events: none;
}

.doc-pill-drop-hint {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px dashed var(--oblex-500);
  border-radius: 999px;
  color: var(--oblex-700);
  font-size: 11px;
  font-style: italic;
  pointer-events: none;
}

.confirm-checks { display: flex; flex-direction: column; gap: 6px; }

.confirm-checks__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.confirm-check-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--oblex-100);
  border: 1px solid #c6e8e5;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--oblex-800);
}

.confirm-check-tag__col {
  font-family: "Menlo", "Consolas", monospace;
  font-size: 10.5px;
  color: var(--oblex-600);
  background: white;
  border-radius: 4px;
  padding: 1px 4px;
}

/* Dialog-specific layout — base styles come from TaskPane.css */

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

#root {
  height: 100%;
}

.dialog-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg);
  font-family: "Geist", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 14px;
  color: var(--text);
}

.dialog-app__header {
  padding: 12px 16px 0;
  background: white;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dialog-app__title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dialog-app__brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog-app__logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.dialog-app__name {
  font-size: 15px;
  font-weight: 800;
  color: var(--oblex-800);
  letter-spacing: -0.01em;
}

.dialog-app__sheet {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #f1f5f9;
  border-radius: 6px;
  padding: 2px 8px;
  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-app__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.dialog-app__waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 200px;
  text-align: center;
}

/* Override step indicator layout for wider dialog */
.dialog-app .step-indicator {
  gap: 4px;
}

.dialog-app .step-indicator__label {
  font-size: 10px;
}

/* Wider layout adjustments for the dialog (vs narrow task pane) */
.dialog-app .column-map-table__head,
.dialog-app .column-map-row {
  grid-template-columns: 32px 1fr 160px 52px;
}

.dialog-app .column-map-table__body {
  max-height: 340px;
}

.dialog-app .match-table__rows {
  max-height: 300px;
}

.dialog-app .evidence-files__list {
  max-height: 180px;
}

.dialog-app .summary-cards {
  grid-template-columns: repeat(3, 1fr);
}

