/* ═══════════════════════════════════════════════════════════════
   BULK PDF SIGNER PRO — Enterprise Design System
   Premium dark navy + blue glassmorphism theme
   ═══════════════════════════════════════════════════════════════ */

/* ──────── CSS Variables & Theme ──────── */
:root {
    /* Colors */
    --navy-950: #030712;
    --navy-900: #0A1628;
    --navy-800: #0F1D32;
    --navy-700: #162340;
    --navy-600: #1E3055;
    --navy-500: #2A4068;
    --navy-400: #3D5A80;
    --navy-300: #5B7BA5;
    --navy-200: #8BA4C4;
    --navy-100: #B8CCE0;
    --navy-50: #E2EAF4;
    
    --blue-600: #2563EB;
    --blue-500: #3B82F6;
    --blue-400: #60A5FA;
    --blue-300: #93C5FD;
    
    --purple-500: #8B5CF6;
    --purple-400: #A78BFA;
    
    --cyan-500: #06B6D4;
    --green-500: #10B981;
    --green-400: #34D399;
    --red-500: #EF4444;
    --amber-500: #F59E0B;
    
    /* Theme tokens (dark default) */
    --bg-primary: var(--navy-950);
    --bg-secondary: var(--navy-900);
    --bg-card: rgba(15, 29, 50, 0.7);
    --bg-card-solid: var(--navy-800);
    --bg-hover: rgba(30, 48, 85, 0.5);
    --bg-input: rgba(22, 35, 64, 0.8);
    --bg-overlay: rgba(3, 7, 18, 0.85);
    
    --border-color: rgba(59, 130, 246, 0.12);
    --border-hover: rgba(59, 130, 246, 0.25);
    --border-active: var(--blue-500);
    
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-accent: var(--blue-400);
    
    --glass-bg: rgba(15, 29, 50, 0.65);
    --glass-border: rgba(59, 130, 246, 0.15);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    
    /* Spacing */
    --nav-height: 64px;
    --sidebar-width: 240px;
    --props-width: 340px;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-solid: #FFFFFF;
    --bg-hover: rgba(59, 130, 246, 0.06);
    --bg-input: rgba(241, 245, 249, 0.9);
    --bg-overlay: rgba(248, 250, 252, 0.9);
    
    --border-color: rgba(59, 130, 246, 0.12);
    --border-hover: rgba(59, 130, 246, 0.2);
    
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-accent: var(--blue-600);
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(59, 130, 246, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    
    --navy-950: #F8FAFC;
    --navy-900: #F1F5F9;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--navy-500);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--navy-400);
}

/* ──────── Animated Background ──────── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: 
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(37, 99, 235, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse 50% 50% at 20% 60%, rgba(6, 182, 212, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ══════════════════════════════════════════════════════
   NAVIGATION
   ══════════════════════════════════════════════════════ */
.top-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
    transition: var(--transition-base);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
    border-radius: var(--radius-md);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.brand-text {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-pro {
    background: linear-gradient(135deg, var(--blue-400), var(--purple-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--text-accent);
    background: rgba(59, 130, 246, 0.1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ══════════════════════════════════════════════════════
   STEP INDICATOR
   ══════════════════════════════════════════════════════ */
.step-indicator {
    position: fixed;
    top: var(--nav-height);
    left: 0; right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 999;
    padding: 16px 24px;
}

.step-track {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: var(--transition-base);
}

.step-item.active {
    opacity: 1;
}

.step-item.completed {
    opacity: 0.8;
}

.step-circle {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    transition: var(--transition-base);
}

.step-item.active .step-circle {
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    border-color: var(--blue-500);
    color: white;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.step-item.completed .step-circle {
    background: var(--green-500);
    border-color: var(--green-500);
    color: white;
}

.step-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    margin: 0 12px;
    max-width: 60px;
    min-width: 20px;
    border-radius: 2px;
    transition: var(--transition-base);
}

.step-connector.filled {
    background: var(--blue-500);
}

/* ══════════════════════════════════════════════════════
   APP SECTIONS
   ══════════════════════════════════════════════════════ */
.app-section {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - var(--nav-height));
    padding-top: calc(var(--nav-height) + 72px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    animation: fadeIn 0.4s ease-out;
}

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

/* ══════════════════════════════════════════════════════
   STEP 1: UPLOAD
   ══════════════════════════════════════════════════════ */
.upload-container {
    max-width: 900px;
    width: 100%;
    padding: 20px 24px 60px;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--blue-400);
    margin-bottom: 20px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 12px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--blue-400), var(--purple-400), var(--cyan-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 32px;
    line-height: 1.7;
}

/* Upload Zone */
.upload-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 4px;
    cursor: pointer;
    transition: var(--transition-base);
    background: var(--bg-card);
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.03), rgba(139, 92, 246, 0.03));
    transition: var(--transition-base);
}

.upload-zone:hover {
    border-color: var(--blue-500);
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.1);
}

.upload-zone:hover::before {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(139, 92, 246, 0.06));
}

.upload-zone.drag-over {
    border-color: var(--blue-400);
    border-style: solid;
    box-shadow: 0 0 60px rgba(59, 130, 246, 0.2);
    transform: scale(1.01);
}

.upload-zone-inner {
    position: relative;
    padding: 48px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-icon-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.upload-icon-bg {
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    animation: pulse-ring 2.5s ease-in-out infinite;
}

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

.upload-icon {
    color: var(--blue-400);
    position: relative;
}

.upload-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.upload-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.upload-badges {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.upload-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* File List */
.upload-file-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    animation: slideUp 0.3s ease-out;
}

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

.file-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    color: #EF4444;
    flex-shrink: 0;
}

.file-item-info {
    flex: 1;
    text-align: left;
}

.file-item-name {
    font-size: 0.875rem;
    font-weight: 600;
}

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

.file-item-remove {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.file-item-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red-500);
}

.file-item-open {
    padding: 6px 16px;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.file-item-open:hover {
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

/* Feature Cards */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 48px;
}

.feature-card {
    padding: 24px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-align: left;
    transition: var(--transition-base);
    backdrop-filter: blur(12px);
}

.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
}

.feature-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-radius: var(--radius-md);
    color: var(--accent);
    margin-bottom: 16px;
}

.feature-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.feature-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ══════════════════════════════════════════════════════
   STEP 2: PDF VIEWER
   ══════════════════════════════════════════════════════ */
.viewer-layout {
    display: flex;
    width: 100%;
    height: calc(100vh - var(--nav-height) - 72px);
    overflow: hidden;
}

/* Left Sidebar */
.viewer-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.sidebar-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.select-all-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
}

.select-all-check input[type="checkbox"] {
    accent-color: var(--blue-500);
}

/* Sidebar page management toolbar */
.sidebar-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}

.sidebar-tool-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.sidebar-tool-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.sidebar-tool-btn:active {
    transform: scale(0.96);
}

.sidebar-tool-btn svg {
    flex-shrink: 0;
}

/* Thumbnail list — Acrobat-style compact page panel */
.thumbnail-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
}

.thumbnail-item {
    position: relative;
    cursor: pointer;
    transition: transform 0.12s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 160px;
    padding: 6px 6px 0;
}

.thumbnail-item:hover {
    transform: scale(1.03);
}

.thumbnail-item.active .thumbnail-canvas-wrapper {
    box-shadow: 0 0 0 2px var(--blue-500), 0 4px 12px rgba(59, 130, 246, 0.25);
}

.thumbnail-canvas-wrapper {
    width: 100%;
    aspect-ratio: 0.707;
    overflow: hidden;
    background: #fff;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25), 0 0 1px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.15s ease;
}

.thumbnail-item:hover .thumbnail-canvas-wrapper {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 1px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .thumbnail-canvas-wrapper {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .thumbnail-item:hover .thumbnail-canvas-wrapper {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .thumbnail-item.active .thumbnail-canvas-wrapper {
    box-shadow: 0 0 0 2px var(--blue-500), 0 4px 12px rgba(59, 130, 246, 0.2);
}

.thumbnail-canvas-wrapper canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.thumbnail-info {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0 2px;
}

.thumbnail-number {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    user-select: none;
}

.thumbnail-item.active .thumbnail-number {
    color: var(--blue-400);
}

.thumbnail-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    border-radius: 3px;
    z-index: 2;
    transition: background 0.15s ease, opacity 0.15s ease;
    opacity: 0.7;
}

.thumbnail-item:hover .thumbnail-check {
    background: rgba(0,0,0,0.65);
    opacity: 1;
}

.thumbnail-check input[type="checkbox"] {
    accent-color: var(--blue-500);
    cursor: pointer;
    width: 13px;
    height: 13px;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 8px 14px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.page-count-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

/* Main Viewer */
.viewer-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.8rem;
    font-weight: 500;
}

.toolbar-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.toolbar-btn.primary {
    width: auto;
    padding: 0 16px;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    border-color: var(--blue-500);
    color: white;
}

.toolbar-btn.primary:hover {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.toolbar-btn.primary.active-tool {
    background: linear-gradient(135deg, var(--green-500), #059669);
    border-color: var(--green-500);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    animation: pulse-tool 2s ease-in-out infinite;
}

@keyframes pulse-tool {
    0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }
    50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.5); }
}

.zoom-level {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 8px;
    min-width: 50px;
    text-align: center;
}

.page-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.page-num-input {
    width: 48px;
    height: 30px;
    text-align: center;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-sans);
}

.page-num-input:focus {
    border-color: var(--blue-500);
    outline: none;
}

.page-separator {
    color: var(--text-muted);
}

/* ──────── Edit Toolbar ──────── */
.edit-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    flex-wrap: wrap;
    animation: slideDown 0.2s ease-out;
}

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

.edit-tool-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.edit-tool-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.edit-tool-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-color: var(--border-color);
}

.edit-tool-btn.active {
    color: var(--blue-400);
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.25);
}

.edit-tool-btn svg {
    flex-shrink: 0;
}

.edit-tool-settings {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.edit-setting {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
}

.edit-setting input[type="color"] {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    padding: 1px;
}

.edit-setting input[type="range"] {
    width: 70px;
    accent-color: var(--blue-500);
}

.edit-setting select {
    height: 28px;
    padding: 0 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.72rem;
    font-family: var(--font-sans);
}

.edit-setting select:focus {
    border-color: var(--blue-500);
    outline: none;
}

.btn-sm {
    padding: 5px 14px !important;
    font-size: 0.75rem !important;
    height: auto !important;
    gap: 5px;
}

/* Annotation Canvas */
.annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 9;
    cursor: crosshair;
}

.annotation-canvas.tool-text {
    cursor: text;
}

.annotation-canvas.tool-eraser {
    cursor: cell;
}

/* Text input overlay for edit mode */
.edit-text-input {
    position: absolute;
    z-index: 15;
    padding: 2px 4px;
    border: 1.5px dashed var(--blue-400);
    background: rgba(255, 255, 255, 0.85);
    color: #000;
    font-family: var(--font-sans);
    outline: none;
    min-width: 60px;
    min-height: 1.2em;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

/* Edit mode indicator on the Edit button */
.toolbar-btn.edit-active {
    background: linear-gradient(135deg, var(--purple-500), #7C3AED) !important;
    border-color: var(--purple-500) !important;
    color: white !important;
    box-shadow: 0 0 16px rgba(139, 92, 246, 0.3);
    width: auto;
    padding: 0 16px;
}

/* Canvas Area */
.viewer-canvas-area {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--navy-950);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(59, 130, 246, 0.03) 0%, transparent 60%);
}

.canvas-wrapper {
    position: relative;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    border-radius: 2px;
    overflow: visible;
}

.canvas-wrapper canvas {
    display: block;
}

/* Signature Overlay */
.signature-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.signature-overlay.placing {
    pointer-events: auto;
    cursor: crosshair;
}

.sig-rect {
    position: absolute;
    border: 2px solid var(--blue-500);
    background: rgba(59, 130, 246, 0.08);
    border-radius: 4px;
    cursor: move;
    pointer-events: auto;
    transition: box-shadow 0.15s ease;
    z-index: 11;
}

.sig-rect:hover,
.sig-rect.selected {
    border-color: var(--blue-400);
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.sig-rect .sig-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--blue-400);
    white-space: nowrap;
    pointer-events: none;
    text-align: center;
    line-height: 1.3;
}

.sig-rect .sig-label svg {
    display: block;
    margin: 0 auto 2px;
}

/* Resize handles */
.sig-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid var(--blue-500);
    border-radius: 2px;
    z-index: 12;
}

.sig-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.sig-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.sig-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.sig-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }
.sig-handle.n { top: -5px; left: calc(50% - 5px); cursor: n-resize; }
.sig-handle.s { bottom: -5px; left: calc(50% - 5px); cursor: s-resize; }
.sig-handle.w { top: calc(50% - 5px); left: -5px; cursor: w-resize; }
.sig-handle.e { top: calc(50% - 5px); right: -5px; cursor: e-resize; }

/* ──────── Right Sidebar: Properties ──────── */
.properties-sidebar {
    width: var(--props-width);
    min-width: var(--props-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition-base);
}

.properties-sidebar.hidden {
    width: 0;
    min-width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

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

.properties-header h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.close-props-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.close-props-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.properties-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prop-section {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.prop-section:last-child {
    border-bottom: none;
}

.prop-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.prop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.prop-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prop-field.full {
    grid-column: 1 / -1;
    margin-bottom: 8px;
}

.prop-field label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.prop-field input[type="number"],
.prop-field input[type="text"],
.prop-field select {
    height: 34px;
    padding: 0 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    transition: var(--transition-fast);
}

.prop-field input:focus,
.prop-field select:focus {
    border-color: var(--blue-500);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker-row input[type="color"] {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    padding: 2px;
}

.color-picker-row input[type="range"] {
    flex: 1;
    accent-color: var(--blue-500);
}

.color-picker-row span {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 32px;
}

/* Page Apply Options */
.page-apply-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 0.8rem;
}

.radio-option:hover {
    border-color: var(--border-hover);
}

.radio-option input[type="radio"] {
    accent-color: var(--blue-500);
}

.custom-range-input {
    margin-top: 8px;
    width: 100%;
    height: 34px;
    padding: 0 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

.custom-range-input:focus {
    border-color: var(--blue-500);
    outline: none;
}

/* Signature Image Upload */
.sig-image-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition-fast);
}

.sig-image-upload:hover {
    border-color: var(--blue-500);
    color: var(--blue-400);
}

.sig-image-preview {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.sig-image-preview img {
    width: 100%;
    max-height: 80px;
    object-fit: contain;
    padding: 8px;
}

.remove-img-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.7rem;
    cursor: pointer;
}

/* Signature Preview */
.sig-preview-box {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sig-preview-content {
    text-align: center;
}

.sig-preview-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-accent);
    margin-bottom: 4px;
}

.sig-preview-details {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Properties Footer */
.properties-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
}

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    color: white;
    border-color: var(--blue-500);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-sign {
    background: linear-gradient(135deg, var(--green-500), #059669);
    color: white;
    border-color: var(--green-500);
    padding: 14px 32px;
    font-size: 0.95rem;
}

.btn-sign:hover:not(:disabled) {
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.btn-sign:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-download {
    background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
    color: white;
    padding: 14px 32px;
    font-size: 0.95rem;
}

.btn-download:hover {
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.full-width {
    width: 100%;
}

/* ══════════════════════════════════════════════════════
   STEP 3: CERTIFICATE PANEL
   ══════════════════════════════════════════════════════ */
.cert-container {
    max-width: 1200px;
    width: 100%;
    padding: 20px 24px 60px;
}

.cert-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
}

.panel-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.panel-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.panel-icon.blue {
    background: rgba(59, 130, 246, 0.12);
    color: var(--blue-400);
}

.panel-icon.purple {
    background: rgba(139, 92, 246, 0.12);
    color: var(--purple-400);
}

.panel-card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Certificate Source Tabs */
.cert-source-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 4px;
}

.cert-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: var(--font-sans);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.cert-tab:hover {
    color: var(--text-secondary);
}

.cert-tab.active {
    background: var(--bg-card-solid);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.detect-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: var(--bg-input);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: 16px;
}

.detect-btn:hover {
    border-color: var(--blue-500);
    color: var(--blue-400);
    background: rgba(59, 130, 246, 0.05);
}

.detect-btn.loading {
    pointer-events: none;
}

.detect-btn.loading svg {
    animation: spin 1s linear infinite;
}

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

/* Certificate List */
.cert-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cert-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.cert-list-item:hover {
    border-color: var(--border-hover);
}

.cert-list-item.selected {
    border-color: var(--blue-500);
    background: rgba(59, 130, 246, 0.08);
}

.cert-list-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(16, 185, 129, 0.1);
    border-radius: var(--radius-sm);
    color: var(--green-500);
    flex-shrink: 0;
}

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

.cert-list-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cert-list-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.cert-list-item-check {
    color: var(--blue-500);
    opacity: 0;
    transition: var(--transition-fast);
}

.cert-list-item.selected .cert-list-item-check {
    opacity: 1;
}

/* Token Providers */
.token-provider-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.provider-chip {
    padding: 4px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* PFX Upload */
.pfx-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-muted);
}

.pfx-upload-zone:hover {
    border-color: var(--blue-500);
    color: var(--blue-400);
}

.pfx-upload-zone p {
    font-size: 0.85rem;
    font-weight: 500;
}

.pfx-password {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
}

.password-input-wrapper input:focus {
    border-color: var(--blue-500);
    outline: none;
}

.toggle-pass {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.toggle-pass:hover {
    color: var(--text-primary);
}

/* Selected Certificate Info */
.selected-cert-info {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-md);
}

.cert-info-header {
    margin-bottom: 16px;
}

.cert-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.cert-status.valid {
    background: rgba(16, 185, 129, 0.12);
    color: var(--green-400);
}

.cert-details-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cert-detail {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-value {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    word-break: break-all;
}

.detail-value.mono {
    font-family: var(--font-mono);
    font-size: 0.7rem;
}

/* Signing Options */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.option-select,
.option-input {
    height: 40px;
    padding: 0 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-sans);
    transition: var(--transition-fast);
}

.option-select:focus,
.option-input:focus {
    border-color: var(--blue-500);
    outline: none;
}

.option-chips {
    display: flex;
    gap: 6px;
}

.chip-option {
    flex: 1;
    cursor: pointer;
}

.chip-option input {
    display: none;
}

.chip-option span {
    display: block;
    padding: 8px 12px;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.chip-option input:checked + span {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--blue-500);
    color: var(--blue-400);
}

.chip-option:hover span {
    border-color: var(--border-hover);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--navy-500);
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--blue-500);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* Document Summary */
.doc-summary {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.doc-summary h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.summary-item svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.summary-item strong {
    color: var(--text-primary);
}

/* Sign Actions */
.sign-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

/* ══════════════════════════════════════════════════════
   STEP 4: PROGRESS & COMPLETION
   ══════════════════════════════════════════════════════ */
.progress-container,
.completion-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 40px 24px;
}

.progress-card,
.completion-card {
    max-width: 520px;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    text-align: center;
    backdrop-filter: blur(12px);
}

/* Progress Ring */
.progress-animation {
    margin-bottom: 24px;
}

.progress-ring-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.progress-ring {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 6;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.progress-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.progress-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.progress-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.progress-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
}

.detail-key {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-val {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-bar-wrapper {
    padding: 0 4px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--blue-500), var(--purple-500));
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

/* Completion */
.completion-icon {
    margin-bottom: 24px;
}

.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.checkmark-svg {
    width: 80px;
    height: 80px;
}

.checkmark-circle {
    stroke: var(--green-500);
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke-anim 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    stroke: var(--green-400);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke-anim 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.4s forwards;
}

@keyframes stroke-anim {
    to { stroke-dashoffset: 0; }
}

.completion-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--green-400), var(--blue-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.completion-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.completion-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    padding: 16px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-accent);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value svg {
    color: var(--green-400);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.completion-cert-info {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.cert-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--blue-400);
}

.completion-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* ══════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    max-width: 420px;
    width: 90%;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 28px 28px 0;
    text-align: center;
}

.modal-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.12);
    border-radius: var(--radius-lg);
    color: var(--blue-400);
    margin: 0 auto 16px;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

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

.modal-body {
    padding: 24px 28px;
}

.pin-input-wrapper {
    position: relative;
}

.pin-input {
    width: 100%;
    height: 48px;
    padding: 0 48px 0 16px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-mono);
    letter-spacing: 0.15em;
    text-align: center;
    transition: var(--transition-fast);
}

.pin-input:focus {
    border-color: var(--blue-500);
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.remember-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
}

.remember-check input {
    accent-color: var(--blue-500);
}

.modal-footer {
    padding: 0 28px 28px;
    display: flex;
    gap: 8px;
}

.modal-footer .btn {
    flex: 1;
}

/* ══════════════════════════════════════════════════════
   TOAST
   ══════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card-solid);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow);
    font-size: 0.85rem;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
}

.toast.success {
    border-left: 3px solid var(--green-500);
}

.toast.error {
    border-left: 3px solid var(--red-500);
}

.toast.info {
    border-left: 3px solid var(--blue-500);
}

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

.toast.success .toast-icon { color: var(--green-500); }
.toast.error .toast-icon { color: var(--red-500); }
.toast.info .toast-icon { color: var(--blue-500); }

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

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cert-layout {
        grid-template-columns: 1fr;
    }
    .completion-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    .hero-title {
        font-size: 1.8rem;
    }
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .viewer-sidebar {
        width: 180px;
        min-width: 180px;
    }
    .properties-sidebar {
        width: 280px;
        min-width: 280px;
    }
    .step-label {
        display: none;
    }
}

@media (max-width: 480px) {
    .viewer-sidebar {
        width: 120px;
        min-width: 120px;
    }
    .properties-sidebar {
        position: fixed;
        right: 0;
        top: var(--nav-height);
        height: calc(100vh - var(--nav-height));
        z-index: 100;
        width: 300px;
        min-width: 300px;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    }
}

/* ══════════════════════════════════════════════════════
   SKELETON / LOADING STATES
   ══════════════════════════════════════════════════════ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ══════════════════════════════════════════════════════
   CONFETTI
   ══════════════════════════════════════════════════════ */
.confetti-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1500;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 12px;
    border-radius: 2px;
    animation: confetti-fall linear forwards;
    opacity: 0;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-10vh) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(110vh) rotate(720deg);
    }
}

/* alias for programmatic toast */
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.btn.full-width {
    width: 100%;
    justify-content: center;
}
