/* ABQM History Database - Vintage Mining Archive Theme */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@400;500;600&display=swap');

:root {
    /* Vintage warm palette */
    --bg-primary: #1a1714;
    --bg-secondary: #242019;
    --bg-tertiary: #2e2820;
    --bg-card: #322c24;

    /* Text colors */
    --text-primary: #f0e9dc;
    --text-secondary: #a69d8d;
    --text-muted: #7a7265;

    /* Gold/amber accent */
    --accent: #c9a227;
    --accent-hover: #ddb63a;
    --accent-muted: #8b7320;

    /* Copper secondary accent */
    --copper: #b87333;
    --copper-hover: #cd8544;

    /* Functional colors */
    --border-color: #3d362c;
    --border-light: #4a423a;
    --success: #6b8e4e;
    --warning: #d4a24c;
    --error: #b54a4a;

    /* Typography */
    --font-display: 'Crimson Text', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

/* ============================================
   SPLASH PAGE
   ============================================ */
.splash-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at center, rgba(201, 162, 39, 0.08) 0%, transparent 60%),
        linear-gradient(180deg, var(--bg-primary) 0%, #0d0b08 100%);
    padding: 2rem;
}

.splash-content {
    text-align: center;
    max-width: 600px;
    animation: fadeInUp 0.8s ease;
}

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

.splash-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 20px rgba(201, 162, 39, 0.3));
}

.splash-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.splash-divider {
    width: 120px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    margin: 1.5rem auto;
}

.splash-subtitle {
    font-size: 1.1rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.splash-years {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-style: italic;
}

.splash-description {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2.5rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.splash-enter-btn {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-muted) 100%);
    color: var(--bg-primary);
    border: 2px solid var(--accent);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(201, 162, 39, 0.3);
}

.splash-enter-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(201, 162, 39, 0.4);
}

.splash-stats {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Mining Animation */
.mining-scene {
    position: relative;
    width: 160px;
    height: 120px;
    margin: 2rem auto;
    cursor: pointer;
}

.rock-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease;
}

.rock {
    font-size: 4rem;
    filter: drop-shadow(0 6px 15px rgba(0,0,0,0.4));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.mining-scene:hover .rock {
    transform: scale(1.1);
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5)) brightness(1.1);
}

.mining-scene.mining .rock {
    animation: rockShake 0.15s ease;
}

@keyframes rockShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px) rotate(-3deg); }
    75% { transform: translateX(4px) rotate(3deg); }
}

/* Quartz glow */
.quartz-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mining-scene:hover .quartz-glow {
    opacity: 1;
}

/* Pickaxe */
.pickaxe {
    position: absolute;
    font-size: 2rem;
    top: 0;
    right: 10px;
    transform: rotate(-45deg);
    transform-origin: bottom right;
    transition: transform 0.15s ease;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.3));
}

.mining-scene:hover .pickaxe {
    transform: rotate(-30deg);
}

.mining-scene.mining .pickaxe {
    animation: pickaxeSwing 0.25s ease;
}

@keyframes pickaxeSwing {
    0% { transform: rotate(-30deg); }
    40% { transform: rotate(-100deg); }
    100% { transform: rotate(-45deg); }
}

/* Particles */
.particles {
    position: absolute;
    top: 50%;
    left: 50%;
    pointer-events: none;
}

.particle {
    position: absolute;
    animation: particleFly 1s ease-out forwards;
}

.particle.quartz {
    width: 8px;
    height: 16px;
    background: linear-gradient(135deg, #fff 0%, #e8e8e8 50%, #ccc 100%);
    clip-path: polygon(50% 0%, 100% 30%, 80% 100%, 20% 100%, 0% 30%);
    box-shadow: 0 0 10px rgba(255,255,255,0.8), 0 0 20px rgba(255,255,255,0.4);
}

.particle.sparkle {
    font-size: 1.2rem;
}

@keyframes particleFly {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
        opacity: 0;
    }
}

/* Mining hint */
.mining-hint {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Breaking animation */
.mining-scene.breaking .rock {
    animation: rockBreak 0.5s ease forwards;
}

@keyframes rockBreak {
    0% { transform: scale(1); opacity: 1; }
    30% { transform: scale(1.3); }
    100% { transform: scale(0); opacity: 0; }
}

.mining-scene.breaking .pickaxe,
.mining-scene.breaking .mining-hint {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Quartz burst effect */
.quartz-burst {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, rgba(200, 220, 255, 0.3) 40%, transparent 70%);
    border-radius: 50%;
    animation: burstExpand 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes burstExpand {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 1.25rem 2rem;
    border-bottom: 2px solid var(--accent-muted);
    position: relative;
}

.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    font-size: 2rem;
    filter: grayscale(20%);
}

.header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.header .subtitle {
    font-size: 0.85rem;
    color: var(--accent);
    margin-top: 0.25rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 300px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
    position: relative;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
    overflow: visible;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .document-list {
    opacity: 0;
    pointer-events: none;
    width: 0;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.sidebar-header h2 {
    margin-bottom: 1rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    transition: opacity 0.2s ease;
}

.sidebar-header h2::before {
    content: '📜';
    font-size: 1.1rem;
}

.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    width: 28px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.sidebar-toggle:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent);
    width: 32px;
    right: -18px;
}

.sidebar.collapsed .sidebar-toggle {
    left: 0;
    right: auto;
    border: 1px solid var(--border-color);
    border-radius: 0 8px 8px 0;
}

.sidebar.collapsed .sidebar-toggle:hover {
    left: 0;
    width: 32px;
}

.filter-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    padding-left: 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a69d8d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.filter-input::placeholder {
    color: var(--text-muted);
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

.document-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.doc-item {
    padding: 0.875rem 1rem;
    margin-bottom: 0.375rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    background-color: transparent;
}

.doc-item:hover {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}

.doc-item.active {
    background-color: var(--accent);
    border-color: var(--accent-hover);
    box-shadow: var(--shadow-sm);
}

.doc-item .doc-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.doc-item .doc-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doc-item .doc-meta::before {
    content: '📅';
    font-size: 0.7rem;
}

.doc-item.active .doc-name,
.doc-item.active .doc-meta {
    color: var(--bg-primary);
}

.doc-item.active .doc-meta::before {
    filter: brightness(0);
}

/* Section headers for document list */
.section-header {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.75rem 1rem 0.5rem;
    margin-top: 0.5rem;
}

.section-header:first-child {
    margin-top: 0;
}

.recent-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
}

.doc-item.recent {
    border-left: 2px solid var(--accent-muted);
}

/* ============================================
   DOCUMENT VIEWER
   ============================================ */
.document-viewer {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-primary);
}

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

.viewer-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.search-bar {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    width: 220px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

.search-hint {
    display: none;
    font-size: 0.75rem;
    color: var(--text-muted);
    align-self: center;
    white-space: nowrap;
}

@media (min-width: 1200px) {
    .search-hint {
        display: block;
    }
}

/* No results styling */
.no-results {
    text-align: center;
    padding: 1.5rem;
}

.no-results-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.search-tip {
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    text-align: left;
}

.search-tip p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.search-tip .open-chat-btn {
    margin-top: 1rem;
    width: 100%;
}

.viewer-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: var(--bg-primary);
}

.viewer-content .placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    gap: 1rem;
}

.viewer-content .placeholder::before {
    content: '⛏️';
    font-size: 3rem;
    opacity: 0.5;
}

.viewer-content .placeholder p {
    margin: 0;
    max-width: 400px;
}

.document-text {
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-primary);
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* ============================================
   VIEW CONTROLS
   ============================================ */
.viewer-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.view-mode-toggle {
    display: flex;
    gap: 0;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    padding: 3px;
}

.view-btn {
    padding: 0.4rem 0.85rem;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 5px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

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

.view-btn.active {
    background-color: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
}

.page-navigation {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background-color: var(--bg-tertiary);
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Prominent prev/next buttons */
#prev-page,
#next-page {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-muted) 100%);
    color: var(--bg-primary);
    border: 1px solid var(--accent);
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

#prev-page:hover,
#next-page:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    box-shadow: 0 2px 8px rgba(201, 162, 39, 0.3);
}

#prev-page:disabled,
#next-page:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-color: var(--border-color);
    box-shadow: none;
    cursor: not-allowed;
}

#page-indicator {
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 100px;
    text-align: center;
    font-weight: 600;
}

#bookmark-btn.bookmarked {
    background-color: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

#share-btn.copied {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}

/* Bookmark items */
.bookmark-item {
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    background-color: var(--bg-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bookmark-item:hover {
    background-color: var(--bg-card);
    border-color: var(--accent-muted);
    transform: translateX(4px);
}

.bookmark-item .bookmark-info {
    flex: 1;
}

.bookmark-item .bookmark-doc {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.bookmark-item .bookmark-page {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bookmark-item .bookmark-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.bookmark-item .bookmark-delete:hover {
    background-color: var(--error);
    color: white;
}

/* Export buttons in bookmarks modal */
.export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* ============================================
   SPLIT VIEW
   ============================================ */
.split-view {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.image-pane {
    flex: 1;
    background-color: #0d0b09;
    background-image:
        radial-gradient(circle at 50% 50%, rgba(201, 162, 39, 0.03) 0%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1.5rem;
    position: relative;
}

.image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
}

.image-pane img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.1s ease;
    transform-origin: center center;
    user-select: none;
    display: block;
}

/* Mirror highlight overlay */
.mirror-highlight {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(201, 162, 39, 0.15);
    border-left: 4px solid var(--accent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, top 0.15s ease, height 0.15s ease;
    z-index: 5;
}

.mirror-highlight::before {
    content: 'Approximate';
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    font-size: 9px;
    color: var(--warning);
    background: rgba(26, 23, 20, 0.95);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mirror-highlight.active {
    opacity: 1;
}

/* Precise OCR-based highlight */
.mirror-highlight.precise {
    background: rgba(107, 142, 78, 0.25);
    border-left-color: var(--success);
}

.mirror-highlight.precise::before {
    content: 'OCR Match';
    color: var(--success);
}

/* ============================================
   DOWNLOAD MODAL
   ============================================ */
.modal-small {
    max-width: 400px;
}

.download-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.download-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.download-option:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    transform: translateX(4px);
}

.download-option:disabled {
    opacity: 0.6;
    cursor: wait;
}

.download-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.download-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Zoom Controls */
.zoom-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    background-color: rgba(36, 32, 25, 0.9);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    z-index: 10;
    backdrop-filter: blur(8px);
}

.zoom-controls #zoom-display {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: center;
    font-weight: 500;
}

/* Fullscreen Image Mode */
.image-pane.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    background-color: rgba(0, 0, 0, 0.95);
    padding: 2rem;
}

.image-pane.fullscreen img {
    max-width: 95vw;
    max-height: 90vh;
}

.image-pane.fullscreen .zoom-controls {
    top: 1.5rem;
    right: 1.5rem;
}

.image-pane.fullscreen::after {
    content: 'Double-click or press Escape to exit fullscreen';
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.no-image-msg {
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.no-image-msg::before {
    content: '🖼️';
    font-size: 2rem;
    opacity: 0.5;
}

.text-pane {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
}

/* View Modes */
.split-view.view-text .image-pane {
    display: none;
}

.split-view.view-text .text-pane {
    border-left: none;
}

.split-view.view-image .text-pane {
    display: none;
}

.split-view.view-both .image-pane,
.split-view.view-both .text-pane {
    flex: 1;
}

/* ============================================
   FLOATING CHAT WIDGET
   ============================================ */
.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-muted) 100%);
    border: 2px solid var(--accent-hover);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(201, 162, 39, 0.2);
    transition: all var(--transition-normal);
    position: absolute;
    bottom: 0;
    right: 0;
}

.chat-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(201, 162, 39, 0.35);
}

/* Hint label pointing to chat */
.chat-toggle-btn::before {
    content: "Ask questions here";
    position: absolute;
    right: 70px;
    bottom: 50%;
    transform: translateY(50%);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    opacity: 0;
    animation: chatHintFade 8s ease-in-out infinite;
    pointer-events: none;
}

.chat-toggle-btn::after {
    content: "";
    position: absolute;
    right: 66px;
    bottom: 50%;
    transform: translateY(50%);
    border: 6px solid transparent;
    border-left-color: var(--bg-secondary);
    opacity: 0;
    animation: chatHintFade 8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes chatHintFade {
    0%, 70%, 100% { opacity: 0; }
    75%, 95% { opacity: 1; }
}

.chat-widget.open .chat-toggle-btn::before,
.chat-widget.open .chat-toggle-btn::after {
    display: none;
}

.chat-toggle-btn .chat-icon,
.chat-toggle-btn .close-icon {
    font-size: 1.5rem;
}

.chat-toggle-btn .close-icon {
    display: none;
    color: var(--bg-primary);
    font-weight: bold;
}

.chat-widget.open .chat-toggle-btn .chat-icon {
    display: none;
}

.chat-widget.open .chat-toggle-btn .close-icon {
    display: block;
}

.chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 500px;
    background-color: var(--bg-secondary);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.chat-widget.open .chat-window {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

.chat-header {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header::before {
    content: '🤖';
    font-size: 1.25rem;
}

.chat-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    flex: 1;
}

.chat-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

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

@media (max-width: 768px) {
    .chat-close-btn {
        display: block;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    font-size: 0.9rem;
    line-height: 1.5;
}

.message.user {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-muted) 100%);
    color: var(--bg-primary);
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.message.system {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-style: normal;
    max-width: 100%;
    text-align: left;
    font-size: 0.85rem;
    border: 1px dashed var(--border-color);
}

.message.system p {
    margin: 0.3rem 0;
}

.chat-examples {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

.chat-examples li {
    font-style: italic;
    color: var(--accent);
    padding: 0.2rem 0;
    font-size: 0.8rem;
}

.chat-examples li::before {
    content: "• ";
    color: var(--text-muted);
}

.message .sources {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.message .sources .source-link {
    display: inline-block;
    background-color: var(--bg-tertiary);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    margin: 0.2rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

.message .sources .source-link:hover {
    background-color: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
}

.chat-input-area {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-tertiary);
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.15);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-muted) 100%);
    color: var(--bg-primary);
    border: 1px solid var(--accent);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-card);
    border-color: var(--border-light);
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.2s ease;
}

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

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.close-btn:hover {
    background-color: var(--bg-card);
    color: var(--accent);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.search-result-item {
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    background-color: var(--bg-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

.search-result-item:hover {
    background-color: var(--bg-card);
    border-color: var(--accent-muted);
    transform: translateX(4px);
}

.search-result-item .result-doc {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.search-result-item .result-line {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.search-result-item .result-context {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

mark {
    background-color: var(--accent);
    color: var(--bg-primary);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-weight: 500;
}

mark.search-highlight {
    background-color: var(--warning);
    color: var(--bg-primary);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    font-weight: 600;
    box-shadow: 0 0 0 2px rgba(212, 162, 76, 0.3);
}

/* ============================================
   SUMMARY MODAL STYLES
   ============================================ */
.summary-section {
    margin-bottom: 1.5rem;
}

.summary-section h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.summary-section p {
    line-height: 1.7;
    color: var(--text-primary);
}

.key-points-list {
    list-style: none;
    padding: 0;
}

.key-points-list li {
    padding: 0.5rem 0 0.5rem 1.5rem;
    position: relative;
    color: var(--text-primary);
    line-height: 1.5;
}

.key-points-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
}

.entities-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.entity-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.entity-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 100px;
}

.entity-tag {
    font-size: 0.85rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid;
}

/* Entity type colors */
.entity-person {
    background-color: rgba(184, 115, 51, 0.15);
    color: var(--copper);
    border-color: rgba(184, 115, 51, 0.3);
}

.entity-place {
    background-color: rgba(74, 144, 217, 0.15);
    color: #4a90d9;
    border-color: rgba(74, 144, 217, 0.3);
}

.entity-organization {
    background-color: rgba(123, 104, 238, 0.15);
    color: #7b68ee;
    border-color: rgba(123, 104, 238, 0.3);
}

.entity-date {
    background-color: rgba(107, 142, 78, 0.15);
    color: var(--success);
    border-color: rgba(107, 142, 78, 0.3);
}

.entity-amount {
    background-color: rgba(212, 162, 76, 0.15);
    color: var(--warning);
    border-color: rgba(212, 162, 76, 0.3);
}

.summary-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   TIMELINE STYLES
   ============================================ */
.modal-wide {
    max-width: 1000px;
    width: 90%;
}

.timeline-container {
    margin-bottom: 1.5rem;
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.timeline-axis {
    position: relative;
    min-height: 80px;
    margin: 0.5rem 0 1rem;
    padding: 0 20px;
}

.timeline-line {
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 2px;
    background: var(--border-light);
}

.timeline-decades {
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 100%;
}

.timeline-decade {
    position: absolute;
    transform: translateX(-50%);
}

.timeline-tick {
    width: 2px;
    height: 10px;
    background: var(--accent);
    margin: 0 auto;
}

.timeline-decade-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    margin-top: 2px;
}

.timeline-markers {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 0;
}

.timeline-marker {
    position: absolute;
    height: 24px;
    min-width: 50px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Alternating colors for better distinction */
.timeline-marker.row-0 { background: linear-gradient(135deg, var(--accent) 0%, #b8860b 100%); }
.timeline-marker.row-1 { background: linear-gradient(135deg, var(--copper) 0%, #8b5a2b 100%); }
.timeline-marker.row-2 { background: linear-gradient(135deg, #6b8e4e 0%, #4a6832 100%); }
.timeline-marker.row-3 { background: linear-gradient(135deg, #4a90d9 0%, #2c5a8a 100%); }
.timeline-marker.row-4 { background: linear-gradient(135deg, #7b68ee 0%, #5a4eb8 100%); }

.timeline-marker:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-md), 0 0 15px rgba(201, 162, 39, 0.4);
    z-index: 100;
}

.timeline-marker-label {
    font-size: 0.65rem;
    color: white;
    font-weight: 600;
    white-space: nowrap;
    padding: 0 0.4rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 1000;
    box-shadow: var(--shadow-md);
    pointer-events: none;
}

.timeline-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-color);
}

.timeline-tooltip strong {
    display: block;
    font-size: 0.8rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.timeline-tooltip span {
    font-size: 0.7rem;
    color: var(--accent);
}

.timeline-marker:hover .timeline-tooltip {
    opacity: 1;
    visibility: visible;
}

.timeline-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.timeline-list {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.timeline-list h4 {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.timeline-list-scroll {
    max-height: 200px;
    overflow-y: auto;
}

.timeline-list-item {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background-color: transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.timeline-list-item:last-child {
    border-bottom: none;
}

.timeline-list-item:hover {
    background-color: var(--bg-card);
}

.timeline-list-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    min-width: 80px;
    font-weight: 600;
}

.timeline-list-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Header actions */
.header-actions {
    margin-left: auto;
}

/* ============================================
   ENTITY EXTRACTION STYLES
   ============================================ */
.entities-controls {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.entity-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    font-weight: 500;
}

.entity-toggle input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.entity-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.entity-filter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
}

.entity-filter input {
    cursor: pointer;
}

.entity-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.entities-list {
    margin-bottom: 1rem;
}

.entity-type-section {
    margin-bottom: 1rem;
}

.entity-type-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.entity-type-person { color: var(--copper); }
.entity-type-place { color: #4a90d9; }
.entity-type-organization { color: #7b68ee; }
.entity-type-date { color: var(--success); }
.entity-type-amount { color: var(--warning); }

.entity-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* Entity highlight marks in text */
.entity-highlight {
    padding: 0.1em 0.25em;
    border-radius: 3px;
    font-weight: normal;
}

.entity-highlight.entity-person {
    background-color: rgba(184, 115, 51, 0.25);
    color: inherit;
    border-bottom: 2px solid var(--copper);
}

.entity-highlight.entity-place {
    background-color: rgba(74, 144, 217, 0.25);
    color: inherit;
    border-bottom: 2px solid #4a90d9;
}

.entity-highlight.entity-organization {
    background-color: rgba(123, 104, 238, 0.25);
    color: inherit;
    border-bottom: 2px solid #7b68ee;
}

.entity-highlight.entity-date {
    background-color: rgba(107, 142, 78, 0.25);
    color: inherit;
    border-bottom: 2px solid var(--success);
}

.entity-highlight.entity-amount {
    background-color: rgba(212, 162, 76, 0.25);
    color: inherit;
    border-bottom: 2px solid var(--warning);
}

/* ============================================
   CONFIDENCE ANALYSIS STYLES
   ============================================ */
.confidence-overview {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.confidence-score-display {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.confidence-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(
        var(--color) calc(var(--score) * 1%),
        var(--bg-primary) calc(var(--score) * 1%)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.confidence-circle::before {
    content: '';
    position: absolute;
    width: 75px;
    height: 75px;
    background-color: var(--bg-secondary);
    border-radius: 50%;
}

.confidence-percentage {
    position: relative;
    z-index: 1;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.confidence-info {
    flex: 1;
}

.confidence-level {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.confidence-description {
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.confidence-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
}

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

.confidence-pages {
    margin-bottom: 1.5rem;
}

.confidence-pages h4,
.confidence-issues h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.page-bars {
    display: flex;
    gap: 4px;
    height: 80px;
    align-items: flex-end;
    background-color: var(--bg-primary);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.page-bar-item {
    flex: 1;
    max-width: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.page-bar-item:hover {
    transform: scale(1.1);
}

.page-bar-fill {
    width: 100%;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease;
    min-height: 4px;
}

.page-bar-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.confidence-issues {
    margin-bottom: 1rem;
}

.issues-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.issue-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background-color: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.issue-item:hover {
    background-color: var(--bg-card);
    border-color: var(--error);
}

.issue-marker {
    background-color: rgba(181, 74, 74, 0.2);
    color: var(--error);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.issue-context {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.issue-page {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.issue-more {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ============================================
   HELP TOOLTIPS
   ============================================ */
.help-tooltip {
    position: relative;
    display: inline-flex;
}

.help-tooltip[data-help]::after {
    content: attr(data-help);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    background: #1a1714;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    width: max-content;
    max-width: 200px;
    text-align: center;
    line-height: 1.4;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    border: 1px solid var(--accent);
    pointer-events: none;
}

.help-tooltip:hover[data-help]::after {
    opacity: 1;
    visibility: visible;
}

/* Ensure tooltips aren't clipped */
.viewer-controls,
.page-navigation,
.view-mode-toggle,
.header-actions,
.header,
.viewer-header {
    overflow: visible;
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 5px;
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }

    .search-input {
        width: 180px;
    }

    .header-content {
        flex-wrap: wrap;
    }
}

/* ============================================
   RESPONSIVE - SMALL TABLET / LARGE PHONE
   ============================================ */
@media (max-width: 768px) {
    /* Header - minimal */
    .header {
        padding: 0.5rem 1rem;
    }

    .header-content {
        gap: 0.5rem;
    }

    .header h1 {
        font-size: 1rem;
    }

    .header .subtitle {
        display: none;
    }

    .header-icon {
        font-size: 1.25rem;
    }

    /* Hide timeline button in header on mobile */
    .header-actions {
        display: none;
    }

    /* Sidebar - collapsible drawer */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 500;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .sidebar-toggle {
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        right: auto;
        border-radius: 0 8px 8px 0;
        z-index: 501;
        width: 32px;
        height: 56px;
    }

    .sidebar.mobile-open + .sidebar-toggle,
    .sidebar.mobile-open .sidebar-toggle {
        left: 280px;
    }

    /* Mobile sidebar overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 499;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Viewer header - MINIMAL */
    .viewer-header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .viewer-header h2 {
        font-size: 0.9rem;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* HIDE search bar on mobile by default */
    .search-bar {
        display: none;
    }

    /* View controls - compact single row */
    .viewer-controls {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        width: 100%;
        justify-content: center;
    }

    .view-mode-toggle {
        flex-shrink: 0;
    }

    .view-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Page navigation - just prev/page/next */
    .page-navigation {
        flex-wrap: nowrap;
        gap: 0.25rem;
        padding: 0.25rem 0.5rem;
        background: transparent;
        border: none;
    }

    #prev-page,
    #next-page {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    #page-indicator {
        font-size: 0.7rem;
        min-width: 70px;
    }

    /* HIDE extra buttons on mobile - put in overflow menu */
    #bookmark-btn,
    #show-bookmarks,
    #share-btn,
    #summary-btn,
    #entities-btn,
    #confidence-btn,
    #download-btn,
    #print-btn {
        display: none !important;
    }

    /* Show mobile overflow menu button */
    .mobile-more-btn {
        display: flex !important;
    }

    /* Split view - stack vertically */
    .split-view.view-both {
        flex-direction: column;
    }

    .split-view.view-both .image-pane,
    .split-view.view-both .text-pane {
        flex: none;
        height: 50%;
    }

    .split-view.view-both .text-pane {
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    /* Image pane - maximize space */
    .image-pane {
        padding: 0.5rem;
    }

    .zoom-controls {
        top: 0.25rem;
        right: 0.25rem;
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
    }

    .zoom-controls .btn {
        padding: 0.2rem 0.4rem;
        min-height: 28px;
        min-width: 28px;
    }

    #zoom-display {
        font-size: 0.65rem;
        min-width: 35px;
    }

    /* Text pane */
    .text-pane {
        padding: 0.5rem;
    }

    .document-text {
        font-size: 0.8rem;
        padding: 0.75rem;
    }

    /* Chat widget */
    .chat-widget {
        bottom: 12px;
        right: 12px;
    }

    .chat-toggle-btn {
        width: 48px;
        height: 48px;
    }

    .chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 60vh;
        border-radius: 16px 16px 0 0;
    }

    /* When chat is open, put close button in the chat header */
    .chat-widget.open .chat-toggle-btn {
        position: absolute;
        top: -48px;
        right: 12px;
        bottom: auto;
        width: 40px;
        height: 40px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
    }

    .chat-widget.open .chat-toggle-btn .close-icon {
        font-size: 1.2rem;
        color: var(--text-primary);
    }

    /* Modals - full screen on mobile */
    .modal-content {
        width: 95%;
        max-width: none;
        max-height: 90vh;
        margin: 1rem;
        border-radius: 12px;
    }

    .modal-wide {
        width: 95%;
    }

    .modal-small {
        max-width: none;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-header h3 {
        font-size: 0.95rem;
    }

    .modal-body {
        padding: 0.75rem;
    }

    /* Timeline - horizontal scroll */
    .timeline-container {
        padding: 0.75rem;
        overflow-x: auto;
    }

    .timeline-axis {
        min-width: 500px;
    }

    /* Help tooltips - hide on touch */
    .help-tooltip[data-help]::after {
        display: none;
    }

    /* Splash page */
    .splash-title {
        font-size: 1.4rem;
    }

    .splash-years {
        font-size: 1.1rem;
    }

    .splash-description {
        font-size: 0.85rem;
        padding: 0 1rem;
    }

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

    .mining-scene {
        width: 100px;
        height: 80px;
    }

    .rock {
        font-size: 2.5rem;
    }

    .pickaxe {
        font-size: 1.25rem;
    }
}

/* ============================================
   MOBILE OVERFLOW MENU
   ============================================ */
.mobile-more-btn {
    display: none;
}

.mobile-menu {
    display: none;
    position: fixed;
    bottom: 70px;
    right: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    z-index: 600;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    gap: 0.25rem;
    min-width: 150px;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background var(--transition-fast);
    width: 100%;
    text-align: left;
}

.mobile-menu-item:hover {
    background: var(--bg-card);
}

.mobile-menu-item .menu-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* ============================================
   LIBRARY VIEW (iBooks-style grid)
   ============================================ */
.library-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.library-header h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0;
}

.library-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.library-search {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 180px;
}

.library-search:focus {
    outline: none;
    border-color: var(--accent);
}

.view-toggle {
    display: flex;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.view-toggle-btn {
    padding: 0.4rem 0.6rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

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

.view-toggle-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Grid Layout */
.library-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    align-content: start;
}

.library-grid.list-view {
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

/* Document Card - Grid */
.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 120px;
}

.doc-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.doc-card:active {
    transform: translateY(0);
}

.doc-card-icon {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.doc-card-title {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.doc-card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: auto;
}

.doc-card-date {
    color: var(--accent);
    font-weight: 500;
}

/* Document Card - List View */
.library-grid.list-view .doc-card {
    flex-direction: row;
    align-items: center;
    min-height: auto;
    padding: 0.75rem 1rem;
    gap: 1rem;
}

.library-grid.list-view .doc-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0;
}

.library-grid.list-view .doc-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.library-grid.list-view .doc-card-title {
    font-size: 0.95rem;
}

.library-grid.list-view .doc-card-meta {
    margin-top: 0;
}

/* Recent badge */
.doc-card.recent::before {
    content: 'Recent';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.6rem;
    background: var(--accent);
    color: var(--bg-primary);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.doc-card {
    position: relative;
}

/* Mobile Library */
@media (max-width: 768px) {
    .library-view {
        padding: 0.75rem;
    }

    .library-header {
        flex-direction: column;
        align-items: stretch;
    }

    .library-header h3 {
        font-size: 1.1rem;
        text-align: center;
    }

    .library-controls {
        justify-content: space-between;
    }

    .library-search {
        flex: 1;
        width: auto;
    }

    .library-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }

    .doc-card {
        padding: 0.75rem;
        min-height: 100px;
    }

    .doc-card-icon {
        font-size: 1.5rem;
    }

    .doc-card-title {
        font-size: 0.8rem;
    }

    .doc-card-meta {
        font-size: 0.7rem;
    }
}

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

    .library-grid.list-view {
        grid-template-columns: 1fr;
    }
}

/* Hide viewer header when library is shown */
.document-viewer.library-mode .viewer-header {
    display: none !important;
}

.document-viewer.library-mode .viewer-content {
    height: 100%;
}

/* Show viewer header when document is loaded */
.document-viewer:not(.library-mode) .viewer-header {
    display: flex !important;
}

/* Back to library button - always visible */
.back-btn {
    display: flex;
    flex-shrink: 0;
}

.viewer-header {
    display: flex;
}

.viewer-header h2 {
    flex: 1;
}

/* Hide sidebar - library view replaces it */
.sidebar {
    display: none !important;
}

.sidebar-toggle {
    display: none !important;
}

.sidebar-overlay {
    display: none !important;
}

/* Ensure library view takes full width */
.library-view {
    width: 100%;
}

/* ============================================
   RESPONSIVE - PHONE
   ============================================ */
@media (max-width: 480px) {
    /* Header - minimal */
    .header {
        padding: 0.4rem 0.75rem;
    }

    .header h1 {
        font-size: 0.85rem;
    }

    .header-icon {
        font-size: 1.1rem;
    }

    /* App container */
    .app-container {
        height: 100dvh;
    }

    /* Viewer header - super compact */
    .viewer-header {
        padding: 0.4rem 0.5rem;
        gap: 0.4rem;
    }

    .viewer-header h2 {
        font-size: 0.8rem;
    }

    /* Controls - single compact row */
    .viewer-controls {
        gap: 0.3rem;
    }

    .view-mode-toggle {
        padding: 2px;
    }

    .view-btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.65rem;
    }

    .page-navigation {
        padding: 0.2rem 0.3rem;
    }

    #prev-page,
    #next-page {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }

    #page-indicator {
        font-size: 0.65rem;
        min-width: 60px;
    }

    /* Chat */
    .chat-window {
        height: 70vh;
    }

    .chat-input {
        font-size: 16px; /* Prevent iOS zoom */
    }

    /* Inputs - prevent iOS zoom */
    input[type="text"],
    input[type="search"],
    textarea {
        font-size: 16px;
    }

    /* Modals - full screen */
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        margin: 0;
        border-radius: 0;
    }

    .modal-header {
        position: sticky;
        top: 0;
        background: var(--bg-tertiary);
        z-index: 10;
    }

    /* Splash page */
    .splash-page {
        padding: 1rem;
    }

    .splash-title {
        font-size: 1.15rem;
    }

    .splash-subtitle {
        font-size: 0.8rem;
    }

    .splash-years {
        font-size: 0.95rem;
    }

    .splash-description {
        font-size: 0.8rem;
    }

    .splash-enter-btn {
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
    }

    /* Mobile menu positioning */
    .mobile-menu {
        bottom: 65px;
        right: 8px;
    }
}

/* ============================================
   TOUCH-SPECIFIC STYLES
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger tap targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-small {
        min-height: 36px;
        min-width: 36px;
    }

    .doc-item {
        padding: 1rem;
    }

    /* Disable hover effects that don't work on touch */
    .doc-item:hover {
        background-color: transparent;
        border-color: transparent;
    }

    .doc-item:active {
        background-color: var(--bg-card);
        border-color: var(--border-color);
    }

    .timeline-marker:hover {
        transform: none;
    }

    .timeline-marker:active {
        transform: scale(0.98);
    }

    /* Always show timeline tooltips on tap */
    .timeline-marker:focus .timeline-tooltip {
        opacity: 1;
        visibility: visible;
    }
}

/* ============================================
   LANDSCAPE PHONE
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-window {
        height: 80vh;
    }

    .modal-content {
        max-height: 95vh;
    }

    .splash-page {
        padding: 1rem 2rem;
    }

    .splash-content {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 1rem;
    }

    .splash-icon,
    .splash-divider {
        display: none;
    }

    .mining-scene {
        order: 2;
    }
}

/* ============================================
   CATEGORY FILTER CHIPS
   ============================================ */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-filters::-webkit-scrollbar {
    display: none;
}

.category-chip {
    padding: 0.4rem 0.9rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
}

.category-chip:hover {
    background-color: var(--bg-card);
    border-color: var(--accent-muted);
    color: var(--text-primary);
}

.category-chip.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
}

@media (max-width: 768px) {
    .category-filters {
        padding: 0.5rem 0;
        gap: 0.4rem;
    }

    .category-chip {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
    }
}

/* ============================================
   PRINT MODAL
   ============================================ */
.print-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.print-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 1rem 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.print-option:hover {
    background: var(--bg-card);
    border-color: var(--accent);
    transform: translateX(4px);
}

.print-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.print-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Print-specific hidden container */
#print-container {
    display: none;
}

/* ============================================
   PRINT MEDIA QUERY
   ============================================ */
@media print {
    /* Hide everything except document content */
    body * {
        visibility: hidden;
    }

    #print-container,
    #print-container * {
        visibility: visible;
    }

    #print-container {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .print-page {
        page-break-after: always;
        padding: 0.5in;
    }

    .print-page:last-child {
        page-break-after: avoid;
    }

    .print-header {
        font-family: 'Crimson Text', Georgia, serif;
        font-size: 14pt;
        font-weight: bold;
        margin-bottom: 0.25in;
        padding-bottom: 0.1in;
        border-bottom: 1px solid #333;
    }

    .print-subheader {
        font-size: 10pt;
        color: #666;
        margin-bottom: 0.2in;
    }

    .print-content {
        font-family: 'Times New Roman', Times, serif;
        font-size: 11pt;
        line-height: 1.6;
        white-space: pre-wrap;
    }

    .print-footer {
        position: fixed;
        bottom: 0.25in;
        left: 0.5in;
        right: 0.5in;
        font-size: 9pt;
        color: #666;
        text-align: center;
        border-top: 1px solid #ccc;
        padding-top: 0.1in;
    }

    /* Hide UI elements */
    .header,
    .sidebar,
    .chat-widget,
    .modal,
    .mobile-menu,
    .viewer-header,
    .library-view,
    .split-view {
        display: none !important;
    }
}

/* ============================================
   DASHBOARD STYLES
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.dashboard-card h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* Stats Cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 150px;
    padding: 1rem 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 60px;
}

.bar-fill {
    width: 35px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-muted) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.3s ease;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}

.bar-value {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* Pie Chart */
.pie-chart-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.pie-chart {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 120px;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pie-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.pie-legend-count {
    margin-left: auto;
    font-weight: 600;
    color: var(--text-primary);
}

/* Entity Lists */
.entity-list {
    max-height: 200px;
    overflow-y: auto;
}

.entity-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.entity-list-item:last-child {
    border-bottom: none;
}

.entity-list-name {
    color: var(--text-primary);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 0.5rem;
}

.entity-list-count {
    background: var(--bg-tertiary);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* Financial Table */
.financial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.financial-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.financial-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.financial-table tr:last-child td {
    border-bottom: none;
}

.financial-amount {
    font-family: var(--font-mono);
    color: var(--warning);
    font-weight: 500;
}

/* Dashboard responsive */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

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

    .pie-chart-container {
        flex-direction: column;
    }

    .bar-chart {
        height: 120px;
    }

    .bar-fill {
        width: 25px;
    }
}

/* Dashboard loading state */
.dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 1rem;
}
