:root {
  color-scheme: light;
  --bg: #f1f5f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #cbd5e1;
  --border-light: #e2e8f0;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --green: #10b981;
  --green-dark: #047857;
  --green-light: #ecfdf5;
  --red: #ef4444;
  --red-dark: #b91c1c;
  --red-light: #fef2f2;
  --amber: #f59e0b;
  --amber-dark: #b45309;
  --amber-light: #fffbeb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
}

h1, h2, h3, .topbar h1 {
  font-family: Outfit, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  height: 100vh;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 100%;
  margin: 0 0 10px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
  max-width: 100%;
  margin: 0;
  flex: 1 1 0;
  min-height: 0;
}

.workspace.setup-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.workspace.setup-collapsed .setup-panel {
  display: none;
}

.setup-panel,
.results-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.setup-panel {
  padding: 18px;
  overflow-y: auto;
}

.upload-form {
  display: grid;
  gap: 14px;
}

.drop-zone {
  display: grid;
  gap: 7px;
  min-height: 132px;
  padding: 18px;
  border: 1px dashed #8da2bb;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  align-content: center;
}

.drop-zone.secondary {
  min-height: 104px;
}

.drop-title {
  font-weight: 800;
  font-size: 16px;
}

.drop-copy {
  color: var(--muted);
  line-height: 1.4;
}

.drop-zone input {
  width: 100%;
  color: var(--muted);
}

.controls-grid {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.advanced-controls {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.advanced-controls summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.controls-grid label {
  display: grid;
  gap: 6px;
  color: #2c3a48;
  font-size: 13px;
  font-weight: 700;
}

.controls-grid input[type="number"],
.toolbar input,
.toolbar select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.toggle-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 9px !important;
  font-weight: 650 !important;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.primary-btn,
.ghost-btn {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-btn {
  background: var(--blue);
  color: #fff;
}

.primary-btn:hover {
  background: var(--blue-dark);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ghost-btn {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.wide {
  width: 100%;
}

.file-list {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.panel-heading h2 {
  font-size: 15px;
}

.panel-heading span,
.muted-list {
  color: var(--muted);
  font-size: 13px;
}

.muted-list ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
}

.results-panel {
  overflow: hidden;
}

.review-split {
  display: grid;
  grid-template-columns: 1fr;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
}

.workspace.setup-collapsed.has-pdf-review .review-split {
  grid-template-columns: minmax(0, 1fr) 8px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.panel-resizer {
  width: 8px;
  background: var(--border-light);
  cursor: col-resize;
  transition: background 0.15s ease;
  position: relative;
  z-index: 10;
  align-self: stretch;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.panel-resizer:hover,
.panel-resizer.dragging {
  background: var(--blue);
  border-color: var(--blue-dark);
}

.pdf-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #e6ebf1;
  height: 100%;
}

.summary-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  height: 100%;
}

.pdf-pane-head {
  display: flex;
  min-height: 48px;
  padding: 8px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex: 0 0 auto;
}

/* Compact Inline Stats Header */
.summary-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  min-height: 38px;
  flex: 0 0 auto;
}

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

.summary-stats-inline span strong {
  color: var(--ink);
  font-weight: 700;
}

.summary-stats-inline .bullet {
  color: var(--line);
}

/* Compact Single-Row Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.toolbar select {
  flex: 0 1 130px;
  height: 32px !important;
  padding: 0 8px !important;
  font-size: 12px !important;
}

.toolbar input {
  height: 32px !important;
  font-size: 12px !important;
}

.batch-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}

.batch-actions .ghost-btn {
  min-height: 32px !important;
  padding: 0 10px !important;
  font-size: 11px !important;
  font-weight: 700;
}

.danger-text {
  color: var(--red);
}

.search-wrap {
  position: relative;
  flex: 1 1 200px;
}

.search-wrap span {
  position: absolute;
  left: 9px;
  top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.search-wrap input {
  padding-left: 26px !important;
}

/* Compact PDF Review Header/Toolbar */
.pdf-pane-head.compact {
  display: flex;
  flex-wrap: wrap;
  row-gap: 6px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  min-height: 48px;
  flex: 0 0 auto;
}

.pdf-pane-head.compact select.compact-select {
  max-width: 170px;
  height: 32px;
  font-size: 12px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.pdf-pane-head.compact .nav-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 2px;
  border-radius: var(--radius-sm);
}

.pdf-pane-head.compact .nav-btn {
  min-height: 28px;
  border: 0;
  background: transparent;
  padding: 0 8px;
  cursor: pointer;
  font-size: 11px;
}

.pdf-pane-head.compact .nav-btn:hover {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 4px;
}

.pdf-pane-head.compact .page-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
  text-align: center;
}

.pdf-pane-head.compact .segmented-control.compact {
  gap: 2px;
  background: #f1f5f9;
  padding: 2px;
  border-radius: var(--radius-sm);
  height: 32px;
}

.pdf-pane-head.compact .segmented-control.compact button {
  min-height: 28px;
  font-size: 11px;
  padding: 0 10px;
  border-radius: 4px;
}

.pdf-pane-head.compact .manual-legend.compact {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
  border-left: 1px solid var(--line);
  padding-left: 8px;
}

.pdf-pane-head.compact .manual-legend.compact i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.pdf-pane-head.compact .manual-legend.compact i.parsed { background: var(--blue); }
.pdf-pane-head.compact .manual-legend.compact i.unknown { background: var(--amber); }
.pdf-pane-head.compact .manual-legend.compact i.included { background: var(--green); }

.suggestions-panel,
.review-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  flex: 0 0 auto;
}

.suggestion-head,
.review-head,
.suggestion-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.suggestion-head {
  color: var(--amber-dark);
}

.review-head {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.verification-toggle {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.verification-toggle:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.verification-toggle:hover strong {
  color: var(--blue);
}

.verification-head-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.count-badge {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 800;
}

.collapse-icon {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--blue-light);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 8px;
  text-align: center;
  transition: all 0.15s ease;
}

.verification-toggle:hover .collapse-icon {
  background: var(--blue);
  color: #fff;
}

.review-queue {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 4px;
}

.manual-pdf-workspace {
  display: flex;
  flex-direction: column;
  height: calc(100% - 48px);
  min-height: 0;
  gap: 10px;
  padding: 10px;
}

.manual-pdf-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto minmax(250px, auto);
  gap: 8px;
  align-items: center;
}

.manual-pdf-toolbar select {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
}

.manual-pdf-toolbar > strong {
  min-width: 110px;
  text-align: center;
  font-size: 12px;
}

.manual-legend {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.manual-legend i {
  width: 12px;
  height: 12px;
  border: 2px solid #2474d2;
  background: rgba(36, 116, 210, 0.16);
}
.manual-legend i.unknown { border-color: #c27a00; background: rgba(255, 183, 52, 0.2); }
.manual-legend i.included { border-color: #16834f; background: rgba(22, 131, 79, 0.2); }

.manual-page-stage {
  position: relative;
  width: 100%;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  background: #dfe5ec;
}

/* Canvas shrink-wraps the image so the overlay always matches the image box,
   regardless of zoom level or panel width (no JS px sizing needed). */
.manual-page-canvas {
  position: relative;
  display: block;
  width: 100%;
}

.manual-page-stage.zoom-focus > .manual-page-canvas {
  width: 170%;
}

.manual-page-stage > .manual-page-canvas > img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
}

.manual-page-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.manual-region {
  position: absolute;
  min-width: 8px;
  min-height: 8px;
  padding: 0;
  border: 2px solid #2474d2;
  border-radius: 2px;
  background: rgba(36, 116, 210, 0.16);
  cursor: pointer;
  pointer-events: auto;
}

.manual-region.unknown { border-color: #c27a00; background: rgba(255, 183, 52, 0.22); }
.manual-region.included,
.manual-region.included-approved { border-color: #16834f; background: rgba(22, 131, 79, 0.2); }
.manual-region.included-approved span { background: #16834f !important; }
.manual-region.included-pending { border-color: #c27a00; background: rgba(255, 183, 52, 0.15); }
.manual-region.included-pending span { background: #c27a00 !important; }
.manual-region.included-excluded { border-color: #dc2626; background: rgba(220, 38, 38, 0.15); opacity: 0.75; }
.manual-region.included-excluded span { background: #dc2626 !important; }
.manual-region:not(.included-approved):not(.included-pending):not(.included-excluded):hover { background: rgba(31, 94, 255, 0.34); border-width: 3px; z-index: 2; }
.manual-region span {
  position: absolute;
  left: 0;
  bottom: 100%;
  display: none;
  padding: 3px 6px;
  border-radius: 4px;
  background: #17212b;
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
}
.manual-region:hover span { display: block; }

.review-queue-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.review-queue-row:hover {
  box-shadow: var(--shadow);
  border-color: var(--blue-light);
  transform: translateY(-2px);
  background: #f8fafc;
}

.review-queue-row.approved {
  border-left: 4px solid var(--green);
  background: var(--green-light);
}

.review-queue-row.approved:hover {
  background: #effaf3;
  border-color: var(--green-light);
}

.review-queue-row.rejected {
  border-left: 4px solid var(--red);
  background: var(--red-light);
}

.review-queue-row.rejected:hover {
  background: #fdf3f2;
  border-color: var(--red-light);
}

.review-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.review-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.review-status {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--muted);
}
.review-status.approved, .review-status.added {
  background: var(--green-light);
  color: var(--green-dark);
}
.review-status.rejected {
  background: var(--red-light);
  color: var(--red-dark);
}

.review-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.review-main strong {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.review-main p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
  overflow-wrap: anywhere;
}

.review-evidence-meta {
  font-size: 11px;
  font-family: monospace;
  color: var(--muted);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  align-self: flex-start;
  margin-top: 2px;
}

.review-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.review-actions button {
  min-height: 28px !important;
  padding: 0 10px !important;
  font-size: 11px !important;
  font-weight: 700;
}

.review-footnote {
  color: var(--muted);
  font-size: 12px;
  padding: 4px;
}

.primary-btn.compact,
.ghost-btn.compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.ghost-btn.active {
  border-color: var(--blue);
  color: var(--blue-dark);
  background: #edf3ff;
}

.suggestion-item,
.review-item,
.skipped-row {
  padding: 12px;
  border: 1px solid #efd69c;
  border-radius: 7px;
  background: #fff;
}

.review-item {
  border-color: var(--line);
}

.review-item summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 850;
}

.suggestion-item h3 {
  font-size: 14px;
  margin-bottom: 4px;
}

.suggestion-item p,
.review-item p {
  color: #536273;
  line-height: 1.4;
}

.confidence-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #edf3ff;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 850;
}

.mini-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-grid div,
.skipped-row {
  display: grid;
  gap: 4px;
}

.mini-grid span,
.skipped-row span {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.skipped-list {
  display: grid;
  gap: 8px;
}

.progress-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f7fbff;
}

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

.progress-head strong {
  color: var(--blue-dark);
}

.progress-head span,
.progress-panel p {
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce6f3;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #12a370);
  transition: width 260ms ease;
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  padding: 30px;
}

.empty-state h2 {
  color: var(--ink);
  font-size: 22px;
}

.table-wrap {
  overflow: auto;
  min-height: 0;
  flex: 1 1 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  text-align: left;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--line);
}

tr.excluded td {
  color: #94a3b8;
  background: #f8fafc;
}

tbody tr {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

tbody tr:hover td {
  background: var(--blue-light) !important;
}

th:nth-child(1),
td:nth-child(1) {
  width: 60px;
}

th:nth-child(2),
td:nth-child(2) {
  width: auto;
}

th:nth-child(3),
td:nth-child(3) {
  width: 250px;
}

.qty {
  font-weight: 800;
  text-align: center;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

.family-pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e9eef7;
  color: #314760;
  font-size: 12px;
  font-weight: 750;
}

.source-pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
}

.verification-pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  background: #fff4d6;
  color: #875900;
  font-size: 12px;
  font-weight: 800;
}

.needs-detail-pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
  font-weight: 750;
  cursor: help;
}

.verification-pill.accepted {
  background: #e8f5ee;
  color: var(--green);
}

.verification-pill.flagged {
  background: #fff1f0;
  color: var(--red);
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.component-card-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.component-main-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.component-main-info strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.component-sub-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.bullet {
  color: #94a3b8;
  font-weight: 800;
}

.component-location-line {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
}

.location-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.location-label {
  font-weight: 800;
  color: #475569;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.05em;
}

.location-value {
  color: var(--ink);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
}

.devices-tag {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  color: #334155;
  font-size: 11px;
}

.review-buttons {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--radius-sm);
  width: fit-content;
  align-items: center;
}

.review-buttons button {
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: all 0.15s ease;
}

.review-buttons button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.review-buttons button.active {
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.review-buttons button.active[data-review="approved"] {
  color: var(--green);
}

.review-buttons button.active[data-review="pending"] {
  color: var(--blue);
}

.review-buttons button.active[data-review="excluded"] {
  color: var(--red);
}

.review-buttons button[data-edit] {
  color: var(--blue);
  background: transparent;
}

.review-buttons button[data-edit]:hover {
  background: var(--blue-light);
  color: var(--blue-dark);
}

.no-results {
  height: 140px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 7px;
  background: #1f2937;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 20;
}

.toast.ok {
  background: var(--green);
}

.toast.error {
  background: var(--red);
}

.evidence-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.evidence-dialog[open] {
  width: min(1200px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  background: #fff;
  overflow: hidden;
}

.edit-dialog {
  width: min(760px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.evidence-dialog::backdrop,
.edit-dialog::backdrop {
  background: rgba(15, 23, 42, 0.36);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-size: 17px;
}

.evidence-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.evidence-layout {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 20px;
  align-items: start;
}

.evidence-summary {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.evidence-body dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.evidence-body dl div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.evidence-body dl div:last-child {
  border-bottom: 0;
}

.evidence-body dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: center;
}

.evidence-body dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
  font-size: 13px;
  color: var(--ink);
}

.rtu-child-review {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.rtu-child-heading {
  margin-bottom: 12px;
}

.rtu-child-heading strong {
  font-size: 14px;
  color: var(--ink);
  display: block;
}

.rtu-child-heading span {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}

.rtu-child-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.rtu-child-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: all 0.15s ease;
}

.rtu-child-row.approved {
  border-left: 4px solid var(--green);
  background: #f0fdf4;
  border-color: var(--green-light) var(--green-light) var(--green-light) var(--green);
}

.rtu-child-row.rejected {
  border-left: 4px solid var(--red);
  background: #fdf2f2;
  border-color: #fde8e8 #fde8e8 #fde8e8 var(--red);
}

.rtu-child-row .child-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.rtu-child-row .child-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}

.rtu-child-row .child-qty {
  font-size: 11px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 4px;
}

.rtu-child-row .child-part {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
}

.rtu-child-row .child-status {
  font-size: 11px;
  font-weight: 700;
  margin-top: 2px;
}

.rtu-child-row .review-buttons {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  margin-left: 12px;
}

.rtu-child-row .review-buttons button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.1s ease;
}

.rtu-child-row .review-buttons button:last-child {
  border-right: 0;
}

.rtu-child-row .review-buttons button[data-child-review="approved"].active {
  background: var(--green);
  color: #fff;
}

.rtu-child-row .review-buttons button[data-child-review="excluded"].active {
  background: var(--red);
  color: #fff;
}

.drawing-found { color: #287a4b; }
.drawing-missing { color: #b45309; }

.summary-title {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.summary-title strong {
  line-height: 1.35;
}

.qty-badge {
  justify-self: start;
  padding: 3px 8px;
  border-radius: 5px;
  background: #e8f5ee;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.evidence-body dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.evidence-body dl div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.evidence-body dl div:last-child {
  border-bottom: 0;
}

.evidence-body dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.evidence-body dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.evidence-navigation {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.evidence-navigation span {
  min-width: 130px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.segmented-control {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.segmented-control button {
  min-height: 32px;
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: #334155;
  padding: 0 11px;
  font-weight: 800;
  cursor: pointer;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.active {
  background: var(--blue);
  color: #fff;
}

.pdf-preview {
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: auto;
  position: relative;
  background: #f8fafc;
  transition: background-color 0.2s ease;
}

/* Crop (Zoom) Mode: Dark, centered, native resolution */
.pdf-preview.mode-crop {
  background: #111215;
  display: grid;
  place-items: center;
  align-content: center;
  justify-content: center;
  padding: 32px;
}
.pdf-preview.mode-crop img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  border: 1px dashed #3a3f4d;
  border-radius: 6px;
  background: #1a1a1a;
  outline: 1px dashed var(--blue);
}

/* Full Page Mode: Light, fit to width, vertical scroll */
.pdf-preview.mode-full {
  background: #f1f3f5;
  padding: 16px;
  display: block;
}
.pdf-preview.mode-full img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  border-radius: 4px;
  border: 1px solid var(--line);
}

.preview-empty {
  display: grid;
  place-items: center;
  min-height: 620px;
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

.edit-dialog {
  width: min(760px, calc(100vw - 32px));
}

#rulesDialog {
  width: min(980px, calc(100vw - 32px));
}

.edit-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.dialog-note {
  color: var(--muted);
  line-height: 1.4;
}

.rules-textarea {
  width: 100%;
  min-height: 480px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.edit-form label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.edit-form input,
.edit-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1280px) {
  .workspace.setup-collapsed.has-pdf-review .review-split {
    grid-template-columns: minmax(0, 1fr) minmax(480px, 0.9fr);
  }

  .manual-legend { display: none; }
}

@media (max-width: 980px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1;
  }

  .workspace {
    display: grid;
  }

  .workspace.setup-collapsed.has-pdf-review .review-split {
    grid-template-columns: 1fr;
    height: auto;
  }

  .pdf-pane {
    min-height: 62vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .manual-pdf-toolbar {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat:nth-child(2) {
    border-right: 0;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

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

  .review-actions {
    justify-content: stretch;
  }

  .review-actions button {
    flex: 1;
  }

  .batch-actions {
    justify-content: stretch;
  }

  .batch-actions button {
    flex: 1;
  }

  .table-wrap {
    max-height: none;
  }

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

  .preview-toolbar,
  .evidence-navigation {
    align-items: stretch;
  }

  .evidence-navigation {
    width: 100%;
  }

  .evidence-navigation span {
    flex: 1;
    align-self: center;
  }

  .pdf-preview,
  .preview-empty {
    min-height: 420px;
  }
}

/* Interactive Manual Candidates List (Bottom of PDF Panel) */
.manual-candidates-list {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.manual-candidates-list h4 {
  font-family: Outfit, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  max-height: 180px;
  overflow-y: auto;
  padding: 2px;
}

.candidate-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.candidate-item-card:hover {
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.candidate-item-card.unknown {
  border-left: 3px solid var(--amber);
}

.candidate-item-card.parsed {
  border-left: 3px solid var(--blue);
}

.candidate-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.candidate-info strong {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.candidate-badge {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.candidates-empty {
  font-size: 13px;
  color: var(--green-dark);
  background: var(--green-light);
  border: 1px solid #a7f3d0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 600;
}

/* Glowing box overlay on region hover */
.manual-region.highlight-hover {
  background: rgba(37, 99, 235, 0.45) !important;
  border: 3px solid var(--blue) !important;
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.7);
  z-index: 10;
  transform: scale(1.02);
}

/* Guided Wizard Header (Step-by-Step progress tracker) */
.summary-wizard-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  flex: 0 0 auto;
}

.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.wizard-step:hover {
  background: rgba(15, 23, 42, 0.04);
}

.wizard-step .step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-light);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.wizard-step .step-label {
  font-family: Outfit, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.wizard-step .step-badge {
  font-size: 10px;
  background: var(--border-light);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 800;
}

/* Wizard step active status style */
.wizard-step.active .step-num {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 3px var(--blue-light);
}

.wizard-step.active .step-label {
  color: var(--blue);
}

/* Wizard step completed status style */
.wizard-step.completed .step-num {
  background: var(--green);
  color: #fff;
}

.wizard-step.completed .step-label {
  color: var(--green-dark);
}

.wizard-connector {
  flex: 1 1 20px;
  height: 2px;
  background: var(--border-light);
  border-radius: 999px;
  transition: background 0.15s ease;
}

.wizard-connector.completed {
  background: var(--green);
}

/* Tab Panels & Scroll containers */
.tab-content {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-content.hidden {
  display: none !important;
}

.review-panel-compact {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 12px 16px;
  background: #f8fafc;
}

.review-pane-info {
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.review-pane-info strong {
  font-family: Outfit, sans-serif;
  font-size: 15px;
  color: var(--ink);
}

.review-pane-info .sub-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.review-queue-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

/* Wizard Navigation Footer */
.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  flex: 0 0 auto;
}

.wizard-footer-status {
  font-size: 12px;
  color: var(--muted);
}

.wizard-footer-status strong {
  color: var(--ink);
}

.wizard-footer.hidden {
  display: none !important;
}

/* Compact Row Actions Buttons */
.row-actions-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.row-actions-cell button {
  min-height: 28px !important;
  padding: 0 10px !important;
  font-size: 11px !important;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.row-actions-cell button.approve-btn {
  background: var(--green-light);
  border: 1px solid var(--green);
  color: var(--green-dark);
}
.row-actions-cell button.approve-btn:hover {
  background: var(--green);
  color: #fff;
}

.row-actions-cell button.exclude-btn {
  background: var(--red-light);
  border: 1px solid var(--red);
  color: var(--red-dark);
}
.row-actions-cell button.exclude-btn:hover {
  background: var(--red);
  color: #fff;
}

.row-actions-cell button.pending-btn {
  background: #f1f5f9;
  border: 1px solid var(--line);
  color: var(--muted);
}
.row-actions-cell button.pending-btn:hover {
  background: var(--border-light);
  color: var(--ink);
}

/* Success / Export Summary Dashboard Pane */
.export-pane-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 30px;
  background: #f8fafc;
  overflow-y: auto;
  text-align: center;
}

.export-success-header {
  margin-bottom: 24px;
}

.export-success-header .success-icon {
  width: 56px;
  height: 56px;
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  font-size: 28px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.export-success-header h2 {
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 6px;
}

.export-success-header p {
  font-size: 13px;
  color: var(--muted);
  max-width: 440px;
  line-height: 1.4;
  margin: 0 auto;
}

.export-summary-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 30px;
  width: 100%;
  max-width: 460px;
}

.export-stat-card {
  flex: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 10px;
  box-shadow: var(--shadow-sm);
}

.export-stat-card span {
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.export-stat-card strong {
  font-size: 22px;
  color: var(--ink);
  font-weight: 800;
}

.export-action-box {
  width: 100%;
  max-width: 320px;
}

.large-btn {
  width: 100%;
  min-height: 48px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.large-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.large-btn span {
  font-size: 13px;
  font-weight: 800;
}

.large-btn small {
  font-size: 10px;
  opacity: 0.8;
  font-family: monospace;
}

.stat-breakdown {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-weight: 700;
  display: block;
}

.added-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--green-dark);
  background: var(--green-light);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--green);
  display: inline-block;
}

.view-child-evidence-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.view-child-evidence-link:hover {
  color: var(--blue-dark);
}

.back-to-verification-container {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.back-to-verification-btn {
  width: 100%;
  text-align: center;
  font-weight: 750;
  color: #0369a1 !important;
  border: 1px dashed #0284c7 !important;
  background: #f0f9ff !important;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.back-to-verification-btn:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
}

.pdf-preview img {
  cursor: zoom-in;
  transition: transform 0.2s ease, max-width 0.2s ease, max-height 0.2s ease;
}

.pdf-preview img.zoomed-in {
  max-width: none !important;
  max-height: none !important;
  width: auto !important;
  height: auto !important;
  cursor: zoom-out;
}
