:root {
  --canvas: #f6f4f0;
  --surface: #ffffff;
  --surface-muted: #efebe4;
  --surface-hover: #f6f3ec;
  --ink: #2a2620;
  --muted: #6e6558;
  --accent: #087969;
  --accent-hover: #065f53;
  --accent-tint: #e4f3ed;
  --danger: #ad3339;
  --danger-tint: #fbecef;
  --warning: #92520d;
  --border: #ddd7cb;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .48; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #cbe9e2; color: var(--ink); }
input { caret-color: var(--accent); }
svg { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 1.8; }
.container { max-width: 1320px; padding: 0 28px 40px; margin: auto; }
.app-header { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: 0; }
h1 span { font-weight: 400; color: var(--muted); }
.privacy-note { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.privacy-note svg { width: 15px; height: 15px; }
.app-intro { color: var(--muted); font-size: 14px; padding-bottom: 4px; }
.file-error { color: var(--danger); font-size: 12px; margin: 10px 0 0; }
.file-error:empty { display: none; }
.intake { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 20px 0 16px; }
.dropzone { width: 100%; display: flex; align-items: center; text-align: left; gap: 16px; background: var(--surface); border: 1px dashed #b5aa97; border-radius: 6px; padding: 20px; color: var(--ink); transition: background .15s, border-color .15s; }
.dropzone > svg { width: 30px; height: 30px; color: var(--accent); }
.dropzone strong { display: block; font-size: 14px; font-weight: 600; }
.dropzone small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: var(--accent-tint); }
.upload-action { margin-left: auto; color: var(--accent); font-size: 14px; font-weight: 600; }
.controls-bar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 14px; }
.config-fields, .actions { display: flex; align-items: center; gap: 8px; }
.config-fields { gap: 20px; }
.form-group { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.form-group > span { white-space: nowrap; }
.form-input, .form-select { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 8px 10px; min-height: 38px; color: var(--ink); font-size: 14px; min-width: 0; font-variant-numeric: tabular-nums; }
.year-input { width: 84px; }
.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 4px; padding: 8px 13px; font-size: 14px; font-weight: 550; white-space: nowrap; transition: background .15s; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary, .btn-outline { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover:not(:disabled), .btn-outline:hover:not(:disabled) { background: var(--surface-muted); }
.btn-danger { color: var(--danger); background: var(--danger-tint); }
.icon-btn { width: 38px; padding: 0; flex-shrink: 0; }
.progress-section { flex-direction: column; gap: 8px; padding-top: 16px; }
.progress-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--muted); }
#progressStatus { overflow-wrap: anywhere; }
#progressText { white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-track { background: var(--surface-muted); height: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.batch-summary { padding: 22px 0 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; border-bottom: 1px solid var(--border); }
.summary-metrics { display: flex; gap: 32px; align-items: baseline; flex-wrap: wrap; }
.summary-metrics > div { display: flex; flex-direction: column; gap: 3px; }
.summary-metrics span { font-size: 12px; color: var(--muted); }
.summary-metrics strong { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.exports-toolbar { align-items: center; gap: 8px; }
.export-menu { position: relative; }
.export-menu summary { list-style: none; }
.export-menu summary::-webkit-details-marker { display: none; }
.export-options { position: absolute; top: calc(100% + 6px); right: 0; min-width: 168px; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 4px; box-shadow: 0 6px 16px #2a262014; }
.menu-item { display: block; background: none; border: none; width: 100%; text-align: left; padding: 10px; color: var(--ink); font-size: 14px; }
.menu-item:hover { background: var(--surface-muted); }
.daily-summary { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.daily-summary summary { width: fit-content; }
#dailyRows { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.daily-item { font-variant-numeric: tabular-nums; color: var(--ink); }
.results-section { padding-top: 22px; }
.results-toolbar { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.results-heading { display: flex; align-items: baseline; gap: 12px; }
h2 { font-size: 18px; font-weight: 650; }
#reviewCount { font-size: 12px; color: var(--muted); }
.result-filters { display: flex; gap: 8px; }
.search-field { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0 10px; }
.search-field svg { color: var(--muted); width: 16px; height: 16px; }
.search-field input { width: 210px; min-height: 36px; border: 0; outline-offset: 0; background: transparent; font-size: 12px; min-width: 0; }
.review-note { color: var(--muted); font-size: 12px; margin: 10px 0 14px; }
.table-wrapper { width: 100%; background: var(--surface); overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; table-layout: fixed; }
.results-table th { background: var(--surface-muted); color: var(--muted); font-weight: 500; padding: 10px; font-size: 12px; border-block: 1px solid var(--border); }
.results-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; vertical-align: middle; overflow-wrap: anywhere; }
.results-table tbody tr:hover { background: var(--surface-hover); }
.results-table th:nth-child(1) { width: 58px; }
.results-table th:nth-child(2) { width: auto; }
.results-table th:nth-child(3) { width: 75px; }
.results-table th:nth-child(4) { width: 110px; }
.results-table th:nth-child(5) { width: 100px; text-align: right; }
.results-table th:nth-child(6) { width: 85px; }
.results-table th:nth-child(9) { width: 54px; }
.results-table th:nth-child(10) { width: 156px; }
.results-table td:nth-child(5) { text-align: right; font-weight: 600; }
.results-table :is(th,td):nth-child(7), .results-table :is(th,td):nth-child(8) { display: none; }
.document-title { display: block; font-weight: 550; line-height: 1.5; }
.document-filename { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.rotation-label { display: inline-block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.thumb-preview { width: 36px; height: 44px; object-fit: contain; background: var(--surface-muted); border-radius: 3px; }
.thumb-button { display: block; border: 0; padding: 0; background: none; cursor: pointer; }
.pill { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 3px; font-size: 12px; white-space: nowrap; }
.pill-invoice { background: var(--accent-tint); color: var(--accent); }
.pill-medical { background: #ece6d8; color: #6a5a2f; }
.pill-unknown { background: var(--danger-tint); color: var(--danger); }
.review-cell { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.confidence-value { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.review-link { border: 0; background: transparent; padding: 8px 0; color: var(--accent); min-height: 36px; font-size: 12px; cursor: pointer; }
.review-link.needs-attention { color: var(--danger); }
.reviewed-label { color: var(--accent); }
.filter-empty { padding: 24px 0; text-align: center; color: var(--muted); }
.review-panel { margin: 0 0 20px; border-block: 1px solid var(--border); background: var(--surface); }
.review-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; gap: 12px; border-bottom: 1px solid var(--border); }
h3 { font-size: 14px; font-weight: 600; }
#reviewPosition { font-size: 12px; color: var(--muted); white-space: nowrap; }
.review-workspace { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); min-width: 0; }
.review-image-button { position: relative; border: none; padding: 16px; background: var(--surface-muted); min-height: 300px; display: flex; align-items: center; justify-content: center; cursor: zoom-in; }
.review-image-button img { max-width: 100%; max-height: 430px; object-fit: contain; }
.review-image-button span { position: absolute; bottom: 12px; right: 12px; background: var(--surface); padding: 5px 8px; font-size: 12px; color: var(--muted); border-radius: 3px; }
.review-form { padding: 20px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.review-scores { display: flex; gap: 32px; }
.review-scores div { display: flex; flex-direction: column; gap: 2px; }
.review-scores span { font-size: 12px; color: var(--muted); }
.review-scores strong { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.review-warning, .review-error { font-size: 12px; color: var(--danger); }
.review-warning:empty, .review-error:empty { display: none; }
.review-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.review-fields label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.ocr-disclosure { font-size: 12px; }
.ocr-disclosure summary { color: var(--muted); }
.ocr-disclosure pre { white-space: pre-wrap; max-height: 150px; overflow: auto; font: inherit; overflow-wrap: anywhere; margin-bottom: 0; }
.ocr-disclosure .document-filename { margin-top: 8px; }
.review-form-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.image-dialog { width: min(1100px,94vw); max-height: 94vh; border: 0; padding: 0; border-radius: 6px; color: var(--ink); background: var(--surface); }
.image-dialog::backdrop { background: #241f19b3; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.site-footer a { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none; min-height: 40px; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.site-footer svg { width: 16px; height: 16px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; gap: 16px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 14px; overflow-wrap: anywhere; }
.modal-body { padding: 12px; text-align: center; }
.modal-body img { max-width: 100%; max-height: 78vh; object-fit: contain; }
@media (max-width: 900px) {
  .container { padding-inline: 18px; }
  .results-table th:nth-child(3) { width: 64px; }
  .results-table th:nth-child(4) { width: 100px; }
  .results-table th:nth-child(10) { width: 118px; }
}
@media (max-width: 680px) {
  .container { padding: 0 16px 28px; }
  .app-header { min-height: 80px; flex-wrap: wrap; gap: 4px; padding-block: 14px; }
  h1 { font-size: 18px; }
  .privacy-note { font-size: 12px; }
  .intake { padding-top: 14px; }
  .dropzone { padding: 16px 12px; gap: 10px; }
  .upload-action { display: none; }
  .config-fields { width: 100%; gap: 12px; }
  .form-group:last-child { flex: 1; min-width: 0; }
  .form-group:last-child select { width: 100%; }
  .controls-bar { flex-wrap: wrap; }
  .actions { margin-left: auto; }
  .btn, .form-input, .form-select { min-height: 42px; }
  .icon-btn { width: 42px; }
  .batch-summary { display: flex !important; flex-wrap: wrap; gap: 16px; }
  .batch-summary[style*="none"] { display: none !important; }
  .summary-metrics { width: 100%; gap: 22px; }
  .exports-toolbar { margin-left: auto; }
  .daily-summary { width: 100%; }
  .results-toolbar, .result-filters { width: 100%; }
  .search-field { flex: 1; min-width: 0; }
  .search-field input { width: 100%; }
  .result-filters select { max-width: 120px; }
  .review-note { line-height: 1.6; }
  .table-wrapper { overflow: visible; background: transparent; }
  .results-table, .results-table tbody { display: block; width: 100%; }
  .results-table thead { display: none; }
  .results-table tr { display: grid; grid-template-columns: 46px minmax(0,1fr) 86px; gap: 6px 10px; padding: 14px 0; border-bottom: 1px solid var(--border); }
  .results-table td { border: none; padding: 0; width: auto; }
  .results-table td:nth-child(1) { grid-column: 1; grid-row: 1 / 4; }
  .results-table td:nth-child(2) { grid-column: 2; grid-row: 1; }
  .results-table td:nth-child(3) { grid-column: 2; grid-row: 3; }
  .results-table td:nth-child(4) { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 12px; }
  .results-table td:nth-child(5) { grid-column: 3; grid-row: 1; }
  .results-table td:nth-child(6) { grid-column: 2; grid-row: 4; font-size: 12px; }
  .results-table td:nth-child(9) { grid-column: 1; grid-row: 4; }
  .results-table td:nth-child(10) { grid-column: 3; grid-row: 2 / 5; }
  .review-cell { flex-direction: column; align-items: flex-end; gap: 0; }
  .review-link { min-height: 42px; }
  .review-workspace { grid-template-columns: 1fr; }
  .review-image-button { min-height: 0; padding: 12px; }
  .review-image-button img { max-height: 250px; }
  .review-header { padding: 10px 12px; }
  .review-header .actions { gap: 4px; }
  .review-form { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
