/* =========================================
   PDF Editor Theme – Redesigned Premium UI
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ─── Design Tokens ─── */
:root {
    --pde-primary: #6366f1;
    --pde-primary-hover: #4f46e5;
    --pde-primary-light: rgba(99, 102, 241, 0.10);
    --pde-primary-glow: rgba(99, 102, 241, 0.15);
    --pde-primary-subtle: rgba(99, 102, 241, 0.06);
    --pde-success: #16a34a;
    --pde-success-light: rgba(22, 163, 74, 0.10);
    --pde-warning: #d97706;
    --pde-warning-light: rgba(217, 119, 6, 0.10);
    --pde-danger: #dc2626;
    --pde-danger-hover: #b91c1c;
    --pde-danger-light: rgba(220, 38, 38, 0.08);

    --pde-bg: #f4f5f7;
    --pde-bg-raised: #ffffff;
    --pde-bg-overlay: #eef0f4;
    --pde-surface: #eef0f4;
    --pde-surface-hover: #e2e5eb;
    --pde-surface-active: #d8dbe3;
    --pde-surface-border: rgba(0, 0, 0, 0.06);

    --pde-toolbar-bg: rgba(255, 255, 255, 0.92);
    --pde-toolbar-border: rgba(0, 0, 0, 0.08);
    --pde-sidebar-bg: #ffffff;
    --pde-sidebar-width: 300px;
    --pde-toolbar-height: 56px;
    --pde-statusbar-height: 28px;
    --pde-left-toolbar-width: 48px;

    --pde-text: #1e293b;
    --pde-text-secondary: #475569;
    --pde-text-muted: #94a3b8;
    --pde-text-white: #0f172a;

    --pde-border: rgba(0, 0, 0, 0.08);
    --pde-border-strong: rgba(0, 0, 0, 0.12);
    --pde-border-active: rgba(99, 102, 241, 0.3);

    --pde-shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --pde-shadow: 0 4px 14px rgba(0,0,0,0.07);
    --pde-shadow-lg: 0 10px 40px rgba(0,0,0,0.10);
    --pde-shadow-glow: 0 0 24px rgba(99,102,241,0.08);

    --pde-radius-xs: 4px;
    --pde-radius-sm: 8px;
    --pde-radius: 12px;
    --pde-radius-lg: 16px;
    --pde-radius-xl: 20px;

    --pde-transition: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --pde-transition-slow: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    color: var(--pde-text);
    background: var(--pde-bg);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.pde-hidden { display: none !important; }

/* ─── App Shell ─── */
#pde-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: var(--pde-bg);
}

/* =========================================
   TOOLBAR
   ========================================= */
#pde-toolbar {
    display: flex;
    align-items: center;
    height: var(--pde-toolbar-height);
    background: var(--pde-toolbar-bg);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border-bottom: 1px solid var(--pde-toolbar-border);
    padding: 0 16px;
    flex-shrink: 0;
    z-index: 100;
    gap: 8px;
}

.pde-toolbar-left {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.pde-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    flex-shrink: 0;
}

.pde-logo-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--pde-primary), #a78bfa);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
    transition: transform var(--pde-transition);
}

.pde-logo:hover .pde-logo-icon { transform: scale(1.05); }

.pde-logo-icon svg { width: 16px; height: 16px; color: #fff; }

.pde-logo-text {
    font-size: 15px;
    font-weight: 800;
    color: var(--pde-text-white);
    letter-spacing: -0.4px;
}

.pde-filename {
    font-size: 12px;
    color: var(--pde-text-muted);
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pde-filename.has-file { color: var(--pde-text-secondary); }

.pde-toolbar-center {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    justify-content: center;
    scrollbar-width: none;
    padding: 0 4px;
}

.pde-toolbar-center::-webkit-scrollbar { display: none; }

.pde-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ─── Tool Buttons ─── */
.pde-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--pde-text-secondary);
    padding: 7px 12px;
    border-radius: var(--pde-radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--pde-transition);
    font-family: inherit;
    position: relative;
}

.pde-tool-btn:hover:not(:disabled) {
    background: var(--pde-surface);
    color: var(--pde-text-white);
    border-color: var(--pde-border);
}

.pde-tool-btn:active:not(:disabled) {
    background: var(--pde-surface-active);
    transform: scale(0.97);
}

.pde-tool-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.pde-tool-btn.active {
    background: var(--pde-primary-light);
    color: var(--pde-primary);
    border-color: var(--pde-border-active);
    box-shadow: inset 0 0 0 1px rgba(99,102,241,0.08);
}

.pde-tool-btn.active svg {
    filter: drop-shadow(0 0 3px rgba(99,102,241,0.35));
}

.pde-tool-btn svg { flex-shrink: 0; transition: all var(--pde-transition); }

.pde-tool-btn-icon { padding: 7px 8px; }
.pde-tool-btn-icon span { display: none; }

/* Upload button */
.pde-tool-btn-upload {
    background: var(--pde-primary-subtle);
    border-color: rgba(99,102,241,0.12);
    color: var(--pde-primary);
}

.pde-tool-btn-upload:hover:not(:disabled) {
    background: var(--pde-primary-light);
    border-color: var(--pde-border-active);
    color: var(--pde-primary);
}

/* Export button */
.pde-btn-export {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 18px;
    background: linear-gradient(135deg, var(--pde-primary), #818cf8);
    border: none;
    border-radius: var(--pde-radius-sm);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--pde-transition);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

.pde-btn-export:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
    transform: translateY(-1px);
}

.pde-btn-export:active:not(:disabled) { transform: translateY(0) scale(0.98); }

.pde-btn-export:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    box-shadow: none;
}

.pde-separator {
    width: 1px;
    height: 22px;
    background: var(--pde-border);
    flex-shrink: 0;
    margin: 0 2px;
}

/* ─── Toolbar Groups ─── */
.pde-tool-group {
    display: flex;
    align-items: center;
    gap: 1px;
    background: var(--pde-surface);
    border: 1px solid var(--pde-surface-border);
    border-radius: var(--pde-radius-sm);
    padding: 2px;
}

.pde-tool-group .pde-tool-btn {
    padding: 6px 10px;
    border-radius: 6px;
}

.pde-zoom-group {
    gap: 0;
}

.pde-zoom-group .pde-tool-btn { padding: 6px 7px; }

/* ─── Zoom Display ─── */
.pde-zoom-display {
    font-size: 11px;
    font-weight: 700;
    color: var(--pde-text-muted);
    min-width: 38px;
    text-align: center;
    padding: 2px 0;
    font-variant-numeric: tabular-nums;
}

/* ─── User Badge ─── */
.pde-user-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.pde-badge-pro {
    background: var(--pde-success-light);
    color: var(--pde-success);
    border: 1px solid rgba(34,197,94,0.15);
}

.pde-badge-free {
    background: var(--pde-warning-light);
    color: var(--pde-warning);
    border: 1px solid rgba(245,158,11,0.15);
}

.pde-login-link {
    color: var(--pde-text-muted);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--pde-transition);
}

.pde-login-link:hover { color: var(--pde-primary); }

/* =========================================
   BODY LAYOUT
   ========================================= */
#pde-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* =========================================
   LEFT TOOLBAR
   ========================================= */
#pde-left-toolbar {
    width: var(--pde-left-toolbar-width);
    background: var(--pde-bg-raised);
    border-right: 1px solid var(--pde-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding: 8px 0;
    gap: 2px;
    overflow: visible;
    position: relative;
    z-index: 50;
}

.pde-ltb-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.pde-ltb-separator {
    width: 24px;
    height: 1px;
    background: var(--pde-border);
    margin: 6px 0;
    flex-shrink: 0;
}

.pde-ltb-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--pde-radius-sm);
    color: var(--pde-text-secondary);
    cursor: pointer;
    transition: all var(--pde-transition);
    position: relative;
    flex-shrink: 0;
    padding: 0;
    font-family: inherit;
}

.pde-ltb-btn:hover:not(:disabled) {
    background: var(--pde-surface);
    color: var(--pde-text-white);
    border-color: var(--pde-border);
}

.pde-ltb-btn:active:not(:disabled) {
    background: var(--pde-surface-active);
    transform: scale(0.93);
}

.pde-ltb-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.pde-ltb-btn.active {
    background: var(--pde-primary-light);
    color: var(--pde-primary);
    border-color: var(--pde-border-active);
    box-shadow: inset 0 0 0 1px rgba(99,102,241,0.08);
}

.pde-ltb-btn.active svg {
    filter: drop-shadow(0 0 3px rgba(99,102,241,0.35));
}

.pde-ltb-btn svg { flex-shrink: 0; transition: all var(--pde-transition); }

/* Tooltip (right side) */
[data-tooltip] { position: relative; }

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--pde-text-white);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 500;
    box-shadow: var(--pde-shadow);
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* Flyout dropdown wrappers in left toolbar */
.pde-ltb-dropdown-wrapper {
    position: relative;
    display: flex;
}

.pde-ltb-dropdown-trigger {
    position: relative;
}

/* Small right-arrow caret indicator on flyout triggers */
.pde-ltb-dropdown-trigger .pde-ltb-caret {
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    color: var(--pde-text-muted);
    pointer-events: none;
}

.pde-ltb-dropdown-trigger.active .pde-ltb-caret {
    color: var(--pde-primary);
}

/* Flyout menu – opens to the right */
.pde-ltb-dropdown-wrapper .pde-dropdown-menu {
    position: absolute;
    left: calc(100% + 6px);
    top: 0;
    transform: none;
    display: none;
    background: var(--pde-bg-raised);
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    box-shadow: var(--pde-shadow-lg);
    z-index: 200;
    min-width: 140px;
    padding: 4px;
    animation: pde-ltb-flyout-in 0.15s ease;
}

.pde-ltb-dropdown-wrapper.open .pde-dropdown-menu {
    display: block;
}

@keyframes pde-ltb-flyout-in {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Mobile toggle for left toolbar */
#pde-ltb-toggle {
    display: none;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background: var(--pde-surface);
    border: 1px solid var(--pde-border);
    border-radius: 6px;
    color: var(--pde-text-secondary);
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    transition: all var(--pde-transition);
}

#pde-ltb-toggle:hover {
    background: var(--pde-surface-hover);
    color: var(--pde-text-white);
}

/* =========================================
   CANVAS AREA
   ========================================= */
#pde-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: auto;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.04) 0%, transparent 50%),
        repeating-conic-gradient(rgba(0,0,0,0.02) 0% 25%, transparent 0% 50%) 0 0 / 24px 24px,
        var(--pde-bg);
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: var(--pde-surface) transparent;
}

#pde-canvas-area::-webkit-scrollbar { width: 8px; height: 8px; }
#pde-canvas-area::-webkit-scrollbar-track { background: transparent; }
#pde-canvas-area::-webkit-scrollbar-thumb { background: var(--pde-surface); border-radius: 4px; }
#pde-canvas-area::-webkit-scrollbar-thumb:hover { background: var(--pde-surface-hover); }

/* ─── Empty State ─── */
#pde-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 32px;
}

.pde-drop-zone {
    position: relative;
    width: 560px;
    max-width: 100%;
    border-radius: var(--pde-radius-xl);
    padding: 3px;
    background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(168,139,250,0.08), rgba(99,102,241,0.03));
    transition: all 0.3s ease;
}

.pde-drop-zone:hover {
    background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(168,139,250,0.15), rgba(99,102,241,0.08));
}

.pde-drop-zone-glow {
    position: absolute;
    inset: -40px;
    background: radial-gradient(ellipse at center, rgba(99,102,241,0.06) 0%, transparent 70%);
    pointer-events: none;
    border-radius: 50%;
}

.pde-drop-zone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 56px 40px;
    background: var(--pde-bg-raised);
    border-radius: calc(var(--pde-radius-xl) - 3px);
    border: 1px dashed rgba(0,0,0,0.10);
}

.pde-drop-zone-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--pde-primary-light), var(--pde-primary-subtle));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    position: relative;
    color: var(--pde-primary);
}

.pde-drop-zone-icon-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, var(--pde-primary), #818cf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 2px 6px rgba(99,102,241,0.3);
    border: 2px solid #fff;
}

.pde-drop-zone-icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 22px;
    border: 1.5px solid rgba(99,102,241,0.12);
    animation: pde-pulse-ring 3s ease-in-out infinite;
}

@keyframes pde-pulse-ring {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0; transform: scale(1.12); }
}

#pde-empty-state h2 {
    font-size: 21px;
    font-weight: 700;
    color: var(--pde-text-white);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

#pde-empty-state p {
    color: var(--pde-text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.pde-upload-area-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 26px;
    background: linear-gradient(135deg, var(--pde-primary), #818cf8);
    color: #fff;
    border: none;
    border-radius: var(--pde-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--pde-transition-slow);
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
    font-family: inherit;
}

.pde-upload-area-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99,102,241,0.45);
}

.pde-drop-zone-features {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.pde-feature-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 500;
    color: var(--pde-text-muted);
    background: rgba(0,0,0,0.03);
    border: 1px solid var(--pde-border);
}

.pde-feature-chip svg { color: var(--pde-success); }

/* ─── PDF Viewer ─── */
#pde-viewer {
    padding: 24px 0 60px;
}

#pde-page-wrapper {
    position: relative;
    display: inline-block;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.05),
        0 2px 4px rgba(0,0,0,0.06),
        0 8px 24px rgba(0,0,0,0.08),
        0 24px 48px rgba(0,0,0,0.04);
    background: #fff;
    line-height: 0;
    border-radius: 4px;
}

#pde-canvas { display: block; }

#pde-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
}

#pde-overlay.blackout-active {
    cursor: crosshair;
}

#pde-draw-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 5;
    pointer-events: none;
}

#pde-draw-canvas.active {
    pointer-events: auto;
    cursor: crosshair;
    z-index: 15;
}

/* =========================================
   OVERLAY ELEMENTS
   ========================================= */
.pde-element {
    position: absolute;
    cursor: move;
    z-index: 20;
    min-width: 20px;
    min-height: 20px;
    outline: 2px solid transparent;
    outline-offset: 3px;
    transition: outline-color 0.12s, box-shadow 0.12s;
    border-radius: 2px;
}

.pde-element:hover {
    outline-color: rgba(99,102,241,0.5);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.06);
}

.pde-element.selected {
    outline: 2px solid var(--pde-primary);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(99,102,241,0.08);
}

.pde-element.selected::after {
    content: '';
    position: absolute;
    bottom: -9px; right: -9px;
    width: 14px; height: 14px;
    background: var(--pde-primary);
    border: 2px solid #fff;
    border-radius: 3px;
    cursor: nwse-resize;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

.pde-text-element.selected::after { display: none; }

.pde-text-element {
    padding: 4px 8px;
    font-size: 16px;
    color: #000;
    white-space: pre-wrap;
    word-break: break-word;
    user-select: none;
    line-height: 1.4;
    cursor: move;
    outline: none;
    min-width: 20px;
    min-height: 1em;
}

.pde-text-element.editing {
    cursor: text;
    user-select: text;
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.95);
}

.pde-image-element img,
.pde-signature-element img {
    width: 100%; height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
}

.pde-blackout-element { background: #000; border-radius: 2px; }

.pde-blackout-preview {
    position: absolute;
    background: rgba(0,0,0,0.45);
    border: 2px solid rgba(239,68,68,0.5);
    pointer-events: none;
    z-index: 25;
    border-radius: 2px;
    backdrop-filter: blur(1px);
}

/* =========================================
   SIDEBAR
   ========================================= */
#pde-sidebar {
    width: var(--pde-sidebar-width);
    background: var(--pde-sidebar-bg);
    border-left: 1px solid var(--pde-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--pde-transition-slow), opacity var(--pde-transition-slow);
}

#pde-sidebar.collapsed {
    width: 40px;
    overflow: hidden;
}

#pde-sidebar.collapsed .pde-sidebar-scroll,
#pde-sidebar.collapsed .pde-page-nav-bar {
    display: none;
}

#pde-sidebar.collapsed .pde-sidebar-header {
    justify-content: center;
    padding: 16px 0 12px;
}

#pde-sidebar.collapsed .pde-sidebar-header span {
    display: none;
}

.pde-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--pde-surface) transparent;
}

.pde-sidebar-scroll::-webkit-scrollbar { width: 3px; }
.pde-sidebar-scroll::-webkit-scrollbar-thumb { background: var(--pde-surface); border-radius: 2px; }

.pde-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--pde-border);
    flex-shrink: 0;
}

.pde-sidebar-header span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--pde-text-muted);
}

.pde-sidebar-collapse {
    background: transparent;
    border: none;
    color: var(--pde-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--pde-transition);
}

.pde-sidebar-collapse:hover { background: var(--pde-surface); color: var(--pde-text); }

#pde-sidebar.collapsed .pde-sidebar-collapse svg {
    transform: rotate(180deg);
}

.pde-sidebar-section {
    padding: 18px;
    border-bottom: 1px solid var(--pde-border);
}

.pde-sidebar-section h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--pde-text-white);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pde-sidebar-section h4 svg {
    color: var(--pde-primary);
    flex-shrink: 0;
}

/* Empty props state */
.pde-empty-props-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
    color: var(--pde-text-muted);
    opacity: 0.5;
}

.pde-shortcut-hints {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 16px;
}

.pde-shortcut-hints span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--pde-text-muted);
    font-weight: 500;
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    background: var(--pde-surface);
    border: 1px solid var(--pde-border-strong);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    font-family: inherit;
    color: var(--pde-text-secondary);
    box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}

/* Info card */
.pde-info-card {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: var(--pde-primary-subtle);
    border: 1px solid rgba(99,102,241,0.1);
    border-radius: var(--pde-radius-sm);
}

.pde-info-card svg { color: var(--pde-primary); flex-shrink: 0; margin-top: 1px; }
.pde-info-card p { font-size: 12px; color: var(--pde-text-secondary); line-height: 1.5; }

/* ─── Sidebar Labels & Inputs ─── */
.pde-sidebar-section label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--pde-text-muted);
    margin-bottom: 6px;
    margin-top: 14px;
}

.pde-sidebar-section label:first-of-type { margin-top: 0; }

.pde-sidebar-section input[type="number"],
.pde-sidebar-section input[type="text"],
.pde-sidebar-section textarea,
.pde-sidebar-section select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    font-size: 12px;
    font-family: inherit;
    background: var(--pde-surface);
    color: var(--pde-text);
    transition: all var(--pde-transition);
    appearance: none;
}

.pde-sidebar-section textarea { resize: vertical; min-height: 56px; }

.pde-sidebar-section input:focus,
.pde-sidebar-section textarea:focus,
.pde-sidebar-section select:focus {
    outline: none;
    border-color: var(--pde-primary);
    box-shadow: 0 0 0 3px var(--pde-primary-light);
    background: var(--pde-bg-overlay);
}

.pde-sidebar-section select {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.pde-sidebar-section input[type="color"] {
    width: 100%;
    height: 34px;
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    padding: 3px;
    cursor: pointer;
    background: var(--pde-surface);
}

/* Property rows */
.pde-prop-row {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.pde-prop-col { flex: 1; }
.pde-prop-col label { margin-top: 0; }

.pde-input-suffix {
    display: flex;
    align-items: center;
    gap: 0;
}

.pde-input-suffix input {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
}

.pde-input-suffix span {
    padding: 8px 8px;
    background: var(--pde-surface);
    border: 1px solid var(--pde-border-strong);
    border-left: none;
    border-radius: 0 var(--pde-radius-sm) var(--pde-radius-sm) 0;
    font-size: 11px;
    color: var(--pde-text-muted);
    font-weight: 600;
}

/* Range wrapper */
.pde-range-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.pde-range-wrapper input[type="range"] {
    flex: 1;
    accent-color: var(--pde-primary);
    height: 4px;
}

.pde-range-value {
    font-size: 11px;
    font-weight: 700;
    color: var(--pde-text-secondary);
    min-width: 32px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Style toggles (Bold/Italic) */
.pde-style-toggles {
    display: flex;
    gap: 6px;
    margin-top: 14px;
}

.pde-style-toggle {
    margin: 0 !important;
    padding: 0 !important;
}

.pde-style-toggle input { display: none; }

.pde-style-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 32px;
    background: var(--pde-surface);
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    color: var(--pde-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--pde-transition);
}

.pde-style-toggle input:checked + .pde-style-toggle-label {
    background: var(--pde-primary-light);
    color: var(--pde-primary);
    border-color: var(--pde-border-active);
}

.pde-muted {
    color: var(--pde-text-muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

/* ─── Page Nav (in sidebar) ─── */
.pde-page-nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-top: 1px solid var(--pde-border);
    border-bottom: 1px solid var(--pde-border);
    background: var(--pde-bg-raised);
    flex-shrink: 0;
}

.pde-page-btn {
    background: var(--pde-surface);
    border: 1px solid var(--pde-border);
    color: var(--pde-text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--pde-transition);
    font-family: inherit;
}

.pde-page-btn:hover:not(:disabled) {
    background: var(--pde-primary);
    color: #fff;
    border-color: var(--pde-primary);
}

.pde-page-btn:disabled { opacity: 0.25; cursor: not-allowed; }

.pde-page-info {
    font-size: 12px;
    font-weight: 700;
    color: var(--pde-text);
    min-width: 50px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ─── Sidebar Footer ─── */
.pde-sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--pde-border);
    border-bottom: none;
    background: var(--pde-bg-raised);
    padding: 14px 18px;
    flex-shrink: 0;
}

.pde-limit-bar { margin-bottom: 10px; }

.pde-limit-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.pde-limit-label span { font-size: 11px; color: var(--pde-text-muted); font-weight: 500; }
.pde-limit-label strong { font-size: 11px; color: var(--pde-warning); font-weight: 700; }

.pde-limit-track {
    width: 100%;
    height: 4px;
    background: var(--pde-surface);
    border-radius: 2px;
    overflow: hidden;
}

.pde-limit-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--pde-warning), #fbbf24);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.pde-upgrade-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--pde-primary);
    text-decoration: none;
    transition: color var(--pde-transition);
}

.pde-upgrade-link:hover { color: #818cf8; }

.pde-pro-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--pde-success);
}

/* =========================================
   STATUS BAR
   ========================================= */
#pde-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--pde-statusbar-height);
    padding: 0 14px;
    background: var(--pde-bg-raised);
    border-top: 1px solid var(--pde-border);
    flex-shrink: 0;
    z-index: 50;
}

.pde-statusbar-left,
.pde-statusbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pde-status-item {
    font-size: 11px;
    font-weight: 500;
    color: var(--pde-text-muted);
    font-variant-numeric: tabular-nums;
}

/* =========================================
   BUTTONS
   ========================================= */
.pde-btn-danger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 14px;
    margin-top: 18px;
    background: var(--pde-danger-light);
    color: var(--pde-danger);
    border: 1px solid rgba(239,68,68,0.12);
    border-radius: var(--pde-radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--pde-transition);
    font-family: inherit;
}

.pde-btn-danger:hover {
    background: var(--pde-danger);
    color: #fff;
    border-color: var(--pde-danger);
}

.pde-btn-primary {
    padding: 9px 24px;
    background: linear-gradient(135deg, var(--pde-primary), #818cf8);
    color: #fff;
    border: none;
    border-radius: var(--pde-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--pde-transition);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

.pde-btn-primary:hover {
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
    transform: translateY(-1px);
}

.pde-btn-secondary {
    padding: 9px 24px;
    background: var(--pde-surface);
    color: var(--pde-text);
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--pde-transition);
    font-family: inherit;
}

.pde-btn-secondary:hover {
    background: var(--pde-surface-hover);
    border-color: var(--pde-primary);
    color: var(--pde-text-white);
}

/* =========================================
   MODAL
   ========================================= */
.pde-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pde-modal-in 0.2s ease;
}

@keyframes pde-modal-in { from { opacity: 0; } to { opacity: 1; } }

.pde-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
}

.pde-modal-content {
    position: relative;
    background: var(--pde-bg-raised);
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-lg);
    box-shadow: var(--pde-shadow-lg), var(--pde-shadow-glow);
    width: 90%;
    max-width: 520px;
    overflow: hidden;
    animation: pde-modal-content-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pde-modal-content-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.pde-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pde-border);
}

.pde-modal-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--pde-text-white);
    display: flex;
    align-items: center;
    gap: 9px;
}

.pde-modal-header h3 svg { color: var(--pde-primary); }

.pde-modal-close {
    background: var(--pde-surface);
    border: 1px solid var(--pde-border);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    color: var(--pde-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--pde-transition);
    line-height: 1;
}

.pde-modal-close:hover {
    background: var(--pde-danger-light);
    color: var(--pde-danger);
    border-color: rgba(239,68,68,0.15);
}

.pde-modal-body {
    padding: 20px;
    display: flex;
    justify-content: center;
}

#pde-sig-canvas {
    border: 2px dashed var(--pde-border-strong);
    border-radius: var(--pde-radius);
    cursor: crosshair;
    max-width: 100%;
    touch-action: none;
    background: #fff;
}

.pde-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--pde-border);
}

/* =========================================
   SETTINGS MODAL
   ========================================= */
.pde-settings-modal-content { max-width: 600px; }

.pde-settings-body {
    display: block;
    padding: 0 !important;
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--pde-surface) transparent;
}

.pde-settings-grid { display: flex; flex-direction: column; }

.pde-settings-group {
    padding: 18px 20px;
    border-bottom: 1px solid var(--pde-border);
}

.pde-settings-group:last-child { border-bottom: none; }

.pde-settings-group h4 {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--pde-text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pde-settings-group h4::before {
    content: '';
    width: 3px; height: 12px;
    background: var(--pde-primary);
    border-radius: 2px;
}

.pde-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
    gap: 14px;
}

.pde-setting-row + .pde-setting-row { border-top: 1px solid rgba(0,0,0,0.04); }

.pde-setting-info { flex: 1; min-width: 0; }

.pde-setting-info label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--pde-text);
    margin: 0;
    text-transform: none;
    letter-spacing: 0;
}

.pde-setting-desc {
    display: block;
    font-size: 11px;
    color: var(--pde-text-muted);
    margin-top: 1px;
    line-height: 1.4;
}

.pde-setting-row select,
.pde-setting-row .pde-setting-input-sm {
    width: 110px;
    padding: 7px 10px;
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    font-size: 12px;
    font-family: inherit;
    background: var(--pde-surface);
    color: var(--pde-text);
    flex-shrink: 0;
    appearance: none;
    transition: all var(--pde-transition);
}

.pde-setting-row select {
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

.pde-setting-row select:focus,
.pde-setting-row .pde-setting-input-sm:focus {
    outline: none;
    border-color: var(--pde-primary);
    box-shadow: 0 0 0 3px var(--pde-primary-light);
}

.pde-setting-color {
    width: 38px; height: 32px;
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    padding: 3px;
    cursor: pointer;
    background: var(--pde-surface);
    flex-shrink: 0;
}

/* Toggle Switch */
.pde-toggle {
    position: relative;
    display: inline-block;
    width: 40px; height: 22px;
    flex-shrink: 0;
    margin: 0; padding: 0;
    text-transform: none;
    letter-spacing: 0;
}

.pde-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.pde-toggle-slider {
    position: absolute; cursor: pointer;
    inset: 0;
    background: var(--pde-surface);
    border: 1px solid var(--pde-border-strong);
    border-radius: 11px;
    transition: all 0.2s ease;
}

.pde-toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px; width: 16px;
    left: 2px; bottom: 2px;
    background: var(--pde-text-muted);
    border-radius: 50%;
    transition: all 0.2s ease;
}

.pde-toggle input:checked + .pde-toggle-slider {
    background: var(--pde-primary);
    border-color: var(--pde-primary);
}

.pde-toggle input:checked + .pde-toggle-slider::before {
    transform: translateX(18px);
    background: #fff;
}

/* Grid Overlay */
.pde-grid-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.25;
}

/* =========================================
   LOADING OVERLAY
   ========================================= */
#pde-loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(12px);
}

.pde-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 48px;
    background: var(--pde-bg-raised);
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-lg);
    box-shadow: var(--pde-shadow-lg);
}

.pde-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--pde-surface);
    border-top-color: var(--pde-primary);
    border-radius: 50%;
    animation: pde-spin 0.65s linear infinite;
    margin-bottom: 16px;
}

@keyframes pde-spin { to { transform: rotate(360deg); } }

#pde-loading-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--pde-text);
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */
#pde-toast-container {
    position: fixed;
    top: calc(var(--pde-toolbar-height) + 12px);
    right: 16px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.pde-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 380px;
    padding: 12px 16px;
    border-radius: var(--pde-radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--pde-text-white);
    background: var(--pde-bg-raised);
    border: 1px solid var(--pde-border-strong);
    box-shadow: var(--pde-shadow-lg);
    animation: pde-toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    backdrop-filter: blur(16px);
}

.pde-toast.removing { animation: pde-toast-out 0.25s ease forwards; }

.pde-toast-icon { width: 18px; height: 18px; flex-shrink: 0; }

.pde-toast.pde-toast-success { border-left: 3px solid var(--pde-success); }
.pde-toast.pde-toast-success .pde-toast-icon { color: var(--pde-success); }
.pde-toast.pde-toast-error { border-left: 3px solid var(--pde-danger); }
.pde-toast.pde-toast-error .pde-toast-icon { color: var(--pde-danger); }
.pde-toast.pde-toast-warning { border-left: 3px solid var(--pde-warning); }
.pde-toast.pde-toast-warning .pde-toast-icon { color: var(--pde-warning); }
.pde-toast.pde-toast-info { border-left: 3px solid var(--pde-primary); }
.pde-toast.pde-toast-info .pde-toast-icon { color: var(--pde-primary); }

@keyframes pde-toast-in {
    from { opacity: 0; transform: translateX(30px) scale(0.96); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes pde-toast-out {
    to { opacity: 0; transform: translateX(30px) scale(0.96); }
}

/* =========================================
   DRAG & DROP
   ========================================= */
#pde-canvas-area.drag-over {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(99,102,241,0.06) 0%, transparent 60%),
        var(--pde-bg);
}

#pde-canvas-area.drag-over .pde-drop-zone {
    background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(168,139,250,0.15), rgba(99,102,241,0.10));
}

#pde-canvas-area.drag-over .pde-drop-zone-inner {
    border-color: rgba(99,102,241,0.3);
    background: rgba(255, 255, 255, 0.98);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
    .pde-tool-btn span { display: none; }
    .pde-tool-btn { padding: 7px 8px; }
    .pde-btn-export span { display: none; }
    .pde-btn-export { padding: 7px 10px; }
    :root { --pde-sidebar-width: 260px; }
    .pde-logo-text { display: none; }
    .pde-filename { display: none; }
}

@media (max-width: 768px) {
    :root {
        --pde-toolbar-height: 48px;
        --pde-sidebar-width: 100%;
        --pde-left-toolbar-width: 100%;
    }

    #pde-toolbar { padding: 0 8px; gap: 4px; }
    .pde-toolbar-left { display: none; }
    .pde-toolbar-center { gap: 2px; justify-content: flex-start; }
    .pde-tool-btn { padding: 6px 7px; }
    .pde-tool-btn span { display: none; }
    .pde-tool-btn svg { width: 17px; height: 17px; }
    .pde-separator { margin: 0 2px; height: 18px; }
    .pde-toolbar-right .pde-login-link { display: none; }
    .pde-tool-group { padding: 2px; }
    .pde-btn-export { padding: 6px 10px; font-size: 11px; }
    .pde-btn-export span { display: none; }

    #pde-body { flex-direction: column; }

    /* Left toolbar becomes horizontal strip on mobile */
    #pde-left-toolbar {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--pde-border);
        padding: 4px 8px;
        gap: 2px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    #pde-left-toolbar.pde-ltb-collapsed { display: none; }

    #pde-ltb-toggle { display: flex; }

    .pde-ltb-group { flex-direction: row; gap: 2px; }

    .pde-ltb-separator {
        width: 1px;
        height: 24px;
        margin: 0 4px;
    }

    .pde-ltb-btn { width: 36px; height: 36px; }

    /* Hide tooltips on mobile */
    [data-tooltip]::after { display: none; }

    /* Flyout menus go downward on mobile */
    .pde-ltb-dropdown-wrapper .pde-dropdown-menu {
        left: 0;
        top: calc(100% + 6px);
    }

    #pde-sidebar {
        width: 100%;
        max-height: 200px;
        border-left: none;
        border-top: 1px solid var(--pde-border);
    }

    .pde-sidebar-footer { margin-top: 0; }
    .pde-drop-zone { width: 100%; }
    .pde-drop-zone-inner { padding: 36px 24px; }

    #pde-sig-canvas { width: 100%; height: 140px; }

    #pde-toast-container {
        top: auto; bottom: calc(var(--pde-statusbar-height) + 12px);
        right: 10px; left: 10px;
    }

    .pde-toast { min-width: unset; }
    .pde-zoom-display { display: none; }

    #pde-statusbar { padding: 0 10px; }
}

@media (max-width: 480px) {
    .pde-tool-btn svg { width: 15px; height: 15px; }
    .pde-tool-btn { padding: 5px 6px; }
    .pde-user-badge { font-size: 9px; padding: 3px 7px; }
    .pde-drop-zone-inner { padding: 28px 18px; }
    .pde-drop-zone-features { gap: 6px; }
    .pde-feature-chip { font-size: 10px; padding: 3px 7px; }
    #pde-empty-state h2 { font-size: 18px; }
    .pde-btn-export { padding: 5px 8px; }
}

/* =========================================
   DROPDOWN MENUS
   ========================================= */
.pde-dropdown-wrapper {
    position: relative;
    display: inline-flex;
}

.pde-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--pde-bg-raised);
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    box-shadow: var(--pde-shadow-lg);
    z-index: 200;
    min-width: 140px;
    padding: 4px;
    animation: pde-dropdown-in 0.15s ease;
}

.pde-dropdown-wrapper.open .pde-dropdown-menu { display: block; }

@keyframes pde-dropdown-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pde-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--pde-text);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--pde-transition);
    white-space: nowrap;
    text-align: left;
}

.pde-dropdown-item:hover {
    background: var(--pde-primary-light);
    color: var(--pde-primary);
}

.pde-dropdown-item svg { flex-shrink: 0; }

/* Stamp chips in dropdown */
.pde-stamp-chip {
    font-weight: 800 !important;
    font-size: 11px !important;
    letter-spacing: 1.5px;
    border: 2px dashed currentColor !important;
    margin: 2px 0;
    justify-content: center;
}

.pde-stamps-menu { min-width: 160px; }

/* =========================================
   HIGHLIGHT ELEMENT & PREVIEW
   ========================================= */
.pde-highlight-element {
    border-radius: 2px;
    pointer-events: auto;
}

.pde-highlight-preview {
    position: absolute;
    pointer-events: none;
    z-index: 25;
    border-radius: 2px;
    border: 1px dashed rgba(0,0,0,0.2);
}

/* =========================================
   SHAPE ELEMENT & PREVIEW
   ========================================= */
.pde-shape-element {
    background: transparent;
    overflow: visible;
    line-height: 0;
}

.pde-shape-element svg {
    width: 100%;
    height: 100%;
    display: block;
}

.pde-shape-preview {
    position: absolute;
    pointer-events: none;
    z-index: 25;
    border-radius: 2px;
}

/* =========================================
   STAMP ELEMENT
   ========================================= */
.pde-stamp-element {
    background: transparent;
    border-radius: 4px;
    user-select: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================
   STICKY NOTE ELEMENT
   ========================================= */
.pde-sticky-element {
    position: relative;
    cursor: move;
}

.pde-sticky-popover {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    padding: 8px 12px;
    background: var(--pde-bg-raised);
    border: 1px solid var(--pde-border-strong);
    border-radius: var(--pde-radius-sm);
    box-shadow: var(--pde-shadow);
    font-size: 11px;
    color: var(--pde-text);
    min-width: 120px;
    max-width: 200px;
    white-space: pre-wrap;
    word-break: break-word;
    z-index: 30;
    line-height: 1.5;
}

.pde-sticky-element:hover .pde-sticky-popover { display: block; }

/* =========================================
   COLOR SWATCHES
   ========================================= */
.pde-color-swatches {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.pde-swatch {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--pde-transition);
    padding: 0;
}

.pde-swatch:hover { transform: scale(1.1); }

.pde-swatch.active {
    border-color: var(--pde-primary);
    box-shadow: 0 0 0 2px var(--pde-primary-light);
}

/* =========================================
   PAGE MANAGER MODAL
   ========================================= */
.pde-page-manager-modal-content {
    max-width: 720px;
}

.pde-pm-body {
    display: block !important;
    max-height: 50vh;
    overflow-y: auto;
    padding: 16px !important;
}

.pde-pm-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pde-pm-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 2px solid var(--pde-border);
    border-radius: var(--pde-radius-sm);
    cursor: grab;
    transition: all var(--pde-transition);
    position: relative;
    background: var(--pde-bg-raised);
}

.pde-pm-thumb:hover { border-color: var(--pde-primary); }
.pde-pm-thumb.dragging { opacity: 0.4; }
.pde-pm-thumb.drag-over { border-color: var(--pde-primary); background: var(--pde-primary-light); }

.pde-pm-check {
    position: absolute;
    top: 6px;
    left: 6px;
    accent-color: var(--pde-primary);
}

.pde-pm-canvas {
    border-radius: 4px;
    box-shadow: var(--pde-shadow-sm);
    background: #fff;
}

.pde-pm-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--pde-text-secondary);
}

.pde-pm-footer {
    gap: 8px;
}

/* =========================================
   MERGE MODAL
   ========================================= */
.pde-merge-file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.pde-merge-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--pde-surface);
    border: 1px solid var(--pde-border);
    border-radius: var(--pde-radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--pde-text);
}

.pde-merge-remove {
    background: none;
    border: none;
    color: var(--pde-text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    transition: color var(--pde-transition);
}

.pde-merge-remove:hover { color: var(--pde-danger); }
