.document-sorter-shell { max-width: 1480px; margin: 0 auto; padding: 0 12px 48px; }
.document-sorter { --ds-border: #ded5c5; --ds-muted: #6d685e; display: grid; gap: 18px; color: var(--text, #201d18); }
.ds-hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding: 30px; color: #fff; border-radius: 28px; background: linear-gradient(135deg, #1b1812, #2b2417); box-shadow: 0 14px 35px #1c160e20; }
.ds-hero h1 { margin: 4px 0 8px; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.8rem); }
.ds-hero p { max-width: 780px; margin: 0; color: #e7dfd2; }
.ds-kicker { color: #c8a34d; font-size: .73rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ds-health { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ds-health article, .ds-card { border: 1px solid var(--ds-border); border-radius: 20px; background: var(--surface, #fff); box-shadow: 0 7px 20px #3227160c; }
.ds-health article { padding: 18px; display: grid; gap: 5px; }
.ds-health span, .ds-health small, .ds-meta, .ds-route small, .ds-job small { color: var(--ds-muted); }
.ds-health strong { font-size: 1.15rem; }
.ds-card { padding: 22px; }
.ds-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.ds-card-head h2 { margin: 3px 0 0; font-family: Georgia, serif; font-size: 1.65rem; }
.ds-form-row, .ds-route-form, .ds-review form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 14px; }
.ds-form-row { grid-template-columns: minmax(300px, 1fr) auto auto; }
.ds-form-row label, .ds-route-form label, .ds-review label { display: grid; gap: 7px; font-weight: 700; font-size: .86rem; }
.ds-form-row input, .ds-route-form input, .ds-review input, .ds-review select { width: 100%; min-height: 45px; border: 1px solid var(--ds-border); border-radius: 11px; background: var(--surface, #fff); color: inherit; padding: 10px 12px; }
.ds-toggle { display: flex !important; flex-direction: row; align-items: center; padding: 11px 0; white-space: nowrap; }
.ds-toggle input { width: 20px; min-height: 20px; }
.ds-wide { grid-column: 1 / -1; }
.ds-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-route-list { display: grid; gap: 8px; margin-top: 18px; }
.ds-route { display: flex; justify-content: space-between; gap: 15px; align-items: center; padding: 13px 14px; border: 1px solid var(--ds-border); border-radius: 12px; }
.ds-route > div:first-child { display: grid; gap: 3px; }
.ds-route.disabled { opacity: .55; }
.ds-alert { border-radius: 12px; padding: 12px 15px; font-weight: 700; }
.ds-alert.error, .ds-inline-error { color: #8b241d; background: #fff0ed; }
.ds-alert.success { color: #1d6740; background: #eaf8ef; }
.ds-inline-error { padding: 8px 10px; border-radius: 8px; }
.ds-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 8px; }
.ds-workspaces { display: flex; gap: 8px; padding: 6px; border: 1px solid var(--ds-border); border-radius: 16px; background: color-mix(in srgb, var(--surface, #fff) 88%, #d7c8a9); }
.ds-workspaces button { flex: 1; min-height: 46px; border: 0; border-radius: 11px; color: inherit; background: transparent; font-weight: 800; cursor: pointer; }
.ds-workspaces button.active { color: #fff; background: #221d14; }
.ds-workspaces span { display: inline-flex; min-width: 24px; justify-content: center; margin-left: 6px; padding: 2px 6px; border-radius: 999px; background: #c8a34d; color: #18140e; }
.ds-tabs button { border: 1px solid var(--ds-border); border-radius: 999px; background: var(--surface, #fff); color: inherit; padding: 8px 12px; white-space: nowrap; cursor: pointer; }
.ds-tabs button.active { color: #fff; background: #221d14; border-color: #221d14; }
.ds-jobs { display: grid; gap: 7px; margin-top: 10px; }
.ds-job { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 12px; text-align: left; border: 1px solid var(--ds-border); border-radius: 12px; background: var(--surface, #fff); color: inherit; cursor: pointer; }
.ds-job.selected { outline: 2px solid #bd9342; background: color-mix(in srgb, var(--surface, #fff) 94%, #c49b4a); }
.ds-job > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.ds-job time { color: var(--ds-muted); font-size: .78rem; }
.ds-status { display: inline-flex; justify-content: center; padding: 5px 8px; border-radius: 999px; background: #efeae0; font-size: .74rem; font-weight: 800; }
.ds-status.review_required, .ds-status.failed { background: #ffe8e2; color: #8a261e; }
.ds-status.copied { background: #e5f6eb; color: #21623f; }
.ds-status.processing, .ds-status.copying { background: #e4f0fa; color: #1b537d; }
.ds-review { margin-top: 20px; padding-top: 22px; border-top: 2px solid var(--ds-border); }
.ds-evidence { padding: 14px; border-radius: 12px; background: color-mix(in srgb, var(--surface, #fff) 90%, #d7c8a9); }
.ds-evidence p { display: grid; grid-template-columns: 180px 1fr; gap: 12px; margin: 8px 0 0; }
.ds-evidence span { color: var(--ds-muted); font-weight: 700; }
.ds-analysis { display: grid; gap: 14px; margin: 8px 0; padding: 18px; border: 1px solid var(--ds-border); border-radius: 15px; background: color-mix(in srgb, var(--surface, #fff) 94%, #d7c8a9); }
.ds-analysis h3, .ds-analysis h4, .ds-analysis p { margin: 0; }
.ds-analysis-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ds-analysis-grid, .ds-statement-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.ds-analysis-grid article, .ds-statement-summary article, .ds-field-list article, .ds-comparison-list article { display: grid; gap: 4px; padding: 11px; border: 1px solid var(--ds-border); border-radius: 10px; background: var(--surface, #fff); }
.ds-analysis-grid span, .ds-statement-summary span, .ds-field-list span, .ds-comparison-list span { color: var(--ds-muted); font-size: .75rem; font-weight: 800; text-transform: capitalize; }
.ds-field-list, .ds-comparison-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.ds-field-list small, .ds-comparison-list small, .ds-review-items small, .ds-transactions small { color: var(--ds-muted); }
.ds-comparison-list article.match { border-left: 4px solid #2f9258; }
.ds-comparison-list article.mismatch { border-left: 4px solid #bf493d; }
.ds-comparison-list article.missing_in_document, .ds-comparison-list article.missing_in_application { border-left: 4px solid #c08e25; }
.ds-review-items { display: grid; gap: 8px; }
.ds-review-items article { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid var(--ds-border); border-radius: 10px; }
.ds-review-items p { margin-top: 3px; }
.ds-review-flag { display: inline-flex; width: max-content; padding: 4px 8px; border-radius: 999px; background: #f2e9d5; color: #725817; font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.ds-review-flag.high { background: #ffe1dc; color: #8b241d; }
.ds-review-flag.low { background: #e4f1e8; color: #21623f; }
.ds-bank-review { display: grid; gap: 16px; }
.ds-statement-summary { grid-template-columns: repeat(4, minmax(140px, 1fr)); }
.ds-table-wrap { overflow: auto; max-height: 68vh; border: 1px solid var(--ds-border); border-radius: 12px; }
.ds-transactions { width: 100%; min-width: 1120px; border-collapse: collapse; font-size: .82rem; }
.ds-transactions th { position: sticky; top: 0; z-index: 1; padding: 10px; text-align: left; color: #fff; background: #282116; }
.ds-transactions td { padding: 9px 10px; vertical-align: top; border-top: 1px solid var(--ds-border); }
.ds-transactions td:nth-child(1) { text-align: center; }
.ds-transactions td:nth-child(2), .ds-transactions td:nth-child(4), .ds-transactions td:nth-child(5) { white-space: nowrap; }
.ds-transactions td strong, .ds-transactions td small { display: block; }
.ds-transactions tr.highlighted { background: color-mix(in srgb, #f4cf6b 26%, var(--surface, #fff)); }
.ds-transactions textarea, .ds-bank-comment textarea { width: 100%; border: 1px solid var(--ds-border); border-radius: 8px; background: var(--surface, #fff); color: inherit; padding: 8px; resize: vertical; }
.ds-transaction-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.ds-transaction-flags span { padding: 2px 5px; border-radius: 5px; background: #f0e4c9; color: #684e13; font-size: .68rem; font-weight: 800; }
.ds-bank-comment { display: grid; gap: 7px; margin: 14px 0; font-weight: 800; }
.ds-empty { color: var(--ds-muted); padding: 18px 5px; }
.ds-count { border-radius: 999px; padding: 7px 10px; background: #eee7d8; color: #65501e; font-weight: 800; }
.button.danger { color: #8b241d; border-color: #d9a8a1; }
html[data-theme="dark"] .document-sorter { --ds-border: #49443a; --ds-muted: #bbb3a5; }
html[data-theme="dark"] .ds-alert.error, html[data-theme="dark"] .ds-inline-error { background: #3d201d; color: #ffb9ae; }
html[data-theme="dark"] .ds-alert.success { background: #173426; color: #a9e7bd; }
html[data-theme="dark"] .ds-count { background: #403720; color: #e8ca7a; }
@media (max-width: 850px) {
  .ds-health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-form-row, .ds-route-form, .ds-review form { grid-template-columns: 1fr; }
  .ds-wide { grid-column: auto; }
  .ds-job { grid-template-columns: 1fr; }
  .ds-job time { display: none; }
  .ds-analysis-grid, .ds-statement-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-field-list, .ds-comparison-list { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .document-sorter-shell { padding: 0 4px 32px; }
  .ds-hero, .ds-card { padding: 17px; border-radius: 17px; }
  .ds-health { grid-template-columns: 1fr; }
  .ds-hero { flex-direction: column; }
  .ds-evidence p { grid-template-columns: 1fr; }
  .ds-workspaces { flex-direction: column; }
  .ds-analysis-grid, .ds-statement-summary { grid-template-columns: 1fr; }
}
