.sp-pdf-view-container,
.pdf-viewer-host {
    width: 100%;
    min-height: 320px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.pdf-viewer-host {
    min-height: 0;
}

.pdf-viewer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    background: var(--main-background-color, #fff);
}

.pdf-viewer-toolbar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius-full);
    background: var(--main-background-color, #fff);
    color: var(--color-ink, #111827);
    font: 600 12px/1 system-ui, sans-serif;
    cursor: pointer;
}

.pdf-viewer-toolbar button.is-active,
.pdf-viewer-toolbar button:hover {
    background: rgba(79, 110, 247, 0.09);
    border-color: rgba(79, 110, 247, 0.26);
}

.pdf-viewer-tool-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-right: 1px solid var(--border-color, #e5e7eb);
    border-left: 1px solid var(--border-color, #e5e7eb);
    background: rgba(248, 250, 252, 0.96);
}

.pdf-viewer-tool-options label,
.pdf-viewer-tool-options button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    color: var(--color-ink, #111827);
    font: 600 12px/1 system-ui, sans-serif;
}

.pdf-viewer-tool-options input[type="number"] {
    width: 64px;
}

.pdf-viewer-tool-options input[type="range"] {
    width: 96px;
}

.pdf-viewer-tool-options button {
    padding: 4px 9px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius-full);
    background: var(--main-background-color, #fff);
    cursor: pointer;
}

.pdf-viewer-tool-options button.is-active {
    background: rgba(79, 110, 247, 0.09);
    border-color: rgba(79, 110, 247, 0.35);
}

.pdf-toolbar-status {
    min-width: 46px;
    text-align: center;
    font-size: 12px;
    color: var(--color-ink-light, #64748b);
}

.pdf-viewer-body,
.pdf-viewer-shell {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 420px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    overflow: auto;
    background: #eef2f7;
}

.side-panel-body .ncp-media-wrap-pdf,
.side-panel-body .sp-modality-pdf-editor,
.side-panel-body .sp-pdf-view-container {
    min-height: 0;
    max-height: min(760px, calc(var(--interface-viewport-height, 100vh) - 220px));
}

.side-panel-body .sp-pdf-view-container {
    height: min(760px, calc(var(--interface-viewport-height, 100vh) - 220px));
}

.side-panel-body .pdf-viewer-body,
.side-panel-body .pdf-viewer-shell {
    min-height: 0;
    overscroll-behavior: contain;
}

.pdf-page-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 16px;
}

.pdf-page {
    position: relative;
    flex: 0 0 auto;
    background: #fff;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
    touch-action: none;
}

.pdf-page-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.pdf-edit-layer,
.pdf-comment-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pdf-edit-layer {
    z-index: 2;
}

.pdf-viewer-shell[data-pdf-mode="edit"] .pdf-edit-layer {
    pointer-events: auto;
}

.pdf-viewer-shell[data-pdf-tool="draw"] .pdf-page,
.pdf-viewer-shell[data-pdf-tool="draw"] .pdf-edit-layer {
    cursor: crosshair;
}

.pdf-comment-layer {
    z-index: 3;
    pointer-events: auto;
}

.pdf-viewer-shell[data-pdf-mode="edit"] .pdf-comment-layer {
    pointer-events: none;
}

.pdf-drawing-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.pdf-drawing-layer--live {
    z-index: 2;
}

.pdf-text-layer-item {
    position: absolute;
    box-sizing: border-box;
    white-space: pre-wrap;
    overflow: hidden;
    pointer-events: none;
}

.pdf-text-layer-item.is-editable {
    cursor: move;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
}

.pdf-text-layer-item.is-selected,
.pdf-text-layer-item.is-editable:hover {
    outline: 1px solid rgba(37, 99, 235, 0.75);
    background: rgba(255, 255, 255, 0.42);
}

.pdf-text-resize-handle {
    display: none;
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 14px;
    height: 14px;
    border: 1px solid rgba(37, 99, 235, 0.9);
    border-radius: 50%;
    background: #fff;
    cursor: nwse-resize;
    touch-action: none;
}

.pdf-text-layer-item.is-selected .pdf-text-resize-handle {
    display: block;
}

.pdf-text-layer-editor {
    position: absolute;
    z-index: 3;
    box-sizing: border-box;
    min-width: 80px;
    min-height: 32px;
    padding: 4px 6px;
    border: 1px solid rgba(37, 99, 235, 0.75);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.94);
    color: #111827;
    font: 500 14px/1.25 Helvetica, Arial, sans-serif;
    resize: both;
    pointer-events: auto;
}

.pdf-comment-rect {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid rgba(245, 158, 11, 0.9);
    background: rgba(245, 158, 11, 0.14);
    border-radius: 3px;
    cursor: pointer;
}

.pdf-comment-rect.is-active,
.pdf-comment-rect:focus-visible,
.pdf-comment-rect:hover {
    outline: none;
    border-color: rgba(37, 99, 235, 0.95);
    background: rgba(37, 99, 235, 0.14);
}

.pdf-comment-rect--draft {
    pointer-events: none;
    border-style: dashed;
}

.pdf-loading,
.pdf-error {
    padding: 24px;
    color: var(--color-ink-light, #64748b);
    text-align: center;
}

.pdf-static-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    color: var(--color-ink-light, #64748b);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(245, 158, 11, 0.08));
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.pdf-static-preview-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    text-align: center;
}

.pdf-static-preview-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    background: #fff;
}

.pdf-static-preview[data-pdf-preview-state="ready"] {
    padding: 0;
    background: #fff;
}

.pdf-static-preview[data-pdf-preview-state="ready"] .pdf-static-preview-fallback {
    display: none;
}

.pdf-static-preview-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 58px;
    border-radius: 8px;
    background: #fff;
    color: #dc2626;
    font: 800 14px/1 system-ui, sans-serif;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.14);
}

.dpg-modal-pdf,
.ppl-presentation-slide-pdf {
    min-height: 460px;
}

@media (max-width: 720px) {
    .pdf-viewer-body,
    .pdf-viewer-shell {
        min-height: 360px;
    }

    .pdf-page-stack {
        padding: 10px;
        gap: 12px;
    }
}
