#pa-document-viewer {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 9999;
    width: min(900px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    height: min(74vh, 680px);
    display: grid;
    grid-template-rows: auto 1fr;
    color: #edf2f7;
    background: linear-gradient(180deg, rgba(16, 22, 28, 0.97), rgba(9, 12, 16, 0.97));
    border: 1px solid rgba(169, 184, 208, 0.18);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.44);
    backdrop-filter: blur(14px);
    font-family: Georgia, "Times New Roman", serif;
}

#pa-document-viewer.pa-dragging {
    transition: none;
    user-select: none;
    -webkit-user-select: none;
}

#pa-document-viewer.pa-hidden {
    display: none;
}

#pa-document-viewer.pa-collapsed {
    height: auto;
    width: min(360px, calc(100vw - 24px));
}

#pa-document-viewer.pa-collapsed .pa-dv-body {
    display: none;
}

.pa-dv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(90deg, rgba(78, 110, 140, 0.24), rgba(55, 75, 90, 0.24));
    border-bottom: 1px solid rgba(169, 184, 208, 0.16);
    cursor: grab;
}

.pa-dv-header:active {
    cursor: grabbing;
}

#pa-document-viewer,
#pa-document-viewer * {
    -webkit-user-select: none;
}

.pa-dv-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pa-dv-title strong {
    font-size: 15px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.pa-dv-title span {
    font-size: 12px;
    color: rgba(237, 242, 247, 0.72);
}

.pa-dv-actions,
.pa-dv-list-actions,
.pa-dv-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pa-dv-body {
    min-height: 0;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.pa-dv-sidebar {
    min-width: 0;
    padding: 14px 14px 16px;
    border-right: 1px solid rgba(169, 184, 208, 0.14);
    overflow: auto;
}

.pa-dv-main {
    min-width: 0;
    padding: 14px 16px 16px;
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 12px;
}

.pa-dv-section + .pa-dv-section {
    margin-top: 14px;
}

.pa-dv-section h3,
.pa-dv-main h3 {
    margin: 0 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(237, 242, 247, 0.68);
}

.pa-dv-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pa-dv-item {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pa-dv-item small,
.pa-dv-meta,
.pa-dv-note {
    color: rgba(237, 242, 247, 0.66);
}

.pa-dv-note {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.pa-dv-empty {
    padding: 10px 12px;
    border: 1px dashed rgba(169, 184, 208, 0.22);
    border-radius: 12px;
    font-size: 12px;
    color: rgba(237, 242, 247, 0.7);
}

.pa-dv-input,
.pa-dv-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(169, 184, 208, 0.18);
    background: rgba(255, 255, 255, 0.05);
    color: inherit;
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
}

.pa-dv-input,
.pa-dv-textarea,
.pa-dv-preview {
    user-select: text;
    -webkit-user-select: text;
}

.pa-dv-input {
    margin-bottom: 8px;
}

.pa-dv-textarea {
    min-height: 100%;
    resize: vertical;
}

.pa-dv-editor {
    min-height: 0;
    display: grid;
}

.pa-dv-preview {
    height: 100%;
    overflow: auto;
    border: 1px solid rgba(169, 184, 208, 0.18);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 12px 14px;
    white-space: pre-wrap;
    line-height: 1.5;
}

.pa-dv-button {
    appearance: none;
    border: 1px solid rgba(169, 184, 208, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
}

.pa-dv-button:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(169, 184, 208, 0.34);
}

.pa-dv-button.pa-dv-primary {
    background: rgba(86, 130, 176, 0.28);
}

.pa-dv-button.pa-dv-danger {
    background: rgba(144, 74, 74, 0.24);
}

.pa-dv-upload {
    display: none;
}

.pa-dv-pdf-frame {
    width: 100%;
    height: 100%;
    min-height: 420px;
    border: 1px solid rgba(169, 184, 208, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 900px) {
    #pa-document-viewer {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        height: min(82vh, 760px);
    }

    .pa-dv-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .pa-dv-sidebar {
        border-right: 0;
        border-bottom: 1px solid rgba(169, 184, 208, 0.14);
        max-height: 34vh;
    }
}
