/* Документы: загрузка, таблица, версии и ход обработки. */
.upload-panel {
  border-bottom: 1px solid var(--border-subtle);
  margin: -4px -4px 20px;
  padding: 4px 4px 20px;
}

.upload-wizard-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
}

.upload-wizard-header h2 {
  margin: 0;
}

.upload-wizard-header span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  gap: 14px;
  align-items: end;
}

.upload-form label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.upload-form input[type="text"],
.upload-form input[type="file"] {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text-primary);
  background: var(--bg-overlay);
}

.upload-form input[type="file"] {
  padding: 8px 10px;
}

.upload-actions {
  display: flex;
  gap: 8px;
}

.upload-wizard-progress {
  border-top: 1px solid var(--border-subtle);
  margin-top: 18px;
  padding-top: 18px;
}

.upload-wizard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hidden-file-input {
  display: none;
}

.table-toolbar h2 {
  margin: 0;
}

.table-toolbar h2 small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.document-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.document-filters label {
  display: grid;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.document-filters input,
.document-filters select {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text-primary);
  background: var(--bg-overlay);
}

.filter-summary {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.documents-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.table-footer-info {
  color: var(--text-muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-overlay);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition:
    border-color 0.1s,
    color 0.1s,
    background 0.1s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.page-btn.active {
  border-color: var(--accent-dim);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

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

.document-record {
  border-top: 1px solid var(--border-subtle);
}

.documents-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(128px, 0.8fr) 72px 72px 96px 150px;
  gap: 14px;
  align-items: center;
  min-height: 54px;
  padding: 0 14px;
}

.documents-row:first-child {
  border-top: 0;
}

.documents-head {
  min-height: 38px;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.documents-row strong,
.documents-row small {
  display: block;
}

.documents-row small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

mark {
  display: inline-block;
  border-radius: 999px;
  background: var(--green-bg);
  color: var(--green);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.status-waiting {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

.status-processing {
  background: var(--blue-bg);
  color: var(--blue);
}

.status-ready {
  background: var(--green-bg);
  color: var(--green);
}

.status-failed {
  background: var(--red-bg);
  color: var(--red);
}

.documents-error-row {
  padding: 0 14px 12px;
  color: var(--red);
  font-size: 12px;
  line-height: 1.4;
}

.processing-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.processing-step {
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 74px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    var(--bg-overlay);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.processing-step::after {
  content: "";
  position: absolute;
  inset: auto 12px 0;
  height: 2px;
  border-radius: 999px 999px 0 0;
  background: var(--border);
  opacity: 0.65;
}

.processing-step-marker {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(33, 38, 45, 0.8);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.processing-step-copy {
  flex: 1;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.processing-step-copy span,
.processing-step-copy strong {
  overflow-wrap: anywhere;
}

.processing-step-copy span {
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 750;
  line-height: 1.25;
}

.processing-step-copy strong {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.processing-step-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
}

.processing-step-heading strong {
  justify-self: end;
  white-space: nowrap;
}

.processing-step-copy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.pipeline-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(13, 148, 136, 0.08), rgba(88, 166, 255, 0.03)),
    var(--bg-overlay);
}

.pipeline-summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pipeline-summary-title {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 800;
}

.pipeline-summary-text {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.pipeline-summary-header strong {
  color: var(--accent-bright);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.pipeline-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(48, 54, 61, 0.78);
}

.pipeline-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  box-shadow: 0 0 18px rgba(13, 148, 136, 0.32);
  transition: width 0.22s ease;
}

.processing-steps-list {
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 0;
}

.processing-steps-list .processing-step {
  align-items: flex-start;
  min-height: auto;
  padding: 14px 16px;
}

.processing-steps-list .processing-step::after {
  display: none;
}

.processing-steps-list .processing-step-marker {
  position: relative;
  z-index: 1;
}

.processing-step.step-active {
  border-color: rgba(88, 166, 255, 0.42);
  background:
    linear-gradient(145deg, rgba(88, 166, 255, 0.14), rgba(88, 166, 255, 0.03)),
    var(--bg-overlay);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(88, 166, 255, 0.08),
    0 10px 26px rgba(88, 166, 255, 0.06);
}

.processing-step.step-active::after {
  background: var(--blue);
}

.processing-step.step-completed,
.processing-step.step-ready {
  border-color: rgba(63, 185, 80, 0.38);
  background:
    linear-gradient(145deg, rgba(63, 185, 80, 0.13), rgba(63, 185, 80, 0.025)),
    var(--bg-overlay);
}

.processing-step.step-completed::after,
.processing-step.step-ready::after {
  background: var(--green);
}

.processing-step.step-failed {
  border-color: rgba(248, 81, 73, 0.42);
  background:
    linear-gradient(145deg, rgba(248, 81, 73, 0.13), rgba(248, 81, 73, 0.025)),
    var(--bg-overlay);
}

.processing-step.step-failed::after {
  background: var(--red);
}

.processing-step.step-waiting {
  opacity: 0.78;
}

.processing-step.step-completed .processing-step-marker,
.processing-step.step-ready .processing-step-marker {
  border-color: rgba(63, 185, 80, 0.45);
  background: rgba(35, 134, 54, 0.18);
  color: var(--green);
}

.processing-step.step-active .processing-step-marker {
  border-color: rgba(88, 166, 255, 0.5);
  background: rgba(88, 166, 255, 0.14);
  color: var(--blue);
}

.processing-step.step-failed .processing-step-marker {
  border-color: rgba(248, 81, 73, 0.5);
  background: rgba(248, 81, 73, 0.14);
  color: var(--red);
}

.processing-step.step-completed .processing-step-marker span,
.processing-step.step-ready .processing-step-marker span,
.processing-step.step-failed .processing-step-marker span {
  display: none;
}

.processing-step.step-completed .processing-step-marker::before,
.processing-step.step-ready .processing-step-marker::before {
  content: "✓";
}

.processing-step.step-failed .processing-step-marker::before {
  content: "!";
}

.processing-step.step-completed .processing-step-copy strong,
.processing-step.step-ready .processing-step-copy strong {
  color: var(--green);
}

.processing-step.step-active .processing-step-copy strong {
  color: var(--blue);
}

.processing-step.step-failed .processing-step-copy strong {
  color: var(--red);
}

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

.link-button {
  min-height: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
}

.link-button:hover {
  text-decoration: underline;
}

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

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

button.danger {
  border-color: var(--red-border);
  color: var(--red);
  background: var(--red-bg);
}

.link-button:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
}

.muted,
.error,
.warning-text {
  margin: 0 0 14px;
}

.error {
  color: var(--red);
}

.warning-text {
  color: var(--amber);
  font-size: 13px;
  font-weight: 700;
}
