/* PDF workbench — shared local document-processing interface. */
.pdf-workbench {
    display: grid;
    gap: var(--space-5);
}

.pdf-privacy-note {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
    color: var(--accent-ok);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.pdf-privacy-note::before {
    content: '';
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent);
}

.pdf-drop-zone {
    width: 100%;
    min-height: 190px;
    display: grid;
    place-content: center;
    gap: var(--space-2);
    padding: var(--space-7);
    border: 1px dashed var(--border-strong);
    border-radius: var(--panel-radius);
    color: var(--text);
    font: inherit;
    background:
        linear-gradient(var(--accent) 14px, transparent 14px) top left / 1px 32px no-repeat,
        linear-gradient(90deg, var(--accent) 14px, transparent 14px) top left / 32px 1px no-repeat,
        linear-gradient(-90deg, var(--accent) 14px, transparent 14px) bottom right / 32px 1px no-repeat,
        linear-gradient(-180deg, var(--accent) 14px, transparent 14px) bottom right / 1px 32px no-repeat,
        var(--surface-1);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out);
}

.pdf-drop-zone:hover,
.pdf-drop-zone:focus-visible,
.pdf-drop-zone.is-dragging {
    border-color: var(--accent);
    background-color: var(--accent-soft);
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.pdf-drop-zone strong {
    font-family: var(--font-display);
    font-size: var(--text-lg);
}

.pdf-drop-zone span {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.pdf-file-list {
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    overflow: hidden;
}

.pdf-file-row {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--surface-1);
}

.pdf-file-row:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.pdf-file-row:last-child { border-bottom: 0; }
.pdf-file-row > div:first-child { min-width: 0; }
.pdf-file-row > div:last-child { display: flex; gap: var(--space-1); }

.pdf-file-row strong,
.pdf-file-row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-file-row strong {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
}

.pdf-file-row span {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.pdf-row-button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-secondary);
    cursor: pointer;
}

.pdf-row-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pdf-row-button:disabled { opacity: .35; cursor: not-allowed; }

.pdf-options {
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background: var(--surface-1);
}

.pdf-options-grid,
.pdf-inspector-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.pdf-field {
    display: grid;
    align-content: start;
    gap: var(--space-2);
}

.pdf-field label,
.pdf-check {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 500;
}

.pdf-field small {
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.pdf-check {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.pdf-caution {
    margin: var(--space-4) 0 0;
    padding: var(--space-3);
    border-left: 3px solid var(--marker);
    background: color-mix(in srgb, var(--marker) 10%, var(--surface-1));
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.pdf-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.pdf-action-row button { min-height: 40px; }

.pdf-status {
    min-height: 22px;
    margin: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}

.pdf-status[data-tone="error"] { color: var(--accent-danger); }
.pdf-status[data-tone="success"] { color: var(--accent-ok); }

.pdf-output {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--accent-ok);
    border-radius: var(--panel-radius);
    background: color-mix(in srgb, var(--accent-ok) 8%, var(--surface-1));
}

.pdf-output[hidden] { display: none; }
.pdf-output span,
.pdf-output strong { display: block; }
.pdf-output span { color: var(--text-muted); font-size: var(--text-xs); }
.pdf-output strong { margin-top: 3px; font-family: var(--font-mono); }

.pdf-inspector-result {
    display: grid;
    gap: var(--space-4);
    margin-top: var(--space-3);
}

.pdf-inspector-result[hidden] { display: none; }

.pdf-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    overflow: hidden;
}

.pdf-metric {
    min-width: 0;
    padding: var(--space-3);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface-1);
}

.pdf-metric:nth-child(4n) { border-right: 0; }
.pdf-metric:nth-last-child(-n+4) { border-bottom: 0; }
.pdf-metric span,
.pdf-metric strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.pdf-metric span { color: var(--text-muted); font: 500 var(--text-xs)/1.2 var(--font-mono); }
.pdf-metric strong { margin-top: var(--space-2); font-size: var(--text-sm); }
.pdf-metric--alert strong { color: var(--accent-danger); }

.pdf-markdown {
    min-height: 320px;
    max-height: 620px;
    margin: 0;
    padding: var(--space-5);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--panel-radius);
    background: var(--code-bg);
    color: var(--code-text);
    font: 400 var(--text-sm)/1.65 var(--font-mono);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .pdf-options-grid,
    .pdf-inspector-options { grid-template-columns: 1fr; }
    .pdf-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pdf-metric:nth-child(4n) { border-right: 1px solid var(--border); }
    .pdf-metric:nth-child(2n) { border-right: 0; }
    .pdf-metric:nth-last-child(-n+4) { border-bottom: 1px solid var(--border); }
    .pdf-metric:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 520px) {
    .pdf-drop-zone { min-height: 160px; padding: var(--space-5); }
    .pdf-output { align-items: stretch; flex-direction: column; }
    .pdf-file-row { align-items: flex-start; }
}
