
/* ── LANGUAGE SWITCHER ── */
.dv-lang-switcher {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}
.dv-lang-switcher-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 6px 12px;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.10);
}
.dv-lang-globe {
    font-size: 16px;
    line-height: 1;
}
.dv-lang-select-wrap {
    position: relative;
}
.dv-lang-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: none;
    font-size: 13px;
    font-weight: 600;
    color: #0369a1;
    cursor: pointer;
    padding: 0 22px 0 2px;
    outline: none;
    line-height: 1.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230369a1' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 2px center;
}
.dv-lang-select:hover {
    color: #0284c7;
}
.dv-lang-select option {
    font-size: 13px;
    background: #ffffff;
    color: #1e293b;
}

/* ── FRONTEND UPLOAD TRIGGER BUTTON ── */
.dv-upload-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    color: #ffffff;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    height: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.25);
}
.dv-upload-trigger-btn:hover {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}

/* ── UPLOAD MODAL ── */
.dv-upload-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.dv-upload-modal-box {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: sdlModalIn 0.2s ease;
}
@keyframes sdlModalIn {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dv-upload-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.dv-upload-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}
.dv-upload-modal-close {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 6px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s;
}
.dv-upload-modal-close:hover {
    background: rgba(255,255,255,0.28);
}
.dv-upload-modal-body {
    padding: 24px;
}
.dv-upload-hint {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 16px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #0ea5e9;
}
.dv-upload-field {
    margin-bottom: 14px;
}
.dv-upload-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}
.dv-upload-field input[type="text"],
.dv-upload-field textarea,
.dv-upload-field input[type="file"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.dv-upload-field input[type="text"]:focus,
.dv-upload-field textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}
.dv-upload-field textarea {
    resize: vertical;
}
.dv-upload-modal-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}
.dv-fup-submit-btn {
    flex: 1;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
}
.dv-fup-submit-btn:hover {
    background: linear-gradient(135deg, #0284c7, #0369a1) !important;
}
.dv-fup-cancel-btn {
    padding: 8px 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.dv-fup-cancel-btn:hover {
    background: #e2e8f0;
    color: #374151;
}

/**
 * Giannotta Tools PRO - Frontend Library Styles
 * Base styles + Template variations (injected via PHP)
 * 
 * @package GiannottaToolsPro
 */

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

.dv-library {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.2;
    color: #1d2327;
}

/* Container */
.dv-library-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */

.dv-library-hero {
    padding: 80px 40px;
    text-align: center;
    background-size: cover;
    background-position: center;
    color: white;
    position: relative;
}

.dv-library-hero h1 {
    font-size: 48px;
    font-weight: 700;
    margin: 0 0 15px 0;
    line-height: 1.2;
}

.dv-hero-subtitle {
    font-size: 24px;
    margin: 0 0 15px 0;
    opacity: 0.95;
}

.dv-hero-description {
    font-size: 18px;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
}

/* ==========================================================================
   CONTENT AREA
   ========================================================================== */

.dv-library-content {
    padding: 60px 20px;
    background: #f6f7f7;
}

/* Empty State */
.dv-empty-state {
    text-align: center;
    padding: 100px 20px;
    background: white;
    border-radius: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.dv-empty-icon {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.dv-empty-state h2 {
    font-size: 28px;
    margin: 0 0 10px 0;
    color: #646970;
}

.dv-empty-state p {
    color: #646970;
    margin: 0;
}

/* ==========================================================================
   SECTIONS GRID
   ========================================================================== */

.dv-sections-grid {
    display: grid;
    gap: 30px;
    margin: 0;
    /* v9.2.3: stretch makes all cards in a row the same height */
    align-items: stretch;
}

.dv-sections-grid.dv-columns-1 {
    grid-template-columns: 1fr;
}

.dv-sections-grid.dv-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* BUG-11 fix: 3-column layout */
.dv-sections-grid.dv-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
    .dv-sections-grid.dv-columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .dv-sections-grid.dv-columns-3 {
        grid-template-columns: 1fr;
    }
}

/* Section Card */
.dv-section-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* v9.2.3: flex-column lets the header grow to match its siblings */
    display: flex;
    flex-direction: column;
}

/* v9.2.3: header fills width; body takes remaining vertical space */
.dv-section-card .dv-section-header {
    flex-shrink: 0;
}
.dv-section-card .dv-section-body {
    flex: 1;
}

.dv-section-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Section Header
 * v9.2.3 fix: uniform height enforced by a fixed min-height calculated for the
 * maximum allowed content — title ≤100 chars (2 lines) + description ≤200 chars
 * (3 lines at 15px/1.5 line-height) + icon + padding = 168px.
 * Every header in a row will be at least this tall, so shorter content still
 * leaves the same amount of space — no more misaligned headers.
 */
.dv-section-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    padding-right: 80px; /* room for the absolute badge */
    border-bottom: 1px solid #f0f0f1;
    position: relative;
    /* Fixed min-height = space for 2-line title + 3-line description + padding */
    min-height: 100px;
    box-sizing: border-box;
}

.dv-section-icon {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
    padding-top: 2px;
}

.dv-section-info {
    flex: 1;
    min-width: 0;
}

.dv-section-title {
    font-size: 17px;
    margin: 0 0 8px 0;
    font-weight: 700;
    line-height: 1.3;
    /* max 100 chars enforced in PHP — visually clips gracefully if overridden */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dv-section-description {
    margin: 0;
    color: #646970;
    font-size: 15px;
    line-height: 1.5;
    /* max 200 chars enforced in PHP — clamp to 3 lines as safety net */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dv-section-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #fff3cd;
    color: #856404;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
}

/* Section Body */
.dv-section-body {
    padding: 10px;
}

/* ==========================================================================
   LOCKED STATE
   ========================================================================== */

.dv-section-locked {
    text-align: center;
    padding: 16px 18px;
}

/* Icon + text on the same row — centred in the section body */
.dv-lock-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    text-align: left;
}

.dv-lock-icon-inline {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.85;
}

.dv-lock-row p {
    margin: 0;
    line-height: 1.55;
    font-size: 13.5px;
}

.dv-unlock-form {
    max-width: 280px;
    margin: 12px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.dv-unlock-form input[type="password"] {
    width: 130px;
    flex-shrink: 1;
    padding: 0 8px;
    border: 1px solid #dcdcde;
    border-radius: 3px;
    font-size: 12px;
    height: 32px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.dv-unlock-form input[type="password"]:focus {
    outline: none;
    border-color: #2271b1;
}

.dv-unlock-btn {
    padding: 0 20px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    height: 32px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none !important;
}

.dv-unlock-btn:hover {
    background: #135e96;
    transform: translateY(-2px);
    text-decoration: none !important;
    color: white;
}

.dv-error-message,
.dv-warning-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    display: none;
}

.dv-error-message {
    background: #f8d7da;
    color: #721c24;
}

.dv-warning-message {
    background: #fff3cd;
    color: #856404;
}

/* ==========================================================================
   UNLOCKED STATE
   ========================================================================== */

.dv-section-unlocked {
    position: relative;
}

/* Controls bar for Lock button + View toggle */
/* .dv-section-controls base layout — see two-row override below (v1.2.0) */

.dv-lock-btn {
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.dv-lock-btn:hover {
    background: #fff;
    border-color: #2271b1;
}

/* ==========================================================================
   VIEW TOGGLE (PRO)
   ========================================================================== */

.dv-view-toggle {
    display: flex;
    gap: 5px;
}

.dv-view-btn {
    background: #f6f7f7;
    border: 2px solid #dcdcde;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dv-view-btn:hover {
    background: #fff;
    border-color: #646970;
}

.dv-view-btn.active {
    background: #2271b1;
    border-color: #2271b1;
    color: white;
}

.dv-view-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    font-family: dashicons;
    speak: never;
    font-style: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.dv-view-btn .dashicons-grid-view:before {
    content: "\f509";
}

.dv-view-btn .dashicons-list-view:before {
    content: "\f163";
}

/* ==========================================================================
   FILES - GRID VIEW
   ========================================================================== */

.dv-files-container[data-view-mode="grid"] {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    box-sizing: border-box;
    width: 100%;
}

/* Scrollbar styling */
.dv-files-container[data-view-mode="grid"]::-webkit-scrollbar {
    width: 8px;
}

.dv-files-container[data-view-mode="grid"]::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dv-files-container[data-view-mode="grid"]::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.dv-files-container[data-view-mode="grid"]::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive: 2 columns on tablets */
@media (max-width: 1024px) {
    .dv-files-container[data-view-mode="grid"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Responsive: 1 column on mobile */
@media (max-width: 768px) {
    .dv-files-container[data-view-mode="grid"] {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        max-height: 500px;
    }
}

.dv-files-container[data-view-mode="grid"] .dv-file-item {
    background: #f6f7f7;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.dv-files-container[data-view-mode="grid"] .dv-file-item:hover {
    background: white;
    border-color: #2271b1;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Grid mode: position file-item as relative container for checkbox overlay */
.dv-files-container[data-view-mode="grid"] .dv-file-item {
    position: relative;
}

/* Grid mode: checkbox floats over top-right of thumbnail, not in flow */
.dv-files-container[data-view-mode="grid"] .dv-file-select {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 16px !important;
    height: 16px !important;
    margin: 0 !important;
    cursor: pointer;
    accent-color: #0ea5e9;
    /* Hide unless hovered or checked */
    opacity: 0;
    transition: opacity 0.15s;
}
.dv-files-container[data-view-mode="grid"] .dv-file-item:hover .dv-file-select,
.dv-files-container[data-view-mode="grid"] .dv-file-select:checked {
    opacity: 1;
}

/* Icon and thumbnail MUST occupy exactly the same height so all cards align */
.dv-files-container[data-view-mode="grid"] .dv-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 180px;         /* same as thumbnail height */
    margin-bottom: 15px;
    font-size: 64px;       /* larger emoji for visual balance */
    border-radius: 8px;
    background: #ececec;
    flex-shrink: 0;
}

.dv-files-container[data-view-mode="grid"] .dv-file-thumbnail {
    width: 100%;
    height: 180px;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    background: #e0e0e0;
    flex-shrink: 0;
}

.dv-files-container[data-view-mode="grid"] .dv-file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center; /* show top of PDF/doc for best preview */
}

.dv-files-container[data-view-mode="grid"] .dv-file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    /* No overflow:hidden here — it clips the expiry badge */
}

.dv-files-container[data-view-mode="grid"] .dv-file-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;        /* single line, same width for all cards */
    font-weight: 600;
    font-size: 13px;
    line-height: 1.4;
    width: 100%;
}

.dv-files-container[data-view-mode="grid"] .dv-file-meta {
    font-size: 11px;
    color: #646970;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.dv-files-container[data-view-mode="grid"] .dv-file-expiry {
    display: block;
    margin-top: 4px;
    margin-bottom: 10px; /* spacing before action buttons */
}

/* Download button in grid - always at bottom */
.dv-files-container[data-view-mode="grid"] .dv-download-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
}
.dv-files-container[data-view-mode="grid"] .dv-file-actions {
    margin-top: auto;
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-wrap: nowrap;
    width: 100%;
}
.dv-files-container[data-view-mode="grid"] .dv-file-actions .dv-unlock-btn,
.dv-files-container[data-view-mode="grid"] .dv-preview-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
}
/* Grid: file lock overlay — stacks inside the card, full width */
.dv-files-container[data-view-mode="grid"] .dv-file-lock-overlay {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    margin-top: auto;
    gap: 6px;
}
.dv-files-container[data-view-mode="grid"] .dv-file-lock-overlay .dv-file-unlock-form {
    flex-direction: row;
    gap: 6px;
    width: 100%;
    flex-wrap: nowrap;
}
.dv-files-container[data-view-mode="grid"] .dv-file-lock-overlay input.dv-file-pw-input {
    flex: 1;
    min-width: 0;
    width: auto;
    height: 32px;
    border-radius: 3px;
}
.dv-files-container[data-view-mode="grid"] .dv-file-lock-overlay .dv-unlock-btn {
    flex-shrink: 0;
    justify-content: center;
    height: 32px;
    border-radius: 3px;
}
/* Grid: metadata and expiry always pinned to same vertical position */
.dv-files-container[data-view-mode="grid"] .dv-file-info {
    min-height: 44px; /* 1 line name + 1 meta line — actions always at same row */
    margin-bottom: 10px; /* breathing room before action buttons */
}

/* ==========================================================================
   FILES - LIST VIEW
   ========================================================================== */

.dv-files-container[data-view-mode="list"] {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar styling for list view */
.dv-files-container[data-view-mode="list"]::-webkit-scrollbar {
    width: 8px;
}

.dv-files-container[data-view-mode="list"]::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dv-files-container[data-view-mode="list"]::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.dv-files-container[data-view-mode="list"]::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@media (max-width: 768px) {
    .dv-files-container[data-view-mode="list"] {
        max-height: 500px;
    }
}

.dv-files-container[data-view-mode="list"] .dv-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    background: #f6f7f7;
    border-radius: 8px;
    transition: background 0.2s ease, border-color 0.2s ease;
    border: 2px solid transparent;
}

.dv-files-container[data-view-mode="list"] .dv-file-item:hover {
    background: white;
    border-color: #2271b1;
}

.dv-files-container[data-view-mode="list"] .dv-file-icon {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: #ececec;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    overflow: hidden;
}

.dv-files-container[data-view-mode="list"] .dv-file-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: #e0e0e0;
    flex-shrink: 0;
}

.dv-files-container[data-view-mode="list"] .dv-file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    padding: 5px;
    box-sizing: border-box;
}

.dv-files-container[data-view-mode="list"] .dv-file-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dv-files-container[data-view-mode="list"] .dv-file-name {
    display: block;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.dv-files-container[data-view-mode="list"] .dv-file-meta {
    display: block;
    font-size: 11px;
    color: #646970;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dv-files-container[data-view-mode="list"] .dv-file-expiry {
    display: block;
    margin-top: 2px;
}

/* Download button in list - fixed width */
.dv-files-container[data-view-mode="list"] .dv-download-btn {
    min-width: 100px;
    flex-shrink: 0;
    height: 32px;
    border-radius: 3px;
}

/* Download Button */
.dv-download-btn {
    padding: 8px 10px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    line-height: 1;
    height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dv-download-btn:hover {
    background: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(34, 113, 177, 0.3);
}

/* File-level unlock button — same compact size as download btn */
.dv-file-lock-overlay .dv-unlock-btn,
.dv-file-actions .dv-unlock-btn {
    padding: 0 14px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    line-height: 1;
    height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.dv-file-lock-overlay .dv-unlock-btn:hover,
.dv-file-actions .dv-unlock-btn:hover {
    background: #135e96;
    transform: translateY(-2px);
}

/* File lock overlay layout — FIX: nowrap keeps pw-input + btn on one row */
.dv-file-lock-overlay {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* File password input — matches button height */
input.dv-file-pw-input,
.dv-file-pw-input {
    padding: 0 8px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    width: 90px;
    height: 32px;
    box-sizing: border-box;
    line-height: 1;
    flex-shrink: 1;
}
input.dv-file-pw-input:focus,
.dv-file-pw-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34,113,177,0.15);
}

/* No Files Message */
.dv-no-files {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
}

/* ==========================================================================
   CTA SECTION (PRO)
   ========================================================================== */

.dv-cta-section {
    padding: 60px 40px;
    text-align: center;
    display: block;
    /* Background set by each template */
}

.dv-cta-section h2 {
    font-size: 36px;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.dv-cta-section p {
    font-size: 18px;
    margin: 0 0 30px 0;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.dv-cta-button {
    display: inline-block;
    padding: 14px 36px;
    text-decoration: none !important;
    color: #ffffff;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 700;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,.28);
    /* Background/color set by each template */
}

.dv-cta-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    text-decoration: none !important;
    color: #ffffff;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.dv-library-footer {
    padding: 40px 20px;
    text-align: center;
    background: #1d2327;
    color: rgba(255, 255, 255, 0.7);
}

.dv-library-footer p {
    margin: 0;
    font-size: 14px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .dv-sections-grid.dv-columns-2 {
        grid-template-columns: 1fr;
    }
    
    .dv-library-hero h1 {
        font-size: 32px;
    }
    
    .dv-hero-subtitle {
        font-size: 18px;
    }
    
    .dv-hero-description {
        font-size: 16px;
    }
    
    .dv-section-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .dv-section-badge {
        position: static;
        margin-top: 10px;
    }
    
    .dv-files-container[data-view-mode="grid"] {
        grid-template-columns: 1fr;
    }
    
    .dv-files-container[data-view-mode="list"] .dv-file-item {
        flex-direction: column;
        text-align: center;
    }
    
    /* unlock-form stays row even on mobile — inputs are narrow enough */
    
    .dv-cta-section h2 {
        font-size: 28px;
    }
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dv-section-card {
    animation: fadeIn 0.5s ease-out;
}

.dv-section-card:nth-child(1) { animation-delay: 0s; }
.dv-section-card:nth-child(2) { animation-delay: 0.1s; }
.dv-section-card:nth-child(3) { animation-delay: 0.2s; }
.dv-section-card:nth-child(4) { animation-delay: 0.3s; }
.dv-section-card:nth-child(5) { animation-delay: 0.4s; }
.dv-section-card:nth-child(6) { animation-delay: 0.5s; }

/* ==========================================================================
   MATRIX HACKER - Password Input Cursor Effect (v3.3.0)
   ========================================================================== */

.dv-library[data-template="matrix-hacker"] .dv-password-input,
.dv-password-input.matrix-cursor-active {
    font-family: 'Orbitron', 'Courier New', monospace !important;
    background: #0a0f0a !important;
    color: #00cc00 !important;
    border: 1px solid #00cc00 !important;
    border-radius: 0 !important;
    padding: 10px 14px !important;
    letter-spacing: 2px;
    box-shadow: 0 0 8px rgba(0, 204, 0, 0.3), inset 0 0 6px rgba(0, 204, 0, 0.1) !important;
    caret-color: #00cc00;
    text-shadow: 0 0 4px #00cc00;
    transition: box-shadow 0.2s;
}

.dv-library[data-template="matrix-hacker"] .dv-password-input:focus,
.dv-password-input.matrix-cursor-active:focus {
    outline: none !important;
    box-shadow: 0 0 16px rgba(0, 204, 0, 0.6), inset 0 0 10px rgba(0, 204, 0, 0.15) !important;
}

/* Matrix placeholder ">_ Enter Password" */
.dv-library[data-template="matrix-hacker"] .dv-password-input::placeholder,
.dv-password-input.matrix-cursor-active::placeholder {
    color: #006600;
    font-family: 'Orbitron', 'Courier New', monospace;
    letter-spacing: 2px;
}

/* Blinking cursor animation on the unlock button in matrix mode */
.dv-library[data-template="matrix-hacker"] .dv-unlock-btn {
    position: relative;
}

.dv-library[data-template="matrix-hacker"] .dv-unlock-btn::after {
    content: ' ▮';
    animation: matrix-blink 0.8s step-end infinite;
    color: #00cc00;
}

@keyframes matrix-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ==========================================================================
   EMOJI ICON SYSTEM - Base fallback (v3.3.0)
   Each template overrides ::before content with its themed emoji
   ========================================================================== */

/* Default lock icon (overridden per template) */
.dv-lock-icon::before {
    content: '🔒';
    font-style: normal;
}

/* Default section badge icon */
.dv-section-badge::before {
    content: '🔒 ';
}

/* Ensure section icon is never blank */
.dv-section-icon:empty::before {
    content: '📁';
    font-size: 48px;
}

/* Ensure section icon text renders correctly */
.dv-section-icon {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
    font-style: normal;
    font-variant-emoji: emoji;
    -webkit-font-variant-emoji: emoji;
}

/* ============================================================
   v6.0 — New feature styles
   ============================================================ */

/* ── Hero Logo ─────────────────────────────────────────────── */
.dv-hero-title-wrap {
    display: flex;
    align-items: center;
    gap: 24px; /* fixed gap between logo and text — no slider */
}

.dv-hero-title-with-logo {
    /* left-logo mode: logo + text side by side, text auto-width (not stretched) */
    flex-direction: row;
    align-items: center;
    justify-content: center; /* centre the pair in the hero */
    gap: 24px;
}

.dv-hero-logo-top {
    text-align: center;
    margin-bottom: 18px;
}

.dv-hero-logo-top img {
    /* top-logo mode: cap at 120px height, let width be natural */
    max-height: 120px;
    max-width: 400px;
    height: auto;
    width: auto;
    object-fit: contain;
}

.dv-hero-logo-left {
    /* left-logo mode: fixed 120×120 box, never stretches */
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dv-hero-logo-left img {
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

.dv-hero-text {
    /* Flex: auto-width so logo+text sit together as a unit (not stretched apart).
       text-align: center so hero title/description is always centred — both when
       there is no logo (full-width) and when in top-logo mode. */
    flex: 0 1 auto;
    min-width: 0;
    max-width: 700px;
    text-align: center;
}

/* No-logo mode: make the text wrapper fill full width so it centres properly */
.dv-hero-title-wrap:not(.dv-hero-title-with-logo) .dv-hero-text {
    flex: 1 1 auto;
    max-width: none;
}

/* ── File Expiry Badges ─────────────────────────────────────── */

/* Universal: works in both list and grid, regardless of view mode state */
.dv-file-expiry {
    display: block;
    margin-top: 3px;
    line-height: 1;
}

.dv-expiry-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    vertical-align: middle;
}

.dv-expiry-expired {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.dv-expiry-soon {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.dv-expiry-ok {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* ── Role-gate notice ───────────────────────────────────────── */

/* ── Analytics wrap ────────────────────────────────────────── */
.dv-analytics-wrap {
    max-width: none;
    width: 100%;
}

/* ── Shortcode rendered portal ─────────────────────────────── */
.dv-library.dv-shortcode {
    border-radius: 8px;
    overflow: hidden;
}

/* ── Insufficient-membership locked state (v8.0.2) ──────────── */

.dv-lock-detail {
    font-size: 12px;
    color: #6b7280;
    margin: 6px 0 12px;
    line-height: 1.5;
}

.dv-upgrade-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

/* Upgrade Plan button — inherits .dv-unlock-btn gradient via template CSS */
.dv-upgrade-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 36px;
    background: linear-gradient(135deg, #7c3aed, #4f46e5) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    transition: filter .2s ease, transform .2s ease, box-shadow .2s ease;
    white-space: nowrap;
}
.dv-upgrade-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(0,0,0,.30);
    text-decoration: none !important;
    color: #ffffff !important;
}

/* Contact Admin button — neutral variant matching unlock style */
.dv-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 36px;
    background: rgba(255,255,255,.12) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255,255,255,.25) !important;
    border-radius: 8px !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    transition: filter .2s ease, transform .2s ease;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}
.dv-contact-btn:hover {
    background: rgba(255,255,255,.20) !important;
    transform: translateY(-2px);
    text-decoration: none !important;
    color: #ffffff !important;
}

/* ── F10: Enhanced Mobile Scaling (v8.0.3) ────────────────────────────── */
@media (max-width: 480px) {
    .dv-library-hero {
        min-height: unset !important;
        padding: 24px 16px !important;
    }
    .dv-library-hero h1 {
        font-size: 1.4em !important;
        line-height: 1.3 !important;
    }
    .dv-hero-subtitle { font-size: 0.85em !important; }
    .dv-hero-description { font-size: 0.82em !important; }

    /* Hero logo: stack vertically on mobile regardless of desktop position */
    .dv-hero-title-with-logo {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }
    .dv-hero-logo-left {
        width: auto !important;
        height: auto !important;
        flex-shrink: 1 !important;
    }
    .dv-hero-logo-left img,
    .dv-hero-logo-top img {
        max-height: 60px !important;
        max-width: 120px !important;
    }
    .dv-hero-text {
        max-width: 100% !important;
        text-align: center !important;
    }

    /* Section card header: icon smaller, centered, badge stays near title */
    .dv-section-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 12px 12px 12px !important;
        padding-right: 12px !important; /* remove desktop badge offset */
        min-height: unset !important;
    }
    .dv-section-icon {
        font-size: 28px !important;
        padding-top: 0 !important;
    }
    .dv-section-info {
        width: 100% !important;
        text-align: center !important;
    }
    .dv-section-title {
        font-size: 15px !important;
        margin-bottom: 4px !important;
    }
    .dv-section-description {
        font-size: 13px !important;
    }
    .dv-section-badge {
        position: static !important;
        display: inline-block !important;
        margin-top: 8px !important;
        align-self: center !important;
    }

    .dv-sections-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .dv-section-card { padding: 0 !important; }
    .dv-files-list { padding: 0 !important; }
    .dv-file-item {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 8px !important;
    }
    .dv-download-btn, .dv-preview-btn {
        min-height: 36px !important;
        padding: 8px 14px !important;
    }
    .dv-cta-section { padding: 28px 16px !important; }
    .dv-library-footer { padding: 16px !important; }
}
}
.dv-flex-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}

/* ── v8.5 utility classes (inline style replacements) ── */
.dv-file-actions-unlock { display:flex; gap:6px; align-items:center; flex-wrap:nowrap; }
.dv-file-lock-error { display:none; color:#dc2626; font-size:11px; width:100%; margin-top:2px; }

/* ── Public section one-click unlock button — same layout as password form ── */
.dv-unlock-form--role {
    display: flex;
    justify-content: center;
    margin: 8px auto 0;
    max-width: 280px;
}

.dv-unlock-form--public {
    display: flex;
    justify-content: center;
    margin: 8px auto 0;
    max-width: 280px;
}
/* .dv-unlock-public-btn and .dv-unlock-form--role button inherit .dv-unlock-btn */

/* ==========================================================================
   ACCESSIBILITY: Reduced motion support
   Respects OS-level "Reduce Motion" setting. Disables all animations and
   transitions for users who have enabled this preference.
   ========================================================================== */

.dv-logout-bar {
    background: rgba(0,0,0,.06);
    border-top: 1px solid rgba(0,0,0,.08);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    font-size: 12px;
}
.dv-logout-user {
    color: var(--dv-text, #1a1d2e);
    opacity: .65;
    font-weight: 500;
}
.dv-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: rgba(220,38,38,.1);
    color: #dc2626;
    border: 1px solid rgba(220,38,38,.25);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}
.dv-logout-btn:hover {
    background: rgba(220,38,38,.18);
    border-color: rgba(220,38,38,.4);
    color: #dc2626;
    text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   v9.2.1 — Cloud provider badge on file icons
   Small SVG badge displayed over the file-type emoji for cloud-stored files.
   ========================================================================== */

.dv-file-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dv-cloud-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    padding: 1px;
    box-shadow: 0 1px 3px rgba(0,0,0,.18);
    line-height: 0;
}

.dv-cloud-badge .dv-provider-svg {
    width: 14px;
    height: 14px;
}

/* Cloud image thumbnail — when proxy fails, show a placeholder */
.dv-file-thumbnail--cloud.dv-img-failed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 20px;
}

.dv-file-thumbnail--cloud.dv-img-failed::after {
    content: '🖼️';
}

/* Admin context: slightly larger badge */
.dv-provider-svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* ── PDF thumbnail placeholder (FUNC-01) ───────────────────────────────────── */
.dv-file-thumbnail--pdf-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    flex-shrink: 0;
    gap: 2px;
}
.dv-file-thumbnail--pdf-placeholder .dv-pdf-thumb-icon {
    font-size: 18px;
    line-height: 1;
}
.dv-file-thumbnail--pdf-placeholder .dv-pdf-thumb-label {
    font-size: 8px;
    font-weight: 700;
    color: #dc2626;
    letter-spacing: .5px;
    text-transform: uppercase;
}
/* Grid mode: larger placeholder */
.dv-files-container[data-view-mode="grid"] .dv-file-thumbnail--pdf-placeholder {
    width: 100%;
    height: 120px;
    border-radius: 8px;
}
.dv-files-container[data-view-mode="grid"] .dv-file-thumbnail--pdf-placeholder .dv-pdf-thumb-icon {
    font-size: 32px;
}

/* ==========================================================================
   SECTION TOOLBAR — TWO-ROW LAYOUT (v1.2.0)
   ========================================================================== */

/* Wrapper holds both rows */
.dv-section-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

/* Individual row: flex, left-aligned, wrapping */
.dv-section-toolbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Row 1 (Lock + View toggle) — push view-toggle to far right */
.dv-section-toolbar-row--primary {
    justify-content: space-between;
}

/* Row 2 (Upload + Select All + ZIP) — left-aligned */
.dv-section-toolbar-row--secondary {
    justify-content: flex-start;
}

/* Select-all toggle button */
/* .dv-btn-select-all-files — see final definition in toolbar section below */

/* ==========================================================================
   FILE METADATA ROW — LIST + GRID (v1.2.0 final)
   ========================================================================== */

/* Grid layout: ext | size | dl | source — aligned in a 4-col fixed grid */
.dv-files-container[data-view-mode="list"] .dv-file-meta-row {
    display: grid;
    grid-template-columns: 42px 60px 48px 1fr;
    align-items: center;
    gap: 0;
    margin-top: 3px;
    font-size: 11px;
    color: #646970;
    overflow: visible;
    white-space: nowrap;
}

/* Grid mode: compact flex wrap */
.dv-files-container[data-view-mode="grid"] .dv-file-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 3px;
    font-size: 10px;
    color: #646970;
    justify-content: center;
}

/* Extension pill */
.dv-file-ext-badge {
    display: inline-block;
    background: #e8f0fe;
    color: #1a56db;
    border-radius: 3px;
    padding: 0 5px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.4px;
    line-height: 18px;
    white-space: nowrap;
    width: 38px;
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* File size — fixed width so all rows align */
.dv-file-size {
    color: #64748b;
    white-space: nowrap;
    font-size: 11px;
    padding-left: 4px;
}

/* Download counter */
.dv-file-dl-count {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    color: #475569;
    white-space: nowrap;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 3px;
    padding: 0 5px;
    line-height: 16px;
    font-weight: 600;
    margin-right: 12px;
}

/* Source badge — takes remaining space in list mode */
.dv-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    border-radius: 3px;
    padding: 1px 5px;
    line-height: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* In list-mode grid: 4th column takes remaining space, badge fills it */
.dv-files-container[data-view-mode="list"] .dv-source-badge {
    width: 40%;
    max-width: 40%;
}

.dv-source-badge--cloud {
    background: #eff8ff;
    color: #1a56db;
    border: 1px solid #bfdbfe;
}

/* Abbreviation — always visible in both list and grid */
.dv-source-abbr {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.dv-source-badge--cloud svg,
.dv-source-badge--cloud .dv-provider-svg {
    width: 11px !important;
    height: 11px !important;
    flex-shrink: 0;
}

.dv-source-badge--local {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Grid mode: hide text label, keep pill visible */
.dv-files-container[data-view-mode="grid"] .dv-source-badge-label {
    display: none;
}
.dv-files-container[data-view-mode="grid"] .dv-source-badge {
    display: inline-flex !important;
    padding: 1px 4px;
}

/* Mobile: switch to flex wrap in list mode too */
@media (max-width: 480px) {
    .dv-files-container[data-view-mode="list"] .dv-file-meta-row {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* Override any parent overflow:hidden that clips the row */
.dv-files-container[data-view-mode="list"] .dv-file-info {
    overflow: visible;
}
.dv-files-container[data-view-mode="list"] .dv-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* ==========================================================================
   FILE ACTION BUTTONS — ICON-ONLY IN LIST, FULL IN GRID (v1.2.0 final)
   ========================================================================== */

/* Base download button */
.dv-download-btn {
    padding: 0 10px;
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    white-space: nowrap;
    line-height: 1;
    height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}
.dv-download-btn:hover {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}

/* Preview button — same gradient as download */
.dv-preview-btn {
    padding: 0 10px;
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    white-space: nowrap;
    line-height: 1;
    height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
}
.dv-preview-btn:hover {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}

/* LIST MODE: square icon-only buttons */
.dv-files-container[data-view-mode="list"] .dv-preview-btn,
.dv-files-container[data-view-mode="list"] .dv-download-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    border-radius: 5px !important;
    font-size: 14px !important;
    justify-content: center !important;
    gap: 0 !important;
}
.dv-files-container[data-view-mode="list"] .dv-preview-btn .dv-btn-text,
.dv-files-container[data-view-mode="list"] .dv-download-btn .dv-btn-text {
    display: none;
}

/* LIST MODE: stack buttons vertically */
.dv-files-container[data-view-mode="list"] .dv-file-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

/* GRID MODE: horizontal */
.dv-files-container[data-view-mode="grid"] .dv-file-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 4px;
}

/* Grid mode: preview and download same height */
.dv-files-container[data-view-mode="grid"] .dv-preview-btn,
.dv-files-container[data-view-mode="grid"] .dv-download-btn {
    height: 28px !important;
    padding: 0 10px !important;
    align-self: stretch;
    flex: 1;
    justify-content: center;
}

/* TOOLTIP via CSS — title attribute works but custom tooltip is nicer */
/* Tooltip only shown in list mode (where btn-text is hidden) */
.dv-files-container[data-view-mode="list"] .dv-preview-btn[data-tip]::after,
.dv-files-container[data-view-mode="list"] .dv-download-btn[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    right: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #fff;
    font-size: 10px;
    font-weight: 500;
    padding: 3px 7px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
}
.dv-files-container[data-view-mode="list"] .dv-preview-btn[data-tip]:hover::after,
.dv-files-container[data-view-mode="list"] .dv-download-btn[data-tip]:hover::after {
    opacity: 1;
}
/* Explicitly no tooltip in grid mode */
.dv-files-container[data-view-mode="grid"] .dv-preview-btn::after,
.dv-files-container[data-view-mode="grid"] .dv-download-btn::after {
    display: none;
    content: none;
}

/* ==========================================================================
   TOOLBAR — TWO-ROW LAYOUT (v1.2.0 final)
   ========================================================================== */

.dv-section-controls {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 12px;
}

.dv-section-toolbar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dv-section-toolbar-row--primary {
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f1;
}
.dv-section-toolbar-row--secondary {
    padding-top: 6px;
    justify-content: space-between;
    align-items: center;
}
.dv-toolbar-left  { display: flex; align-items: center; gap: 8px; flex: 1; }
.dv-toolbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Select-all: identical to dv-upload-trigger-btn */
.dv-btn-select-all-files {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    color: #ffffff;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    height: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.25);
}
.dv-btn-select-all-files:hover {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(14, 165, 233, 0.35);
}

/* ==========================================================================
   CLOUD PROVIDER BADGE ON THUMBNAIL OVERLAY (v1.2.0)
   ========================================================================== */

.dv-thumb-cloud-badge {
    display: none; /* thumbnail overlay badge — hidden, provider shown in meta-row instead */
}
.dv-thumb-cloud-badge svg,
.dv-thumb-cloud-badge .dv-provider-svg {
    width: 11px !important;
    height: 11px !important;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 600px) {
    .dv-section-toolbar-row--primary,
    .dv-section-toolbar-row--secondary { flex-wrap: wrap; }
    .dv-source-badge-label { display: none; }
}

/* ==========================================================================
   MAMMOTH.JS DOCX RENDERER STYLES (v1.2.0)
   ========================================================================== */

#dv-text-content-wrap {
    background: #fff;
    border-radius: 4px;
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: #1e293b;
}

.dv-mammoth-doc {
    max-width: 740px;
    margin: 0 auto;
}

/* Mammoth generates standard HTML — style it nicely */
.dv-mammoth-doc h1 { font-size: 24px; font-weight: 700; margin: 1em 0 0.4em; color: #0f172a; }
.dv-mammoth-doc h2 { font-size: 20px; font-weight: 700; margin: 0.9em 0 0.4em; color: #1e293b; }
.dv-mammoth-doc h3 { font-size: 16px; font-weight: 600; margin: 0.8em 0 0.3em; color: #334155; }
.dv-mammoth-doc p  { margin: 0.5em 0; }
.dv-mammoth-doc ul,
.dv-mammoth-doc ol { padding-left: 1.5em; margin: 0.5em 0; }
.dv-mammoth-doc li { margin: 0.25em 0; }
.dv-mammoth-doc table {
    width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 13px;
}
.dv-mammoth-doc th,
.dv-mammoth-doc td {
    padding: 6px 10px; border: 1px solid #e2e8f0; text-align: left;
}
.dv-mammoth-doc th  { background: #f1f5f9; font-weight: 600; }
.dv-mammoth-doc strong, .dv-mammoth-doc b { font-weight: 700; }
.dv-mammoth-doc em,     .dv-mammoth-doc i { font-style: italic; }
.dv-mammoth-doc img    { max-width: 100%; height: auto; border-radius: 4px; }
.dv-mammoth-doc a      { color: #3b82f6; }
.dv-mammoth-doc blockquote {
    border-left: 4px solid #e2e8f0; margin: 0.8em 0; padding: 0.4em 1em;
    color: #64748b; font-style: italic;
}
.dv-mammoth-doc hr { border: none; border-top: 1px solid #e2e8f0; margin: 1.2em 0; }

/* ==========================================================================
   SHEETJS XLSX RENDERER STYLES (v1.2.0)
   ========================================================================== */

.dv-xlsx-tabs {
    display: flex;
    gap: 4px;
    padding: 0 0 12px 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dv-xlsx-tab {
    padding: 4px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 4px 4px 0 0;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.dv-xlsx-tab.active {
    background: #fff;
    border-bottom-color: #fff;
    color: #1e293b;
    font-weight: 600;
    border-top: 2px solid #0ea5e9;
}

.dv-xlsx-table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.dv-xlsx-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.dv-xlsx-table th {
    background: #f1f5f9;
    padding: 6px 12px;
    text-align: left;
    border: 1px solid #e2e8f0;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.dv-xlsx-table td {
    padding: 5px 12px;
    border: 1px solid #f0f4f8;
    color: #1e293b;
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dv-xlsx-table tr:nth-child(even) td {
    background: #f8fafc;
}

.dv-xlsx-table tr:hover td {
    background: #eff6ff;
}

/* ── Meta-row mobile: reduce density on narrow screens ── */
@media (max-width:480px) {
  .dv-file-ext-badge { display:none; }
  .dv-file-source-badge { display:none; }
  .dv-file-meta-row { grid-template-columns: 60px 48px; }
}

/* ── Toolbar rows — responsive wrap on narrow screens ── */
@media (max-width:600px) {
  .dv-toolbar-row { flex-wrap: wrap; gap: 6px; }
  .dv-toolbar-row > * { flex-shrink: 0; }
}

/* ==========================================================================
   TEMPLATE HERO GRADIENTS — v1.3.2
   Modern gradient headers with Playfair Display headings, ::before radial
   highlight, ::after geometric overlay, and updated CTA + footer styles.
   Each block uses [data-template="slug"] on the .dv-library wrapper.
   ========================================================================== */

/* ── Shared layer helpers ── */
.dv-library-hero { position: relative; overflow: hidden; }

/* ::before  → radial "glow" top-right — subtle depth */
.dv-library[data-template] .dv-library-hero::before {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 420px; height: 420px;
    background: radial-gradient(circle, rgba(255,255,255,.10) 0%, transparent 65%) !important;
    pointer-events: none;
    z-index: 0;
}

/* ::after  → dot-grid / geometric pattern overlay */
.dv-library[data-template] .dv-library-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}

/* Ensure hero content sits above pseudo-elements */
.dv-library[data-template] .dv-library-hero > * { position: relative; z-index: 1; }

/* Playfair Display for all template headings and section titles */
.dv-library[data-template] .dv-library-hero h1,
.dv-library[data-template] .dv-section-title,
.dv-library[data-template] .dv-library-footer h2,
.dv-library[data-template] .dv-cta-section h2 {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

/* Access state messages — Playfair Display italic for all templates */
.dv-library[data-template] .dv-section-locked p,
.dv-library[data-template] .dv-role-msg,
.dv-library[data-template] .dv-wrong-role-msg,
.dv-library[data-template] .dv-public-msg,
.dv-library[data-template] .dv-role-ok-msg,
.dv-library[data-template] .dv-upgrade-msg {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
}

/* Shared button upgrade */
.dv-library[data-template] .dv-cta-button,
.dv-library[data-template] .dv-unlock-btn,
.dv-library[data-template] .dv-public-unlock-btn {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,.22);
    transition: transform .25s ease, box-shadow .25s ease, filter .2s ease;
}
.dv-library[data-template] .dv-cta-button:hover,
.dv-library[data-template] .dv-unlock-btn:hover,
.dv-library[data-template] .dv-public-unlock-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
    filter: brightness(1.06);
}

/* Footer shared depth shadow */
.dv-library[data-template] .dv-library-footer {
    box-shadow: inset 0 4px 20px rgba(0,0,0,.18);
}

/* CTA section — NO background here, set per-template or via generate_css() */
.dv-library[data-template] .dv-cta-section {
    position: relative;
    overflow: hidden;
}
/* CTA dot overlay pattern — mirrors hero ::after */
.dv-library[data-template] .dv-cta-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}
.dv-library[data-template] .dv-cta-section > * {
    position: relative;
    z-index: 1;
}

/* ── Per-template CTA backgrounds — mirror hero exactly ────────────────── */
/* Each template's CTA gets the same gradient as its hero so they are visually
   coherent. generate_css() overrides this only when the user customises the
   CTA gradient explicitly in the Design panel. */

.dv-library[data-template="academic-authority"] .dv-cta-section {
    background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 45%, #0f172a 100%) !important;
}
.dv-library[data-template="modern-education"] .dv-cta-section {
    background: linear-gradient(150deg, #0c4a6e 0%, #065f46 50%, #064e3b 100%) !important;
}
.dv-library[data-template="legal-prestige"] .dv-cta-section {
    background: linear-gradient(150deg, #111827 0%, #1c1208 45%, #111827 100%) !important;
}
.dv-library[data-template="ai-tech-saas"] .dv-cta-section {
    background: linear-gradient(135deg, #0f0f1a 0%, #1e1b4b 50%, #0f172a 100%) !important;
}
.dv-library[data-template="secure-finance"] .dv-cta-section {
    background: linear-gradient(150deg, #0c4a6e 0%, #0f172a 40%, #064e3b 100%) !important;
}
.dv-library[data-template="medical-clean"] .dv-cta-section {
    background: linear-gradient(145deg, #0d4f4f 0%, #0f766e 50%, #0d9488 100%) !important;
}
.dv-library[data-template="property-vault"] .dv-cta-section {
    background: linear-gradient(150deg, #0f172a 0%, #1e293b 40%, #451a03 100%) !important;
}
.dv-library[data-template="corporate-talent"] .dv-cta-section {
    background: linear-gradient(145deg, #0f172a 0%, #312e81 50%, #4c1d95 100%) !important;
}
.dv-library[data-template="strategic-advisory"] .dv-cta-section {
    background: linear-gradient(155deg, #0f172a 0%, #1c1a0f 50%, #422006 100%) !important;
}
.dv-library[data-template="insurance-shield"] .dv-cta-section {
    background: linear-gradient(150deg, #1e3a8a 0%, #0c4a6e 50%, #1e40af 100%) !important;
}
.dv-library[data-template="document-authority"] .dv-cta-section {
    background: linear-gradient(150deg, #111827 0%, #1f2937 45%, #111827 100%) !important;
}
.dv-library[data-template="luxury-secure"] .dv-cta-section {
    background: linear-gradient(150deg, #000000 0%, #1c1410 40%, #2d1f0e 100%) !important;
    border-top: 1px solid rgba(212,175,55,.14);
}

/* Per-template CTA button gradients — match the template accent colour */
.dv-library[data-template="academic-authority"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
}
.dv-library[data-template="modern-education"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #16a34a 0%, #059669 100%) !important;
}
.dv-library[data-template="legal-prestige"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%) !important;
}
.dv-library[data-template="ai-tech-saas"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #22d3ee 0%, #0891b2 100%) !important;
    color: #0b0b13 !important;
}
.dv-library[data-template="secure-finance"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%) !important;
}
.dv-library[data-template="medical-clean"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%) !important;
}
.dv-library[data-template="property-vault"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%) !important;
}
.dv-library[data-template="corporate-talent"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
}
.dv-library[data-template="strategic-advisory"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
}
.dv-library[data-template="insurance-shield"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
}
.dv-library[data-template="document-authority"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%) !important;
}
.dv-library[data-template="luxury-secure"] .dv-cta-section .dv-cta-button {
    background: linear-gradient(135deg, #c8961e 0%, #a07012 100%) !important;
}

/* Per-template unlock/download button gradients — match accent colour */
.dv-library[data-template="academic-authority"] .dv-unlock-btn,
.dv-library[data-template="academic-authority"] .dv-download-btn,
.dv-library[data-template="academic-authority"] .dv-public-unlock-btn,
.dv-library[data-template="academic-authority"] .dv-preview-btn {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
}
.dv-library[data-template="modern-education"] .dv-unlock-btn,
.dv-library[data-template="modern-education"] .dv-download-btn,
.dv-library[data-template="modern-education"] .dv-public-unlock-btn,
.dv-library[data-template="modern-education"] .dv-preview-btn {
    background: linear-gradient(135deg, #16a34a 0%, #059669 100%) !important;
}
.dv-library[data-template="legal-prestige"] .dv-unlock-btn,
.dv-library[data-template="legal-prestige"] .dv-download-btn,
.dv-library[data-template="legal-prestige"] .dv-public-unlock-btn,
.dv-library[data-template="legal-prestige"] .dv-preview-btn {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%) !important;
}
.dv-library[data-template="ai-tech-saas"] .dv-unlock-btn,
.dv-library[data-template="ai-tech-saas"] .dv-download-btn,
.dv-library[data-template="ai-tech-saas"] .dv-public-unlock-btn,
.dv-library[data-template="ai-tech-saas"] .dv-preview-btn {
    background: linear-gradient(135deg, #4f46e5 0%, #22d3ee 100%) !important;
    color: #fff !important;
}
.dv-library[data-template="secure-finance"] .dv-unlock-btn,
.dv-library[data-template="secure-finance"] .dv-download-btn,
.dv-library[data-template="secure-finance"] .dv-public-unlock-btn,
.dv-library[data-template="secure-finance"] .dv-preview-btn {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%) !important;
}
.dv-library[data-template="medical-clean"] .dv-unlock-btn,
.dv-library[data-template="medical-clean"] .dv-download-btn,
.dv-library[data-template="medical-clean"] .dv-public-unlock-btn,
.dv-library[data-template="medical-clean"] .dv-preview-btn {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%) !important;
}
.dv-library[data-template="property-vault"] .dv-unlock-btn,
.dv-library[data-template="property-vault"] .dv-download-btn,
.dv-library[data-template="property-vault"] .dv-public-unlock-btn,
.dv-library[data-template="property-vault"] .dv-preview-btn {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%) !important;
}
.dv-library[data-template="corporate-talent"] .dv-unlock-btn,
.dv-library[data-template="corporate-talent"] .dv-download-btn,
.dv-library[data-template="corporate-talent"] .dv-public-unlock-btn,
.dv-library[data-template="corporate-talent"] .dv-preview-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
}
.dv-library[data-template="strategic-advisory"] .dv-unlock-btn,
.dv-library[data-template="strategic-advisory"] .dv-download-btn,
.dv-library[data-template="strategic-advisory"] .dv-public-unlock-btn,
.dv-library[data-template="strategic-advisory"] .dv-preview-btn {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
}
.dv-library[data-template="insurance-shield"] .dv-unlock-btn,
.dv-library[data-template="insurance-shield"] .dv-download-btn,
.dv-library[data-template="insurance-shield"] .dv-public-unlock-btn,
.dv-library[data-template="insurance-shield"] .dv-preview-btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
}
.dv-library[data-template="document-authority"] .dv-unlock-btn,
.dv-library[data-template="document-authority"] .dv-download-btn,
.dv-library[data-template="document-authority"] .dv-public-unlock-btn,
.dv-library[data-template="document-authority"] .dv-preview-btn {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%) !important;
}
.dv-library[data-template="luxury-secure"] .dv-unlock-btn,
.dv-library[data-template="luxury-secure"] .dv-download-btn,
.dv-library[data-template="luxury-secure"] .dv-public-unlock-btn,
.dv-library[data-template="luxury-secure"] .dv-preview-btn {
    background: linear-gradient(135deg, #d4af37 0%, #a07012 100%) !important;
    color: #000 !important;
}

/* ── Per-template section header backgrounds ────────────────────────────── */
/* Light tint matching each template's colour palette.
   Same values as the $section_header_tints map in class-dv-preview-renderer.php.
   generate_css() overrides these only when the user customises section header
   colours explicitly in the Design panel. */

.dv-library[data-template="academic-authority"] .dv-section-header {
    background: linear-gradient(135deg, #dce6f5 0%, #cfdaee 100%) !important;
    border-bottom: 1px solid #b8cce4 !important;
}
.dv-library[data-template="academic-authority"] .dv-section-title {
    color: #0f172a !important;
}
.dv-library[data-template="academic-authority"] .dv-section-description {
    color: #334155 !important;
}

.dv-library[data-template="modern-education"] .dv-section-header {
    background: #e6f4ee !important;
    border-bottom: 1px solid #a7d9bc !important;
}
.dv-library[data-template="modern-education"] .dv-section-title   { color: #064e3b !important; }
.dv-library[data-template="modern-education"] .dv-section-description { color: #1e293b !important; }

.dv-library[data-template="legal-prestige"] .dv-section-header {
    background: #f5f0e8 !important;
    border-bottom: 1px solid #d4b483 !important;
}
.dv-library[data-template="legal-prestige"] .dv-section-title   { color: #111827 !important; }
.dv-library[data-template="legal-prestige"] .dv-section-description { color: #374151 !important; }

.dv-library[data-template="ai-tech-saas"] .dv-section-header {
    background: #1a2035 !important;
    border-bottom: 1px solid #2d3a5c !important;
}
.dv-library[data-template="ai-tech-saas"] .dv-section-title   { color: #ffffff !important; }
.dv-library[data-template="ai-tech-saas"] .dv-section-description { color: #22d3ee !important; }

.dv-library[data-template="secure-finance"] .dv-section-header {
    background: #0c4a6e !important;
    border-bottom: 1px solid #0369a1 !important;
}
.dv-library[data-template="secure-finance"] .dv-section-title   { color: #ffffff !important; }
.dv-library[data-template="secure-finance"] .dv-section-description { color: #bae6fd !important; }

.dv-library[data-template="medical-clean"] .dv-section-header {
    background: #e8f7f5 !important;
    border-bottom: 1px solid #5eead4 !important;
}
.dv-library[data-template="medical-clean"] .dv-section-title   { color: #0f766e !important; }
.dv-library[data-template="medical-clean"] .dv-section-description { color: #134e4a !important; }

.dv-library[data-template="property-vault"] .dv-section-header {
    background: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
}
.dv-library[data-template="property-vault"] .dv-section-title   { color: #fed7aa !important; }
.dv-library[data-template="property-vault"] .dv-section-description { color: #94a3b8 !important; }

.dv-library[data-template="corporate-talent"] .dv-section-header {
    background: #eeebfc !important;
    border-bottom: 1px solid #a5b4fc !important;
}
.dv-library[data-template="corporate-talent"] .dv-section-title   { color: #1e1b4b !important; }
.dv-library[data-template="corporate-talent"] .dv-section-description { color: #312e81 !important; }

.dv-library[data-template="strategic-advisory"] .dv-section-header {
    background: #f5f1e8 !important;
    border-bottom: 1px solid #d4a853 !important;
}
.dv-library[data-template="strategic-advisory"] .dv-section-title   { color: #0f172a !important; }
.dv-library[data-template="strategic-advisory"] .dv-section-description { color: #334155 !important; }

.dv-library[data-template="insurance-shield"] .dv-section-header {
    background: #e8eef8 !important;
    border-bottom: 1px solid #93b4e8 !important;
}
.dv-library[data-template="insurance-shield"] .dv-section-title   { color: #1e3a8a !important; }
.dv-library[data-template="insurance-shield"] .dv-section-description { color: #1e40af !important; }

.dv-library[data-template="document-authority"] .dv-section-header {
    background: #f4f2ee !important;
    border-bottom: 1px solid #c4b99a !important;
}
.dv-library[data-template="document-authority"] .dv-section-title   { color: #111827 !important; }
.dv-library[data-template="document-authority"] .dv-section-description { color: #374151 !important; }

.dv-library[data-template="luxury-secure"] .dv-section-header {
    background: #222222 !important;
    border-bottom: 1px solid #4a3a1a !important;
}
.dv-library[data-template="luxury-secure"] .dv-section-title   { color: #d4af37 !important; }
.dv-library[data-template="luxury-secure"] .dv-section-description { color: #c0993c !important; }

/* ── Per-template section badges ────────────────────────────────────────── */
/* Badges use a gradient matching the hero accent colour of each template.
   generate_css() overrides only when user customises badge colours in Design panel. */

.dv-library[data-template="academic-authority"] .dv-section-badge {
    background: linear-gradient(135deg, #1d4ed8, #1e3a5f) !important; color: #fff !important;
}
.dv-library[data-template="modern-education"] .dv-section-badge {
    background: linear-gradient(135deg, #16a34a, #065f46) !important; color: #fff !important;
}
.dv-library[data-template="legal-prestige"] .dv-section-badge {
    background: linear-gradient(135deg, #b45309, #7c2d12) !important; color: #fff !important;
}
.dv-library[data-template="ai-tech-saas"] .dv-section-badge {
    background: linear-gradient(135deg, #4f46e5, #22d3ee) !important; color: #fff !important;
}
.dv-library[data-template="secure-finance"] .dv-section-badge {
    background: linear-gradient(135deg, #0369a1, #065f46) !important; color: #fff !important;
}
.dv-library[data-template="medical-clean"] .dv-section-badge {
    background: linear-gradient(135deg, #14b8a6, #0d9488) !important; color: #fff !important;
}
.dv-library[data-template="property-vault"] .dv-section-badge {
    background: linear-gradient(135deg, #ea580c, #451a03) !important; color: #fff !important;
}
.dv-library[data-template="corporate-talent"] .dv-section-badge {
    background: linear-gradient(135deg, #7c3aed, #312e81) !important; color: #fff !important;
}
.dv-library[data-template="strategic-advisory"] .dv-section-badge {
    background: linear-gradient(135deg, #d97706, #422006) !important; color: #fff !important;
}
.dv-library[data-template="insurance-shield"] .dv-section-badge {
    background: linear-gradient(135deg, #1e3a8a, #1e40af) !important; color: #fff !important;
}
.dv-library[data-template="document-authority"] .dv-section-badge {
    background: linear-gradient(135deg, #374151, #111827) !important; color: #fff !important;
}
.dv-library[data-template="luxury-secure"] .dv-section-badge {
    background: linear-gradient(135deg, #c8961e, #a07012) !important; color: #fff !important;
}

/* ────────────────────────────────────────────────────────
   1. Academic Authority  — Navy + Gold
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="academic-authority"] .dv-library-hero {
    background: linear-gradient(160deg, #0f172a 0%, #1e3a5f 45%, #0f172a 100%) !important;
    box-shadow: 0 4px 30px rgba(0,0,0,.35);
}
.dv-library[data-template="academic-authority"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(245,158,11,.14) 0%, transparent 65%) !important;
}
.dv-library[data-template="academic-authority"] .dv-library-footer {
    background: linear-gradient(135deg, #0a1020 0%, #0f172a 100%) !important;
}

/* ────────────────────────────────────────────────────────
   2. Modern Education  — Teal + Blue
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="modern-education"] .dv-library-hero {
    background: linear-gradient(150deg, #0c4a6e 0%, #065f46 50%, #064e3b 100%) !important;
    box-shadow: 0 4px 28px rgba(0,0,0,.30);
}
.dv-library[data-template="modern-education"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(134,239,172,.15) 0%, transparent 65%) !important;
}
.dv-library[data-template="modern-education"] .dv-library-footer {
    background: linear-gradient(135deg, #052e16 0%, #1e293b 100%) !important;
}

/* ────────────────────────────────────────────────────────
   3. Legal Prestige  — Deep charcoal + Gold
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="legal-prestige"] .dv-library-hero {
    background: linear-gradient(150deg, #111827 0%, #1c1208 45%, #111827 100%) !important;
    box-shadow: 0 4px 32px rgba(0,0,0,.45);
}
.dv-library[data-template="legal-prestige"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(180,83,9,.18) 0%, transparent 65%) !important;
}
.dv-library[data-template="legal-prestige"] .dv-library-hero::after {
    /* Diagonal fine lines — prestige feel */
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(255,255,255,.03) 0px,
        rgba(255,255,255,.03) 1px,
        transparent 1px,
        transparent 14px
    );
}
.dv-library[data-template="legal-prestige"] .dv-library-hero h1 {
    font-style: italic;
}
.dv-library[data-template="legal-prestige"] .dv-library-footer {
    background: linear-gradient(135deg, #000000 0%, #111827 100%) !important;
}

/* ────────────────────────────────────────────────────────
   4. AI Tech SaaS  — Dark indigo + Cyan neon
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="ai-tech-saas"] .dv-library-hero {
    background: linear-gradient(135deg, #0f0f1a 0%, #1e1b4b 50%, #0f172a 100%) !important;
    box-shadow: 0 4px 40px rgba(99,102,241,.25);
}
.dv-library[data-template="ai-tech-saas"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(34,211,238,.18) 0%, transparent 65%) !important;
    top: -60px; right: -60px;
    width: 380px; height: 380px;
}
.dv-library[data-template="ai-tech-saas"] .dv-library-hero::after {
    /* Fine grid — tech aesthetic */
    background-image:
        linear-gradient(rgba(99,102,241,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,102,241,.08) 1px, transparent 1px);
    background-size: 32px 32px;
}
.dv-library[data-template="ai-tech-saas"] .dv-library-footer {
    background: linear-gradient(135deg, #030308 0%, #0b0b13 100%) !important;
}

/* ────────────────────────────────────────────────────────
   5. Secure Finance  — Deep blue + Emerald
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="secure-finance"] .dv-library-hero {
    background: linear-gradient(150deg, #0c4a6e 0%, #0f172a 40%, #064e3b 100%) !important;
    box-shadow: 0 4px 28px rgba(0,0,0,.35);
}
.dv-library[data-template="secure-finance"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(16,185,129,.14) 0%, transparent 65%) !important;
}
.dv-library[data-template="secure-finance"] .dv-library-footer {
    background: linear-gradient(135deg, #051e31 0%, #0c4a6e 100%) !important;
}

/* ────────────────────────────────────────────────────────
   6. Medical Clean  — Teal deep + Cyan
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="medical-clean"] .dv-library-hero {
    background: linear-gradient(145deg, #0d4f4f 0%, #0f766e 50%, #0d9488 100%) !important;
    box-shadow: 0 4px 28px rgba(13,148,136,.25);
}
.dv-library[data-template="medical-clean"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(153,246,228,.18) 0%, transparent 65%) !important;
}
.dv-library[data-template="medical-clean"] .dv-library-hero::after {
    /* Wave-like soft lines */
    background-image: repeating-linear-gradient(
        0deg,
        rgba(255,255,255,.04) 0px,
        rgba(255,255,255,.04) 1px,
        transparent 1px,
        transparent 20px
    );
}
.dv-library[data-template="medical-clean"] .dv-library-footer {
    background: linear-gradient(135deg, #042f2e 0%, #0f766e 100%) !important;
}

/* ────────────────────────────────────────────────────────
   7. Property Vault  — Slate + Amber
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="property-vault"] .dv-library-hero {
    background: linear-gradient(150deg, #0f172a 0%, #1e293b 40%, #451a03 100%) !important;
    box-shadow: 0 4px 28px rgba(0,0,0,.38);
}
.dv-library[data-template="property-vault"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(249,115,22,.16) 0%, transparent 65%) !important;
}
.dv-library[data-template="property-vault"] .dv-library-footer {
    background: linear-gradient(135deg, #0a0f18 0%, #1e293b 100%) !important;
}

/* ────────────────────────────────────────────────────────
   8. Corporate Talent  — Indigo → Purple
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="corporate-talent"] .dv-library-hero {
    background: linear-gradient(145deg, #0f172a 0%, #312e81 50%, #4c1d95 100%) !important;
    box-shadow: 0 4px 30px rgba(79,70,229,.28);
}
.dv-library[data-template="corporate-talent"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(196,181,253,.15) 0%, transparent 65%) !important;
}
.dv-library[data-template="corporate-talent"] .dv-library-footer {
    background: linear-gradient(135deg, #050510 0%, #111827 100%) !important;
}

/* ────────────────────────────────────────────────────────
   9. Strategic Advisory  — Navy + Gold accent
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="strategic-advisory"] .dv-library-hero {
    background: linear-gradient(155deg, #0f172a 0%, #1c1a0f 50%, #422006 100%) !important;
    box-shadow: 0 4px 32px rgba(0,0,0,.40);
}
.dv-library[data-template="strategic-advisory"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(245,158,11,.15) 0%, transparent 65%) !important;
}
.dv-library[data-template="strategic-advisory"] .dv-library-hero::after {
    background-image: repeating-linear-gradient(
        -60deg,
        rgba(255,255,255,.025) 0px,
        rgba(255,255,255,.025) 1px,
        transparent 1px,
        transparent 18px
    );
}
.dv-library[data-template="strategic-advisory"] .dv-library-footer {
    background: linear-gradient(135deg, #000000 0%, #0f172a 100%) !important;
}

/* ────────────────────────────────────────────────────────
   10. Insurance Shield  — Deep blue + Red signal
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="insurance-shield"] .dv-library-hero {
    background: linear-gradient(150deg, #1e3a8a 0%, #0c4a6e 50%, #1e40af 100%) !important;
    box-shadow: 0 4px 28px rgba(30,58,138,.35);
}
.dv-library[data-template="insurance-shield"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(191,219,254,.14) 0%, transparent 65%) !important;
}
.dv-library[data-template="insurance-shield"] .dv-library-footer {
    background: linear-gradient(135deg, #0a1540 0%, #1e3a8a 100%) !important;
}

/* ────────────────────────────────────────────────────────
   11. Document Authority  — Slate + Amber
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="document-authority"] .dv-library-hero {
    background: linear-gradient(150deg, #111827 0%, #1f2937 45%, #111827 100%) !important;
    box-shadow: 0 4px 24px rgba(0,0,0,.32);
}
.dv-library[data-template="document-authority"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(180,83,9,.13) 0%, transparent 65%) !important;
}
.dv-library[data-template="document-authority"] .dv-library-hero::after {
    background-image: radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 22px 22px;
}
.dv-library[data-template="document-authority"] .dv-library-footer {
    background: linear-gradient(135deg, #050709 0%, #111827 100%) !important;
}

/* ────────────────────────────────────────────────────────
   12. Luxury Secure  — Obsidian + Pure Gold
   ──────────────────────────────────────────────────────── */
.dv-library[data-template="luxury-secure"] .dv-library-hero {
    background: linear-gradient(150deg, #000000 0%, #1c1410 40%, #2d1f0e 100%) !important;
    box-shadow: 0 4px 40px rgba(212,175,55,.18);
}
.dv-library[data-template="luxury-secure"] .dv-library-hero::before {
    background: radial-gradient(circle, rgba(212,175,55,.18) 0%, transparent 60%) !important;
}
.dv-library[data-template="luxury-secure"] .dv-library-hero::after {
    /* Fine gold-tint lines — luxury feel */
    background-image: repeating-linear-gradient(
        -45deg,
        rgba(212,175,55,.04) 0px,
        rgba(212,175,55,.04) 1px,
        transparent 1px,
        transparent 16px
    );
}
.dv-library[data-template="luxury-secure"] .dv-library-hero h1 {
    font-style: italic;
    letter-spacing: .02em;
}
.dv-library[data-template="luxury-secure"] .dv-library-footer {
    background: linear-gradient(135deg, #000000 0%, #0d0b08 100%) !important;
    border-top: 1px solid rgba(212,175,55,.18);
}

/* ==========================================================================
   TEMPLATE GEOMETRIC GLASS EFFECTS — v1.3.2
   Subtle decorative shapes on hero: diamond, rotated squares, and floating
   glass circles. All use rgba white at very low opacity so they work on
   any coloured gradient background without changing perceived colours.
   Uses ::before on section-specific elements to avoid conflicting with
   the hero pseudo-elements already in use.
   ========================================================================== */

/* ── Shared: floating glass diamond top-left of hero ── */
.dv-library[data-template] .dv-library-hero .dv-hero-title-wrap::before {
    content: '';
    position: absolute;
    left: -40px; top: 30px;
    width: 80px; height: 80px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 4px;
    transform: rotate(45deg);
    pointer-events: none;
    z-index: 0;
}

/* ── Shared: small rotated square bottom-right of hero ── */
.dv-library[data-template] .dv-library-hero .dv-hero-title-wrap::after {
    content: '';
    position: absolute;
    right: 5%; bottom: 15%;
    width: 44px; height: 44px;
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 3px;
    transform: rotate(30deg);
    pointer-events: none;
    z-index: 0;
}

/* ── Shared: glass circle overlay in hero — large faint ring ── */
.dv-library[data-template] .dv-library-container::before {
    content: '';
    position: absolute;
    left: -60px; top: -60px;
    width: 200px; height: 200px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,.05);
    pointer-events: none;
    z-index: 0;
}

/* ── Section cards: glass shimmer line on section header top-edge ── */
.dv-library[data-template] .dv-section-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent) !important;
    pointer-events: none;
}

/* ── Template-specific: accent diamond size and colour tint ─────── */

/* Academic Authority — navy shimmer */
.dv-library[data-template="academic-authority"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(245,158,11,.12);
    width: 90px; height: 90px;
}

/* Legal Prestige — gold accent diamond */
.dv-library[data-template="legal-prestige"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(180,83,9,.20);
    width: 100px; height: 100px;
}

/* AI Tech SaaS — cyan neon diamond + extra small square */
.dv-library[data-template="ai-tech-saas"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(34,211,238,.16);
    box-shadow: 0 0 12px rgba(34,211,238,.08);
}
.dv-library[data-template="ai-tech-saas"] .dv-library-hero .dv-hero-title-wrap::after {
    border-color: rgba(99,102,241,.18);
    box-shadow: 0 0 8px rgba(99,102,241,.06);
}

/* Luxury Secure — gold shimmer diamond */
.dv-library[data-template="luxury-secure"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(212,175,55,.22);
    box-shadow: 0 0 16px rgba(212,175,55,.08);
    width: 96px; height: 96px;
}
.dv-library[data-template="luxury-secure"] .dv-library-hero .dv-hero-title-wrap::after {
    border-color: rgba(212,175,55,.14);
}

/* Insurance Shield — blue accent */
.dv-library[data-template="insurance-shield"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(191,219,254,.14);
}

/* Strategic Advisory — amber accent */
.dv-library[data-template="strategic-advisory"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(253,230,138,.14);
}

/* Modern Education — green tint */
.dv-library[data-template="modern-education"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(134,239,172,.14);
}

/* Medical Clean — teal shimmer */
.dv-library[data-template="medical-clean"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(153,246,228,.16);
}

/* Corporate Talent — purple shimmer */
.dv-library[data-template="corporate-talent"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(196,181,253,.14);
    box-shadow: 0 0 10px rgba(124,58,237,.06);
}

/* Secure Finance — emerald shimmer */
.dv-library[data-template="secure-finance"] .dv-library-hero .dv-hero-title-wrap::before {
    border-color: rgba(110,231,183,.14);
}

/* ── Glass section icon background ────────────────────────────────── */
/* Adds a very subtle circular glass halo around the section emoji icon */
.dv-library[data-template] .dv-section-icon {
    position: relative;
}
.dv-library[data-template] .dv-section-icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.07) 0%, transparent 70%) !important;
    pointer-events: none;
}

/* ── Dark templates: adapt glass shimmer to be visible on dark bg ── */
.dv-library[data-template="ai-tech-saas"] .dv-section-header::before,
.dv-library[data-template="luxury-secure"] .dv-section-header::before,
.dv-library[data-template="property-vault"] .dv-section-header::before {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.10), transparent) !important;
}

/* ── Per-file unlock: shake animation on wrong password ── */
@keyframes dvFileShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-5px); }
    40%     { transform: translateX(5px); }
    60%     { transform: translateX(-4px); }
    80%     { transform: translateX(4px); }
}
