@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:ital,wght@0,300..800;1,300..800&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-dim: #f1f5f9;
    --border-color: #e2e8f0;
    --border-focus: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;

    /* Brand Colors - Clinical Tech Precision Blue */
    --color-primary: #137BEC;
    --color-primary-hover: #005ab3;
    --color-secondary: #2563eb;
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-warning: #ea580c;

    /* Feature Specific Hues (Consistent with Stitch Design System) */
    --hue-organize: #0284c7;
    --hue-merge: #4f46e5;
    --hue-split: #0ea5e9;
    --hue-compress: #0d9488;
    --hue-edit: #2563eb;
    --hue-protect: #7c3aed;
    --hue-convert: #e11d48;
    --hue-ai: #d97706;

    /* Typography */
    --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Gradients & Shadows */
    --grad-primary: linear-gradient(135deg, #137BEC 0%, #2563eb 100%);
    --grad-card-hover: linear-gradient(135deg, rgba(19, 123, 236, 0.02) 0%, rgba(37, 99, 235, 0.02) 100%);
    --shadow-subtle: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
    --shadow-hover: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 4px 6px -2px rgba(15, 23, 42, 0.02);
}

/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Global typography override for all controls and textual layers */
button,
input,
select,
textarea,
.nav-item,
.dropdown-item,
.badge-pro,
.badge-pro-card,
.panel-tip,
.upload-tip,
kbd,
.star-btn,
.toast {
    font-family: var(--font-main);
}

/* Monospace font for technical metrics, numbers, file sizes, and tokens */
.file-item-size,
.progress-percent,
.mono-metric,
.quota-counter,
.page-badge,
.token-badge {
    font-family: var(--font-mono);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    background-color: var(--bg-surface);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.5rem;
    cursor: pointer;
    user-select: none;
}

.logo-icon {
    font-size: 1.8rem;
    display: inline-flex;
    align-items: center;
}

.logo-highlight {
    color: var(--color-secondary);
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-item {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
    background: var(--color-primary);
    color: white;
}

/* Nav Dropdowns */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dropdown-toggle::after {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-bottom: 2px;
}

.nav-dropdown:hover .dropdown-toggle::after {
    transform: rotate(-135deg) translateY(-1px);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-surface);
    min-width: 190px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 0.4rem 0;
    z-index: 1000;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    margin-top: 0.3rem;
    animation: dropdownFadeIn 0.2s ease forwards;
}

.dropdown-menu::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, 6px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 0.6rem 1.1rem;
    color: var(--text-main) !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin: 0.2rem 0.4rem;
    background: transparent !important;
}

.dropdown-item:hover,
.dropdown-item.active {
    background-color: rgba(37, 99, 235, 0.06) !important;
    color: var(--color-primary) !important;
}

.nav-dropdown:hover .dropdown-toggle {
    background: rgba(37, 99, 235, 0.08) !important;
    color: var(--color-primary) !important;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 3.5rem 1rem 2.75rem 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero-section h1 {
    font-size: 2.75rem;
    font-weight: 800;
    margin-bottom: 0.85rem;
    color: var(--text-main);
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.hero-section p {
    font-size: 1.15rem;
    color: var(--text-muted);
    font-weight: 400;
    max-width: 640px;
    margin: 0 auto 1.25rem auto;
    line-height: 1.55;
}

.security-badge-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1.1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.security-badge-hero svg {
    color: var(--color-success);
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    padding-bottom: 4rem;
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tools Grid Dashboard */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding: 0.5rem 0;
}

@media (max-width: 992px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Category Sections & Filter Navigation */
.category-filter-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 1.5rem auto 2.5rem;
    flex-wrap: wrap;
    max-width: 800px;
}

.category-filter-btn {
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 9999px;
    padding: 0.5rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.category-filter-btn:hover {
    background: #f8fafc;
    color: var(--text-main, #0f172a);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.category-filter-btn.active {
    background: #1e3a8a;
    color: #ffffff;
    border-color: #1e3a8a;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
}

.category-filter-count {
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 9999px;
    font-family: var(--font-mono, monospace);
}

.category-filter-btn.active .category-filter-count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.category-section {
    margin-bottom: 3.5rem;
    transition: opacity 0.3s ease;
}

.category-header-wrap {
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    padding-bottom: 0.65rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-main, #0f172a);
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.category-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    font-weight: 400;
}

/* Watermark Studio Dual-View Mode & All Pages Grid */
.wm-view-mode-tabs {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    gap: 4px;
}

.wm-view-tab-btn {
    background: transparent;
    border: none;
    padding: 5px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.wm-view-tab-btn:hover {
    color: #0f172a;
}

.wm-view-tab-btn.active {
    background: #ffffff;
    color: #1e3a8a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.wm-grid-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    color: #475569;
    margin-bottom: 1rem;
    width: 100%;
}

.wm-all-pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    width: 100%;
    max-height: 640px;
    overflow-y: auto;
    padding: 6px;
}

.wm-page-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.wm-page-card:hover {
    border-color: #2563eb;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
    transform: translateY(-2px);
}

.wm-page-card.excluded {
    opacity: 0.65;
    background: #f8fafc;
}

.wm-page-card.excluded:hover {
    opacity: 0.9;
}

.wm-page-card-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

.wm-badge-status {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 9999px;
    font-weight: 600;
}

.wm-badge-included {
    background: #dcfce7;
    color: #15803d;
}

.wm-badge-excluded {
    background: #f1f5f9;
    color: #94a3b8;
}

.wm-thumb-wrapper {
    position: relative;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
    line-height: 0;
}

.wm-thumb-canvas {
    display: block;
    width: 100%;
    height: auto;
}

.wm-thumb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Feature-Specific Color Mappings */
#card-organize .tool-card-icon,
.color-organize {
    background-color: rgba(2, 132, 199, 0.08) !important;
    color: var(--hue-organize) !important;
}

#card-merge .tool-card-icon,
.color-merge {
    background-color: rgba(79, 70, 229, 0.08) !important;
    color: var(--hue-merge) !important;
}

#card-split .tool-card-icon,
.color-split {
    background-color: rgba(14, 165, 233, 0.08) !important;
    color: var(--hue-split) !important;
}

#card-compress .tool-card-icon,
.color-compress {
    background-color: rgba(13, 148, 136, 0.08) !important;
    color: var(--hue-compress) !important;
}

#card-editpdf .tool-card-icon,
.color-edit {
    background-color: rgba(37, 99, 235, 0.08) !important;
    color: var(--hue-edit) !important;
}

#card-protect .tool-card-icon,
.color-protect {
    background-color: rgba(124, 58, 237, 0.08) !important;
    color: var(--hue-protect) !important;
}

#card-mail-merge .tool-card-icon,
#card-convert .tool-card-icon,
.color-convert {
    background-color: rgba(225, 29, 72, 0.08) !important;
    color: var(--hue-convert) !important;
}

/* AI Chat Document Custom Gradient Theme */
#card-chatdoc .tool-card-icon {
    background: rgba(217, 119, 6, 0.08) !important;
    color: var(--hue-ai) !important;
}

#card-chatdoc:hover .tool-card-icon {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%) !important;
    color: white !important;
}

/* SOON Card on Dashboard */
.tool-card-soon {
    position: relative;
    opacity: 0.85;
}

.badge-soon-card {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tool-card {
    display: block;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    cursor: pointer;
    text-decoration: none !important;
    color: var(--text-main) !important;
    box-shadow: var(--shadow-subtle);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-primary);
    text-decoration: none !important;
}

.tool-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: transform 0.2s ease;
}

.tool-card:hover .tool-card-icon {
    transform: scale(1.05);
}

.tool-card-icon svg {
    width: 24px;
    height: 24px;
}

.tool-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text-main);
    letter-spacing: -0.01em;
    text-decoration: none !important;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.5;
    text-decoration: none !important;
}

/* Workspace Views */
.btn-back {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
}

.btn-back:hover {
    color: var(--color-primary);
}

.workspace-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.workspace-icon {
    font-size: 2.5rem;
}

.workspace-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
}

.workspace-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Upload Container */
.upload-container {
    background: var(--bg-surface);
    border: 2px dashed rgba(13, 110, 253, 0.5);
    border-radius: 20px;
    padding: 5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.upload-container:hover {
    border-color: var(--color-primary);
    background-color: rgba(13, 110, 253, 0.03);
    box-shadow: 0 8px 16px -1px rgba(13, 110, 253, 0.1);
}

.upload-container.dragover {
    border-color: var(--color-secondary);
    background-color: rgba(37, 99, 235, 0.05);
    box-shadow: 0 10px 20px -2px rgba(37, 99, 235, 0.15);
    transform: scale(1.01);
}

.file-input-hidden {
    display: none;
}

.upload-illustration {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: bounce 2s infinite;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.upload-container.dragover .upload-illustration {
    transform: translateY(-5px) scale(1.08);
    color: var(--color-secondary);
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.upload-container h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-container p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.upload-tip {
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-action {
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    padding: 0.75rem 2.5rem;
    box-shadow: 0 2px 4px rgba(30, 58, 138, 0.15);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.25);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
    padding: 0.6rem 1.5rem;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-success {
    background-color: var(--color-success);
    color: white;
    padding: 0.75rem 2.5rem;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 161, 105, 0.5);
}

.btn-action {
    background: var(--color-primary);
    color: white;
    padding: 0.85rem 3rem;
    font-size: 1.1rem;
    box-shadow: 0 2px 4px rgba(30, 58, 138, 0.15);
}

.btn-action:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.25);
}

.btn-large {
    width: 100%;
}

/* Editor Workspace Container */
.editor-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    backdrop-filter: blur(10px);
}

.tool-panel {
    margin-bottom: 2rem;
    animation: fadeIn 0.3s ease forwards;
}

.panel-tip {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Merge Files List */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
    transition: all 0.2s ease;
    cursor: grab;
}

.file-item:active {
    cursor: grabbing;
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-item-icon {
    font-size: 1.5rem;
}

.file-item-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.file-item-size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.btn-icon:hover {
    background-color: #f7fafc;
}

.btn-icon-delete:hover {
    background-color: rgba(229, 62, 62, 0.1);
    color: var(--color-danger);
}

/* File Preview Card */
.file-preview-card {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Control Box */
.control-box {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.control-box h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Forms & Inputs */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 500;
    font-size: 0.9rem;
}

.input-field {
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field:focus {
    border-color: var(--color-primary);
}

/* Alerts */
.alert-info,
.alert-success {
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.alert-info {
    background-color: rgba(66, 153, 225, 0.1);
    border-left: 4px solid #4299e1;
    color: #2b6cb0;
}

.alert-success {
    background-color: rgba(72, 187, 120, 0.1);
    border-left: 4px solid #48bb78;
    color: #276749;
}

/* Organize Pages Grid */
.panel-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.pages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
    position: relative;
}

.page-card {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03);
    position: relative;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.page-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.page-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
    border-color: var(--color-primary);
}

.page-card.keyboard-moving {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4), 0 12px 20px -4px rgba(37, 99, 235, 0.15);
    transform: scale(1.03) translateY(-4px);
}

.page-card-image-container {
    background-color: #f7fafc;
    border-radius: 8px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0.5rem;
    border: 1px solid #edf2f7;
    position: relative;
    pointer-events: none;
}

.page-card-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    pointer-events: none;
}

.page-card-number {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
}

/* Page Card Toolbar Actions on Hover */
.page-card-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 2px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    padding: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: auto;
}

.page-card:hover .page-card-actions,
.page-card:focus-within .page-card-actions {
    opacity: 1;
}

.btn-card-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn-card-action:hover {
    background-color: #edf2f7;
    transform: scale(1.1);
}

.btn-card-action-delete:hover {
    color: var(--color-danger);
    background-color: rgba(229, 62, 62, 0.08);
}

/* Source item being dragged */
.page-card.is-drag-source {
    opacity: 0.25;
    transform: scale(0.96);
    border: 2px dashed #94a3b8;
    box-shadow: none;
}

/* Floating Drag Avatar following cursor/finger */
.page-card-drag-avatar {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10000;
    background-color: #ffffff;
    border: 2px solid var(--color-primary, #2563eb);
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.22), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
    transform: scale(1.05) rotate(1.5deg);
    transform-origin: center center;
    box-sizing: border-box;
    will-change: transform, left, top;
    cursor: grabbing;
}

.page-card-drag-avatar .page-card-image-container {
    height: 160px;
    background-color: #f7fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.page-card-drag-avatar .page-card-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.page-card-drag-avatar .page-card-number {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-primary, #2563eb);
}

/* Animated Drop Placeholder Slot */
.page-card-placeholder {
    border: 2px dashed var(--color-primary, #2563eb);
    background-color: #eff6ff;
    border-radius: 12px;
    box-sizing: border-box;
    min-height: 204px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--color-primary, #2563eb);
    font-size: 0.8rem;
    font-weight: 600;
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1);
    animation: placeholder-pulse 1.8s ease-in-out infinite;
}

.page-card-placeholder svg {
    opacity: 0.8;
}

@keyframes placeholder-pulse {
    0%, 100% {
        background-color: #eff6ff;
        border-color: #3b82f6;
    }
    50% {
        background-color: #dbeafe;
        border-color: #1d4ed8;
    }
}

/* In-Grid Add File Tile */
.page-card-add-tile {
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 0.75rem;
    text-align: center;
    box-sizing: border-box;
    min-height: 204px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.22s cubic-bezier(0.2, 0, 0, 1);
    color: #64748b;
    position: relative;
}

.page-card-add-tile:hover {
    border-color: var(--color-primary, #2563eb);
    background-color: #eff6ff;
    color: var(--color-primary, #2563eb);
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.08);
}

.page-card-add-tile:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
    border-color: var(--color-primary);
}

.page-card-add-tile.is-dragover {
    border-color: #2563eb;
    background-color: #dbeafe;
    transform: scale(1.03);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
    color: #1d4ed8;
}

.add-tile-icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    color: var(--color-primary, #2563eb);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.page-card-add-tile:hover .add-tile-icon-wrap,
.page-card-add-tile.is-dragover .add-tile-icon-wrap {
    transform: scale(1.12);
    background-color: var(--color-primary, #2563eb);
    color: #ffffff;
    border-color: var(--color-primary, #2563eb);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.25);
}

.add-tile-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
    transition: color 0.2s ease;
}

.page-card-add-tile:hover .add-tile-title,
.page-card-add-tile.is-dragover .add-tile-title {
    color: var(--color-primary, #2563eb);
}

.add-tile-desc {
    font-size: 0.75rem;
    color: #64748b;
}

/* Dragging visual cues */
.page-card.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

/* Action Area */
.action-section {
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Loading Spinner & Progress Bar */
.process-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    width: 100%;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(37, 99, 235, 0.15);
    border-top-color: var(--color-secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.progress-bar-container {
    width: 100%;
    max-width: 320px;
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.progress-bar-track {
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--grad-primary);
    transition: width 0.15s ease-out;
    border-radius: 9999px;
}

.progress-percent {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
}

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

#process-loader-text {
    font-weight: 500;
    font-size: 0.95rem;
}

.download-box {
    text-align: center;
}

/* Footer */
.footer {
    background-color: white;
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Feature Specific: Compress Color Hues */
.color-compress {
    background-color: rgba(13, 110, 253, 0.05);
    color: #0d6efd;
}

/* Merge List Thumbnails */
.file-thumbnail-container {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f7fafc;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.file-item-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.file-thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(13, 110, 253, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Split Visual Selection Workspace Layout */
.split-workspace-layout {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .split-workspace-layout {
        grid-template-columns: 1fr;
    }
}

.split-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.split-grid-actions {
    display: flex;
    gap: 0.5rem;
}

/* Selection Indicators in Split Grid */
.page-card.selected {
    border-color: var(--color-primary);
    background-color: rgba(13, 110, 253, 0.04);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.page-card.selected::before {
    content: "✓";
    position: absolute;
    top: 6px;
    left: 6px;
    width: 20px;
    height: 20px;
    background-color: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Loaded PDFs section in Organize */
.loaded-pdfs-section {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.loaded-pdfs-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.loaded-pdfs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.loaded-pdf-tag {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.3rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.btn-delete-pdf-tag {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-danger);
    font-weight: bold;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 0.25rem;
    transition: opacity 0.2s;
}

.btn-delete-pdf-tag:hover {
    opacity: 0.7;
}

.global-actions button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tiered Conversion & RAG Chat Styles */
.convert-workspace-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.convert-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    gap: 1rem;
}

.convert-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    outline: none;
}

.convert-tab:hover {
    color: var(--color-primary);
}

.convert-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tier-option-card {
    transition: all 0.2s ease !important;
}

.tier-option-card:hover {
    border-color: var(--color-primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.tier-option-card.active {
    border-color: var(--color-primary) !important;
    background-color: rgba(37, 99, 235, 0.02) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* Chat Styles */
.chat-container {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--color-primary);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 12px 12px 0 12px;
    max-width: 80%;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-bubble.assistant {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chat-locked-overlay {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==========================================
   NEW FEATURES STYLES (2026-07)
   ========================================== */

/* AI Chat Document - PRO Badge in Nav */
.nav-item-pro {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.badge-pro {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* PRO Card on Dashboard */
.tool-card-pro {
    position: relative;
    border: 1.5px solid rgba(245, 158, 11, 0.3) !important;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
}

.tool-card-pro:hover {
    border-color: rgba(217, 119, 6, 0.5) !important;
    box-shadow: 0 8px 32px rgba(245, 158, 11, 0.15) !important;
}

.badge-pro-card {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Color for AI Chat Document */
.color-chatdoc {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(217, 119, 6, 0.08) 100%);
    color: #ec9f46;
}

/* Maintenance Page Styles */
.maintenance-container {}

.maintenance-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: #d97706;
}

.badge-maintenance {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.08));
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    letter-spacing: 0.03em;
}

.maintenance-container h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main, #1f2937);
    margin-bottom: 1rem;
}

.maintenance-description {
    color: var(--text-muted, #6b7280);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.maintenance-features {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    width: 100%;
    text-align: left;
}

.maintenance-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--text-muted, #6b7280);
    font-size: 0.9rem;
}

.maintenance-feature-item+.maintenance-feature-item {
    border-top: 1px solid var(--border-color);
}

.feature-icon {
    color: #10b981;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.maintenance-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.85rem 1.1rem;
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #92400e;
    line-height: 1.5;
    text-align: left;
    width: 100%;
}

/* Merge thumbnail */
.merge-thumb-wrap {
    width: 48px;
    height: 64px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    background: var(--bg-primary, #f8fafc);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
}

.merge-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.merge-thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-primary, #1e3a8a);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* Split Page Grid Selection Styles */
.split-pages-section {
    margin-bottom: 1.5rem;
}

.split-pages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.split-pages-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.split-selection-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

kbd {
    display: inline-block;
    padding: 0.1rem 0.35rem;
    font-size: 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
}

/* Page card selected state */
.page-card.selected {
    border: 2px solid var(--color-primary, #1e3a8a) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.page-card-check {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary, #1e3a8a);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.page-card.selected .page-card-check {
    display: flex;
}

/* Organize: Loaded PDF Tags */
.loaded-pdf-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.25rem;
}

.btn-tag-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1;
    padding: 0;
    transition: color 0.15s;
}

.btn-tag-delete:hover {
    color: #ef4444;
}

/* Selection controls in Organize */
.selection-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.selection-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: auto;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Organize undo/redo disabled state */
button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Alert styles */
.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #92400e;
    padding: 0.9rem 1.1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.info-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Color for compress */
.color-compress {
    background: linear-gradient(135deg, rgba(0, 119, 182, 0.12) 0%, rgba(13, 110, 253, 0.12) 100%);
    color: #0077b6;
}

/* ==========================================
   HAMBURGER MENU BUTTON
   ========================================== */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    flex-direction: column;
    gap: 5px;
    z-index: 200;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger animasi saat aktif (X) */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================
   HAMBURGER BUTTON (Desktop: hidden)
   ========================================== */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    flex-direction: column;
    gap: 5px;
    z-index: 110;
    transition: opacity 0.2s ease;
}

.hamburger-btn:hover {
    opacity: 0.7;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--text-main, #1f2937);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Animasi hamburger jadi X saat active */
.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ========================================== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    /* Navbar: hamburger menu */
    .navbar-container {
        height: auto;
        padding: 0.5rem 0;
        flex-wrap: wrap;
    }

    .hamburger-btn {
        display: flex;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0.25rem;
        padding: 0.75rem 0 0.5rem 0;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-item {
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
        white-space: nowrap;
        width: 100%;
    }

    /* Mobile Dropdown Overrides */
    .nav-dropdown {
        width: 100%;
        display: block;
    }

    .nav-dropdown .dropdown-toggle {
        justify-content: space-between;
    }

    .nav-dropdown .dropdown-menu {
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        background: rgba(0, 0, 0, 0.03) !important;
        background-color: rgba(0, 0, 0, 0.03) !important;
        backdrop-filter: none !important;
        margin: 0.25rem 0 0.5rem 1rem !important;
        width: calc(100% - 1.5rem) !important;
        min-width: 0 !important;
        display: none !important;
        padding: 0.2rem 0 !important;
        animation: none !important;
    }

    .nav-dropdown:hover .dropdown-menu,
    .nav-dropdown:focus-within .dropdown-menu,
    .nav-dropdown.active .dropdown-menu {
        display: block !important;
    }

    .nav-dropdown .dropdown-item {
        margin: 0.15rem 0 !important;
        padding: 0.5rem 0.8rem !important;
        display: block !important;
        color: var(--text-main) !important;
        background: transparent !important;
        font-size: 0.88rem !important;
    }

    /* Hero Section */
    .hero-section {
        padding: 2rem 0.5rem 1.5rem;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .hero-section p {
        font-size: 0.95rem;
    }

    /* Tool Card Dashboard */
    .tool-card {
        padding: 1.25rem;
    }

    .tool-card-icon {
        width: 48px;
        height: 48px;
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    /* Workspace Header */
    .workspace-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem;
    }

    .workspace-header h2 {
        font-size: 1.35rem;
    }

    .workspace-icon {
        font-size: 2rem;
    }

    /* Upload Area */
    .upload-container {
        padding: 2.5rem 1rem;
    }

    .upload-container h3 {
        font-size: 1.1rem;
    }

    /* Editor Container */
    .editor-container {
        padding: 1rem;
    }

    .control-box {
        padding: 1rem;
    }

    /* Panel Header & Global Actions */
    .panel-header-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .global-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .global-actions .btn-small {
        font-size: 0.78rem;
        padding: 0.35rem 0.7rem;
    }

    /* File item di merge */
    .file-item {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }

    .file-item .file-item-info {
        min-width: 0;
        flex: 1;
    }

    .file-item-name {
        max-width: 160px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .file-item .file-item-actions {
        flex-shrink: 0;
    }

    /* Pages Grid lebih rapi dan kokoh untuk mobile (2 Kolom Presisi) */
    .pages-grid,
    .stitch-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.75rem !important;
        padding: 0.5rem 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .page-card-image-container {
        height: 130px !important;
        width: 100% !important;
    }

    .page-card {
        padding: 0.5rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .page-card-number {
        font-size: 0.75rem;
    }

    /* Split pages header */
    .split-pages-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    /* Selection controls */
    .selection-controls {
        gap: 0.3rem;
        padding: 0.5rem;
    }

    .selection-controls .btn-small {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .selection-count {
        font-size: 0.75rem;
        width: 100%;
        margin-left: 0;
        margin-top: 0.25rem;
    }

    /* Radio label lebih kecil */
    .radio-label {
        font-size: 0.85rem;
    }

    /* Action Section */
    .action-section {
        padding-top: 1.5rem;
    }

    /* AI Chat Doc / Maintenance */
    .maintenance-container h2 {
        font-size: 1.4rem;
    }

    .maintenance-icon {
        width: 80px;
        height: 80px;
    }

    .maintenance-container {
        text-align: center;
    }

    /* Convert tabs scroll */
    .convert-tabs {
        overflow-x: auto;
        gap: 0.5rem;
    }

    .convert-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Edit PDF two-panel: collapse to vertical on mobile */
    .editpdf-workspace {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }

    .editpdf-page-strip {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.5rem;
        gap: 0.5rem;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
        max-height: 130px;
    }

    .editpdf-strip-card {
        flex-shrink: 0;
        width: 70px;
    }

    .editpdf-canvas-area {
        padding: 1rem 0.75rem;
    }
}

/* Extra small: ≤ 480px */
@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 1.4rem;
    }

    .nav-item {
        font-size: 0.72rem;
        padding: 0.3rem 0.5rem;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .logo-icon svg {
        width: 22px;
        height: 22px;
    }

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

    .page-card-image-container {
        height: 100px;
    }

    .upload-illustration svg {
        width: 40px;
        height: 40px;
    }

    .btn-primary,
    .btn-action {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
    }

    .tool-card h3 {
        font-size: 1.1rem;
    }
}

/* Modal Feedback (Premium UI) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    /* Slate-900 with transparency */
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 480px;
    padding: 2rem;
    position: relative;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.7rem;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0;
    line-height: 1;
}

.btn-close-modal:hover {
    color: #475569;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-body p {
    color: #475569;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Star Rating styling */
.rating-stars {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.star-btn {
    font-size: 2.2rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
    user-select: none;
}

.star-btn:hover {
    transform: scale(1.15);
}

.star-btn.hover,
.star-btn.active {
    color: #f59e0b;
    /* Golden star color */
}

/* Comment Area */
.comment-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comment-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
}

.comment-textarea {
    width: 100%;
    height: 80px;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.comment-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Modal Footer buttons */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-cancel {
    background-color: #f1f5f9;
    color: #475569;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-cancel:hover {
    background-color: #e2e8f0;
}

.btn-submit {
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

.btn-submit:hover:not(:disabled) {
    background-color: #2563eb;
}

.btn-submit:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Animations */
.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-surface);
    color: var(--text-main);
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    font-size: 0.95rem;
    font-weight: 500;
    min-width: 300px;
    max-width: 450px;
    animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), toastFadeOut 0.3s ease-out 4.7s forwards;
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.error {
    border-left-color: var(--color-danger);
}

.toast.info {
    border-left-color: var(--color-secondary);
}

.toast.warning {
    border-left-color: var(--color-warning);
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 4px;
}

.toast-close:hover {
    color: var(--text-main);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastFadeOut {
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* Editor Screens (Edit PDF & Annotate PDF) */
.edit-toolbar,
.annotate-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-surface);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(10px);
}

.toolbar-info {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.btn-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-toolbar:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--color-primary);
}

.btn-toolbar.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
}

.toolbar-color-picker,
.toolbar-size-picker,
.toolbar-font-picker {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-main);
}

.toolbar-color-picker input[type="color"] {
    border: 1px solid var(--border-color);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    padding: 1px;
    background: var(--bg-surface);
}

.toolbar-size-picker select,
.toolbar-font-picker select {
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.8rem;
    cursor: pointer;
}

.pdfed-text-format-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.pdfed-align-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pdfed-align-group .stitch-segmented-item {
    padding: 0.28rem 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.pdfed-align-group .stitch-segmented-item svg {
    display: block;
}

/* Vertical page viewer list */
.pages-vertical-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.02);
    border: 1px dashed var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.page-view-wrapper {
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    background-color: white;
    line-height: 0;
    container-type: size;
}

.page-view-image {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    pointer-events: none;
}

/* ===== Edit PDF Two-Panel Workspace ===== */

.editpdf-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.editpdf-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.editpdf-toolbar-hint {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.editpdf-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.editpdf-page-indicator {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(37, 99, 235, 0.08);
    border-radius: 6px;
    padding: 0.3rem 0.75rem;
    white-space: nowrap;
}

/* Two-panel workspace row */
.editpdf-workspace {
    display: flex;
    gap: 0;
    height: calc(100vh - 260px);
    min-height: 500px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
}

/* Left: page thumbnail strip */
.editpdf-page-strip {
    width: 170px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 0.75rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.editpdf-page-strip::-webkit-scrollbar {
    width: 4px;
}

.editpdf-page-strip::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* Each thumbnail card in the strip */
.editpdf-strip-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.4rem;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.editpdf-strip-card:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: scale(1.02);
}

.editpdf-strip-card.active {
    border-color: var(--color-primary);
    background: #dbeafe;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.2);
}

.editpdf-strip-card img {
    width: 100%;
    border-radius: 4px;
    display: block;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    pointer-events: none;
    user-select: none;
}

.editpdf-strip-page-num {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.editpdf-strip-card.active .editpdf-strip-page-num {
    color: var(--color-primary);
}

/* Right: canvas editor area */
.editpdf-canvas-area {
    flex: 1;
    overflow-y: auto;
    background: #f0f4fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 2rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.editpdf-canvas-area::-webkit-scrollbar {
    width: 6px;
}

.editpdf-canvas-area::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* Container of all full-size pages in the right panel */
.editpdf-pages-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    width: 100%;
    max-width: 900px;
}

/* Each full-size page wrapper — override the shared page-view-wrapper */
.editpdf-pages-list .page-view-wrapper {
    width: 100%;
    max-width: 800px;
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    scroll-margin-top: 2.5rem;
}

/* Page section separator label */
.editpdf-page-section-label {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-left: 4px;
    margin-bottom: -2rem;
}


.page-edit-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    line-height: normal;
}

.editable-text-block {
    position: absolute;
    border: 1px dashed transparent;
    cursor: text;
    overflow: visible;
    white-space: pre-wrap !important;
    word-break: break-word;
    padding: 0 !important;
    margin: 0 !important;
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    display: block;
    transform-origin: 0 0;
    /* By default, hide overlay text to reveal sharp PDF canvas background */
    color: transparent !important;
    background-color: transparent;
    caret-color: var(--color-primary, #2563eb);
    user-select: text;
    -webkit-user-select: text;
    z-index: 10;
}

.editable-text-block:hover {
    border-color: rgba(37, 99, 235, 0.55);
    background-color: rgba(37, 99, 235, 0.04);
    border-radius: 2px;
    z-index: 20;
}

.editable-text-block:focus,
.editable-text-block.is-focused {
    border-color: transparent;
    background-color: var(--block-bg, #ffffff) !important;
    color: var(--text-color, var(--text-color-original, #000000)) !important;
    /* Clean focus ring */
    box-shadow: 0 0 0 1.5px var(--color-primary, #2563eb), 0 2px 8px rgba(37, 99, 235, 0.15);
    border-radius: 2px;
    z-index: 100;
}

.editable-text-block.is-edited {
    background-color: var(--block-bg, #ffffff) !important;
    color: var(--text-color, var(--text-color-original, #000000)) !important;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
    border-radius: 2px;
    z-index: 30;
}

.editable-text-block.is-dragging {
    cursor: grabbing !important;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35) !important;
    z-index: 1000 !important;
    user-select: none;
    opacity: 0.92;
}

/* Move Drag Handle on top-left of editable text blocks */
.pdfed-block-drag-handle {
    position: absolute;
    top: -20px;
    left: -1px;
    width: 20px;
    height: 20px;
    background: var(--color-primary, #2563eb);
    color: #ffffff;
    border-radius: 4px 4px 0 0;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: grab;
    font-size: 11px;
    z-index: 110;
    user-select: none;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease, background-color 0.15s ease;
}

.pdfed-block-drag-handle:hover {
    background: #1d4ed8;
    transform: scale(1.08);
}

.pdfed-block-drag-handle:active {
    cursor: grabbing;
}

.editable-text-block:hover .pdfed-block-drag-handle,
.editable-text-block.is-focused .pdfed-block-drag-handle,
.editable-text-block.is-edited .pdfed-block-drag-handle {
    display: flex;
}

/* Word-Level Edit Mode */
.editable-text-block.is-word-mode {
    white-space: nowrap !important;
    word-break: normal !important;
    border-radius: 3px;
    padding: 0 1px !important;
}

.editable-text-block.is-word-mode:hover {
    border-color: rgba(37, 99, 235, 0.65);
    background-color: rgba(37, 99, 235, 0.08);
}

.editable-text-block.is-word-mode:focus,
.editable-text-block.is-word-mode.is-focused {
    box-shadow: 0 0 0 1.5px var(--color-primary, #2563eb), 0 2px 6px rgba(37, 99, 235, 0.2);
    min-width: 14px;
}

/* Granularity toggle */
.pdfed-granularity-group {
    display: inline-flex;
    background: var(--stitch-surface-dim, #f1f5f9);
    border-radius: 6px;
    padding: 2px;
}

.pdfed-granularity-group .stitch-segmented-item {
    padding: 3px 8px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--stitch-text-muted, #64748b);
    transition: all 0.15s ease;
}

.pdfed-granularity-group .stitch-segmented-item.active {
    background: #ffffff;
    color: var(--color-primary, #1e3a8a);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Annotation Layer (Annotate PDF) */
.page-annotate-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: auto;
    line-height: normal;
}

.page-annotate-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: crosshair;
}

/* Draggable annotation textboxes */
.annotated-textbox {
    position: absolute;
    border: 1px dashed var(--color-primary);
    background: transparent;
    outline: none;
    cursor: move;
    z-index: 20;
    padding: 4px;
    min-width: 50px;
    min-height: 20px;
    box-sizing: border-box;
    white-space: pre-wrap;
    line-height: 1.2;
}

.annotated-textbox:focus {
    border-style: solid;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.btn-textbox-delete {
    position: absolute;
    top: -24px;
    right: 0;
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
}

.annotated-textbox:hover .btn-textbox-delete,
.annotated-textbox:focus-within .btn-textbox-delete {
    display: flex;
}

/* Security Banner below Upload Box */
.security-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    font-size: 0.82rem;
    color: #166534;
    margin-top: 14px;
    line-height: 1.5;
    width: 100%;
}

.security-banner svg {
    color: #15803d;
    flex-shrink: 0;
}

/* Security Badge in Dashboard Hero */
.security-badge-hero {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(30, 58, 138, 0.05);
    border: 1.5px solid rgba(30, 58, 138, 0.08);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-primary);
    margin-top: 12px;
}

.security-badge-hero svg {
    color: var(--color-secondary);
}

/* Footer Compliance Links styling */
.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.25rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--color-secondary);
}

@media (max-width: 600px) {
    .footer-container {
        flex-direction: column;
        text-align: center;
    }
    .footer-links {
        justify-content: center;
    }
}


/* ═══════════════════════════════════════════════════════════════════
   AI PDF Chat (chatdoc) — Komponen UI
   ═══════════════════════════════════════════════════════════════════ */

.chatdoc-container {
    display: flex;
    flex-direction: column;
    height: 540px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: 0 4px 24px rgba(30, 58, 138, 0.07);
}

/* ── Header ───────────────────────────────────────────────────── */
.chatdoc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.04) 0%, rgba(37, 99, 235, 0.02) 100%);
    flex-shrink: 0;
}

.chatdoc-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-primary);
}

.chatdoc-header-left h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

.badge-beta {
    display: inline-block;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 20px;
    text-transform: uppercase;
}

.chatdoc-quota-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-success);
    background: rgba(22, 163, 74, 0.08);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.chatdoc-quota-icon {
    font-size: 10px;
}

/* ── Upload Area ──────────────────────────────────────────────── */
.chatdoc-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 32px 24px;
    text-align: center;
    gap: 12px;
}

.chatdoc-upload-icon {
    color: var(--color-secondary);
    opacity: 0.85;
    animation: chatdoc-pulse 2.4s ease-in-out infinite;
}

@keyframes chatdoc-pulse {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.06); opacity: 1; }
}

.chatdoc-upload h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.chatdoc-upload-desc {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    max-width: 360px;
    line-height: 1.6;
}

.chatdoc-upload-limits {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.chatdoc-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    background: var(--grad-primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    margin-top: 4px;
}

.chatdoc-upload-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.chatdoc-upload-btn:active {
    transform: translateY(0);
}

/* ── Chat Area ────────────────────────────────────────────────── */
.chatdoc-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

/* File info bar */
.chatdoc-filebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(37, 99, 235, 0.04);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chatdoc-filebar-info {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.chatdoc-filebar-info svg {
    color: var(--color-secondary);
    flex-shrink: 0;
}

.chatdoc-pagecount {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.chatdoc-changefile-btn {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-secondary);
    background: none;
    border: 1px solid var(--color-secondary);
    border-radius: 7px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.chatdoc-changefile-btn:hover {
    background: var(--color-secondary);
    color: #fff;
}

/* Messages container */
.chatdoc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.chatdoc-messages::-webkit-scrollbar {
    width: 4px;
}

.chatdoc-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Message bubbles */
.chatdoc-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 85%;
    margin-bottom: 16px;
    animation: chatdoc-bubble-in 0.22s ease-out;
}

@keyframes chatdoc-bubble-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chatdoc-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatdoc-message.assistant,
.chatdoc-message.error {
    align-self: flex-start;
    flex-direction: row;
}

.chatdoc-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    margin-top: 2px;
}

.chatdoc-message.user .chatdoc-avatar {
    background: var(--grad-primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.chatdoc-message.assistant .chatdoc-avatar {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.1);
}

.chatdoc-message.user .chatdoc-bubble {
    background: #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.chatdoc-message.assistant .chatdoc-bubble {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}



.chatdoc-message.error .chatdoc-bubble {
    background: rgba(220, 38, 38, 0.07);
    color: var(--color-danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-bottom-left-radius: 4px;
}

/* Export to Word Button */
.chatdoc-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 12px;
    padding: 6px 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chatdoc-export-btn:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.15);
}

.chatdoc-export-btn svg {
    flex-shrink: 0;
}

/* Typing indicator */
.chatdoc-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.chatdoc-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-secondary);
    animation: chatdoc-bounce 1.2s ease-in-out infinite;
}

.chatdoc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chatdoc-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatdoc-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Input row */
.chatdoc-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    flex-shrink: 0;
}

.chatdoc-textarea {
    flex: 1;
    padding: 9px 13px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-primary);
    resize: none;
    outline: none;
    line-height: 1.5;
    min-height: 38px;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color 0.15s;
}

.chatdoc-textarea:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.chatdoc-send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: var(--grad-primary);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.chatdoc-send-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.chatdoc-send-btn:not(:disabled):hover {
    opacity: 0.88;
    transform: scale(1.05);
}

/* Footer disclaimer */
.chatdoc-disclaimer {
    text-align: center;
    font-size: 10.5px;
    color: var(--text-muted);
    margin: 0;
    padding: 5px 12px 7px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    opacity: 0.8;
}

/* ── Quota Warning ────────────────────────────────────────────── */
.chatdoc-quota-warning {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 32px 24px;
    text-align: center;
    gap: 10px;
    background: rgba(220, 38, 38, 0.03);
}

.chatdoc-quota-warning-icon {
    font-size: 40px;
}

.chatdoc-quota-warning h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-danger);
}

.chatdoc-quota-warning p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════
   Enhanced AI PDF Chat (chatdoc) — Google Drive Gemini Style UI
   ═══════════════════════════════════════════════════════════════════ */

body:has(#panel-chatdoc) main.main-content,
body.page-chat main.main-content {
    max-width: 100% !important;
    padding: 8px 20px !important;
}

.chatdoc-layout {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 110px);
    min-height: 700px;
    border: 1px solid #1e293b;
    border-radius: 16px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

/* ── PDF Viewer Panel (Main Left Canvas Area) ── */
.chatdoc-viewer-panel {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-width: 0;
    border-right: 1px solid #1e293b;
    background: #18191c;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chatdoc-viewer-panel.collapsed {
    flex: 0 !important;
    width: 0px !important;
    border-right: none;
}

/* Vertical Page Rail */
.chatdoc-viewer-rail {
    width: 54px;
    background: #111214;
    border-right: 1px solid #232528;
    overflow-y: auto;
    padding: 10px 0;
    flex-shrink: 0;
}

.chatdoc-rail-pages {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.chatdoc-page-tab {
    width: 38px;
    padding: 6px 0;
    text-align: center;
    font-family: monospace;
    font-size: 11px;
    font-weight: 600;
    color: #a0a5ad;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.chatdoc-page-tab:hover {
    background: #3c3f42;
    color: #fff;
}

.chatdoc-page-tab.active {
    background: #2563eb;
    color: #fff;
    font-weight: 700;
}

.chatdoc-page-tab.flash {
    animation: tab-flash-animation 1s ease forwards;
}

@keyframes tab-flash-animation {
    0% { background: #f4c430; color: #000; }
    100% { background: #2563eb; color: #fff; }
}

/* Canvas Preview Area */
.chatdoc-viewer-canvas-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    gap: 20px;
    position: relative;
    scroll-behavior: smooth;
}

.chatdoc-viewer-empty {
    margin: auto;
    text-align: center;
    color: #8a8f98;
}

.chatdoc-viewer-empty p {
    font-size: 13px;
    margin-top: 8px;
}

.chatdoc-pdf-pages {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 900px;
}

.chatdoc-pdf-page-canvas {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    border-radius: 6px;
}

/* ── Chat Panel (Gemini Right Sidebar — Bright Light Mode) ── */
.chatdoc-chat-panel {
    display: flex;
    flex-direction: column;
    width: 380px;
    flex-shrink: 0;
    background: #ffffff;
    color: #0f172a;
    border-left: 1px solid #e2e8f0;
}

.chatdoc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 14px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
    gap: 8px;
    flex-shrink: 0;
}

.chatdoc-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.chatdoc-filebar-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.chatdoc-filebar-pages {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 2px 7px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

.chatdoc-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.chatdoc-quota-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.chatdoc-changefile-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.chatdoc-changefile-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Gemini Empty State Styling */
.gemini-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 20px 20px;
    margin: auto 0;
}

.gemini-sparkle-icon {
    margin-bottom: 16px;
    animation: gemini-float 3s ease-in-out infinite;
}

@keyframes gemini-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.gemini-title {
    font-size: 1.45rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #7c3aed, #db2777);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.gemini-subtitle {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.5;
    max-width: 310px;
}

.gemini-subtitle strong {
    color: #0f172a;
}

/* Floating Quick Prompts Drawer */
.chatdoc-chips-container {
    position: absolute;
    bottom: 68px;
    left: 12px;
    right: 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    z-index: 25;
    display: none;
    flex-direction: column;
    gap: 8px;
    animation: chips-slide-up 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chatdoc-chips-container.active {
    display: flex;
}

@keyframes chips-slide-up {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chatdoc-chips-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
}

.chatdoc-chips-close {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 4px;
}

.chatdoc-chips-close:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.chatdoc-toggle-chips-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #2563eb;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.chatdoc-toggle-chips-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}



.chatdoc-content-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.chatdoc-toggle-viewer-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    margin-left: 8px;
}

.chatdoc-toggle-viewer-btn:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.chatdoc-toggle-viewer-btn.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
    border-color: rgba(37, 99, 235, 0.3);
}

/* ── Progress Indicators ── */
.chatdoc-progress-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 24px;
    max-width: 380px;
    margin: auto;
    width: 100%;
    gap: 12px;
}

.chatdoc-progress-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.chatdoc-progress-bar-track {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.chatdoc-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    width: 0%;
    transition: width 0.3s ease;
}

.chatdoc-progress-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.chatdoc-phase-dots {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.chatdoc-phase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    transition: background 0.3s;
}

.chatdoc-phase-dot.active {
    background: var(--color-primary);
}

.chatdoc-phase-dot.done {
    background: var(--color-primary);
    opacity: 0.4;
}

/* ── Document Type Identification & Mode Selection ── */
.chatdoc-identify-card {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: center;
    padding: 32px 24px;
    max-width: 420px;
    margin: auto;
    width: 100%;
}

.chatdoc-identify-shimmer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatdoc-shimmer-line {
    height: 14px;
    background: linear-gradient(90deg, var(--border-color) 25%, rgba(226, 232, 240, 0.4) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer-pulse 1.5s infinite;
    border-radius: 6px;
}

.chatdoc-shimmer-line.w-40 { width: 40%; }
.chatdoc-shimmer-line.w-75 { width: 75%; }
.chatdoc-shimmer-line.w-90 { width: 90%; }

@keyframes shimmer-pulse {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.chatdoc-identify-result {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chatdoc-identify-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.chatdoc-identify-header {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(37, 99, 235, 0.04);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 12px;
}

.chatdoc-identify-icon {
    font-size: 24px;
}

.chatdoc-identify-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.chatdoc-identify-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.chatdoc-mode-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatdoc-mode-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-surface);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.chatdoc-mode-option-btn:hover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.02);
}

.chatdoc-mode-option-btn.recommended {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary);
    background: rgba(37, 99, 235, 0.03);
    position: relative;
}

.chatdoc-mode-option-btn.recommended::after {
    content: "Recommended";
    position: absolute;
    top: -9px;
    right: 12px;
    background: var(--color-primary);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
}

.chatdoc-mode-option-btn .btn-icon {
    font-size: 20px;
}

.chatdoc-mode-option-btn .btn-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.chatdoc-mode-option-btn .btn-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Mode selector top pills ── */
.chatdoc-mode-pills {
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

.chatdoc-pill-btn {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.chatdoc-pill-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}

.chatdoc-pill-btn.active.regulation {
    background: #fef3c7;
    border-color: #d97706;
    color: #b45309;
}

.chatdoc-pill-btn.active.research {
    background: #eceafb;
    border-color: #7c3aed;
    color: #5b4fcf;
}

.chatdoc-pill-btn.active.general {
    background: #dce8e4;
    border-color: #2f6f62;
    color: #1f5046;
}

.chatdoc-mode-pill {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
}

/* ── Message formatting & Citations ── */
.chatdoc-bubble strong {
    font-weight: 700;
}

.chatdoc-bubble ul {
    margin: 6px 0;
    padding-left: 18px;
}

.chatdoc-bubble li {
    margin-bottom: 3px;
}

.chatdoc-active-mode-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-family: monospace;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.chatdoc-active-mode-banner.regulation { background: #fef3c7; color: #b45309; }
.chatdoc-active-mode-banner.research   { background: #eceafb; color: #5b4fcf; }
.chatdoc-active-mode-banner.general    { background: #dce8e4; color: #1f5046; }

/* Inline Citations */
.cite {
    background: linear-gradient(transparent 60%, var(--color-warning-soft) 60%);
    cursor: pointer;
    border-bottom: 1.5px solid var(--color-warning);
    padding-bottom: 1px;
}

.cite:hover {
    background: linear-gradient(transparent 60%, var(--color-warning) 60%);
}

.cite-tag {
    font-size: 9.5px;
    font-family: monospace;
    font-weight: 700;
    color: var(--color-secondary);
    vertical-align: super;
    margin-left: 2px;
}

/* Source citations below message bubble */
.chatdoc-sources {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

.chatdoc-sources-label {
    font-size: 10px;
    font-family: monospace;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chatdoc-source-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.chatdoc-source-card:hover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.02);
}

.chatdoc-source-page {
    font-size: 10px;
    font-family: monospace;
    font-weight: 700;
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
    padding: 2px 6px;
    border-radius: 8px;
    flex-shrink: 0;
}

.chatdoc-source-excerpt {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    flex: 1;
}

.chatdoc-source-jump {
    font-size: 10px;
    color: var(--color-primary);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
}

.chatdoc-source-card:hover .chatdoc-source-jump {
    opacity: 1;
}

/* ── Typing & Skeletons ── */
.chatdoc-typing-indicator-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.chatdoc-skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.02);
    border-left: 3px solid var(--border-color);
}

.chatdoc-skel-line {
    height: 10px;
    background: linear-gradient(90deg, var(--border-color) 25%, rgba(226, 232, 240, 0.4) 50%, var(--border-color) 75%);
    background-size: 200% 100%;
    animation: shimmer-pulse 1.5s infinite;
    border-radius: 4px;
}

.chatdoc-skel-line.w-80 { width: 80%; }
.chatdoc-skel-line.w-90 { width: 90%; }
.chatdoc-skel-line.w-65 { width: 65%; }

/* ── Suggestion Chips ── */
.chatdoc-chips-container {
    padding: 0 16px 8px;
    display: none;
}

.chatdoc-chips-container.active {
    display: block;
}

.chatdoc-chips-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.chatdoc-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chatdoc-chip {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.chatdoc-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(37, 99, 235, 0.02);
    transform: translateY(-1px);
}

/* ── Citations Popover ── */
.popover {
    position: fixed;
    max-width: 260px;
    background: #1e293b;
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.5;
    padding: 10px 12px;
    border-radius: 8px;
    z-index: 9999;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    display: none;
    border: 1px solid #334155;
    pointer-events: none;
}

.popover .ptag {
    font-family: monospace;
    font-size: 10px;
    font-weight: 700;
    color: #f59e0b;
    display: block;
    margin-bottom: 4px;
}

/* ── Responsive adjustments ── */
@media (max-width: 860px) {
    .chatdoc-layout {
        flex-direction: column;
        height: auto;
    }
    .chatdoc-viewer-panel {
        width: 100% !important;
        height: 350px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .chatdoc-viewer-panel.collapsed {
        height: 0px !important;
        border-bottom: none;
    }
}

/* ======================================================
   COMPRESS TOOL — Enhanced UX
   ====================================================== */

/* File card */
.compress-file-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.compress-file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.compress-file-icon {
    width: 44px;
    height: 44px;
    background: rgba(30, 58, 138, 0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    flex-shrink: 0;
}

.compress-file-meta {
    flex: 1;
    min-width: 0;
}

.compress-file-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compress-file-size {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.compress-file-badge {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    flex-shrink: 0;
}

/* Target section */
.compress-target-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.compress-section-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    color: var(--text-muted);
}

.compress-section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

/* Size display row */
.compress-size-display {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.compress-size-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.compress-size-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.compress-size-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.compress-size-target .compress-size-value {
    color: var(--color-secondary);
}

.compress-size-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Range slider wrapper */
.compress-slider-wrapper {
    margin-bottom: 1rem;
}

.compress-range-input {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(
        to right,
        var(--color-secondary) 0%,
        var(--color-secondary) var(--slider-pct, 50%),
        var(--border-color) var(--slider-pct, 50%),
        var(--border-color) 100%
    );
    outline: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.compress-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--color-secondary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    cursor: grab;
    transition: box-shadow 0.2s, transform 0.15s;
}

.compress-range-input::-webkit-slider-thumb:active {
    cursor: grabbing;
    transform: scale(1.18);
    box-shadow: 0 3px 14px rgba(37, 99, 235, 0.5);
}

.compress-range-input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--color-secondary);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    cursor: grab;
}

.compress-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Estimation badge */
.compress-estimation-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    transition: background 0.3s, color 0.3s;
}

.compress-est-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.compress-estimation-badge.badge-neutral {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-muted);
}

.compress-estimation-badge.badge-light {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.compress-estimation-badge.badge-balanced {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.compress-estimation-badge.badge-aggressive {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

/* Quick presets */
.compress-presets {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.compress-presets-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

.compress-preset-btn {
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    border: 1.5px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.18s ease;
}

.compress-preset-btn:hover {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
    background: rgba(37, 99, 235, 0.06);
}

.compress-preset-btn.active {
    border-color: var(--color-secondary);
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-secondary);
    font-weight: 600;
}

/* Preview & Compress button */
.compress-preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

.compress-preview-btn:hover:not(:disabled) {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(37, 99, 235, 0.4);
}

.compress-preview-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Spinner for loading states */
.compress-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: compressSpinAnim 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes compressSpinAnim {
    to { transform: rotate(360deg); }
}

/* ─── Inline Loading Bar ──────────────────────────────── */

.compress-loading-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.25rem 2rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    animation: compressFadeIn 0.3s ease-out;
}

.compress-loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.compress-loading-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.compress-loading-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.compress-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(37, 99, 235, 0.15);
    border-top-color: var(--color-secondary);
    border-radius: 50%;
    animation: compressSpinAnim 0.8s linear infinite;
    display: inline-block;
}

.compress-loading-status {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    max-width: 320px;
    height: 20px;
}

.compress-progress-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.compress-progress-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.compress-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.1s ease-out;
}

.compress-progress-text {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

/* ─── Success Results Panel ─────────────────────────── */


.compress-results-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1rem;
    animation: compressFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.compress-success-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.25rem 1.5rem 1.75rem 1.5rem;
}

.success-icon-wrapper {
    width: 60px;
    height: 60px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.05);
    animation: compressSuccessScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s both;
}

@keyframes compressSuccessScale {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.compress-success-banner h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.compress-success-banner p {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 380px;
    line-height: 1.55;
}

/* Result stats */
.compress-result-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    flex-wrap: wrap;
}

.compress-stat-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 110px;
}

.compress-stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.compress-stat-info {
    display: flex;
    flex-direction: column;
}

.compress-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.compress-stat-value {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.compress-stat-savings .compress-stat-value {
    color: #059669;
}

.compress-stat-divider {
    color: var(--text-muted);
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Action row */
.compress-action-row {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.compress-download-btn,
.compress-retry-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.18s ease;
}

.compress-download-btn {
    flex: 2;
    justify-content: center;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.3);
}

.compress-download-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(16, 185, 129, 0.4);
}

.compress-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.compress-retry-btn {
    flex: 1;
    justify-content: center;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1.5px solid var(--border-color);
}

.compress-retry-btn:hover {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
    background: rgba(37, 99, 235, 0.06);
}

/* Mobile responsiveness */
@media (max-width: 600px) {
    .compress-size-display {
        gap: 0.75rem;
    }

    .compress-size-value {
        font-size: 1.1rem;
    }

    .compress-result-stats {
        gap: 0.75rem;
    }

    .compress-stat-card {
        min-width: 80px;
    }

    .compress-action-row {
        flex-direction: column;
    }

    .compress-download-btn,
    .compress-retry-btn {
        width: 100%;
    }

    .before-after-container {
        min-height: 160px;
    }
}
/* ═══════════════════════════════════════════════════════════════════
   Shared PDF Editor Engine (pdf-editor.js) — Edit PDF & Annotate PDF
   ═══════════════════════════════════════════════════════════════════ */

/* Toolbar */
.pdfed-toolbar {
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
}

.pdfed-tb-group {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.pdfed-toolbar .btn-toolbar {
    padding: 0.45rem 0.6rem;
    font-size: 0.8rem;
    gap: 0.35rem;
}

.pdfed-toolbar .btn-toolbar span {
    white-space: nowrap;
}

.pdfed-tb-icon {
    padding: 0.45rem 0.5rem !important;
}

.btn-toolbar:disabled,
.btn-toolbar.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: auto;
}

.btn-toolbar:disabled:hover {
    background: transparent;
    color: var(--text-main);
}

/* Tool Dropdowns (Shape & Edit Text) */
.pdfed-shape-dd,
.pdfed-tool-dd {
    position: relative;
    display: inline-flex;
}

.pdfed-shape-menu,
.pdfed-dropdown-menu,
.pdfed-tool-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #ffffff;
    border: 1px solid var(--stitch-border, #cbd5e1);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16), 0 4px 10px rgba(15, 23, 42, 0.08);
    z-index: 9999 !important;
    min-width: 155px;
    padding: 6px;
    flex-direction: column;
    gap: 3px;
}

.pdfed-shape-menu.open,
.pdfed-dropdown-menu.open,
.pdfed-tool-menu.open {
    display: flex !important;
}

.pdfed-shape-menu button,
.pdfed-dropdown-menu button,
.pdfed-tool-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    text-align: left;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--stitch-text-main, #1e293b);
    transition: all 0.15s ease;
    width: 100%;
}

.pdfed-shape-menu button svg,
.pdfed-dropdown-menu button svg,
.pdfed-tool-menu button svg {
    flex-shrink: 0;
    color: var(--stitch-text-muted, #64748b);
    transition: color 0.15s ease;
}

.pdfed-shape-menu button:hover,
.pdfed-dropdown-menu button:hover,
.pdfed-tool-menu button:hover {
    background: #f1f5f9;
    color: var(--color-primary, #2563eb);
}

.pdfed-shape-menu button:hover svg,
.pdfed-dropdown-menu button:hover svg,
.pdfed-tool-menu button:hover svg {
    color: var(--color-primary, #2563eb);
}

.pdfed-shape-menu button.active,
.pdfed-dropdown-menu button.active,
.pdfed-tool-menu button.active {
    background: #eff6ff;
    color: var(--color-primary, #1e3a8a);
    font-weight: 600;
}

.pdfed-shape-menu button.active svg,
.pdfed-dropdown-menu button.active svg,
.pdfed-tool-menu button.active svg {
    color: var(--color-primary, #1e3a8a);
}

/* Search group */
.pdfed-search-group {
    gap: 0.3rem;
    color: var(--text-muted);
}

.pdfed-search-input {
    width: 130px;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    background: var(--bg-surface);
    color: var(--text-main);
}

.pdfed-search-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdfed-search-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    min-width: 30px;
    text-align: center;
}

.pdfed-search-nav {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.55rem;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
    color: var(--text-main);
}

.pdfed-search-nav:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
}

/* Zoom group */
.pdfed-zoom-group {
    gap: 0.35rem;
    margin-left: auto;
}

.pdfed-zoom-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.pdfed-zoom-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    color: var(--color-primary);
}

.pdfed-zoom-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    min-width: 42px;
    text-align: center;
}

/* Scanned-document banner */
.pdfed-scan-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    font-size: 0.82rem;
    color: #92400e;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.pdfed-scan-banner svg {
    color: #d97706;
    flex-shrink: 0;
}

/* Page slots & rotated inner page */
.pdfed-page-slot {
    position: relative;
    flex-shrink: 0;
    scroll-margin-top: 2.5rem;
}

.pdfed-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: none !important;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    container-type: size;
}

.pdfed-inner .page-view-image {
    width: 100%;
    height: 100%;
    display: block;
}

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

.pdfed-textlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.pdfed-searchlayer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 12;
    pointer-events: none;
    line-height: normal;
}

.pdfed-search-hit {
    position: absolute;
    background: rgba(255, 213, 0, 0.35);
    border-radius: 2px;
    outline: 1px solid rgba(217, 119, 6, 0.35);
}

.pdfed-search-hit.current {
    background: rgba(249, 115, 22, 0.45);
    outline: 2px solid #ea580c;
}

.pdfed-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    line-height: normal;
}

/* Annotation objects (DOM types) */
.pdfed-obj {
    position: absolute;
    box-sizing: border-box;
}

.pdfed-obj-text {
    border: 1px dashed rgba(19, 123, 236, 0.6);
    padding: 2px 4px;
    min-height: 1.2em;
    min-width: 40px;
    max-width: 95%;
    outline: none;
    cursor: text;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.25;
    background: transparent !important;
    border-radius: 3px;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pdfed-obj-text:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
    font-style: italic;
}

.pdfed-obj-text:focus,
.pdfed-obj-text.is-selected {
    border: 1.5px solid var(--color-primary);
    background: transparent !important;
    cursor: text;
    box-shadow: 0 0 0 3px rgba(19, 123, 236, 0.15);
    z-index: 40;
}

.pdfed-obj-text:not(:focus):not(.is-selected) {
    border-color: transparent;
}

.pdfed-obj-text:not(:focus):not(.is-selected):hover {
    border-color: rgba(19, 123, 236, 0.5);
}

.pdfed-obj-image,
.pdfed-obj-sign {
    cursor: move;
    border: 1px dashed transparent;
}

.pdfed-obj-image img,
.pdfed-obj-sign img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    user-select: none;
    pointer-events: none;
}

.pdfed-obj-image:hover,
.pdfed-obj-sign:hover {
    border-color: rgba(37, 99, 235, 0.5);
}

.pdfed-obj-note {
    width: 26px;
    height: 26px;
    border-radius: 6px 6px 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: move;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.pdfed-obj.is-selected {
    border: 1.5px solid var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Resize handle (bottom-right) */
.pdfed-resize-handle {
    position: absolute;
    right: -7px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: var(--color-primary);
    border: 2px solid white;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 40;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Selection box for canvas-drawn objects */
.pdfed-sel-box {
    position: absolute;
    border: 1.5px dashed var(--color-primary);
    background: rgba(37, 99, 235, 0.06);
    cursor: move;
    z-index: 35;
    box-sizing: border-box;
}

/* Note popover */
.pdfed-note-popover {
    position: absolute;
    top: 30px;
    left: 0;
    width: 210px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    padding: 8px;
    z-index: 60;
    cursor: default;
}

.pdfed-note-textarea {
    width: 100%;
    height: 70px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.8rem;
    padding: 6px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}

.pdfed-note-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

.pdfed-note-actions button {
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.75rem;
    cursor: pointer;
}

.pdfed-note-save {
    background: var(--color-primary);
    color: white;
}

.pdfed-note-cancel {
    background: #eef1f6;
    color: var(--text-main);
}

/* Thumbnail strip: manage pages */
.pdfed-strip-card {
    position: relative;
}

.pdfed-strip-card.dragging {
    opacity: 0.45;
}

.pdfed-strip-card.drag-over {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
}

.pdfed-thumb {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
}

.pdfed-thumb img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    border-radius: 4px;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    user-select: none;
    transform: translate(-50%, -50%);
}

.pdfed-strip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 2px;
}

.pdfed-strip-actions {
    display: flex;
    gap: 4px;
}

.pdfed-strip-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 5px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.pdfed-strip-btn:hover {
    background: rgba(37, 99, 235, 0.5);
    color: white;
}

.pdfed-strip-btn-danger:hover {
    background: rgba(239, 68, 68, 0.6);
}

/* Signature modal */
.pdfed-sign-content {
    max-width: 660px;
    width: 92%;
}

.pdfed-sign-tabs {
    display: flex;
    gap: 8px;
    padding: 0 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.pdfed-sign-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.pdfed-sign-tab:hover {
    color: var(--color-primary, #2563eb);
}

.pdfed-sign-tab.active {
    color: var(--color-primary, #2563eb);
    border-bottom-color: var(--color-primary, #2563eb);
    font-weight: 600;
}

.pdfed-sign-panel {
    display: flex;
    flex-direction: column;
}

.pdfed-sign-canvas {
    width: 100%;
    height: auto;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    background: #fafbff;
    cursor: crosshair;
    touch-action: none;
    display: block;
}

.pdfed-sign-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

/* Upload Signature Dropzone */
.pdfed-sign-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 2.2rem 1.5rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.pdfed-sign-dropzone:hover {
    border-color: var(--color-primary, #2563eb);
    background: #eff6ff;
}

.pdfed-sign-dropzone.is-dragover {
    border-color: #2563eb;
    background: #dbeafe;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.pdfed-sign-dropzone-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary, #2563eb);
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

.pdfed-sign-dropzone-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.35rem;
}

.pdfed-sign-dropzone-desc {
    font-size: 0.78rem;
    color: #64748b;
}

/* Uploaded Image Preview */
.pdfed-sign-preview-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pdfed-sign-preview-box {
    width: 100%;
    height: 180px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    /* Transparent checkerboard pattern */
    background-color: #ffffff;
    background-image: 
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
        linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    overflow: hidden;
}

.pdfed-sign-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.pdfed-sign-preview-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.25rem;
}

.pdfed-sign-file-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pdfed-sign-filename {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.pdfed-sign-dim {
    font-size: 0.75rem;
    color: #64748b;
}

/* Responsive tweaks */
@media (max-width: 860px) {
    .pdfed-toolbar .btn-toolbar span {
        display: none;
    }

    .pdfed-search-input {
        width: 90px;
    }

    .pdfed-zoom-group {
        margin-left: 0;
    }
}

/* Preview canvas (pdf.js client-side rendering) */
.pdfed-preview-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: white;
}

.pdfed-thumb canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    border-radius: 4px;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

/* ==========================================================================
   Protect PDF Component Styles
   ========================================================================== */
.protect-form-container {
    max-width: 540px;
    margin: 1.5rem auto 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
    padding: 0.75rem 2.75rem 0.75rem 0.9rem;
    font-size: 0.95rem;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.password-input-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    background: #ffffff;
}

.btn-toggle-password {
    position: absolute;
    right: 0.6rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem;
    color: var(--text-muted);
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s ease;
}

.btn-toggle-password:hover {
    background: rgba(0, 0, 0, 0.05);
}

.password-strength-meter {
    height: 4px;
    width: 100%;
    background: #e2e8f0;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}

.strength-bar-fill {
    height: 100%;
    width: 0%;
    transition: width 0.25s ease, background-color 0.25s ease;
}

.strength-text {
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 4px;
    display: block;
}

.error-message-text {
    font-size: 0.8rem;
    color: var(--color-danger);
    font-weight: 500;
    margin-top: 4px;
    display: block;
}


/* ═══════════════════════════════════════════════════════════════════
   Mail Merge PDF — Komponen UI & Styling
   ═══════════════════════════════════════════════════════════════════ */

.badge-new {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #ffffff;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 999px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 6px;
}

.steps-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    background: #f1f5f9;
    padding: 8px 12px;
    border-radius: 12px;
    overflow-x: auto;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}

.step-item.active {
    color: var(--color-primary);
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #cbd5e1;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
}

.step-item.active .step-num {
    background: var(--color-primary);
}

.mm-step-box {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.step-box-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.step-box-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0 0 4px 0;
}

.step-box-header .subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.mm-interactive-area {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

@media (max-width: 900px) {
    .mm-interactive-area {
        grid-template-columns: 1fr;
    }
}

.pdf-canvas-wrapper {
    position: relative;
    border: 1px solid var(--stitch-border, #e2e8f0);
    border-radius: 12px;
    overflow: auto;
    background: var(--stitch-canvas-bg, #f1f5f9);
    min-height: 480px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem;
}

.pdf-canvas-inner {
    position: relative;
    display: inline-block;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
    border-radius: 4px;
    background: #ffffff;
    line-height: 0;
    margin: 0 auto;
}

.canvas-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--color-primary);
    font-weight: 600;
}

#pdf-render-canvas {
    display: block;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.text-overlay-layer {
    position: absolute;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: auto;
    margin: 0;
    padding: 0;
    line-height: normal;
}

.overlay-span {
    position: absolute;
    cursor: pointer;
    background: rgba(37, 99, 235, 0.08);
    border: 1.5px dashed rgba(37, 99, 235, 0.6);
    border-radius: 3px;
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.overlay-span:hover {
    background: rgba(37, 99, 235, 0.25);
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.overlay-span.selected-field {
    background: rgba(22, 163, 74, 0.25) !important;
    border: 2px solid #16a34a !important;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.25) !important;
}

.mm-step-box {
    background: #ffffff;
    border: 1px solid var(--stitch-border, #e2e8f0);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--stitch-shadow-paper, 0 4px 20px rgba(15, 23, 42, 0.06));
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    scroll-margin-top: 1rem;
}

.mm-fields-sidebar {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.mm-fields-sidebar h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    color: var(--text-heading);
}

.sidebar-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.fields-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 500px;
}

.field-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.field-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.field-name-input {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary);
    padding: 3px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: 100%;
}

.field-item-preview {
    font-size: 0.76rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-remove-field {
    background: none;
    border: none;
    color: var(--color-danger, #ef4444);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 4px;
}

.field-font-config {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-font-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-font-select {
    font-size: 0.8rem;
    padding: 5px 8px;
    border: 1px solid var(--stitch-border, #cbd5e1);
    border-radius: 6px;
    background: #ffffff;
    flex: 1;
    color: #1e293b;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.field-font-select:focus {
    border-color: var(--stitch-primary, #2563eb);
    outline: none;
}

.field-font-select optgroup {
    font-weight: 700;
    color: #0f172a;
    background: #f8fafc;
    padding: 4px 0;
}

.field-font-select option {
    font-weight: 400;
    color: #334155;
    background: #ffffff;
    padding: 4px 6px;
}

.field-font-size-input {
    width: 55px;
    font-size: 0.78rem;
    padding: 3px 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}

.field-font-color-picker {
    width: 28px;
    height: 26px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.btn-style-toggle {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #f8fafc;
    cursor: pointer;
    color: #475569;
    font-weight: 600;
    transition: all 0.15s ease;
}

.btn-style-toggle.active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

.modal-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    overflow: hidden;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
}

.paste-textarea {
    width: 100%;
    padding: 12px;
    font-family: monospace, sans-serif;
    font-size: 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    resize: vertical;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.paste-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}


.btn-remove-field:hover {
    background: rgba(220, 38, 38, 0.1);
}

.data-input-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.tab-btn.active {
    background: var(--color-primary);
    color: #ffffff;
}

.csv-drop-area {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    background: #f8fafc;
    transition: border-color 0.2s ease;
}

.csv-drop-area.dragover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.04);
}

.csv-status {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #16a34a;
}

.web-grid-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.grid-help {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: auto;
}

.web-grid-wrapper {
    overflow-x: auto;
    max-height: 350px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.web-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.web-data-table th, .web-data-table td {
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    text-align: left;
}

.web-data-table th {
    background: #f1f5f9;
    font-weight: 700;
    color: var(--text-heading);
}

.web-data-table td input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 0.85rem;
    padding: 2px;
}

.web-data-table td input:focus {
    outline: 2px solid var(--color-primary);
    background: #ffffff;
    border-radius: 2px;
}

.output-format-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 600px) {
    .output-format-selector {
        grid-template-columns: 1fr;
    }
}

.format-option {
    cursor: pointer;
}

.format-option input {
    display: none;
}

.format-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.format-option input:checked + .format-card {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.03);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.format-card svg {
    color: var(--color-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.format-card strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-heading);
    margin-bottom: 2px;
}

.format-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}


/* ═══════════════════════════════════════════════════════════════════
   PDF Editor v2 — Upgraded Edit Experience
   Document-centered editor with compact toolbar, contextual property
   bar, collapsible sidebar, and improved selection visuals.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Status Bar ────────────────────────────────────────────────── */

.pdfed-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 0.5rem;
    gap: 0.75rem;
    flex-shrink: 0;
}

.pdfed-status-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.pdfed-status-filename {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.pdfed-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-dim);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.pdfed-status-badge svg {
    color: var(--color-success);
    flex-shrink: 0;
}

.pdfed-status-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pdfed-status-zoom {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pdfed-status-zoom-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.pdfed-status-zoom-btn:hover {
    background: rgba(19, 123, 236, 0.08);
    color: var(--color-primary);
}

.pdfed-status-zoom-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    min-width: 42px;
    text-align: center;
}

.pdfed-status-page-indicator {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(19, 123, 236, 0.08);
    border-radius: 6px;
    padding: 0.25rem 0.65rem;
    white-space: nowrap;
}


/* ── Unified Editor Topbar Integrations ────────────────────────── */

#panel-editpdf .pdfed-app-topbar {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1000 !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    background: var(--stitch-surface, #ffffff);
    border-bottom: 1px solid var(--stitch-border, #e2e8f0);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

#panel-editpdf .stitch-topbar-row-1 {
    min-height: 52px;
    padding: 0.4rem 1rem;
    background: #ffffff;
    border-bottom: 1px solid var(--stitch-border, #e2e8f0);
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0 !important;
    width: 100%;
    box-sizing: border-box;
}

#panel-editpdf .stitch-topbar-row-2 {
    min-height: 48px;
    padding: 0.35rem 1rem;
    background: #fafbfc;
    border-bottom: 1px solid var(--stitch-border, #e2e8f0);
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    overflow: visible !important;
    flex-shrink: 0 !important;
    width: 100%;
    box-sizing: border-box;
}

#panel-editpdf .stitch-topbar-row-3 {
    min-height: 42px;
    padding: 0.3rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--stitch-border, #e2e8f0);
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    overflow: visible !important;
    flex-shrink: 0 !important;
    width: 100%;
    box-sizing: border-box;
}


/* ── Collapsible Sidebar ───────────────────────────────────────── */

#panel-editpdf .editpdf-workspace {
    background: var(--bg-dim);
    border-radius: 12px;
    overflow: hidden;
}

#panel-editpdf .editpdf-page-strip {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    width: 190px;
    padding: 0.5rem;
    transition: width 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

#panel-editpdf .editpdf-page-strip.collapsed {
    width: 0;
    padding: 0;
    border-right: none;
    opacity: 0;
    pointer-events: none;
}

#panel-editpdf .editpdf-strip-card {
    background: var(--bg-dim);
    border: 2px solid transparent;
    border-radius: 8px;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

#panel-editpdf .editpdf-strip-card:hover {
    background: var(--bg-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transform: none;
}

#panel-editpdf .editpdf-strip-card.active {
    border-color: var(--color-primary);
    background: rgba(19, 123, 236, 0.06);
    box-shadow: 0 2px 8px rgba(19, 123, 236, 0.12);
}

#panel-editpdf .editpdf-strip-card img,
#panel-editpdf .editpdf-strip-card canvas {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

#panel-editpdf .editpdf-strip-page-num {
    color: var(--text-muted);
}

#panel-editpdf .editpdf-strip-card.active .editpdf-strip-page-num {
    color: var(--color-primary);
}

#panel-editpdf .pdfed-strip-btn {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-muted);
}

#panel-editpdf .pdfed-strip-btn:hover {
    background: rgba(19, 123, 236, 0.12);
    color: var(--color-primary);
}

#panel-editpdf .pdfed-strip-btn-danger:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-danger);
}

.pdfed-sidebar-toggle {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 25;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: background 0.15s ease, color 0.15s ease;
}

.pdfed-sidebar-toggle:hover {
    background: rgba(19, 123, 236, 0.08);
    color: var(--color-primary);
}

#panel-editpdf .editpdf-canvas-area {
    background: #eef2f8;
    position: relative;
    padding: 2rem;
}


/* ── Floating Contextual Property Bar ──────────────────────────── */

.pdfed-context-bar {
    position: absolute;
    z-index: 50;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
    pointer-events: auto;
    animation: ctxBarFadeIn 0.18s ease;
    max-width: 520px;
}

.pdfed-context-bar.is-visible {
    display: flex;
}

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

.pdfed-ctx-font {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-dim);
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: background 0.15s ease;
    min-width: 0;
}

.pdfed-ctx-font:hover {
    background: var(--bg-primary);
}

.pdfed-ctx-font select {
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 0;
    min-width: 70px;
    max-width: 100px;
}

.pdfed-ctx-font select:focus {
    outline: none;
}

.pdfed-ctx-font svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.pdfed-ctx-size {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-dim);
    padding: 3px 6px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.pdfed-ctx-size-btn {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    transition: background 0.12s ease, color 0.12s ease;
}

.pdfed-ctx-size-btn:hover {
    background: rgba(19, 123, 236, 0.1);
    color: var(--color-primary);
}

.pdfed-ctx-size-val {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    min-width: 24px;
    text-align: center;
}

.pdfed-ctx-divider {
    width: 1px;
    height: 22px;
    background: rgba(0, 0, 0, 0.08);
    margin: 0 2px;
    flex-shrink: 0;
}

.pdfed-ctx-color-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.12s ease;
    position: relative;
}

.pdfed-ctx-color-btn:hover {
    background: var(--bg-dim);
}

.pdfed-ctx-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pdfed-ctx-color-btn input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.pdfed-ctx-align,
.pdfed-ctx-align-group {
    display: flex;
    align-items: center;
    background: var(--bg-dim);
    border-radius: 8px;
    padding: 2px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    gap: 1px;
}

.pdfed-ctx-align-btn {
    width: 28px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.pdfed-ctx-align-btn:hover {
    color: var(--text-main);
}

.pdfed-ctx-align-btn.active {
    background: var(--bg-surface);
    color: var(--color-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.pdfed-ctx-style-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.12s ease, color 0.12s ease;
}

.pdfed-ctx-style-btn:hover {
    background: var(--bg-dim);
    color: var(--text-main);
}

.pdfed-ctx-style-btn.active {
    background: rgba(19, 123, 236, 0.1);
    color: var(--color-primary);
    border-color: rgba(19, 123, 236, 0.2);
}

.pdfed-ctx-more-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.12s ease;
}

.pdfed-ctx-more-btn:hover {
    background: var(--bg-dim);
}


/* ── Enhanced Selection Visuals ────────────────────────────────── */

#panel-editpdf .pdfed-sel-box {
    border: 2px solid var(--color-primary);
    border-style: solid;
    background: rgba(19, 123, 236, 0.04);
    border-radius: 2px;
}

#panel-editpdf .pdfed-obj.is-selected {
    border: 2px solid var(--color-primary);
    border-style: solid;
    background: rgba(19, 123, 236, 0.04);
    box-shadow: 0 0 0 3px rgba(19, 123, 236, 0.12);
    border-radius: 2px;
}

#panel-editpdf .pdfed-obj-text.is-selected {
    background: transparent !important;
    border: 1.5px solid var(--color-primary);
    box-shadow: 0 0 0 3px rgba(19, 123, 236, 0.15);
}

.pdfed-corner-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border: 1.5px solid white;
    border-radius: 50%;
    z-index: 42;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.pdfed-corner-handle.tl { top: -5px; left: -5px; cursor: nwse-resize; }
.pdfed-corner-handle.tr { top: -5px; right: -5px; cursor: nesw-resize; }
.pdfed-corner-handle.bl { bottom: -5px; left: -5px; cursor: nesw-resize; }
.pdfed-corner-handle.br { bottom: -5px; right: -5px; cursor: nwse-resize; }

.pdfed-drag-handle {
    position: absolute;
    top: -14px;
    left: -14px;
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    border: 2px solid white;
    border-radius: 50%;
    z-index: 43;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

.pdfed-drag-handle svg {
    width: 14px;
    height: 14px;
    color: white;
}

#panel-editpdf .pdfed-resize-handle {
    width: 10px;
    height: 10px;
    right: -5px;
    bottom: -5px;
    border-width: 1.5px;
}


/* ── Mobile Responsive (≤ 768px) ───────────────────────────────── */

@media (max-width: 768px) {
    .pdfed-status-bar {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.4rem 0.75rem;
    }

    .pdfed-status-filename {
        max-width: 160px;
        font-size: 0.8rem;
    }

    #panel-editpdf .editpdf-page-strip {
        width: 0;
        padding: 0;
        border-right: none;
        opacity: 0;
        pointer-events: none;
        position: absolute;
        z-index: 30;
        top: 0;
        left: 0;
        height: 100%;
        background: var(--bg-surface);
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.08);
    }

    #panel-editpdf .editpdf-page-strip.mobile-open {
        width: 170px;
        padding: 0.5rem;
        border-right: 1px solid var(--border-color);
        opacity: 1;
        pointer-events: auto;
    }

    .pdfed-context-bar {
        position: fixed;
        bottom: 12px;
        left: 12px;
        right: 12px;
        top: auto;
        border-radius: 14px;
        max-width: none;
        justify-content: center;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
    }

    #panel-editpdf .pdfed-toolbar .btn-toolbar span {
        display: none;
    }

    #panel-editpdf .editpdf-canvas-area {
        padding: 1rem 0.5rem;
    }
}

@media (max-width: 1024px) {
    #panel-editpdf .editpdf-page-strip:not(.collapsed) {
        width: 150px;
    }

    .pdfed-context-bar {
        gap: 4px;
        padding: 5px 6px;
    }

    .pdfed-ctx-font select {
        max-width: 80px;
    }
}


/* ═══════════════════════════════════════════════════════════════════
   PDF Editor — Fullscreen Desktop Application Mode (Smallpdf Style)
/* ═══════════════════════════════════════════════════════════════════
   STITCH UNIFIED FULL-SCREEN STUDIO ENGINE (ALL TOOLS)
   Fixed 100vw x 100vh immersive workspace — No header, No footer
   ═══════════════════════════════════════════════════════════════════ */

body.stitch-studio-active,
body.has-active-workspace,
body.pdfed-fullscreen-active {
    overflow: hidden !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--stitch-canvas-bg, #f1f5f9) !important;
}

body.stitch-studio-active header.navbar,
body.stitch-studio-active footer.footer,
body.stitch-studio-active #view-workspace > .btn-back,
body.stitch-studio-active #view-workspace > .workspace-header,
body.stitch-studio-active #view-workspace > .security-banner,
body.stitch-studio-active #drop-zone,
body.stitch-studio-active #compress-mode-toggle,
body.stitch-studio-active .compress-mode-toggle,
body.stitch-studio-active .cookie-banner,
body.has-active-workspace header.navbar,
body.has-active-workspace footer.footer,
body.has-active-workspace #view-workspace > .btn-back,
body.has-active-workspace #view-workspace > .workspace-header,
body.has-active-workspace #view-workspace > .security-banner,
body.has-active-workspace #drop-zone,
body.has-active-workspace #compress-mode-toggle,
body.has-active-workspace .compress-mode-toggle,
body.has-active-workspace .cookie-banner,
body.pdfed-fullscreen-active header.navbar,
body.pdfed-fullscreen-active footer.footer,
body.pdfed-fullscreen-active #view-workspace > .btn-back,
body.pdfed-fullscreen-active #view-workspace > .workspace-header,
body.pdfed-fullscreen-active #view-workspace > .security-banner,
body.pdfed-fullscreen-active #drop-zone,
body.pdfed-fullscreen-active #compress-mode-toggle,
body.pdfed-fullscreen-active .compress-mode-toggle,
body.pdfed-fullscreen-active .cookie-banner {
    display: none !important;
}

body.stitch-studio-active main.main-content,
body.has-active-workspace main.main-content,
body.pdfed-fullscreen-active main.main-content {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    z-index: 100 !important;
}

body.stitch-studio-active #view-workspace,
body.has-active-workspace #view-workspace,
body.pdfed-fullscreen-active #view-workspace {
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

body.stitch-studio-active .editor-container,
body.stitch-studio-active #editor-area,
body.has-active-workspace .editor-container,
body.has-active-workspace #editor-area,
body.pdfed-fullscreen-active .editor-container,
body.pdfed-fullscreen-active #editor-area {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
}

body.stitch-studio-active .tool-panel,
body.has-active-workspace .tool-panel,
body.pdfed-fullscreen-active .tool-panel {
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

body.stitch-studio-active .stitch-topbar,
body.has-active-workspace .stitch-topbar,
body.pdfed-fullscreen-active .stitch-topbar {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1000 !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    background: var(--stitch-surface, #ffffff) !important;
    border-bottom: 1px solid var(--stitch-border, #e2e8f0) !important;
    border-radius: 0 !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

body.stitch-studio-active .stitch-canvas-viewport,
body.has-active-workspace .stitch-canvas-viewport,
body.pdfed-fullscreen-active .stitch-canvas-viewport {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100vw !important;
    overflow: auto !important;
    background: var(--stitch-canvas-bg, #f1f5f9) !important;
    padding: 1.5rem 1.5rem !important;
    margin: 0 !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    box-sizing: border-box !important;
}

/* Studio Action Overlay Modal */
body.stitch-studio-active #action-section,
body.has-active-workspace #action-section,
body.pdfed-fullscreen-active #action-section {
    display: none;
}

body.stitch-studio-active #action-section.active-overlay,
body.has-active-workspace #action-section.active-overlay,
body.pdfed-fullscreen-active #action-section.active-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: rgba(15, 23, 42, 0.5) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 1.5rem !important;
    border: none !important;
    box-shadow: none !important;
}

body.stitch-studio-active #action-section #btn-execute-process,
body.has-active-workspace #action-section #btn-execute-process,
body.pdfed-fullscreen-active #action-section #btn-execute-process {
    display: none !important;
}

body.stitch-studio-active #action-section .process-loading,
body.has-active-workspace #action-section .process-loading,
body.pdfed-fullscreen-active #action-section .process-loading {
    background: #ffffff;
    border-radius: 16px;
    padding: 2.25rem 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--stitch-border, #e2e8f0);
    min-width: 320px;
    max-width: 440px;
    flex-direction: column;
    align-items: center;
}

body.stitch-studio-active #action-section .download-box,
body.has-active-workspace #action-section .download-box,
body.pdfed-fullscreen-active #action-section .download-box {
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--stitch-border, #e2e8f0);
    min-width: 320px;
    max-width: 480px;
    text-align: center;
}

/* Exit Button in Topbar */
.btn-exit-studio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.38rem 0.75rem;
    border: 1px solid var(--stitch-border, #e2e8f0);
    border-radius: 8px;
    background: var(--stitch-surface-soft, #f8fafc);
    color: var(--stitch-text-dark, #1e293b);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-exit-studio:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: var(--color-danger, #dc2626);
}

.btn-exit-studio svg {
    flex-shrink: 0;
}

/* ── Fullscreen App Top Bar ────────────────────────────────────── */

.pdfed-app-topbar {
    position: sticky !important;
    top: 0 !important;
    height: auto !important;
    min-height: auto !important;
    background: var(--stitch-surface, #ffffff);
    border-bottom: 1px solid var(--stitch-border, #e2e8f0);
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    gap: 0;
    flex-shrink: 0;
    z-index: 1000 !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.pdfed-top-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 200px;
}

.pdfed-btn-exit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.38rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-dim);
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pdfed-btn-exit:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: var(--color-danger);
}

.pdfed-doc-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 220px;
}

.pdfed-doc-info .pdfed-status-filename {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdfed-top-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.pdfed-app-topbar .pdfed-toolbar {
    margin-bottom: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.4rem 1.25rem !important;
    background: #fafbfc !important;
}

.pdfed-top-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 240px;
    justify-content: flex-end;
}

.pdfed-btn-export-top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 1.15rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(19, 123, 236, 0.28);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pdfed-btn-export-top:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(19, 123, 236, 0.35);
}

/* ── Fullscreen Workspace Layout ───────────────────────────────── */

body.pdfed-fullscreen-active .editpdf-workspace {
    flex: 1 1 0% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    width: 100vw !important;
    display: flex !important;
    overflow: hidden !important;
    border-radius: 0 !important;
    background: var(--stitch-canvas-bg, #f1f5f9) !important;
    border: none !important;
}

body.pdfed-fullscreen-active .editpdf-page-strip {
    height: 100% !important;
    max-height: 100% !important;
    width: 200px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: var(--stitch-sidebar-bg, #ffffff) !important;
    border-right: 1px solid var(--stitch-border, #e2e8f0) !important;
    padding: 0.75rem 0.5rem !important;
    flex-shrink: 0;
}

body.pdfed-fullscreen-active .editpdf-page-strip.collapsed {
    width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    opacity: 0;
    pointer-events: none;
}

body.pdfed-fullscreen-active .editpdf-canvas-area {
    flex: 1 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: auto !important;
    background: var(--stitch-canvas-bg, #f1f5f9) !important;
    padding: 2.5rem 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    position: relative !important;
}

/* ── Responsive Fullscreen Topbar ──────────────────────────────── */

@media (max-width: 960px) {
    .pdfed-top-left {
        min-width: auto;
    }
    .pdfed-top-right {
        min-width: auto;
        gap: 0.5rem;
    }
    .pdfed-doc-info {
        max-width: 130px;
    }
    .pdfed-status-page-indicator {
        display: none !important;
    }
    .pdfed-btn-export-top span {
        display: none;
    }
    .pdfed-btn-export-top {
        padding: 0.45rem 0.7rem;
    }
}

@media (max-width: 640px) {
    .pdfed-top-left {
        order: 1;
    }
    .pdfed-top-right {
        order: 2;
    }
    .pdfed-top-center {
        order: 3;
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 2px;
    }
}

/* ==========================================================================
   STITCH UNIFIED WORKSPACE DESIGN SYSTEM (hazPDF Design Web V1)
   ========================================================================== */

:root {
    --stitch-canvas-bg: #f1f5f9;
    --stitch-sidebar-bg: #ffffff;
    --stitch-surface: #ffffff;
    --stitch-surface-soft: #f8fafc;
    --stitch-surface-dim: #eceef0;
    --stitch-border: #e2e8f0;
    --stitch-border-subtle: #cbd5e1;
    --stitch-text-dark: #0f172a;
    --stitch-text-muted: #64748b;
    --stitch-blue-primary: #1e3a8a;
    --stitch-blue-hover: #172554;
    --stitch-blue-accent: #3b82f6;
    --stitch-blue-tint: rgba(59, 130, 246, 0.08);
    --stitch-grad-btn: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    --stitch-shadow-paper: 0 4px 20px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.04);
    --stitch-shadow-popover: 0 12px 36px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
    --stitch-ring-glow: 0 0 0 2px rgba(59, 130, 246, 0.6), 0 0 10px rgba(59, 130, 246, 0.2);
}

/* ── Fullscreen Studio Frame ───────────────────────────────────── */
.stitch-studio-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--stitch-canvas-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

/* ── Full Width Studio Workspace Helpers ────────────────────────── */
.editor-container {
    width: 100% !important;
    max-width: 100% !important;
}

body.has-active-workspace .main-content.container,
.main-content.container:has(.editor-container:not([style*="display: none"])),
.main-content.container:has(#editor-area:not([style*="display: none"])) {
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    width: 100% !important;
}

/* ── Unified Multi-Row Topbar ──────────────────────────────────── */
.stitch-topbar {
    background-color: var(--stitch-surface);
    border-bottom: 1px solid var(--stitch-border);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 110;
}

.stitch-topbar-row-1 {
    min-height: 54px;
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    gap: 1rem;
    flex-wrap: wrap;
}

.stitch-topbar-row-2 {
    min-height: 48px;
    padding: 0.4rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fafbfc;
    gap: 0.75rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.stitch-topbar-row-3 {
    min-height: 44px;
    padding: 0.35rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #f1f4f9;
    border-top: 1px solid var(--stitch-border);
    font-size: 0.85rem;
    overflow-x: auto;
}

/* ── Branding & Action Components in Topbar ────────────────────── */
.stitch-doc-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--stitch-text-dark);
}

.stitch-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(30, 58, 138, 0.08);
    color: var(--stitch-blue-primary);
    border: 1px solid rgba(59, 130, 246, 0.18);
    font-family: var(--font-mono);
}

.stitch-pill-badge.success {
    background: rgba(22, 163, 74, 0.1);
    color: #15803d;
    border-color: rgba(22, 163, 74, 0.2);
}

.stitch-pill-badge.amber {
    background: rgba(217, 119, 6, 0.1);
    color: #b45309;
    border-color: rgba(217, 119, 6, 0.25);
}

.stitch-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0.5rem 1.25rem;
    background: var(--stitch-grad-btn);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(30, 58, 138, 0.28);
    transition: all 0.15s ease;
    white-space: nowrap;
    user-select: none;
}

.stitch-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(30, 58, 138, 0.38);
    filter: brightness(1.05);
}

.stitch-btn-primary:active {
    transform: translateY(0);
}

.stitch-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 0.9rem;
    background: var(--stitch-surface);
    color: var(--stitch-text-dark);
    border: 1px solid var(--stitch-border);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.stitch-btn-secondary:hover {
    background: var(--stitch-surface-soft);
    border-color: var(--stitch-blue-accent);
    color: var(--stitch-blue-primary);
}

/* ── Tool Buttons (Icon 20px + Label 11px) ─────────────────────── */
.stitch-tool-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stitch-tool-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 42px;
    padding: 2px 8px;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.stitch-tool-btn svg {
    width: 18px;
    height: 18px;
}

.stitch-tool-btn span {
    font-size: 10px;
    font-weight: 600;
    margin-top: 1px;
    line-height: 1;
}

.stitch-tool-btn:hover {
    background: var(--stitch-blue-tint);
    color: var(--stitch-blue-primary);
    border-color: rgba(59, 130, 246, 0.2);
}

.stitch-tool-btn.active {
    background: var(--stitch-blue-primary) !important;
    color: #ffffff !important;
    border-color: var(--stitch-blue-primary) !important;
    box-shadow: var(--stitch-ring-glow);
}

.stitch-tool-btn.active svg,
.stitch-tool-btn.active span {
    color: #ffffff !important;
}

.stitch-divider-vert {
    width: 1px;
    height: 24px;
    background-color: var(--stitch-border);
    margin: 0 4px;
    flex-shrink: 0;
}

/* ── Segmented Control Pills ───────────────────────────────────── */
.stitch-segmented {
    display: inline-flex;
    align-items: center;
    background: var(--stitch-surface-dim);
    padding: 3px;
    border-radius: 9999px;
    border: 1px solid var(--stitch-border);
}

.stitch-segmented-item {
    padding: 0.3rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--stitch-text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.stitch-segmented-item:hover {
    color: var(--stitch-text-dark);
}

.stitch-segmented-item.active {
    background: var(--stitch-surface);
    color: var(--stitch-blue-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    font-weight: 700;
}

/* ── Multi-Panel Workspace Studio Body ─────────────────────────── */
.stitch-workspace-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Left Sidebar (Clean Soft Slate #ffffff / #f8fafc) */
.stitch-sidebar-dark,
.stitch-sidebar-light {
    width: 200px;
    background-color: var(--stitch-sidebar-bg);
    border-right: 1px solid var(--stitch-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    padding: 1rem 0.6rem;
    gap: 0.75rem;
}

.stitch-thumb-card {
    background: #ffffff;
    border: 2px solid var(--stitch-border);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stitch-thumb-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background: #f8fafc;
}

.stitch-thumb-card.active {
    border-color: var(--stitch-blue-accent);
    background: #eff6ff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.stitch-thumb-paper {
    width: 100%;
    aspect-ratio: 1 / 1.414;
    background: #ffffff;
    border-radius: 4px;
    border: 1px solid var(--stitch-border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.stitch-thumb-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--stitch-text-dark);
    font-family: var(--font-mono);
}

.stitch-thumb-card.active .stitch-thumb-label {
    color: var(--stitch-blue-primary);
    font-weight: 700;
}

/* Center Document Canvas Area (Bright Airy Slate Studio) */
.stitch-canvas-viewport {
    flex: 1;
    background-color: var(--stitch-canvas-bg);
    border: 1px solid var(--stitch-border);
    border-top: none;
    border-radius: 0 0 12px 12px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem 1.25rem;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.stitch-pdf-paper {
    background-color: #ffffff;
    border-radius: 6px;
    border: 1px solid var(--stitch-border);
    box-shadow: var(--stitch-shadow-paper);
    position: relative;
    max-width: 100%;
    margin-bottom: 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Right Contextual Inspector Sidebar */
.stitch-inspector-panel {
    width: 340px;
    background-color: var(--stitch-surface);
    border-left: 1px solid var(--stitch-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    padding: 1.25rem;
    gap: 1.25rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.03);
}

.stitch-inspector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--stitch-border);
}

.stitch-inspector-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--stitch-text-dark);
}

/* ── Interactive Card Grid (Organize / Split / Image to PDF) ─────── */
.stitch-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.stitch-page-card {
    background: #ffffff;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    user-select: none;
    box-sizing: border-box;
}

.stitch-page-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.stitch-page-card.selected {
    border-color: var(--stitch-blue-accent) !important;
    box-shadow: var(--stitch-ring-glow), 0 6px 16px rgba(0, 0, 0, 0.08) !important;
    background: #f0f7ff;
}

.stitch-page-card.dimmed {
    opacity: 0.45;
    filter: grayscale(40%);
}

.stitch-page-card.dragging {
    opacity: 0.75;
    transform: rotate(2deg) scale(1.02);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.stitch-card-dropzone-placeholder {
    border: 2px dashed #3b82f6;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    color: #2563eb;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
}

/* ── Split Comparison Slider (Compress PDF) ────────────────────── */
.stitch-split-slider-container {
    position: relative;
    width: 820px;
    max-width: 100%;
    aspect-ratio: 1 / 1.35;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: var(--stitch-shadow-paper);
    border: 1px solid var(--stitch-border);
    overflow: hidden;
    user-select: none;
}

.stitch-split-slider-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--stitch-blue-accent);
    cursor: ew-resize;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
    z-index: 20;
}

.stitch-split-slider-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38px;
    height: 38px;
    background: #ffffff;
    border: 2px solid var(--stitch-blue-accent);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--stitch-blue-primary);
    font-size: 14px;
}

/* ── Floating Dock Summary ─────────────────────────────────────── */
.stitch-floating-dock {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--stitch-border-subtle);
    border-radius: 9999px;
    padding: 0.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--stitch-text-dark);
    font-size: 0.84rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    z-index: 90;
    pointer-events: auto;
}

/* ── AI PDF Interactive Citations & Chips ──────────────────────── */
.stitch-citation-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    margin: 2px 0;
}

.stitch-citation-pill:hover {
    background: #1e3a8a;
    color: #ffffff;
    border-color: #1e3a8a;
}

/* ── Dynamic Watermark Preview Overlay ─────────────────────────── */
.stitch-watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.stitch-watermark-text {
    transform: rotate(-45deg);
    font-size: 3.5rem;
    font-weight: 800;
    color: rgba(220, 38, 38, 0.18);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    user-select: none;
    white-space: nowrap;
}

/* ── Responsive Adaptations ────────────────────────────────────── */
@media (max-width: 900px) {
    .stitch-workspace-body {
        flex-direction: column;
    }
    .stitch-sidebar-dark,
    .stitch-sidebar-light {
        width: 100%;
        height: 100px;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid var(--stitch-border);
        padding: 0.5rem;
    }
    .stitch-thumb-card {
        width: 65px;
        height: auto;
    }
    .stitch-inspector-panel {
        width: 100%;
        height: 240px;
        border-left: none;
        border-top: 1px solid var(--stitch-border);
    }
    .stitch-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.85rem;
    }
}

@media (max-width: 640px) {
    .stitch-topbar-row-1 {
        padding: 0.4rem 0.6rem;
        min-height: auto;
        gap: 0.5rem;
    }
    .stitch-topbar-row-2 {
        padding: 0.4rem 0.6rem;
        min-height: auto;
        gap: 0.5rem;
    }
    .stitch-topbar-row-3 {
        padding: 0.3rem 0.6rem;
        min-height: auto;
        gap: 0.4rem;
    }
    .stitch-btn-primary {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    .stitch-btn-secondary {
        padding: 0.35rem 0.65rem;
        font-size: 0.78rem;
    }
    .stitch-canvas-viewport {
        padding: 1rem 0.5rem;
        border-radius: 0 0 8px 8px;
    }
    .stitch-card-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
    }
    .stitch-page-card {
        padding: 0.5rem;
    }
    .stitch-floating-dock {
        width: 92%;
        justify-content: center;
        bottom: 0.6rem;
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
}

/* ═════════════════════════════════════════════════════════════════
   WATERMARK STUDIO FULLSCREEN MODE (Matching Edit PDF Architecture)
   ═════════════════════════════════════════════════════════════════ */

body.wm-studio-active {
    overflow: hidden !important;
    height: 100vh !important;
    width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.wm-studio-active .navbar,
body.wm-studio-active .footer,
body.wm-studio-active .btn-back,
body.wm-studio-active .workspace-header,
body.wm-studio-active #drop-zone,
body.wm-studio-active .security-banner,
body.wm-studio-active .donate-fab {
    display: none !important;
}

body.wm-studio-active .main-content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
}

.wm-studio-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--stitch-canvas-bg, #f1f5f9);
}

body.wm-studio-active .wm-studio-fullscreen {
    display: flex !important;
}


.wm-studio-topbar {
    width: 100% !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--stitch-border, #e2e8f0) !important;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05) !important;
    z-index: 1000 !important;
    flex-shrink: 0 !important;
    position: relative !important;
}

.wm-topbar-row-1 {
    min-height: 52px !important;
    padding: 0.5rem 1.25rem !important;
    background: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem !important;
    flex-shrink: 0 !important;
}

.wm-studio-workspace {
    display: flex !important;
    flex: 1 1 0% !important;
    height: calc(100vh - 53px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
    position: relative !important;
}


.wm-studio-page-strip {
    width: 200px !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #ffffff !important;
    border-right: 1px solid var(--stitch-border, #e2e8f0) !important;
    padding: 0.75rem 0.5rem !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    transition: width 0.2s ease, padding 0.2s ease !important;
}

.wm-studio-page-strip.collapsed {
    width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.wm-studio-canvas-area {
    flex: 1 !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    background: var(--stitch-canvas-bg, #f1f5f9) !important;
    padding: 2.5rem 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    position: relative !important;
}

/* Right Studio Properties Panel */
.wm-studio-sidebar-settings {
    width: 320px !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #ffffff !important;
    border-left: 1px solid var(--stitch-border, #e2e8f0) !important;
    padding: 1.25rem 1rem !important;
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1.2rem !important;
    box-shadow: -2px 0 10px rgba(15, 23, 42, 0.04) !important;
}

.wm-studio-sidebar-settings::-webkit-scrollbar {
    width: 5px;
}

.wm-studio-sidebar-settings::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.wm-panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    padding: 0.85rem;
}

.wm-panel-section[style*="display: none"] {
    display: none !important;
}

.wm-panel-title {
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 2px !important;
}

.wm-panel-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.5rem !important;
}

.wm-pos-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
}

.wm-color-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
}

.wm-sidebar-toggle {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    z-index: 50 !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #475569 !important;
    cursor: pointer !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    transition: all 0.2s ease !important;
}

.wm-sidebar-toggle:hover {
    background: #f8fafc !important;
    color: #1e3a8a !important;
    border-color: #94a3b8 !important;
}

.wm-studio-single-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    margin: 0 auto !important;
}

.wm-studio-canvas-card {
    position: relative !important;
    background: #ffffff !important;
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    border-radius: 2px !important;
    line-height: 0 !important;
    overflow: hidden !important;
    margin: 0 auto !important;
    transform-origin: top center !important;
}

#watermark-preview-canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

#watermark-overlay-canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10 !important;
    pointer-events: auto !important;
    cursor: crosshair !important;
}

.wm-studio-toolbar-group {
    display: flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    flex-shrink: 0 !important;
}

.wm-studio-divider {
    width: 1px !important;
    height: 24px !important;
    background: #e2e8f0 !important;
    margin: 0 4px !important;
    flex-shrink: 0 !important;
}

.wm-studio-tool-label {
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    white-space: nowrap !important;
}

.wm-studio-btn-primary {
    background: #1e3a8a !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    border: none !important;
    border-radius: 7px !important;
    padding: 7px 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25) !important;
    transition: all 0.15s ease !important;
    white-space: nowrap !important;
}

.wm-studio-btn-primary:hover {
    background: #1d4ed8 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.35) !important;
}

.wm-studio-btn-secondary {
    background: #f8fafc !important;
    color: #334155 !important;
    font-weight: 600 !important;
    font-size: 0.82rem !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 7px !important;
    padding: 6px 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    white-space: nowrap !important;
}

.wm-studio-btn-secondary:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
}

.wm-studio-pill-badge {
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    padding: 3px 8px !important;
    border-radius: 9999px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
}

.wm-studio-pill-badge.success {
    background: #dcfce7 !important;
    color: #15803d !important;
}

.wm-studio-segmented {
    display: inline-flex !important;
    background: #f1f5f9 !important;
    padding: 2px !important;
    border-radius: 7px !important;
    gap: 2px !important;
    border: 1px solid #e2e8f0 !important;
    width: 100% !important;
}

.wm-studio-seg-item {
    background: transparent !important;
    border: none !important;
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
    flex: 1 !important;
}

.wm-studio-seg-item:hover {
    color: #0f172a !important;
}

.wm-studio-seg-item.active {
    background: #ffffff !important;
    color: #1e3a8a !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08) !important;
}


.wm-text-field {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.82rem;
    color: #1e293b;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wm-text-field:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

/* ──────────────────────────────────────
   Page Thumbnail Cards
   ────────────────────────────────────── */
.wm-page-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wm-page-card:hover {
    border-color: #94a3b8;
}

.wm-page-card.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.wm-page-card.excluded {
    opacity: 0.5;
}

.wm-page-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wm-badge-status {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
}

.wm-badge-included {
    background: #dcfce7;
    color: #15803d;
}

.wm-badge-excluded {
    background: #fee2e2;
    color: #dc2626;
}

.wm-thumb-wrapper {
    position: relative;
    line-height: 0;
}

.wm-thumb-canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 3px;
}

.wm-thumb-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ──────────────────────────────────────
   Mobile Settings Toggle (Bottom Drawer)
   ────────────────────────────────────── */
/* ──────────────────────────────────────
   Mobile Settings Toggle (Bottom Drawer) & Drawer Header
   ────────────────────────────────────── */
.wm-mobile-settings-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100001;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #1e3a8a;
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 18px rgba(30, 58, 138, 0.4);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wm-mobile-settings-toggle:active {
    transform: scale(0.92);
}

.wm-mobile-drawer-header {
    display: none;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: -0.75rem;
    background: #ffffff;
    z-index: 10;
    margin-top: -0.25rem;
}

.wm-drawer-handle {
    width: 42px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 999px;
    margin-bottom: 0.6rem;
}

.wm-drawer-title-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wm-drawer-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.01em;
}

.wm-drawer-close-btn {
    background: #f1f5f9;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.wm-drawer-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.wm-studio-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 99998;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.wm-studio-backdrop.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ──────────────────────────────────────
   RESPONSIVE: Mobile & Tablet
   ────────────────────────────────────── */

/* Tablet: ≤ 1024px */
@media (max-width: 1024px) {
    .wm-studio-page-strip {
        width: 140px !important;
    }

    .wm-studio-sidebar-settings {
        width: 280px !important;
    }

    .wm-studio-canvas-area {
        padding: 1.5rem 1rem !important;
    }
}

/* Mobile: ≤ 768px */
@media (max-width: 768px) {
    
    .wm-studio-fullscreen {
        height: 100vh !important;
        height: 100dvh !important;
    }

    /* Topbar: stack into compact rows */
    .wm-topbar-row-1 {
        flex-wrap: wrap !important;
        min-height: auto !important;
        padding: 0.4rem 0.6rem !important;
        gap: 0.4rem !important;
        justify-content: center !important;
    }

    .wm-studio-toolbar-group {
        gap: 0.3rem !important;
    }

    /* Hide filename + badge on mobile to save space */
    #wm-current-filename,
    .wm-studio-pill-badge {
        display: none !important;
    }

    /* Compact buttons */
    .wm-studio-btn-primary span,
    .wm-studio-btn-secondary span {
        display: none !important;
    }
    .wm-studio-btn-primary {
        padding: 8px 10px !important;
    }
    .wm-studio-btn-secondary {
        padding: 6px 8px !important;
    }

    /* Hide left page strip entirely on mobile */
    .wm-studio-page-strip {
        display: none !important;
    }
    .wm-sidebar-toggle {
        display: none !important;
    }

    /* Canvas area fills full width and scrolls smoothly */
    .wm-studio-canvas-area {
        padding: 0.75rem 0.5rem 5rem 0.5rem !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .wm-studio-single-container {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .wm-studio-canvas-card {
        max-width: 100% !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
    }

    .wm-mobile-drawer-header {
        display: flex !important;
    }

    /* Right sidebar: modern bottom sheet style */
    .wm-studio-sidebar-settings {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 78vh !important;
        height: 78dvh !important;
        max-height: 82vh !important;
        max-height: 82dvh !important;
        border-left: none !important;
        border-top: 1px solid #cbd5e1 !important;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.22) !important;
        z-index: 100000 !important;
        transform: translateY(100%) !important;
        transition: transform 0.3s cubic-bezier(0.33, 1, 0.68, 1) !important;
        padding: 0.75rem 1rem calc(2rem + env(safe-area-inset-bottom, 16px)) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    .wm-studio-sidebar-settings.mobile-open {
        transform: translateY(0) !important;
    }

    /* Show mobile FAB toggle */
    .wm-mobile-settings-toggle {
        display: flex !important;
    }

    /* Workspace takes full width on mobile */
    .wm-studio-workspace {
        flex: 1 1 0% !important;
        height: calc(100vh - 54px) !important;
        height: calc(100dvh - 54px) !important;
        min-height: 0 !important;
    }

    /* Segmented controls: smaller touch targets */
    .wm-studio-seg-item {
        padding: 5px 8px !important;
        font-size: 0.76rem !important;
    }

    /* Panel sections: tighter spacing */
    .wm-panel-section {
        padding: 0.65rem !important;
        gap: 0.35rem !important;
    }

    /* Position grid: 2 columns on small screens */
    .wm-pos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Small phone: ≤ 480px */
@media (max-width: 480px) {
    .wm-topbar-row-1 {
        padding: 0.3rem 0.4rem !important;
    }

    .wm-studio-canvas-area {
        padding: 0.5rem 0.25rem 5rem 0.25rem !important;
    }

    .wm-studio-sidebar-settings {
        height: 82vh !important;
        height: 82dvh !important;
        max-height: 85vh !important;
        max-height: 85dvh !important;
    }

    .wm-color-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}


