/* Anonimizacja dokumentów PDF i DOCX (uzupełnia prompt-anonymizer.css). */
/* Jedna kolumna 1120px jak w VAT i KSeF: wyrównana z nagłówkiem, narzędzie i treść pod nim tej samej szerokości.
   Wcześniej narzędzie miało 1240px (szersze niż nagłówek), a treść 920px przyklejoną do lewej. */
.redaction-shell { width: min(1120px, calc(100% - 40px)); }
.redaction-shell > .tool-intro { max-width: 920px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.redaction-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: -12px 0 22px; }
.offline-badge { padding: 8px 10px; border-radius: 20px; color: #5f6475; background: #eef0f6; font-size: 12px; font-weight: 700; }
.offline-badge > span[aria-hidden] { margin-right: 5px; color: #a0a5b5; font-size: 9px; }
.offline-badge.is-ready { color: #21795e; background: #e9f8f2; }
.offline-badge.is-ready > span[aria-hidden] { color: #36ad82; }

.redaction-shell .tool-button { min-height: 40px; padding: 0 14px; border: 1px solid #e3e8f0; border-radius: 9px; color: #344054; background: #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
@media (hover: hover) and (pointer: fine) { .redaction-shell .tool-button:hover { border-color: #c8c8fa; background: #f8f7ff; } }
.redaction-shell .tool-button:focus-visible, .redaction-shell button:focus-visible, .redaction-shell a:focus-visible, .redaction-shell input:focus-visible, .redaction-shell select:focus-visible { outline: 3px solid rgb(var(--brand-rgb) / 35%); outline-offset: 2px; }
.redaction-shell .tool-button-primary { border-color: var(--brand); color: #fff; background: var(--brand); }
@media (hover: hover) and (pointer: fine) { .redaction-shell .tool-button-primary:hover { border-color: var(--brand-dark); color: #fff; background: var(--brand-dark); } }
.redaction-shell .tool-button-small { min-height: 34px; padding: 0 11px; font-size: 12px; }
.redaction-shell .tool-button[aria-pressed="true"] { border-color: #e8b931; color: #725300; background: #fff8d9; }
.redaction-shell .tool-button:disabled { color: #8a8fa0; background: #f4f5f8; cursor: not-allowed; }
.download-button.is-disabled { border-color: #d0d5dd !important; color: #8a8fa0 !important; background: #f4f5f8 !important; cursor: not-allowed; }

.redaction-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border: 1px solid #e3e8f0; border-radius: 12px; background: #fff; width: fit-content; }
.redaction-tabs [role="tab"] { min-height: 38px; padding: 0 16px; border: 0; border-radius: 8px; color: #4b5565; background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; }
.redaction-tabs [role="tab"][aria-selected="true"] { color: #fff; background: var(--brand); }

.redaction-stepper { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; }
.redaction-stepper button { min-height: 34px; padding: 0 12px; border: 1px solid #e3e8f0; border-radius: 999px; color: #4b5565; background: #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
.redaction-stepper button.is-active { border-color: var(--brand); color: #fff; background: var(--brand); }
.redaction-stepper button:disabled { color: #a0a5b5; cursor: not-allowed; }

.password-row, .redaction-progress { margin: 14px 0 0; padding: 12px 14px; border: 1px solid #e3e8f0; border-radius: 12px; background: #fff; }
.password-row label { display: block; margin-bottom: 8px; color: #45485a; font-size: 13px; font-weight: 650; }
.password-controls, .phrase-controls { display: flex; gap: 8px; }
.password-controls input, .phrase-controls input { flex: 1; min-width: 0; min-height: 40px; padding: 0 11px; border: 1px solid #d7deea; border-radius: 9px; font: inherit; font-size: 13px; }
.redaction-progress { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.redaction-progress progress { flex: 1 1 220px; height: 10px; accent-color: var(--brand); }
.redaction-progress span { color: #4b5565; font-size: 12px; }

.redaction-status { min-height: 18px; margin: 10px 0 0; color: #27795f; font-size: 12px; line-height: 1.55; }
.redaction-status:empty { min-height: 0; margin: 0; }
.redaction-status.is-error { color: #b42318; }
.redaction-status.is-warning { color: #8a5a00; }
.redaction-status.is-ok { color: #21795e; }

.dropzone { display: grid; justify-items: center; gap: 6px; padding: 34px 20px; border: 2px dashed #c9cdf8; border-radius: 14px; color: #4b5565; background: #fafaff; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.dropzone.is-dragover, .dropzone:focus-within { border-color: var(--brand); background: #f3f2ff; }
@media (hover: hover) and (pointer: fine) { .dropzone:hover { border-color: var(--brand); background: #f3f2ff; } }
.dropzone strong { color: #292b40; font-size: 15px; }
.dropzone span { max-width: 560px; font-size: 12px; line-height: 1.6; }
.dropzone .dropzone-icon { color: var(--brand); font-size: 24px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone-compact { padding: 22px 16px; }

.queue-title { margin: 20px 0 8px; color: #292b40; font-size: 15px; }
.file-queue { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.queue-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #edf0f4; border-radius: 10px; background: #fbfcfe; }
.queue-item.is-current { border-color: #c8c8fa; background: #f8f7ff; }
.queue-open { flex: 1 1 260px; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 0; border: 0; color: #292b40; background: transparent; cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.queue-open:disabled { cursor: default; }
.queue-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-kind { flex: 0 0 auto; padding: 3px 6px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 800; }
.kind-pdf { background: #c2410c; }
.kind-docx { background: #1d4ed8; }
.queue-status { font-size: 12px; font-weight: 700; color: #5f6475; }
.status-done { color: #21795e; }
.status-error, .status-failed { color: #b42318; }
.queue-error { flex-basis: 100%; color: #b42318; font-size: 12px; }

.review-card { padding-bottom: 18px; }
.review-warnings { margin: 0 0 14px; padding: 10px 14px 10px 30px; border: 1px solid #f0dfbd; border-radius: 10px; color: #715a2a; background: #fffaf0; font-size: 12px; line-height: 1.6; }
.review-layout { display: grid; grid-template-columns: 110px minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.review-pages, .review-findings { position: sticky; top: 12px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; }
/* Panel "Dodaj własne dane" i licznik zostają na miejscu, przewija się tylko lista znalezisk. */
.review-findings { display: flex; flex-direction: column; overflow: hidden; }
.review-findings > * { flex: none; }
.review-pages h3, .review-findings > h3 { margin: 0 0 8px; color: #292b40; font-size: 14px; }
.page-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.page-jump { width: 100%; display: flex; justify-content: space-between; gap: 6px; padding: 7px 8px; border: 1px solid #edf0f4; border-radius: 8px; color: #344054; background: #fff; cursor: pointer; font: inherit; font-size: 12px; text-align: left; }
@media (hover: hover) and (pointer: fine) { .page-jump:hover { border-color: #c8c8fa; } }
.page-flag { color: #5f6475; font-weight: 700; }
.page-flag.is-warning { color: #b54708; }

.preview { min-height: 320px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; padding: 12px; border: 1px solid #e3e8f0; border-radius: 12px; background: #eef0f6; }
.preview-page { position: relative; width: 100%; max-width: 900px; margin: 0 auto 14px; background: #fff; box-shadow: 0 2px 10px rgb(16 24 40 / 12%); }
.preview-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview-page-label { position: absolute; top: 6px; left: 8px; padding: 2px 6px; border-radius: 6px; color: #fff; background: rgb(41 43 64 / 70%); font-size: 12px; pointer-events: none; }
.preview-overlay .area { cursor: pointer; stroke-width: 1; vector-effect: non-scaling-stroke; }
.preview-overlay .area.is-pending { fill: rgb(255 214 51 / 38%); stroke: #c99700; }
.preview-overlay .area.is-pending.level-low { fill: rgb(255 214 51 / 18%); stroke-dasharray: 3 2; }
.preview-overlay .area.is-selected { fill: rgb(0 0 0 / 82%); stroke: #000; }
.preview-overlay .area.is-active { stroke: var(--brand); stroke-width: 3; }
.preview-overlay .area.is-drawing { fill: rgb(var(--brand-rgb) / 20%); stroke: var(--brand); stroke-dasharray: 4 3; }
.preview-pdf .preview-overlay { cursor: text; touch-action: pan-y; }
.preview.is-drawing .preview-overlay { cursor: crosshair; }
.preview.is-drawing .preview-overlay .area, .preview.is-drawing .preview-overlay .handle { pointer-events: none; }
/* Uchwyty krawędzi znaleziska (widoczne po najechaniu) i warstwy pomocnicze: wyniki wyszukiwania, zaznaczenie, nowy zakres. */
.preview-overlay .handle { stroke: transparent; stroke-width: 8px; stroke-linecap: round; vector-effect: non-scaling-stroke; cursor: ew-resize; }
.preview-overlay .finding.is-active .handle { stroke: rgb(var(--brand-rgb) / 70%); }
@media (hover: hover) and (pointer: fine) { .preview-overlay .finding:hover .handle { stroke: rgb(var(--brand-rgb) / 70%); } }
.preview-overlay .finding.is-resizing .area { fill: none; stroke: var(--brand); stroke-dasharray: 3 2; }
.preview-overlay .finding.is-resizing .handle { stroke: transparent; }
.preview-overlay .layer-search, .preview-overlay .layer-selection, .preview-overlay .layer-resize { pointer-events: none; }
.preview-overlay .search-hit { fill: rgb(var(--brand-rgb) / 12%); stroke: var(--brand); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.preview-overlay .selection-hit { fill: rgb(37 99 235 / 28%); }
.preview-overlay .resize-hit { fill: rgb(var(--brand-rgb) / 32%); stroke: var(--brand-dark); stroke-width: 1.5px; stroke-dasharray: 4 2; vector-effect: non-scaling-stroke; }
.scroll-marker { position: absolute; left: 0; width: 1px; height: 1px; pointer-events: none; }

.preview-docx { background: #fff; color: #292b40; font-size: 14px; line-height: 1.75; }
.docx-story + .docx-story { margin-top: 18px; padding-top: 12px; border-top: 1px dashed #d7deea; }
.docx-story h3 { margin: 0 0 8px; color: #5f6475; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.docx-paragraph { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.docx-paragraph.in-table { padding-left: 10px; border-left: 3px solid #e3e8f0; }
.hidden-kind { color: #5f6475; font-size: 12px; font-weight: 700; }
.preview-docx mark { padding: 0 1px; border-radius: 3px; cursor: pointer; color: inherit; }
.preview-docx mark.is-pending { outline: 1px solid #c99700; background: rgb(255 214 51 / 45%); }
.preview-docx mark.is-pending.level-low { outline-style: dashed; background: rgb(255 214 51 / 20%); }
.preview-docx mark.is-selected { color: #fff; background: #111; }
.preview-docx mark.is-active { box-shadow: 0 0 0 3px var(--brand); }
@media (hover: hover) and (pointer: fine) { .preview-docx mark:hover { box-shadow: inset 3px 0 0 var(--brand), inset -3px 0 0 var(--brand); } }
.preview-docx mark.is-resizing { outline: 1px dashed var(--brand); color: inherit; background: transparent; box-shadow: none; }
::highlight(wb-search) { background-color: rgb(var(--brand-rgb) / 24%); }
::highlight(wb-resize) { color: #1e1b4b; background-color: rgb(var(--brand-rgb) / 45%); }

.findings-list { display: grid; align-content: start; gap: 10px; }
.review-findings > .findings-list { flex: 1 1 auto; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.findings-empty { margin: 0; color: #5f6475; font-size: 12px; line-height: 1.6; }
.findings-level { padding: 10px; border: 1px solid #edf0f4; border-radius: 10px; background: #fbfcfe; }
.findings-level header { margin-bottom: 6px; }
.level-toggle, .category-toggle, .finding-check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.level-toggle { color: #292b40; font-size: 13px; font-weight: 800; }
.level-toggle input, .category-toggle input, .finding-check input { width: 16px; height: 16px; accent-color: #111; }
.level-hint { margin: 4px 0 0; color: #5f6475; font-size: 12px; line-height: 1.5; }
.level-high { border-left: 4px solid #111; }
.level-medium { border-left: 4px solid #b54708; }
.level-low { border-left: 4px solid #c9cdd8; }
.finding-category { margin-top: 6px; }
.finding-category summary { display: flex; align-items: center; gap: 7px; color: #344054; font-size: 12px; font-weight: 700; cursor: pointer; }
.finding-rows { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.finding-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 6px; padding: 6px 7px; border-radius: 8px; background: #fff; }
.finding-row.is-active { box-shadow: 0 0 0 2px var(--brand); }
.finding-value { overflow: hidden; color: #292b40; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.finding-check { min-width: 0; }
.finding-meta { grid-column: 1; color: #5f6475; font-size: 10.5px; line-height: 1.4; }
.finding-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; display: flex; gap: 4px; }
.finding-jump, .finding-remove { width: 28px; height: 28px; border: 1px solid #e3e8f0; border-radius: 7px; background: #fff; cursor: pointer; }
.finding-jump { color: var(--brand); }
.finding-remove { color: #b42318; font-size: 15px; line-height: 1; }
@media (hover: hover) and (pointer: fine) { .finding-remove:hover { border-color: #fecdca; background: #fef3f2; } }

.phrase-form { margin: 0 0 12px; padding: 11px 12px; border: 1px solid #e3e8f0; border-radius: 12px; background: #fbfcfe; display: grid; gap: 8px; }
.phrase-form label { color: #45485a; font-size: 12px; font-weight: 700; }
.phrase-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.phrase-head h3 { margin: 0; color: #292b40; font-size: 14px; }
#phrase-input { min-width: 0; min-height: 40px; padding: 0 11px; border: 1px solid #d7deea; border-radius: 9px; background: #fff; font: inherit; font-size: 13px; }
.phrase-controls input { background: #fff; }
.phrase-all { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.phrase-all input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.phrase-all:has(input:disabled) { color: #8a8fa0; cursor: default; }
.phrase-form .redaction-status { margin: 0; }
.phrase-form .redaction-status:empty { display: none; }
.status-action { margin-left: 2px; padding: 2px 9px; border: 1px solid #c8c8fa; border-radius: 999px; color: #4338ca; background: #f3f2ff; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 700; }
@media (hover: hover) and (pointer: fine) { .status-action:hover { background: #e9e7ff; } }
.kbd-hint { margin: 10px 0 0; color: #5f6475; font-size: 12px; line-height: 1.5; }

.settings-group { margin-bottom: 8px; }
.settings-group .scrubber-label:first-child { margin-top: 0; }
#output-name { font-family: inherit; }
.checklist { margin-top: 18px; padding: 12px 14px; border: 1px solid #e8eaf1; border-radius: 10px; background: #fbfcfe; }
.checklist h3 { margin: 0 0 6px; color: #292b40; font-size: 13px; }
.checklist ul { margin: 0; padding-left: 20px; color: #4b5565; font-size: 12px; line-height: 1.7; }

.verification-summary { margin: 0 0 12px; padding: 12px 14px; border-radius: 10px; font-size: 13px; font-weight: 650; line-height: 1.6; }
.verification-summary.is-ok { color: #155e47; background: #e9f8f2; border: 1px solid #b7e6d3; }
.verification-summary.is-fail { color: #912018; background: #fef3f2; border: 1px solid #fecdca; }
.verification-checks, .removed-list, .checker-results { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.verification-checks li { display: flex; flex-wrap: wrap; gap: 8px; color: #344054; font-size: 12px; line-height: 1.5; }
.check-icon { width: 18px; font-weight: 800; }
.verification-checks .is-ok .check-icon { color: #21795e; }
.verification-checks .is-fail { color: #b42318; }
.check-detail { color: #8a5a00; overflow-wrap: anywhere; }
.removed-section { margin-top: 16px; }
.removed-section h3 { margin: 0 0 6px; color: #292b40; font-size: 14px; }
.removed-list { display: flex; flex-wrap: wrap; gap: 6px; }
.removed-list li { padding: 5px 9px; border-radius: 999px; color: #344054; background: #f2f4f7; font-size: 11.5px; }
.override-row { color: #912018; }
.checker-results li { padding: 8px 10px; border: 1px solid #fecdca; border-radius: 8px; color: #912018; background: #fffbfa; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }

.table-scroll { overflow-x: auto; }
.redaction-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.55; }
.redaction-table th, .redaction-table td { padding: 8px 10px; border-bottom: 1px solid #edf0f4; text-align: left; vertical-align: top; color: #4b5565; }
.redaction-table thead th { color: #292b40; background: #f8f9fc; }
.redaction-table tbody th { color: #292b40; font-weight: 700; }

@media (max-width: 1080px) {
  .review-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .review-pages { display: none; }
}
@media (max-width: 760px) {
  .redaction-shell { width: min(100% - 30px, 640px); }
  .review-layout { grid-template-columns: 1fr; }
  .review-findings { position: static; max-height: none; order: -1; overflow: visible; }
  .review-findings > .findings-list { max-height: 55vh; }
  .preview { max-height: 70vh; padding: 6px; }
  .password-controls, .phrase-controls { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .dropzone, .redaction-shell .tool-button { transition: none; }
}
#step-upload h2:focus, #step-review h2:focus, #step-settings h2:focus, #step-result h2:focus { outline: none; }
