:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}

body {
  background: #f5f7fb;
}

#app {
  width: 100%;
  height: 100%;
}

button, input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  width: 100%;
  padding: 12px 16px;
  overflow-x: hidden;
}

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

.app-shell--workbench .workbench-toolbar {
  flex-shrink: 0;
  margin-bottom: 8px;
}

.app-shell--workbench .dual-panel {
  flex: 1;
  min-height: 0;
  grid-template-columns: 4fr 6fr;
  align-items: stretch;
}

.app-shell--workbench .source-panel,
.app-shell--workbench .order-workbench {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.shell-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
}

.shell-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin: 0 0 16px;
}

.dual-panel {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  gap: 12px;
  align-items: start;
  max-width: 100%;
}

.source-panel,
.source-layout,
.source-json-section {
  max-width: 100%;
  min-width: 0;
}

.panel {
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel.is-focused-field,
.inline-field.is-focused-field,
.line-search.is-focused-inline {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.shell-status {
  margin-bottom: 12px;
}

.table td.is-focused-field {
  background: #dbeafe;
}

.line-search {
  margin-top: 6px;
}

.line-search .inline-field {
  gap: 4px;
}

.line-search .inline-field input {
  background: #f8fafc;
}

.candidate-panel {
  margin-top: 8px;
}

.candidate-panel-list {
  display: grid;
  gap: 6px;
}

.candidate-row {
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  cursor: pointer;
}

.candidate-row.is-active-candidate {
  border-color: #2563eb;
  background: #eff6ff;
}

.candidate-name {
  font-size: 13px;
  font-weight: 600;
}

.candidate-meta,
.candidate-panel-empty {
  font-size: 12px;
  color: #6b7280;
}

.submit-bar.is-focused-field,
.panel.is-focused-field {
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2), 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel h2,
.panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.muted {
  color: #6b7280;
  font-size: 13px;
}

.source-box {
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
  white-space: pre-wrap;
}

.order-grid {
  display: grid;
  gap: 12px;
}

.inline-field {
  display: grid;
  gap: 6px;
}

.inline-field label {
  font-size: 12px;
  color: #475569;
}

.inline-field input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

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

.table th, .table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 6px;
  vertical-align: top;
  text-align: left;
}

.table tr.is-active {
  background: #eff6ff;
}

.table .candidate {
  color: #2563eb;
}

.submit-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
}

.submit-bar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.workbench-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.workbench-cache-status {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.workbench-cache-counts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #4b5563;
  white-space: nowrap;
}

.workbench-cache-counts strong {
  color: #111827;
  font-weight: 600;
}

.icon-button--compact {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
}

.icon-button--compact:hover:not(:disabled) {
  background: #f3f4f6;
  border: none;
}

.icon-button--compact:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-button--compact.is-syncing .icon-button-svg {
  animation: workbench-cache-spin 0.9s linear infinite;
}

@keyframes workbench-cache-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.workbench-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.icon-button:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.icon-button-svg {
  width: 18px;
  height: 18px;
}

.workbench-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.workbench-task-meta {
  font-size: 13px;
}

.workbench-task-banner {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.workbench-task-banner.is-recognized {
  border-color: #86efac;
  background: #f0fdf4;
}

.workbench-task-banner-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.workbench-task-banner-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-size: 13px;
  color: #4b5563;
}

.source-alert {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fef3c7;
  color: #92400e;
  font-size: 13px;
}

.source-panel-tabs {
  display: flex;
  gap: 0;
  flex-shrink: 0;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.source-panel-tab {
  flex: 1;
  padding: 12px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.source-panel-tab:hover {
  color: #374151;
}

.source-panel-tab.is-active {
  color: #111827;
  border-bottom-color: #111827;
}

.source-panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.source-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.source-section-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}

.source-image-card,
.source-image-viewport {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: auto;
  background: #f9fafb;
  overscroll-behavior: contain;
}

.source-image-viewport {
  max-height: 840px;
}

.source-image-stage {
  position: relative;
  display: block;
  width: 100%;
  line-height: 0;
}

.source-image {
  display: block;
  width: 100%;
  max-height: none;
  object-fit: contain;
  background: #111827;
}

.source-anchor-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.source-anchor-group-bounds {
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
}

.source-anchor-highlight {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #2563eb;
  background: rgba(37, 99, 235, 0.14);
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 0 14px rgba(37, 99, 235, 0.28);
  transition: left 0.15s ease, top 0.15s ease, width 0.15s ease, height 0.15s ease;
}

.source-anchor-label {
  position: absolute;
  left: 0;
  top: -1.4em;
  max-width: 100%;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.92);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-anchor-debug {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  padding: 6px 10px;
  border: 1px dashed #dbe2ea;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.source-anchor-debug code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #1e40af;
}

.line-source-cell {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.line-anchor-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

tr.has-source-anchor.is-active .line-anchor-dot {
  background: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.source-image-meta {
  padding: 8px 12px;
  font-size: 12px;
}

.source-image-placeholder,
.source-json-empty {
  padding: 16px;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.source-text-preview {
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.8;
}

.source-text-preview--tags {
  background: #fff;
}

.source-info-tag {
  display: inline-block;
  margin: 0 2px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  line-height: 1.5;
  vertical-align: baseline;
  white-space: nowrap;
}

.source-info-tag--product {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.source-info-tag--quantity {
  background: #fff7ed;
  border-color: #fdba74;
  color: #c2410c;
}

.source-info-tag--contact {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}

.source-info-tag--meta {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.source-tag-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.source-tag-flow--header {
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
}

.source-tag-flow--lines {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding-top: 10px;
}

.source-line-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.source-tag-flow--meta {
  padding-top: 10px;
  border-top: 1px dashed #e5e7eb;
}

.source-match-card--tags {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
}

.source-json {
  margin: 0;
  padding: 12px;
  max-height: 360px;
  max-width: 100%;
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.inbox-task-list tr.is-recognized,
.inbox-task-list .tabulator-row.is-recognized {
  background: #f0fdf4;
}

.inbox-task-list tr.is-recognized.is-active,
.inbox-task-list .tabulator-row.is-recognized.is-active {
  background: #dcfce7;
}

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

.task-action-button {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.danger-button {
  border: 1px solid #fecaca;
  background: #fff;
  color: #b91c1c;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}

.danger-button.task-action-button {
  padding: 6px 10px;
  font-size: 12px;
}

.danger-button:hover {
  background: #fef2f2;
}

.is-uncertain-line {
  background: #fffbeb;
}

.banner-warning {
  color: #b45309;
  font-weight: 600;
}

.match-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #f3f4f6;
  color: #374151;
}

.match-pill--MATCHED {
  background: #dcfce7;
  color: #166534;
}

.match-pill--PARTIAL {
  background: #fef3c7;
  color: #92400e;
}

.match-pill--pending {
  background: #e5e7eb;
  color: #4b5563;
}

.customer-matcher {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f9fafb;
}

.customer-matcher.is-focused-field {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.customer-matcher-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.customer-matcher-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customer-matcher-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.customer-search {
  position: relative;
}

.customer-search-label {
  display: block;
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
}

.customer-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: #111827;
}

.customer-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.customer-search-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.customer-search-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 12px;
  color: #111827;
  cursor: pointer;
}

.customer-search-option:hover {
  background: #eff6ff;
}

.customer-search-option-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-search-option-code,
.customer-search-option-id {
  flex-shrink: 0;
  font-size: 11px;
}

.customer-candidate-hint {
  line-height: 1.4;
}

.customer-matcher-empty {
  font-size: 12px;
}

.customer-matcher-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  align-items: center;
}

.customer-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
}

.customer-field--grow {
  grid-column: span 1;
}

.customer-field-label {
  color: #6b7280;
  flex-shrink: 0;
}

.customer-field-value {
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-candidate-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.customer-candidate-tags.muted {
  font-size: 12px;
  margin-top: 8px;
}

.customer-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid #dbe2ea;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.customer-tag:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.customer-tag.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.customer-tag-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.customer-tag-score {
  color: #6b7280;
  font-size: 11px;
  flex-shrink: 0;
}

.customer-tag.is-active .customer-tag-score {
  color: #3b82f6;
}

.order-workbench {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.order-workbench-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 0;
}

.order-workbench .order-grid {
  gap: 10px;
  padding-bottom: 12px;
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}

.order-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.order-header-heading {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.order-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.order-status-pill--pending {
  background: #dcfce7;
  color: #166534;
}

.order-status-pill--success {
  background: #dbeafe;
  color: #1d4ed8;
}

.order-status-pill--info {
  background: #e0f2fe;
  color: #0369a1;
}

.order-status-pill--draft {
  background: #f3f4f6;
  color: #4b5563;
}

.order-header-meta {
  flex-shrink: 0;
}

.order-date-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-date-label {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.order-date-input {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: #111827;
}

.order-date-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.order-line-table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.order-line-table-head h3 {
  margin: 0;
}

.order-line-table-hint {
  font-size: 11px;
}

.order-lines-table .col-product {
  min-width: 180px;
  overflow: visible;
}

.order-lines-table td.col-product {
  position: relative;
  overflow: visible;
}

.order-line-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.order-lines-table {
  width: 100%;
  border-collapse: collapse;
}

.order-lines-table th,
.order-lines-table td {
  padding: 8px 6px;
  vertical-align: top;
  border-bottom: 1px solid #eef2f7;
  font-size: 12px;
}

.order-lines-table th {
  color: #6b7280;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.order-lines-table .col-confidence {
  width: 84px;
}

.order-lines-table .col-quantity {
  width: 88px;
}

.order-lines-table .col-unit {
  width: 88px;
}

.order-lines-table .col-actions {
  width: 44px;
  text-align: center;
}

.order-line-row.is-active {
  background: #f8fbff;
}

.order-line-row.is-active td {
  background: #f8fbff;
}

.line-confidence {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.line-confidence-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
  min-width: 0;
}

.line-confidence-score {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #6b7280;
  font-weight: 500;
}

.line-confidence-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.line-confidence-dot--high {
  background: #22c55e;
}

.line-confidence-dot--pending {
  background: #f59e0b;
}

.line-confidence-dot--manual {
  background: #ef4444;
}

.line-confidence-dot--verified {
  background: #9ca3af;
}

.line-confidence-label {
  font-size: 11px;
  color: #374151;
  white-space: nowrap;
}

.line-field-input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
}

.line-field-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.line-quantity-input {
  min-width: 72px;
}

.line-product-input.is-active-line-input {
  border-color: #93c5fd;
  background: #f8fbff;
}

.candidate-panel.is-visible {
  margin-top: 6px;
}

.line-source-hint {
  margin-top: 4px;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-uncertain-hint {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-unit-cell {
  display: grid;
  gap: 2px;
}

.line-unit-value {
  font-weight: 600;
  color: #111827;
}

.line-unit-recognized {
  font-size: 11px;
  line-height: 1.3;
}

.line-product-cell {
  position: relative;
}

.product-search-dropdown {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 220px;
  overflow-y: auto;
}

.product-search-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: #111827;
}

.product-search-option:hover {
  background: #eff6ff;
}

.product-search-option-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-search-option-unit,
.product-search-option-id {
  font-size: 11px;
  white-space: nowrap;
}

.line-candidate-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.candidate-tag {
  border: 1px solid #dbe2ea;
  border-radius: 999px;
  background: #fff;
  color: #374151;
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
}

.candidate-tag.is-active,
.candidate-tag:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.order-line-table-footer {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.order-add-line-button {
  min-width: 160px;
}

.line-delete-button {
  color: #dc2626;
}

.line-delete-button:hover {
  background: #fef2f2;
}

.order-workbench-footer {
  flex-shrink: 0;
  display: grid;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid #dbe2ea;
  background: #fff;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

.order-footer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: 12px;
  color: #374151;
}

.order-stat strong {
  color: #111827;
}

.order-stat--manual {
  color: #dc2626;
}

.order-stat--pending {
  color: #d97706;
}

.order-stat--verified {
  color: #6b7280;
}

.order-stat--high {
  color: #15803d;
}

.order-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.order-save-button,
.order-submit-button {
  min-width: 108px;
}

.order-footer-message {
  font-size: 11px;
}

.match-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

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

.candidate-chip {
  display: inline-block;
  margin-right: 6px;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #f3f4f6;
  font-size: 12px;
}

.line-match-state {
  font-size: 11px;
  margin-top: 2px;
}

.source-match-section {
  margin-top: 0;
}

.source-match-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f9fafb;
  font-size: 13px;
}

.uncertain-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #fde68a;
  color: #92400e;
  font-weight: 600;
}

.queue-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e5e7eb;
  color: #374151;
}

.queue-pill--QUEUED { background: #dbeafe; color: #1d4ed8; }
.queue-pill--RECOGNIZING { background: #fef3c7; color: #b45309; }
.queue-pill--RECOGNIZED { background: #d1fae5; color: #047857; }
.queue-pill--SUBMITTING { background: #ede9fe; color: #6d28d9; }
.queue-pill--SUBMITTED,
.queue-pill--ARCHIVED { background: #f3f4f6; color: #4b5563; }
.queue-pill--FAILED { background: #fee2e2; color: #b91c1c; }

.inbox-task-list tr.is-archived,
.inbox-task-list .tabulator-row.is-archived {
  opacity: 0.65;
}

.inbox-task-list tbody tr.task-row,
.inbox-task-list .tabulator-row.task-row {
  cursor: pointer;
}

.inbox-task-list tbody tr.task-row:hover,
.inbox-task-list .tabulator-row.task-row:hover {
  background: #eff6ff;
}

.inbox-task-table {
  width: 100%;
}

.inbox-task-list .tabulator {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}

.inbox-task-list .tabulator .tabulator-header {
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  font-weight: 600;
}

.inbox-task-list .tabulator .tabulator-header .tabulator-col {
  border-right: 1px solid #eef2f7;
}

.inbox-task-list .tabulator .tabulator-header .tabulator-col-content {
  padding: 10px 8px;
}

.inbox-task-list .tabulator .tabulator-tableholder .tabulator-table .tabulator-row {
  border-bottom: 1px solid #f3f4f6;
  min-height: 44px;
}

.inbox-task-list .tabulator .tabulator-tableholder .tabulator-table .tabulator-row .tabulator-cell {
  padding: 8px;
  border-right: 1px solid #f8fafc;
}

.inbox-task-list .tabulator .tabulator-header-filter input,
.inbox-task-list .tabulator .tabulator-header-filter select {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.inbox-task-list .tabulator .tabulator-header-filter input[type='date'] {
  min-width: 0;
  color: #374151;
}

.inbox-task-list .tabulator .tabulator-header-filter input[type='date']::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

.inbox-task-list .tabulator .tabulator-footer {
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #6b7280;
  font-size: 12px;
}

.inbox-task-list .tabulator .tabulator-footer .tabulator-page {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
}

.inbox-task-list .tabulator .tabulator-footer .tabulator-page.active {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.inbox-task-list .tabulator .tabulator-footer .tabulator-page-size {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.inbox-task-list .tabulator-row.is-active {
  background: #eff6ff;
}

.inbox-task-list .tabulator-placeholder {
  padding: 24px;
  color: #6b7280;
  text-align: center;
}

.task-id-link {
  color: #2563eb;
  font-weight: 600;
}

.task-open-button {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.primary-button {
  border: 0;
  background: #111827;
  color: white;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}

.secondary-button {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #111827;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}

.kbd-hint {
  font-size: 12px;
  color: #6b7280;
}

.inbox-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.inbox-header h2 {
  margin: 0 0 4px;
}

.inbox-header p {
  margin: 0;
}

.composer-grid {
  display: grid;
  gap: 12px;
}

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

.source-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  padding: 10px 8px;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.source-type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.source-type-option.is-active,
.source-type-option:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.source-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #334155;
}

.source-type-icon svg {
  width: 28px;
  height: 28px;
}

.source-type-option.is-active .source-type-icon,
.source-type-option:has(input:checked) .source-type-icon {
  color: #1d4ed8;
}

.source-type-label {
  font-size: 13px;
  color: #475569;
}

.source-type-option.is-active .source-type-label,
.source-type-option:has(input:checked) .source-type-label {
  color: #1d4ed8;
  font-weight: 600;
}

.attachment-preview {
  margin-top: 4px;
}

.attachment-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #f9fafb;
  max-width: 100%;
}

.attachment-preview-image {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #f3f4f6;
}

.attachment-meta {
  padding: 6px 10px;
  font-size: 12px;
}

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

.modal-dialog {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
}

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

.modal-close {
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: #111827;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid #e5e7eb;
}

@media (max-width: 980px) {
  .dual-panel,
  .app-shell--workbench .dual-panel {
    grid-template-columns: 1fr;
  }

  .app-shell--workbench {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .app-shell--workbench .source-panel,
  .app-shell--workbench .order-workbench {
    overflow: visible;
  }

  .customer-matcher-fields {
    grid-template-columns: 1fr 1fr;
  }
}
