.paipn-library,
.paipn-library * {
    box-sizing: border-box;
}

.paipn-library {
    color: #101828;
    margin: 18px 0;
    max-width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.paipn-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.paipn-card {
    appearance: none;
    background: #ffffff;
    border: 1px solid #d7dee9;
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.1);
    color: inherit;
    cursor: pointer;
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 10px;
    text-align: left;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    width: 100%;
}

.paipn-library .paipn-grid .paipn-card {
    background: #ffffff !important;
    border: 1px solid #d7dee9 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.1) !important;
    overflow: hidden;
}

.paipn-card:hover,
.paipn-card:focus-visible {
    border-color: #98a9c2;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    outline: 0;
    transform: translateY(-2px);
}

.paipn-library .paipn-grid .paipn-card:hover,
.paipn-library .paipn-grid .paipn-card:focus-visible {
    border-color: #98a9c2 !important;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18) !important;
}

.paipn-card-top {
    align-items: flex-start;
    display: grid;
    gap: 10px;
    grid-template-columns: 30px minmax(0, 1fr) 20px;
    min-height: 42px;
}

.paipn-file-icon {
    align-items: center;
    background: #f04438;
    border-radius: 3px;
    color: #ffffff;
    display: inline-flex;
    font-size: 8px;
    font-weight: 800;
    height: 20px;
    justify-content: center;
    line-height: 1;
    margin-top: 2px;
    width: 20px;
}

.paipn-card-heading {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.paipn-card-heading strong {
    color: #111827;
    display: block;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.28;
    overflow-wrap: anywhere;
    white-space: normal;
}

.paipn-card-heading em {
    color: #667085;
    display: block;
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: normal;
}

.paipn-menu-dots {
    display: block;
    height: 22px;
    position: relative;
    width: 18px;
}

.paipn-menu-dots::before {
    background: #111827;
    border-radius: 999px;
    box-shadow: 0 6px 0 #111827, 0 12px 0 #111827;
    content: "";
    height: 3px;
    left: 8px;
    position: absolute;
    top: 3px;
    width: 3px;
}

.paipn-preview {
    align-items: center;
    aspect-ratio: 1.38 / 1;
    background: #ffffff;
    border: 1px solid #edf1f7;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    overflow: hidden;
    width: 100%;
}

.paipn-preview img {
    display: block;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    pointer-events: none;
    user-select: none;
    width: 100%;
}

.paipn-preview canvas {
    display: block;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    pointer-events: none;
    user-select: none;
    width: 100%;
}

.paipn-preview-placeholder {
    align-items: center;
    color: #1570ef;
    display: grid;
    gap: 8px;
    justify-items: center;
    padding: 18px;
    text-align: center;
}

.paipn-preview-placeholder span {
    color: #12b76a;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.paipn-preview-placeholder strong {
    color: #1570ef;
    font-size: 16px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.paipn-empty {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #475467;
    padding: 16px;
}

.paipn-category-library,
.paipn-category-library * {
    box-sizing: border-box;
}

.paipn-category-library {
    color: #101828;
    margin: 18px 0;
    max-width: 100%;
}

.paipn-category-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.paipn-category-card {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d7dee9;
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.1);
    color: inherit;
    display: grid;
    gap: 14px;
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 116px;
    padding: 16px;
    text-decoration: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.paipn-category-card:hover,
.paipn-category-card:focus-visible {
    border-color: var(--paipn-category-color);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
    outline: 0;
    transform: translateY(-2px);
}

.paipn-category-icon {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--paipn-category-color);
    border-radius: 8px;
    box-shadow: inset 0 0 0 6px rgba(21, 112, 239, 0.08);
    color: var(--paipn-category-color);
    display: inline-flex;
    font-size: 16px;
    font-weight: 900;
    height: 64px;
    justify-content: center;
    line-height: 1;
    overflow: hidden;
    width: 64px;
}

.paipn-category-icon img {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.paipn-category-copy {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.paipn-category-copy strong {
    color: #111827;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.paipn-category-copy em {
    color: #667085;
    display: -webkit-box;
    font-size: 13px;
    font-style: normal;
    line-height: 1.35;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.paipn-category-copy small {
    color: var(--paipn-category-color);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
}

.paipn-viewer {
    display: none;
    inset: 0;
    position: fixed;
    z-index: 999999;
}

.paipn-viewer.is-open {
    display: block;
}

.paipn-viewer:fullscreen,
.paipn-viewer:-webkit-full-screen {
    background: #f3f6fb;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
}

.paipn-viewer-backdrop {
    background: rgba(15, 23, 42, 0.72);
    inset: 0;
    position: absolute;
}

.paipn-viewer-panel {
    background: #f3f6fb;
    border-radius: 0;
    box-shadow: none;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    height: 100dvh;
    inset: 0;
    left: auto;
    max-width: none;
    overflow: hidden;
    position: absolute;
    top: auto;
    transform: none;
    width: 100%;
}

.paipn-viewer-toolbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #d9e2ef;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    min-width: 0;
    padding: 10px 12px;
}

.paipn-viewer-title {
    color: #111827;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.paipn-viewer-actions {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
}

.paipn-viewer-actions button {
    align-items: center;
    appearance: none;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #111827;
    cursor: pointer;
    display: inline-flex;
    font-size: 20px;
    font-weight: 800;
    height: 38px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 38px;
}

.paipn-viewer-actions button:hover,
.paipn-viewer-actions button:focus-visible {
    border-color: #1570ef;
    color: #1570ef;
    outline: 0;
}

.paipn-zoom-value {
    color: #344054;
    font-size: 13px;
    font-weight: 800;
    min-width: 48px;
    text-align: center;
}

.paipn-close {
    margin-left: 4px;
}

.paipn-viewer-body {
    background: #dbe4f0;
    min-height: 0;
    overflow: auto;
    padding: 14px;
    position: relative;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.paipn-viewer-body.is-panning {
    cursor: grabbing;
}

.paipn-status {
    color: #475467;
    font-size: 14px;
    font-weight: 700;
    left: 24px;
    position: absolute;
    top: 20px;
    z-index: 2;
}

.paipn-status.is-error {
    color: #b42318;
}

.paipn-pages {
    align-items: center;
    display: grid;
    gap: 14px;
    justify-items: center;
    min-height: 100%;
    min-width: max-content;
}

.paipn-page {
    display: flex;
    justify-content: center;
    margin: 0 auto;
    max-width: none;
    width: max-content;
}

.paipn-page canvas {
    background: #ffffff;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    display: block;
    max-width: none;
    pointer-events: none;
}

.paipn-lock-scroll {
    overflow: hidden !important;
}

@media (max-width: 1024px) {
    .paipn-grid,
    .paipn-category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .paipn-grid,
    .paipn-category-grid {
        gap: 14px;
        grid-template-columns: 1fr;
    }

    .paipn-card {
        padding: 9px;
    }

    .paipn-card-heading strong {
        font-size: 15px;
    }

    .paipn-category-card {
        grid-template-columns: 56px minmax(0, 1fr);
        min-height: 104px;
        padding: 14px;
    }

    .paipn-category-icon {
        height: 56px;
        width: 56px;
    }

    .paipn-viewer-toolbar {
        align-items: flex-start;
        gap: 8px;
        padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
    }

    .paipn-viewer-title {
        white-space: normal;
    }

    .paipn-viewer-actions {
        gap: 6px;
    }

    .paipn-viewer-actions button {
        height: 36px;
        width: 36px;
    }

    .paipn-zoom-value {
        min-width: 42px;
    }

    .paipn-viewer-body {
        padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
    }
}
