#document-processing-screen,
#document-viewer-screen {
  font-size: 12px;
}

.document-workspace-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(9, 18, 29, 0.72);
}

.document-workspace-tabs button {
  min-width: 116px;
  min-height: 32px;
  border-color: transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.document-workspace-tabs button.active {
  background: #26445d;
  color: #f4f8fb;
}

.document-upload-heading,
.document-upload-title,
.document-upload-actions,
.document-upload-file-row,
.document-upload-command-actions,
.document-upload-detail-actions {
  display: flex;
  align-items: center;
}

.document-upload-heading { justify-content: space-between; gap: 12px; }
.document-upload-title, .document-upload-actions, .document-upload-file-row { gap: 8px; }
.document-upload-title h4 { margin: 0; font-size: 16px; }
.document-info-button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 50%;
  font-weight: 700;
}

.document-upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(360px, 0.85fr);
  gap: 12px;
}

.document-upload-list-panel,
.document-upload-detail-panel { min-height: 510px; }
.document-upload-table { table-layout: fixed; }
.document-upload-table th, .document-upload-table td { padding: 9px 7px; font-size: 12px; }
.document-upload-table th:first-child { width: 34%; }
.document-upload-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.document-upload-table tbody tr[data-upload-operation-id] { cursor: pointer; outline: none; }
.document-upload-table tbody tr[data-upload-operation-id]:hover,
.document-upload-table tbody tr[data-upload-operation-id]:focus,
.document-upload-table tbody tr.selected { background: rgba(96, 165, 250, 0.11); }

.document-upload-detail-grid {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 9px;
  margin: 16px 0;
}
.document-upload-detail-grid dt { color: var(--muted); }
.document-upload-detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.document-upload-state-notice {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-left: 3px solid #64748b;
  background: rgba(255, 255, 255, 0.03);
}
.document-upload-state-notice.green { border-color: #55d6a7; }
.document-upload-state-notice.amber { border-color: #f5bd56; }
.document-upload-state-notice.red { border-color: #ff8585; }
.document-upload-state-notice span { color: var(--muted); font-size: 10px; }
.document-upload-detail-actions { justify-content: flex-end; margin-top: 14px; }

.document-upload-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111c29;
}
.document-upload-dialog::backdrop { background: rgba(2, 8, 15, 0.72); }
.document-upload-dialog form { display: grid; gap: 12px; padding: 16px; }
.document-upload-dialog label { color: var(--muted); font-size: 10px; }
.document-upload-dialog select { width: 100%; min-height: 36px; }
.document-upload-file-row {
  min-height: 52px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 6px;
}
.document-upload-file-row span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-upload-command-actions { justify-content: flex-end; gap: 8px; }

@media (max-width: 1180px) {
  .document-upload-layout { grid-template-columns: 1fr; }
}

.document-screen-head,
.document-toolbar,
.document-detail-meta,
.document-viewer-meta,
.document-pagination {
  display: flex;
  align-items: center;
}

.document-screen-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.document-screen-head h3 { margin: 0 0 4px; font-size: 16px; }
.document-screen-head p { margin: 0; color: var(--muted); }
.document-toolbar { gap: 8px; flex-wrap: wrap; }
.document-toolbar label { color: var(--muted); font-size: 10px; }
.document-toolbar select { min-width: 142px; height: 34px; }
.document-toolbar button { min-height: 34px; }
.document-toolbar button:disabled { cursor: not-allowed; opacity: 0.5; }

.document-message { min-height: 28px; padding: 6px 10px; color: var(--muted); }
.document-message.error { color: #ff9f9f; }
.document-message.success { color: #8ff0ce; }
.document-message.loading::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--blue); }

.document-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.document-metric { min-height: 64px; padding: 10px 12px; background: rgba(255,255,255,0.035); border: 1px solid var(--border); border-radius: 6px; }
.document-metric span { display: block; color: var(--muted); font-size: 10px; }
.document-metric strong { display: block; margin-top: 7px; font-size: 18px; }

.document-processing-layout { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(340px, 0.9fr); gap: 12px; }
.document-list-panel, .document-detail-panel { min-height: 540px; }
.document-table-wrap { max-height: 455px; overflow: auto; }
.document-table { table-layout: fixed; }
.document-table th, .document-table td { padding: 9px 7px; font-size: 12px; }
.document-table th:first-child { width: 20%; }
.document-table th:nth-child(2) { width: 14%; }
.document-table th:nth-child(3) { width: 16%; }
.document-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.document-table tbody tr[data-document-id] { cursor: pointer; outline: none; }
.document-table tbody tr[data-document-id]:hover,
.document-table tbody tr[data-document-id]:focus,
.document-table tbody tr.selected { background: rgba(96,165,250,0.11); }
.document-progress { display: inline-block; width: 58px; height: 5px; margin-right: 6px; overflow: hidden; vertical-align: middle; background: rgba(255,255,255,0.08); }
.document-progress i { display: block; height: 100%; background: var(--accent-2); }
.document-pagination { justify-content: flex-end; gap: 8px; padding-top: 12px; }

.document-detail-panel h5, .document-block-detail h5 { margin: 16px 0 8px; font-size: 12px; }
.document-detail-meta { gap: 12px; color: var(--muted); font-size: 10px; }
.document-step-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.document-step-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px; background: rgba(255,255,255,0.025); }
.document-page-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.document-page-list button { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px; min-height: 58px; padding: 8px; text-align: left; }
.document-page-list button small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; }
.document-empty { display: grid; place-items: center; min-height: 90px; color: var(--muted); text-align: center; }
.document-empty.error { color: #ff9f9f; }

.document-viewer-layout { display: grid; grid-template-columns: minmax(560px, 1.55fr) minmax(360px, 0.85fr); gap: 12px; }
.document-evidence-panel, .document-block-panel { min-height: 650px; }
.document-viewer-meta { min-height: 34px; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.evidence-canvas { position: relative; width: min(100%, 680px); aspect-ratio: 1 / 1.18; margin: 8px auto; overflow: hidden; background: #111925; border: 1px solid var(--border); }
.asset-pending { position: absolute; inset: 0; display: grid; place-content: center; gap: 7px; color: #cbd5e1; text-align: center; }
.asset-pending span { color: #91a0b7; font-size: 10px; }
.evidence-overlay { position: absolute; min-width: 3px; min-height: 3px; padding: 0; border-radius: 2px; background: rgba(96,165,250,0.13); border: 1px solid rgba(96,165,250,0.65); }
.evidence-overlay.layout { border-style: dashed; background: rgba(94,234,212,0.06); border-color: rgba(94,234,212,0.45); }
.evidence-overlay.evidence { z-index: 2; }
.evidence-overlay.selected { z-index: 3; background: rgba(251,191,36,0.3); border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,0.18); }
.document-table-summary { display: flex; gap: 8px; flex-wrap: wrap; min-height: 32px; }
.document-table-summary > span { padding: 7px 9px; background: rgba(255,255,255,0.025); }
.document-block-list { display: grid; gap: 7px; max-height: 360px; overflow: auto; }
.document-block-list button { display: grid; gap: 5px; min-height: 55px; padding: 9px 10px; text-align: left; }
.document-block-list button span { color: var(--muted); font-size: 10px; }
.document-block-list button.selected { border-color: var(--amber); background: rgba(251,191,36,0.08); }
.document-block-detail { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.document-block-detail dl { display: grid; grid-template-columns: 90px 1fr; gap: 7px; margin: 0; }
.document-block-detail dt { color: var(--muted); }
.document-block-detail dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 1180px) {
  .document-summary { grid-template-columns: repeat(3, 1fr); }
  .document-processing-layout, .document-viewer-layout { grid-template-columns: 1fr; }
}
