:root {
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --border-color: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --color-accent: #7c3aed;
    --color-accent-soft: rgba(124, 58, 237, 0.08);
    --color-accent-hover: #6d28d9;
    --color-danger: #ef4444;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.05);
    --transition: 0.2s cubic-bezier(0.16, 1, 0.3, 1);

    /* Paleta rosa pastel para el visor */
    --pdf-bg-light: #fff5f7;
    --pdf-bg-soft: #ffeef2;
    --pdf-bg-card: #fff8fa;
    --pdf-border: #f7d6e0;
    --rose-glow: rgba(244, 114, 182, 0.12);
    --rose-shadow-1: rgba(236, 72, 153, 0.08);
    --rose-shadow-2: rgba(236, 72, 153, 0.05);
    --rose-accent: #ec4899;
    --rose-accent-hover: #e0528a;
}

[data-theme="dark"] {
    --bg-primary: #1b1120;
    --bg-secondary: #241726;
    --border-color: #3b243f;
    --text-primary: #f3e8ff;
    --text-secondary: #c9a8d4;
    --text-muted: #8b6b9e;
    --color-accent: #f9a8d4;
    --color-accent-soft: rgba(249, 168, 212, 0.12);
    --color-accent-hover: #fbcfe8;
    --shadow-sm: 0 1px 3px rgba(236, 72, 153, 0.08);
    --shadow: 0 4px 10px rgba(236, 72, 153, 0.1), 0 2px 6px rgba(236, 72, 153, 0.06);
    --pdf-dark-bg: #1b1120;
    --pdf-dark-surface: #241726;
    --pdf-dark-border: #3b243f;
    --rose-primary: #f9a8d4;
    --rose-soft: #fbcfe8;
    --rose-accent: #ec4899;
    --rose-glow-dark: rgba(236, 72, 153, 0.18);

    /* Adaptación de la paleta rosa pastel para el visor en modo oscuro */
    --pdf-bg-light: #2d1830;
    --pdf-bg-soft: #381f3b;
    --pdf-bg-card: #2c1a2e;
    --pdf-border: #4a2d52;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); background: var(--bg-primary); color: var(--text-primary); line-height: 1.5; overflow: hidden; transition: background 0.35s ease, color 0.35s ease; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.overlay { position: fixed; inset: 0; background: rgba(27, 17, 32, 0.4); backdrop-filter: blur(2px); z-index: 40; opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s; }
.overlay.on { opacity: 1; visibility: visible; }
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text-primary); color: var(--bg-secondary); box-shadow: 0 10px 25px -5px rgba(236, 72, 153, 0.3); border-radius: 9999px; padding: 10px 20px; font-size: 0.825rem; font-weight: 700; transition: all 0.25s cubic-bezier(0.16,1,0.3,1); opacity: 0; z-index: 100; pointer-events: none; white-space: nowrap; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.tracking-restore-btn { position: fixed; right: 16px; bottom: 100px; z-index: 60; display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--rose-accent); color: white; border: none; border-radius: 9999px; box-shadow: 0 10px 20px -5px rgba(236, 72, 153, 0.35); font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: transform 0.2s; }
.tracking-restore-btn:hover { transform: scale(1.05); }

.app-layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar { width: 260px; flex-shrink: 0; background: var(--bg-secondary); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; padding: 24px 16px; position: sticky; top: 0; height: 100vh; z-index: 30; transition: transform 0.3s; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; padding: 0 8px; }
.sidebar-logo { width: 40px; height: 40px; background: var(--color-accent-soft); color: var(--color-accent); border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(236, 72, 153, 0.15); }
.sidebar-brand-text { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); display: block; line-height: 1.2; }
.sidebar-brand-sub { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav-btn { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: none; background: transparent; color: var(--text-secondary); border-radius: var(--radius); cursor: pointer; font-size: 0.875rem; font-weight: 600; transition: all var(--transition); width: 100%; position: relative; overflow: hidden; }
.sidebar-nav-btn:hover { background: var(--bg-primary); color: var(--text-primary); }
.sidebar-nav-btn.active { background: var(--color-accent-soft); color: var(--color-accent); }
.sidebar-nav-btn svg { transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), color 0.25s ease; }
.sidebar-nav-btn:hover svg { transform: translateX(4px) scale(1.05); color: var(--color-accent) !important; }
.sidebar-nav-btn::after { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%) scaleY(0.2); width: 4px; height: 20px; background-color: var(--color-accent); border-radius: 0 4px 4px 0; opacity: 0; transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16,1,0.3,1); }
.sidebar-nav-btn.active::after { opacity: 1; transform: translateY(-50%) scaleY(1); }
.sidebar-theme-btn { margin-top: auto; background: none; border: 1px solid var(--border-color); border-radius: var(--radius); padding: 0; cursor: pointer; transition: all var(--transition); }
.sidebar-theme-btn-inner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text-secondary); font-size: 0.875rem; font-weight: 600; width: 100%; }
.sidebar-theme-btn:hover { background: var(--bg-primary); }
#sidebarThemeIcon { transition: transform 0.5s ease; }
.sidebar-theme-btn:hover #sidebarThemeIcon { transform: rotate(30deg); }

.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg-primary); }
.top-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); z-index: 20; }
.top-bar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-toggle { display: none; padding: 8px; background: none; border: none; color: var(--text-secondary); cursor: pointer; border-radius: var(--radius-sm); }
.menu-toggle:hover { background: var(--bg-primary); color: var(--text-primary); }
.top-bar-info { min-width: 0; }
.top-bar-info h2 { font-size: 1rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-bar-info p { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.top-bar-actions { display: flex; align-items: center; gap: 8px; }
.zoom-badge { font-size: 0.75rem; font-weight: 700; color: var(--rose-accent); padding: 6px 10px; background: var(--pdf-bg-card); border: 1px solid var(--pdf-border); border-radius: var(--radius-sm); }
.icon-btn { padding: 8px; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; transition: all var(--transition); display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--pdf-bg-soft); border-color: var(--rose-accent); color: var(--rose-accent); }
.icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.shortcuts-btn { font-size: 0.875rem; font-weight: 700; width: 36px; height: 36px; }
.top-bar-divider { width: 1px; height: 24px; background: var(--border-color); margin: 0 4px; }

.content-scroll { flex: 1; overflow-y: auto; padding: 24px; }

.panel-section { display: block; }
.panel-section.hidden { display: none; }
.panel-section:not(.hidden) { animation: panelEntrance 0.5s cubic-bezier(0.16,1,0.3,1) forwards; }

@keyframes panelEntrance { from { opacity: 0; transform: translateY(16px) scale(0.995); filter: blur(2px); } to { opacity: 1; transform: translateY(0) scale(1); filter: none; } }

.top-cards-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: all 0.35s cubic-bezier(0.16,1,0.3,1); }
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
[data-theme="dark"] .card:hover { box-shadow: 0 16px 36px -12px rgba(236, 72, 153, 0.25); border-color: var(--rose-accent) !important; }
.card-glow { position: absolute; top: 0; right: 0; width: 128px; height: 128px; border-radius: 50%; filter: blur(40px); opacity: 0.4; transition: transform 0.5s; }
.card-upload .card-glow { background: rgba(249, 168, 212, 0.25); }
.card-voice .card-glow { background: rgba(244, 114, 182, 0.25); }
.card:hover .card-glow { transform: scale(1.15); }
.card-inner { position: relative; z-index: 1; }
.card-icon-wrapper { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.card-upload .card-icon-wrapper { background: rgba(249, 168, 212, 0.15); color: var(--rose-accent); }
.card-voice .card-icon-wrapper { background: var(--color-accent-soft); color: var(--color-accent); }
.card-title { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.card-desc { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; margin-bottom: 24px; }
.card-actions { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 1; }
.card-status { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; text-align: center; margin-top: 8px; }

/* ── BOTONES CORREGIDOS ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius); font-weight: 600; font-size: 0.875rem; border: 1px solid transparent; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn:active { transform: scale(0.96) !important; }
.btn-primary { background: var(--rose-accent); color: white; border-color: var(--rose-accent); box-shadow: 0 1px 3px rgba(236, 72, 153, 0.25); }
.btn-primary:hover { background: var(--rose-accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: var(--bg-secondary); border-color: var(--border-color); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-primary); color: var(--text-primary); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-icon-action { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-primary); border: 1px solid var(--border-color); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--transition); }
.btn-icon-action:hover { background: var(--border-color); color: var(--text-primary); }
.btn-icon-action:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-search { background: var(--text-primary); color: var(--bg-secondary); }
.btn-search:hover { opacity: 0.9; }
.btn-go { background: var(--rose-accent); color: white; font-weight: 700; }
.btn-go:hover { background: var(--rose-accent-hover); }
.btn-ia-action { background: var(--bg-primary); border: 1px solid var(--border-color); color: var(--text-secondary); font-size: 0.75rem; font-weight: 700; flex: 1; }
.btn-ia-action:hover { background: var(--color-accent-soft); color: var(--color-accent); }
.btn-ia-chat { background: var(--text-primary); color: var(--bg-secondary); font-size: 0.75rem; font-weight: 700; padding: 6px 16px; }
.btn-ia-chat:hover { opacity: 0.9; }
.btn-ia-chat:disabled { opacity: 0.5; cursor: not-allowed; }

/* Controles Premium de Voz */
.voice-premium-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}
.voice-secondary-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Botón de reproducción principal */
.btn-play-premium {
    width: 72px; height: 72px; border-radius: 50%;
    background: var(--rose-accent); color: white;
    border: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 8px 20px rgba(236, 72, 153, 0.3); transition: all 0.3s ease; position: relative;
}
.btn-play-premium svg { width: 28px; height: 28px; fill: white; color: white; }
.btn-play-premium:hover { box-shadow: 0 12px 28px rgba(236, 72, 153, 0.45); transform: scale(1.05); }
.btn-play-premium:active { transform: scale(0.95); }
.btn-play-premium:disabled { opacity: 0.5; box-shadow: none; cursor: not-allowed; }
.btn-play-premium.playing::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--rose-accent); animation: pulse-ring 1.5s ease-out infinite; }
@keyframes pulse-ring { 0% { transform: scale(0.9); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
.btn-play-premium::before {
    content: ''; position: absolute; inset: -6px; border-radius: 50%; background: var(--rose-accent);
    opacity: 0.15; z-index: -1; transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), opacity 0.3s ease;
}
.btn-play-premium:hover::before { opacity: 0.35; transform: scale(1.1); animation: premiumPulse 2.2s infinite ease-out; }
@keyframes premiumPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.5); }
    60% { transform: scale(1.18); box-shadow: 0 0 0 12px rgba(236, 72, 153, 0); }
    100% { transform: scale(1.22); box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); }
}

/* Botones secundarios de voz (pausa y detener) */
.btn-voice-secondary {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--border-color); background: var(--bg-secondary);
    cursor: pointer; transition: all 0.2s ease;
}
.btn-voice-secondary svg { width: 18px; height: 18px; }
.btn-voice-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-voice-secondary:active { transform: scale(0.94); }

.btn-pause { color: #d97706; border-color: rgba(217, 119, 6, 0.3); background: rgba(217, 119, 6, 0.06); }
.btn-pause svg { fill: #d97706; }
.btn-pause:hover:not(:disabled) { background: rgba(217, 119, 6, 0.12); border-color: #d97706; }

.btn-stop { color: #dc2626; border-color: rgba(220, 38, 38, 0.3); background: rgba(220, 38, 38, 0.06); }
.btn-stop svg { fill: #dc2626; }
.btn-stop:hover:not(:disabled) { background: rgba(220, 38, 38, 0.12); border-color: #dc2626; }

[data-theme="dark"] .btn-pause { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08); }
[data-theme="dark"] .btn-pause svg { fill: #fbbf24; }
[data-theme="dark"] .btn-pause:hover:not(:disabled) { background: rgba(251, 191, 36, 0.15); }
[data-theme="dark"] .btn-stop { color: #f87171; border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); }
[data-theme="dark"] .btn-stop svg { fill: #f87171; }
[data-theme="dark"] .btn-stop:hover:not(:disabled) { background: rgba(248, 113, 113, 0.15); }

.progress-bar-wrapper { height: 4px; background: var(--pdf-border); border-radius: 2px; margin: 12px 0; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--rose-accent); border-radius: 2px; transition: width 0.3s; }

.search-bar-wrapper { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.search-bar { display: flex; align-items: center; gap: 12px; background: var(--pdf-bg-card); border: 1px solid var(--pdf-border); border-radius: var(--radius); padding: 6px 16px; transition: border-color 0.2s, box-shadow 0.2s; }
.search-bar:focus-within { border-color: var(--rose-accent); box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15); }
.search-icon { color: var(--text-muted); flex-shrink: 0; }
.search-input { flex: 1; border: none; background: transparent; padding: 10px 8px; font-size: 0.875rem; color: var(--text-primary); outline: none; font-weight: 600; }
.search-input::placeholder { color: var(--text-muted); }
.search-results { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; margin-top: 8px; padding-left: 4px; }

.split-view { display: grid; grid-template-columns: 7fr 5fr; gap: 24px; align-items: start; }
.split-left, .split-right { min-width: 0; }
.pdf-viewer-container {
    background: var(--pdf-bg-card); border: 1px solid var(--pdf-border);
    border-radius: var(--radius-lg); overflow: hidden;
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.08);
    display: flex; flex-direction: column;
    transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}
[data-theme="dark"] .pdf-viewer-container { background: var(--pdf-dark-surface); border-color: var(--pdf-dark-border); box-shadow: 0 4px 20px rgba(236, 72, 153, 0.15); }

.pdf-stage {
    flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 28px;
    background: linear-gradient(180deg, var(--pdf-bg-light) 0%, var(--pdf-bg-soft) 100%);
    min-height: 500px; max-height: 750px; overflow: auto;
    transition: background 0.35s ease;
    position: relative;
}
.pdf-stage canvas {
    display: block; max-width: none; height: auto; border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15), 0 20px 60px rgba(0,0,0,0.20), 0 0 40px var(--rose-glow);
    background: white; transition: box-shadow 0.35s ease; position: relative; z-index: 1;
}
[data-theme="dark"] .pdf-stage { background: radial-gradient(circle at top, #2d1830, #1b1120); }
[data-theme="dark"] .pdf-stage canvas {
    background: white;
    box-shadow: 0 8px 20px rgba(0,0,0,0.35), 0 20px 60px rgba(0,0,0,0.45), 0 0 50px var(--rose-glow-dark);
}

.empty-state { text-align: center; max-width: 320px; padding: 24px; }
.empty-icon-wrapper { width: 64px; height: 64px; border-radius: 50%; background: rgba(244, 114, 182, 0.1); color: var(--rose-accent); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; border: 1px solid rgba(244, 114, 182, 0.2); }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; line-height: 1.6; }

/* Panel de seguimiento con scroll libre */
.tracking-panel { background: var(--pdf-bg-card); border-top: 1px solid var(--pdf-border); padding: 16px; max-height: 192px; overflow-y: auto; scroll-behavior: smooth; }
.tracking-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tracking-header span { font-size: 0.75rem; font-weight: 700; color: var(--rose-accent); text-transform: uppercase; letter-spacing: 0.05em; }
.tracking-close-btn { background: none; border: none; color: var(--text-muted); font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.tracking-close-btn:hover { background: var(--pdf-border); color: var(--rose-accent); }
.tracking-content { font-size: 0.875rem; color: var(--text-secondary); font-weight: 600; line-height: 2; text-align: justify; word-break: break-word; }

/* Palabra individual */
.tracking-word {
    display: inline-block; padding: 2px 5px; margin: 1px 2px; border-radius: 5px;
    color: var(--text-secondary); font-weight: 500; cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16,1,0.3,1);
}
.tracking-word:hover { background: rgba(236, 72, 153, 0.12); color: var(--rose-accent); }
/* Palabra activa durante la lectura */
.tracking-word.active-word {
    background: var(--rose-accent); color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4); font-weight: 700;
    transform: scale(1.08);
}

/* Línea activa: se resalta todo el renglón */
.tracking-line-active {
    background: rgba(236, 72, 153, 0.08);
    border-radius: 6px;
    transition: background 0.3s ease;
}

.pdf-zoom-controls {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-top: 1px solid var(--pdf-border);
    background: rgba(255, 245, 247, 0.85); backdrop-filter: blur(12px);
    transition: background 0.35s ease;
}
[data-theme="dark"] .pdf-zoom-controls { background: rgba(36, 23, 38, 0.85); border-top-color: var(--pdf-dark-border); }
.page-nav { display: flex; align-items: center; gap: 8px; }
.page-input { width: 48px; text-align: center; border: 1px solid var(--pdf-border); background: var(--pdf-bg-card); padding: 6px; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 700; color: var(--text-primary); outline: none; }
.page-input:focus { border-color: var(--rose-accent); }
.page-count-text { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

.ia-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.ia-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--pdf-border); }
.ia-card-header h3 { font-size: 0.875rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.ia-title-icon { font-size: 0.75rem; padding: 4px; background: rgba(244, 114, 182, 0.1); color: var(--rose-accent); border-radius: 6px; }
.ia-badge { font-size: 9px; font-weight: 800; color: var(--rose-accent); background: rgba(244, 114, 182, 0.12); padding: 4px 10px; border-radius: 9999px; text-transform: uppercase; letter-spacing: 0.1em; }
.ia-card-body { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.7; font-weight: 500; padding: 8px 0; }
.ia-placeholder { font-style: italic; color: var(--text-muted); font-weight: 600; }
.ia-keywords { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.ia-keywords span { font-size: 10px; font-weight: 700; padding: 4px 8px; background: rgba(244, 114, 182, 0.08); color: var(--rose-accent); border-radius: 6px; }
.ia-meta { font-size: 10px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 16px; }
.ia-actions { display: flex; gap: 8px; border-top: 1px solid var(--pdf-border); padding-top: 16px; }
.ia-close-btn { background: none; border: none; color: var(--text-muted); font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.ia-close-btn:hover { background: var(--pdf-border); color: var(--rose-accent); }
.ask-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.ask-input { flex: 1; padding: 12px; background: var(--pdf-bg-card); border: 1px solid var(--pdf-border); border-radius: var(--radius); font-size: 0.75rem; font-weight: 700; color: var(--text-primary); outline: none; }
.ask-input:focus { border-color: var(--rose-accent); box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12); }
.ask-history { max-height: 224px; overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 8px; }
.ask-bubble { padding: 10px 14px; border-radius: 12px; font-size: 0.8125rem; font-weight: 500; line-height: 1.5; animation: bubbleAppear 0.25s cubic-bezier(0.16,1,0.3,1); }
.ask-bubble.user { background: rgba(244, 114, 182, 0.12); color: var(--rose-accent); border-top-right-radius: 2px; margin-left: 20px; text-align: right; }
.ask-bubble.ai { background: var(--bg-primary); color: var(--text-secondary); border-top-left-radius: 2px; margin-right: 20px; }
@keyframes bubbleAppear { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.mini-map { position: fixed; bottom: 24px; right: 24px; background: rgba(255, 245, 247, 0.95); backdrop-filter: blur(8px); border: 1px solid var(--pdf-border); border-radius: 9999px; padding: 10px 20px; box-shadow: 0 10px 30px -5px rgba(236, 72, 153, 0.15); display: flex; align-items: center; gap: 16px; z-index: 35; }
[data-theme="dark"] .mini-map { background: rgba(36, 23, 38, 0.95); border-color: var(--pdf-dark-border); }
.mini-map-label { font-size: 10px; font-weight: 700; color: var(--rose-accent); text-transform: uppercase; letter-spacing: 0.1em; }
.mini-map-bar { width: 112px; height: 4px; background: var(--pdf-border); border-radius: 2px; position: relative; }
.mini-map-progress { height: 100%; background: var(--rose-accent); border-radius: 2px; transition: width 0.3s; }
.mini-map-marker { position: absolute; top: -4px; width: 12px; height: 12px; background: var(--rose-accent); border: 2px solid white; border-radius: 50%; box-shadow: 0 1px 3px rgba(236, 72, 153, 0.4); transform: translateX(-50%); transition: left 0.3s; }

.library-container { max-width: 900px; margin: 0 auto; }
.library-header { margin-bottom: 24px; }
.library-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.library-header p { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.library-card { background: var(--bg-secondary); border: 1px solid var(--pdf-border); border-radius: var(--radius-lg); padding: 20px; cursor: pointer; transition: all 0.35s cubic-bezier(0.16,1,0.3,1); }
.library-card:hover { transform: translateY(-4px) scale(1.01); border-color: var(--rose-accent); box-shadow: 0 16px 32px -12px rgba(236, 72, 153, 0.25); }
.library-card h4 { font-size: 0.875rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.library-card p { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }
.library-empty { color: var(--text-muted); font-weight: 500; font-style: italic; font-size: 0.75rem; }

.voice-settings { max-width: 600px; margin: 0 auto; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-sm); }
.settings-header { text-align: center; padding-bottom: 16px; border-bottom: 1px solid var(--pdf-border); margin-bottom: 24px; }
.settings-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.settings-header h2 { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.settings-header p { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.settings-field { margin-bottom: 20px; }
.settings-label { font-size: 0.75rem; font-weight: 700; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 8px; }
.settings-hint { font-size: 10px; color: var(--text-muted); font-weight: 700; display: block; margin-top: 4px; }
.settings-select-wrapper { position: relative; }
.settings-select { width: 100%; padding: 12px 48px 12px 16px; background: var(--pdf-bg-card); border: 1px solid var(--pdf-border); border-radius: var(--radius); font-size: 0.875rem; font-weight: 700; color: var(--text-primary); appearance: none; cursor: pointer; outline: none; }
.settings-select:focus { border-color: var(--rose-accent); box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.12); }
.settings-select-chevron { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--rose-accent); pointer-events: none; }
.settings-field-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.settings-val { font-size: 0.75rem; font-weight: 700; color: var(--rose-accent); }
.settings-slider { width: 100%; height: 4px; background: var(--pdf-border); border-radius: 2px; appearance: none; cursor: pointer; accent-color: var(--rose-accent); }
.settings-field-toggle { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--pdf-border); }
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--pdf-border); border-radius: 24px; transition: 0.3s; }
.toggle-slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: 0.3s; box-shadow: 0 1px 3px rgba(236, 72, 153, 0.15); }
.toggle-switch input:checked + .toggle-slider { background: var(--rose-accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }
.settings-reset { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--pdf-border); }
.settings-reset h3 { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }
.settings-reset p { font-size: 10px; color: var(--text-muted); }

.modal-overlay { position: fixed; inset: 0; background: rgba(27, 17, 32, 0.5); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; transition: opacity 0.3s; }
.modal-content { background: var(--bg-secondary); padding: 28px; border-radius: var(--radius-lg); max-width: 360px; width: 90%; border: 1px solid var(--pdf-border); box-shadow: 0 20px 40px rgba(236, 72, 153, 0.2); }
.modal-header { margin-bottom: 16px; }
.modal-header h2 { font-size: 1rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.modal-header p { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.shortcuts-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.shortcuts-list li { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--pdf-border); font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; }
kbd { padding: 2px 8px; background: var(--pdf-bg-card); border: 1px solid var(--pdf-border); border-radius: 4px; font-family: var(--font-mono); font-size: 10px; font-weight: 600; box-shadow: 0 1px 1px rgba(236, 72, 153, 0.15); }

#shortcutsModal { opacity: 0; pointer-events: none; transition: opacity 0.3s cubic-bezier(0.16,1,0.3,1); display: flex !important; }
#shortcutsModal:not(.hidden) { opacity: 1; pointer-events: auto; }
#shortcutsModal .modal-content { transform: scale(0.92) translateY(12px); transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1); }
#shortcutsModal:not(.hidden) .modal-content { transform: scale(1) translateY(0); }
#shortcutsModal.hidden { display: none !important; pointer-events: none; }

body.focus-mode .sidebar,
body.focus-mode .top-cards-row,
body.focus-mode .search-bar-wrapper,
body.focus-mode #iaPanel,
body.focus-mode .top-bar-info,
body.focus-mode .zoom-badge,
body.focus-mode #zoomInBtn,
body.focus-mode #zoomOutBtn,
body.focus-mode #shortcutsHelpBtn { display: none !important; }
body.focus-mode .split-view { grid-template-columns: 1fr !important; max-width: 800px; margin: 0 auto; }

@media (max-width: 1023px) {
    .sidebar { position: fixed; left: -260px; top: 0; bottom: 0; box-shadow: 20px 0 50px rgba(236, 72, 153, 0.2); z-index: 50; }
    .sidebar.open { transform: translateX(260px); }
    .menu-toggle { display: flex; }
    .top-cards-row { grid-template-columns: 1fr; }
    .split-view { grid-template-columns: 1fr; }
}