/* ═══════════════════════════════════════════════════════════════════════════
   DreamyHub PDF Editor — Design System v5
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
    --pdfx-bg-900: #0c1021;
    --pdfx-bg-800: #131a2e;
    --pdfx-bg-700: #1b2540;
    --pdfx-bg-600: #243052;
    --pdfx-text-100: #f1f5f9;
    --pdfx-text-200: #cbd5e1;
    --pdfx-text-400: #64748b;
    --pdfx-accent: #3b82f6;
    --pdfx-accent-hover: #60a5fa;
    --pdfx-accent-subtle: rgba(59,130,246,.12);
    --pdfx-danger: #ef4444;
    --pdfx-success: #22c55e;
    --pdfx-warning: #f59e0b;
    --pdfx-border: rgba(255,255,255,.06);
    --pdfx-radius: 8px;
    --pdfx-radius-sm: 4px;
    --pdfx-transition: 150ms ease;
    --pdfx-font: 'Inter', system-ui, -apple-system, sans-serif;
    --pdfx-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --pdfx-topbar-h: 52px;
    --pdfx-statusbar-h: 28px;
    --pdfx-tools-w: 52px;
    --pdfx-sidebar-w: 180px;
    --pdfx-props-w: 240px;
    --pdfx-dropdown-z: 200;
    --pdfx-tooltip-offset: 10px;
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.pdfx {
    font-family: var(--pdfx-font);
    background: var(--pdfx-bg-900);
    color: var(--pdfx-text-100);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    -webkit-font-smoothing: antialiased;
}

/* ── Auth Guard ───────────────────────────────────────────────────────────── */
body.pdfx--auth {
    background: var(--pdfx-bg-900);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(59,130,246,.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(139,92,246,.06) 0%, transparent 50%);
}
.pdfx-auth { display: flex; align-items: center; justify-content: center; height: 100vh; }
.pdfx-auth__card {
    background: var(--pdfx-bg-800);
    border: 1px solid var(--pdfx-border);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    text-align: center;
    max-width: 420px;
    box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.pdfx-auth__icon { color: var(--pdfx-accent); margin-bottom: 1.5rem; }
.pdfx-auth__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .5rem;
    background: linear-gradient(135deg, #fff, var(--pdfx-accent-hover));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.pdfx-auth__desc { color: var(--pdfx-text-400); margin-bottom: 2rem; line-height: 1.6; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.pdfx-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--pdfx-font); font-weight: 500; font-size: .8125rem;
    border: none; border-radius: var(--pdfx-radius-sm); cursor: pointer;
    padding: 7px 14px; transition: all var(--pdfx-transition);
    white-space: nowrap;
}
.pdfx-btn--primary { background: var(--pdfx-accent); color: #fff; }
.pdfx-btn--primary:hover { background: var(--pdfx-accent-hover); }
.pdfx-btn--primary:disabled { opacity: .4; pointer-events: none; }
.pdfx-btn--outline { background: transparent; border: 1px solid var(--pdfx-border); color: var(--pdfx-text-100); }
.pdfx-btn--outline:hover { background: var(--pdfx-bg-700); }
.pdfx-btn--ghost { background: transparent; color: var(--pdfx-text-200); }
.pdfx-btn--ghost:hover { background: var(--pdfx-bg-700); color: #fff; }
.pdfx-btn--ghost:disabled { opacity: .3; pointer-events: none; }
.pdfx-btn--lg { padding: 12px 28px; font-size: .9375rem; border-radius: var(--pdfx-radius); }
.pdfx-btn--sm { padding: 4px 10px; font-size: .75rem; }
.pdfx-btn--xs { padding: 4px 8px; font-size: .75rem; background: var(--pdfx-bg-700); color: var(--pdfx-text-200); border: 1px solid var(--pdfx-border); }
.pdfx-btn--xs:hover { background: var(--pdfx-bg-600); color: #fff; }

/* ── Top Bar ──────────────────────────────────────────────────────────────── */
.pdfx-topbar {
    height: var(--pdfx-topbar-h);
    background: var(--pdfx-bg-800);
    border-bottom: 1px solid var(--pdfx-border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px;
    flex-shrink: 0;
    z-index: 50;
    gap: 8px;
}
.pdfx-topbar__left, .pdfx-topbar__center, .pdfx-topbar__right {
    display: flex; align-items: center; gap: 6px;
}
.pdfx-topbar__right { gap: 4px; }
.pdfx-topbar__logo {
    display: flex; align-items: center; gap: 8px;
    font-weight: 700; font-size: .9375rem; color: #fff;
    letter-spacing: -.01em;
}
.pdfx-topbar__logo svg { color: var(--pdfx-accent); }
.pdfx-topbar__filename {
    color: var(--pdfx-text-400); font-size: .8125rem;
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pdfx-topbar__divider {
    width: 1px; height: 24px; background: var(--pdfx-border); margin: 0 4px; flex-shrink: 0;
}

/* Zoom */
.pdfx-zoom {
    display: flex; align-items: center;
    background: var(--pdfx-bg-900); border-radius: var(--pdfx-radius-sm);
    padding: 2px; border: 1px solid var(--pdfx-border);
}
.pdfx-zoom__btn {
    background: transparent; border: none; color: var(--pdfx-text-400);
    width: 26px; height: 26px; border-radius: var(--pdfx-radius-sm);
    cursor: pointer; font-size: 14px; transition: all var(--pdfx-transition);
    display: flex; align-items: center; justify-content: center;
}
.pdfx-zoom__btn:hover { background: var(--pdfx-bg-700); color: #fff; }
.pdfx-zoom__level {
    width: 48px; text-align: center;
    font-family: var(--pdfx-mono); font-size: .75rem; color: var(--pdfx-text-200);
}

/* ── Topbar Dropdown Menus ────────────────────────────────────────────────── */
.pdfx-dropdown { position: relative; }
.pdfx-dropdown__panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 210px;
    background: var(--pdfx-bg-700);
    border: 1px solid var(--pdfx-border);
    border-radius: var(--pdfx-radius);
    box-shadow: 0 16px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.04);
    z-index: var(--pdfx-dropdown-z);
    padding: 4px 0;
    animation: pdfx-dropdown-in .15s ease;
    min-width: 200px;
}
@keyframes pdfx-dropdown-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.pdfx-dropdown__item {
    display: flex; align-items: center; gap: 8px;
    width: 100%; padding: 8px 14px;
    background: none; border: none;
    color: var(--pdfx-text-200); font-size: .8125rem;
    cursor: pointer; text-align: left;
    transition: background var(--pdfx-transition), color var(--pdfx-transition);
    font-family: var(--pdfx-font);
}
.pdfx-dropdown__item:hover { background: var(--pdfx-bg-600); color: var(--pdfx-text-100); }
.pdfx-dropdown__item--danger { color: var(--pdfx-danger); }
.pdfx-dropdown__item--danger:hover { background: rgba(239,68,68,.1); color: var(--pdfx-danger); }
.pdfx-dropdown__divider { height: 1px; background: var(--pdfx-border); margin: 4px 0; }
.pdfx-dropdown__label {
    padding: 6px 14px 2px;
    font-size: .625rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--pdfx-text-400);
}

/* ── Workspace Grid ───────────────────────────────────────────────────────── */
.pdfx-workspace {
    display: flex;
    height: calc(100vh - var(--pdfx-topbar-h) - var(--pdfx-statusbar-h));
    overflow: hidden;
}

/* ── Tools Palette ────────────────────────────────────────────────────────── */
.pdfx-tools {
    width: var(--pdfx-tools-w);
    background: var(--pdfx-bg-800);
    border-right: 1px solid var(--pdfx-border);
    display: flex; flex-direction: column; align-items: center;
    padding: 8px 0;
    gap: 1px;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Tool Tooltip Wrapper ─────────────────────────────────────────────────── */
.pdfx-tool-wrap {
    position: relative;
    width: 100%;
    display: flex; align-items: center; justify-content: center;
}
.pdfx-tool-wrap::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + var(--pdfx-tooltip-offset));
    top: 50%;
    transform: translateY(-50%);
    background: var(--pdfx-bg-600);
    border: 1px solid rgba(255,255,255,.1);
    color: var(--pdfx-text-100);
    font-size: .6875rem;
    font-family: var(--pdfx-font);
    font-weight: 500;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: var(--pdfx-radius-sm);
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 120ms ease;
    z-index: 999;
}
.pdfx-tool-wrap::before {
    content: '';
    position: absolute;
    left: calc(100% + var(--pdfx-tooltip-offset) - 6px);
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--pdfx-bg-600);
    opacity: 0;
    transition: opacity 120ms ease;
    pointer-events: none;
    z-index: 999;
}
.pdfx-tool-wrap:hover::after,
.pdfx-tool-wrap:hover::before { opacity: 1; }

/* ── Tool Section Labels ──────────────────────────────────────────────────── */
.pdfx-tools__section-label {
    font-size: .5rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--pdfx-text-400);
    opacity: .5;
    padding: 10px 0 2px;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}

.pdfx-tools__btn {
    width: 36px; height: 36px;
    background: transparent; border: none; border-radius: var(--pdfx-radius-sm);
    color: var(--pdfx-text-400); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--pdfx-transition);
    position: relative;
}
.pdfx-tools__btn:hover { color: var(--pdfx-text-100); background: var(--pdfx-bg-700); }
.pdfx-tools__btn.active {
    color: var(--pdfx-accent); background: var(--pdfx-accent-subtle);
}
.pdfx-tools__btn--danger:hover { color: var(--pdfx-danger); background: rgba(239,68,68,.1); }
.pdfx-tools__divider {
    width: 28px; height: 1px; background: var(--pdfx-border); margin: 4px 0;
}

/* ── Sidebar / Thumbnails ─────────────────────────────────────────────────── */
.pdfx-sidebar {
    width: var(--pdfx-sidebar-w);
    background: var(--pdfx-bg-800);
    border-right: 1px solid var(--pdfx-border);
    display: flex; flex-direction: column;
    flex-shrink: 0;
}
.pdfx-sidebar__header {
    padding: 8px 12px;
    font-size: .6875rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--pdfx-text-400);
    border-bottom: 1px solid var(--pdfx-border);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.pdfx-sidebar__count {
    background: var(--pdfx-bg-700);
    color: var(--pdfx-text-400);
    font-size: .625rem; font-weight: 600;
    padding: 2px 7px; border-radius: 10px;
    border: 1px solid var(--pdfx-border);
}
.pdfx-sidebar__list {
    flex: 1; overflow-y: auto; padding: 10px;
    display: flex; flex-direction: column; gap: 8px;
}
.pdfx-thumb {
    cursor: pointer; border: 2px solid transparent;
    border-radius: var(--pdfx-radius-sm); padding: 3px;
    transition: border-color var(--pdfx-transition);
    user-select: none;
}
.pdfx-thumb:hover { border-color: var(--pdfx-bg-600); }
.pdfx-thumb.active { border-color: var(--pdfx-accent); }
.pdfx-thumb.dragging { opacity: .4; }
.pdfx-thumb.drag-over-thumb { border-color: var(--pdfx-accent); box-shadow: 0 0 0 2px var(--pdfx-accent); }
.pdfx-thumb canvas { width: 100%; display: block; border-radius: 2px; }
.pdfx-thumb__label {
    text-align: center; font-size: .625rem;
    color: var(--pdfx-text-400); margin-top: 4px;
}

/* ── Thumbnail Context Menu ───────────────────────────────────────────────── */
.pdfx-thumb-ctx {
    position: fixed;
    background: var(--pdfx-bg-700);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: var(--pdfx-radius);
    box-shadow: 0 12px 32px rgba(0,0,0,.5);
    z-index: 800;
    padding: 4px 0;
    min-width: 170px;
    animation: pdfx-dropdown-in .12s ease;
}
.pdfx-thumb-ctx__item {
    display: block; width: 100%; padding: 8px 14px;
    background: none; border: none;
    color: var(--pdfx-text-200); font-size: .8125rem;
    cursor: pointer; text-align: left; font-family: var(--pdfx-font);
    transition: background var(--pdfx-transition), color var(--pdfx-transition);
}
.pdfx-thumb-ctx__item:hover { background: var(--pdfx-bg-600); color: var(--pdfx-text-100); }
.pdfx-thumb-ctx__item--danger { color: var(--pdfx-danger); }
.pdfx-thumb-ctx__item--danger:hover { background: rgba(239,68,68,.1); color: var(--pdfx-danger); }
.pdfx-thumb-ctx__div { height: 1px; background: var(--pdfx-border); margin: 4px 0; }

/* ── Viewport / Canvas Area ───────────────────────────────────────────────── */
.pdfx-viewport {
    flex: 1; position: relative;
    background: var(--pdfx-bg-900);
    overflow: auto;
}

/* Viewport cursor modes */
.pdfx-viewport.tool-text  { cursor: text; }
.pdfx-viewport.tool-draw,
.pdfx-viewport.tool-highlight,
.pdfx-viewport.tool-whiteout,
.pdfx-viewport.tool-rect,
.pdfx-viewport.tool-circle,
.pdfx-viewport.tool-line,
.pdfx-viewport.tool-arrow { cursor: crosshair; }
.pdfx-viewport.tool-note,
.pdfx-viewport.tool-stamp,
.pdfx-viewport.tool-check,
.pdfx-viewport.tool-date  { cursor: copy; }

/* Dropzone */
.pdfx-dropzone {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 30; cursor: pointer;
}
.pdfx-dropzone__inner {
    width: 90%; max-width: 520px;
    border: 2px dashed var(--pdfx-border);
    border-radius: 20px; padding: 4rem 2rem;
    text-align: center;
    background: var(--pdfx-bg-800);
    transition: all .25s ease;
}
.pdfx-dropzone__inner:hover,
.pdfx-dropzone.drag-over .pdfx-dropzone__inner {
    border-color: var(--pdfx-accent);
    background: var(--pdfx-bg-700);
    transform: scale(1.01);
}
.pdfx-dropzone__icon { color: var(--pdfx-accent); margin-bottom: 1rem; }
.pdfx-dropzone__inner h2 { font-size: 1.375rem; margin-bottom: .25rem; }
.pdfx-dropzone__inner p { color: var(--pdfx-text-400); margin-bottom: .5rem; }
.pdfx-dropzone__hint { font-size: .75rem; color: var(--pdfx-text-400); opacity: .7; }

/* Pages container */
.pdfx-pages {
    display: flex; flex-direction: column; align-items: center;
    padding: 2rem; gap: 2rem;
    min-height: 100%;
    background-image: radial-gradient(circle, rgba(255,255,255,.03) 1px, transparent 1px);
    background-size: 24px 24px;
}
.pdfx-page {
    position: relative;
    box-shadow: 0 4px 30px rgba(0,0,0,.35), 0 1px 4px rgba(0,0,0,.2);
    background: #fff;
    transition: transform .15s ease;
}
.pdfx-page__render {
    position: absolute !important; top: 0; left: 0;
    z-index: 1; pointer-events: none;
}
.pdfx-page .canvas-container {
    position: relative !important;
    z-index: 2;
}

/* ── Properties Panel ─────────────────────────────────────────────────────── */
.pdfx-props {
    width: var(--pdfx-props-w);
    background: var(--pdfx-bg-800);
    border-left: 1px solid var(--pdfx-border);
    flex-shrink: 0;
    overflow-y: auto;
    padding: 14px;
}
.pdfx-props__placeholder {
    text-align: center; color: var(--pdfx-text-400);
    font-size: .8125rem; margin-top: 3rem; line-height: 1.6;
}
.pdfx-props__group { margin-bottom: 1.25rem; }
.pdfx-props__group h4 {
    font-size: .6875rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--pdfx-text-400); margin-bottom: .75rem; font-weight: 600;
}
.pdfx-props__group label {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .75rem; color: var(--pdfx-text-200);
    margin-bottom: 8px; gap: 8px;
}
.pdfx-props__row { display: flex; gap: 4px; flex-wrap: wrap; }
.pdfx-props__separator {
    border: none; border-top: 1px solid var(--pdfx-border);
    margin: 12px 0;
}

/* Object group — shown alongside any selection panel */
#propsObject {
    border-top: 1px solid var(--pdfx-border);
    padding-top: 12px;
    margin-top: 4px;
}

/* Form elements */
.pdfx-input {
    background: var(--pdfx-bg-900); border: 1px solid var(--pdfx-border);
    color: var(--pdfx-text-100); border-radius: var(--pdfx-radius-sm);
    font-family: var(--pdfx-font); padding: 6px 10px; font-size: .8125rem;
    width: 100%;
}
.pdfx-input--sm { width: 64px; text-align: center; }
.pdfx-input:focus { outline: none; border-color: var(--pdfx-accent); }
.pdfx-color {
    width: 34px; height: 28px; padding: 1px; border: 1px solid var(--pdfx-border);
    border-radius: var(--pdfx-radius-sm); background: var(--pdfx-bg-900); cursor: pointer;
    flex-shrink: 0;
}
.pdfx-color::-webkit-color-swatch-wrapper { padding: 1px; }
.pdfx-color::-webkit-color-swatch { border: none; border-radius: 2px; }
.pdfx-range { flex: 1; min-width: 60px; accent-color: var(--pdfx-accent); }

/* ── Signature Modal ──────────────────────────────────────────────────────── */
.pdfx-modal-overlay {
    position: fixed; inset: 0; z-index: 9000;
    background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
}
.pdfx-modal {
    background: var(--pdfx-bg-800); border: 1px solid var(--pdfx-border);
    border-radius: 16px; width: 90%; max-width: 560px;
    box-shadow: 0 25px 60px rgba(0,0,0,.5);
    animation: pdfx-modal-in .2s ease;
}
@keyframes pdfx-modal-in {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.pdfx-modal--sm { max-width: 420px; }
.pdfx-modal--sm .pdfx-modal__body label {
    display: flex; flex-direction: column; gap: 4px;
    margin-bottom: 14px; font-size: .8125rem; color: var(--pdfx-text-200);
}
.pdfx-modal--sm .pdfx-modal__body label span {
    font-size: .6875rem; color: var(--pdfx-text-400);
}
.pdfx-modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--pdfx-border);
}
.pdfx-modal__header h3 { font-size: 1rem; font-weight: 600; }
.pdfx-modal__close {
    background: none; border: none; color: var(--pdfx-text-400);
    font-size: 1.5rem; cursor: pointer; line-height: 1;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--pdfx-radius-sm);
    transition: all var(--pdfx-transition);
}
.pdfx-modal__close:hover { color: #fff; background: var(--pdfx-bg-700); }
.pdfx-modal__tabs {
    display: flex; border-bottom: 1px solid var(--pdfx-border);
}
.pdfx-modal__tab {
    flex: 1; padding: 10px; text-align: center;
    background: none; border: none; color: var(--pdfx-text-400);
    cursor: pointer; font-size: .8125rem; font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--pdfx-transition); font-family: var(--pdfx-font);
}
.pdfx-modal__tab:hover { color: var(--pdfx-text-100); }
.pdfx-modal__tab.active {
    color: var(--pdfx-accent); border-bottom-color: var(--pdfx-accent);
}
.pdfx-modal__body { padding: 20px; }
.pdfx-modal__footer {
    padding: 12px 20px; border-top: 1px solid var(--pdfx-border);
    display: flex; justify-content: flex-end; gap: 8px;
}
.pdfx-sig-tab { text-align: center; }
#sigCanvas {
    width: 100%; max-height: 200px;
    background: #fff; border-radius: var(--pdfx-radius);
    cursor: crosshair; border: 1px solid #e2e8f0;
}
#initCanvas {
    width: 100%; max-height: 150px;
    background: #fff; border-radius: var(--pdfx-radius);
    cursor: crosshair; border: 1px solid #e2e8f0;
}
.pdfx-sig-preview {
    margin-top: 12px; font-size: 2rem;
    font-family: 'Brush Script MT', 'Segoe Script', cursive;
    color: #1a1a1a; background: #fff;
    padding: 16px; border-radius: var(--pdfx-radius);
    min-height: 60px; border: 1px solid #e2e8f0;
}
.pdfx-upload-label {
    display: block; padding: 2rem;
    border: 2px dashed var(--pdfx-border);
    border-radius: var(--pdfx-radius);
    cursor: pointer; color: var(--pdfx-text-400);
    transition: all var(--pdfx-transition); text-align: center;
}
.pdfx-upload-label:hover { border-color: var(--pdfx-accent); color: var(--pdfx-text-100); }
#sigUploadPreview img,
#initUploadPreview img { max-width: 100%; margin-top: 12px; border-radius: var(--pdfx-radius); }

/* ── Loader ───────────────────────────────────────────────────────────────── */
.pdfx-loader {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(12,16,33,.92); backdrop-filter: blur(6px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pdfx-loader__spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--pdfx-bg-600);
    border-top-color: var(--pdfx-accent);
    border-radius: 50%; animation: pdfx-spin .8s linear infinite;
    margin-bottom: 12px;
}
@keyframes pdfx-spin { to { transform: rotate(360deg); } }
.pdfx-loader__text { font-size: .875rem; color: var(--pdfx-text-200); }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.pdfx-toast-container {
    position: fixed; bottom: 20px; right: 20px; z-index: 9500;
    display: flex; flex-direction: column-reverse; gap: 8px;
    pointer-events: none;
}
.pdfx-toast {
    background: var(--pdfx-bg-700); border: 1px solid var(--pdfx-border);
    border-radius: var(--pdfx-radius); padding: 10px 16px;
    font-size: .8125rem; color: var(--pdfx-text-100);
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    animation: pdfx-toast-in .3s ease;
    max-width: 340px; pointer-events: auto;
}
.pdfx-toast--success { border-left: 3px solid var(--pdfx-success); }
.pdfx-toast--error   { border-left: 3px solid var(--pdfx-danger); }
.pdfx-toast--info    { border-left: 3px solid var(--pdfx-accent); }
.pdfx-toast--warning { border-left: 3px solid var(--pdfx-warning); }
@keyframes pdfx-toast-in {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Scrollbars ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--pdfx-bg-600); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--pdfx-accent); }

/* ── Smart Field Indicators ───────────────────────────────────────────────── */
.smart-field-badge {
    position: absolute; top: -8px; left: -8px; z-index: 10;
    background: var(--pdfx-accent); color: #fff;
    font-size: 9px; font-weight: 600; letter-spacing:.02em;
    padding: 2px 5px; border-radius: 3px;
    pointer-events: none;
}

/* ── Checkbox Style Picker ────────────────────────────────────────────────── */
.pdfx-check-styles {
    display: flex; gap: 4px; margin-bottom: 10px;
}
.pdfx-check-style {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--pdfx-bg-900);
    border: 2px solid var(--pdfx-border);
    border-radius: var(--pdfx-radius-sm);
    color: var(--pdfx-text-200);
    font-size: 18px; cursor: pointer;
    transition: all var(--pdfx-transition);
}
.pdfx-check-style:hover {
    border-color: var(--pdfx-text-400);
    color: #fff;
    background: var(--pdfx-bg-700);
}
.pdfx-check-style.active {
    border-color: var(--pdfx-accent);
    color: var(--pdfx-accent);
    background: var(--pdfx-accent-subtle);
}
.pdfx-props__hint {
    font-size: .6875rem;
    color: var(--pdfx-text-400);
    line-height: 1.5;
    margin-top: 6px;
    padding: 8px;
    background: var(--pdfx-bg-900);
    border-radius: var(--pdfx-radius-sm);
    border: 1px solid var(--pdfx-border);
}

/* ── Select Dropdown ──────────────────────────────────────────────────────── */
.pdfx-select {
    width: 100%;
    background: var(--pdfx-bg-900); border: 1px solid var(--pdfx-border);
    color: var(--pdfx-text-100); border-radius: var(--pdfx-radius-sm);
    font-family: var(--pdfx-font); padding: 6px 8px; font-size: .75rem;
    margin-bottom: 8px; cursor: pointer;
}
.pdfx-select:focus { outline: none; border-color: var(--pdfx-accent); }

/* ── Status Bar ───────────────────────────────────────────────────────────── */
.pdfx-statusbar {
    height: var(--pdfx-statusbar-h);
    background: var(--pdfx-bg-800);
    border-top: 1px solid var(--pdfx-border);
    display: flex; align-items: center;
    padding: 0 12px; gap: 12px;
    font-size: .6875rem;
    color: var(--pdfx-text-400);
    flex-shrink: 0;
}
.pdfx-statusbar__spacer { flex: 1; }
#statusPageInfo { font-weight: 500; color: var(--pdfx-text-200); }
#statusHint {
    font-family: var(--pdfx-mono); font-size: .625rem;
    opacity: .55; flex: 1; text-align: center;
}
#statusZoom { font-family: var(--pdfx-mono); color: var(--pdfx-accent); font-size: .6875rem; }
#statusTool { color: var(--pdfx-text-400); text-transform: capitalize; }

/* ── Stamp Buttons ────────────────────────────────────────────────────────── */
.pdfx-stamp-list {
    display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px;
}
.pdfx-stamp-btn {
    padding: 4px 8px;
    font-size: .625rem; font-weight: 700; letter-spacing: .05em;
    background: transparent;
    border: 1.5px solid var(--pdfx-danger);
    color: var(--pdfx-danger);
    border-radius: var(--pdfx-radius-sm);
    cursor: pointer;
    transition: all var(--pdfx-transition);
    text-transform: uppercase; font-family: var(--pdfx-font);
}
.pdfx-stamp-btn:hover,
.pdfx-stamp-btn.active {
    background: rgba(239,68,68,.15);
}
.pdfx-stamp-btn.active {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 2px rgba(239,68,68,.2);
}

/* ── Note Color Swatches ──────────────────────────────────────────────────── */
.pdfx-note-color {
    width: 28px; height: 28px;
    border: 2px solid transparent;
    border-radius: 50%; cursor: pointer;
    transition: all var(--pdfx-transition);
}
.pdfx-note-color:hover { transform: scale(1.15); }
.pdfx-note-color.active { border-color: #fff; box-shadow: 0 0 0 2px var(--pdfx-accent); }

/* ── Print ─────────────────────────────────────────────────────────────────── */
@media print {
    .pdfx-topbar, .pdfx-tools, .pdfx-sidebar, .pdfx-props,
    .pdfx-statusbar, .pdfx-dropzone, .pdfx-loader,
    .pdfx-modal-overlay, .pdfx-toast-container,
    .pdfx-thumb-ctx, .pdfx-dropdown__panel { display: none !important; }
    body.pdfx { overflow: visible; }
    .pdfx-workspace { height: auto; }
    .pdfx-viewport { overflow: visible; position: static; }
    .pdfx-pages { padding: 0; }
    .pdfx-page { box-shadow: none; page-break-after: always; }
}
