/* ============================================
   DIGITAL LAWYER — SaaS Brand Design System
   Friendly Professional Legal AI Assistant
   ============================================ */

:root {
    color-scheme: light;
    
    /* Typography - Premium Fonts */
    --font-heading: 'Instrument Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* ===== Premium Color Palette ===== */
    /* Refined warm paper with elegant contrast */
    --color-bg: #faf8f5;
    --color-surface: #ffffff;
    --color-surface-muted: #f7f5f2;
    --color-surface-hover: #f3f1ee;
    --color-surface-elevated: #ffffff;
    --color-border: rgba(0, 0, 0, 0.06);
    --color-border-strong: rgba(0, 0, 0, 0.12);

    /* Text - Deep and sophisticated */
    --color-text-primary: #1a1a1a;
    --color-text-secondary: #6b6b6b;
    --color-text-muted: #9ca3af;
    --color-text-inverse: #ffffff;

    /* Brand Colors - Refined Blue */
    --color-primary: #1e3a5f;
    --color-primary-light: #2563eb;
    --color-primary-soft: rgba(37, 99, 235, 0.06);
    
    /* Secondary: Premium Blue */
    --color-secondary: #2563eb;
    --color-secondary-light: #3b82f6;
    --color-secondary-soft: rgba(37, 99, 235, 0.08);
    
    /* Accent: Elegant Violet */
    --color-accent-purple: #7c3aed;
    --color-accent-purple-light: #8b5cf6;
    --color-accent-purple-soft: rgba(124, 58, 237, 0.08);
    
    /* CTA: Sophisticated accent */
    --color-accent: #2563eb;
    --color-accent-hover: #1d4ed8;
    --color-accent-soft: rgba(37, 99, 235, 0.08);
    
    /* CTA Buttons - Deep charcoal */
    --color-cta: #111827;
    --color-cta-hover: #1f2937;
    --color-cta-text: #ffffff;
    --color-cta-rgb: 17, 24, 39;

    /* Semantic Colors - Muted and refined */
    --color-success: #059669;
    --color-success-soft: rgba(5, 150, 105, 0.08);
    --color-warning: #d97706;
    --color-warning-soft: rgba(217, 119, 6, 0.08);
    --color-danger: #dc2626;
    --color-danger-soft: rgba(220, 38, 38, 0.08);
    --color-info: #2563eb;
    --color-info-soft: rgba(37, 99, 235, 0.08);

    /* Border Radius - Softer, more premium */
    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-pill: 999px;

    /* Shadows - Subtle and layered */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.08);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.02), 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-premium: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 20px -5px rgba(0, 0, 0, 0.04);
    
    /* Focus */
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.15);
    
    /* Transitions - Smooth and elegant */
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: 0.15s ease;
    --transition-premium: 0.5s cubic-bezier(0.16, 1, 0.3, 1);

    /* Z-index System */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-header: 300;
    --z-modal: 400;
    --z-tooltip: 500;

    /* Effects */
    --blur-light: 8px;
    --blur-medium: 16px;
    --blur-heavy: 24px;

    /* Layout - More generous spacing */
    --layout-horizontal-padding: clamp(24px, 5vw, 64px);
}

/* ===== Dark Theme - Premium ===== */
html[data-theme='dark'] {
    color-scheme: dark;
    
    --color-bg: #0f0f0f;
    --color-surface: #1a1a1a;
    --color-surface-muted: #242424;
    --color-surface-hover: #2a2a2a;
    --color-surface-elevated: #1f1f1f;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-strong: rgba(255, 255, 255, 0.15);

    --color-text-primary: #fafafa;
    --color-text-secondary: rgba(250, 250, 250, 0.7);
    --color-text-muted: rgba(250, 250, 250, 0.45);
    --color-text-inverse: #0f0f0f;

    --color-primary: #60a5fa;
    --color-primary-light: #93c5fd;
    --color-primary-soft: rgba(96, 165, 250, 0.12);

    --color-cta: #3b82f6;
    --color-cta-hover: #60a5fa;
    --color-cta-text: #ffffff;
    --color-cta-rgb: 59, 130, 246;

    --color-success: #34d399;
    --color-warning: #fbbf24;
    --color-danger: #f87171;
    --color-info: #60a5fa;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.7);
    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-premium: 0 4px 12px rgba(0, 0, 0, 0.4);
    
    --focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.25);
}

/* ===== Global Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

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

/* Page Load Animations */
.hero__content {
    animation: fadeInUp 0.5s ease-out;
}

.hero__panel {
    animation: slideInRight 0.5s ease-out 0.15s backwards;
}

.workspace__header {
    animation: fadeInUp 0.4s ease-out;
}

.workspace__panel {
    animation: fadeIn 0.4s ease-out 0.1s backwards;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-surface-muted) 25%,
        var(--color-surface-hover) 50%,
        var(--color-surface-muted) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 1.5em;
    width: 40%;
    margin-bottom: 1em;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-md);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* ===== Global Styles ===== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text-primary);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-base), color var(--transition-base);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover,
a:focus-visible {
    text-decoration: none;
}

.app-body {
    background: var(--color-bg);
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
}

/* ===== Header ===== */
.app-header {
    position: sticky;
    top: 16px;
    z-index: var(--z-header);
    margin: 16px var(--layout-horizontal-padding) 32px;
    padding: 12px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: rgba(248, 244, 232, 0.92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    box-shadow: var(--shadow-md);
    transition: background-color var(--transition-base), 
                border-color var(--transition-base),
                box-shadow var(--transition-base);
}

html[data-theme='dark'] .app-header {
    background: rgba(51, 59, 68, 0.65);
    border-color: var(--color-border);
}

.app-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: none;
    padding: 0;
    margin: 0 auto;
}

/* Header Left Side (Logo + About) */
.app-header__left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Header Right Side (Nav + Actions) */
.app-header__right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-nav__link--about {
    margin-left: 4px;
}

/* ===== Landing Page Header Navigation ===== */
.app-header__nav-landing {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.app-header__nav-link {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), 
                background-color var(--transition-fast);
}

.app-header__nav-link:hover {
    color: var(--color-text-primary);
    background-color: var(--color-surface-muted);
}

.app-header__nav-link:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Responsive: hide landing nav on smaller screens */
@media (max-width: 992px) {
    .app-header__nav-landing {
        display: none;
    }
}

/* ===== Mobile Menu Toggle (Hamburger) ===== */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background-color: var(--color-surface-muted);
}

.mobile-menu-toggle__bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--color-text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger -> X animation when open */
.mobile-menu-toggle.is-active .mobile-menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.mobile-menu-toggle.is-active .mobile-menu-toggle__bar:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.is-active .mobile-menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: flex;
    }
}

/* ===== Mobile Navigation Drawer ===== */
.mobile-nav {
    display: none;
}

@media (max-width: 992px) {
    .mobile-nav {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9998;
        pointer-events: none;
        visibility: hidden;
        opacity: 0;
        transition: visibility 0.3s, opacity 0.3s;
    }

    .mobile-nav.is-open {
        pointer-events: auto;
        visibility: visible;
        opacity: 1;
    }

    .mobile-nav__overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .mobile-nav.is-open .mobile-nav__overlay {
        opacity: 1;
    }

    .mobile-nav__panel {
        position: absolute;
        top: 80px;
        right: 16px;
        left: 16px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 12px;
        background: var(--color-surface, #fff);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg, 0 10px 40px rgba(0,0,0,0.15));
        transform: translateY(-12px);
        opacity: 0;
        transition: transform 0.3s ease, opacity 0.3s ease;
    }

    html[data-theme='dark'] .mobile-nav__panel {
        background: rgba(51, 59, 68, 0.97);
    }

    .mobile-nav.is-open .mobile-nav__panel {
        transform: translateY(0);
        opacity: 1;
    }

    .mobile-nav__link {
        display: block;
        padding: 12px 16px;
        font-family: var(--font-sans);
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--color-text-secondary);
        text-decoration: none;
        border-radius: var(--radius-sm);
        transition: color var(--transition-fast),
                    background-color var(--transition-fast);
    }

    .mobile-nav__link:hover {
        color: var(--color-text-primary);
        background-color: var(--color-surface-muted);
    }
}

/* ===== Logo ===== */
.app-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-primary);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    transition: background-color var(--transition-base),
                border-color var(--transition-base);
}

.app-logo:hover,
.app-logo:focus-visible {
    outline: none;
    background: var(--color-surface-muted);
    border-color: var(--color-border);
}

.app-logo__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 1rem;
}

.app-logo__svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
}

.app-logo__icon--cyberlawyer {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: none;
    overflow: hidden;
    transition: transform var(--transition-smooth), 
                box-shadow var(--transition-smooth);
}

.app-logo:hover .app-logo__icon--cyberlawyer {
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.4);
}

.app-logo__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.app-logo__text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
    transition: color var(--transition-base);
}

/* Hide logo graphics but keep app name text visible */
.app-logo__icon,
.app-logo__svg,
.app-logo__img,
.custom-logo__icon,
.custom-logo__svg,
.custom-logo__img {
    display: none !important;
}

/* ===== Navigation ===== */
.app-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.875rem;
}

.app-nav__link {
    position: relative;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-family: var(--font-sans);
    font-weight: 500;
    transition: color var(--transition-base),
                background-color var(--transition-base);
}

.app-nav__link:hover,
.app-nav__link:focus-visible {
    color: var(--color-text-primary);
    background: var(--color-surface-muted);
    outline: none;
}

.app-nav__link--active {
    color: var(--color-cta-text);
    background: var(--color-cta);
}

.app-nav__link--active:hover {
    background: var(--color-cta-hover);
}

/* Support Button in Navigation */
.app-nav__link--support {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%);
    color: white;
    transition: all var(--transition-base);
}

.app-nav__link--support:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.app-nav__link--support i {
    font-size: 0.9rem;
}

/* ===== Header Actions ===== */
.app-header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.app-header__chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--color-accent) 0%, #fb923c 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-base),
                box-shadow var(--transition-base);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.app-header__chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(249, 115, 22, 0.35);
}

.app-header__chat-btn:active {
    transform: translateY(0);
}

.app-header__chat-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), 0 4px 12px rgba(249, 115, 22, 0.25);
}

.app-header__chat-btn i {
    font-size: 0.9rem;
}

/* ===== Theme Switcher ===== */
.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    transition: background-color var(--transition-base), 
                border-color var(--transition-base);
}

.theme-switcher__btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-xs);
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color var(--transition-base), 
                color var(--transition-base);
}

.theme-switcher__btn:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-hover);
}

.theme-switcher__btn.is-active,
.theme-switcher__btn[aria-pressed="true"] {
    background: var(--color-surface);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-sm);
}

.theme-switcher__btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.app-status-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.app-status-button:hover {
    background: var(--color-surface-hover);
}

.app-status-button__icon {
    display: grid;
    place-items: center;
}

/* ===== Main Content ===== */
.app-main {
    flex: 1;
    padding: 0 var(--layout-horizontal-padding) 48px;
}

.app-main > .container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== Footer ===== */
.app-footer {
    margin-top: auto;
    padding: 20px var(--layout-horizontal-padding);
    background: var(--color-surface-muted);
    border-top: 1px solid var(--color-border);
}

.app-footer__inner {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.app-footer__accent {
    color: var(--color-text-primary);
    font-weight: 600;
}

.app-footer__meta {
    color: var(--color-text-muted);
}

.app-footer__credit {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    opacity: 0.7;
}

/* ===== Hero Section ===== */
.hero {
    display: block;
    padding: 1rem 0 2.5rem;
}

.hero__content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 640px;
}

.hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-pill);
    background: var(--color-secondary-soft);
    color: var(--color-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    line-height: 1.15;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
}

.hero__lead {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 1.05rem;
    line-height: 1.65;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Main CTA Button */
.hero__primary-action {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 3.5rem;
    border-radius: var(--radius-lg);
    border: none;
    background: linear-gradient(135deg, var(--color-primary) 0%, #1e40af 50%, var(--color-secondary) 100%);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 0;
    box-shadow: 
        0 0 30px rgba(59, 130, 246, 0.35),
        0 0 60px rgba(59, 130, 246, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.15);
    animation: magic-pulse 3s ease-in-out infinite;
    overflow: hidden;
}

.hero__primary-action::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.12) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.hero__primary-action:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 0 45px rgba(59, 130, 246, 0.45),
        0 0 90px rgba(59, 130, 246, 0.25),
        0 16px 48px rgba(0, 0, 0, 0.2);
}

.hero__primary-action:hover::before {
    opacity: 1;
}

.hero__primary-action:active {
    transform: translateY(-1px) scale(0.99);
}

.hero__primary-action::after {
    content: "";
    position: absolute;
    inset: -1.5rem;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 50%, rgba(96, 165, 250, 0.3), rgba(59, 130, 246, 0.15) 40%, transparent 70%);
    filter: blur(16px);
    opacity: 0.7;
    z-index: -1;
    animation: hero-magic-glow 3.5s ease-in-out infinite;
}

.hero__primary-action i {
    transition: transform 0.3s ease;
}

.hero__primary-action:hover i {
    transform: translateX(4px) rotate(-10deg);
}

@keyframes magic-pulse {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(59, 130, 246, 0.35),
            0 0 60px rgba(59, 130, 246, 0.2),
            0 8px 32px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(59, 130, 246, 0.45),
            0 0 80px rgba(59, 130, 246, 0.25),
            0 8px 32px rgba(0, 0, 0, 0.15);
    }
}

@keyframes hero-magic-glow {
    0%, 100% {
        transform: scale(0.95);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.85;
    }
}

html[data-theme='dark'] .hero__primary-action {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%);
    box-shadow: 
        0 0 40px rgba(96, 165, 250, 0.35),
        0 0 80px rgba(59, 130, 246, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Responsive Primary Button */
@media (max-width: 992px) {
    .hero__primary-action {
        padding: 1.5rem 2.5rem;
        font-size: 1.5rem;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .hero__primary-action {
        padding: 1.25rem 2rem;
        font-size: 1.25rem;
        gap: 0.85rem;
    }
    
    .hero__content h1 {
        font-size: 1.65rem;
    }
    
    .hero__lead {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .hero__primary-action {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
        gap: 0.65rem;
        width: 100%;
        justify-content: center;
    }
}

.hero__secondary-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition-base), background-color var(--transition-base);
}

.hero__secondary-action:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-muted);
}

/* ===== Hero Panel ===== */
.hero__panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    transition: box-shadow var(--transition-base),
                border-color var(--transition-base);
}

.hero__panel:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-md);
}

.hero__panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-text-primary);
}

.hero__panel-refresh {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: background-color var(--transition-base), 
                color var(--transition-base),
                border-color var(--transition-base);
}

.hero__panel-refresh:hover {
    color: var(--color-text-primary);
    background: var(--color-surface-muted);
    border-color: var(--color-border-strong);
}

.hero__panel-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ===== Metrics Grid ===== */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.metric {
    padding: 12px 14px;
    background: var(--color-surface-muted);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: border-color var(--transition-base);
}

.metric:hover {
    border-color: var(--color-border-strong);
}

.metric__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 600;
}

.metric__value {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-text-primary);
    word-break: break-word;
}

/* ===== Status Pills ===== */
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pill--success {
    background: var(--color-success-soft);
    color: var(--color-success);
}

.status-pill--warning {
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.status-pill--danger {
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.status-pill--info {
    background: var(--color-info-soft);
    color: var(--color-info);
}

/* ===== Slide-out AI Chat Panel ===== */
.slide-out-chat {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-out-chat--open {
    opacity: 1;
    pointer-events: all;
}

.slide-out-chat__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.slide-out-chat--open .slide-out-chat__overlay {
    opacity: 1;
}

.slide-out-chat__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(680px, 100%);
    max-width: 90vw;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
}

html[data-theme='dark'] .slide-out-chat__panel {
    background: var(--color-surface);
    border-left: 1px solid var(--color-border-strong);
    box-shadow: var(--shadow-xl);
}

.slide-out-chat--open .slide-out-chat__panel {
    transform: translateX(0);
}

/* ===== Support Chat Panel Styles ===== */
.slide-out-support .slide-out-chat__panel {
    border-left: 3px solid var(--color-success);
}

/* Support Chat Header */
.support-chat__header {
    background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%) !important;
}

.support-chat__header-icon {
    margin-right: 8px;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Support Chat Welcome */
.support-chat__welcome-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%) !important;
    color: var(--color-success) !important;
}

.support-chat__quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
    width: 100%;
    max-width: 320px;
}

.support-chat__quick-btn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.08) 100%) !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
    color: var(--color-success) !important;
}

.support-chat__quick-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.15) 100%) !important;
    border-color: var(--color-success) !important;
    transform: translateY(-2px);
}

/* ===== Support Chat Feedback Styles ===== */
.support-chat__feedback {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-radius: 8px;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.support-chat__feedback-question {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.support-chat__feedback-buttons {
    display: flex;
    gap: 8px;
}

.support-chat__feedback-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.2s ease;
}

.support-chat__feedback-btn--yes {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--color-success);
}

.support-chat__feedback-btn--yes:hover {
    background: var(--color-success);
    border-color: var(--color-success);
    color: white;
    transform: translateY(-1px);
}

.support-chat__feedback-btn--no {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.support-chat__feedback-btn--no:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    transform: translateY(-1px);
}

.support-chat__feedback-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.support-chat__feedback-result--positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.support-chat__feedback-result--positive i {
    color: var(--color-success);
}

.support-chat__feedback-result--negative {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    margin-bottom: 8px;
}

.support-chat__feedback-result--negative i {
    color: #ef4444;
}

.support-chat__telegram-direct {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
    border-radius: 8px;
    color: white !important;
    text-decoration: none !important;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.25);
}

.support-chat__telegram-direct:hover {
    background: linear-gradient(135deg, #0077b5 0%, #006699 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.35);
}

.support-chat__telegram-direct .fa-telegram {
    font-size: 1.2rem;
}

.support-chat__telegram-direct .fa-external-link-alt {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-left: auto;
}

/* Support Chat Avatar */
.support-chat__avatar--assistant {
    background: linear-gradient(135deg, var(--color-success) 0%, #059669 100%) !important;
    color: white !important;
}

/* Telegram Link Section */
.support-chat__telegram {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0, 136, 204, 0.08) 0%, rgba(0, 136, 204, 0.15) 100%);
    border-top: 1px solid rgba(0, 136, 204, 0.2);
    animation: fadeInUp 0.3s ease-out;
}

.support-chat__telegram-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.support-chat__telegram-content > i {
    font-size: 1.75rem;
    color: #0088cc;
}

.support-chat__telegram-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.support-chat__telegram-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-primary);
}

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

.support-chat__telegram-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.support-chat__telegram-btn:hover {
    background: linear-gradient(135deg, #0077b5 0%, #006699 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.support-chat__telegram-btn i {
    font-size: 0.75rem;
}

/* Dark theme support */
html[data-theme='dark'] .support-chat__telegram {
    background: linear-gradient(135deg, rgba(0, 136, 204, 0.1) 0%, rgba(0, 136, 204, 0.2) 100%);
    border-top-color: rgba(0, 136, 204, 0.3);
}

html[data-theme='dark'] .support-chat__telegram-content > i {
    color: #29b6f6;
}

html[data-theme='dark'] .support-chat__quick-btn {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%) !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
    color: var(--color-success) !important;
}

html[data-theme='dark'] .support-chat__quick-btn:hover {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.2) 0%, rgba(16, 185, 129, 0.2) 100%) !important;
    border-color: var(--color-success) !important;
}

/* Dark theme feedback styles */
html[data-theme='dark'] .support-chat__feedback {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.08) 0%, rgba(16, 185, 129, 0.08) 100%);
    border-color: rgba(52, 211, 153, 0.2);
}

html[data-theme='dark'] .support-chat__feedback-btn--yes {
    background: rgba(52, 211, 153, 0.15);
    border-color: rgba(52, 211, 153, 0.35);
}

html[data-theme='dark'] .support-chat__feedback-btn--no {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.35);
    color: #f87171;
}

html[data-theme='dark'] .support-chat__feedback-result--positive {
    background: rgba(52, 211, 153, 0.2);
}

html[data-theme='dark'] .support-chat__feedback-result--negative {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.embedded-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
    overflow: hidden;
}

/* ===== Embedded Chat Header ===== */
.embedded-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    border-radius: var(--radius-lg) 0 0 0;
}

html[data-theme='dark'] .embedded-chat__header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-strong);
}

.embedded-chat__header-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.embedded-chat__avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.embedded-chat__avatar--cyberlawyer {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.embedded-chat__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.embedded-chat__avatar-icon {
    color: #ffffff;
    font-size: 1.1rem;
}

.embedded-chat__header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.embedded-chat__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.embedded-chat__status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.embedded-chat__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse-dot 2s ease-in-out infinite;
}

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

.embedded-chat__header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.embedded-chat__action-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-base);
}

.embedded-chat__action-btn:hover {
    background: var(--color-surface-muted);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
}

.embedded-chat__action-btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ===== Analysis Selector - Premium Design ===== */
.embedded-chat__analysis-selector {
    padding: 14px 20px;
    background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-muted) 100%);
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

.embedded-chat__analysis-selector::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-secondary-soft), transparent);
}

.embedded-chat__analysis-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.embedded-chat__analysis-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-secondary), var(--color-accent-purple));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.embedded-chat__analysis-wrapper:hover {
    border-color: var(--color-secondary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12);
    transform: translateY(-1px);
}

.embedded-chat__analysis-wrapper:hover::before {
    opacity: 1;
}

.embedded-chat__analysis-wrapper:focus-within {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px var(--color-secondary-soft), 0 4px 12px rgba(59, 130, 246, 0.12);
}

.embedded-chat__analysis-wrapper:focus-within::before {
    opacity: 1;
}

.embedded-chat__analysis-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-secondary-soft) 0%, var(--color-accent-purple-soft) 100%);
    display: grid;
    place-items: center;
    color: var(--color-secondary);
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.embedded-chat__analysis-wrapper:hover .embedded-chat__analysis-icon {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-accent-purple) 100%);
    color: white;
    transform: scale(1.05);
}

.embedded-chat__analysis-select {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: 4px 8px 4px 0;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M2.97 5.47a.75.75 0 0 1 1.06 0L8 9.44l3.97-3.97a.75.75 0 1 1 1.06 1.06l-4.5 4.5a.75.75 0 0 1-1.06 0l-4.5-4.5a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-right: 24px;
    min-width: 0;
}

.embedded-chat__analysis-select:focus {
    outline: none;
}

.embedded-chat__analysis-select option {
    padding: 12px;
    font-size: 0.9rem;
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.embedded-chat__analysis-select option:checked {
    background: var(--color-secondary-soft);
    color: var(--color-secondary);
}

.embedded-chat__analysis-refresh {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.embedded-chat__analysis-refresh:hover {
    color: var(--color-secondary);
    background: var(--color-secondary-soft);
    border-color: var(--color-secondary);
    transform: rotate(90deg);
}

.embedded-chat__analysis-refresh.loading {
    animation: spin 1s linear infinite;
    color: var(--color-secondary);
    border-color: var(--color-secondary);
}

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

/* ===== Chat History Panel - Premium Design ===== */
.embedded-chat__history-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-muted) 100%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    animation: slideInPanel 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.embedded-chat__history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: relative;
}

.embedded-chat__history-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, var(--color-secondary), var(--color-accent-purple), var(--color-secondary));
    opacity: 0.3;
}

.embedded-chat__history-header h5 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.embedded-chat__history-header h5 i {
    color: var(--color-secondary);
}

.embedded-chat__close-history {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.embedded-chat__close-history:hover {
    background: var(--color-danger-soft);
    border-color: var(--color-danger);
    color: var(--color-danger);
    transform: rotate(90deg);
}

.embedded-chat__history-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Custom scrollbar for history list */
.embedded-chat__history-list::-webkit-scrollbar {
    width: 6px;
}

.embedded-chat__history-list::-webkit-scrollbar-track {
    background: transparent;
}

.embedded-chat__history-list::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-pill);
}

.embedded-chat__history-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary);
}

/* History Item Cards */
.embedded-chat__history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.embedded-chat__history-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-secondary), var(--color-accent-purple));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.embedded-chat__history-item:hover {
    border-color: var(--color-secondary);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
    transform: translateX(4px);
}

.embedded-chat__history-item:hover::before {
    opacity: 1;
}

.embedded-chat__history-item--active {
    border-color: var(--color-secondary);
    background: linear-gradient(135deg, var(--color-secondary-soft) 0%, transparent 100%);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
}

.embedded-chat__history-item--active::before {
    opacity: 1;
}

.embedded-chat__history-item--active .embedded-chat__history-icon {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-accent-purple) 100%);
    color: white;
}

.embedded-chat__history-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-secondary-soft) 0%, var(--color-accent-purple-soft) 100%);
    display: grid;
    place-items: center;
    color: var(--color-secondary);
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.25s ease;
}

.embedded-chat__history-item:hover .embedded-chat__history-icon {
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-accent-purple) 100%);
    color: white;
    transform: scale(1.05);
}

.embedded-chat__history-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.embedded-chat__history-title {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.embedded-chat__history-item:hover .embedded-chat__history-title {
    color: var(--color-secondary);
}

.embedded-chat__history-item--active .embedded-chat__history-title {
    color: var(--color-secondary);
}

.embedded-chat__history-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.embedded-chat__history-date::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-text-muted);
    opacity: 0.5;
}

.embedded-chat__history-preview {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.embedded-chat__history-delete {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.embedded-chat__history-item:hover .embedded-chat__history-delete {
    opacity: 1;
}

.embedded-chat__history-delete:hover {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    transform: scale(1.1);
}

/* Empty State */
.embedded-chat__history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.embedded-chat__history-empty i {
    font-size: 3rem;
    margin-bottom: 8px;
    opacity: 0.25;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.embedded-chat__history-empty p {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-secondary);
}

.embedded-chat__history-empty small {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    max-width: 220px;
}

/* ===== Chat Body ===== */
.embedded-chat__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.embedded-chat__welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    flex: 1;
}

.embedded-chat__welcome-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-secondary-soft) 0%, var(--color-accent-purple-soft) 100%);
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    color: var(--color-secondary);
    margin-bottom: 16px;
}

.embedded-chat__welcome-title {
    margin: 0 0 8px;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.embedded-chat__welcome-text {
    margin: 0 0 24px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    max-width: 320px;
    line-height: 1.55;
}

.embedded-chat__quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 360px;
}

.embedded-chat__quick-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
}

.embedded-chat__quick-btn i {
    color: var(--color-secondary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.embedded-chat__quick-btn:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-secondary);
    transform: translateX(4px);
}

/* ===== Chat Messages ===== */
.embedded-chat__messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ===== Chat Context Bar - Premium Design ===== */
.embedded-chat__context {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--color-success-soft) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-top: 1px solid rgba(16, 185, 129, 0.15);
    font-size: 0.85rem;
    color: var(--color-success);
    font-weight: 500;
    animation: slideInContext 0.3s ease-out;
    position: relative;
}

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

.embedded-chat__context::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--color-success), #34d399);
}

.embedded-chat__context i {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    background: var(--color-success);
    color: white;
    border-radius: var(--radius-xs);
    font-size: 0.8rem;
}

.embedded-chat__context-clear {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(16, 185, 129, 0.3);
    background: transparent;
    color: var(--color-success);
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.embedded-chat__context-clear:hover {
    background: var(--color-danger-soft);
    border-color: var(--color-danger);
    color: var(--color-danger);
    transform: rotate(90deg);
}

/* ===== System Messages ===== */
.embedded-chat__system-message {
    display: flex;
    justify-content: center;
    padding: 8px 0;
    animation: fadeInMessage 0.3s ease-out;
}

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

.embedded-chat__system-message-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--color-secondary-soft) 0%, var(--color-accent-purple-soft) 100%);
    border: 1px solid var(--color-secondary);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    color: var(--color-secondary);
    font-weight: 500;
    max-width: 90%;
    text-align: center;
}

/* History item staggered animation */
.embedded-chat__history-item {
    animation: slideInHistoryItem 0.3s ease-out backwards;
}

@keyframes slideInHistoryItem {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Chat Footer ===== */
.embedded-chat__footer {
    padding: 16px 20px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

.embedded-chat__form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.embedded-chat__input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.embedded-chat__input-wrapper:focus-within {
    border-color: var(--color-secondary);
    box-shadow: var(--focus-ring);
}

.embedded-chat__input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--color-text-primary);
    resize: none;
    line-height: 1.5;
    max-height: 120px;
}

.embedded-chat__input:focus {
    outline: none;
}

.embedded-chat__input::placeholder {
    color: var(--color-text-muted);
}

.embedded-chat__send {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--color-secondary);
    color: white;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.embedded-chat__send:hover:not(:disabled) {
    background: var(--color-primary-light);
    transform: scale(1.05);
}

.embedded-chat__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.embedded-chat__input-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    padding: 0 4px;
}

.embedded-chat__input-hint kbd {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 1px 4px;
}

/* ===== AI Typing Indicator Animation ===== */
.embedded-chat__typing {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    animation: fadeInTyping 0.3s ease-out;
}

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

.embedded-chat__typing .embedded-chat__message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-secondary-soft), var(--color-accent-purple-soft));
    display: grid;
    place-items: center;
    flex-shrink: 0;
    animation: avatarPulse 2s ease-in-out infinite;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

@keyframes avatarPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(99, 102, 241, 0);
    }
}

.embedded-chat__typing .embedded-chat__message-avatar i {
    font-size: 0.95rem;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: iconGlow 1.5s ease-in-out infinite;
}

@keyframes iconGlow {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.embedded-chat__typing-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.embedded-chat__typing-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--color-surface-muted) 0%, var(--color-surface) 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

/* Shimmer effect behind dots */
.embedded-chat__typing-dots::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(99, 102, 241, 0.08),
        rgba(168, 85, 247, 0.08),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.embedded-chat__typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-accent-purple));
    animation: typingBounce 1.4s ease-in-out infinite both;
    position: relative;
    z-index: 1;
}

.embedded-chat__typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.embedded-chat__typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.embedded-chat__typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Alternative wave animation */
.embedded-chat__typing-dots--wave .embedded-chat__typing-dot {
    animation: typingWave 1.2s ease-in-out infinite;
}

@keyframes typingWave {
    0%, 60%, 100% {
        transform: translateY(0);
        background: var(--color-secondary);
    }
    30% {
        transform: translateY(-8px);
        background: var(--color-accent-purple);
    }
}

/* Typing indicator text label */
.embedded-chat__typing-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    padding-left: 4px;
    animation: fadeInOut 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    gap: 6px;
}

.embedded-chat__typing-label::before {
    content: '✨';
    font-size: 0.7rem;
}

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

/* Chat widget (old) typing indicator styles */
.ai-chat-typing {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    animation: fadeInTyping 0.3s ease-out;
}

.ai-chat-typing .ai-chat-message__avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    display: grid;
    place-items: center;
    flex-shrink: 0;
    animation: avatarPulse 2s ease-in-out infinite;
}

.ai-chat-typing .ai-chat-message__avatar i {
    font-size: 0.85rem;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: iconGlow 1.5s ease-in-out infinite;
}

.ai-chat-typing__content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-chat-typing__dots {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: var(--color-surface-muted);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    position: relative;
    overflow: hidden;
}

.ai-chat-typing__dots::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(99, 102, 241, 0.08),
        rgba(168, 85, 247, 0.08),
        transparent
    );
    animation: shimmer 2s infinite;
}

.ai-chat-typing__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-accent-purple));
    animation: typingBounce 1.4s ease-in-out infinite both;
    position: relative;
    z-index: 1;
}

.ai-chat-typing__dot:nth-child(1) {
    animation-delay: 0s;
}

.ai-chat-typing__dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-typing__dot:nth-child(3) {
    animation-delay: 0.4s;
}

.ai-chat-typing__label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    padding-left: 4px;
    animation: fadeInOut 2s ease-in-out infinite;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-chat-typing__label::before {
    content: '✨';
    font-size: 0.65rem;
}

/* Chat Error Message */
.embedded-chat__error,
.ai-chat-error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-danger-soft);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--color-danger);
    font-size: 0.85rem;
    animation: fadeInTyping 0.3s ease-out;
}

.embedded-chat__error i,
.ai-chat-error i {
    flex-shrink: 0;
}

/* ===== Workspace Section ===== */
.workspace {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.workspace__header {
    margin-bottom: 8px;
}

.workspace__header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--color-text-primary);
}

.workspace__header p {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.55;
}

.workspace__card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.workspace__content {
    padding: 24px;
}

/* ===== Analysis Tabs ===== */
.analysis-tabs {
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-muted);
}

.analysis-tabs .nav-tabs {
    border: none;
    padding: 12px 24px 0;
    gap: 4px;
}

.analysis-tabs .nav-link {
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    padding: 10px 18px;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: transparent;
    transition: all var(--transition-base);
}

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

.analysis-tabs .nav-link.active {
    color: var(--color-text-primary);
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-secondary);
}

/* ===== Input Sections ===== */
.input-section {
    display: flex;
    flex-direction: column;
}

.input-section__label {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
    margin-bottom: 12px;
}

.input-card {
    background: var(--color-surface-muted);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 20px;
}

.input-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
}

/* ===== Dropzone ===== */
.dropzone-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 768px) {
    .dropzone-grid {
        grid-template-columns: 1.5fr 1fr 1fr;
    }
}

.dropzone {
    position: relative;
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
}

.dropzone:hover {
    border-color: var(--color-secondary);
    background: var(--color-secondary-soft);
}

.dropzone--dragover {
    border-color: var(--color-secondary);
    background: var(--color-secondary-soft);
    transform: scale(1.01);
    box-shadow: 0 0 0 3px var(--color-secondary-soft);
}

.dropzone--dragover .dropzone__icon,
.dropzone--dragover .dropzone__icon-small {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.dropzone--primary {
    border-style: solid;
    border-color: var(--color-secondary);
    background: var(--color-secondary-soft);
}

.dropzone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    pointer-events: none;
}

.dropzone__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.dropzone__badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dropzone__badge--primary {
    background: var(--color-secondary);
    color: white;
}

.dropzone__badge--muted {
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.dropzone__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    color: var(--color-secondary);
}

.dropzone--primary .dropzone__icon {
    background: var(--color-secondary);
    color: white;
}

.dropzone__title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.dropzone__description {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.dropzone__hint {
    margin: 0;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.dropzone__file-list {
    width: 100%;
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.dropzone__file-list::-webkit-scrollbar {
    width: 6px;
}

.dropzone__file-list::-webkit-scrollbar-track {
    background: transparent;
}

.dropzone__file-list::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.dropzone__file-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-strong);
}

.dropzone__file-empty {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-style: italic;
    padding: 16px 12px;
    text-align: center;
    background: var(--color-surface-muted);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--color-border);
}

/* ===== File Item Cards ===== */
.dropzone__file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: all var(--transition-base);
    animation: fileItemSlideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.dropzone__file-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-secondary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.dropzone__file-item:hover {
    border-color: var(--color-secondary);
    box-shadow: var(--shadow-sm);
    transform: translateX(2px);
}

.dropzone__file-item:hover::before {
    opacity: 1;
}

.dropzone__file-item:last-child {
    margin-bottom: 0;
}

@keyframes fileItemSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropzone__file-item--removing {
    animation: fileItemSlideOut 0.25s ease-out forwards;
}

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

/* File Icon */
.dropzone__file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    transition: transform var(--transition-base);
}

.dropzone__file-item:hover .dropzone__file-icon {
    transform: scale(1.05);
}

/* File type specific colors */
.dropzone__file-icon--pdf {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
}

.dropzone__file-icon--docx,
.dropzone__file-icon--doc {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.dropzone__file-icon--txt {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #6b7280;
}

.dropzone__file-icon--xlsx {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
}

.dropzone__file-icon--image {
    background: linear-gradient(135deg, #fae8ff 0%, #f5d0fe 100%);
    color: #a855f7;
}

.dropzone__file-icon--archive {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.dropzone__file-icon--default {
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
}

/* File Info */
.dropzone__file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropzone__file-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.dropzone__file-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.dropzone__file-size {
    font-weight: 500;
}

.dropzone__file-type {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 6px;
    background: var(--color-surface-muted);
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
}

/* Remove Button */
.dropzone__file-remove {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-base);
    flex-shrink: 0;
    opacity: 0.6;
}

.dropzone__file-item:hover .dropzone__file-remove {
    opacity: 1;
}

.dropzone__file-remove:hover {
    background: var(--color-danger-soft);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

.dropzone__file-remove:active {
    transform: scale(0.95);
}

/* Compact variant for secondary dropzones */
.dropzone__file-list--compact .dropzone__file-item {
    padding: 8px 10px;
    gap: 8px;
}

.dropzone__file-list--compact .dropzone__file-icon {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
}

.dropzone__file-list--compact .dropzone__file-name {
    font-size: 0.8rem;
}

.dropzone__file-list--compact .dropzone__file-meta {
    display: none;
}

.dropzone__file-list--compact .dropzone__file-remove {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
}

/* File count badge */
.dropzone__file-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--color-secondary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}

/* Success state for dropzone with files */
.dropzone--filled {
    border-color: var(--color-success);
    border-style: solid;
    background: var(--color-success-soft);
}

.dropzone--filled .dropzone__icon,
.dropzone--filled .dropzone__icon-small {
    background: var(--color-success);
    color: white;
}

/* Dark theme adjustments for file items */
html[data-theme='dark'] .dropzone__file-item {
    background: var(--color-surface-muted);
    border-color: var(--color-border);
}

html[data-theme='dark'] .dropzone__file-item:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-secondary);
}

html[data-theme='dark'] .dropzone__file-icon--pdf {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15) 0%, rgba(220, 38, 38, 0.25) 100%);
}

html[data-theme='dark'] .dropzone__file-icon--docx,
html[data-theme='dark'] .dropzone__file-icon--doc {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, rgba(37, 99, 235, 0.25) 100%);
}

html[data-theme='dark'] .dropzone__file-icon--txt {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.15) 0%, rgba(107, 114, 128, 0.25) 100%);
}

html[data-theme='dark'] .dropzone__file-icon--xlsx {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.15) 0%, rgba(22, 163, 74, 0.25) 100%);
}

html[data-theme='dark'] .dropzone__file-type {
    background: var(--color-surface);
}

/* Counter badge styles */
.dropzone__counter--warning {
    color: var(--color-warning);
}

.dropzone__counter--full {
    color: var(--color-danger);
    font-weight: 600;
}

.dropzone__counter {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.dropzone__actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    pointer-events: auto;
}

.dropzone__button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid var(--color-secondary);
    background: var(--color-secondary);
    color: white;
}

.dropzone__button:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary-light);
}

.dropzone__button--ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: var(--color-border);
}

.dropzone__button--ghost:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-border-strong);
    color: var(--color-text-primary);
}

/* ===== Category Select ===== */
.category-select {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-select__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.category-select__all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.category-select__all:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

.category-select__all[aria-pressed="true"] {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: white;
}

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

.category-select__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

/* ===== Category Card ===== */
.category-card {
    position: relative;
    display: block;
    cursor: pointer;
}

.category-card__checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.category-card__body {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.category-card:hover .category-card__body {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-sm);
}

.category-card__checkbox:checked + .category-card__body {
    border-color: var(--color-secondary);
    background: var(--color-secondary-soft);
}

.category-card__checkbox:disabled + .category-card__body {
    opacity: 0.6;
    cursor: not-allowed;
}

.category-card__marker {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    color: transparent;
    flex-shrink: 0;
    transition: all var(--transition-base);
}

.category-card__checkbox:checked + .category-card__body .category-card__marker {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: white;
}

.category-card__content {
    flex: 1;
    min-width: 0;
}

.category-card__title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
}

.category-card__title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.category-card__subtitle {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.category-card__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--color-secondary-soft);
    display: grid;
    place-items: center;
    font-size: 0.9rem;
    color: var(--color-secondary);
    flex-shrink: 0;
}

.category-card__description {
    margin: 0 0 8px;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.category-card__details {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.category-card__details li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 3px;
}

.category-card__details li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--color-secondary);
}

.category-card__status {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--color-surface-muted);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.category-card__checkbox:checked + .category-card__body .category-card__status {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.btn-primary {
    background: var(--color-cta);
    color: var(--color-cta-text);
    border-color: var(--color-cta);
}

.btn-primary:hover {
    background: var(--color-cta-hover);
    border-color: var(--color-cta-hover);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-surface-muted);
    border-color: var(--color-border-strong);
}

.btn-outline-primary {
    background: transparent;
    color: var(--color-cta);
    border-color: var(--color-cta);
}

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

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

.btn-outline-secondary:hover {
    background: var(--color-surface-muted);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
}

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

.btn-outline-danger:hover {
    background: var(--color-danger);
    color: white;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* ===== Form Controls ===== */
.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--color-text-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: var(--focus-ring);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

.form-control-lg,
.form-select-lg {
    padding: 12px 16px;
    font-size: 0.95rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* ===== Modal Styles ===== */
.modal-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.modal-body {
    padding: 24px;
}

.btn-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all var(--transition-base);
    opacity: 1;
    font-size: 0;
}

.btn-close::before {
    content: "✕";
    font-size: 0.85rem;
}

.btn-close:hover {
    background: var(--color-surface-muted);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
}

/* ===== Analysis Modal ===== */
.analysis-modal .modal-dialog {
    max-width: 1000px;
}

.analysis-modal .modal-body {
    max-height: 75vh;
    overflow-y: auto;
}

.analysis-modal .modal-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.analysis-modal .modal-title {
    color: white;
}

.analysis-modal .btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
}

.analysis-modal .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* ===== Result Modal ===== */
.analysis-result-modal .modal-dialog {
    max-width: 1100px;
}

.analysis-result-modal .modal-body {
    max-height: 80vh;
    overflow-y: auto;
}

.analysis-result-modal__header {
    flex-wrap: wrap;
    gap: 16px;
}

.modal-header__info {
    flex: 1;
    min-width: 0;
}

.modal-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-secondary);
    margin-bottom: 4px;
}

.modal-header__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.result-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 6px;
}

/* ===== Result Sections ===== */
.result-section-stack {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.result-section {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.result-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--color-surface-muted);
    border-bottom: 1px solid var(--color-border);
}

.result-section__header h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.result-section__hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: 2px 0 0;
}

.result-section__body {
    padding: 20px;
}

.result-section__meta {
    padding: 12px 20px;
    background: var(--color-surface-muted);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
}

/* ===== Summary Card ===== */
.summary-card {
    padding: 20px;
}

/* ===== Document Tabs ===== */
.document-tabs-container {
    padding: 12px 20px;
    background: var(--color-surface-muted);
    border-bottom: 1px solid var(--color-border);
}

.document-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.document-text-panel {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Debug Report ===== */
.debug-report {
    padding: 20px;
}

.debug-report__body {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--color-surface-muted);
    padding: 16px;
    border-radius: var(--radius-sm);
    max-height: 400px;
    overflow-y: auto;
}

.debug-report.collapsed .debug-report__body {
    max-height: 100px;
    overflow: hidden;
}

/* ===== Result Cards ===== */
.result-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 24px;
}

/* ===== Loading State ===== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
}

.loading-state--centered {
    text-align: center;
}

.loading-state p {
    color: var(--color-text-secondary);
}

/* ===== Progress Bar ===== */
.progress {
    height: 8px;
    background: var(--color-surface-muted);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-accent-purple) 100%);
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
}

.progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

/* ===== Inline Progress Bar ===== */
.inline-progress-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.inline-progress-content {
    flex: 1;
    min-width: 0;
}

.inline-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.inline-progress-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-primary);
}

.inline-progress-time {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.time-separator {
    opacity: 0.4;
}

.inline-progress-track {
    height: 6px;
    background: var(--color-surface-muted);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.inline-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-accent-purple) 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.inline-progress-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.progress-percent {
    font-weight: 600;
    color: var(--color-secondary);
}

.inline-progress-cancel {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
    position: relative;
    overflow: hidden;
}

.inline-progress-cancel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.inline-progress-cancel:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.inline-progress-cancel:hover::before {
    opacity: 1;
}

.inline-progress-cancel:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.inline-progress-cancel i {
    font-size: 0.9rem;
    animation: pulseStop 1.5s ease-in-out infinite;
}

@keyframes pulseStop {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.inline-progress-cancel span {
    white-space: nowrap;
}

/* ===== Floating Analysis Bar ===== */
.floating-analysis-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    min-width: 380px;
    max-width: 90vw;
}

.floating-analysis-bar__content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.floating-analysis-bar__icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.floating-analysis-bar__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--color-surface-muted);
    border-top-color: var(--color-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.floating-analysis-bar__check {
    font-size: 1.75rem;
    color: var(--color-success);
}

.floating-analysis-bar__info {
    flex: 1;
    min-width: 0;
}

.floating-analysis-bar__status {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.floating-analysis-bar__progress-track {
    height: 4px;
    background: var(--color-surface-muted);
    border-radius: 2px;
    overflow: hidden;
}

.floating-analysis-bar__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-secondary) 0%, var(--color-accent-purple) 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.floating-analysis-bar__complete-msg {
    font-size: 0.8rem;
    color: var(--color-success);
}

.floating-analysis-bar__time {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.floating-analysis-bar__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.floating-analysis-bar__expand,
.floating-analysis-bar__dismiss {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all var(--transition-base);
}

.floating-analysis-bar__cancel {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    position: relative;
    overflow: hidden;
}

.floating-analysis-bar__cancel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.floating-analysis-bar__cancel i {
    animation: floatingBarStopPulse 1.5s ease-in-out infinite;
}

@keyframes floatingBarStopPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.floating-analysis-bar__expand:hover {
    background: var(--color-secondary-soft);
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

.floating-analysis-bar__cancel:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.floating-analysis-bar__cancel:hover::before {
    opacity: 1;
}

.floating-analysis-bar__cancel:active {
    transform: scale(0.98);
}

.floating-analysis-bar__view-results {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--color-success);
    color: white;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
}

.floating-analysis-bar__view-results:hover {
    background: #059669;
}

/* ===== Utility Classes ===== */
.text-muted {
    color: var(--color-text-muted) !important;
}

.text-primary {
    color: var(--color-text-primary) !important;
}

.text-secondary {
    color: var(--color-text-secondary) !important;
}

.text-success {
    color: var(--color-success) !important;
}

.text-warning {
    color: var(--color-warning) !important;
}

.text-danger {
    color: var(--color-danger) !important;
}

.fw-bold {
    font-weight: 700;
}

.fw-semibold {
    font-weight: 600;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 0.5rem; }

.gap-3 { gap: 1rem; }

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

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.flex-grow-1 { flex-grow: 1; }

/* ===== Spinner ===== */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: -0.125em;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .app-header__inner {
        flex-wrap: nowrap;
    }
    
    .app-header__left {
        flex: 1;
        min-width: 0;
    }

    .app-logo__text {
        white-space: nowrap;
    }
    
    .app-header__right {
        flex-shrink: 0;
        gap: 8px;
    }
    
    .app-nav__link--about {
        margin-left: 8px;
    }
}

@media (max-width: 768px) {
    .app-header {
        margin: 12px 12px 24px;
        padding: 10px 14px;
    }
    
    .app-header__inner {
        flex-wrap: nowrap;
        gap: 8px;
    }
    
    .app-header__left {
        flex: 1;
        min-width: 0;
    }

    .app-logo__text {
        white-space: nowrap;
    }
    
    .app-header__right {
        flex-shrink: 0;
        gap: 6px;
    }
    
    .app-nav {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .app-nav__link {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .app-nav__link--about {
        margin-left: 4px;
    }
    
    .app-header__actions {
        gap: 6px;
    }
    
    .app-header__chat-btn span {
        display: none;
    }
    
    .app-header__chat-btn {
        padding: 10px;
    }
    
    .workspace__content {
        padding: 16px;
    }
    
    .input-card {
        padding: 14px;
    }
    
    .category-select__grid {
        grid-template-columns: 1fr;
    }
    
    .floating-analysis-bar {
        left: 12px;
        right: 12px;
        transform: none;
        min-width: auto;
    }
}

/* ===== Print Styles ===== */
@media print {
    .app-header,
    .app-footer,
    .slide-out-chat,
    .floating-analysis-bar,
    .btn,
    .theme-switcher {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .result-section {
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}

/* ===== Checklists Parameters Page Styles ===== */
.checklists-container {
    padding: 0;
}

.module-section {
    background: var(--color-surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--color-border);
}

.module-header {
    border-bottom: 1px solid var(--color-border);
}

.module-icon-wrapper {
    transition: transform 0.2s ease;
}

.module-section:hover .module-icon-wrapper {
    transform: scale(1.05);
}

/* Table Styles */
.module-section .table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.module-section .table thead th {
    border-bottom: 2px solid var(--color-border);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    background: var(--color-surface-muted);
}

.module-section .table tbody tr {
    transition: all 0.15s ease;
}

.module-section .table tbody tr:hover {
    background: var(--color-surface-hover) !important;
}

.module-section .table tbody td {
    padding: 14px 16px;
    border-color: var(--color-border);
    vertical-align: middle;
}

/* Check row states */
.check-row.table-secondary {
    opacity: 0.6;
}

.check-row.table-secondary td {
    text-decoration: line-through;
    text-decoration-color: var(--color-text-muted);
}

.check-row.table-secondary code {
    opacity: 0.5;
}

/* Form switch in table */
.module-section .form-check-input {
    width: 2.5rem;
    height: 1.25rem;
    cursor: pointer;
}

.module-section .form-check-input:checked {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

/* ID code styling */
.module-section code {
    background: var(--color-surface-muted);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Risk badges */
.module-section .badge {
    font-weight: 500;
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* Controls panel */
.controls-panel {
    border: 1px solid var(--color-border);
}

.controls-panel .btn-group .btn {
    padding: 10px 20px;
    font-weight: 500;
}

.stats-info .badge {
    font-size: 0.85rem;
    padding: 8px 12px;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .module-section .table {
        font-size: 0.85rem;
    }
    
    .module-section .table thead th,
    .module-section .table tbody td {
        padding: 10px 12px;
    }
    
    .module-header h4 {
        font-size: 1rem;
    }
    
    .module-icon-wrapper {
        width: 36px !important;
        height: 36px !important;
    }
}

@media (max-width: 768px) {
    .controls-panel {
        flex-direction: column;
        gap: 12px;
    }
    
    .controls-panel .btn-group {
        width: 100%;
    }
    
    .controls-panel .btn-group .btn {
        flex: 1;
    }
    
    .stats-info {
        justify-content: center;
    }
    
    /* Hide description column on mobile */
    .module-section .table thead th:nth-child(4),
    .module-section .table tbody td:nth-child(4) {
        display: none;
    }
    
    .module-section .table thead th:nth-child(3),
    .module-section .table tbody td:nth-child(3) {
        min-width: auto;
    }
}

/* ============================================
   ТАБЛИЦА РИСКОВ (Risk Summary Table)
   ============================================ */

.risk-summary-table {
    font-size: 0.9rem;
}

.risk-summary-table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--color-text-secondary);
    padding: 0.75rem 1rem;
    background: var(--color-surface-muted);
    border-bottom: 2px solid var(--color-border);
}

.risk-summary-table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

.risk-table-row {
    transition: background-color 0.2s ease;
}

.risk-table-row:hover {
    background-color: var(--color-surface-hover);
}

.risk-table-row--critical {
    border-left: 3px solid #dc2626;
}

.risk-table-row--critical:hover {
    background-color: rgba(220, 38, 38, 0.05);
}

.risk-table-row--attention {
    border-left: 3px solid #f59e0b;
}

.risk-table-row--attention:hover {
    background-color: rgba(245, 158, 11, 0.05);
}

.risk-table-row.resolved {
    opacity: 0.5;
    text-decoration: line-through;
    background-color: var(--color-surface-muted);
}

.risk-table-row .quote-cell {
    min-width: 200px;
    max-width: 400px;
    overflow: visible;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
}

.risk-table-row .quote-cell .quote-link,
.risk-table-row .quote-cell .quote-text {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.risk-table-row .quote-cell .quote-link:hover {
    color: var(--color-secondary);
    text-decoration: underline;
}

.summary-table-wrapper {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

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

.summary-stat {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem;
    background: var(--color-surface-muted);
    border-radius: var(--radius-md);
    border-left: 4px solid;
}

.summary-stat span {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
}

.summary-stat strong {
    font-size: 1.25rem;
    font-weight: 700;
}

.summary-stat--critical {
    border-left-color: #dc2626;
}

.summary-stat--critical strong {
    color: #dc2626;
}

.summary-stat--attention {
    border-left-color: #f59e0b;
}

.summary-stat--attention strong {
    color: #f59e0b;
}

.summary-stat--time {
    border-left-color: var(--color-secondary);
}

.summary-stat--time strong {
    color: var(--color-secondary);
}

/* Conclusion badges */
.conclusion-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.9rem;
}

.conclusion-badge--success {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.conclusion-badge--warning {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.conclusion-badge--danger {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* Summary sections */
.summary-card {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.summary-section {
    padding: 1.5rem;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.summary-section:last-child {
    margin-bottom: 0;
}

.summary-section h5 {
    display: flex;
    align-items: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.summary-section h5 i {
    color: var(--color-cta);
    margin-right: 0.5rem;
}

/* Темная тема для таблицы рисков */
[data-theme="dark"] .risk-summary-table thead th {
    background: var(--color-surface);
    color: var(--color-text-secondary);
}

[data-theme="dark"] .risk-table-row--critical:hover {
    background-color: rgba(220, 38, 38, 0.1);
}

[data-theme="dark"] .risk-table-row--attention:hover {
    background-color: rgba(245, 158, 11, 0.1);
}
