:root {
    --bg-primary: #0f111a;
    --bg-secondary: #1a1d29;
    --bg-card: #2a2f3f;
    --bg-card-hover: #353b4f;
    
    --accent-gold: #f59e0b;
    --accent-emerald: #10b981;
    --accent-coral: #ef4444;
    
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --border-subtle: #374151;
    --border-medium: #4b5563;
    --border-bright: #6b7280;
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
    overflow-x: hidden;
}

body.ai-dialog-fullscreen-active,
body.ai-dialog-reply-fullscreen-active {
    overflow: hidden;
}

.page-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 10, 16, 0.72);
    backdrop-filter: blur(4px);
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.page-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loading-card {
    min-width: 220px;
    padding: 22px 26px;
    border-radius: 12px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: linear-gradient(145deg, rgba(26, 29, 41, 0.97), rgba(15, 17, 26, 0.97));
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.55), 0 0 24px rgba(245, 158, 11, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.page-loading-logo-wrap {
    position: relative;
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
}

.page-loading-logo-wrap::before {
    content: '';
    position: absolute;
    inset: -7px;
    border-radius: 999px;
    background:
        conic-gradient(
            from 0deg,
            rgba(245, 158, 11, 0.0) 0%,
            rgba(245, 158, 11, 0.95) 20%,
            rgba(56, 189, 248, 0.45) 55%,
            rgba(245, 158, 11, 0.0) 100%
        );
    -webkit-mask: radial-gradient(circle, transparent 57%, #000 58%);
    mask: radial-gradient(circle, transparent 57%, #000 58%);
    animation: page-loader-spin 0.95s linear infinite;
}

.page-loading-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    animation: page-loader-breathe 1.8s ease-in-out infinite;
    transform-origin: center;
}

.page-loading-title {
    color: var(--accent-gold);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.page-loading-subtitle {
    color: var(--text-secondary);
    font-size: 0.84rem;
}

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

@keyframes page-loader-breathe {
    0%, 100% { transform: rotate(-8deg) scale(1); }
    50% { transform: rotate(8deg) scale(1.06); }
}

.container {
    max-width: 2100px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
}

.glass-panel {
    background: var(--bg-card);
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 24px;
    transition: border-color 0.2s ease;
    max-width: 100%;
    overflow: hidden;
}

.glass-panel:hover {
    border-color: var(--border-medium);
}

/* Unique left border colors for each section */
#companies-section {
    border-left: 4px solid #38bdf8; /* Sky blue */
}

#details-section {
    border-left: 4px solid #a78bfa; /* Purple */
}

#analytics-section {
    border-left: 4px solid #34d399; /* Emerald */
}

#chart-section {
    border-left: 4px solid #f59e0b; /* Gold/Amber */
}

#kohonen-section {
    border-left: 4px solid #f472b6; /* Pink */
}

#ai-analysis-section {
    border-left: 4px solid #22d3ee; /* Cyan */
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    border-left: 3px solid var(--accent-gold);
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse 600px 300px at 80px 50%,
        rgba(245, 158, 11, 0.15) 0%,
        rgba(245, 158, 11, 0.08) 30%,
        rgba(245, 158, 11, 0.03) 50%,
        transparent 70%
    );
    animation: header-shimmer 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 60%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(245, 158, 11, 0.08) 25%,
        rgba(255, 215, 0, 0.15) 50%,
        rgba(245, 158, 11, 0.08) 75%,
        transparent 100%
    );
    transform: skewX(-20deg);
    animation: header-wave 6s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.header > * {
    position: relative;
    z-index: 1;
}

@keyframes header-shimmer {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

@keyframes header-wave {
    0% {
        left: -60%;
        opacity: 0;
    }
    20% {
        opacity: 0.6;
    }
    80% {
        opacity: 0.6;
    }
    100% {
        left: 120%;
        opacity: 0;
    }
}

.header-left {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-to-landing {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 8px;
    color: #f59e0b;
    text-decoration: none;
    transition: all 0.2s ease;
}

.back-to-landing:hover {
    background: rgba(245, 158, 11, 0.32);
    border-color: #f59e0b;
    color: #fbbf24;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
    transform: scale(1.05);
}

.back-to-landing--info {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.45);
    color: #60a5fa;
}

.back-to-landing--info:hover {
    background: rgba(59, 130, 246, 0.32);
    border-color: #60a5fa;
    color: #93bbfc;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.back-to-landing svg {
    width: 18px;
    height: 18px;
}

.header-center {
    display: none;
}

.header-nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 1px solid rgba(255,255,255,0.1);
}

.profile-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.profile-save-status {
    flex: 1;
    min-height: 18px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-right: 10px;
}

#save-profile-btn {
    background: #16a34a;
    color: #f8fafc;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#save-profile-btn:hover {
    background: #15803d;
}

#save-profile-btn.is-saving {
    background: #f59e0b;
    color: #111827;
    cursor: wait;
}

#save-profile-btn.is-saving::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid rgba(17, 24, 39, 0.35);
    border-top-color: #111827;
    border-radius: 50%;
    animation: profileSaveSpin 0.7s linear infinite;
}

#save-profile-btn.is-saved {
    animation: profileSaveDone 0.45s ease;
}

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

@keyframes profileSaveDone {
    0% { transform: scale(1); }
    45% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.profile-billing-section {
    margin: 0;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.profile-billing-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.profile-billing-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent-gold);
    font-weight: 700;
    flex: 1;
}

.profile-billing-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.profile-billing-loading {
    font-size: 11px;
    color: var(--text-muted);
}

.profile-billing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-billing-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.profile-billing-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}

.profile-billing-value--debt {
    color: var(--accent-coral);
}

.profile-billing-value--ok {
    color: var(--accent-emerald);
}

.profile-billing-value--muted {
    color: var(--text-muted);
    font-size: 11px;
}

.profile-billing-details-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 6px;
    color: var(--accent-gold);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.profile-billing-details-link:hover {
    background: rgba(245, 158, 11, 0.22);
    border-color: var(--accent-gold);
    text-decoration: none;
}

.title-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-ai-icon-wrapper {
    position: relative;
    display: inline-block;
}

.header-ai-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 2px solid var(--accent-gold);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4),
                0 0 40px rgba(245, 158, 11, 0.2);
    transition: all 0.3s ease;
    animation: icon-glow 3s ease-in-out infinite;
    cursor: pointer;
}

.header-ai-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.6),
                0 0 60px rgba(245, 158, 11, 0.4);
}

.header-ai-tooltip {
    position: absolute;
    top: 50%;
    left: calc(100% + 20px);
    transform: translateY(-50%);
    width: 520px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
    border: 2px solid var(--accent-gold);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.3),
                0 0 60px rgba(245, 158, 11, 0.15),
                0 10px 25px rgba(0, 0, 0, 0.5);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.header-ai-tooltip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -10px;
    transform: translateY(-50%);
    border-width: 10px 10px 10px 0;
    border-style: solid;
    border-color: transparent var(--accent-gold) transparent transparent;
}

.header-ai-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -7px;
    transform: translateY(-50%);
    border-width: 8px 8px 8px 0;
    border-style: solid;
    border-color: transparent rgba(15, 23, 42, 0.98) transparent transparent;
}

.header-ai-tooltip strong {
    color: var(--accent-gold);
    font-size: 13px;
    display: inline;
    margin-right: 8px;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.header-ai-icon-wrapper:hover .header-ai-tooltip {
    opacity: 1;
    visibility: visible;
}

@keyframes icon-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.4),
                    0 0 40px rgba(245, 158, 11, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(245, 158, 11, 0.6),
                    0 0 50px rgba(245, 158, 11, 0.3);
    }
}

.title-text {
    display: flex;
    flex-direction: column;
}

.selected-context-header {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: min(92vw, 900px);
    min-width: 0;
}

.selected-industry-header,
.selected-company-header {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-gold);
    border-radius: 6px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
    min-width: 0;
}

.selected-industry-header {
    position: relative;
    flex: 0 0 auto;
    max-width: min(220px, 32vw);
}

.selected-industry-header::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: 320px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: linear-gradient(180deg, rgba(18, 22, 34, 0.98), rgba(24, 29, 45, 0.98));
    color: #d1d5db;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    white-space: normal;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 60;
}

.selected-industry-header::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    transform: translateX(-50%) translateY(4px);
    width: 8px;
    height: 8px;
    background: rgba(24, 29, 45, 0.98);
    border-right: 1px solid rgba(212, 175, 55, 0.35);
    border-bottom: 1px solid rgba(212, 175, 55, 0.35);
    rotate: 45deg;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 59;
}

.selected-industry-header:hover::after,
.selected-industry-header:hover::before,
.selected-industry-header:focus-visible::after,
.selected-industry-header:focus-visible::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.selected-company-header {
    flex: 0 1 auto;
    max-width: min(620px, 62vw);
}

.selected-industry-header:hover,
.selected-company-header:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: #fcd34d;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.5),
                0 0 40px rgba(245, 158, 11, 0.3);
    transform: scale(1.02);
}

.selected-company-header:hover .selected-company-name,
.selected-industry-header:hover .selected-company-industry {
    color: #fcd34d;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.selected-company-label {
    color: var(--accent-gold);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selected-company-industry,
.selected-company-name {
    color: var(--accent-gold, #f59e0b);
    font-size: 12px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
}

.selected-company-industry,
.selected-company-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-company-industry {
    max-width: min(180px, 28vw);
}

.selected-company-loader {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: none; /* чтобы анимация не мешала взаимодействиям шапки */
}

.selected-company-loader-logo {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    position: relative;
}

.selected-company-loader-logo img {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    animation: selected-company-logo-breathe 1.8s ease-in-out infinite;
    transform-origin: center;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.18));
}

.selected-company-loader-logo::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 999px;
    background:
        conic-gradient(
            from 0deg,
            rgba(245, 158, 11, 0.0) 0%,
            rgba(245, 158, 11, 0.85) 20%,
            rgba(56, 189, 248, 0.35) 55%,
            rgba(245, 158, 11, 0.0) 100%
        );
    -webkit-mask: radial-gradient(circle, transparent 55%, #000 56%);
    mask: radial-gradient(circle, transparent 55%, #000 56%);
    animation: selected-company-logo-spin 0.95s linear infinite;
}

.selected-company-loader-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

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

@keyframes selected-company-logo-breathe {
    0%, 100% { transform: rotate(-8deg) scale(1); }
    50% { transform: rotate(8deg) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
    .page-loading-logo-wrap::before,
    .page-loading-logo {
        animation: none !important;
    }

    .selected-company-loader-logo::before,
    .selected-company-loader-logo img {
        animation: none !important;
    }
}

.title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 4px;
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
}

/* Quick Navigation */
.quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    border: none;
    border-left: 3px solid var(--accent-gold);
    border-radius: 0;
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 99;
    overflow: hidden;
}

.quick-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse 400px 200px at 50px 50%,
        rgba(56, 189, 248, 0.1) 0%,
        rgba(56, 189, 248, 0.05) 30%,
        transparent 60%
    );
    pointer-events: none;
    z-index: 0;
}

.quick-nav > * {
    position: relative;
    z-index: 1;
}

.nav-main-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.nav-divider {
    display: none;
}

.nav-dashboard-group {
    display: none;
}

.nav-page-spacer {
    display: inline-block;
    width: 2px;
    height: 28px;
    background: rgba(245, 158, 11, 0.2);
    border-radius: 1px;
    margin: 0 6px;
    vertical-align: middle;
}

.quick-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    min-height: 70px;
    box-sizing: border-box;
    background: transparent;
    color: #e2c97e;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quick-nav-btn .nav-icon {
    color: var(--accent-gold);
    flex-shrink: 0;
}

.quick-nav-btn .nav-icon-img {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 6px;
    border: 1px solid var(--accent-gold);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.3);
    transition: all 0.3s ease;
}

.quick-nav-btn:hover .nav-icon-img {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
    filter: brightness(1.2);
}

.quick-nav-btn:hover {
    color: #10b981;
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5),
                0 0 30px rgba(16, 185, 129, 0.3),
                inset 0 0 10px rgba(16, 185, 129, 0.1);
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.quick-nav-btn:active {
    transform: translateY(1px);
}

.quick-nav-btn--ai,
.quick-nav-btn--companies,
.quick-nav-btn--kohonen,
.quick-nav-btn--details,
.quick-nav-btn--params,
.quick-nav-btn--sources,
.quick-nav-btn--outliers {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(180, 150, 50, 0.06) 100%);
    border: 1.5px solid rgba(212, 175, 55, 0.4);
    color: #e2c97e;
}

.quick-nav-btn--ai {
    position: relative;
}

.quick-nav-btn--ai .nav-icon-img,
.quick-nav-btn--companies .nav-icon-img,
.quick-nav-btn--kohonen .nav-icon-img,
.quick-nav-btn--details .nav-icon-img,
.quick-nav-btn--params .nav-icon-img,
.quick-nav-btn--sources .nav-icon-img,
.quick-nav-btn--outliers .nav-icon-img {
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.25);
}

.quick-nav-btn--ai:hover,
.quick-nav-btn--companies:hover,
.quick-nav-btn--kohonen:hover,
.quick-nav-btn--details:hover,
.quick-nav-btn--params:hover,
.quick-nav-btn--sources:hover,
.quick-nav-btn--outliers:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, rgba(180, 150, 50, 0.14) 100%);
    border-color: rgba(212, 175, 55, 0.7);
    color: #f5dfa0;
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.35),
                0 0 35px rgba(212, 175, 55, 0.18),
                inset 0 0 12px rgba(212, 175, 55, 0.06);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.quick-nav-btn--ai:hover .nav-icon-img,
.quick-nav-btn--companies:hover .nav-icon-img,
.quick-nav-btn--kohonen:hover .nav-icon-img,
.quick-nav-btn--details:hover .nav-icon-img,
.quick-nav-btn--params:hover .nav-icon-img,
.quick-nav-btn--sources:hover .nav-icon-img,
.quick-nav-btn--outliers:hover .nav-icon-img {
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.5);
}

.quick-nav-btn--dashboard {
    color: #93c5fd;
    border-color: rgba(147, 197, 253, 0.35);
}

.quick-nav-btn--dashboard .nav-icon-img--dashboard {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    border: none;
    filter: none;
}

.quick-nav-btn--dashboard::after {
    content: '↗';
    font-size: 12px;
    margin-left: 4px;
    opacity: 0.8;
}

.quick-nav-btn--dashboard:hover {
    color: #bfdbfe;
    border-color: #93c5fd;
    background: rgba(147, 197, 253, 0.15);
    box-shadow: 0 0 15px rgba(147, 197, 253, 0.35),
                0 0 30px rgba(147, 197, 253, 0.18),
                inset 0 0 10px rgba(147, 197, 253, 0.08);
    text-shadow: 0 0 8px rgba(147, 197, 253, 0.4);
}

.quick-nav-btn--dashboard:hover .nav-icon-img--dashboard {
    filter: brightness(1.15);
}

.quick-nav-btn--info {
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.35);
    min-width: auto;
    padding: 8px 12px;
}

.quick-nav-btn--info:hover {
    color: #93bbfc;
    border-color: #60a5fa;
    background: rgba(59, 130, 246, 0.15);
}

.quick-nav-btn--info::after {
    content: '↗';
    font-size: 12px;
    margin-left: 4px;
    opacity: 0.8;
}

.nav-icon-svg--info {
    width: 28px;
    height: 28px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.username {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 3px;
    border: 1px solid var(--border-subtle);
    font-family: 'Roboto Mono', monospace;
}

/* Имя пользователя в заголовке главной страницы — голубой */
.username--header {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.25);
    background: rgba(56, 189, 248, 0.08);
}

.login-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-field {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.2s ease;
}

.input-field:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

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

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 3px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-family: 'Inter', sans-serif;
}

.btn-login {
    background: var(--accent-gold);
    color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

.btn-login:hover {
    background: #d97706;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-logout {
    background: var(--accent-coral);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
    background: #dc2626;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-profile {
    background: var(--bg-secondary);
    color: var(--accent-gold);
    padding: 8px 10px;
    border: 1px solid var(--accent-gold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-profile:hover {
    background: rgba(245, 158, 11, 0.15);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.btn-profile--blue,
.btn-profile.btn-profile--blue {
    color: #38bdf8;
    border-color: #38bdf8;
}
.btn-profile--blue:hover,
.btn-profile.btn-profile--blue:hover {
    background: rgba(56, 189, 248, 0.15);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}
.btn-profile--blue svg,
.btn-profile.btn-profile--blue svg {
    color: inherit;
}

.user-role-badge {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2744 100%);
    color: #38bdf8;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Profile Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.profile-modal {
    border-left: 4px solid var(--accent-gold);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.profile-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.profile-modal .modal-body::-webkit-scrollbar {
    width: 4px;
}

.profile-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.profile-modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 4px;
}

.profile-modal .profile-billing-section {
    flex-shrink: 0;
}

.profile-modal .modal-footer {
    flex-shrink: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.modal-header h3 {
    color: var(--accent-gold);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    color: var(--accent-coral);
    background: rgba(239, 68, 68, 0.1);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.profile-section {
    margin-bottom: 20px;
}

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

.profile-label {
    display: block;
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.profile-value {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    font-family: 'Roboto Mono', monospace;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.profile-input:hover {
    border-color: var(--accent-gold);
}

.profile-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

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

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

.profile-input-icon {
    position: absolute;
    left: 12px;
    color: var(--accent-gold);
    pointer-events: none;
    z-index: 1;
}

.profile-input.with-icon {
    padding-left: 42px;
}

.profile-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.profile-consent-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.profile-consent-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #cbd5e1;
    line-height: 1.35;
    cursor: pointer;
}

.profile-consent-item input[type="checkbox"] {
    margin-top: 1px;
    width: 14px;
    height: 14px;
    accent-color: var(--accent-gold);
    cursor: pointer;
}

.profile-consent-item span {
    font-size: 0.75rem;
    color: #cbd5e1;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.profile-stat-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 14px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-stat-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-gold);
    line-height: 1;
}

.profile-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-select:hover {
    border-color: var(--accent-gold);
}

.profile-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.profile-select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px;
}

.role-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    padding: 12px 16px;
    background: rgba(56, 189, 248, 0.05);
    border-left: 3px solid #38bdf8;
    border-radius: 0 4px 4px 0;
    margin: 0;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    min-width: 0;
}

.main-content > * {
    min-width: 0;
}


.pct-sign {
    color: #f59e0b;
    font-weight: 400;
    margin-left: 1px;
}

.section {
    animation: fadeIn 0.4s ease-out;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    position: relative;
    border-bottom: 2px solid #4b5563;
    padding-bottom: 16px;
}

.scroll-top-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.scroll-top-btn:hover {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
}

.scroll-top-btn svg {
    width: 14px;
    height: 14px;
}

.ai-section-header {
    align-items: center;
    justify-content: flex-start;
}

.ai-header-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
    border: 1px solid var(--accent-gold);
}

.section-title-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
}

.ai-dialog-section-period-center {
    position: absolute;
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.section-header-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.section-icon {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
    border: 1px solid var(--accent-gold);
    flex-shrink: 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.section-icon:hover {
    transform: scale(1.25);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.7),
                0 0 40px rgba(245, 158, 11, 0.4);
    filter: brightness(1.3);
    border-color: #fcd34d;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.section-info-btn {
    width: 20px;
    height: 20px;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    vertical-align: middle;
    border-radius: 50%;
    filter: drop-shadow(0 0 3px rgba(0, 200, 255, 0.4));
}

.section-info-btn:hover {
    transform: scale(1.25);
    filter: drop-shadow(0 0 8px rgba(0, 200, 255, 0.8)) brightness(1.2);
}

.valuetype-help-btn {
    width: 14px;
    height: 14px;
    margin-left: 4px;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.section-subtitle {
    color: var(--accent-gold);
    font-size: 0.875rem;
    margin-top: 6px;
    font-weight: 400;
}

.btn-settings {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    margin-top: 0;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--accent-gold);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-settings:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-gold);
    box-shadow: var(--shadow-md);
}

.btn-settings svg {
    transition: transform 0.3s ease;
}

.btn-settings:hover svg {
    transform: rotate(90deg);
}

.btn-export {
    padding: 10px 12px;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
}

.btn-export:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-export:hover svg {
    transform: translateY(-2px);
}


.companies-filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 16px 20px;
}

.companies-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.companies-filter-row-full {
    grid-template-columns: 1fr;
}

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

.companies-filter-group-full {
    width: 100%;
}

.companies-filter-label {
    color: var(--accent-gold);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.companies-filter-label--green {
    color: var(--accent-emerald);
}

.companies-filter-label--gold {
    color: var(--accent-gold);
}

.companies-filter-row--marked {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(245, 158, 11, 0.2);
}

.companies-filter-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}

.companies-filter-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.companies-filter-checkbox-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(245, 158, 11, 0.6);
    background: transparent;
    transition: border-color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.companies-filter-checkbox:checked + .companies-filter-checkbox-custom {
    background: linear-gradient(135deg, var(--accent-gold), #d97706);
    border-color: var(--accent-gold);
}

.companies-filter-checkbox:checked + .companies-filter-checkbox-custom::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #0f0f0f;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

#logical-group-dropdown-container .custom-dropdown-option {
    color: var(--accent-emerald);
}

#logical-group-dropdown-container .custom-dropdown-option:hover {
    color: #4ade80;
}

#logical-group-dropdown-container .custom-dropdown-option.selected {
    background: rgba(16, 185, 129, 0.15);
    color: #4ade80;
}

#logical-group-dropdown-container .custom-dropdown-selected {
    color: var(--accent-emerald);
}

/* Parameters Section */
.parameters-content {
    padding: 16px 0;
}

.parameters-row {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.parameters-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.parameters-group-sources {
    flex: 1;
    min-width: 300px;
}

.parameters-group-industry {
    min-width: 200px;
}

.parameters-group-stats {
    min-width: 180px;
}

.parameters-panel {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(20, 30, 48, 0.98) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-left: 3px solid #a78bfa;
    box-shadow: 0 4px 24px rgba(139, 92, 246, 0.15), inset 0 1px 0 rgba(139, 92, 246, 0.1);
}

.parameters-panel .section-title {
    color: #a78bfa;
}

.parameters-panel .section-header {
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.parameters-panel .parameters-label {
    color: #a78bfa;
}

.section-header-clickable {
    cursor: pointer;
}

.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-header:hover {
    opacity: 0.9;
}

.collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 4px;
    color: var(--accent-gold);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.collapse-toggle svg {
    transition: transform 0.3s ease;
}

.collapsible-header.collapsed .collapse-toggle svg {
    transform: rotate(-90deg);
}

.collapsible-content {
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.collapsible-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.section-header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-industry-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 6px;
    background: rgba(139, 92, 246, 0.08);
}

.header-industry-label {
    color: #a78bfa;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-industry-selector .custom-dropdown {
    min-width: 180px;
}

.btn-toggle-section {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    color: #a78bfa;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle-section:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: #a78bfa;
}

.btn-toggle-section .toggle-icon {
    transition: transform 0.3s ease;
}

.parameters-panel.collapsed .btn-toggle-section .toggle-icon {
    transform: rotate(-90deg);
}

.parameters-panel:not(.collapsed) .btn-toggle-section .toggle-icon {
    transform: rotate(0deg);
}

.parameters-panel.collapsed .collapse-toggle svg {
    transform: rotate(-90deg);
}

.parameters-panel:not(.collapsed) .collapse-toggle svg {
    transform: rotate(0deg);
}

.data-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 8px 0;
}

.data-stats-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    padding: 6px 10px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.05);
}

.stats-label {
    color: var(--text-secondary);
}

.stats-value {
    color: #60a5fa;
    font-weight: 600;
}

.stats-value.stats-null {
    color: #ef4444;
}

.parameters-label {
    color: var(--accent-gold);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .quick-nav {
        display: none !important;
    }
    
    .parameters-row {
        flex-direction: column;
        gap: 20px;
    }
    
    .parameters-group-sources,
    .parameters-group-industry {
        width: 100%;
        min-width: unset;
    }
}

.source-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 0;
}

.source-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.source-checkbox-item:hover {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.source-checkbox-item.active {
    border-color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.15);
}

.source-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-gold);
    cursor: pointer;
}

.source-checkbox-item label {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.source-checkbox-item.active label {
    color: var(--accent-gold);
}

.companies-filter-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.companies-filter-select:hover {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.companies-filter-select:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.companies-filter-select option {
    background: #1a1d24;
    color: var(--text-primary);
    padding: 10px;
}

.companies-filter-select option.group-option {
    background: #12151a;
    color: var(--accent-gold);
    font-weight: 700;
    text-transform: uppercase;
}

.companies-filter-select option.subgroup-option {
    background: #1a1d24;
    color: var(--text-secondary);
    padding-left: 24px;
}

@media (max-width: 768px) {
    .companies-filter-row {
        grid-template-columns: 1fr;
    }
}

.column-settings-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease-out;
}

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

.column-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.column-settings-header h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.btn-close-settings {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-settings:hover {
    background: var(--accent-coral);
    color: var(--text-primary);
    border-color: var(--accent-coral);
}

.settings-section-title {
    color: var(--accent-gold);
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.value-type-section {
    margin-bottom: 20px;
}

.value-type-select-wrapper {
    padding: 8px;
}

.value-type-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.value-type-select:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-gold);
}

.value-type-select:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.value-type-select option {
    background: #1a1d24;
    color: var(--text-primary);
    padding: 10px;
}

.settings-divider {
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--accent-gold) 20%, 
        var(--accent-gold) 80%, 
        transparent
    );
    margin: 20px 0;
    opacity: 0.3;
}

.column-selection-section {
    margin-top: 20px;
}

.column-settings-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.btn-column-action {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.btn-column-action:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.column-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 3px;
    border: 1px solid var(--border-subtle);
}

.column-checkboxes::-webkit-scrollbar {
    width: 8px;
}

.column-checkboxes::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 3px;
}

.column-checkboxes::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.column-checkboxes::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

.column-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-card);
    border-radius: 3px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 32px;
}

.column-checkbox-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-gold);
}

.column-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    margin-top: 1px;
    cursor: pointer;
    accent-color: var(--accent-gold);
    flex-shrink: 0;
}

.column-checkbox-item label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    line-height: 1.3;
    word-break: break-word;
}

.column-checkbox-item:has(input:checked) label {
    color: var(--text-primary);
}

.col-group-section {
    border: 1px solid rgba(245,158,11,0.18);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
    grid-column: 1 / -1;
}
.col-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    min-height: 38px;
    background: rgba(245,158,11,0.08);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.col-group-header:hover {
    background: rgba(245,158,11,0.15);
}
.col-group-arrow {
    color: var(--accent-gold);
    font-size: 0.9rem;
    width: 14px;
    flex-shrink: 0;
    line-height: 1;
}
.col-group-title {
    color: var(--accent-gold);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.col-group-counter {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: 'Roboto Mono', monospace;
    opacity: 0.8;
    flex-shrink: 0;
}
.col-group-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 4px;
    padding: 8px;
}
.col-group-section.collapsed .col-group-body {
    display: none;
}

.column-checkbox-label {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-card);
    border-radius: 3px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    line-height: 1.3;
}

.column-checkbox-label:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-gold);
}

.column-checkbox-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    min-width: 14px;
    cursor: pointer;
    accent-color: var(--accent-gold);
    flex-shrink: 0;
}

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

.column-checkbox-label:has(input:checked) span {
    color: var(--text-primary);
}

.column-checkbox-desc {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 400;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

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

.filter-label {
    color: var(--accent-gold);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.details-filters-row {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.details-filter-list-wrapper {
    flex: 1;
    background: rgba(30, 35, 56, 0.5);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.details-filter-list-title {
    color: #f59e0b;
    font-size: 0.8rem;
    font-family: 'Roboto Mono', monospace;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.details-filter-list-title--period {
    color: #a78bfa;
}

.details-filter-list-wrapper--source {
    flex: 0 0 200px;
    min-width: 0;
}

.details-filter-list-wrapper--narrow {
    flex: 0 0 160px;
    min-width: 0;
}

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

.details-filter-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.details-filter-list-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.details-filter-list-scroll::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 3px;
}

.details-filter-list-table {
    width: 100%;
    border-collapse: collapse;
}

.details-filter-list-table td {
    padding: 4px 8px;
    font-size: 0.8rem;
    color: #e5e7eb;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.details-filter-list-table tr:hover td {
    background: rgba(245, 158, 11, 0.1);
}

.details-filter-row.selected td {
    background: rgba(245, 158, 11, 0.2);
    border-left: 3px solid #f59e0b;
}

.filter-select {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover {
    border-color: var(--border-medium);
}

.filter-select:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.filter-select option {
    background: #1a1d24;
    color: var(--text-primary);
    padding: 10px;
}

.filter-select option.group-option {
    background: #12151a;
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 10px 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filter-select option.subgroup-option {
    background: #1a1d24;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.85rem;
    padding-left: 24px;
}

.filter-select option.subgroup-option:hover {
    background: #252a33;
    color: var(--text-primary);
}

.company-name {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-left: 3px solid var(--accent-emerald);
    border-radius: 3px;
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    border-radius: 4px;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.details-table-container {
    max-height: 600px;
    overflow-y: auto;
}

.details-table-container::-webkit-scrollbar {
    width: 10px;
}

.details-table-container::-webkit-scrollbar-track {
    background: #3a3f4b;
    border-radius: 5px;
}

.details-table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d4ff 0%, #38bdf8 50%, #00d4ff 100%);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5),
                0 0 20px rgba(0, 212, 255, 0.3);
}

.details-table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00e5ff 0%, #4fc3f7 50%, #00e5ff 100%);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.7),
                0 0 30px rgba(0, 212, 255, 0.5);
}

.table-container::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-card);
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

.data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    display: table;
    table-layout: auto;
}

.data-table thead {
    background: var(--bg-card);
    display: table-header-group;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody {
    display: table-row-group;
}

.data-table tr {
    display: table-row;
}

.data-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--accent-gold);
    border-bottom: 2px solid var(--accent-gold);
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.2s ease;
    box-sizing: border-box;
    display: table-cell;
    background: var(--bg-card);
    font-family: 'Inter', sans-serif;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.05em;
}

.data-table th:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.data-table th::after {
    content: '⇅';
    position: absolute;
    right: 4px;
    top: 8px;
    opacity: 0.4;
    font-size: 0.75rem;
}

.data-table th.sort-asc::after {
    content: '▲';
    opacity: 1;
    color: var(--accent-gold);
    font-size: 0.65rem;
}

.data-table th.sort-desc::after {
    content: '▼';
    opacity: 1;
    color: var(--accent-gold);
    font-size: 0.65rem;
}

.details-table-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.details-table-container::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 5px;
}

.details-table-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 50%, #22c55e 100%);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5), 0 0 20px rgba(34, 197, 94, 0.3);
}

.details-table-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 50%, #4ade80 100%);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.7), 0 0 30px rgba(34, 197, 94, 0.4);
}

.details-table-container::-webkit-scrollbar-corner {
    background: rgba(15, 23, 42, 0.8);
}

#details-table thead {
    background: var(--bg-card);
}

#details-table th {
    color: var(--accent-emerald);
    border-bottom: 2px solid var(--accent-emerald);
}

#details-table th:hover {
    background: var(--bg-card-hover);
}

#details-table th.sort-asc::after,
#details-table th.sort-desc::after {
    color: var(--accent-emerald);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.15s ease;
}

.data-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:nth-child(odd) {
    background: transparent;
}

.data-table tbody tr:hover {
    background: rgba(245, 158, 11, 0.08);
    border-color: var(--accent-gold);
}

#companies-table tbody tr {
    cursor: pointer;
}

#companies-table tbody tr.selected {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.25) 0%, rgba(245, 158, 11, 0.15) 100%);
    border-left: 4px solid var(--accent-gold);
    border-color: var(--accent-gold);
    box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.1);
}

#companies-table tbody tr.selected td {
    color: #fff;
}

#companies-table tbody tr.selected:hover {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.35) 0%, rgba(245, 158, 11, 0.2) 100%);
}

.data-table td {
    padding: 5px 8px;
    color: var(--text-primary);
    box-sizing: border-box;
    display: table-cell;
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
}

#companies-table td.val-pos { color: #22c55e; text-align: right; }
#companies-table td.val-neg { color: #ef4444; text-align: right; }
#companies-table td.val-zero { color: #6b7280; text-align: right; }
#companies-table td.val-company { color: #f59e0b; font-weight: 600; }
#companies-table td.val-industry { font-weight: 600; }

#companies-table th {
    white-space: normal;
    word-break: break-word;
    max-width: 160px;
    line-height: 1.3;
    vertical-align: top;
    padding-right: 20px;
    padding-bottom: 10px;
}

#companies-table th .th-name {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#companies-table th .th-unit {
    color: #9ca3af;
    font-weight: 400;
}

/* Колонка выделения: дизайнерские кружки-чекбоксы */
#companies-table .th-checkbox,
#companies-table .td-checkbox {
    width: 42px;
    min-width: 42px;
    max-width: 42px;
    text-align: center;
    vertical-align: middle;
    padding: 6px 8px;
}
#companies-table .th-checkbox {
    cursor: default;
}
#companies-table .th-checkbox::after {
    display: none;
}
#companies-table .td-checkbox {
    cursor: default;
}
.companies-table-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(245, 158, 11, 0.6);
    background: transparent;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    cursor: pointer;
    flex-shrink: 0;
}
.companies-table-checkbox:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
.companies-table-checkbox--checked {
    background: linear-gradient(135deg, var(--accent-gold), #d97706);
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25), inset 0 1px 0 rgba(255,255,255,0.2);
}
.companies-table-checkbox--checked::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #0f0f0f;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}
.companies-table-checkbox--header {
    cursor: pointer;
}
#companies-table tbody tr.row-marked {
    background: rgba(245, 158, 11, 0.06);
}
#companies-table tbody tr.row-marked:nth-child(even) {
    background: rgba(245, 158, 11, 0.1);
}

.th-tooltip {
    position: fixed;
    z-index: 10001;
    pointer-events: none;
    background: linear-gradient(135deg, #1e2338 0%, #151929 100%);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(245, 158, 11, 0.15);
    max-width: 280px;
    white-space: normal;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.th-tooltip.visible {
    opacity: 1;
}

.th-tooltip .tt-unit {
    color: #9ca3af;
    font-weight: 400;
}

.data-table td:first-child {
    font-weight: 500;
}

.footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.footer-meta {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-meta a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.footer-meta a:hover {
    color: var(--accent-gold);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--accent-gold);
    font-size: 1.1rem;
    font-weight: 500;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-coral);
    border-left: 3px solid var(--accent-coral);
    color: var(--accent-coral);
    padding: 16px;
    border-radius: 3px;
    margin: 20px 0;
    font-weight: 500;
}

@media (max-width: 768px) {
    .title {
        font-size: 1.75rem;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
    
    .column-checkboxes {
        grid-template-columns: 1fr;
        grid-auto-flow: row;
    }
}

/* Analytics Panel */
.analytics-controls {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 16px 24px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.analytics-period-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.analytics-controls-bottom {
    margin-top: 16px;
}

.param-selector-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
}

.param-selector-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.param-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 100px;
}

.params-source-filter-dropdown {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}

.params-hierarchy-filter-dropdown {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

.params-hierarchy-filter-dropdown .custom-dropdown-selected {
    color: #a855f7;
    border-color: #a855f7;
}

.params-hierarchy-filter-dropdown .custom-dropdown-selected:hover {
    border-color: #c084fc;
}

.params-group-filter-dropdown {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

.params-subgroup-filter-dropdown {
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}

.companies-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 16px;
}

.selected-list-group {
    flex: 1 1 auto;
    min-width: 0;
}

.companies-list-group {
    width: 950px !important;
    min-width: 950px !important;
    max-width: 950px !important;
    flex: 0 0 950px !important;
}

.param-dual-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.param-list-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.param-list-panel.selected-panel {
    border-color: var(--border-subtle);
}

.param-list-panel.selected-panel.no-border {
    border: none;
}


.ai-main-controls-row {
    background: rgba(0, 0, 0, 0.15);
    padding: 12px 16px;
    border-radius: 6px;
    align-items: flex-end;
}

.ai-company-control {
    flex: 0 0 auto;
    min-width: 200px;
    max-width: 500px;
}

.ai-company-control .ai-company-select {
    min-width: 200px;
}

.ai-company-control .ai-company-dropdown-container {
    min-width: 240px;
}

/* AI-Анализ: шире и выше — длинные названия компаний и больший список */
.ai-main-controls-row .ai-company-control {
    min-width: 380px;
    max-width: min(100%, 720px);
    flex: 1 1 380px;
}

#ai-company-dropdown-container {
    min-width: 100%;
}

#ai-company-dropdown-container .custom-dropdown-options {
    max-height: 520px;
}

#ai-company-dropdown-container .custom-dropdown-items-container {
    max-height: 420px;
}

.ai-company-dropdown-container .custom-dropdown-selected {
    color: var(--accent-gold);
    font-weight: 700;
    min-height: 42px;
    display: flex;
    align-items: center;
}

.ai-company-dropdown-container .custom-dropdown-selected:hover {
    border-color: var(--accent-gold);
}

.ai-company-dropdown-container .custom-dropdown-items-container {
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) var(--bg-card);
}

.ai-company-dropdown-container .custom-dropdown-items-container::-webkit-scrollbar {
    width: 8px;
}

.ai-company-dropdown-container .custom-dropdown-items-container::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 3px;
}

.ai-company-dropdown-container .custom-dropdown-items-container::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.ai-company-dropdown-container .custom-dropdown-items-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

/* Поверх общих правил .ai-company-dropdown-container — только AI-Анализ */
#ai-company-dropdown-container .custom-dropdown-selected {
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    min-height: 52px;
    padding: 12px 40px 12px 14px;
    overflow: visible;
    text-overflow: clip;
}

#ai-company-dropdown-container .custom-dropdown-option {
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
    padding-top: 12px;
    padding-bottom: 12px;
}

.narratives-controls-row,
.ai-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.narrative-status {
    margin-left: auto;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.narrative-status.not-generated {
    color: #ff6b6b !important;
    background: rgba(255, 80, 80, 0.2) !important;
    border: 1px solid rgba(255, 80, 80, 0.5) !important;
}

.narrative-status.generated {
    color: #4ade80 !important;
    background: rgba(74, 222, 128, 0.2) !important;
    border: 1px solid rgba(74, 222, 128, 0.5) !important;
}

.btn-ai-analyse:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-narratives-subsection {
    margin-bottom: 20px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    overflow: hidden;
    background-image: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('../images/ai_analysis_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.ai-narratives-subsection .subsection-title {
    color: #ff9500;
}

.ai-filter-list-group {
    min-width: 150px;
}

.ai-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 80px;
    overflow-y: auto;
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}

.ai-filter-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ai-filter-item:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.ai-filter-item.selected {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.ai-filter-item input[type="checkbox"] {
    accent-color: var(--accent-gold);
    width: 12px;
    height: 12px;
    cursor: pointer;
}

.ai-filter-list-group-wide {
    min-width: 200px;
    flex: 1;
}

.ai-filter-list-source {
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    flex: 0 0 400px;
}

.ai-filter-row {
    margin-top: 8px;
    display: flex;
    align-items: flex-start;
}

.ai-selectable-list {
    max-height: 182px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}

.ai-selectable-list::-webkit-scrollbar {
    width: 10px;
}

.ai-selectable-list::-webkit-scrollbar-track {
    background: #3a3f4b;
    border-radius: 5px;
}

.ai-selectable-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d4ff 0%, #38bdf8 50%, #00d4ff 100%);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5),
                0 0 20px rgba(0, 212, 255, 0.3);
}

.ai-selectable-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00e5ff 0%, #4fc3f7 50%, #00e5ff 100%);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.7),
                0 0 30px rgba(0, 212, 255, 0.5);
}

.ai-selectable-table {
    width: 100%;
    border-collapse: collapse;
}

.ai-selectable-row {
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-selectable-row:hover {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent-gold);
}

.ai-selectable-row.selected {
    background: rgba(212, 175, 55, 0.2);
    color: var(--accent-gold);
    font-weight: 600;
}

.ai-selectable-row--checkable {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-row-checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    font-size: 11px;
    font-weight: 700;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.ai-selectable-row--checkable.selected .ai-row-checkmark {
    opacity: 1;
    transform: scale(1);
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.42), rgba(34, 197, 94, 0.32));
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.36);
}

.ai-row-label {
    min-width: 0;
}

.ai-selectable-row.kb-highlighted {
    background: rgba(212, 175, 55, 0.18);
    outline: 1px solid rgba(212, 175, 55, 0.5);
    outline-offset: -1px;
    color: var(--accent-gold);
}

.ai-selectable-list:focus {
    outline: none;
}

.ai-prompt-copy-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}

.ai-prompt-copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    color: var(--accent-gold);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-prompt-copy-btn:hover {
    background: rgba(212, 175, 55, 0.3);
}

.ai-prompt-copy-btn.copied {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
    color: #4caf50;
}

.ai-results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}

.ai-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.ai-copy-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid var(--accent-gold);
    border-radius: 4px;
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-copy-icon-btn:hover {
    background: rgba(212, 175, 55, 0.3);
}

.ai-copy-icon-btn.copied {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
    color: #4caf50;
}

.ai-icon-only-btn {
    width: 32px;
    min-width: 32px;
    padding: 0;
    gap: 0;
}

#ai-open-results-fullscreen-btn {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.82);
    color: #34d399;
}

#ai-open-results-fullscreen-btn:hover {
    background: rgba(16, 185, 129, 0.3);
    border-color: rgba(52, 211, 153, 0.95);
    color: #6ee7b7;
}

.ai-clear-output-btn {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.82);
    color: #f87171;
}

.ai-clear-output-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(248, 113, 113, 0.95);
    color: #fca5a5;
}

.ai-save-widget-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 28px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    border: 1px solid #a855f7;
    border-radius: 6px;
    color: #c4b5fd;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-save-widget-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
    transform: translateY(-1px);
}

.ai-save-widget-btn.saved {
    background: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
    color: #4caf50;
}

.ai-save-widget-btn svg {
    flex-shrink: 0;
}

.subsection-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.subsection-header:hover {
    background: rgba(0, 0, 0, 0.3);
}

.subsection-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.subsection-collapse-toggle svg {
    stroke: var(--text-secondary);
}

.subsection-header.collapsed .subsection-collapse-toggle {
    transform: rotate(-90deg);
}

.subsection-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.subsection-content {
    padding: 14px;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.subsection-content-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.subsection-content-left .analytics-content-wrapper {
    width: 100%;
}

.subsection-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0 14px;
}

.ai-analyse-section {
    margin-top: 20px;
}

.ai-analyse-controls {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 12px;
}

.ai-analyse-controls > .ai-help-tooltip-target.ai-analyse-action {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
}

.ai-analyse-controls > .ai-help-tooltip-target.ai-analyse-action .btn-ai-analyse {
    width: 100%;
}

.ai-results-subsection {
    margin-top: 4px;
}

.ai-results-subsection .subsection-title {
    color: var(--accent-gold);
}

#ai-results-subsection-content {
    align-items: stretch;
}

#ai-results-subsection-content .ai-report-title-wrapper,
#ai-results-subsection-content .ai-results-container {
    width: 100%;
}

.ai-analyse-modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-analyse-modal-form .ai-control-group {
    width: 100%;
}

.ai-analyse-modal-label {
    display: block;
    margin-bottom: 8px;
    color: var(--accent-gold);
    font-size: 0.875rem;
    font-weight: 600;
}

.ai-analyse-macro-toggle-group {
    margin-top: 4px;
}

.ai-analyse-modal-form .prompt-editor-btn {
    width: 100%;
    justify-content: flex-start;
}

/* Let model dropdown use modal space without being clipped by body scroll. */
.ai-analyse-modal-content {
    max-height: min(92vh, 840px);
}

.ai-analyse-modal-content .section-info-body {
    overflow: visible;
}

.ai-analyse-modal-content .csel-dropdown {
    max-height: 400px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ai-analyse-modal-footer {
    display: flex;
    gap: 12px;
}

.ai-analyse-modal-footer .btn-ai-analyse {
    flex: 1 1 auto;
    width: auto;
}

.ai-analyse-art-section {
    min-height: 240px;
    border-top: 1px solid rgba(245, 158, 11, 0.18);
    border-bottom: 1px solid rgba(245, 158, 11, 0.14);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.06), rgba(26, 29, 41, 0.22));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    pointer-events: none;
    overflow: hidden;
}

.ai-analyse-art-section img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    opacity: 0.72;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.35));
    animation: aiIconShimmer 2.4s ease-in-out infinite;
}

@keyframes aiIconShimmer {
    0%,
    100% {
        opacity: 0.45;
        filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.2));
        transform: translateY(0);
    }
    50% {
        opacity: 0.95;
        filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.65));
        transform: translateY(-1px);
    }
}

.data-type-checkboxes {
    display: flex;
    gap: 12px;
    align-items: center;
    height: 38px;
}

.data-type-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}

.data-type-checkbox input[type="checkbox"] {
    accent-color: var(--accent-gold);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.data-type-checkbox span {
    color: var(--text-primary);
    font-weight: 500;
}

.data-type-checkbox:hover span {
    color: var(--accent-gold);
}

.param-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.param-count {
    background: var(--accent-gold);
    color: #000;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.param-list-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.param-list-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.param-list-search--with-tree-fold {
    display: flex;
    align-items: center;
    gap: 8px;
}

.param-list-search--with-tree-fold .param-search-input {
    flex: 1;
    min-width: 0;
    width: auto;
}

.param-inline-filter-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.65);
    color: rgba(203, 213, 225, 0.95);
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.param-inline-filter-btn:hover {
    border-color: rgba(245, 158, 11, 0.7);
    color: #f59e0b;
}

.param-inline-filter-btn.active {
    border-color: rgba(245, 158, 11, 0.85);
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.28) inset;
}

.ai-param-tree-fold-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
}

.tree-fold-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.7));
    color: rgba(212, 175, 55, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.1) inset, 0 3px 8px rgba(0, 0, 0, 0.35);
}

.param-search-input {
    width: 100%;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
}

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

.param-list-items {
    flex: 0 0 auto;
    height: 300px;
    min-height: 200px;
    max-height: 800px;
    overflow: auto;
    padding: 4px;
    background-image: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('../images/ai_analysis_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#available-params-list {
    resize: vertical;
}

.ai-param-tooltip {
    position: fixed;
    z-index: 10010;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
    border: 1px solid rgba(245, 158, 11, 0.42);
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 16px rgba(245, 158, 11, 0.16);
    max-width: 460px;
    min-width: 290px;
    padding: 10px 12px;
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.35;
}

.ai-param-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.ai-param-tooltip-row {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 8px;
    align-items: start;
    margin-bottom: 5px;
}

.ai-param-tooltip-row:last-child {
    margin-bottom: 0;
}

.ai-param-tooltip-label {
    color: #fbbf24;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 10px;
}

.ai-param-tooltip-value {
    color: #cbd5e1;
    word-break: break-word;
}

.ai-param-tooltip-row-comment .ai-param-tooltip-value {
    max-height: 120px;
    overflow: auto;
    white-space: pre-wrap;
    padding-right: 4px;
}

.param-list-items::-webkit-scrollbar {
    width: 10px;
}

.param-list-items::-webkit-scrollbar-track {
    background: #3a3f4b;
    border-radius: 5px;
}

.param-list-items::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d4ff 0%, #38bdf8 50%, #00d4ff 100%);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5),
                0 0 20px rgba(0, 212, 255, 0.3);
}

.param-list-items::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00e5ff 0%, #4fc3f7 50%, #00e5ff 100%);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.7),
                0 0 30px rgba(0, 212, 255, 0.5);
}

.param-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin: 2px 0;
    background: rgba(10, 15, 20, 0.65);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.param-list-item:nth-child(even) {
    background: rgba(20, 30, 40, 0.75);
}

.param-list-item:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: var(--accent-gold);
}

.param-list-item .param-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.param-list-item .param-source-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.28);
    border-radius: 3px;
    color: #fbbf24;
    flex-shrink: 0;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.param-list-item .param-group-tag {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.param-list-item .param-action-icon {
    color: var(--accent-gold);
    opacity: 0;
    transition: opacity 0.2s;
}

.param-list-item:hover .param-action-icon {
    opacity: 1;
}

.param-list-item.hierarchy-top {
    border-left: 3px solid #d4af37;
    font-weight: 700;
}
.param-list-item.hierarchy-top .param-name {
    color: #d4af37;
}
.param-list-item.hierarchy-middle {
    border-left: 3px solid #38bdf8;
    padding-left: 16px;
    font-weight: 600;
}
.param-list-item.hierarchy-middle .param-name {
    color: #93c5fd;
}
.param-list-item.hierarchy-leaf {
    border-left: 3px solid rgba(148, 163, 184, 0.4);
    padding-left: 24px;
}
.param-list-item.hierarchy-leaf .param-name {
    color: #cbd5e1;
}

.param-hierarchy-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.param-hierarchy-badge.ht-top {
    background: rgba(212, 175, 55, 0.2);
    color: #d4af37;
    border: 1px solid rgba(212, 175, 55, 0.3);
}
.param-hierarchy-badge.ht-middle {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.25);
}
.param-hierarchy-badge.ht-leaf {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.ai-param-tree-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.82rem;
    color: #a78bfa;
    border-radius: 3px;
    min-height: 26px;
}
.ai-param-tree-row:hover {
    background: rgba(212, 175, 55, 0.12);
}
.ai-param-tree-row.hierarchy-top {
    color: #d4af37;
    font-weight: 600;
}
.ai-param-tree-row.hierarchy-middle {
    color: #93c5fd;
    font-weight: 500;
}
.ai-param-tree-row.hierarchy-leaf {
    color: #94a3b8;
    font-size: 0.78rem;
}
.ai-param-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    color: #d4af37;
    transition: transform 0.15s ease;
}
.ai-param-tree-toggle.expanded {
    transform: rotate(90deg);
}
.ai-param-tree-spacer {
    width: 16px;
    flex-shrink: 0;
}
.ai-param-tree-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.param-star-toggle {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: rgba(15, 23, 42, 0.45);
    color: rgba(148, 163, 184, 0.9);
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.param-star-toggle:hover {
    border-color: rgba(245, 158, 11, 0.68);
    color: #f59e0b;
}

.param-star-toggle.starred {
    border-color: rgba(245, 158, 11, 0.85);
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.param-list-item .param-star-toggle {
    margin-left: auto;
    margin-right: 0;
}
.ai-param-tree-badges {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.ai-param-tree-add-subtree {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: rgba(212, 175, 55, 0.15);
    color: #d4af37;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
    margin-left: 2px;
}
.ai-param-tree-row:hover .ai-param-tree-add-subtree {
    opacity: 1;
}
.ai-param-tree-add-subtree:hover {
    background: rgba(212, 175, 55, 0.3);
}
.ai-param-tree-row .param-action-icon {
    color: var(--accent-gold);
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.ai-param-tree-row:hover .param-action-icon {
    opacity: 1;
}
.ai-param-tree-row.already-selected {
    opacity: 0.45;
}
.ai-param-tree-row.already-selected .ai-param-tree-label {
    text-decoration: line-through;
    text-decoration-color: rgba(212, 175, 55, 0.5);
}

.ai-param-tree-row .param-source-tag {
    font-size: 9px;
    padding: 1px 5px;
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: 3px;
    color: #fbbf24;
    flex-shrink: 0;
    width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.ai-param-tree-row .param-group-tag {
    font-size: 9px;
    padding: 1px 5px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    color: var(--text-muted);
    flex-shrink: 0;
    width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

#parameter-tree-section .parameter-tree-layout {
    display: grid;
    grid-template-columns: minmax(360px, var(--parameter-tree-left-width, 1.15fr)) 10px minmax(280px, 0.85fr);
    gap: 10px;
    width: 100%;
}

#parameter-tree-section .parameter-tree-column-resizer {
    align-self: stretch;
    width: 10px;
    min-height: 420px;
    border-radius: 999px;
    cursor: col-resize;
    position: relative;
}

#parameter-tree-section .parameter-tree-column-resizer::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 50%;
    width: 2px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
    transform: translateX(-50%);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

#parameter-tree-section .parameter-tree-column-resizer:hover::before,
body.parameter-tree-column-resizing #parameter-tree-section .parameter-tree-column-resizer::before {
    background: rgba(212, 175, 55, 0.78);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.28);
}

body.parameter-tree-column-resizing {
    cursor: col-resize;
    user-select: none;
}

#parameter-tree-section .param-list-panel {
    min-height: 420px;
}

#parameter-tree-section .parameter-tree-chart-panel {
    margin-top: 12px;
    padding: 0;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.42);
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-radius: 12px;
}

#parameter-tree-section .parameter-tree-chart-message {
    margin: 10px 12px 12px;
    padding: 12px;
    color: #94a3b8;
    font-size: 0.84rem;
    text-align: center;
    background: rgba(15, 23, 42, 0.48);
    border: 1px dashed rgba(148, 163, 184, 0.22);
    border-radius: 10px;
}

#parameter-tree-section .parameter-tree-chart-message.loading {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.28);
}

#parameter-tree-section .parameter-tree-chart-message.error {
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.32);
}

#parameter-tree-section .parameter-tree-chart-wrap {
    height: 320px;
    margin: 8px 12px 14px;
    padding: 14px 14px 10px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(2, 6, 23, 0.55));
    border: 1px solid rgba(71, 85, 105, 0.42);
    border-radius: 12px;
}

#parameter-tree-section #parameter-tree-quarter-chart {
    width: 100% !important;
    height: 100% !important;
}

#parameter-tree-section .parameter-tree-selected-name {
    color: var(--accent-gold);
    font-size: 0.78rem;
    font-weight: 600;
    max-width: 58%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#parameter-tree-section .parameter-tree-values-controls {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

#parameter-tree-section .parameter-tree-values-controls .ai-control-group {
    flex: 1 1 220px;
    min-width: 180px;
}

#parameter-tree-section .parameter-tree-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.52);
}

#parameter-tree-section .parameter-tree-view-btn {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 6px 10px;
    color: var(--text-muted);
    background: transparent;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

#parameter-tree-section .parameter-tree-view-btn:hover {
    color: #f8fafc;
    border-color: rgba(212, 175, 55, 0.35);
}

#parameter-tree-section .parameter-tree-view-btn.active {
    color: #111827;
    border-color: rgba(212, 175, 55, 0.75);
    background: linear-gradient(180deg, #f7d774, #d4af37);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.22);
}

#parameter-tree-section .parameter-tree-zoom-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.44);
}

#parameter-tree-section .parameter-tree-zoom-controls.is-hidden {
    display: none;
}

#parameter-tree-section .parameter-tree-zoom-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid rgba(212, 175, 55, 0.34);
    border-radius: 4px;
    color: #f8fafc;
    background: linear-gradient(180deg, rgba(71, 85, 105, 0.72), rgba(30, 41, 59, 0.86));
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.15s ease;
}

#parameter-tree-section .parameter-tree-zoom-btn:hover {
    border-color: rgba(247, 215, 116, 0.72);
    color: #f7d774;
    transform: translateY(-1px);
}

#parameter-tree-section .parameter-tree-zoom-btn-wide {
    min-width: 64px;
}

#parameter-tree-section .parameter-tree-fullscreen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#parameter-tree-section .parameter-tree-fullscreen-btn .parameter-tree-fs-icon {
    display: block;
    flex-shrink: 0;
}

#parameter-tree-section .parameter-tree-fullscreen-btn .parameter-tree-fs-icon-exit {
    display: none;
}

#parameter-tree-section .parameter-tree-fullscreen-btn.is-active .parameter-tree-fs-icon-enter {
    display: none;
}

#parameter-tree-section .parameter-tree-fullscreen-btn.is-active .parameter-tree-fs-icon-exit {
    display: block;
}

#parameter-tree-section .parameter-tree-fullscreen-btn.is-active {
    border-color: rgba(247, 215, 116, 0.72);
    color: #f7d774;
    background: rgba(212, 175, 55, 0.18);
}

#parameter-tree-section .parameter-tree-print-btn {
    height: 36px;
    min-width: 62px;
    padding: 0 12px;
    align-self: flex-end;
    border-color: rgba(212, 175, 55, 0.34);
    border-radius: 6px;
    font-size: 0.75rem;
    line-height: 1;
    box-shadow: none;
}

#parameter-tree-section .parameter-tree-zoom-value {
    min-width: 44px;
    color: #f7d774;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.72rem;
    text-align: center;
}

#parameter-tree-section #parameter-tree-period-dropdown {
    width: 100%;
}

#parameter-tree-section .parameter-tree-message,
#parameter-tree-section .parameter-tree-empty {
    margin: 12px;
    padding: 14px 16px;
    border: 1px dashed rgba(148, 163, 184, 0.32);
    border-radius: 6px;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.34);
    font-size: 0.86rem;
}

#parameter-tree-section .parameter-tree-message.loading {
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.35);
}

#parameter-tree-section .parameter-tree-message.error {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.42);
}

#parameter-tree-section .parameter-tree-values-list,
#parameter-tree-section .parameter-tree-graph,
#parameter-tree-section #parameter-tree-selector-list {
    overflow: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.62) rgba(15, 23, 42, 0.58);
}

#parameter-tree-section .parameter-tree-values-list::-webkit-scrollbar,
#parameter-tree-section .parameter-tree-graph::-webkit-scrollbar,
#parameter-tree-section #parameter-tree-selector-list::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

#parameter-tree-section .parameter-tree-values-list::-webkit-scrollbar-track,
#parameter-tree-section .parameter-tree-graph::-webkit-scrollbar-track,
#parameter-tree-section #parameter-tree-selector-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.58);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 999px;
}

#parameter-tree-section .parameter-tree-values-list::-webkit-scrollbar-thumb,
#parameter-tree-section .parameter-tree-graph::-webkit-scrollbar-thumb,
#parameter-tree-section #parameter-tree-selector-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.82), rgba(99, 102, 241, 0.58));
    border: 2px solid rgba(15, 23, 42, 0.8);
    border-radius: 999px;
}

#parameter-tree-section .parameter-tree-values-list::-webkit-scrollbar-thumb:hover,
#parameter-tree-section .parameter-tree-graph::-webkit-scrollbar-thumb:hover,
#parameter-tree-section #parameter-tree-selector-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(247, 215, 116, 0.95), rgba(147, 197, 253, 0.72));
}

#parameter-tree-section .parameter-tree-values-list::-webkit-scrollbar-corner,
#parameter-tree-section .parameter-tree-graph::-webkit-scrollbar-corner,
#parameter-tree-section #parameter-tree-selector-list::-webkit-scrollbar-corner {
    background: rgba(15, 23, 42, 0.58);
}

#parameter-tree-section .parameter-tree-values-list {
    padding: 8px;
    height: 520px;
    min-height: 220px;
    max-height: 82vh;
    resize: vertical;
}

#parameter-tree-section .parameter-tree-graph {
    position: relative;
    padding: 18px 12px 24px;
    height: 580px;
    min-height: 260px;
    max-height: 82vh;
    resize: vertical;
    cursor: grab;
    background-image: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), url('../images/ai_analysis_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#parameter-tree-section .parameter-tree-graph-period {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: none;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.42);
    background: rgba(15, 20, 25, 0.82);
    color: #f8fafc;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
    will-change: transform;
}

#parameter-tree-section .parameter-tree-graph-period.is-visible {
    display: inline-flex;
}

#parameter-tree-section .parameter-tree-graph-period .period-year {
    color: #e2e8f0;
}

#parameter-tree-section .parameter-tree-graph-period .period-separator {
    color: rgba(148, 163, 184, 0.9);
}

#parameter-tree-section .parameter-tree-graph-period .period-quarter {
    color: #f7d774;
}

#parameter-tree-section .parameter-tree-graph.is-panning {
    cursor: grabbing;
    user-select: none;
}

#parameter-tree-section .parameter-tree-graph:fullscreen,
#parameter-tree-section .parameter-tree-graph:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-height: none;
    min-height: 0;
    resize: none;
    border-radius: 0;
    padding: 24px 16px 32px;
    background-image: linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.62)), url('../images/ai_analysis_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#parameter-tree-section .parameter-tree-graph.parameter-tree-graph--pseudo-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    z-index: 3000;
    width: 100vw !important;
    height: 100vh !important;
    max-height: none !important;
    min-height: 0 !important;
    resize: none !important;
    border-radius: 0 !important;
    padding: 24px 16px 32px;
    background-image: linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.62)), url('../images/ai_analysis_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

body.parameter-tree-graph-fullscreen-active {
    overflow: hidden;
}

#parameter-tree-section .parameter-tree-fs-chart-dock {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 7;
    display: none;
    flex-direction: column;
    max-height: min(340px, 42vh);
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(71, 85, 105, 0.55);
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    will-change: transform;
}

#parameter-tree-section .parameter-tree-graph:fullscreen .parameter-tree-fs-chart-dock.is-open,
#parameter-tree-section .parameter-tree-graph:-webkit-full-screen .parameter-tree-fs-chart-dock.is-open,
#parameter-tree-section .parameter-tree-graph.parameter-tree-graph--pseudo-fullscreen .parameter-tree-fs-chart-dock.is-open {
    display: flex;
}

#parameter-tree-section .parameter-tree-fs-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(71, 85, 105, 0.45);
}

#parameter-tree-section .parameter-tree-fs-chart-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

#parameter-tree-section .parameter-tree-fs-chart-title {
    color: #e2e8f0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

#parameter-tree-section .parameter-tree-fs-chart-header .parameter-tree-selected-name {
    max-width: none;
}

#parameter-tree-section .parameter-tree-fs-chart-hide-btn {
    flex-shrink: 0;
    height: 30px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    background: rgba(30, 41, 59, 0.85);
    color: #f7d774;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

#parameter-tree-section .parameter-tree-fs-chart-hide-btn:hover {
    background: rgba(212, 175, 55, 0.18);
    border-color: rgba(247, 215, 116, 0.72);
}

#parameter-tree-section .parameter-tree-fs-chart-dock .parameter-tree-chart-message {
    margin: 10px 12px;
}

#parameter-tree-section .parameter-tree-fs-chart-wrap {
    flex: 1 1 auto;
    min-height: 220px;
    height: 240px;
    margin: 0 12px 12px;
}

#parameter-tree-section #parameter-tree-fs-quarter-chart {
    width: 100% !important;
    height: 100% !important;
}

#parameter-tree-section .parameter-tree-fullscreen-overlay-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 6;
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.45);
    background: rgba(15, 20, 25, 0.82);
    color: #f7d774;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    backdrop-filter: blur(4px);
}

#parameter-tree-section .parameter-tree-graph:fullscreen .parameter-tree-fullscreen-overlay-btn,
#parameter-tree-section .parameter-tree-graph:-webkit-full-screen .parameter-tree-fullscreen-overlay-btn,
#parameter-tree-section .parameter-tree-graph.parameter-tree-graph--pseudo-fullscreen .parameter-tree-fullscreen-overlay-btn {
    display: inline-flex;
}

#parameter-tree-section .parameter-tree-fullscreen-overlay-btn:hover {
    background: rgba(212, 175, 55, 0.18);
    border-color: rgba(247, 215, 116, 0.72);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

#parameter-tree-section .parameter-tree-graph-canvas {
    display: inline-block;
    min-width: 100%;
    padding: 8px 12px;
    position: relative;
    zoom: var(--parameter-tree-graph-zoom, 1);
}

#parameter-tree-section .parameter-tree-graph-canvas.compact {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 8px 4px 16px;
}

#parameter-tree-section .parameter-tree-graph-links {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: visible;
    pointer-events: none;
}

#parameter-tree-section .parameter-tree-graph-link {
    stroke: rgba(148, 163, 184, 0.38);
    stroke-width: 1.2;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

#parameter-tree-section .parameter-tree-graph-level {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 18px;
    width: max-content;
    margin: 0 auto;
    padding: 34px 0 0;
    list-style: none;
}

#parameter-tree-section .parameter-tree-graph-canvas.compact .parameter-tree-graph-level {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 28px 16px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding-top: 38px;
}

#parameter-tree-section .parameter-tree-graph-canvas > .parameter-tree-graph-level {
    padding-top: 0;
}

#parameter-tree-section .parameter-tree-graph-canvas.compact > .parameter-tree-graph-level {
    padding-top: 0;
}

#parameter-tree-section .parameter-tree-graph-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 188px;
}

#parameter-tree-section .parameter-tree-graph-canvas.compact .parameter-tree-graph-item.has-children {
    width: 100%;
    min-width: 100%;
}

#parameter-tree-section .parameter-tree-graph-canvas.compact .parameter-tree-graph-item:not(.has-children) {
    flex: 0 1 188px;
}

#parameter-tree-section .parameter-tree-graph-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 188px;
    min-height: 84px;
    padding: 0;
    border: 1px solid rgba(71, 85, 105, 0.72);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.92)),
        radial-gradient(circle at 20% 0%, rgba(59, 130, 246, 0.12), transparent 52%);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    cursor: pointer;
    overflow: visible;
}

#parameter-tree-section .parameter-tree-graph-card:hover {
    border-color: rgba(212, 175, 55, 0.55);
}

#parameter-tree-section .parameter-tree-graph.is-panning .parameter-tree-graph-card {
    cursor: grabbing;
}

#parameter-tree-section .parameter-tree-graph-card.selected-chart-node {
    border-color: rgba(245, 158, 11, 0.86);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.28), 0 12px 28px rgba(0, 0, 0, 0.28);
}

#parameter-tree-section .parameter-tree-graph-card::after {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 3px;
    border-radius: 0 999px 999px 0;
    background: rgba(148, 163, 184, 0.6);
}

#parameter-tree-section .parameter-tree-graph-canvas > .parameter-tree-graph-level > .parameter-tree-graph-item > .parameter-tree-graph-card::before {
    display: none;
}

#parameter-tree-section .parameter-tree-graph-card.hierarchy-top {
    border-color: rgba(212, 175, 55, 0.65);
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.12), 0 10px 26px rgba(0, 0, 0, 0.28);
}

#parameter-tree-section .parameter-tree-graph-card.hierarchy-top::after {
    background: linear-gradient(180deg, #f7d774, #d4af37);
}

#parameter-tree-section .parameter-tree-graph-card.hierarchy-middle {
    border-color: rgba(147, 197, 253, 0.48);
}

#parameter-tree-section .parameter-tree-graph-card.hierarchy-middle::after {
    background: linear-gradient(180deg, #93c5fd, #60a5fa);
}

#parameter-tree-section .parameter-tree-graph-card.missing-value {
    opacity: 0.78;
}

#parameter-tree-section .parameter-tree-graph-card.anchor-node {
    opacity: 1;
    border-color: rgba(168, 85, 247, 0.55);
    border-style: dashed;
    background:
        linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(15, 23, 42, 0.88)),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 7px);
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.08), 0 10px 24px rgba(0, 0, 0, 0.22);
}

#parameter-tree-section .parameter-tree-graph-card.formula-ref-node {
    border-color: rgba(34, 211, 238, 0.42);
    border-style: dashed;
    background:
        linear-gradient(180deg, rgba(8, 47, 73, 0.45), rgba(15, 23, 42, 0.92)),
        radial-gradient(circle at 20% 0%, rgba(34, 211, 238, 0.11), transparent 52%);
}

#parameter-tree-section .parameter-tree-graph-card.formula-ref-node.selected-chart-node {
    border-color: rgba(245, 158, 11, 0.86);
}

#parameter-tree-section .parameter-tree-graph-card.formula-ref-node::after {
    background: linear-gradient(180deg, #67e8f9, #38bdf8);
}

#parameter-tree-section .parameter-tree-graph-card.formula-ref-node .parameter-tree-graph-name {
    color: #a5f3fc;
    background: rgba(8, 47, 73, 0.34);
}

#parameter-tree-section .parameter-tree-graph-card.formula-ref-node .parameter-tree-graph-value {
    background: linear-gradient(180deg, rgba(8, 47, 73, 0.48), rgba(15, 23, 42, 0.72));
    border-color: rgba(34, 211, 238, 0.2);
}

#parameter-tree-section .parameter-tree-graph-name {
    display: block;
    min-height: 68px;
    padding: 10px 12px 9px 14px;
    border-radius: 11px 11px 0 0;
    color: #bfdbfe;
    font-size: 0.76rem;
    line-height: 1.25;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.32);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
    overflow: hidden;
}

#parameter-tree-section .parameter-tree-graph-card.hierarchy-top .parameter-tree-graph-name {
    color: #f7d774;
}

#parameter-tree-section .parameter-tree-graph-card.hierarchy-middle .parameter-tree-graph-name {
    color: #bfdbfe;
}

#parameter-tree-section .parameter-tree-graph-card.anchor-node .parameter-tree-graph-name {
    color: #ddd6fe;
    background: rgba(88, 28, 135, 0.26);
}

.parameter-tree-card-tooltip {
    position: fixed;
    z-index: 10000;
    display: none;
    width: min(360px, calc(100vw - 24px));
    padding: 12px 13px;
    color: #e5e7eb;
    font-size: 0.78rem;
    line-height: 1.35;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.96)),
        radial-gradient(circle at 12% 0%, rgba(245, 158, 11, 0.13), transparent 48%);
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

.parameter-tree-card-tooltip.visible {
    display: block;
}

.parameter-tree-card-tooltip-title {
    margin-bottom: 9px;
    color: #bfdbfe;
    font-weight: 800;
}

.parameter-tree-card-tooltip-note {
    display: inline-flex;
    margin-bottom: 8px;
    padding: 3px 7px;
    color: #a5f3fc;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    background: rgba(8, 145, 178, 0.15);
    border: 1px solid rgba(34, 211, 238, 0.24);
    border-radius: 999px;
}

.parameter-tree-card-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 4px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.parameter-tree-card-tooltip-label {
    flex: 0 0 auto;
    color: rgba(147, 197, 253, 0.92);
    font-family: 'Roboto Mono', monospace;
    font-weight: 800;
}

.parameter-tree-card-tooltip-value {
    min-width: 0;
    color: #fbbf24;
    font-family: 'Roboto Mono', monospace;
    font-weight: 800;
    text-align: right;
    word-break: break-word;
}

.parameter-tree-card-tooltip-value.positive {
    color: #86efac;
}

.parameter-tree-card-tooltip-value.negative {
    color: #fca5a5;
}

.parameter-tree-card-tooltip-formula {
    margin-top: 9px;
    padding: 8px;
    color: rgba(191, 219, 254, 0.94);
    font-family: 'Roboto Mono', monospace;
    font-size: 0.72rem;
    background: rgba(30, 64, 175, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 8px;
    overflow-wrap: anywhere;
}

#parameter-tree-section .parameter-tree-graph-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    margin: 0 10px 10px 14px;
    padding: 8px 9px 7px;
    color: #f8fafc;
    font-family: 'Roboto Mono', monospace;
    line-height: 1.25;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.52), rgba(15, 23, 42, 0.76));
    border: 1px solid rgba(212, 175, 55, 0.18);
    border-radius: 9px;
    text-align: right;
    word-break: break-word;
}

#parameter-tree-section .parameter-tree-graph-value-main {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    width: 100%;
}

#parameter-tree-section .parameter-tree-graph-value-amount {
    color: #fbbf24;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

#parameter-tree-section .parameter-tree-graph-card.hierarchy-top .parameter-tree-graph-value-amount {
    color: #f8fafc;
}

#parameter-tree-section .parameter-tree-graph-value-unit {
    color: rgba(253, 230, 138, 0.9);
    font-family: inherit;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

#parameter-tree-section .parameter-tree-graph-changes {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

#parameter-tree-section .parameter-tree-graph-change-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    color: rgba(203, 213, 225, 0.78);
    font-size: 0.58rem;
    line-height: 1.2;
}

#parameter-tree-section .parameter-tree-graph-change-label {
    flex: 0 0 auto;
    color: rgba(147, 197, 253, 0.92);
    font-weight: 800;
}

#parameter-tree-section .parameter-tree-graph-change-value {
    min-width: 0;
    color: rgba(226, 232, 240, 0.9);
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#parameter-tree-section .parameter-tree-graph-change-value.positive {
    color: #86efac;
}

#parameter-tree-section .parameter-tree-graph-change-value.negative {
    color: #fca5a5;
}

#parameter-tree-section .parameter-tree-graph-card.missing-value .parameter-tree-graph-value {
    color: rgba(148, 163, 184, 0.72);
    background: rgba(148, 163, 184, 0.06);
    border-color: rgba(148, 163, 184, 0.14);
}

#parameter-tree-section .parameter-tree-graph-value.is-missing {
    align-items: center;
}

#parameter-tree-section .parameter-tree-graph-value.is-missing .parameter-tree-graph-value-amount {
    color: rgba(148, 163, 184, 0.72);
    font-size: 0.8rem;
}

#parameter-tree-section .parameter-tree-graph-card.anchor-node .parameter-tree-graph-value {
    color: #c4b5fd;
    background: rgba(88, 28, 135, 0.2);
    border-color: rgba(168, 85, 247, 0.3);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

#parameter-tree-section .parameter-tree-graph-card.anchor-node.missing-value .parameter-tree-graph-value {
    display: none;
}

#parameter-tree-section .parameter-tree-graph-card.anchor-node.missing-value .parameter-tree-graph-name {
    border-radius: 11px;
}

#parameter-tree-section .parameter-tree-graph-formula {
    display: -webkit-box;
    box-sizing: border-box;
    width: calc(100% - 24px);
    max-height: 54px;
    margin: 0 10px 10px 14px;
    padding: 7px 8px;
    overflow: hidden;
    color: rgba(191, 219, 254, 0.92);
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    background: rgba(30, 64, 175, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.22);
    border-radius: 8px;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

#parameter-tree-section #parameter-tree-selector-list {
    height: 520px;
    min-height: 220px;
    max-height: 82vh;
}

#parameter-tree-section .parameter-tree-selector-row.selected-root {
    background: rgba(212, 175, 55, 0.18);
    box-shadow: inset 2px 0 0 var(--accent-gold);
}

#parameter-tree-section .parameter-tree-value-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 3px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.82rem;
}

#parameter-tree-section .parameter-tree-value-row:hover {
    background: rgba(212, 175, 55, 0.1);
}

#parameter-tree-section .parameter-tree-value-row.selected-chart-node {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.14);
    box-shadow: inset 2px 0 0 #f59e0b;
}

#parameter-tree-section .parameter-tree-value-row.hierarchy-top {
    color: #d4af37;
    font-weight: 700;
}

#parameter-tree-section .parameter-tree-value-row.hierarchy-middle {
    color: #93c5fd;
    font-weight: 600;
}

#parameter-tree-section .parameter-tree-value-row.missing-value .parameter-tree-value-number {
    color: rgba(148, 163, 184, 0.62);
}

#parameter-tree-section .parameter-tree-value-toggle,
#parameter-tree-section .parameter-tree-value-spacer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

#parameter-tree-section .parameter-tree-value-toggle {
    color: var(--accent-gold);
    cursor: pointer;
    transition: transform 0.15s ease;
}

#parameter-tree-section .parameter-tree-value-toggle.expanded {
    transform: rotate(90deg);
}

#parameter-tree-section .parameter-tree-value-label {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#parameter-tree-section .parameter-tree-value-number {
    flex: 0 0 auto;
    max-width: 42%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e5e7eb;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.78rem;
    text-align: right;
}

@media (max-width: 900px) {
    #parameter-tree-section .parameter-tree-layout {
        grid-template-columns: 1fr;
    }

    #parameter-tree-section .parameter-tree-column-resizer {
        display: none;
    }

    #parameter-tree-section .parameter-tree-values-controls {
        align-items: stretch;
        flex-direction: column;
    }

    #parameter-tree-section .parameter-tree-selected-name,
    #parameter-tree-section .parameter-tree-value-number {
        max-width: 50%;
    }

    #parameter-tree-section .parameter-tree-view-toggle {
        align-self: flex-start;
    }
}

tr.metadata-hierarchy-top td {
    font-weight: 700;
}
tr.metadata-hierarchy-top td.col-parameter_name_ru {
    color: #d4af37;
}
tr.metadata-hierarchy-middle td {
    font-weight: 600;
}
tr.metadata-hierarchy-middle td.col-parameter_name_ru {
    color: #93c5fd;
}
tr.metadata-hierarchy-leaf td.col-parameter_name_ru {
    color: #cbd5e1;
}

.tree-mini-btn {
    background: linear-gradient(180deg, rgba(71, 85, 105, 0.75), rgba(30, 41, 59, 0.85));
    border: 1px solid rgba(212, 175, 55, 0.45);
    color: #f8fafc;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.tree-mini-btn:hover {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.35), rgba(161, 98, 7, 0.35));
    color: #fef3c7;
    border-color: rgba(245, 208, 84, 0.9);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.tree-mini-btn.active {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.38), rgba(161, 98, 7, 0.42));
    color: #fef3c7;
    border-color: rgba(245, 208, 84, 0.95);
    box-shadow: 0 0 0 1px rgba(245, 208, 84, 0.28) inset, 0 4px 10px rgba(0, 0, 0, 0.35);
}

.tree-mini-btn:focus-visible {
    outline: none;
    border-color: rgba(245, 208, 84, 0.95);
    box-shadow: 0 0 0 2px rgba(245, 208, 84, 0.25), 0 4px 10px rgba(0, 0, 0, 0.35);
}

.tree-toggle-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    margin-left: 8px;
    user-select: none;
}

.tree-toggle-input {
    display: none;
}

.tree-toggle-switch {
    position: relative;
    width: 32px;
    height: 16px;
    background: rgba(75, 85, 99, 0.6);
    border-radius: 8px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}

.tree-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: #94a3b8;
    border-radius: 50%;
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.tree-toggle-input:checked + .tree-toggle-switch {
    background: rgba(212, 175, 55, 0.4);
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.tree-toggle-input:checked + .tree-toggle-switch::after {
    transform: translateX(16px);
    background: #d4af37;
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.5);
}

.tree-toggle-text {
    color: #64748b;
    font-weight: 500;
    transition: color 0.3s ease;
}

.tree-toggle-input:checked ~ .tree-toggle-text {
    color: #d4af37;
    font-weight: 600;
}

.custom-multiselect-item.hierarchy-top .custom-multiselect-label {
    color: #d4af37;
    font-weight: 700;
}

.custom-multiselect-item.hierarchy-middle .custom-multiselect-label {
    color: #93c5fd;
    font-weight: 600;
    padding-left: 12px;
}

.custom-multiselect-item.hierarchy-leaf .custom-multiselect-label {
    color: #cbd5e1;
    font-weight: 400;
    padding-left: 24px;
}

.param-list-actions {
    padding: 10px 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.param-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.65);
    border: 2px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.param-action-btn:hover {
    background: rgba(212, 175, 55, 0.18);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.2);
}

.param-action-btn:active {
    transform: translateY(1px);
}

.param-action-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.param-action-btn-add {
    border-color: rgba(16, 185, 129, 0.65);
    color: #6ee7b7;
    background: rgba(6, 78, 59, 0.45);
}

.param-action-btn-add:hover {
    background: rgba(16, 185, 129, 0.22);
    border-color: #34d399;
    color: #a7f3d0;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.param-action-btn-remove {
    border-color: rgba(248, 113, 113, 0.55);
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.35);
}

.param-action-btn-remove:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: #f87171;
    color: #fecaca;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.22);
}

.param-action-btn-compact {
    min-width: 3.25rem;
    padding-left: 14px;
    padding-right: 14px;
    font-size: 15px;
    letter-spacing: 0.12em;
    font-weight: 800;
}

#analytics-param-group-dropdown {
    min-width: 400px;
}

#analytics-param-group-dropdown .dropdown-menu {
    min-width: 400px;
}

.btn-generate-description {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    color: var(--text-secondary);
    align-self: flex-start;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.btn-generate-description:hover {
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.5);
    color: var(--text-primary);
}

.btn-generate-description:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-generate-description svg {
    flex-shrink: 0;
}

.analytics-label {
    color: var(--accent-gold);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 80px;
}

.analytics-select {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 300px;
}

.analytics-select:hover {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.analytics-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.analytics-content-wrapper {
    margin-top: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    background: rgba(30, 35, 42, 0.85);
    overflow-anchor: none;
}

.analytics-lines-wrapper {
    display: flex;
    flex-direction: column;
}

.analytics-line {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.analytics-line:hover {
    background: rgba(255, 255, 255, 0.02);
}

.analytics-line-number {
    min-width: 35px;
    text-align: right;
    color: rgba(212, 175, 55, 0.5);
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85em;
    user-select: none;
    padding-right: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.analytics-line-content {
    flex: 1;
}

.analytics-content-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: background 0.2s;
}

.analytics-content-header:hover {
    background: var(--bg-card-hover);
}

.analytics-content-header.collapsed {
    border-radius: 6px;
    border-bottom: none;
}

.analytics-collapse-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-gold);
    transition: transform 0.2s;
}

.analytics-content-header:not(.collapsed) .analytics-collapse-icon {
    transform: rotate(90deg);
}

.analytics-content-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-gold);
    flex-shrink: 0;
}

.narrative-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    margin-left: 10px;
}

.narrative-header-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.2);
    padding: 1px 8px;
    border-radius: 3px;
    white-space: nowrap;
    font-family: 'Roboto Mono', monospace;
}

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

.analytics-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.analytics-copy-btn:hover {
    background: var(--bg-card-hover);
    color: var(--accent-gold);
    border-color: var(--accent-gold);
}

.analytics-copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border-color: #10b981;
}

.analytics-content {
    background: var(--bg-secondary);
    border: none;
    border-radius: 0 0 6px 6px;
    padding: 20px;
    min-height: 150px;
    max-height: 500px;
    overflow-y: auto;
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 1rem;
    white-space: pre-wrap;
    font-family: 'Inter', sans-serif;
    resize: vertical;
}

.analytics-content::-webkit-scrollbar {
    width: 10px;
}

.analytics-content::-webkit-scrollbar-track {
    background: #3a3f4b;
    border-radius: 5px;
}

.analytics-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d4ff 0%, #38bdf8 50%, #00d4ff 100%);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5),
                0 0 20px rgba(0, 212, 255, 0.3);
}

.analytics-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00e5ff 0%, #4fc3f7 50%, #00e5ff 100%);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.7),
                0 0 30px rgba(0, 212, 255, 0.5);
}

.narrative-zero-warning {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 6px 8px;
    background: rgba(234, 179, 8, 0.06);
    border: 1px solid rgba(234, 179, 8, 0.25);
    border-left: 3px solid #eab308;
    border-radius: 6px;
    padding: 14px 18px;
}
.narrative-zero-warning .nzw-icon {
    color: #eab308;
    font-size: 15px;
    filter: drop-shadow(0 0 4px rgba(234, 179, 8, 0.5));
}
.narrative-zero-warning .nzw-title {
    font-size: 13px;
    font-weight: 600;
    color: #fbbf24;
    margin-right: 4px;
}
.narrative-zero-warning .nzw-params {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
    justify-content: center;
}
.narrative-zero-warning .nzw-tag {
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.22);
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 10px;
    color: #fbbf24;
    font-family: 'Roboto Mono', monospace;
    white-space: nowrap;
}
.narrative-zero-warning .nzw-hint {
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.analytics-content .analytics-header {
    color: var(--accent-gold);
    font-weight: 600;
}

.analytics-content .analytics-quoted {
    color: #22d3ee;
    font-style: italic;
}

.analytics-content .analytics-number {
    color: #f9a8d4;
    font-weight: 500;
}

.analytics-content .analytics-quarter {
    background: rgba(234, 179, 8, 0.15);
    padding: 1px 4px;
    border-radius: 3px;
    display: inline;
    color: #fbbf24;
}

.analytics-content .analytics-quarter .quarter-year-digits {
    color: #fbbf24;
    font-weight: 400;
}

.analytics-content .analytics-quarter .quarter-y-letter {
    color: #34d399;
    font-weight: 700;
}

.analytics-content .analytics-quarter .quarter-q-number {
    color: #fbbf24;
    font-weight: 400;
}

.analytics-content .analytics-quarter .quarter-q-letter {
    color: #34d399;
    font-weight: 700;
}

.analytics-content .analytics-q2q {
    color: #a78bfa;
    font-weight: 600;
    background: rgba(167, 139, 250, 0.15);
    padding: 1px 4px;
    border-radius: 3px;
}

.analytics-selection-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.analytics-selection-header .selection-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.analytics-selection-header .selection-label {
    color: #f59e0b;
    font-weight: 600;
}

.analytics-selection-header .selection-value {
    color: #e5e7eb;
}

.analytics-selection-header .selection-groups {
    color: #10b981;
    font-weight: 500;
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 16px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    padding: 4px 8px;
}

.font-size-btn {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s ease;
}

.font-size-btn:hover {
    background: rgba(245, 158, 11, 0.3);
    border-color: #f59e0b;
}

.font-size-value {
    color: #e5e7eb;
    font-size: 12px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.multiselect-option {
    display: flex;
    align-items: center;
    gap: 8px;
}

.multiselect-checkbox {
    color: var(--accent-gold);
    font-size: 14px;
}

.multiselect-label {
    flex: 1;
}

.analytics-content .analytics-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 14px 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(34, 211, 238, 0.08) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.analytics-content .analytics-group-badge,
.analytics-content .analytics-subgroup-badge {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.analytics-content .analytics-group-label,
.analytics-content .analytics-subgroup-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.analytics-content .analytics-group-label {
    color: var(--accent-gold);
}

.analytics-content .analytics-subgroup-label {
    color: #22d3ee;
}

.analytics-content .analytics-group-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.analytics-content .analytics-subgroup-value {
    font-size: 14px;
    font-weight: 600;
    color: #22d3ee;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

.analytics-content .analytics-group-separator {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 300;
}

.analytics-placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
    font-size: 0.95rem;
}

.analytics-content p {
    margin-bottom: 12px;
}

.analytics-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

/* Chart Section */
.chart-controls {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 24px;
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    position: relative;
}

.chart-control-group {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 20px;
}

.chart-group-title {
    color: var(--accent-gold);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--accent-gold);
    padding-bottom: 8px;
}

.chart-params {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-param {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-select:hover {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.chart-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.chart-select option {
    background: #1a1d24;
    color: var(--text-primary);
    padding: 10px;
}

.chart-select option.group-option {
    background: #12151a;
    color: var(--accent-gold);
    font-weight: 700;
    text-transform: uppercase;
}

.chart-select option.subgroup-option {
    background: #1a1d24;
    color: var(--text-secondary);
    padding-left: 24px;
}

.chart-type-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 4px;
    border: 1px solid var(--border-subtle);
}

.chart-type-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 34px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chart-type-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.chart-type-btn.active {
    background: var(--accent-gold);
    color: var(--bg-primary);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.chart-type-btn svg {
    width: 18px;
    height: 18px;
}

.chart-options {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 12px 0;
    margin-top: 8px;
}

.chart-options-row {
    display: flex;
    align-items: center;
    gap: 32px;
    flex-wrap: wrap;
    justify-content: center;
}

.chart-param-start-period {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 12px;
    min-width: 320px;
}

.chart-param-start-period .chart-label {
    margin-bottom: 0 !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.chart-param-start-period .custom-dropdown-container {
    min-width: 150px;
    flex: 1;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid var(--border-subtle);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #9ca3af;
    border-radius: 50%;
    top: 2px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--accent-gold);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: var(--accent-gold);
}

.toggle-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

.toggle-switch input:checked ~ .toggle-label {
    color: var(--accent-gold);
}

.btn-update-chart {
    grid-column: 1 / -1;
    background: var(--accent-gold);
    color: var(--bg-primary);
    border: none;
    border-radius: 4px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

.btn-update-chart:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-update-chart:active {
    transform: translateY(0);
}

.chart-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 24px;
    position: relative;
    width: 100%;
}

.chart-wrapper {
    width: 100%;
    height: 440px;
    position: relative;
}

.chart-container canvas {
    width: 100% !important;
}

.chart-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('../images/chart_placeholder_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.chart-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 31, 44, 0.75);
    border-radius: 4px;
}

.chart-placeholder-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--text-muted);
}

.chart-placeholder-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.chart-placeholder-content p {
    font-size: 14px;
    color: var(--text-secondary);
}

.chart-placeholder.hidden {
    display: none;
}

.chart-status {
    margin-top: 48px;
    padding: 10px 16px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    color: #9ca3af;
    min-height: 20px;
    line-height: 1.6;
}

.chart-status .status-chart-label {
    color: #9ca3af;
    font-weight: 500;
}

.chart-status .status-company {
    color: #f59e0b;
    font-weight: 600;
}

.chart-status .status-parameter {
    color: #60a5fa;
    font-weight: 500;
}

.chart-status .status-value-type {
    color: #a78bfa;
    font-weight: 400;
}

.chart-status .status-separator {
    color: #4b5563;
}

.chart-status .status-divider {
    color: #6b7280;
}

.chart-status.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    border-left: 3px solid #ef4444;
}

.chart-status.warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 4px;
    border-left: 3px solid #f59e0b;
}

.chart-status.success {
    color: #10b981;
}

.section-status-bar {
    display: none;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 16px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    font-size: 12px;
    max-width: 500px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-status-bar .status-error {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #f87171;
    font-weight: 500;
}

.section-status-bar .status-error svg {
    flex-shrink: 0;
    stroke: #f87171;
}

.section-status-bar .status-warning {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fbbf24;
    font-weight: 500;
}

.section-status-bar .status-success {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #34d399;
    font-weight: 500;
}

.chart-custom-legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
}

.chart-legend-color {
    width: 16px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.chart-legend-company {
    color: var(--accent-gold);
    font-weight: 600;
}

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

.chart-legend-parameter {
    color: #60a5fa;
    font-weight: 400;
}

@media (max-width: 768px) {
    .chart-custom-legend {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .chart-legend-item {
        flex-wrap: wrap;
    }
}

@media (max-width: 1200px) {
    .chart-controls {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 2100px;
    }
}

#ai-analysis-section {
    margin-top: 24px;
    overflow: visible;
    isolation: isolate;
}

.ai-analysis-controls {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
    align-items: end;
}

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

.ai-label {
    color: var(--accent-gold);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-company-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--accent-gold);
    padding: 10px 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    min-height: 42px;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.ai-company-select:hover {
    border-color: var(--accent-gold);
    background-color: var(--bg-card);
}

.ai-company-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.ai-company-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
    font-weight: 500;
}

.ai-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-select:hover {
    border-color: var(--border-medium);
    background: var(--bg-card);
}

.ai-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.ai-model-select {
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-primary);
    padding: 10px 12px;
    min-width: 280px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 42px;
    width: 100%;
}

.ai-model-select:hover {
    border-color: rgba(245, 158, 11, 0.3);
    background: var(--bg-card);
}

.ai-model-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.ai-model-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px;
    outline: none;
}

.ai-model-select option:hover,
.ai-model-select option:checked {
    background: rgba(245, 158, 11, 0.2);
}

.ai-model-select optgroup {
    background: var(--bg-primary);
    color: var(--accent-gold);
    font-style: normal;
    font-weight: 600;
    font-size: 12px;
    padding-top: 4px;
}

.ai-model-select:active,
.ai-model-select:focus-within {
    outline: none;
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15);
}

.ai-model-select::-webkit-scrollbar { width: 6px; }
.ai-model-select::-webkit-scrollbar-track { background: var(--bg-primary); border-radius: 3px; }
.ai-model-select::-webkit-scrollbar-thumb { background: rgba(245, 158, 11, 0.4); border-radius: 3px; }
.ai-model-select::-webkit-scrollbar-thumb:hover { background: rgba(245, 158, 11, 0.6); }
.ai-model-select { scrollbar-width: thin; scrollbar-color: rgba(245, 158, 11, 0.4) var(--bg-primary); }

.csel-wrapper {
    position: relative;
    display: inline-block;
    min-width: 200px;
}
.csel-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
    height: 42px;
    width: 100%;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}
.csel-btn:hover {
    border-color: rgba(245, 158, 11, 0.3);
    background: var(--bg-card);
}
.csel-wrapper.open .csel-btn {
    border-color: rgba(245, 158, 11, 0.5);
}
.csel-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.csel-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}
.csel-wrapper.open .csel-arrow {
    transform: rotate(180deg);
}
.csel-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 6px;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.4) var(--bg-primary);
}
.csel-dropdown::-webkit-scrollbar { width: 6px; }
.csel-dropdown::-webkit-scrollbar-track { background: var(--bg-primary); border-radius: 3px; }
.csel-dropdown::-webkit-scrollbar-thumb { background: rgba(245, 158, 11, 0.4); border-radius: 3px; }
.csel-dropdown::-webkit-scrollbar-thumb:hover { background: rgba(245, 158, 11, 0.6); }
.csel-wrapper.open .csel-dropdown {
    display: block;
}
.csel-group {
    padding: 6px 12px 3px;
    color: var(--accent-gold);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
    border-top: 1px solid rgba(245, 158, 11, 0.1);
}
.csel-group:first-child {
    border-top: none;
}
.csel-item {
    padding: 7px 12px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.csel-item:hover {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
}
.csel-item.selected {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-gold);
}

/* AI Dialog Panel */
.ai-dialog-section {
    margin-top: 24px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 24px;
    /* Не дёргать позицию скролла окна при смене высоты блока (подсказки, ответ) */
    overflow-anchor: none;
    position: relative;
    overflow: visible;
}

#ai-dialog-panel-section .ai-dialog-section {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

.ai-dialog-header-controls {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
    gap: 10px 14px;
    width: 100%;
    align-items: start;
}

.ai-dialog-controls-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.ai-dialog-header-controls .ai-control-group {
    display: grid;
    grid-template-columns: 210px minmax(220px, 1fr);
    gap: 10px;
    align-items: center;
}

.ai-dialog-header-controls .ai-control-group .ai-label {
    margin: 0;
    white-space: normal;
    line-height: 1.25;
}

.ai-dialog-company-control {
    min-width: 0;
}

#ai-dialog-company-dropdown-container {
    width: 100%;
}

.ai-dialog-source-filter {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: 1 1 auto;
}

#ai-dialog-source-list {
    max-height: 320px;
}

.ai-dialog-controls-col--right .ai-model-select,
.ai-dialog-controls-col--right .custom-dropdown-container,
.ai-dialog-controls-col--right .ai-dialog-period-range-wrap {
    width: 100%;
}

.ai-dialog-period-range-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.ai-dialog-period-range-slider {
    position: relative;
    height: 26px;
}

.ai-dialog-period-range-scale {
    position: relative;
    height: 16px;
}

.ai-dialog-period-range-scale-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: rgba(148, 163, 184, 0.9);
    font-size: 10px;
    line-height: 1;
    user-select: none;
    white-space: nowrap;
}

.ai-dialog-period-range-scale-tick::before {
    content: '';
    width: 1px;
    height: 5px;
    background: rgba(148, 163, 184, 0.55);
    border-radius: 999px;
}

.ai-dialog-period-range-track,
.ai-dialog-period-range-fill {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 4px;
    border-radius: 999px;
    transform: translateY(-50%);
}

.ai-dialog-period-range-track {
    background: rgba(148, 163, 184, 0.35);
}

.ai-dialog-period-range-fill {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.95), rgba(52, 211, 153, 0.95));
    left: 0;
    right: 100%;
}

.ai-dialog-period-slider {
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    margin: 0;
    transform: translateY(-50%);
    pointer-events: none;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
}

.ai-dialog-period-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: transparent;
}

.ai-dialog-period-slider::-moz-range-track {
    height: 4px;
    background: transparent;
}

.ai-dialog-period-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #10b981;
    background: #052e24;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    pointer-events: auto;
    cursor: pointer;
    margin-top: -5px;
}

.ai-dialog-period-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #10b981;
    background: #052e24;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    pointer-events: auto;
    cursor: pointer;
}

.ai-dialog-period-slider--start {
    z-index: 3;
}

.ai-dialog-period-slider--end {
    z-index: 4;
}

.ai-dialog-period-range-values {
    position: relative;
    height: 24px;
}

.ai-dialog-period-range-sep {
    color: rgba(148, 163, 184, 0.9);
    font-size: 12px;
    font-weight: 700;
}

.ai-dialog-period-slider-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(-50%);
    flex: 0 0 auto;
    min-width: 74px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(16, 185, 129, 0.38);
    background: rgba(16, 185, 129, 0.12);
    color: #86efac;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.ai-dialog-period-slider-value--start {
    z-index: 3;
}

.ai-dialog-period-slider-value--end {
    z-index: 4;
}

.ai-dialog-macro-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    user-select: none;
    padding: 10px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), rgba(15, 23, 42, 0.45));
    min-height: 40px;
    transition: border-color 0.2s ease, background 0.2s ease;
    cursor: pointer;
}

.ai-dialog-macro-toggle:hover {
    border-color: rgba(212, 175, 55, 0.55);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.16), rgba(15, 23, 42, 0.55));
}

.ai-dialog-macro-toggle input[type="checkbox"] {
    accent-color: var(--accent-gold);
    width: 16px;
    height: 16px;
}

.ai-dialog-macro-toggle-group .ai-label {
    align-self: center;
}

.ai-dialog-extra-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 1200px) {
    .ai-dialog-header-controls {
        grid-template-columns: 1fr;
    }
    .ai-dialog-header-controls .ai-control-group {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    body .container > header.header {
        display: none !important;
    }

    .quick-nav,
    #sources-section,
    #companies-section,
    #ai-analysis-section,
    #outliers-section,
    #kohonen-section {
        display: none !important;
    }

    .main-content {
        display: block;
        gap: 0;
    }

    #ai-dialog-panel-section {
        margin-top: 0;
    }

    #ai-dialog-panel-section.glass-panel {
        padding: 10px;
        border-radius: 8px;
    }

    #ai-dialog-panel-content.collapsible-content,
    #ai-dialog-panel-content.collapsible-content.collapsed {
        max-height: none !important;
        opacity: 1 !important;
        overflow: visible !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin: 0 !important;
    }

    #ai-dialog-panel-section .section-header {
        padding: 8px 10px;
        margin-bottom: 8px;
    }

    #ai-dialog-panel-section .section-subtitle {
        font-size: 10px;
        line-height: 1.35;
    }

    #ai-dialog-panel-section .collapse-toggle {
        display: none;
    }

    #ai-dialog-panel-section .scroll-top-btn {
        display: none;
    }

    #ai-dialog-panel-section .ai-dialog-header {
        gap: 8px;
        margin-bottom: 10px;
    }

    #ai-dialog-panel-section .ai-dialog-header-top {
        gap: 8px;
    }

    #ai-dialog-panel-section .ai-dialog-period-tags {
        width: 100%;
    }

    #ai-dialog-panel-section .ai-dialog-section-period-center {
        position: static;
        transform: none;
        width: 100%;
        justify-content: flex-start;
        margin-top: 6px;
    }

    #ai-dialog-panel-section .ai-dialog-title {
        font-size: 14px;
    }

    #ai-dialog-panel-section .ai-dialog-hint {
        font-size: 11px;
        width: 100%;
    }

    #ai-dialog-panel-section .ai-dialog-header-controls {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    #ai-dialog-panel-section .ai-dialog-controls-col {
        gap: 8px;
    }

    #ai-dialog-panel-section .ai-dialog-header-controls .ai-control-group {
        grid-template-columns: 112px minmax(0, 1fr);
        gap: 8px;
        align-items: center;
    }

    #ai-dialog-panel-section .ai-dialog-header-controls .ai-label {
        font-size: 10px;
        letter-spacing: 0.3px;
    }

    #ai-dialog-panel-section .ai-dialog-source-filter .ai-label {
        align-self: start;
        padding-top: 6px;
    }

    #ai-dialog-panel-section .ai-dialog-controls-col--right .ai-model-select,
    #ai-dialog-panel-section .ai-dialog-controls-col--right .custom-dropdown-container,
    #ai-dialog-panel-section .ai-dialog-controls-col--right .ai-dialog-period-range-wrap,
    #ai-dialog-panel-section #ai-dialog-company-dropdown-container {
        width: 100%;
    }

    #ai-dialog-source-list {
        max-height: 220px;
    }

    #ai-dialog-panel-section .ai-selectable-row {
        padding: 8px 10px;
        font-size: 11px;
    }

    #ai-dialog-panel-section .ai-dialog-period-slider-value {
        min-width: 58px;
        font-size: 10px;
        padding: 4px 6px;
    }

    #ai-dialog-panel-section .ai-dialog-period-range-scale-tick {
        font-size: 9px;
    }

    #ai-dialog-panel-section .ai-dialog-container {
        min-height: 260px;
        height: 46vh;
        max-height: 52vh;
        resize: none;
    }

    #ai-dialog-panel-section .ai-dialog-presets {
        margin-bottom: 10px;
        gap: 8px;
    }

    #ai-dialog-panel-section .ai-dialog-question-pick .ai-dialog-questions-btn {
        width: 100%;
        justify-content: center;
    }

    #ai-dialog-panel-section .ai-dialog-presets-actions {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    #ai-dialog-panel-section #ai-dialog-copy,
    #ai-dialog-panel-section #ai-dialog-clear,
    #ai-dialog-panel-section #ai-dialog-font-decrease,
    #ai-dialog-panel-section #ai-dialog-font-increase,
    #ai-dialog-panel-section #ai-dialog-open-questions-btn,
    #ai-dialog-panel-section #ai-dialog-tips {
        display: none !important;
    }

    #ai-dialog-panel-section .ai-dialog-open-fullscreen-btn {
        display: inline-flex;
    }

    #ai-dialog-panel-section .ai-dialog-input-container {
        gap: 8px;
    }

    #ai-dialog-panel-section .ai-dialog-input {
        padding: 10px 12px;
        font-size: 13px;
    }

    #ai-dialog-panel-section .btn-ai-send {
        padding: 10px 12px;
        min-width: 46px;
    }

    #ai-dialog-panel-section .ai-dialog-tips {
        margin-top: 10px;
        padding: 10px 12px;
    }

    #ai-dialog-panel-section .ai-dialog-avatar-container {
        display: none;
    }
}

.ai-dialog-section.ai-dialog-section--fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 30000;
    margin: 0;
    padding: 20px 24px 16px;
    border-top: none;
    background: linear-gradient(160deg, rgba(12, 18, 30, 0.97), rgba(7, 11, 21, 0.99));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.ai-dialog-fullscreen-placeholder {
    display: block;
    width: 100%;
    min-height: 1px;
}

.ai-dialog-reply-fullscreen-overlay {
    position: fixed;
    inset: 0;
    z-index: 32060;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(5, 8, 14, 0.88);
    backdrop-filter: blur(6px);
    padding: 20px;
    box-sizing: border-box;
}

.ai-dialog-reply-fullscreen-panel {
    width: min(1200px, 100%);
    height: min(92dvh, 100%);
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: 14px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: linear-gradient(180deg, rgba(22, 29, 42, 0.96), rgba(11, 16, 28, 0.98));
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.ai-dialog-reply-fullscreen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.ai-dialog-reply-fullscreen-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-gold);
    letter-spacing: 0.2px;
}

.ai-dialog-reply-fullscreen-close {
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.65);
    color: var(--text-secondary);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    line-height: 1;
    font-size: 22px;
    cursor: pointer;
}

.ai-dialog-reply-fullscreen-close:hover {
    border-color: rgba(245, 158, 11, 0.42);
    color: var(--accent-gold);
}

.ai-dialog-reply-fullscreen-body {
    flex: 1;
    overflow: auto;
    min-height: 0;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.68) rgba(15, 23, 42, 0.55);
}

.ai-dialog-reply-fullscreen-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.ai-dialog-reply-fullscreen-body::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.55);
    border-radius: 12px;
}

.ai-dialog-reply-fullscreen-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.95), rgba(217, 119, 6, 0.92));
    border-radius: 12px;
    border: 2px solid rgba(15, 23, 42, 0.72);
}

.ai-dialog-reply-fullscreen-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(252, 211, 77, 0.98), rgba(234, 88, 12, 0.95));
}

.ai-dialog-reply-fullscreen-body::-webkit-scrollbar-corner {
    background: transparent;
}

.ai-dialog-reply-fullscreen-body .ai-dialog-bubble {
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-bottom-right-radius: 12px;
    cursor: default;
}

.ai-dialog-reply-fullscreen-body .ai-results-content--fullscreen {
    overflow: visible;
    min-height: auto;
    max-height: none;
    border-radius: 10px;
}

.ai-dialog-reply-fullscreen-body .ai-dialog-open-fullscreen-btn {
    display: none !important;
}

.ai-dialog-section.ai-dialog-section--fullscreen .ai-dialog-header,
.ai-dialog-section.ai-dialog-section--fullscreen .ai-dialog-presets,
.ai-dialog-section.ai-dialog-section--fullscreen .ai-dialog-input-container,
.ai-dialog-section.ai-dialog-section--fullscreen .ai-dialog-question-pick,
.ai-dialog-section.ai-dialog-section--fullscreen .ai-dialog-tips {
    flex: 0 0 auto;
}

.ai-dialog-section.ai-dialog-section--fullscreen .ai-dialog-container {
    flex: 1 1 auto;
    min-height: 260px;
    height: auto;
    max-height: none;
    resize: none;
}

.ai-dialog-section.ai-dialog-section--fullscreen .ai-dialog-avatar-container {
    display: none;
}

.ai-dialog-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-dialog-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-dialog-period-tags {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
    pointer-events: auto;
}

.ai-dialog-period-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 7px;
    border: 1px solid rgba(16, 185, 129, 0.42);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(2, 132, 199, 0.1));
    color: #86efac;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.ai-dialog-period-tag-sep {
    color: rgba(148, 163, 184, 0.95);
    font-size: 12px;
    font-weight: 700;
}

.ai-dialog-settings-panel {
    width: 100%;
}

.ai-dialog-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-dialog-fullscreen-btn.is-active {
    background: rgba(245, 158, 11, 0.16);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.ai-dialog-copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-dialog-copy-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.ai-dialog-copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.ai-dialog-icon-only-btn {
    width: 32px;
    min-width: 32px;
    justify-content: center;
    padding: 0;
    gap: 0;
}

.ai-dialog-clear-btn {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.78);
    color: #f87171;
}

.ai-dialog-clear-btn:hover {
    background: rgba(239, 68, 68, 0.28);
    border-color: rgba(248, 113, 113, 0.95);
    color: #fca5a5;
}

.ai-dialog-clear-btn.cleared {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.ai-dialog-tips {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
}

.ai-dialog-tips-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-gold);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.ai-dialog-tips.ai-dialog-tips--context-mode .ai-dialog-tips-header {
    cursor: pointer;
    user-select: none;
}

.ai-dialog-tips.ai-dialog-tips--context-mode .ai-dialog-tips-header::after {
    content: '▾';
    margin-left: auto;
    font-size: 12px;
    line-height: 1;
    color: rgba(253, 224, 71, 0.9);
    transition: transform 0.18s ease;
}

.ai-dialog-tips.ai-dialog-tips--context-collapsed .ai-dialog-tips-header {
    margin-bottom: 0;
}

.ai-dialog-tips.ai-dialog-tips--context-collapsed .ai-dialog-tips-header::after {
    transform: rotate(-90deg);
}

.ai-dialog-tips.ai-dialog-tips--context-collapsed #ai-dialog-tips-inner {
    display: none;
}

.ai-dialog-tips-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.6;
}

.ai-dialog-tips-list li {
    margin-bottom: 4px;
}

.ai-dialog-tips-list li:last-child {
    margin-bottom: 0;
}

.ai-dialog-context-inline {
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
}

.ai-dialog-context-inline .ai-dialog-context-sep {
    margin: 0 0.4em;
    opacity: 0.45;
    user-select: none;
}

.ai-dialog-context-params-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px 8px;
    margin-top: 8px;
    padding-left: 20px;
    font-size: 0.7em;
    color: #9ca3af; /* светло-серый */
}

.ai-dialog-context-param-item {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-dialog-avatar-container {
    margin-top: 50px;
    margin-bottom: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: visible;
    isolation: isolate;
}

.ai-dialog-avatar {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.ai-dialog-avatar img {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 2;
    border: 3px solid var(--accent-gold);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    animation: avatarShimmer 4s ease-in-out infinite, avatarRingPulse 3s ease-in-out infinite;
    cursor: pointer;
    transition: box-shadow 0.3s ease, filter 0.3s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: filter, box-shadow;
}

.ai-avatar-glow {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--accent-gold), var(--accent-cyan), var(--accent-gold));
    background-size: 300% 300%;
    animation: avatarGlow 3s ease-in-out infinite, avatarPulse 2s ease-in-out infinite;
    z-index: 1;
    opacity: 0.6;
    filter: blur(8px);
    transform: translateZ(0);
    will-change: opacity, filter;
}

@keyframes avatarGlow {
    0%, 100% {
        background-position: 0% 50%;
        filter: blur(8px) brightness(1);
    }
    25% {
        background-position: 50% 100%;
        filter: blur(10px) brightness(1.2);
    }
    50% {
        background-position: 100% 50%;
        filter: blur(12px) brightness(1.4);
    }
    75% {
        background-position: 50% 0%;
        filter: blur(10px) brightness(1.2);
    }
}

@keyframes avatarPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.9;
    }
}

@keyframes avatarShimmer {
    0% {
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
    25% {
        filter: brightness(1.1) saturate(1.1);
    }
    50% {
        filter: brightness(1.2) saturate(1.2);
        transform: scale(1.02);
    }
    75% {
        filter: brightness(1.1) saturate(1.1);
    }
    100% {
        filter: brightness(1) saturate(1);
        transform: scale(1);
    }
}

@keyframes avatarRingPulse {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(212, 175, 55, 0.3),
            0 0 30px rgba(212, 175, 55, 0.2),
            inset 0 0 20px rgba(212, 175, 55, 0.1);
    }
    50% {
        box-shadow: 
            0 0 25px rgba(212, 175, 55, 0.5),
            0 0 50px rgba(212, 175, 55, 0.3),
            0 0 80px rgba(100, 200, 255, 0.2),
            inset 0 0 30px rgba(212, 175, 55, 0.2);
    }
}

.ai-dialog-avatar:hover .ai-avatar-glow {
    opacity: 0.9;
    filter: blur(10px);
}

.ai-dialog-avatar:hover img {
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
}

.ai-avatar-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(30, 35, 45, 0.98), rgba(20, 25, 35, 0.98));
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    padding: 12px 16px;
    width: 280px;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 20px rgba(212, 175, 55, 0.15);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    will-change: opacity, transform;
}

.ai-avatar-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(212, 175, 55, 0.4);
}

.ai-avatar-tooltip strong {
    color: #d4af37;
    font-size: 14px;
    display: block;
    margin-bottom: 6px;
}

.ai-dialog-avatar:hover .ai-avatar-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.avatar-tooltip {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    will-change: opacity, transform;
}

.avatar-tooltip.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.avatar-tooltip-content {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(185, 28, 28, 0.95));
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 12px;
    padding: 12px 18px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3), 0 0 20px rgba(239, 68, 68, 0.2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.avatar-tooltip-content svg {
    flex-shrink: 0;
    stroke: #fff;
}

.avatar-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: rgba(239, 68, 68, 0.95);
}

.ai-dialog-title {
    color: var(--accent-gold);
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.ai-dialog-hint {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

.ai-dialog-container {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    min-height: 200px;
    height: 320px;
    max-height: 80vh;
    overflow: hidden;
    margin-bottom: 12px;
    background: 
        linear-gradient(rgba(26, 31, 44, 0.85), rgba(26, 31, 44, 0.85)),
        url('../images/ai_dialog_bg.png') center / cover no-repeat;
    /* local + рост высоты давали дрожание фона при «печати» ответа */
    background-attachment: scroll;
    background-position: center top;
    position: relative;
    display: flex;
    resize: vertical;
}

/* Скролл только у .ai-dialog-messages (у контейнера overflow: hidden) */
.ai-dialog-messages {
    --ai-dialog-font-size: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 16px;
    /* Прокрутка внутри панели: иначе каждый тик typewriter меняет высоту документа и дёргает окно */
    min-height: 0;
    height: 100%;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overflow-anchor: none;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.75) rgba(15, 17, 26, 0.55);
    box-sizing: border-box;
}

.ai-dialog-messages::-webkit-scrollbar {
    width: 9px;
}

.ai-dialog-messages::-webkit-scrollbar-track {
    margin: 8px 0;
    background: linear-gradient(
        180deg,
        rgba(15, 17, 26, 0.15) 0%,
        rgba(26, 31, 44, 0.65) 35%,
        rgba(26, 31, 44, 0.65) 65%,
        rgba(15, 17, 26, 0.15) 100%
    );
    border-radius: 100px;
    border: 1px solid rgba(212, 175, 55, 0.14);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.35);
}

.ai-dialog-messages::-webkit-scrollbar-thumb {
    border-radius: 100px;
    background: linear-gradient(
        180deg,
        rgba(253, 224, 71, 0.92) 0%,
        rgba(245, 158, 11, 0.82) 42%,
        rgba(217, 119, 6, 0.88) 100%
    );
    border: 2px solid rgba(15, 17, 26, 0.55);
    background-clip: padding-box;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 10px rgba(245, 158, 11, 0.22);
}

.ai-dialog-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        #fde68a 0%,
        var(--accent-gold) 48%,
        #ea580c 100%
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.32),
        0 0 14px rgba(245, 158, 11, 0.4);
}

.ai-dialog-messages::-webkit-scrollbar-thumb:active {
    background: linear-gradient(180deg, #fbbf24, #d97706);
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.25);
}

.ai-dialog-messages::-webkit-scrollbar-corner {
    background: transparent;
}

.ai-dialog-message {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.ai-dialog-message.user {
    justify-content: flex-start;
}

.ai-dialog-message.assistant {
    justify-content: flex-end;
}

.ai-dialog-message--context-notice {
    justify-content: center;
    align-items: flex-start;
}

.ai-dialog-message--context-notice .ai-dialog-bubble--context-notice {
    max-width: min(640px, 94%);
    text-align: left;
    background: rgba(18, 24, 36, 0.92);
    border: 1px solid rgba(212, 175, 55, 0.24);
    color: rgba(226, 232, 240, 0.94);
    font-size: var(--ai-dialog-font-size);
    line-height: 1.5;
    border-radius: 10px;
    padding: 10px 16px 12px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.ai-dialog-message--context-notice .ai-dialog-label {
    color: rgba(253, 224, 71, 0.88);
}

.ai-dialog-context-notice-body {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-dialog-context-notice-lead {
    font-weight: 600;
    color: rgba(241, 245, 249, 0.96);
    margin-bottom: 2px;
}

.ai-dialog-context-notice-line {
    color: rgba(203, 213, 225, 0.95);
    padding-left: 0;
}

.ai-dialog-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: var(--ai-dialog-font-size);
    line-height: 1.5;
}

.ai-dialog-message.user .ai-dialog-bubble {
    background: rgba(30, 35, 50, 0.98);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.ai-dialog-message.assistant .ai-dialog-bubble {
    max-width: 75%;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.30), rgba(30, 35, 50, 0.97));
    border: 1px solid var(--accent-gold-muted);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
    backdrop-filter: blur(8px);
}

.ai-dialog-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.ai-dialog-label {
    font-size: 0.714em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-dialog-timestamp {
    font-size: 0.714em;
    color: var(--text-secondary);
    font-family: 'Roboto Mono', monospace;
    opacity: 0.9;
}

.ai-dialog-save-btn {
    background: transparent;
    border: none;
    color: var(--accent-green);
    cursor: pointer;
    padding: 2px;
    margin-left: auto;
    opacity: 0.7;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-dialog-open-fullscreen-btn {
    display: none;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 2px 6px;
    border: 1px solid rgba(245, 158, 11, 0.38);
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    font-size: 0.68em;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
}

.ai-dialog-open-fullscreen-btn:hover {
    border-color: rgba(245, 158, 11, 0.56);
    background: rgba(245, 158, 11, 0.2);
}

.ai-dialog-save-btn:hover {
    color: var(--accent-green);
    opacity: 1;
}

.ai-dialog-save-btn.saved {
    color: var(--accent-green);
    opacity: 1;
}

.ai-dialog-content {
    line-height: 1.5;
}

.ai-dialog-question-frame {
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(56, 189, 248, 0.38);
    border-radius: 9px;
    background: linear-gradient(160deg, rgba(8, 47, 73, 0.42), rgba(15, 23, 42, 0.58));
}

.ai-dialog-question-frame-label {
    display: inline-block;
    margin-bottom: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.42);
    background: rgba(14, 116, 144, 0.28);
    color: #7dd3fc;
    font-size: 0.66em;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 700;
}

.ai-dialog-question-frame-text {
    color: rgba(226, 232, 240, 0.98);
    font-size: 0.95em;
    line-height: 1.45;
}

/* Ответы LLM в диалоге: formatAIText (заголовки, списки, подсветка чисел/периодов) */
.ai-dialog-bubble .ai-dialog-md {
    font-size: 1em;
    line-height: 1.55;
}
.ai-dialog-bubble .ai-dialog-md h2.ai-heading-1 {
    color: var(--accent-gold);
    font-size: 1.07em;
    font-weight: 700;
    margin: 0.45em 0 0.2em;
}
.ai-dialog-bubble .ai-dialog-md h3.ai-heading-2 {
    color: #22d3ee;
    font-size: 1em;
    font-weight: 600;
    margin: 0.45em 0 0.15em;
}
.ai-dialog-bubble .ai-dialog-md h4.ai-heading-3 {
    color: #a78bfa;
    font-size: 0.93em;
    font-weight: 600;
    margin: 0.4em 0 0.12em;
}
.ai-dialog-bubble .ai-dialog-md .ai-paragraph {
    margin-bottom: 0.45em;
}
.ai-dialog-bubble .ai-dialog-md .ai-list-item,
.ai-dialog-bubble .ai-dialog-md .ai-list-item-num {
    display: block;
    padding-left: 18px;
    position: relative;
    margin-bottom: 0.3em;
}
.ai-dialog-bubble .ai-dialog-md .ai-list-item::before {
    content: '•';
    color: var(--accent-gold);
    position: absolute;
    left: 4px;
}
.ai-dialog-bubble .ai-dialog-md .ai-list-num {
    color: var(--accent-gold);
    font-weight: 600;
}
.ai-dialog-bubble .ai-dialog-md .ai-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold-muted), transparent);
    margin: 10px 0;
}
.ai-dialog-bubble .ai-dialog-md .ai-md-table-wrap,
.ai-results-content .ai-md-table-wrap {
    margin: 0.45em 0 0.65em;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.42);
}
.ai-dialog-bubble .ai-dialog-md .ai-md-table,
.ai-results-content .ai-md-table {
    /* Ширину столбцов подгоняем под содержимое (не сжимаем в доступную ширину):
       таблица растёт по контенту, но занимает не меньше ширины контейнера, а лишнее
       уходит в горизонтальный скролл обёртки .ai-md-table-wrap. */
    width: max-content;
    max-width: none;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 0.93em;
    line-height: 1.45;
}
.ai-dialog-bubble .ai-dialog-md .ai-md-table thead th,
.ai-results-content .ai-md-table thead th {
    background: rgba(30, 41, 59, 0.85);
    color: #f8fafc;
    font-weight: 600;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}
.ai-dialog-bubble .ai-dialog-md .ai-md-table th,
.ai-dialog-bubble .ai-dialog-md .ai-md-table td,
.ai-results-content .ai-md-table th,
.ai-results-content .ai-md-table td {
    padding: 8px 10px;
    vertical-align: top;
    border-right: 1px solid rgba(148, 163, 184, 0.18);
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
/* Значения — в одну строку без переносов, чтобы ширины столбца хватало на число целиком. */
.ai-dialog-bubble .ai-dialog-md .ai-md-table td,
.ai-results-content .ai-md-table td {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}
/* Компактно показанное большое число (полное значение — в тултипе по наведению). */
.ai-dialog-bubble .ai-dialog-md .ai-md-table td .ai-num-compact,
.ai-results-content .ai-md-table td .ai-num-compact {
    border-bottom: 1px dotted rgba(148, 163, 184, 0.5);
    cursor: help;
}
/* Заголовки могут переноситься, но не длиннее 4 строк (иначе — усечение с многоточием). */
.ai-dialog-bubble .ai-dialog-md .ai-md-table th,
.ai-results-content .ai-md-table th {
    white-space: normal;
    vertical-align: bottom;
}
.ai-dialog-bubble .ai-dialog-md .ai-md-table th .ai-th-clamp,
.ai-results-content .ai-md-table th .ai-th-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
    max-width: 260px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.ai-dialog-bubble .ai-dialog-md .ai-md-table th:last-child,
.ai-dialog-bubble .ai-dialog-md .ai-md-table td:last-child,
.ai-results-content .ai-md-table th:last-child,
.ai-results-content .ai-md-table td:last-child {
    border-right: none;
}
.ai-dialog-bubble .ai-dialog-md .ai-md-table tbody tr:nth-child(even),
.ai-results-content .ai-md-table tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.06);
}
.ai-dialog-bubble .ai-dialog-md .ai-md-table tbody tr:hover,
.ai-results-content .ai-md-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.08);
}
.ai-dialog-inline-chart-card {
    margin-top: 12px;
    padding: 10px 12px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: linear-gradient(160deg, rgba(15, 23, 42, 0.55), rgba(30, 41, 59, 0.38));
    cursor: context-menu;
}
.ai-dialog-inline-chart-title {
    font-size: 0.86em;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 8px;
}
.ai-dialog-inline-chart-wrap {
    position: relative;
    width: 100%;
    height: 260px;
}
.ai-dialog-inline-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}
.ai-dialog-bubble .ai-dialog-md .nr-number {
    color: #f9a8d4;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}
.ai-dialog-bubble .ai-dialog-md .nr-company {
    color: #fbbf24;
    font-weight: 600;
}
.ai-dialog-bubble .ai-dialog-md .nr-period {
    color: #34d399;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}
.ai-dialog-bubble .ai-dialog-md .nr-quarter {
    color: #38bdf8;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
}
.ai-dialog-bubble .ai-dialog-md .nr-finterm {
    color: #f472b6;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
}
.ai-dialog-bubble .ai-dialog-md .nr-unit {
    color: #a78bfa;
    font-weight: 500;
}
.ai-dialog-bubble .ai-dialog-md .nr-bullet {
    color: var(--accent-gold);
    font-weight: 600;
}

.ai-dialog-message.user .ai-dialog-label {
    color: var(--text-muted);
}

.ai-dialog-message.assistant .ai-dialog-label {
    color: var(--accent-gold);
}

/* Одна строка шапки ответа AI: AI + [ответ …] */
.ai-dialog-header-row--reply-meta {
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
    min-width: 0;
}
.ai-dialog-header-row--reply-meta .ai-dialog-label {
    flex-shrink: 0;
}
.ai-dialog-reply-meta-inline {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.786em;
    font-family: 'Roboto Mono', monospace;
    color: var(--text-secondary);
    line-height: 1.35;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.55) rgba(15, 17, 26, 0.45);
}
.ai-dialog-reply-meta-inline::-webkit-scrollbar {
    height: 5px;
}
.ai-dialog-reply-meta-inline::-webkit-scrollbar-track {
    background: rgba(15, 17, 26, 0.5);
    border-radius: 100px;
}
.ai-dialog-reply-meta-inline::-webkit-scrollbar-thumb {
    background: linear-gradient(
        90deg,
        rgba(217, 119, 6, 0.75) 0%,
        rgba(245, 158, 11, 0.85) 50%,
        rgba(253, 224, 71, 0.8) 100%
    );
    border-radius: 100px;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.2);
}
.ai-dialog-reply-meta-inline::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #d97706, var(--accent-gold), #fde68a);
}

/* Фаза «печати» до подстановки formatAIText */
.ai-dialog-typewriter-plain {
    color: var(--text-muted, #8b92a8);
    font-style: italic;
    font-size: 1em;
    line-height: 1.55;
    letter-spacing: 0.015em;
    font-family: 'Georgia', 'Times New Roman', 'Noto Serif', serif;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-dialog-typewriter-cursor {
    display: inline-block;
    width: 0.5ch;
    min-width: 2px;
    margin-left: 1px;
    color: var(--accent-gold);
    animation: aiDialogCursorBlink 0.9s step-end infinite;
    vertical-align: text-bottom;
    font-weight: 300;
}
.ai-dialog-typewriter-plain + .ai-dialog-typewriter-cursor {
    color: rgba(139, 146, 168, 0.95);
    font-style: italic;
}
@keyframes aiDialogCursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.ai-dialog-presets {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ai-dialog-presets-label {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.ai-dialog-questions-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.06) 100%);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 8px;
    color: var(--accent-gold);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.ai-dialog-questions-btn:hover {
    border-color: var(--accent-gold);
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.2);
}

.ai-dialog-questions-btn:active {
    transform: scale(0.98);
}

.ai-dialog-questions-btn svg {
    flex-shrink: 0;
}

.ai-dialog-presets-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ai-dialog-font-btn {
    min-width: 40px;
    justify-content: center;
    font-weight: 700;
}

/* ПКМ по ответу AI в диалоге — контекстное меню «В виджеты» */
.ai-dialog-assistant-context-menu {
    position: fixed;
    z-index: 31010;
    min-width: 200px;
    padding: 4px 0;
    margin: 0;
    list-style: none;
    background: linear-gradient(180deg, rgba(22, 28, 40, 0.98) 0%, rgba(14, 18, 28, 0.99) 100%);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.ai-dialog-assistant-context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}

.ai-dialog-assistant-context-menu-item-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 14px;
    opacity: 0.9;
}

.ai-dialog-assistant-context-menu-item-label {
    display: inline-block;
}

.ai-dialog-assistant-context-menu-item:hover {
    background: rgba(212, 175, 55, 0.12);
    color: var(--accent-gold);
}

.ai-dialog-assistant-context-menu-item--widget {
    margin: 4px 8px;
    width: calc(100% - 16px);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(22, 163, 74, 0.18));
    border: 1px solid rgba(34, 197, 94, 0.55);
    color: #86efac;
    font-weight: 600;
}

.ai-dialog-assistant-context-menu-item--widget:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.34), rgba(22, 163, 74, 0.28));
    border-color: rgba(74, 222, 128, 0.95);
    color: #dcfce7;
}
.ai-dialog-chart-type-context-menu {
    min-width: 220px;
}

/* AI Dialog: modal "Выбор вопроса к AI" — под шапкой с запасом, до низа окна с отступом */
.ai-dialog-question-modal-overlay.modal-overlay {
    z-index: 10000;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    /* шапка ~64–100px + запас; при переносе строк в header — больший clamp */
    padding-top: calc(clamp(96px, 12vh, 148px) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(clamp(20px, 3vh, 40px) + env(safe-area-inset-bottom, 0px));
    padding-left: clamp(10px, 2.2vw, 22px);
    padding-right: clamp(10px, 2.2vw, 22px);
    box-sizing: border-box;
}

.ai-dialog-question-modal-content {
    width: 100%;
    max-width: min(1408px, 98vw);
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(18, 24, 35, 0.98) 0%, rgba(12, 16, 24, 0.99) 100%);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 14px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 175, 55, 0.08);
    overflow: hidden;
}

.ai-dialog-question-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(212, 175, 55, 0.06);
    border-radius: 14px 14px 0 0;
}

.ai-dialog-question-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 0.02em;
}

.ai-dialog-question-modal-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.ai-dialog-question-modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.ai-dialog-question-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 16px 20px 20px;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.75) rgba(15, 17, 26, 0.55);
}

/* Двухколоночная схема: список вопросов | детали выбранного */
.ai-dialog-question-modal-layout {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    /* правая колонка ~+20% к доле (0.56fr → 0.672fr), min ширина 360→432px */
    grid-template-columns: minmax(0, 1.22fr) minmax(432px, 0.672fr);
    gap: 18px;
    align-items: stretch;
}

.ai-dialog-question-modal-list-wrap {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    margin-right: -2px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.65) rgba(15, 17, 26, 0.45);
}

.ai-dialog-question-modal-detail {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 2px 4px 4px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.65) rgba(15, 17, 26, 0.45);
}

.ai-dialog-question-modal-detail-hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.ai-dialog-question-modal-route-section {
    flex: 0 0 auto;
    width: 100%;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.ai-dialog-question-modal-route {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(16, 22, 34, 0.92) 0%, rgba(8, 12, 20, 0.88) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ai-dialog-question-modal-route-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(253, 224, 71, 0.85);
    margin-bottom: 2px;
}

.ai-dialog-question-modal-route-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-primary);
    padding: 4px 2px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.ai-dialog-question-modal-route-option:hover {
    background: rgba(255, 255, 255, 0.04);
}

.ai-dialog-question-modal-route-option input {
    margin-top: 3px;
    flex-shrink: 0;
    accent-color: var(--accent-gold);
}

.ai-dialog-question-modal-detail-question {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-dialog-question-modal-detail-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.ai-dialog-question-modal-detail-table-wrap {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.ai-dialog-question-modal-params-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 8px;
    line-height: 1.35;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(6, 10, 18, 0.45);
}

.ai-dialog-question-modal-params-table thead th {
    text-align: left;
    padding: 6px 6px;
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(253, 224, 71, 0.88);
    background: rgba(212, 175, 55, 0.1);
    border-bottom: 1px solid rgba(212, 175, 55, 0.22);
}

.ai-dialog-question-modal-params-table thead th:nth-child(1) {
    width: 52%;
}

.ai-dialog-question-modal-params-table thead th:nth-child(2) {
    width: 20%;
}

.ai-dialog-question-modal-params-table thead th:nth-child(3) {
    width: 28%;
}

.ai-dialog-question-modal-params-table tbody td {
    padding: 5px 6px;
    vertical-align: top;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
}

.ai-dialog-question-modal-params-row:last-child td {
    border-bottom: none;
}

.ai-dialog-question-modal-params-row:nth-child(even):not(.ai-dialog-question-modal-params-row--empty) td {
    background: rgba(255, 255, 255, 0.03);
}

.ai-dialog-question-modal-params-cell--name {
    font-size: 12px;
    line-height: 1.45;
    font-weight: 500;
    color: rgba(186, 210, 255, 0.95);
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
}

.ai-dialog-question-modal-params-cell--id,
.ai-dialog-question-modal-params-cell--src {
    vertical-align: middle;
}

.ai-dialog-question-modal-param-tag {
    display: inline-block;
    max-width: 100%;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 8px;
    line-height: 1.35;
    font-weight: 600;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.ai-dialog-question-modal-param-tag--id {
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-weight: 600;
    background: rgba(72, 58, 130, 0.55);
    border: 1px solid rgba(186, 170, 255, 0.38);
    color: rgba(228, 220, 255, 0.96);
}

.ai-dialog-question-modal-param-tag--src {
    background: rgba(18, 100, 72, 0.48);
    border: 1px solid rgba(100, 210, 165, 0.38);
    color: rgba(188, 248, 212, 0.95);
}

.ai-dialog-question-modal-params-row--empty td {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 14px 10px;
}

.ai-dialog-question-modal-detail-promo {
    flex: 0 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 2px;
}

.ai-dialog-question-modal-confirm-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: min(100%, 360px);
    margin: 0 auto;
    padding: 10px 16px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 12px;
    background: linear-gradient(165deg, rgba(28, 36, 52, 0.95) 0%, rgba(14, 18, 28, 0.98) 100%);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s ease, background 0.2s;
}

.ai-dialog-question-modal-confirm-btn:hover:not(:disabled) {
    border-color: rgba(253, 224, 71, 0.45);
    box-shadow: 0 8px 26px rgba(245, 158, 11, 0.18);
    transform: translateY(-1px);
}

.ai-dialog-question-modal-confirm-btn:active:not(:disabled) {
    transform: translateY(0);
}

.ai-dialog-question-modal-confirm-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.ai-dialog-question-modal-confirm-img {
    display: block;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    object-fit: contain;
    filter: drop-shadow(0 4px 14px rgba(59, 130, 246, 0.35));
    pointer-events: none;
}

.ai-dialog-question-modal-confirm-label {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
    color: var(--accent-gold);
    letter-spacing: 0.02em;
    pointer-events: none;
}

.ai-dialog-question-modal-list .ai-dialog-question-card-text {
    margin-bottom: 0;
}

.ai-dialog-question-modal-list .ai-dialog-question-card {
    user-select: none;
}

.ai-dialog-question-card--selected {
    border-color: rgba(212, 175, 55, 0.55) !important;
    background: rgba(212, 175, 55, 0.1) !important;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.2);
}

@media (max-width: 720px) {
    .ai-dialog-presets-actions {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    .ai-dialog-question-modal-layout {
        grid-template-columns: 1fr;
    }

    .ai-dialog-question-modal-list-wrap {
        max-height: 44vh;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-right: 0;
        margin-right: 0;
        padding-bottom: 10px;
    }

    .ai-dialog-question-modal-detail-promo {
        padding-top: 6px;
    }

    .ai-dialog-question-modal-confirm-btn {
        max-width: 100%;
        padding: 10px 12px;
    }

    .ai-dialog-question-modal-confirm-img {
        width: 48px;
        height: 48px;
    }
}

.ai-dialog-question-modal-body::-webkit-scrollbar {
    width: 9px;
}

.ai-dialog-question-modal-body::-webkit-scrollbar-track {
    margin: 6px 0;
    background: linear-gradient(
        180deg,
        rgba(15, 17, 26, 0.15) 0%,
        rgba(26, 31, 44, 0.65) 35%,
        rgba(26, 31, 44, 0.65) 65%,
        rgba(15, 17, 26, 0.15) 100%
    );
    border-radius: 100px;
    border: 1px solid rgba(212, 175, 55, 0.14);
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.35);
}

.ai-dialog-question-modal-body::-webkit-scrollbar-thumb {
    border-radius: 100px;
    background: linear-gradient(
        180deg,
        rgba(253, 224, 71, 0.92) 0%,
        rgba(245, 158, 11, 0.82) 42%,
        rgba(217, 119, 6, 0.88) 100%
    );
    border: 2px solid rgba(15, 17, 26, 0.55);
    background-clip: padding-box;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 10px rgba(245, 158, 11, 0.22);
}

.ai-dialog-question-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        #fde68a 0%,
        var(--accent-gold) 48%,
        #ea580c 100%
    );
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.32),
        0 0 14px rgba(245, 158, 11, 0.4);
}

.ai-dialog-question-modal-body::-webkit-scrollbar-corner {
    background: transparent;
}

.ai-dialog-question-modal-loading {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    padding: 32px 16px;
}

.ai-dialog-question-modal-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-dialog-question-modal-category {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-dialog-question-modal-category-title {
    margin: 0;
    padding: 8px 0 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-gold);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(18, 24, 35, 0.98) 0%, rgba(14, 18, 28, 0.97) 100%);
    z-index: 1;
}

.ai-dialog-question-card {
    padding: 12px 14px;
    background: rgba(15, 20, 30, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.ai-dialog-question-card:hover {
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(212, 175, 55, 0.06);
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.1);
}

.ai-dialog-question-card-text {
    margin: 0 0 8px 0;
    font-size: 15px;
    line-height: 1.45;
    color: var(--text-primary);
}

.ai-dialog-question-card-params {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 10px;
    font-size: 8px;
    color: var(--text-muted);
}

.ai-dialog-question-card-param {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px 5px;
    background: rgba(8, 12, 20, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 5px;
    color: var(--text-secondary);
}

/* Обёртка: тултип с полным названием над строкой (CSS attr) */
.ai-dialog-question-card-param-name-wrap {
    position: relative;
    flex: 1 1 120px;
    min-width: 0;
    max-width: 100%;
}

.ai-dialog-question-card-param-name-wrap[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.35;
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(22, 28, 40, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    white-space: normal;
    word-wrap: break-word;
    max-width: min(380px, 82vw);
    width: max-content;
    max-height: 40vh;
    overflow-y: auto;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, visibility 0.12s ease;
    z-index: 20;
}

.ai-dialog-question-card-param-name-wrap[data-tip]:hover::after {
    opacity: 1;
    visibility: visible;
}

.ai-dialog-question-card-param-name {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 8px;
    line-height: 1.35;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 3px;
    color: rgba(186, 210, 255, 0.95);
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(96, 165, 250, 0.26);
}

.ai-dialog-question-card-param-id {
    flex-shrink: 0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 8px;
    line-height: 1.35;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    letter-spacing: 0.02em;
    color: rgba(216, 201, 255, 0.9);
    background: rgba(124, 58, 237, 0.14);
    border: 1px solid rgba(167, 139, 250, 0.28);
}

.ai-dialog-question-card-param-source {
    flex-shrink: 0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 8px;
    line-height: 1.35;
    font-weight: 500;
    color: rgba(167, 243, 208, 0.9);
    background: rgba(5, 150, 105, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.26);
}

.custom-dropdown {
    flex: 1;
    position: relative;
}

.custom-dropdown-toggle {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 8px 36px 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-dropdown-toggle:hover:not(:disabled) {
    border-color: var(--accent-gold);
}

.custom-dropdown-toggle:focus {
    outline: none;
    border-color: var(--accent-gold);
}

.custom-dropdown-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.custom-dropdown-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-dropdown-arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.custom-dropdown.open .custom-dropdown-arrow {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.custom-dropdown.open .custom-dropdown-menu {
    display: block;
}

.custom-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
    background: #3a3f4b;
    border-radius: 4px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-gold) 0%, #b8860b 100%);
    border-radius: 4px;
}

.custom-dropdown-group {
    padding: 10px 12px 6px 12px;
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
}

.custom-dropdown-item {
    padding: 10px 12px 10px 20px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-dropdown-item:last-child {
    border-bottom: none;
}

.custom-dropdown-item:hover {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
}

.ai-dialog-question-pick {
    margin-top: 10px;
    margin-bottom: 4px;
}

.ai-dialog-question-pick .ai-dialog-questions-btn {
    width: 100%;
    justify-content: center;
}

.ai-dialog-input-container {
    display: flex;
    gap: 12px;
}

.ai-dialog-input-history-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.ai-dialog-input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px 42px 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.ai-dialog-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.ai-dialog-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.ai-dialog-history-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.55);
    color: rgba(226, 232, 240, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.ai-dialog-history-toggle:hover {
    border-color: rgba(16, 185, 129, 0.65);
    color: #86efac;
    background: rgba(15, 23, 42, 0.78);
}

.ai-dialog-history-toggle[aria-expanded="true"] {
    border-color: rgba(16, 185, 129, 0.7);
    color: #86efac;
}

.ai-dialog-question-history-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
    display: none;
    max-height: 260px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid rgba(71, 85, 105, 0.55);
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.52);
    padding: 6px;
}

.ai-dialog-question-history-list.open {
    display: block;
}

.ai-dialog-question-history-item {
    width: 100%;
    display: block;
    text-align: left;
    border: 0;
    background: transparent;
    color: rgba(226, 232, 240, 0.94);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.35;
    cursor: pointer;
}

.ai-dialog-question-history-item:hover {
    background: rgba(16, 185, 129, 0.14);
    color: #86efac;
}

.ai-dialog-question-history-empty {
    color: rgba(148, 163, 184, 0.9);
    font-size: 12px;
    padding: 8px 10px;
}

.btn-ai-send {
    background: var(--accent-gold);
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ai-send:hover:not(:disabled) {
    background: #d97706;
    transform: translateY(-1px);
}

.btn-ai-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-dialog-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: var(--ai-dialog-font-size);
    padding: 12px 16px;
}

.ai-dialog-loading .loading-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: dialogPulse 1.4s infinite ease-in-out;
}

.ai-dialog-loading .loading-dot:nth-child(1) { animation-delay: 0s; }
.ai-dialog-loading .loading-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dialog-loading .loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* AI Диалог: этап + «часы» во время многошагового ответа */
.ai-dialog-loading-bubble {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 16px;
}
.ai-dialog-loading-top {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.93em;
    line-height: 1.35;
}
.ai-dialog-loading-stage {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    color: var(--text-primary);
}
.ai-dialog-loading-clock {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-gold);
    animation: aiDialogClockTick 2s ease-in-out infinite;
}
.ai-dialog-loading-clock svg {
    display: block;
}
@keyframes aiDialogClockTick {
    0%, 100% { opacity: 0.65; transform: rotate(0deg); }
    25% { opacity: 1; transform: rotate(-8deg); }
    75% { opacity: 1; transform: rotate(8deg); }
}
.ai-dialog-loading-context {
    font-size: 0.857em;
    color: var(--text-secondary);
    padding: 8px 0 4px 34px;
    line-height: 1.45;
    border-top: 1px solid rgba(212, 175, 55, 0.12);
    margin-top: 2px;
}
.ai-dialog-loading-ctx-line {
    margin-bottom: 3px;
}
.ai-dialog-loading-ctx-line:last-child {
    margin-bottom: 0;
}
.ai-dialog-loading-timer-row {
    font-size: 0.857em;
    color: var(--text-secondary);
    padding-left: 34px;
    margin: -2px 0 2px;
    line-height: 1.4;
}
.ai-dialog-loading-timer-label {
    opacity: 0.9;
}
.ai-dialog-loading-timer {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent-gold);
}
.ai-dialog-loading-dots {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 34px;
}
.ai-dialog-loading-dots .loading-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-gold);
    border-radius: 50%;
    animation: dialogPulse 1.4s infinite ease-in-out;
}
.ai-dialog-loading-dots .loading-dot:nth-child(1) { animation-delay: 0s; }
.ai-dialog-loading-dots .loading-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dialog-loading-dots .loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dialogPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

.btn-ai-analyse {
    position: relative;
    overflow: hidden;
    background: #0a120e;
    color: #34d399;
    border: 2px solid #34d399;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    height: 42px;
    width: 100%;
    align-self: end;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 
        0 0 15px rgba(52, 211, 153, 0.2),
        0 0 30px rgba(52, 211, 153, 0.1);
    animation: btnAiRingPulse 3s ease-in-out infinite;
}

.btn-ai-analyse .btn-ai-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    background: radial-gradient(ellipse at center, rgba(52, 211, 153, 0.08) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.btn-ai-analyse .btn-ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
    position: relative;
    z-index: 2;
    animation: btnAvatarShimmer 4s ease-in-out infinite;
    flex-shrink: 0;
}

.btn-ai-analyse .btn-ai-text {
    position: relative;
    z-index: 2;
    text-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

@keyframes btnAiRingPulse {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(52, 211, 153, 0.2),
            0 0 30px rgba(52, 211, 153, 0.1),
            inset 0 0 20px rgba(52, 211, 153, 0.05);
    }
    50% {
        box-shadow: 
            0 0 25px rgba(52, 211, 153, 0.4),
            0 0 50px rgba(52, 211, 153, 0.2),
            0 0 70px rgba(100, 255, 200, 0.15),
            inset 0 0 25px rgba(52, 211, 153, 0.1);
    }
}

@keyframes btnAvatarShimmer {
    0%, 100% {
        filter: brightness(1) saturate(1);
    }
    50% {
        filter: brightness(1.2) saturate(1.2);
    }
}

.btn-ai-analyse:hover {
    border-color: #6ee7b7;
    transform: translateY(-2px);
    box-shadow: 
        0 0 30px rgba(52, 211, 153, 0.4),
        0 0 60px rgba(52, 211, 153, 0.2),
        0 0 80px rgba(100, 255, 200, 0.15);
    color: #6ee7b7;
}

.btn-ai-analyse:hover .btn-ai-glow {
    background: radial-gradient(ellipse at center, rgba(52, 211, 153, 0.15) 0%, transparent 70%);
}

.btn-ai-analyse:hover .btn-ai-avatar {
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.6);
}

.btn-ai-analyse:active {
    transform: translateY(0);
}

.btn-ai-analyse:disabled {
    background: linear-gradient(135deg, rgba(40, 42, 50, 0.9), rgba(30, 32, 40, 0.9));
    border-color: rgba(100, 100, 110, 0.5);
    color: rgba(150, 150, 160, 0.6);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    animation: none;
}

.btn-ai-analyse:disabled .btn-ai-glow {
    display: none;
}

.btn-ai-analyse:disabled .btn-ai-avatar {
    border-color: rgba(100, 100, 110, 0.5);
    box-shadow: none;
    filter: grayscale(0.8) brightness(0.5);
    animation: none;
}

.btn-ai-analyse:disabled .btn-ai-text {
    text-shadow: none;
}

.btn-ai-analyse:disabled .btn-ai-icon {
    filter: grayscale(0.8) brightness(0.5);
    animation: none;
    opacity: 0.6;
}

/* Иконка-логотип внутри AI-кнопок (наследует цвет кнопки через currentColor) */
.btn-ai-icon {
    width: 18px;
    height: 18px;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px currentColor);
    animation: btnAiIconPulse 3s ease-in-out infinite;
}

@keyframes btnAiIconPulse {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.08); }
}

/* AI RESEARCH — вторая ветвь (голубой акцент) */
.btn-ai-research {
    padding: 8px 16px;
    min-width: auto;
    background: #08121a;
    border-color: #38bdf8;
    color: #7dd3fc;
    box-shadow:
        0 0 15px rgba(56, 189, 248, 0.2),
        0 0 30px rgba(56, 189, 248, 0.1);
    animation: btnAiRingPulseBlue 3s ease-in-out infinite;
}
.btn-ai-research .btn-ai-avatar {
    display: none;
}
.btn-ai-research .btn-ai-glow {
    background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.1) 0%, transparent 70%);
}
.btn-ai-research .btn-ai-text {
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}
.btn-ai-research:hover {
    border-color: #7dd3fc;
    color: #bae6fd;
    box-shadow:
        0 0 30px rgba(56, 189, 248, 0.4),
        0 0 60px rgba(56, 189, 248, 0.2),
        0 0 80px rgba(125, 211, 252, 0.15);
}
.btn-ai-research:hover .btn-ai-glow {
    background: radial-gradient(ellipse at center, rgba(56, 189, 248, 0.18) 0%, transparent 70%);
}

@keyframes btnAiRingPulseBlue {
    0%, 100% {
        box-shadow:
            0 0 15px rgba(56, 189, 248, 0.2),
            0 0 30px rgba(56, 189, 248, 0.1),
            inset 0 0 20px rgba(56, 189, 248, 0.05);
    }
    50% {
        box-shadow:
            0 0 25px rgba(56, 189, 248, 0.4),
            0 0 50px rgba(56, 189, 248, 0.2),
            0 0 70px rgba(125, 211, 252, 0.15),
            inset 0 0 25px rgba(56, 189, 248, 0.1);
    }
}

/* AI THINKING — третья ветвь (фиолетовый акцент) */
.btn-ai-thinking {
    padding: 8px 16px;
    min-width: auto;
    background: #100a1a;
    border-color: #a78bfa;
    color: #c4b5fd;
    box-shadow:
        0 0 15px rgba(139, 92, 246, 0.2),
        0 0 30px rgba(139, 92, 246, 0.1);
    animation: btnAiRingPulsePurple 3s ease-in-out infinite;
}
.btn-ai-thinking .btn-ai-avatar {
    display: none;
}
.btn-ai-thinking .btn-ai-glow {
    background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
}
.btn-ai-thinking .btn-ai-text {
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}
.btn-ai-thinking:hover {
    border-color: #c4b5fd;
    color: #ddd6fe;
    box-shadow:
        0 0 30px rgba(139, 92, 246, 0.4),
        0 0 60px rgba(139, 92, 246, 0.2),
        0 0 80px rgba(196, 181, 253, 0.15);
}
.btn-ai-thinking:hover .btn-ai-glow {
    background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.18) 0%, transparent 70%);
}

@keyframes btnAiRingPulsePurple {
    0%, 100% {
        box-shadow:
            0 0 15px rgba(139, 92, 246, 0.2),
            0 0 30px rgba(139, 92, 246, 0.1),
            inset 0 0 20px rgba(139, 92, 246, 0.05);
    }
    50% {
        box-shadow:
            0 0 25px rgba(139, 92, 246, 0.4),
            0 0 50px rgba(139, 92, 246, 0.2),
            0 0 70px rgba(196, 181, 253, 0.15),
            inset 0 0 25px rgba(139, 92, 246, 0.1);
    }
}

/* Канвас рассуждений AI THINKING */
.ai-thinking-canvas {
    font-size: 0.92em;
    line-height: 1.5;
}
.ai-thinking-section-title {
    font-weight: 700;
    color: var(--accent-gold, #d4af37);
    margin: 14px 0 6px;
    font-size: 1.02em;
}
.ai-thinking-reasoning-head {
    color: #c4b5fd;
    border-top: 1px dashed rgba(167, 139, 250, 0.35);
    padding-top: 10px;
}
.ai-thinking-subhead {
    font-weight: 600;
    margin: 8px 0 4px;
    color: var(--text-primary, #e5e7eb);
    opacity: 0.9;
}
.ai-thinking-plan {
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 10px;
    background: rgba(88, 60, 160, 0.08);
    padding: 10px 14px;
    margin-bottom: 12px;
}
.ai-thinking-objective { font-style: italic; opacity: 0.9; margin-bottom: 6px; }
.ai-thinking-hyps, .ai-thinking-plan-steps, .ai-thinking-findings, .ai-thinking-issues {
    margin: 4px 0 4px 18px;
    padding: 0;
}
.ai-thinking-step {
    border-left: 3px solid rgba(167, 139, 250, 0.5);
    padding: 8px 12px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0 8px 8px 0;
}
.ai-thinking-step.is-error {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.06);
}
.ai-thinking-step-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.ai-thinking-step-badge {
    font-size: 0.78em;
    font-weight: 700;
    background: rgba(167, 139, 250, 0.2);
    color: #c4b5fd;
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
}
.ai-thinking-step-title { font-weight: 600; }
.ai-thinking-step-hyp { font-size: 0.88em; opacity: 0.8; margin-bottom: 4px; }
.ai-thinking-step-reasoning { white-space: pre-wrap; opacity: 0.95; }
.ai-thinking-step-error { color: #fca5a5; }
.ai-thinking-findings { list-style: none; margin: 6px 0 4px; padding: 0; }
.ai-thinking-finding {
    position: relative;
    margin: 4px 0;
    padding-left: 16px;
}
.ai-thinking-finding::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.55em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
}
.ai-thinking-finding.is-positive::before { background: #34d399; }
.ai-thinking-finding.is-negative::before { background: #f87171; }
.ai-thinking-finding.is-mixed::before { background: #fbbf24; }
.ai-thinking-finding.is-neutral::before { background: #94a3b8; }
/* Живой индикатор работы AI THINKING (таймеры + модель) */
.ai-thinking-live-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 10px 0 2px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(88, 60, 160, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.35);
    font-size: 0.9em;
    color: #ddd6fe;
    position: sticky;
    bottom: 0;
    backdrop-filter: blur(2px);
}
.ai-thinking-live-label {
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 0;
}
.ai-thinking-live-model {
    font-size: 0.85em;
    color: #c4b5fd;
    background: rgba(167, 139, 250, 0.18);
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
}
.ai-thinking-live-clock {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: #a5b4fc;
    font-weight: 600;
}
.ai-thinking-clock-ico {
    display: inline-block;
    animation: aiThinkingClockPulse 1s ease-in-out infinite;
}
@keyframes aiThinkingClockPulse {
    0%, 100% { opacity: 0.55; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}
.ai-thinking-spinner {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(167, 139, 250, 0.3);
    border-top-color: #a78bfa;
    animation: aiThinkingSpin 0.8s linear infinite;
}
@keyframes aiThinkingSpin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .ai-thinking-spinner { animation: none; }
    .ai-thinking-clock-ico { animation: none; opacity: 0.9; }
}
.ai-thinking-verify {
    border: 1px solid rgba(52, 211, 153, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    margin: 10px 0;
    background: rgba(52, 211, 153, 0.05);
}
.ai-thinking-verify.is-warn {
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.06);
}
.ai-thinking-userprompt {
    border: 1px solid rgba(167, 139, 250, 0.35);
    border-left: 3px solid #a78bfa;
    border-radius: 8px;
    margin-bottom: 12px;
    background: rgba(88, 60, 160, 0.08);
    padding: 8px 12px;
}
.ai-thinking-userprompt-head {
    font-weight: 700;
    color: #c4b5fd;
    font-size: 0.9em;
    margin-bottom: 4px;
}
.ai-thinking-userprompt-body {
    white-space: pre-wrap;
    opacity: 0.92;
    font-size: 0.92em;
    max-height: 220px;
    overflow-y: auto;
}

.ai-thinking-reasoning-details {
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 8px;
    margin-bottom: 12px;
    background: rgba(88, 60, 160, 0.06);
}
.ai-thinking-reasoning-details > summary {
    cursor: pointer;
    padding: 8px 12px;
    font-weight: 600;
    color: #c4b5fd;
    user-select: none;
}
.ai-thinking-canvas--collapsed {
    padding: 4px 14px 12px;
    max-height: 480px;
    overflow-y: auto;
}
.ai-thinking-numcheck {
    display: inline-block;
    font-size: 0.85em;
    font-weight: 600;
    border-radius: 6px;
    padding: 4px 10px;
    margin-bottom: 10px;
}
.ai-thinking-numcheck.is-ok {
    background: rgba(52, 211, 153, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(52, 211, 153, 0.3);
}
.ai-thinking-numcheck.is-warn {
    background: rgba(251, 191, 36, 0.12);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.4);
}

.ai-research-modal-content .ai-research-form { margin-bottom: 12px; }
.ai-research-field { margin-bottom: 12px; }
.ai-research-field label { display: block; margin-bottom: 4px; font-size: 0.875rem; color: var(--accent-gold); }
.ai-research-field label .required { color: var(--accent-gold); }
.ai-research-input { width: 100%; padding: 8px 12px; border: 1px solid var(--border-subtle); border-radius: 4px; background: var(--bg-secondary); color: var(--text-primary); box-sizing: border-box; }
.ai-research-model-section {
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: rgba(15, 20, 30, 0.35);
    padding: 10px 12px;
}
.ai-research-model-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.ai-research-model-section-title {
    color: var(--accent-gold);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
}
.ai-research-model-select {
    flex: 1;
    min-width: 230px;
    max-width: 360px;
}
.ai-research-model-subsection-title {
    margin-top: 10px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
}
.ai-research-model-subsection-body {
    padding-top: 2px;
}
#ai-research-plan-model-select { color: #60a5fa; border-color: rgba(96, 165, 250, 0.55); }
#ai-research-step-model-select { color: #a78bfa; border-color: rgba(167, 139, 250, 0.55); }
#ai-research-summary-model-select { color: #34d399; border-color: rgba(52, 211, 153, 0.55); }
.ai-research-textarea { resize: vertical; min-height: 88px; line-height: 1.35; }
.ai-research-field-hint { margin-top: 6px; color: var(--text-secondary); font-size: 0.8rem; font-style: italic; line-height: 1.35; }
.ai-research-error { color: #ef4444; font-size: 0.875rem; margin-top: 6px; }
.ai-research-options-header { cursor: pointer; padding: 8px 0; font-size: 0.875rem; color: var(--text-secondary); display: flex; justify-content: space-between; align-items: center; }
.ai-research-options-header.collapsed .ai-research-collapse-icon { transform: rotate(-90deg); }
.ai-research-options { padding: 8px 0; border-top: 1px solid var(--border-subtle); margin-top: 8px; }
.ai-research-options-title { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 10px; font-weight: 600; }
.ai-research-options-always-open { display: block !important; }
.ai-research-collapsible { margin-bottom: 10px; border: 1px solid var(--border-subtle); border-radius: 8px; background: rgba(15, 20, 30, 0.25); overflow: hidden; }
.ai-research-collapsible > summary { list-style: none; cursor: pointer; padding: 10px 12px; color: var(--accent-gold); font-size: 0.84rem; font-weight: 600; }
.ai-research-collapsible > summary::-webkit-details-marker { display: none; }
.ai-research-collapsible > summary::before { content: '▶'; margin-right: 8px; font-size: 0.68rem; color: var(--accent-gold); display: inline-block; transition: transform 0.2s ease; }
.ai-research-parallel-collapsible > summary { color: #60a5fa; }
.ai-research-parallel-collapsible > summary::before { color: #60a5fa; }
.ai-research-instructions-collapsible > summary { color: var(--text-secondary); }
.ai-research-instructions-collapsible > summary::before { color: var(--text-secondary); }
.ai-research-collapsible[open] > summary::before { transform: rotate(90deg); }
.ai-research-collapsible-title { padding: 10px 12px; color: var(--text-secondary); font-size: 0.84rem; font-weight: 600; }
.ai-research-collapsible-body { padding: 0 10px 10px; }
.ai-research-slider-wrap { margin-top: 2px; }
.ai-research-range { width: 100%; accent-color: var(--accent-gold); }
.ai-research-range-blue { accent-color: #60a5fa; }
.ai-research-slider-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 0.82rem; color: var(--text-secondary); }
.ai-research-slider-meta strong { color: var(--accent-gold); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.ai-research-max-steps-label { color: #60a5fa !important; }
.ai-research-max-steps-wrap .ai-research-slider-meta span { color: rgba(96, 165, 250, 0.85); }
#ai-research-max-steps-value { color: #60a5fa; }
#ai-research-workers-field label { color: #60a5fa; }
#ai-research-max-workers { accent-color: #60a5fa; }
#ai-research-max-workers-value { color: #60a5fa; }
#ai-research-workers-field .ai-research-slider-meta span { color: rgba(96, 165, 250, 0.85); }
.ai-research-mode-label { margin-bottom: 6px; }
.ai-research-mode-switch-wrap { display: flex; align-items: center; gap: 10px; }
.ai-research-mode-caption { font-size: 0.82rem; color: var(--text-secondary); transition: color 0.2s ease, opacity 0.2s ease; opacity: 0.75; }
.ai-research-mode-caption.active { color: var(--text-primary); opacity: 1; }
.ai-research-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.ai-research-switch input { opacity: 0; width: 0; height: 0; }
.ai-research-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(120, 120, 120, 0.35);
    border: 1px solid var(--border-subtle);
    border-radius: 26px;
    transition: all 0.2s ease;
}
.ai-research-switch-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
}
.ai-research-switch input:checked + .ai-research-switch-slider {
    background: rgba(212, 175, 55, 0.4);
    border-color: rgba(212, 175, 55, 0.6);
}
.ai-research-switch input:checked + .ai-research-switch-slider::before {
    transform: translateX(24px);
}
.ai-research-switch input:focus-visible + .ai-research-switch-slider {
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35);
}
.ai-research-checkbox-label {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.84rem;
    user-select: none;
}
.ai-research-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.ai-research-checkbox-custom {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    background: rgba(15, 20, 30, 0.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.ai-research-checkbox-custom::after {
    content: "";
    width: 8px;
    height: 5px;
    border-left: 2px solid transparent;
    border-bottom: 2px solid transparent;
    transform: rotate(-45deg) translate(0, -1px);
}
.ai-research-checkbox-label input[type="checkbox"]:checked + .ai-research-checkbox-custom {
    border-color: rgba(212, 175, 55, 0.75);
    background: rgba(212, 175, 55, 0.3);
}
.ai-research-checkbox-label input[type="checkbox"]:checked + .ai-research-checkbox-custom::after {
    border-left-color: var(--accent-gold);
    border-bottom-color: var(--accent-gold);
}
.ai-research-checkbox-label input[type="checkbox"]:focus-visible + .ai-research-checkbox-custom {
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35);
}
.ai-research-footer { display: flex; gap: 12px; align-items: center; }
.modal-secondary-btn { padding: 8px 16px; border: 1px solid var(--border-subtle); border-radius: 6px; background: var(--bg-secondary); color: var(--text-primary); cursor: pointer; font-size: 0.875rem; }
.modal-secondary-btn:hover { background: var(--bg-tertiary); }
.ai-research-header { padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: 10px; background: rgba(15, 20, 30, 0.35); margin-bottom: 12px; }
.ai-research-title { margin: 0 0 6px 0; font-size: 1.05rem; color: var(--accent-gold); }
.ai-research-meta { margin: 2px 0; color: var(--text-secondary); font-size: 0.9rem; }
.ai-research-phase { padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: 10px; background: rgba(15, 20, 30, 0.25); margin-bottom: 12px; }
.ai-research-phase-title { margin: 0 0 8px 0; color: var(--text-primary); font-size: 1rem; }
.ai-research-plan { margin-top: 0; }
.ai-research-plan-outline {
    margin: 0;
    padding: 10px 12px 12px 1.75rem;
    list-style: decimal;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.45;
}
.ai-research-plan-outline > li { margin-bottom: 10px; padding-left: 6px; }
.ai-research-plan-outline > li:last-child { margin-bottom: 0; }
.ai-research-plan-step-title-text { color: var(--text-primary); }
.ai-research-plan-meta { font-size: 0.88em; opacity: 0.88; margin-left: 4px; }
.ai-research-plan-details { margin-top: 10px; border-radius: 8px; border: 1px solid var(--border-subtle); background: rgba(0, 0, 0, 0.25); overflow: hidden; }
.ai-research-plan-details summary { padding: 10px 12px; cursor: pointer; color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; list-style: none; }
.ai-research-plan-details summary::-webkit-details-marker { display: none; }
.ai-research-plan-details summary::before { content: '▶'; margin-right: 8px; font-size: 0.7rem; transition: transform 0.2s; }
.ai-research-plan-details[open] summary::before { transform: rotate(90deg); }
.ai-research-plan-details .ai-research-pre { margin: 0; border-radius: 0; border: none; }
.ai-research-details summary { cursor: pointer; color: var(--text-secondary); font-size: 0.9rem; }
.ai-research-pre { margin: 8px 0 0 0; padding: 10px 12px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border-subtle); overflow: auto; max-height: 260px; }
.ai-research-pre::-webkit-scrollbar { width: 8px; height: 8px; }
.ai-research-pre::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); border-radius: 4px; }
.ai-research-pre::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, 0.35); border-radius: 4px; }
.ai-research-pre::-webkit-scrollbar-thumb:hover { background: rgba(212, 175, 55, 0.5); }
.ai-research-plan .ai-research-pre { max-height: 280px; }
.ai-research-step-body { max-height: none; overflow: visible; }
.ai-research-summary-body { max-height: none; overflow: visible; }
.ai-research-step { padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: 10px; background: rgba(15, 20, 30, 0.2); margin-bottom: 12px; }
.ai-research-step-title { margin: 0 0 8px 0; font-size: 0.98rem; color: var(--text-primary); }
.ai-research-step-result { margin-top: 10px; }
.ai-research-step-body { margin-top: 6px; color: var(--text-secondary); line-height: 1.35; }
.ai-research-step-error { border-color: rgba(239, 68, 68, 0.35); }
.ai-research-error { color: #ef4444; margin: 6px 0 0 0; white-space: pre-line; }
.ai-research-summary { padding: 12px 14px; border: 1px solid var(--border-subtle); border-radius: 10px; background: rgba(15, 20, 30, 0.25); margin-bottom: 12px; }
.ai-research-summary-body { color: var(--text-secondary); line-height: 1.35; }
.ai-research-token-card {
    margin: 0 0 12px 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(96, 165, 250, 0.35);
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.38), rgba(15, 23, 42, 0.32));
}
.ai-research-token-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px 0;
    font-size: 0.83rem;
    font-weight: 600;
    color: #93c5fd;
}
.ai-research-token-source {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.ai-research-token-source.provider {
    color: #86efac;
    border: 1px solid rgba(74, 222, 128, 0.45);
    background: rgba(22, 101, 52, 0.22);
}
.ai-research-token-source.estimate {
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(120, 53, 15, 0.24);
}
.ai-research-token-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.ai-research-token-metric {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.25);
}
.ai-research-token-metric span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
    margin-bottom: 4px;
}
.ai-research-token-metric strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.96rem;
    font-variant-numeric: tabular-nums;
}
.ai-research-token-total-card {
    border-color: rgba(212, 175, 55, 0.55);
    background: linear-gradient(135deg, rgba(56, 41, 14, 0.36), rgba(29, 22, 7, 0.3));
}
.ai-research-token-total-meta {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* AI Research: progress strip, timers and cancel */
.ai-research-progress-wrap { margin-top: 12px; width: 100%; overflow: visible; }
.ai-research-progress-bar-wrap { height: 4px; border-radius: 2px; background: rgba(15, 20, 30, 0.6); overflow: hidden; margin-top: 12px; margin-bottom: 0; }
.ai-research-progress-bar { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent-gold), rgba(212, 175, 55, 0.6), var(--accent-gold)); background-size: 200% 100%; animation: ai-research-bar-shimmer 2s ease-in-out infinite; width: var(--progress-pct, 2%); min-width: 4px; transition: width 0.45s ease-out; }
.ai-research-progress-wrap.running .ai-research-progress-bar { box-shadow: 0 0 12px rgba(212, 175, 55, 0.25); }
@keyframes ai-research-bar-shimmer { 0%, 100% { background-position: 100% 0; opacity: 1; } 50% { background-position: 0 0; opacity: 0.9; } }
.ai-research-timers { display: flex; justify-content: center; gap: 24px; margin-bottom: 12px; flex-wrap: wrap; }
.ai-research-timer { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; background: rgba(15, 20, 30, 0.5); border: 1px solid var(--border-subtle); font-variant-numeric: tabular-nums; }
.ai-research-timer-total { border-color: rgba(212, 175, 55, 0.35); background: rgba(212, 175, 55, 0.08); }
.ai-research-timer-step { border-color: rgba(59, 130, 246, 0.35); background: rgba(59, 130, 246, 0.08); }
.ai-research-timer-icon { font-size: 1rem; opacity: 0.9; }
.ai-research-timer-total .ai-research-timer-icon { filter: none; }
.ai-research-timer-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.ai-research-timer-value { font-size: 1rem; font-weight: 700; color: var(--text-primary); min-width: 3.2em; text-align: right; }
.ai-research-timer-total .ai-research-timer-value { color: var(--accent-gold); }
.ai-research-timer-step .ai-research-timer-value { color: #60a5fa; }

/* AI Research: нейро-индикатор процесса (изображение + чистый CSS) */
.ai-research-neural-stage {
    display: none;
    justify-content: center;
    align-items: center;
    margin: 2px 0 14px;
}
.ai-research-progress-wrap.running .ai-research-neural-stage {
    display: flex;
}
.ai-research-neural-core {
    position: relative;
    width: 104px;
    height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Цикл 20s: 10s искры, 10s без искр */
.ai-research-neural-fx-sparks-wrap {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    mix-blend-mode: plus-lighter;
    animation: neuralFxVisSparks 20s ease-in-out infinite;
}
@keyframes neuralFxVisSparks {
    0%, 49.5% { opacity: 1; visibility: visible; }
    50%, 100% { opacity: 0; visibility: hidden; }
}

.ai-research-neural-spark {
    position: absolute;
    bottom: 10px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fffef0, #ffcc33 55%, rgba(255, 80, 20, 0.9));
    box-shadow: 0 0 6px rgba(255, 180, 60, 0.9), 0 0 12px rgba(255, 60, 20, 0.45);
    opacity: 0;
    animation: neuralSparkRise 2.4s ease-out infinite;
}
.ai-research-neural-spark:nth-child(1) { left: 18%; animation-delay: 0s; --sx: -6px; }
.ai-research-neural-spark:nth-child(2) { left: 30%; animation-delay: 0.35s; --sx: 4px; }
.ai-research-neural-spark:nth-child(3) { left: 42%; animation-delay: 0.7s; --sx: -3px; }
.ai-research-neural-spark:nth-child(4) { left: 54%; animation-delay: 0.2s; --sx: 8px; }
.ai-research-neural-spark:nth-child(5) { left: 66%; animation-delay: 0.55s; --sx: -10px; }
.ai-research-neural-spark:nth-child(6) { left: 78%; animation-delay: 0.1s; --sx: 5px; }
.ai-research-neural-spark:nth-child(7) { left: 50%; margin-left: -2px; animation-delay: 0.9s; width: 5px; height: 5px; --sx: 0px; }
.ai-research-neural-spark:nth-child(8) { left: 24%; animation-delay: 1.1s; --sx: -14px; }
@keyframes neuralSparkRise {
    0% { transform: translateY(0) scale(1); opacity: 0; }
    8% { opacity: 1; }
    100% { transform: translateY(-72px) translateX(var(--sx, 0px)) scale(0.25); opacity: 0; }
}

.ai-research-neural-ring-pulse {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    width: 56%;
    height: 56%;
    border-radius: 50%;
    border: 1px solid rgba(212, 175, 55, 0.42);
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.18);
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: neuralRingPulse 2.6s ease-out infinite;
}
.ai-research-neural-ring-pulse--2 { animation-delay: 0.85s; }
.ai-research-neural-ring-pulse--3 { animation-delay: 1.7s; }
@keyframes neuralRingPulse {
    0% { transform: translate(-50%, -50%) scale(0.52); opacity: 0.72; }
    100% { transform: translate(-50%, -50%) scale(1.85); opacity: 0; }
}
.ai-research-neural-orbit {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    width: 92px;
    height: 92px;
    margin: -46px 0 0 -46px;
    animation: neuralOrbit 14s linear infinite;
    pointer-events: none;
}
@keyframes neuralOrbit {
    to { transform: rotate(360deg); }
}
.ai-research-neural-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff6c8, #d4af37 55%, #8a6a12);
    box-shadow: 0 0 6px rgba(212, 175, 55, 0.55);
    animation: neuralParticleBlink 1.35s ease-in-out infinite;
}
.ai-research-neural-particle:nth-child(1) {
    top: 0;
    left: 50%;
    margin: -3px 0 0 -3px;
    animation-delay: 0s;
}
.ai-research-neural-particle:nth-child(2) {
    top: 50%;
    right: 0;
    margin: -3px -3px 0 0;
    animation-delay: 0.35s;
}
.ai-research-neural-particle:nth-child(3) {
    bottom: 0;
    left: 50%;
    margin: 0 0 -3px -3px;
    animation-delay: 0.7s;
}
@keyframes neuralParticleBlink {
    0%, 100% { opacity: 0.38; box-shadow: 0 0 4px rgba(212, 175, 55, 0.35); transform: scale(0.92); }
    50% { opacity: 1; box-shadow: 0 0 12px rgba(255, 220, 120, 0.95); transform: scale(1.05); }
}
.ai-research-neural-img-wrap {
    position: relative;
    z-index: 3;
    width: 68px;
    height: 68px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.15), inset 0 0 14px rgba(0, 0, 0, 0.25);
    animation: neuralPulse 2.4s ease-in-out infinite;
}
.ai-research-neural-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: neuralImgSpin 5s ease-in-out infinite;
}
@keyframes neuralPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes neuralImgSpin {
    0%, 100% { filter: hue-rotate(0deg) saturate(1.02) brightness(1); }
    33% { filter: hue-rotate(12deg) saturate(1.1) brightness(1.04); }
    66% { filter: hue-rotate(-10deg) saturate(1.08) brightness(1.02); }
}

.ai-research-progress { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; overflow: visible; }
.ai-research-progress .step-dot {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-subtle);
    background: rgba(15, 20, 30, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    overflow: visible;
    transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.2s;
}
.ai-research-progress .step-dot.pending { opacity: 0.6; }
.ai-research-progress .step-dot.current {
    border-color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.2);
    color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    font-size: 0;
    transform: scale(1.08);
    transition: none;
}
.ai-research-progress .step-dot.current::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -7px 0 0 -7px;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: ai-research-spin 0.8s linear infinite;
}
/* Морфинг current → done: золото → зелёный, затем pop галочки в .done */
.ai-research-progress .step-dot.completing {
    font-size: 0;
    opacity: 1;
    transition: none;
    animation: step-dot-morph-ring 0.45s ease-out forwards;
}
.ai-research-progress .step-dot.completing::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -7px 0 0 -7px;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent-gold);
    border-top-color: transparent;
    border-radius: 50%;
    animation: step-dot-spinner-fade 0.14s ease-in forwards;
}
.ai-research-progress .step-dot.completing::after {
    content: none;
}
.ai-research-progress .step-dot.done {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    font-size: 0;
    transform: scale(1);
}
.ai-research-progress .step-dot.done::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: 0.85rem;
    line-height: 1;
    transform: translate(-50%, -50%);
    animation: ai-research-done-pop 0.35s ease-out;
}
.ai-research-progress .step-dot.error { border-color: rgba(239, 68, 68, 0.6); background: rgba(239, 68, 68, 0.15); color: #ef4444; font-size: 0; }
.ai-research-progress .step-dot.error::after { content: '!'; position: absolute; font-size: 0.85rem; font-weight: 700; }
.ai-research-progress .step-dot-summary { font-size: 0.9rem; z-index: 1; }
.ai-research-progress .step-dot-summary.pending { opacity: 0.6; }
.ai-research-progress .step-dot-summary.current,
.ai-research-progress .step-dot-summary.completing,
.ai-research-progress .step-dot-summary.done { font-size: 0; }
/* Искры нейросети при завершении шага (как у центральной мандалы) */
.step-dot-spark-burst {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 3;
    --spark-dist: 14px;
    --spark-lift: -10px;
}
.step-dot-spark-burst--summary {
    --spark-dist: 24px;
    --spark-lift: -14px;
}
.step-dot-spark-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border-radius: 50%;
    border: 1px solid rgba(212, 175, 55, 0.55);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.35), 0 0 20px rgba(34, 197, 94, 0.2);
    animation: step-dot-spark-ring-pulse 0.65s ease-out forwards;
}
.step-dot-spark {
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fffef0, #ffcc33 55%, rgba(255, 80, 20, 0.9));
    box-shadow: 0 0 6px rgba(255, 180, 60, 0.9), 0 0 10px rgba(34, 197, 94, 0.35);
    opacity: 0;
    animation: step-dot-spark-neural 0.62s ease-out forwards;
    animation-delay: calc(var(--spark-i, 0) * 0.04s);
    transform: rotate(var(--spark-angle, 0deg)) translate(0, 0);
}
.step-dot-spark-burst--summary .step-dot-spark {
    width: 5px;
    height: 5px;
    margin: -2.5px 0 0 -2.5px;
    box-shadow: 0 0 8px rgba(255, 180, 60, 0.95), 0 0 14px rgba(34, 197, 94, 0.45);
}
@keyframes step-dot-morph-ring {
    0% {
        border-color: var(--accent-gold);
        background: rgba(212, 175, 55, 0.2);
        box-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
        transform: scale(1.08);
    }
    45% {
        border-color: #4ade80;
        background: rgba(34, 197, 94, 0.28);
        box-shadow: 0 0 16px rgba(34, 197, 94, 0.5);
        transform: scale(1.18);
    }
    100% {
        border-color: rgba(34, 197, 94, 0.6);
        background: rgba(34, 197, 94, 0.15);
        box-shadow: 0 0 8px rgba(34, 197, 94, 0.28);
        transform: scale(1);
    }
}
@keyframes step-dot-spinner-fade {
    to { opacity: 0; transform: rotate(140deg) scale(0.35); }
}
@keyframes step-dot-spark-neural {
    0% {
        opacity: 0;
        transform: rotate(var(--spark-angle, 0deg)) translate(0, 0) scale(0.5);
    }
    12% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: rotate(var(--spark-angle, 0deg))
            translate(var(--spark-dist, 14px), var(--spark-lift, -10px))
            translateX(var(--spark-sx, 0px))
            scale(0.12);
    }
}
@keyframes step-dot-spark-ring-pulse {
    0% {
        opacity: 0.85;
        transform: scale(0.6);
    }
    100% {
        opacity: 0;
        transform: scale(1.85);
    }
}
@keyframes ai-research-spin { to { transform: rotate(360deg); } }
@keyframes ai-research-done-pop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .ai-research-progress .step-dot.completing {
        animation: none;
        border-color: rgba(34, 197, 94, 0.6);
        background: rgba(34, 197, 94, 0.15);
        box-shadow: none;
        transform: scale(1);
    }
    .ai-research-progress .step-dot.completing::before { display: none; }
    .step-dot-spark-burst { display: none !important; }
}
.ai-research-cancel-btn { display: block; margin: 6px auto 10px; padding: 6px 16px; border: 1px solid rgba(212, 175, 55, 0.55); border-radius: 8px; background: rgba(212, 175, 55, 0.12); color: #d4af37; font-size: 0.8rem; font-weight: 400; letter-spacing: 0.04em; text-transform: lowercase; cursor: pointer; transition: background 0.2s, border-color 0.2s, color 0.2s; }
.ai-research-cancel-btn:hover { background: rgba(212, 175, 55, 0.2); border-color: rgba(212, 175, 55, 0.85); color: #f3d98a; }
.ai-research-retry-failed-btn { display: block; margin: 6px auto 10px; padding: 6px 16px; border: 1px solid rgba(96, 165, 250, 0.65); border-radius: 8px; background: rgba(37, 99, 235, 0.16); color: #93c5fd; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.04em; text-transform: lowercase; cursor: pointer; transition: background 0.2s, border-color 0.2s, color 0.2s; }
.ai-research-retry-failed-btn:hover { background: rgba(37, 99, 235, 0.24); border-color: rgba(147, 197, 253, 0.9); color: #bfdbfe; }
.ai-research-retry-failed-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ai-research-retry-modal-overlay { z-index: 10020; background: rgba(5, 10, 18, 0.78); backdrop-filter: blur(8px); }
.ai-research-retry-modal-content { width: min(520px, calc(100vw - 32px)); border-radius: 16px; border: 1px solid rgba(96, 165, 250, 0.35); background: linear-gradient(145deg, rgba(18, 27, 42, 0.98), rgba(10, 16, 26, 0.98)); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42), 0 0 28px rgba(37, 99, 235, 0.12); overflow: hidden; }
.ai-research-retry-modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid rgba(96, 165, 250, 0.18); }
.ai-research-retry-modal-header h3 { margin: 0; color: #bfdbfe; font-size: 1.12rem; font-weight: 700; }
.ai-research-retry-modal-header p { margin: 6px 0 0; color: var(--text-secondary); font-size: 0.88rem; line-height: 1.4; }
.ai-research-retry-modal-close { width: 32px; height: 32px; border: 1px solid rgba(148, 163, 184, 0.22); border-radius: 8px; background: rgba(15, 23, 42, 0.65); color: var(--text-secondary); font-size: 1.35rem; line-height: 1; cursor: pointer; transition: color 0.2s, background 0.2s, border-color 0.2s; }
.ai-research-retry-modal-close:hover { color: #f8fafc; background: rgba(239, 68, 68, 0.14); border-color: rgba(248, 113, 113, 0.38); }
.ai-research-retry-modal-body { padding: 18px 22px 20px; }
.ai-research-retry-modal-label { display: block; margin-bottom: 8px; color: #93c5fd; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ai-research-retry-model-select { width: 100%; min-height: 42px; border-color: rgba(96, 165, 250, 0.45); color: #dbeafe; background: rgba(15, 23, 42, 0.72); }
.ai-research-retry-modal-note { margin-top: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(96, 165, 250, 0.16); background: rgba(37, 99, 235, 0.08); color: var(--text-secondary); font-size: 0.82rem; line-height: 1.4; }
.ai-research-retry-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; border-top: 1px solid rgba(96, 165, 250, 0.16); background: rgba(8, 13, 22, 0.55); }
.ai-research-retry-modal-secondary,
.ai-research-retry-modal-primary { min-height: 38px; padding: 8px 16px; border-radius: 9px; font-size: 0.86rem; font-weight: 700; cursor: pointer; transition: transform 0.18s, box-shadow 0.18s, background 0.18s, border-color 0.18s; }
.ai-research-retry-modal-secondary { border: 1px solid rgba(148, 163, 184, 0.3); background: rgba(15, 23, 42, 0.72); color: var(--text-secondary); }
.ai-research-retry-modal-secondary:hover { color: var(--text-primary); border-color: rgba(148, 163, 184, 0.5); }
.ai-research-retry-modal-primary { border: 1px solid rgba(96, 165, 250, 0.62); background: linear-gradient(135deg, rgba(37, 99, 235, 0.86), rgba(59, 130, 246, 0.72)); color: #eff6ff; box-shadow: 0 10px 28px rgba(37, 99, 235, 0.22); }
.ai-research-retry-modal-primary:hover { transform: translateY(-1px); border-color: rgba(147, 197, 253, 0.9); box-shadow: 0 14px 34px rgba(37, 99, 235, 0.3); }

/* AI Research: step block — prompt and result as collapsible cards */
.ai-research-step { padding: 14px 16px; border: 1px solid var(--border-subtle); border-radius: 12px; background: linear-gradient(135deg, rgba(15, 20, 30, 0.4) 0%, rgba(20, 28, 42, 0.3) 100%); margin-bottom: 14px; }
.ai-research-step-title { margin: 0 0 12px 0; font-size: 1rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.ai-research-step-title .step-num { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 6px; background: rgba(212, 175, 55, 0.2); color: var(--accent-gold); font-size: 0.85rem; }
.ai-research-step .ai-research-detail-card { margin-top: 10px; border-radius: 8px; border: 1px solid var(--border-subtle); background: rgba(0, 0, 0, 0.25); overflow: hidden; }
.ai-research-step .ai-research-detail-card summary { padding: 10px 12px; cursor: pointer; color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 8px; }
.ai-research-step .ai-research-detail-card summary::-webkit-details-marker { display: none; }
.ai-research-step .ai-research-detail-card summary::before { content: '▶'; font-size: 0.7rem; transition: transform 0.2s; }
.ai-research-step .ai-research-detail-card[open] summary::before { transform: rotate(90deg); }
.ai-research-step .ai-research-detail-card .ai-research-pre { margin: 0; border-radius: 0; border: none; max-height: none; overflow: visible; }
.ai-research-step .ai-research-detail-card .ai-research-step-body { margin: 0; padding: 12px; max-height: none; overflow: visible; border: none; background: transparent; }
.ai-research-step-result .ai-research-detail-card summary { color: var(--text-primary); }
.ai-research-step-error .ai-research-detail-card.result summary { color: rgba(239, 68, 68, 0.95); }

/* AI Research: rich step result (JSON step_result → HTML) */
.ai-research-step-body-rich { line-height: 1.45; }
.ai-research-step-body-rich .ai-research-plain p { margin: 0 0 10px 0; color: var(--text-secondary); }
.ai-research-step-body-rich .ai-research-plain p:last-child { margin-bottom: 0; }
.ai-research-step-body-rich .ai-research-empty { color: var(--text-secondary); font-style: italic; margin: 0; }
.ai-research-step-raw-json { font-size: 0.82rem; max-height: none; overflow: visible; }
.ai-research-inline-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); margin-bottom: 6px; }
.ai-research-step-conclusion { margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; background: rgba(212, 175, 55, 0.06); border: 1px solid rgba(212, 175, 55, 0.2); }
.ai-research-step-conclusion p { margin: 8px 0 0 0; color: var(--text-primary); }
.ai-research-step-meta { margin-bottom: 12px; }
.ai-research-confidence-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0 0 10px 0;
}
.ai-research-confidence-row .ai-research-confidence {
    margin-left: 0;
    text-transform: none;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}
.ai-research-confidence-help {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.9;
    line-height: 1.35;
    flex: 1 1 200px;
}
.ai-research-confidence { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle; }
.ai-research-confidence-high { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.35); }
.ai-research-confidence-medium { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.35); }
.ai-research-confidence-low { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.ai-research-confidence-unknown { background: rgba(148, 163, 184, 0.1); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.ai-research-findings { margin-bottom: 14px; }
.ai-research-finding-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ai-research-finding-card { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-subtle); background: rgba(0, 0, 0, 0.2); }
.ai-research-finding-title { font-weight: 600; color: var(--text-primary); margin-bottom: 6px; font-size: 0.95rem; }
.ai-research-finding-details { color: var(--text-secondary); font-size: 0.9rem; }
.ai-research-finding-positive { border-left: 3px solid #22c55e; }
.ai-research-finding-negative { border-left: 3px solid #ef4444; }
.ai-research-finding-mixed { border-left: 3px solid #eab308; }
.ai-research-finding-neutral { border-left: 3px solid #64748b; }
.ai-research-evidence { margin: 8px 0 0 0; font-size: 0.78rem; color: var(--text-secondary); display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.ai-research-evidence dt { font-weight: 600; color: var(--text-secondary); }
.ai-research-evidence dd { margin: 0; font-family: ui-monospace, monospace; word-break: break-word; }
.ai-research-cross ul, .ai-research-risks ul { margin: 6px 0 0 1rem; padding: 0; color: var(--text-secondary); font-size: 0.9rem; }
.ai-research-cross li, .ai-research-risks li { margin-bottom: 6px; }
.ai-research-ro-list { list-style: none; margin: 6px 0 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ai-research-ro-item { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-subtle); }
.ai-research-ro-risk { border-left: 3px solid rgba(239, 68, 68, 0.65); background: rgba(239, 68, 68, 0.06); }
.ai-research-ro-opportunity { border-left: 3px solid rgba(34, 197, 94, 0.55); background: rgba(34, 197, 94, 0.06); }
.ai-research-ro-statement { font-weight: 600; color: var(--text-primary); font-size: 0.92rem; }
.ai-research-ro-why { margin-top: 4px; color: var(--text-secondary); font-size: 0.88rem; }

/* AI Research: финальное резюме (final_summary JSON → HTML) */
.ai-research-summary-body-rich { line-height: 1.45; color: var(--text-secondary); }
.ai-research-summary-rich { display: flex; flex-direction: column; gap: 16px; }
.ai-research-fs-company-line { margin: 0 0 4px 0; font-size: 0.9rem; color: var(--text-secondary); }
.ai-research-fs-company-line .ai-research-inline-label { display: inline; margin-right: 8px; }
.ai-research-fs-assessment { padding: 12px 14px; border-radius: 10px; background: rgba(212, 175, 55, 0.08); border: 1px solid rgba(212, 175, 55, 0.22); color: var(--text-primary); font-size: 0.95rem; }
.ai-research-fs-assessment p { margin: 0; }
.ai-research-fs-section ul { margin: 6px 0 0 0; padding-left: 1.15rem; color: var(--text-secondary); font-size: 0.9rem; }
.ai-research-fs-section li { margin-bottom: 6px; }
.ai-research-fs-strengths .ai-research-inline-label { color: #4ade80; }
.ai-research-fs-problems .ai-research-inline-label { color: #f87171; }
.ai-research-fs-mixed .ai-research-inline-label { color: #fbbf24; }
.ai-research-fs-priority .ai-research-inline-label { color: #60a5fa; }
.widget-narrative-plain .ai-quoted,
.widget-narrative-content .ai-quoted,
.widget-ai-report-content .ai-quoted {
    color: #22d3ee;
    font-style: italic;
    font-weight: 600;
}
body:not(.dark-theme) .widget-narrative-plain .ai-quoted,
body:not(.dark-theme) .widget-narrative-content .ai-quoted,
body:not(.dark-theme) .widget-ai-report-content .ai-quoted {
    color: #0891b2;
}
.ai-research-fs-view { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-subtle); background: rgba(0, 0, 0, 0.2); }
.ai-research-fs-view h5 { margin: 0 0 8px 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-gold); }
.ai-research-fs-view p { margin: 0 0 8px 0; color: var(--text-secondary); font-size: 0.9rem; }
.ai-research-fs-view p:last-child { margin-bottom: 0; }
.ai-research-fs-conclusion { padding: 12px 14px; border-radius: 10px; border-left: 3px solid var(--accent-gold); background: rgba(212, 175, 55, 0.06); }
.ai-research-fs-conclusion p { margin: 0; color: var(--text-primary); font-size: 0.95rem; }
.ai-research-summary-raw-json { font-size: 0.82rem; max-height: none; overflow: visible; }

.ai-report-title-wrapper {
    margin-bottom: 8px;
}

.ai-report-title-input {
    width: 100%;
    background: rgba(15, 20, 30, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 6px;
    color: #d4af37;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    padding: 10px 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.ai-report-title-input::placeholder {
    color: rgba(212, 175, 55, 0.35);
    font-weight: 400;
}

.ai-report-title-input:hover {
    border-color: rgba(212, 175, 55, 0.4);
}

.ai-report-title-input:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
    background: rgba(15, 20, 30, 0.8);
}

.ai-report-subtitle-input {
    width: 100%;
    background: rgba(15, 20, 30, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 400;
    font-family: 'Inter', sans-serif;
    padding: 7px 14px;
    margin-top: 4px;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.ai-report-subtitle-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.ai-report-subtitle-input:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.4);
    background: rgba(15, 20, 30, 0.6);
}

.ai-results-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 24px;
    min-height: 200px;
}

.ai-placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 80px 20px;
    font-size: 14px;
    line-height: 1.6;
    background-image: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('../images/ai_analysis_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 8px;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 31, 44, 0.75);
    border-radius: 8px;
    z-index: 0;
}

.ai-placeholder span,
.ai-placeholder > * {
    position: relative;
    z-index: 1;
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px;
    color: var(--accent-gold);
}

/* Блок ожидания: ряд индикаторов + прогресс */
.ai-analysis-wait-block {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 420px;
}

/* Спиннер, часы и Фибоначчи в одной строке */
.ai-analysis-wait-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Ожидание ответа LLM (кнопка AI ANALYSE): аналоговые часы + время */
.ai-analysis-wait-clock-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--accent-gold);
}

.ai-analysis-wait-clock-face {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 50%;
    box-shadow:
        0 0 0 1px rgba(212, 175, 55, 0.15),
        0 4px 20px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.12));
}

.ai-analysis-wait-clock-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.ai-analysis-wait-time-text {
    font-family: 'Roboto Mono', 'Consolas', monospace;
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(0, 212, 255, 0.92);
    text-shadow: 0 0 12px rgba(0, 212, 255, 0.25);
    min-width: 3.2ch;
    text-align: center;
}

/* Круг Фибоначчи справа от часов */
.ai-analysis-wait-fib-wrap {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-analysis-wait-fib-ring-host {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-analysis-wait-fib-orbit {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    pointer-events: none;
}

.ai-analysis-wait-fib-orbit--a {
    border-top-color: rgba(212, 175, 55, 0.9);
    border-right-color: rgba(212, 175, 55, 0.2);
    animation: ai-wait-fib-spin 1.1s linear infinite;
}

.ai-analysis-wait-fib-orbit--b {
    inset: 5px;
    border-bottom-color: rgba(0, 212, 255, 0.75);
    border-left-color: rgba(0, 212, 255, 0.15);
    animation: ai-wait-fib-spin 1.7s linear infinite reverse;
}

.ai-analysis-wait-fib-value {
    position: relative;
    z-index: 1;
    font-family: 'Roboto Mono', 'Consolas', monospace;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: rgba(212, 175, 55, 0.95);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
    max-width: 42px;
    text-align: center;
    line-height: 1.1;
    transition: transform 0.2s ease, color 0.2s ease;
}

.ai-analysis-wait-fib-value--pulse {
    animation: ai-wait-fib-pulse 0.35s ease-out;
}

@keyframes ai-wait-fib-spin {
    to { transform: rotate(360deg); }
}

@keyframes ai-wait-fib-pulse {
    0% { transform: scale(0.82); color: rgba(0, 212, 255, 0.95); }
    100% { transform: scale(1); color: rgba(212, 175, 55, 0.95); }
}

/* Прогресс: 90% за 1 мин, оставшиеся 10% за следующую минуту */
.ai-analysis-wait-progress-wrap {
    display: none;
    width: 100%;
    padding: 0 4px;
}

.ai-analysis-wait-progress-track {
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.ai-analysis-wait-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        rgba(212, 175, 55, 0.85) 0%,
        rgba(0, 212, 255, 0.9) 55%,
        rgba(212, 175, 55, 0.95) 100%
    );
    background-size: 200% 100%;
    animation: ai-wait-progress-shimmer 2.4s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.35);
    transition: width 0.35s linear;
}

@keyframes ai-wait-progress-shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.ai-loading.ai-loading-inline {
    flex-direction: row;
    gap: 10px;
    padding: 8px 12px;
    min-height: auto;
    justify-content: flex-start;
}

.ai-param-structure-status {
    width: 100%;
    box-sizing: border-box;
    color: rgba(212, 175, 55, 0.85);
}
.ai-param-structure-status--error {
    color: var(--accent-coral, #f87171);
}
.ai-param-structure-status-cell {
    padding: 8px 4px;
    border: none;
}
.ai-selectable-list .ai-param-structure-status,
.param-list-items .ai-param-structure-status {
    padding: 12px 10px;
}
.param-list-items .ai-param-structure-status {
    min-height: 80px;
    align-items: center;
    justify-content: center;
}
.ai-loading.ai-loading-inline .loading-spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
    flex-shrink: 0;
}
.ai-loading.ai-loading-inline p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-loading.ai-loading-inline.ai-loading-research {
    flex-direction: column;
    align-items: center;
}
.ai-loading.ai-loading-inline.ai-loading-research p {
    white-space: normal;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.ai-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-coral);
    border-radius: 4px;
    padding: 16px;
    color: var(--accent-coral);
    font-size: 14px;
    line-height: 1.6;
}

.ai-copy-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 10px;
    padding: 8px 0 0;
}

.ai-copy-buttons-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    margin-right: 16px;
}

.ai-soft-indicator-host {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 100020;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.ai-soft-indicator {
    max-width: min(420px, calc(100vw - 32px));
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(14, 20, 32, 0.95);
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1.4;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
    transform: translateY(0);
    opacity: 1;
    transition: transform 0.24s ease, opacity 0.24s ease;
}

.ai-soft-indicator-warning {
    border-color: rgba(245, 158, 11, 0.52);
    color: #fde68a;
}

.ai-soft-indicator-info {
    border-color: rgba(96, 165, 250, 0.52);
}

.ai-soft-indicator.is-hide {
    transform: translateY(8px);
    opacity: 0;
}

.ai-copy-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-copy-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.ai-copy-btn:active {
    transform: scale(0.95);
}

.ai-copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}

.ai-copy-btn::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    margin-bottom: 6px;
    z-index: 100;
}

.ai-copy-btn::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--border-color);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    margin-bottom: 1px;
}

.ai-copy-btn:hover::before,
.ai-copy-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

.ai-richtext-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: rgba(15, 20, 30, 0.9);
    border: 1px solid rgba(0, 212, 255, 0.25);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

.ai-richtext-toolbar .ai-toolbar-group {
    display: flex;
    align-items: center;
    gap: 3px;
}

.ai-richtext-toolbar .ai-toolbar-btn {
    background: rgba(30, 35, 50, 0.8);
    border: 1px solid rgba(75, 85, 99, 0.4);
    color: #c9d1d9;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s ease;
}

.ai-richtext-toolbar .ai-toolbar-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: rgba(0, 212, 255, 0.4);
    color: #00d4ff;
}

.ai-richtext-toolbar .ai-toolbar-heading {
    font-size: 10px;
    font-weight: 700;
    width: 26px;
    font-family: 'Inter', sans-serif;
    color: #d4af37;
}

.ai-richtext-toolbar .ai-toolbar-list {
    width: 28px;
}

.ai-results-content h1,
.ai-results-content h2,
.ai-results-content h3 {
    color: #d4af37;
    margin: 8px 0 4px 0;
    font-family: 'Inter', sans-serif;
    line-height: 1.3;
}
.ai-results-content h1 { font-size: 1.4em; }
.ai-results-content h2 { font-size: 1.2em; }
.ai-results-content h3 { font-size: 1.05em; }

.ai-results-content ul,
.ai-results-content ol {
    margin: 4px 0;
    padding-left: 24px;
}
.ai-results-content ul li,
.ai-results-content ol li {
    margin: 2px 0;
}
.ai-results-content ul li::marker {
    color: #d4af37;
}
.ai-results-content ol li::marker {
    color: #d4af37;
    font-weight: 600;
}

.ai-richtext-toolbar .ai-toolbar-fontsize {
    font-size: 11px;
    font-weight: 600;
    width: 30px;
}

.ai-richtext-toolbar .ai-toolbar-fontsize-label {
    font-size: 10px;
    color: #9ca3af;
    min-width: 30px;
    text-align: center;
    font-family: 'Roboto Mono', monospace;
}

.ai-richtext-toolbar .ai-toolbar-separator {
    width: 1px;
    height: 20px;
    background: rgba(75, 85, 99, 0.4);
    margin: 0 4px;
}

.ai-richtext-toolbar .ai-toolbar-colors {
    gap: 3px;
}

.ai-richtext-toolbar .ai-color-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(30, 35, 50, 0.8);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-richtext-toolbar .ai-color-btn:hover {
    transform: scale(1.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.ai-richtext-toolbar .ai-toolbar-clear {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.ai-richtext-toolbar .ai-toolbar-clear:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
}

.ai-results-content[contenteditable="true"] {
    outline: none;
    border-radius: 0 0 8px 8px;
}

.ai-results-content[contenteditable="true"]:focus {
    border-color: rgba(0, 212, 255, 0.4);
}

.ai-results-editor-wrap {
    display: flex;
    align-items: stretch;
    height: 400px;
    max-height: min(850px, 92vh);
    min-height: 220px;
    resize: vertical;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

/*
 * Прокрутка contenteditable внутри flex: при flex-basis:auto минимальная высота
 * элемента = высота контента, родитель растягивается и overflow-y не срабатывает.
 * flex: 1 1 0% + min-height: 0 задаёт ограниченную колонку; local-фон отключаем — иначе
 * в части браузеров колесо/полоса ведут себя непредсказуемо.
 * Общие правила для AI ANALYSE и AI RESEARCH (высота блока: по умолчанию 400px, resize до min(850px, 92vh)).
 */
.ai-results-editor-wrap .ai-results-content {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background-attachment: scroll;
}

.ai-results-editor-wrap .ai-results-line-numbers {
    align-self: stretch;
    min-height: 0;
    max-height: 100%;
}

.ai-results-line-numbers {
    width: 44px;
    flex: 0 0 44px;
    align-self: stretch;
    min-height: 0;
    overflow: hidden;
    padding: 20px 6px 20px 8px;
    background: rgba(12, 16, 26, 0.38);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    user-select: none;
    pointer-events: none;
}

.ai-results-line-numbers-inner {
    font-family: 'Roboto Mono', monospace;
    font-size: 10px;
    line-height: 1;
    color: rgba(148, 163, 184, 0.52);
}

.ai-results-line-number {
    text-align: right;
    opacity: 0.78;
}

.ai-results-content {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.8;
    word-wrap: break-word;
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    background: 
        linear-gradient(rgba(26, 31, 44, 0.70), rgba(26, 31, 44, 0.70)),
        url('../images/ai_analysis_bg.png') center / cover no-repeat;
    background-attachment: local;
    border-radius: 0;
    position: relative;
    border: none;
    flex: 1;
}

/* Keep a strict line grid so visual line numbers stay aligned */
.ai-results-content * {
    line-height: inherit !important;
}

.ai-results-content p,
.ai-results-content ul,
.ai-results-content ol,
.ai-results-content li,
.ai-results-content h2.ai-heading-1,
.ai-results-content h3.ai-heading-2,
.ai-results-content h4.ai-heading-3 {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* AI Research: сетка нулевых margin выше ломает абзацы/списки в резюме и шагах */
.ai-results-content .ai-research-summary-body-rich p,
.ai-results-content .ai-research-summary-rich p,
.ai-results-content .ai-research-fs-assessment p,
.ai-results-content .ai-research-fs-view p,
.ai-results-content .ai-research-fs-conclusion p,
.ai-results-content .ai-research-summary-body-rich .ai-research-plain p,
.ai-results-content .ai-research-step-body-rich .ai-research-plain p,
.ai-results-content .ai-research-step-body-rich .ai-research-step-conclusion p {
    margin-bottom: 0.65em !important;
}
.ai-results-content .ai-research-summary-body-rich .ai-research-plain p:last-child,
.ai-results-content .ai-research-step-body-rich .ai-research-plain p:last-child,
.ai-results-content .ai-research-fs-assessment p:last-child,
.ai-results-content .ai-research-fs-view p:last-child,
.ai-results-content .ai-research-fs-conclusion p:last-child,
.ai-results-content .ai-research-step-body-rich .ai-research-step-conclusion p:last-child {
    margin-bottom: 0 !important;
}
.ai-results-content .ai-research-fs-section ul {
    margin: 0.35em 0 0.65em 0 !important;
    padding-left: 1.25em !important;
}
.ai-results-content .ai-research-fs-section li {
    margin-bottom: 0.4em !important;
}
.ai-results-content .ai-research-step-body-rich .ai-research-cross ul,
.ai-results-content .ai-research-step-body-rich .ai-research-risks ul {
    margin: 0.35em 0 0.65em 0 !important;
    padding-left: 1.25em !important;
}
.ai-results-content .ai-research-step-body-rich .ai-research-cross li,
.ai-results-content .ai-research-step-body-rich .ai-research-risks li {
    margin-bottom: 0.4em !important;
}

.ai-results-content::-webkit-scrollbar {
    width: 10px;
}

.ai-results-content::-webkit-scrollbar-track {
    background: #3a3f4b;
    border-radius: 5px;
}

.ai-results-content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00d4ff 0%, #38bdf8 50%, #00d4ff 100%);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5),
                0 0 20px rgba(0, 212, 255, 0.3);
}

.ai-results-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #00e5ff 0%, #4fc3f7 50%, #00e5ff 100%);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.7),
                0 0 30px rgba(0, 212, 255, 0.5);
}

.ai-results-content h2.ai-heading-1 {
    color: var(--accent-gold);
    font-size: 18px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.ai-results-content h3.ai-heading-2 {
    color: #22d3ee;
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0;
}

.ai-results-content h4.ai-heading-3 {
    color: #a78bfa;
    font-size: 15px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0;
}

.ai-results-content h2:first-child,
.ai-results-content h3:first-child,
.ai-results-content h4:first-child {
    margin-top: 0;
}

.ai-results-content .ai-bold {
    color: #fbbf24;
    font-weight: 600;
}

.ai-results-content .ai-italic {
    color: #94a3b8;
    font-style: italic;
}

.ai-results-content .ai-bold-italic {
    color: #fbbf24;
}

.ai-results-content .ai-code {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
}

.ai-results-content .ai-quoted {
    color: #22d3ee;
    font-style: italic;
}

.ai-results-content .ai-number {
    color: #f9a8d4;
    font-weight: 500;
}

.ai-results-content .ai-list-item,
.ai-results-content .ai-list-item-num {
    display: block;
    padding-left: 20px;
    position: relative;
    margin-bottom: 6px;
}

.ai-results-content .ai-list-item::before {
    content: '•';
    color: var(--accent-gold);
    position: absolute;
    left: 6px;
}

.ai-results-content .ai-list-num {
    color: var(--accent-gold);
    font-weight: 600;
}

.ai-results-content .ai-paragraph {
    margin-bottom: 10px;
    line-height: 1.7;
}

.ai-results-content .ai-metric {
    color: #a78bfa;
    font-weight: 500;
}

.ai-results-content .nr-number,
.analytics-line-content .nr-number {
    color: #f9a8d4;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}

.ai-results-content .nr-company,
.analytics-line-content .nr-company {
    color: #fbbf24;
    font-weight: 600;
}

.ai-results-content .nr-period,
.analytics-line-content .nr-period {
    color: #34d399;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
}

.ai-results-content .nr-quarter,
.analytics-line-content .nr-quarter {
    color: #38bdf8;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
}

.ai-results-content .nr-finterm,
.analytics-line-content .nr-finterm {
    color: #f472b6;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
}

.ai-results-content .nr-unit,
.analytics-line-content .nr-unit {
    color: #a78bfa;
    font-weight: 500;
}

.ai-results-content .nr-bullet,
.analytics-line-content .nr-bullet {
    color: var(--accent-gold);
    font-weight: 600;
}

.ai-results-content .ai-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
    margin: 16px 0;
}

.ai-results-content .ai-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 16px 0;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(34, 211, 238, 0.08) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ai-results-content .ai-group-badge,
.ai-results-content .ai-subgroup-badge {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-results-content .ai-group-label,
.ai-results-content .ai-subgroup-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.ai-results-content .ai-group-label {
    color: var(--accent-gold);
}

.ai-results-content .ai-subgroup-label {
    color: #22d3ee;
}

.ai-results-content .ai-group-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.ai-results-content .ai-subgroup-value {
    font-size: 15px;
    font-weight: 600;
    color: #22d3ee;
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.3);
}

.ai-results-content .ai-group-separator {
    font-size: 20px;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 300;
}

.ai-results-content p {
    margin-bottom: 12px;
}

.ai-results-content ul, .ai-results-content ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.ai-results-content li {
    margin-bottom: 6px;
}

@media (max-width: 1200px) {
    .ai-analysis-controls {
        grid-template-columns: 1fr;
    }
}

/* Custom Select for Parameter with colored brackets */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    min-height: 42px;
}

.custom-select-trigger:hover {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--accent-gold);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.custom-select-value {
    color: var(--text-primary);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.custom-select-value .param-bracket {
    color: var(--accent-gold);
    font-weight: 500;
}

.custom-select-arrow {
    color: var(--text-secondary);
    font-size: 10px;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.custom-select-wrapper.open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-gold);
    border-top: none;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.custom-select-wrapper.open .custom-select-options {
    display: block;
}

.custom-select-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background: var(--bg-card-hover);
}

.custom-select-option.selected {
    background: rgba(245, 158, 11, 0.15);
}

.custom-select-option .param-bracket {
    color: var(--accent-gold);
    font-weight: 500;
}

.custom-select-group-header {
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-gold);
    background: var(--bg-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.custom-select-option-grouped {
    padding-left: 20px;
    font-size: 13px;
}

.custom-select-search {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    padding: 8px;
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
}

.custom-select-search-input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-main);
    outline: none;
    box-sizing: border-box;
}

.custom-select-search-input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}

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

.custom-select-options-list {
    max-height: 250px;
    overflow-y: auto;
}

.custom-select-options-list::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.custom-select-options-list::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 4px;
}

.custom-select-options-list::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.5);
}

.custom-select-options::-webkit-scrollbar {
    width: 8px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}

.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: var(--border-bright);
}

/* Kohonen Map Section */
#kohonen-section {
    margin-top: 24px;
}

.kohonen-description {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 16px 24px;
    margin-bottom: 16px;
}

.kohonen-controls {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 20px 24px;
    margin-bottom: 16px;
}

.kohonen-controls-row {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.kohonen-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
}

.kohonen-label {
    color: var(--accent-gold);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kohonen-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.kohonen-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
}

.kohonen-select:hover {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.kohonen-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.kohonen-group-selection {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-top: 16px;
}

.kohonen-group-selector {
    min-width: 280px;
    flex-shrink: 0;
}

.kohonen-group-params-info {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    min-height: 80px;
}

.kohonen-params-header {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.kohonen-params-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.kohonen-param-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 4px;
    padding: 4px 8px;
    gap: 4px;
    transition: border-color 0.15s;
}
.kohonen-param-tag:hover {
    border-color: rgba(239, 68, 68, 0.4);
}
.kohonen-param-remove {
    cursor: pointer;
    color: rgba(148, 163, 184, 0.4);
    font-size: 13px;
    font-weight: 700;
    margin-left: 4px;
    line-height: 1;
    transition: color 0.15s;
    padding: 0 2px;
}
.kohonen-param-remove:hover {
    color: #ef4444;
}

.kohonen-param-group {
    font-size: 10px;
    font-weight: 600;
    color: #f59e0b;
    padding: 2px 5px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 3px;
}

.kohonen-param-subgroup {
    font-size: 10px;
    font-weight: 500;
    color: #10b981;
    padding: 2px 5px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 3px;
}

.kohonen-param-name {
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.3;
}

.kohonen-param-tag-text {
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.3;
}

.kohonen-params-empty {
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

.kohonen-company-selection {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}
.kohonen-company-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}
.kohonen-company-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}
.kohonen-company-search {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 6px 10px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.15s;
}
.kohonen-company-search:focus {
    border-color: rgba(245, 158, 11, 0.4);
}
.kohonen-company-search::placeholder {
    color: var(--text-muted);
}
.btn-kohonen-company-action {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #f59e0b;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-kohonen-company-action:hover {
    background: rgba(245, 158, 11, 0.15);
}
.btn-kohonen-company-clear {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-kohonen-company-clear:hover {
    background: rgba(239, 68, 68, 0.15);
}
.kohonen-company-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
    max-height: 120px;
    overflow-y: auto;
    padding: 2px 0;
}
.kohonen-company-list::-webkit-scrollbar {
    width: 4px;
}
.kohonen-company-list::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 2px;
}
.kohonen-company-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}
.kohonen-company-chip:hover {
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--text-primary);
}
.kohonen-company-chip.active {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.4);
    color: #f59e0b;
    font-weight: 600;
}
.kohonen-company-chip.active::before {
    content: '✓ ';
    font-size: 10px;
}

.kohonen-param-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.kohonen-param-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 8px 12px;
}

.kohonen-param-select optgroup {
    background: var(--bg-secondary);
    color: var(--accent-gold);
    font-weight: 600;
    font-style: normal;
}

.kohonen-param-select optgroup option {
    color: var(--text-primary);
    font-weight: 400;
    padding-left: 12px;
}

.kohonen-param-select:hover {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.kohonen-param-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.btn-kohonen-update {
    background: linear-gradient(135deg, var(--accent-gold), #d97706);
    border: none;
    border-radius: 4px;
    padding: 10px 24px;
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-kohonen-update:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-kohonen-update:active {
    transform: translateY(0);
}

.kohonen-period-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-kohonen-step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    background: linear-gradient(135deg, #22d3ee, #0891b2);
    border: none;
    border-radius: 4px;
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-kohonen-step:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 211, 238, 0.4);
}

.btn-kohonen-step:active {
    transform: translateY(0);
}

.btn-kohonen-icon {
    padding: 4px;
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-kohonen-icon:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--accent-gold);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.kohonen-step-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 0 3px rgba(212, 175, 55, 0.4));
}

@media (max-width: 1200px) {
    .kohonen-group-selection {
        flex-direction: column;
    }
    .kohonen-group-selector {
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .kohonen-group-selection {
        flex-direction: column;
        gap: 12px;
    }
    
    .kohonen-controls-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .kohonen-control-group {
        width: 100%;
    }
}

.kohonen-description p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.kohonen-container {
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 12px;
    padding: 24px;
    min-height: 400px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 0 30px rgba(245, 158, 11, 0.08),
        inset 0 0 60px rgba(0, 0, 0, 0.3);
}

.kohonen-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, rgba(12, 15, 20, 0.88) 0%, rgba(15, 20, 30, 0.78) 50%, rgba(12, 15, 20, 0.88) 100%),
        url('/static/images/kohonen_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}


.kohonen-container > * {
    position: relative;
    z-index: 1;
}

.kohonen-tooltip-panel {
    background: rgba(10, 15, 30, 0.96);
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-radius: 8px;
    padding: 12px 14px;
    min-width: 260px;
    max-width: 380px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    font-family: 'Inter', sans-serif;
}
.kohonen-tooltip-title {
    color: #f59e0b;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}
.kohonen-tooltip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.76rem;
}
.kohonen-tooltip-table thead th {
    color: rgba(148, 163, 184, 0.6);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    padding: 3px 6px 5px;
    text-align: left;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}
.kohonen-tooltip-table thead th:last-child {
    text-align: right;
}
.kohonen-tooltip-table tbody td {
    padding: 4px 6px;
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}
.kohonen-tooltip-table tbody tr:last-child td {
    border-bottom: none;
}
.kohonen-tp-name {
    color: #60a5fa;
    font-weight: 500;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kohonen-tv-pos {
    color: #4ade80;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    text-align: right;
}
.kohonen-tv-neg {
    color: #f87171;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    text-align: right;
}
.kohonen-tv-zero {
    color: rgba(148, 163, 184, 0.7);
    font-family: 'Roboto Mono', monospace;
    text-align: right;
}

.kohonen-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
    z-index: 10;
}

.kohonen-loading p {
    margin-top: 16px;
    font-size: 0.95rem;
}

.kohonen-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: 4px;
    color: var(--accent-red);
    padding: 16px;
    text-align: center;
    margin-bottom: 16px;
}

#kohonen-chart {
    width: 100% !important;
    height: 450px !important;
}

.kohonen-legend {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 16px 24px;
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.kohonen-legend-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kohonen-legend-label {
    color: var(--accent-gold);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kohonen-legend-value {
    color: var(--text-primary);
    font-size: 0.9rem;
}

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

@media (max-width: 768px) {
    .kohonen-legend {
        grid-template-columns: 1fr;
    }
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.custom-dropdown-selected {
    background: #1e222a;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 10px 40px 10px 14px;
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-dropdown-selected::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-secondary);
    transition: transform 0.2s ease;
}

.custom-dropdown.open .custom-dropdown-selected::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-dropdown-selected:hover {
    border-color: var(--accent-gold);
    background: #252a33;
}

.custom-dropdown.open .custom-dropdown-selected {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.custom-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #12151a;
    border: 1px solid var(--accent-gold);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 350px;
    z-index: 1000;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    flex-direction: column;
}

.custom-dropdown-search-wrap {
    padding: 8px 10px;
    background: #12151a;
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
    position: sticky;
    top: 0;
    z-index: 1;
}

.custom-dropdown-search {
    width: 100%;
    box-sizing: border-box;
    background: #1a1d24;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 7px 10px;
    font-size: 0.88rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.custom-dropdown-search:focus {
    border-color: var(--accent-gold);
}

.custom-dropdown-search::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.custom-dropdown-items-container {
    max-height: 290px;
    overflow-y: auto;
}

.custom-dropdown.open .custom-dropdown-options {
    display: block;
}

.custom-dropdown-option {
    padding: 10px 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease;
    background: #1a1d24;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-dropdown-option:last-child {
    border-bottom: none;
}

.custom-dropdown-option:hover {
    background: #252a33;
}

.custom-dropdown-option.selected {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold);
}

.custom-dropdown-header {
    background: rgba(212, 175, 55, 0.06);
    color: #d4af37;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    padding: 10px 14px 6px;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    cursor: default;
    user-select: none;
    pointer-events: none;
}

.custom-dropdown-header:first-child {
    border-top: none;
}

.custom-dropdown-option.grouped-item {
    padding-left: 20px;
    font-size: 0.88rem;
}

.custom-dropdown-option.group-option {
    background: #12151a;
    color: var(--accent-gold);
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 12px 14px 8px;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.custom-dropdown-option.group-option .group-arrow {
    display: inline-block;
    margin-right: 4px;
    font-size: 0.8em;
}

.custom-dropdown-option.group-option:hover {
    background: #1e2229;
}

.custom-dropdown-option.group-option.selected {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-gold);
}

.custom-dropdown-option.subgroup-option {
    background: #1a1d24;
    color: var(--text-secondary);
    padding-left: 28px;
    font-size: 0.9rem;
}

.custom-dropdown-option.subgroup-option:hover {
    background: #252a33;
    color: var(--text-primary);
}

.custom-dropdown-option.subgroup-option.selected {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-gold);
}

/* Period formatting styles for better readability */
.period-year {
    font-size: 1em;
    font-weight: 600;
    color: #e2e8f0;
    font-family: 'Roboto Mono', monospace;
}

.period-separator {
    font-size: 0.75em;
    font-weight: 400;
    color: #64748b;
    font-family: 'Roboto Mono', monospace;
}

.period-quarter {
    font-size: 0.9em;
    font-weight: 600;
    color: #e2e8f0;
    font-family: 'Roboto Mono', monospace;
}

.custom-dropdown-selected .period-year,
.custom-dropdown-option .period-year {
    color: #e2e8f0;
}

.custom-dropdown-selected .period-separator,
.custom-dropdown-option .period-separator {
    color: #64748b;
}

.custom-dropdown-selected .period-quarter,
.custom-dropdown-option .period-quarter {
    color: #e2e8f0;
}

.custom-dropdown-option:hover .period-year {
    color: #f1f5f9;
}

.custom-dropdown-option:hover .period-separator {
    color: #94a3b8;
}

.custom-dropdown-option:hover .period-quarter {
    color: #f1f5f9;
}

.custom-dropdown-option.selected .period-year {
    color: #f8fafc;
}

.custom-dropdown-option.selected .period-separator {
    color: #94a3b8;
}

.custom-dropdown-option.selected .period-quarter {
    color: #f8fafc;
}

.custom-dropdown-options {
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.4) rgba(18, 21, 26, 0.5);
}

.custom-dropdown-options::-webkit-scrollbar {
    width: 6px;
}

.custom-dropdown-options::-webkit-scrollbar-track {
    background: rgba(18, 21, 26, 0.5);
    border-radius: 0 8px 8px 0;
}

.custom-dropdown-options::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.35);
    border-radius: 3px;
}

.custom-dropdown-options::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.6);
}

/* Section Info Modal Styles */
.section-icon-clickable {
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.section-icon-clickable:hover {
    transform: scale(1.1);
    filter: brightness(1.2) drop-shadow(0 0 8px rgba(245, 158, 11, 0.5));
}

.section-info-modal {
    max-width: 720px;
    background: linear-gradient(145deg, #1a1d24 0%, #12151a 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(245, 158, 11, 0.1);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.section-info-header {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, transparent 100%);
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
    padding: 20px 24px;
}

.section-info-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-info-title-group h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-gold);
    letter-spacing: 0.02em;
}

.section-info-icon {
    width: 42px;
    height: 42px;
    filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.4));
}

.section-info-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.3) rgba(255,255,255,0.03);
}
.section-info-body::-webkit-scrollbar {
    width: 8px;
}
.section-info-body::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
}
.section-info-body::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.25);
    border-radius: 4px;
}
.section-info-body::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.45);
}

.info-section {
    margin-bottom: 24px;
}

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

.info-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-section-title svg {
    fill: var(--accent-gold);
    opacity: 0.8;
}

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

.info-tip {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--accent-emerald);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    color: var(--text-primary);
}

.info-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.info-list li {
    position: relative;
    padding: 8px 0 8px 24px;
    font-size: 0.93rem;
    line-height: 1.5;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--accent-gold);
    border-radius: 50%;
}

.info-highlight {
    color: var(--accent-gold);
    font-weight: 600;
}

.info-comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}
.info-comparison-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 12px;
}
.info-comparison-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-family: 'Roboto Mono', monospace;
}
.info-comparison-card .info-text {
    font-size: 0.82rem;
    margin: 0;
    line-height: 1.5;
}

.info-calc-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.82rem;
}
.info-calc-table thead th {
    background: rgba(245,158,11,0.1);
    color: var(--accent-gold);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(245,158,11,0.2);
}
.info-calc-table thead th:first-child {
    border-radius: 6px 0 0 0;
}
.info-calc-table thead th:last-child {
    border-radius: 0 6px 0 0;
}
.info-calc-table tbody td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--text-secondary);
    vertical-align: top;
}
.info-calc-table tbody tr:last-child td {
    border-bottom: none;
}
.info-calc-label {
    color: var(--accent-gold);
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.78rem;
    white-space: nowrap;
}
.info-calc-table sub {
    font-size: 0.7em;
    color: #9ca3af;
}
.info-calc-na {
    color: #6b7280;
    font-style: italic;
}
.info-calc-note-row td {
    background: rgba(245,158,11,0.04);
    color: #9ca3af;
    font-size: 0.78rem;
    font-style: italic;
    padding: 8px 10px;
    border-radius: 0 0 6px 6px;
}

.service-info-modal {
    max-width: 620px;
}

.service-info-header {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.service-info-footer {
    background: rgba(12, 15, 20, 0.5);
    border-top: 1px solid rgba(245, 158, 11, 0.1);
    padding: 16px 24px;
    text-align: center;
}

.service-info-author {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.radar-chart-container {
    margin-top: 20px;
    padding: 20px;
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 12px;
    box-shadow: 
        0 0 30px rgba(245, 158, 11, 0.08),
        inset 0 0 60px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.radar-chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, rgba(12, 15, 20, 0.85) 0%, rgba(15, 20, 30, 0.75) 50%, rgba(12, 15, 20, 0.85) 100%),
        url('/static/images/radar_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.radar-chart-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 75%;
    background: radial-gradient(ellipse at center, 
        rgba(12, 15, 20, 0.95) 0%, 
        rgba(12, 15, 20, 0.85) 30%,
        rgba(12, 15, 20, 0.6) 60%,
        transparent 100%);
    pointer-events: none;
    z-index: 0;
    border-radius: 50%;
    border: 1px solid rgba(245, 158, 11, 0.15);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.05);
}

.radar-chart-container > * {
    position: relative;
    z-index: 1;
}

.radar-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.15);
    flex-wrap: wrap;
}

.radar-save-widget-btn {
    padding: 6px 16px;
    font-size: 0.75rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(212, 175, 55, 0.15) 100%);
    border-color: rgba(245, 158, 11, 0.5);
    color: #f59e0b;
}

.radar-save-widget-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(212, 175, 55, 0.25) 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.radar-save-widget-btn--green {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(22, 163, 74, 0.25) 100%);
    border-color: rgba(34, 197, 94, 0.6);
    color: #22c55e;
}

.radar-save-widget-btn--green:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.35) 0%, rgba(22, 163, 74, 0.35) 100%);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
}

.radar-title-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.radar-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-gold);
}

.radar-company-neon {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.radar-value-type-center {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.radar-type-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.radar-value-type {
    color: var(--accent-emerald);
    font-weight: 600;
    font-size: 0.9rem;
}

.radar-compare-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.radar-compare-right label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.radar-compare-dropdown {
    background: var(--bg-tertiary);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 180px;
    transition: all 0.2s ease;
}

.radar-compare-dropdown:hover {
    border-color: rgba(245, 158, 11, 0.4);
}

.radar-compare-dropdown:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.radar-compare-dropdown option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.radar-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(245, 158, 11, 0.1);
}

.radar-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.radar-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.radar-legend-color.primary {
    background: rgba(245, 158, 11, 0.6);
    border: 2px solid rgba(245, 158, 11, 0.8);
}

.radar-legend-color.compare {
    background: rgba(59, 130, 246, 0.6);
    border: 2px solid rgba(59, 130, 246, 0.8);
}

.radar-legend-name {
    color: var(--text-secondary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-style: italic;
}

.radar-chart-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    aspect-ratio: 1;
}

/* =============================================================================
   RESPONSIVE DESIGN - MOBILE & TABLET ADAPTATIONS
   ============================================================================= */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    body {
        padding: 12px;
    }
    
    .glass-panel {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-left {
        width: 100%;
    }
    
    .header-right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .table-container {
        max-height: 350px;
    }
    
    .chart-controls {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .ai-analysis-controls {
        grid-template-columns: 1fr;
    }
    
    .kohonen-controls-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .kohonen-group-selection {
        flex-direction: column;
    }
    
    .radar-chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .radar-value-type-center {
        justify-content: flex-start;
    }
    
    .radar-compare-right {
        width: 100%;
    }
    
    .radar-legend {
        flex-direction: column;
        gap: 8px;
        align-items: center;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    body {
        padding: 8px;
    }
    
    .glass-panel {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 8px;
    }
    
    /* Mobile Header - Restructured Layout */
    .header {
        padding: 10px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .header-left {
        display: flex;
        align-items: center;
        gap: 8px;
        order: 1;
    }
    
    .header-ai-icon {
        width: 36px;
        height: 36px;
        border-radius: 6px;
    }
    
    .header-ai-tooltip {
        display: none;
    }
    
    .title-container {
        flex: 1;
        gap: 8px;
    }
    
    .title-text {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    
    .title {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .subtitle {
        font-size: 0.65rem;
        display: none;
    }
    
    .header-nav-links {
        margin-left: 4px;
        padding-left: 4px;
        gap: 4px;
    }
    
    .header-nav-links .back-to-landing {
        width: 32px;
        height: 32px;
        padding: 6px;
    }
    
    .header-right {
        order: 2;
        width: 100%;
        padding-top: 8px;
        border-top: 1px solid rgba(245, 158, 11, 0.1);
    }
    
    .selected-context-header {
        order: 3;
        position: static;
        left: auto;
        transform: none;
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .selected-industry-header,
    .selected-company-header {
        padding: 8px 10px;
        background: rgba(245, 158, 11, 0.08);
        border-radius: 6px;
        border: 1px solid rgba(245, 158, 11, 0.2);
        box-shadow: none;
    }

    .selected-industry-header {
        flex: 0 1 auto;
        max-width: 42%;
    }

    .selected-company-header {
        flex: 1 1 auto;
        max-width: none;
    }
    
    .selected-industry-header:hover,
    .selected-company-header:hover {
        transform: none;
    }
    
    .selected-company-label {
        font-size: 0.65rem;
        white-space: nowrap;
    }
    
    .selected-company-name {
        font-size: 0.85rem;
        font-weight: 600;
    }

    .selected-company-loader-logo {
        width: 24px;
        height: 24px;
    }

    .selected-company-loader-logo img {
        width: 16px;
        height: 16px;
    }

    .selected-company-loader-text {
        font-size: 0.75rem;
    }
    
    .login-form {
        width: 100%;
        display: flex;
        flex-direction: row;
        gap: 8px;
    }
    
    .login-form .input-field {
        flex: 1;
        min-width: 0;
        font-size: 14px;
        padding: 8px 10px;
    }
    
    .login-form .btn-login {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .user-info {
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
    }
    
    .user-label {
        display: none;
    }
    
    .username {
        font-size: 0.8rem;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .user-role-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    .btn-profile,
    .btn-logout {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .btn-profile svg {
        width: 14px;
        height: 14px;
    }
    
    /* Mobile Quick Navigation */
    .quick-nav {
        padding: 10px;
        gap: 6px;
        flex-direction: column;
        overflow-x: visible;
    }
    
    .nav-main-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        width: 100%;
    }

    .nav-divider {
        width: 100%;
        height: 2px;
        background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
        margin: 4px 0;
    }

    .nav-dashboard-group {
        display: none;
    }
    
    .quick-nav-btn {
        flex: none;
        padding: 8px 10px;
        gap: 6px;
        font-size: 0.75rem;
        white-space: nowrap;
        justify-content: flex-start;
    }
    
    .quick-nav-btn .nav-icon-img {
        width: 36px;
        height: 36px;
    }
    
    .section-title {
        font-size: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .section-header-controls {
        width: 100%;
        flex-wrap: wrap;
    }
    
    /* Mobile table styles */
    .table-container {
        max-height: 300px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        font-size: 0.75rem;
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    
    .details-table {
        font-size: 0.75rem;
        min-width: 500px;
    }
    
    .details-table th,
    .details-table td {
        padding: 6px 8px;
    }
    
    /* Mobile filters */
    .companies-filter-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filter-select,
    .filter-input {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    /* Mobile controls */
    .control-group {
        min-width: 100%;
    }
    
    .chart-select {
        font-size: 14px;
    }
    
    /* Mobile Kohonen section */
    .kohonen-controls {
        padding: 12px;
    }
    
    .kohonen-group-selection {
        flex-direction: column;
        gap: 12px;
    }
    
    .kohonen-container {
        padding: 12px;
        min-height: 300px;
    }
    
    #kohonen-chart {
        height: 300px !important;
    }
    
    .kohonen-legend {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 8px;
    }
    
    /* Mobile radar chart */
    .radar-chart-container {
        padding: 12px;
    }
    
    .radar-chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .radar-title-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .radar-label {
        font-size: 0.85rem;
    }
    
    .radar-company-neon {
        font-size: 0.95rem;
    }
    
    .radar-chart-wrapper {
        max-width: 100%;
    }
    
    .radar-compare-dropdown {
        width: 100%;
        font-size: 14px;
    }
    
    /* Mobile AI analysis */
    .ai-analysis-controls {
        padding: 12px;
    }
    
    .ai-control-group {
        min-width: 100%;
    }

    .ai-analyse-controls {
        flex-direction: row;
        align-items: stretch;
    }

    .ai-analyse-controls > .ai-help-tooltip-target.ai-analyse-action {
        width: 50%;
    }
    
    .ai-select {
        font-size: 14px;
    }
    
    .ai-response-container {
        padding: 12px;
        font-size: 0.85rem;
    }
    
    /* Mobile comparison chart */
    #comparison-chart {
        height: 250px !important;
    }
    
    .chart-legend {
        flex-direction: column;
        gap: 8px;
    }
    
    /* Mobile buttons */
    .btn-primary,
    .btn-secondary {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .btn-kohonen-update {
        width: 100%;
    }
    
    /* Mobile modals */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    /* Mobile info button */
    .info-help-btn {
        width: 32px;
        height: 32px;
    }
    
    /* Hide less important elements on mobile */
    .role-label {
        display: none;
    }
    
    .back-to-landing {
        width: 32px;
        height: 32px;
    }
}

/* Small mobile (< 480px) */
@media (max-width: 480px) {
    body {
        padding: 4px;
    }
    
    .glass-panel {
        padding: 10px;
        border-radius: 6px;
    }
    
    .title {
        font-size: 1.1rem;
    }
    
    .section-title {
        font-size: 0.9rem;
    }
    
    .data-table {
        font-size: 0.7rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
    }
    
    #kohonen-chart {
        height: 250px !important;
    }
    
    #comparison-chart {
        height: 200px !important;
    }
    
    .header-right {
        gap: 8px;
    }
    
    .role-selector {
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .table-container {
        max-height: 200px;
    }
    
    #kohonen-chart {
        height: 200px !important;
    }
    
    #comparison-chart {
        height: 180px !important;
    }
    
    .radar-chart-wrapper {
        max-width: 300px;
    }
}

/* Large desktop (> 1400px) */
@media (min-width: 1400px) {
    .glass-panel {
        padding: 28px;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    .data-table {
        font-size: 0.9rem;
    }
}

/* Details Row Tooltip */
.details-row-tooltip {
    position: fixed;
    z-index: 10000;
    background: linear-gradient(135deg, #1e2338 0%, #252b42 100%);
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    padding: 14px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.15);
    pointer-events: none;
    max-width: 420px;
    min-width: 320px;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.details-row-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.details-row-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: #1e2338;
    border-left: 1px solid var(--accent-gold);
    border-top: 1px solid var(--accent-gold);
    transform: rotate(45deg);
}

.details-row-tooltip-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-gold);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-row-tooltip-title svg {
    width: 16px;
    height: 16px;
    fill: var(--accent-gold);
    flex-shrink: 0;
}

.tooltip-param-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tooltip-param-value {
    font-family: 'Roboto Mono', monospace;
    color: #22c55e;
    font-weight: 700;
    margin-left: auto;
    padding-left: 12px;
    flex-shrink: 0;
}

.details-row-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.details-row-tooltip-row:last-child {
    border-bottom: none;
}

.details-row-tooltip-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    flex: 1;
    padding-right: 12px;
}

.details-row-tooltip-value {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: right;
    min-width: 70px;
}

.details-row-tooltip-value.positive {
    color: #22c55e;
}

.details-row-tooltip-value.negative {
    color: #ef4444;
}

.details-row-tooltip-value.neutral {
    color: var(--text-primary);
}

.details-row-tooltip-desc {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2px;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .data-table tr:hover {
        background: inherit;
    }
    
    .data-table tr.selected {
        background: rgba(245, 158, 11, 0.15);
    }
    
    .filter-select,
    .filter-input,
    .chart-select,
    .kohonen-select,
    .ai-select {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-kohonen-update {
        min-height: 44px; /* Touch target size */
    }
}

/* Company Table Tooltip */
.company-tooltip {
    position: absolute;
    z-index: 10000;
    background: linear-gradient(135deg, #1e2338 0%, #151929 100%);
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.15);
    max-width: 350px;
    min-width: 250px;
    pointer-events: none;
    display: none;
}

.company-tooltip .tooltip-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.company-tooltip .tooltip-params {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.company-tooltip .tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 0.8rem;
}

.company-tooltip .tooltip-label {
    color: var(--text-secondary);
    flex: 1;
    padding-right: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.company-tooltip .tooltip-value {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    color: #22c55e;
    text-align: right;
    flex-shrink: 0;
}

/* Metadata Section */
.metadata-section {
    margin-top: 20px;
    border-top: 1px solid rgba(245, 158, 11, 0.2);
    padding-top: 15px;
}

.metadata-header {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 6px;
    transition: background 0.2s ease;
}

.metadata-header:hover {
    background: rgba(245, 158, 11, 0.1);
}

.metadata-header .collapse-toggle {
    transition: transform 0.3s ease;
}

.metadata-header.expanded .collapse-toggle {
    transform: rotate(180deg);
}

.metadata-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 1px;
}

.metadata-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

.metadata-content {
    margin-top: 15px;
}

.metadata-search-row {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.metadata-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
}

.metadata-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #f59e0b;
    cursor: pointer;
}

.metadata-checkbox-label span {
    font-family: 'Roboto Mono', monospace;
}

.metadata-search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    background: #1e222a;
    border: 1px solid rgba(75, 85, 99, 0.5);
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.metadata-search-input:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.metadata-search-input::placeholder {
    color: #6b7280;
}

.metadata-table-wrapper {
    max-height: 800px;
    overflow: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.metadata-table-wrapper::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.metadata-table-wrapper::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.8);
    border-radius: 5px;
}

.metadata-table-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 50%, #f59e0b 100%);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5), 0 0 20px rgba(245, 158, 11, 0.3);
}

.metadata-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.7), 0 0 30px rgba(245, 158, 11, 0.4);
}

.metadata-table-wrapper::-webkit-scrollbar-corner {
    background: rgba(15, 23, 42, 0.8);
}

.metadata-table {
    width: 100%;
    font-size: 0.75rem;
}

.metadata-table th {
    position: sticky;
    top: 0;
    background: #1e2338;
    z-index: 10;
    padding: 8px 10px;
    text-align: left;
    color: var(--accent-gold);
    font-weight: 600;
    white-space: nowrap;
}

.metadata-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metadata-table td:hover {
    white-space: normal;
    word-wrap: break-word;
}

.metadata-table tr:hover {
    background: rgba(245, 158, 11, 0.25);
}

.metadata-table th.sorted-asc::after,
.metadata-table th.sorted-desc::after {
    margin-left: 5px;
    font-size: 0.7rem;
}

.metadata-table th.sorted-asc::after {
    content: '▲';
    color: var(--accent-gold);
}

.metadata-table th.sorted-desc::after {
    content: '▼';
    color: var(--accent-gold);
}

.metadata-table th:hover {
    color: #fbbf24;
}

.metadata-table th.col-source,
.metadata-table td.col-source {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
}

.metadata-table th.col-parameter_id,
.metadata-table td.col-parameter_id {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

.metadata-filters-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.metadata-summary-row {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.metadata-copy-json-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: rgba(30, 35, 56, 0.6);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    color: #f59e0b;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.metadata-copy-json-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.5);
}
.metadata-copy-json-btn.copied {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.5);
}

.metadata-summary-table-wrapper {
    flex: 1;
    background: rgba(30, 35, 56, 0.5);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.metadata-summary-title {
    color: #f59e0b;
    font-size: 0.8rem;
    font-family: 'Roboto Mono', monospace;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.metadata-summary-scroll {
    max-height: 200px;
    overflow-y: auto;
}

.metadata-summary-scroll::-webkit-scrollbar {
    width: 6px;
}

.metadata-summary-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.metadata-summary-scroll::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 3px;
}

.metadata-summary-table {
    width: 100%;
    border-collapse: collapse;
}

.metadata-summary-table td {
    padding: 4px 8px;
    font-size: 0.8rem;
    color: #e5e7eb;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metadata-summary-table tr:hover td {
    background: rgba(245, 158, 11, 0.1);
}

.metadata-group-row.selected td {
    background: rgba(245, 158, 11, 0.2);
    border-left: 3px solid #f59e0b;
}

/* Data Quality Section */
.data-quality-section {
    margin-top: 20px;
    background: rgba(30, 35, 56, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.section-divider-image {
    width: 100%;
    height: 150px;
    overflow: hidden;
    margin: 15px 0;
    border-radius: 8px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.section-divider-image:hover {
    opacity: 1;
}

.section-divider-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.data-quality-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    cursor: pointer;
    background: transparent;
    transition: background 0.2s ease;
}

.data-quality-header:hover {
    background: rgba(245, 158, 11, 0.1);
}

.data-quality-header .collapse-toggle {
    transition: transform 0.3s ease;
}

.data-quality-header.expanded .collapse-toggle {
    transform: rotate(180deg);
}

.data-quality-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ef4444;
    letter-spacing: 1px;
}

.data-quality-count {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 5px;
}

.data-quality-content {
    padding: 15px;
}

.data-quality-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.dq-card {
    background: rgba(20, 25, 40, 0.6);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dq-card-title {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: #f59e0b;
    margin-bottom: 10px;
    font-weight: 600;
}

.dq-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dq-stat-label {
    color: #9ca3af;
}

.dq-stat-value {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
}

.dq-stat-value.zero {
    color: #10b981;
}

.dq-stat-value.warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid #f59e0b;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.8rem;
    line-height: 1.2;
}

.dq-stat-value.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.8rem;
    line-height: 1.2;
}

.dq-params-list {
    margin-top: 8px;
    max-height: 100px;
    overflow-y: auto;
    font-size: 0.7rem;
    color: #6b7280;
    font-family: 'Roboto Mono', monospace;
}

.dq-params-list strong {
    color: #f472b6;
}

.dq-params-list::-webkit-scrollbar {
    width: 4px;
}

.dq-params-list::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 2px;
}

.dq-loading {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-size: 0.85rem;
}

/* Radar axis tooltip */
.radar-axis-tooltip {
    position: absolute;
    z-index: 10000;
    background: rgba(12, 15, 20, 0.96);
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-radius: 8px;
    padding: 12px 16px;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    max-width: 350px;
}

.radar-tooltip-title {
    color: #f59e0b;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.radar-tooltip-value {
    color: #e5e7eb;
    font-size: 12px;
    font-family: 'Roboto Mono', monospace;
    margin: 4px 0;
}

.radar-tooltip-diff {
    color: #10b981;
    font-size: 11px;
    font-style: italic;
    margin-top: 6px;
}

/* Navigation button tooltip */
.nav-tooltip {
    position: absolute;
    z-index: 10000;
    background: linear-gradient(135deg, rgba(12, 15, 20, 0.98) 0%, rgba(20, 25, 35, 0.98) 100%);
    border: 1px solid rgba(245, 158, 11, 0.6);
    border-radius: 10px;
    padding: 14px 18px;
    max-width: 280px;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.15);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.nav-tooltip::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid rgba(245, 158, 11, 0.6);
}

.nav-tooltip::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(12, 15, 20, 0.98);
}

.nav-tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.nav-tooltip-icon {
    width: 24px;
    height: 24px;
}

.nav-tooltip-title {
    color: #f59e0b;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.nav-tooltip-text {
    color: #d1d5db;
    font-size: 12px;
    line-height: 1.5;
    font-family: 'Inter', sans-serif;
}

/* Chart type selector buttons */
.radar-chart-type-selector {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 3px;
}

.chart-type-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.chart-type-btn:hover {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
}

.chart-type-btn.active {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
}

.chart-type-btn svg {
    stroke: currentColor;
    fill: none;
}

.chart-type-btn.active svg rect,
.chart-type-btn:hover svg rect {
    fill: currentColor;
    stroke: currentColor;
}

/* Center bar chart in container */
.radar-chart-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.radar-chart-wrapper canvas {
    max-width: 100%;
}

/* Metadata Row Tooltip */
.metadata-row-tooltip {
    position: absolute;
    z-index: 10000;
    background: linear-gradient(135deg, #1e2338 0%, #151929 100%);
    border: 1px solid var(--accent-gold);
    border-radius: 10px;
    padding: 16px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 25px rgba(245, 158, 11, 0.2);
    max-width: 500px;
    min-width: 300px;
    pointer-events: none;
    display: none;
}

.metadata-row-tooltip .tooltip-header {
    font-size: 1rem;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.metadata-row-tooltip .tooltip-header::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url('/static/images/golden_parameters_settings_icon.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.metadata-row-tooltip .tooltip-section {
    margin-bottom: 12px;
}

.metadata-row-tooltip .tooltip-section:last-child {
    margin-bottom: 0;
}

.metadata-row-tooltip .tooltip-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metadata-row-tooltip .tooltip-formula {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #22c55e;
    word-break: break-word;
}

.metadata-row-tooltip .tooltip-comment {
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.5;
    word-break: break-word;
}

/* Error Modal */
.error-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.error-modal-overlay.active {
    display: flex;
}

.error-modal {
    background: linear-gradient(145deg, #1f242d 0%, #161a22 100%);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(239, 68, 68, 0.15);
    animation: errorModalSlideIn 0.3s ease;
}

@keyframes errorModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.error-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.error-modal-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 50%;
    color: #ef4444;
}

.error-modal-title {
    flex: 1;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #ef4444;
}

.error-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

.error-modal-close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.error-modal-body {
    padding: 20px;
}

.error-modal-message {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #e5e7eb;
    line-height: 1.5;
    margin-bottom: 12px;
}

.error-modal-details-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease;
}

.error-modal-details-toggle:hover {
    color: #9ca3af;
}

.error-modal-details-toggle.expanded svg {
    transform: rotate(180deg);
}

.error-modal-details {
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: #9ca3af;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: min(45vh, 420px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(239, 68, 68, 0.55) rgba(15, 18, 24, 0.85);
}

.error-modal .error-modal-details::-webkit-scrollbar {
    width: 8px;
}

.error-modal .error-modal-details::-webkit-scrollbar-track {
    background: rgba(15, 18, 24, 0.85);
    border-radius: 6px;
    margin: 4px 0;
}

.error-modal .error-modal-details::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.45) 0%, rgba(185, 28, 28, 0.6) 100%);
    border-radius: 6px;
    border: 2px solid rgba(15, 18, 24, 0.85);
    background-clip: padding-box;
}

.error-modal .error-modal-details::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(248, 113, 113, 0.7) 0%, rgba(239, 68, 68, 0.85) 100%);
    border-color: rgba(15, 18, 24, 0.85);
}

.error-modal-details.hidden {
    display: none;
}

.error-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid rgba(239, 68, 68, 0.1);
}

.error-modal-btn {
    padding: 10px 24px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.error-modal-btn:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Info Modal */
.info-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.info-modal-overlay.active {
    display: flex;
}

.info-modal {
    background: linear-gradient(145deg, #1f242d 0%, #161a22 100%);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(212, 175, 55, 0.15);
    animation: infoModalSlideIn 0.3s ease;
}

@keyframes infoModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.info-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.info-modal-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 55, 0.15);
    border-radius: 50%;
    color: var(--accent-gold);
}

.info-modal-title {
    flex: 1;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-gold);
}

.info-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

.info-modal-close:hover {
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.1);
}

.info-modal-body {
    padding: 20px;
}

.info-modal-message {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #e5e7eb;
    line-height: 1.6;
}

.info-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid rgba(212, 175, 55, 0.1);
}

.info-modal-btn {
    padding: 10px 24px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--bg-primary);
    background: linear-gradient(135deg, var(--accent-gold) 0%, #b8860b 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.info-modal-btn:hover {
    background: linear-gradient(135deg, #fbbf24 0%, var(--accent-gold) 100%);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.empty-edge-params-modal {
    max-width: 620px;
}

.empty-edge-params-message {
    color: #e5e7eb;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 14px;
}

.empty-edge-params-list {
    max-height: min(42vh, 360px);
    overflow-y: auto;
    margin: 0;
    padding: 12px 12px 12px 30px;
    border: 1px solid rgba(212, 175, 55, 0.22);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.42);
    color: #fef3c7;
    font-size: 0.9rem;
    line-height: 1.5;
    scrollbar-width: thin;
    scrollbar-color: rgba(245, 158, 11, 0.65) rgba(15, 23, 42, 0.85);
}

.empty-edge-params-list li + li {
    margin-top: 8px;
}

.empty-edge-params-list::-webkit-scrollbar {
    width: 8px;
}

.empty-edge-params-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.85);
    border-radius: 8px;
    margin: 6px 0;
}

.empty-edge-params-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.55) 0%, rgba(180, 83, 9, 0.72) 100%);
    border: 2px solid rgba(15, 23, 42, 0.85);
    border-radius: 8px;
    background-clip: padding-box;
}

.empty-edge-params-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.82) 0%, rgba(245, 158, 11, 0.9) 100%);
}

.prompt-editor-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    background: rgba(212, 175, 55, 0.08);
    color: #d4af37;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    height: 42px;
    box-sizing: border-box;
    align-self: end;
}

.prompt-editor-btn:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.5);
}

.prompt-editor-btn span {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-editor-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-editor-modal {
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1419 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    width: 90vw;
    max-width: 900px;
    height: 85vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(212, 175, 55, 0.1);
    resize: both;
    overflow: auto;
    min-width: 500px;
    min-height: 400px;
}

.prompt-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.prompt-editor-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f59e0b;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.prompt-editor-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.prompt-editor-close:hover {
    color: #f43f5e;
}

.prompt-editor-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.prompt-presets-panel {
    width: 220px;
    min-width: 220px;
    border-right: 1px solid rgba(212, 175, 55, 0.15);
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 8px;
}

.prompt-presets-label {
    color: #9ca3af;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 4px;
}

.prompt-presets-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prompt-preset-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #d1d5db;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.prompt-preset-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.prompt-preset-item.active {
    background: rgba(212, 175, 55, 0.12);
    border-color: rgba(212, 175, 55, 0.3);
    color: #f59e0b;
}

.prompt-preset-item.shared-preset,
.prompt-preset-item.public-preset {
    border-color: rgba(59, 130, 246, 0.18);
}

.prompt-preset-item.has-color {
    box-shadow: inset 3px 0 0 0 var(--preset-color, transparent);
}

.prompt-context-menu {
    position: fixed;
    z-index: 10002;
    min-width: 210px;
    background: linear-gradient(135deg, #1a1f2e 0%, #12161f 100%);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: promptCtxMenuIn 0.12s ease;
}

@keyframes promptCtxMenuIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.prompt-context-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: none;
    color: #d1d5db;
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.prompt-context-item svg {
    flex-shrink: 0;
    color: #9ca3af;
}

.prompt-context-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.prompt-context-item:hover svg {
    color: #f59e0b;
}

.prompt-context-item.danger:hover {
    background: rgba(244, 63, 94, 0.12);
    color: #f87171;
}

.prompt-context-item.danger:hover svg {
    color: #f87171;
}

.prompt-context-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 6px;
}

.prompt-context-section-label {
    padding: 6px 10px 2px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.prompt-context-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 4px 10px 8px;
}

.prompt-context-color {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
}

.prompt-context-color:hover {
    transform: scale(1.15);
}

.prompt-context-color.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.prompt-context-color-none {
    position: relative;
    background: transparent;
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

.prompt-context-color-none::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 1px;
    bottom: 1px;
    width: 2px;
    margin-left: -1px;
    background: #ef4444;
    transform: rotate(45deg);
}

.prompt-preset-item .preset-name,
.prompt-preset-item .prompt-preset-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    line-height: 1.35;
}

.prompt-preset-badge {
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(59, 130, 246, 0.28);
    color: #93c5fd;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.prompt-preset-item .preset-icon,
.prompt-preset-item .prompt-preset-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-presets-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.prompt-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: #9ca3af;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.prompt-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
}

.prompt-save-btn:hover {
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.prompt-save-current-btn {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
    font-weight: 600;
}

.prompt-save-current-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.55);
    color: #6ee7b7;
}

.prompt-save-current-btn.saved {
    background: rgba(16, 185, 129, 0.28);
    border-color: rgba(16, 185, 129, 0.7);
    color: #a7f3d0;
}

.prompt-delete-btn:hover {
    border-color: rgba(244, 63, 94, 0.4);
    color: #f43f5e;
}

.prompt-editor-text-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    min-width: 0;
}

.prompt-publish-btn:hover,
.prompt-publish-btn.active {
    border-color: rgba(59, 130, 246, 0.45);
    color: #93c5fd;
}

.prompt-publish-btn.active {
    background: rgba(59, 130, 246, 0.12);
}

.prompt-editor-textarea {
    flex: 1;
    resize: none;
    background: rgba(15, 17, 28, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #e5e7eb;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    padding: 14px;
    min-height: 300px;
    transition: border-color 0.2s;
}

.prompt-editor-textarea:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.4);
}

.prompt-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
}

.prompt-editor-select-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, #d4af37, #b8962e);
    color: #0d1117;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.prompt-editor-select-btn:hover {
    background: linear-gradient(135deg, #e5c54b, #d4af37);
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.45);
    transform: translateY(-1px);
}

.prompt-editor-select-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(212, 175, 55, 0.3);
}

.prompt-presets-list::-webkit-scrollbar,
.prompt-editor-textarea::-webkit-scrollbar {
    width: 6px;
}

.prompt-presets-list::-webkit-scrollbar-track,
.prompt-editor-textarea::-webkit-scrollbar-track {
    background: rgba(15, 17, 28, 0.4);
    border-radius: 3px;
}

.prompt-presets-list::-webkit-scrollbar-thumb,
.prompt-editor-textarea::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.35);
    border-radius: 3px;
    transition: background 0.2s;
}

.prompt-presets-list::-webkit-scrollbar-thumb:hover,
.prompt-editor-textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.6);
}

.prompt-presets-list,
.prompt-editor-textarea {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.35) rgba(15, 17, 28, 0.4);
}

.prompt-save-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-save-modal {
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1419 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 10px;
    padding: 20px;
    width: 360px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

.prompt-save-modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f59e0b;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

.prompt-save-modal-body {
    margin-bottom: 16px;
}

.prompt-save-modal-body label {
    color: #9ca3af;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 6px;
}

.prompt-save-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 17, 28, 0.6);
    color: #e5e7eb;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.prompt-save-input:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.5);
}

.prompt-save-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.prompt-save-cancel-btn,
.prompt-save-confirm-btn,
.prompt-delete-confirm-btn {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid;
}

.prompt-save-cancel-btn {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #9ca3af;
}

.prompt-save-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #d1d5db;
}

.prompt-save-confirm-btn {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.prompt-save-confirm-btn:hover {
    background: rgba(16, 185, 129, 0.25);
}

.prompt-delete-confirm-btn {
    border-color: rgba(244, 63, 94, 0.5);
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
}

.prompt-delete-confirm-btn:hover {
    background: rgba(244, 63, 94, 0.25);
}

@keyframes widgetFlash {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(2); }
}

.outliers-controls {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.outliers-controls-row {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
}
.outliers-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}
.outliers-ecdf-group {
    flex: 1;
    min-width: 200px;
}
.outliers-ecdf-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.outliers-ecdf-chip {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 5px 10px;
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
    opacity: 0.5;
}
.outliers-ecdf-chip.active {
    opacity: 1;
    color: var(--text-primary);
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.08);
}
.outliers-ecdf-chip:hover {
    border-color: var(--accent-gold);
    opacity: 0.85;
}
.outliers-ecdf-chip.active:hover {
    opacity: 1;
}
.outliers-ecdf-chip-all {
    border-color: rgba(245, 158, 11, 0.3) !important;
}
.outliers-ecdf-chip-all span {
    color: var(--accent-gold);
    font-weight: 600;
}
.outliers-ecdf-chip-all.active {
    background: rgba(245, 158, 11, 0.15);
}
.outliers-slider-group {
    flex: 1;
    min-width: 220px;
}
.outliers-slider-container {
    position: relative;
    height: 36px;
    margin-top: 2px;
}
.outliers-slider {
    position: absolute;
    width: 100%;
    height: 4px;
    top: 16px;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    z-index: 2;
}
.outliers-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gold);
    border: 2px solid var(--bg-primary);
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}
.outliers-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gold);
    border: 2px solid var(--bg-primary);
    cursor: pointer;
    pointer-events: auto;
}
.outliers-slider-track {
    position: absolute;
    top: 16px;
    height: 4px;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.6), rgba(16, 185, 129, 0.6));
    border-radius: 2px;
    z-index: 1;
}
.outliers-slider-container::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(100, 116, 139, 0.3);
    border-radius: 2px;
}
.outliers-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.outliers-summary {
    padding: 14px 24px;
    margin-bottom: 16px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(30, 34, 42, 0.95), rgba(20, 24, 32, 0.95));
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.os-label {
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.os-company {
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 0.9rem;
}
.os-period {
    color: #60a5fa;
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
}
.os-norm {
    color: var(--accent-emerald);
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
}
.os-count {
    color: var(--text-primary);
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.95rem;
}
.os-count.outliers-count-highlight {
    color: #f43f5e;
    font-size: 1.05rem;
    text-shadow: 0 0 8px rgba(244, 63, 94, 0.3);
}
.os-sep {
    color: rgba(148, 163, 184, 0.25);
    margin: 0 4px;
    font-weight: 300;
}
.outliers-error-msg {
    color: #f43f5e;
}
.outlier-custom-tooltip {
    position: absolute;
    z-index: 10000;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.97), rgba(20, 28, 48, 0.97));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 12px rgba(245, 158, 11, 0.1);
    transition: opacity 0.15s ease;
    min-width: 180px;
}
.oct-period {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    color: rgba(148, 163, 184, 0.8);
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}
.oct-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-gold);
}
.oct-unit {
    font-size: 11px;
    font-weight: 400;
    color: rgba(148, 163, 184, 0.7);
    margin-left: 4px;
}
.oct-outlier-badge {
    margin-top: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    border-radius: 3px;
    padding: 2px 6px;
    display: inline-block;
    text-transform: uppercase;
}
.oct-extras-table {
    width: 100%;
    margin-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    padding-top: 6px;
    border-collapse: collapse;
}
.oct-extras-table td {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    padding: 2px 0;
    white-space: nowrap;
}
.oct-ex-label {
    color: rgba(148, 163, 184, 0.7);
    padding-right: 10px !important;
    font-weight: 600;
}
.oct-ex-val {
    color: #e2e8f0;
    text-align: right;
    padding-right: 8px !important;
}
.oct-ex-pct {
    color: #93c5fd;
    text-align: right;
}
.oct-ecdf-table {
    width: 100%;
    margin-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    padding-top: 4px;
    border-collapse: collapse;
}
.oct-ecdf-header td {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 700;
    color: rgba(148, 163, 184, 0.5);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 4px 0 2px;
}
.oct-ecdf-table td {
    font-family: 'Roboto Mono', monospace;
    font-size: 11px;
    padding: 1px 0;
    white-space: nowrap;
}
.oct-ecdf-label {
    color: rgba(148, 163, 184, 0.7);
    font-weight: 600;
    padding-right: 10px !important;
}
.oct-ecdf-val {
    text-align: right;
    font-weight: 600;
}
.outliers-intro {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('/static/images/ai_analysis_bg.png') center/cover no-repeat;
    min-height: 340px;
}
.outliers-intro::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(10, 15, 30, 0.95) 0%, rgba(15, 23, 42, 0.92) 50%, rgba(10, 15, 30, 0.94) 100%);
    z-index: 1;
}
.outliers-intro-content {
    position: relative;
    z-index: 2;
    padding: 32px 36px 28px;
}
.outliers-intro-content h3 {
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #7dd3fc;
    margin: 0 0 12px 0;
    letter-spacing: 0.02em;
}
.outliers-intro-lead {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: #93c5fd;
    line-height: 1.6;
    margin: 0 0 24px 0;
    max-width: 800px;
}
.outliers-intro-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.outliers-intro-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 16px 14px 14px;
    transition: border-color 0.2s;
}
.outliers-intro-card:hover {
    border-color: rgba(245, 158, 11, 0.3);
}
.outliers-intro-icon {
    width: 36px;
    height: 36px;
    display: block;
    margin-bottom: 8px;
    object-fit: contain;
}
.outliers-intro-card h4 {
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: #bae6fd;
    margin: 0 0 6px 0;
}
.outliers-intro-card p {
    font-family: 'Inter', sans-serif;
    font-size: 0.76rem;
    color: #7dd3fc;
    line-height: 1.55;
    margin: 0;
}
.outliers-intro-ecdf-ref {
    margin-bottom: 20px;
    padding: 16px 18px;
    background: rgba(56, 189, 248, 0.04);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 8px;
}
.outliers-intro-ecdf-ref h4 {
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    color: #7dd3fc;
    margin: 0 0 8px 0;
}
.outliers-intro-ecdf-ref > p {
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    color: #93c5fd;
    line-height: 1.6;
    margin: 0 0 14px 0;
}
.outliers-intro-ecdf-ref b {
    color: #bae6fd;
}
.outliers-ecdf-scale {
    margin-bottom: 14px;
}
.outliers-ecdf-scale-bar {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
}
.outliers-ecdf-zone {
    display: flex;
    align-items: center;
    justify-content: center;
}
.outliers-ecdf-zone-low {
    flex: 0.1;
    background: rgba(248, 113, 113, 0.25);
    color: #f87171;
    border-right: 1px solid rgba(248, 113, 113, 0.4);
}
.outliers-ecdf-zone-norm {
    flex: 0.8;
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
}
.outliers-ecdf-zone-high {
    flex: 0.1;
    background: rgba(248, 113, 113, 0.25);
    color: #f87171;
    border-left: 1px solid rgba(248, 113, 113, 0.4);
}
.outliers-ecdf-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
}
.outliers-ecdf-label-low,
.outliers-ecdf-label-high {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    color: #f87171;
    text-align: center;
    width: 120px;
    line-height: 1.3;
}
.outliers-ecdf-label-norm {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    color: #4ade80;
    text-align: center;
    flex: 1;
}
.outliers-ecdf-hints {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}
.outliers-ecdf-hints li {
    font-family: 'Inter', sans-serif;
    font-size: 0.76rem;
    color: #93c5fd;
    padding: 4px 0 4px 16px;
    position: relative;
    line-height: 1.5;
}
.outliers-ecdf-hints li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #38bdf8;
}
.outliers-ecdf-hints li b {
    font-family: 'Roboto Mono', monospace;
    color: #e0f2fe;
    font-size: 0.74rem;
}
.outliers-ecdf-note {
    font-family: 'Inter', sans-serif;
    font-size: 0.74rem;
    color: rgba(147, 197, 253, 0.7);
    line-height: 1.5;
    margin: 0;
}
.outliers-ecdf-note b {
    color: #bae6fd;
}

.outliers-intro-steps {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.outliers-intro-step {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #bae6fd;
    background: rgba(56, 189, 248, 0.06);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 6px;
    padding: 6px 14px;
}
.outliers-intro-step b {
    color: #38bdf8;
}
.outliers-intro-arrow {
    color: rgba(56, 189, 248, 0.4);
    font-size: 1rem;
}

.outliers-empty {
    padding: 30px;
    text-align: center;
    color: rgba(16, 185, 129, 0.8);
    font-size: 0.9rem;
}

.outliers-table tbody tr {
    cursor: pointer;
    transition: background 0.15s ease;
}
.outliers-table tbody tr.outlier-selected {
    background: rgba(245, 158, 11, 0.12) !important;
    outline: 1px solid rgba(245, 158, 11, 0.3);
}

.outliers-chart-container {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    position: relative;
}
.outliers-chart-header {
    margin-bottom: 10px;
}
.outliers-chart-title {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--accent-gold);
    font-weight: 600;
}
#outliers-chart-canvas {
    width: 100% !important;
    height: 280px !important;
}
.outliers-results {
    padding: 0;
}
.outliers-filter-row {
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.outliers-param-filter {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: 'Roboto Mono', monospace;
    font-size: 12px;
    padding: 7px 12px;
    width: 320px;
    max-width: 100%;
    transition: border-color 0.2s;
}
.outliers-param-filter:focus {
    outline: none;
    border-color: var(--accent-gold);
    color: var(--text-primary);
}
.outliers-param-filter::placeholder {
    color: rgba(148, 163, 184, 0.5);
}
.outliers-th-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 18px !important;
    transition: color 0.2s;
}
.outliers-th-sortable:hover {
    color: var(--accent-gold);
}
.outliers-th-sortable::after {
    content: '⇅';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0.3;
}
.outliers-th-sortable.sort-asc::after {
    content: '▲';
    opacity: 0.9;
    color: var(--accent-gold);
}
.outliers-th-sortable.sort-desc::after {
    content: '▼';
    opacity: 0.9;
    color: var(--accent-gold);
}
.outliers-table-container {
    max-height: 600px;
    overflow: auto;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}
.outliers-table-container::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.outliers-table-container::-webkit-scrollbar-track {
    background: var(--bg-card);
}
.outliers-table-container::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}
.outliers-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}
.outliers-table-container::-webkit-scrollbar-corner {
    background: var(--bg-card);
}
.outliers-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.8rem;
}
.outliers-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    color: var(--accent-gold);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    z-index: 2;
}
.outliers-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}
.outliers-table tbody tr:hover {
    background: rgba(245, 158, 11, 0.05);
}
tr.outlier-low td.outlier-value {
    color: #f43f5e;
    font-weight: 700;
}
tr.outlier-high td.outlier-value {
    color: #10b981;
    font-weight: 700;
}
tr.outlier-low td.outlier-direction {
    color: #f43f5e;
    font-size: 0.75rem;
}
tr.outlier-high td.outlier-direction {
    color: #10b981;
    font-size: 0.75rem;
}
.outliers-table tbody td.outlier-num {
    color: rgba(148, 163, 184, 0.5);
}
.outliers-table tbody td.outlier-param {
    color: #60a5fa;
    font-weight: 600;
}
.os-src-interros { color: #f59e0b; }
.os-src-statrep { color: #a78bfa; }
.os-src-msfo { color: #34d399; }
.os-src-cb { color: #f472b6; }
.os-src-calc { color: #38bdf8; }
.os-src-default { color: var(--text-secondary); }
.outliers-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.2);
}
.outliers-table tbody tr:nth-child(even):hover {
    background: rgba(245, 158, 11, 0.05);
}

.outliers-ai-section {
    margin-top: 16px;
}
.outliers-ai-selection-info {
    margin-bottom: 8px;
}
.outliers-ai-selected-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    color: var(--accent-gold);
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 4px;
    padding: 4px 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.outlier-th-check {
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    text-align: center;
    padding: 2px !important;
    vertical-align: middle;
}
.outlier-th-check input[type="checkbox"],
.outlier-check-cell input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(212, 175, 55, 0.35);
    border-radius: 4px;
    background: rgba(212, 175, 55, 0.06);
    cursor: pointer;
    position: relative;
    transition: all 0.25s ease;
    vertical-align: middle;
    display: inline-block;
    margin: 0 auto;
}
.outlier-th-check input[type="checkbox"]:hover,
.outlier-check-cell input[type="checkbox"]:hover {
    border-color: rgba(212, 175, 55, 0.7);
    background: rgba(212, 175, 55, 0.12);
    transform: scale(1.15);
}
.outlier-th-check input[type="checkbox"]:checked,
.outlier-check-cell input[type="checkbox"]:checked {
    background: #d4af37;
    border-color: #d4af37;
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}
.outlier-th-check input[type="checkbox"]:checked::after,
.outlier-check-cell input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.outlier-th-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-color: rgba(212, 175, 55, 0.5);
}
.outlier-th-check input[type="checkbox"]:checked::after {
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
}
.outlier-check-cell {
    text-align: center;
    padding: 2px 0 !important;
    width: 28px;
    min-width: 28px;
    max-width: 28px;
    vertical-align: middle;
}
.outliers-table tr.outlier-checked {
    background: rgba(212, 175, 55, 0.15) !important;
}
.outliers-table tr.outlier-checked td:first-child {
    border-left: 2px solid rgba(212, 175, 55, 0.7);
}
.outlier-ai-no-selection {
    color: rgba(255, 107, 107, 0.7) !important;
    font-style: italic;
}
.outlier-prompt-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 220px;
    background: var(--bg-card, #1a1f2e);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    overflow: hidden;
}
.outlier-prompt-item {
    padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.outlier-prompt-item:last-child {
    border-bottom: none;
}
.outlier-prompt-item:hover {
    background: rgba(212, 175, 55, 0.1);
    color: var(--text-primary);
}
.outlier-prompt-item.active {
    background: rgba(212, 175, 55, 0.12);
    color: #d4af37;
    font-weight: 600;
}

.param-action-btn-logical-set {
    background: rgba(212, 175, 55, 0.2) !important;
    border-color: rgba(212, 175, 55, 0.55) !important;
    color: #f5e6a8 !important;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.18) !important;
}

.param-action-btn-logical-set:hover {
    background: rgba(212, 175, 55, 0.28) !important;
    border-color: rgba(234, 201, 108, 0.75) !important;
    color: #fffbeb !important;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.28) !important;
}

.logical-sets-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.logical-sets-modal-overlay.active {
    display: flex;
}

.logical-sets-modal {
    background: linear-gradient(145deg, #1a1f28 0%, #0f1318 100%);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 16px;
    width: 90%;
    max-width: 970px;
    max-height: 80vh;
    display: flex;
    flex-direction: row;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(212, 175, 55, 0.1);
    animation: logicalSetsSlideIn 0.3s ease;
    overflow: hidden;
}

@keyframes logicalSetsSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.logical-sets-modal-image {
    width: 180px;
    min-width: 180px;
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(212, 175, 55, 0.2);
    position: relative;
}

.logical-sets-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
    filter: brightness(0.9);
}

.logical-sets-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logical-sets-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}

.logical-sets-modal-header h3 {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: #d4af37;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logical-sets-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 26px;
    padding: 0 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 6px;
}

.logical-sets-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logical-sets-modal-close:hover {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.15);
}

.logical-sets-modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
}

.logical-sets-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.logical-sets-search {
    flex: 1;
}

.logical-sets-search input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.logical-sets-search input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.logical-sets-search input::placeholder {
    color: #6b7280;
}

.logical-sets-source-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logical-sets-source-filter label {
    font-size: 0.85rem;
    color: #9ca3af;
    white-space: nowrap;
}

.logical-sets-source-filter select {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    min-width: 180px;
}

.logical-sets-source-filter select:focus {
    outline: none;
    border-color: #d4af37;
}

.logical-sets-source-filter select option {
    background: #1a1f28;
    color: #e5e7eb;
}

.logical-sets-favorites-filter {
    display: flex;
    align-items: center;
}

.favorites-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.favorites-checkbox-label:hover {
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(0, 0, 0, 0.4);
}

.favorites-checkbox-label input[type="checkbox"] {
    display: none;
}

.favorites-checkbox-label .favorites-heart-icon {
    color: #6b7280;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.favorites-checkbox-label input[type="checkbox"]:checked ~ .favorites-heart-icon {
    color: #ef4444;
}

.favorites-checkbox-label span:last-child {
    font-size: 0.85rem;
    color: #9ca3af;
}

.logical-set-card-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
    transition: all 0.2s ease;
    z-index: 10;
}

.logical-set-card-favorite:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(212, 175, 55, 0.4);
    transform: scale(1.1);
}

.logical-set-card-favorite.active {
    color: #ef4444;
}

.logical-sets-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.logical-sets-list::-webkit-scrollbar {
    width: 8px;
}

.logical-sets-list::-webkit-scrollbar-track {
    background: #12151a;
    border-radius: 4px;
}

.logical-sets-list::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.35);
    border-radius: 4px;
}

.logical-sets-list::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.55);
}

.logical-set-card {
    position: relative;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 10px;
    padding: 14px 16px;
    padding-right: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logical-set-card:nth-child(even) {
    background: rgba(212, 175, 55, 0.02);
}

.logical-set-card:nth-child(odd) {
    background: rgba(30, 40, 55, 0.4);
}

.logical-set-card:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.logical-set-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.logical-set-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #d4af37;
    margin: 0;
}

.logical-set-card-priority {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.7rem;
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.12);
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.logical-set-card-count {
    font-size: 0.7rem;
    color: #d4af37;
    background: rgba(212, 175, 55, 0.15);
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
    border: 1px solid rgba(212, 175, 55, 0.25);
}

.logical-set-card-description {
    font-size: 0.85rem;
    color: #9ca3af;
    line-height: 1.5;
    margin-bottom: 12px;
    transition: color 0.2s ease;
}

.logical-set-card:hover .logical-set-card-description {
    color: #ffffff;
}

.logical-set-custom-tooltip {
    position: fixed;
    z-index: 20000;
    background: linear-gradient(145deg, #1e2530 0%, #141920 100%);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 175, 55, 0.1);
    max-width: 550px;
}

.logical-set-tooltip-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.8rem;
}

.logical-set-tooltip-table tr:nth-child(odd) {
    background: rgba(212, 175, 55, 0.05);
}

.logical-set-tooltip-table tr:nth-child(even) {
    background: rgba(30, 40, 55, 0.3);
}

.logical-set-tooltip-table td {
    padding: 6px 10px;
    vertical-align: top;
}

.logical-set-tooltip-table td.tooltip-id {
    color: #d4af37;
    font-family: 'Roboto Mono', monospace;
    font-weight: 500;
    white-space: nowrap;
    width: 60px;
}

.logical-set-tooltip-table td.tooltip-group {
    color: #a78bfa;
    font-size: 0.7rem;
    width: 120px;
    max-width: 120px;
    white-space: normal;
    word-wrap: break-word;
}

.logical-set-tooltip-table td.tooltip-name {
    color: #38bdf8;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.logical-set-card-params {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.logical-set-param-tag {
    font-size: 0.7rem;
    color: #d1d5db;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(75, 85, 99, 0.3);
}

.logical-sets-empty {
    text-align: center;
    color: #6b7280;
    padding: 40px 20px;
    font-size: 0.9rem;
}

.logical-set-card-sources {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.logical-set-card-sources .logical-set-card-priority {
    margin-left: auto;
}

.logical-set-source-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.logical-set-source-tag[data-source*="\u041C\u0421\u0424\u041E"] {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.3);
}

.logical-set-source-tag[data-source*="\u0440\u0430\u0441\u0447\u0435\u0442\u043D\u044B\u0439"] {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

.logical-set-source-tag[data-source*="\u0420\u0421\u0411\u0423"] {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
    border-color: rgba(236, 72, 153, 0.3);
}

.logical-set-source-tag[data-source*="StatRep"] {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
    border-color: rgba(236, 72, 153, 0.3);
}

.logical-set-source-tag[data-source*="INTERROS"] {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
    border-color: rgba(6, 182, 212, 0.3);
}

.logical-sets-tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0 8px 0;
}
.logical-sets-tags-filter:empty {
    display: none;
}
.logical-sets-tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-family: 'Roboto Mono', monospace;
    color: #9ca3af;
    background: rgba(55, 65, 81, 0.4);
    border: 1px solid rgba(75, 85, 99, 0.4);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.logical-sets-tag-pill:hover {
    color: #d4af37;
    border-color: rgba(212, 175, 55, 0.3);
}
.logical-sets-tag-pill.active {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.5);
}
.logical-set-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.logical-set-tag-badge {
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(212, 175, 55, 0.1);
    color: #d4af37;
    border: 1px solid rgba(212, 175, 55, 0.2);
    font-family: 'Roboto Mono', monospace;
}

.insert-pos-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.insert-pos-dialog {
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1419 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 14px;
    width: 520px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(212, 175, 55, 0.08);
}

.insert-pos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(75, 85, 99, 0.3);
}

.insert-pos-title {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.95rem;
    color: #d4af37;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.insert-pos-close {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.insert-pos-close:hover {
    color: #ef4444;
}

.insert-pos-hint {
    padding: 10px 20px;
    font-size: 0.8rem;
    color: #9ca3af;
}

.insert-pos-loading-state {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 20px 0;
    padding: 10px 12px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    background: rgba(20, 25, 32, 0.55);
    color: #cbd5e1;
    font-size: 0.8rem;
}

.insert-pos-progress-wrap {
    display: grid;
    gap: 8px;
    margin: 10px 20px 0;
    padding: 10px 12px;
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 8px;
    background: rgba(22, 38, 30, 0.28);
}

.insert-pos-progress-bar {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.insert-pos-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.92), rgba(16, 185, 129, 0.88));
    transition: width 0.25s ease;
}

.insert-pos-progress-text {
    font-size: 0.78rem;
    color: #bbf7d0;
    font-family: 'Roboto Mono', monospace;
}

.insert-pos-loading-spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(212, 175, 55, 0.22);
    border-top-color: rgba(212, 175, 55, 0.9);
    animation: insertPosSpin 0.9s linear infinite;
    flex-shrink: 0;
}

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

.insert-pos-list {
    overflow-y: auto;
    padding: 0 12px 12px;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.35) rgba(15, 20, 25, 0.4);
}

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

.insert-pos-list::-webkit-scrollbar-track {
    background: rgba(15, 20, 25, 0.4);
    border-radius: 3px;
}

.insert-pos-list::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.35);
    border-radius: 3px;
}

.insert-pos-list::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.6);
}

.insert-pos-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid rgba(75, 85, 99, 0.2);
    background: rgba(20, 25, 32, 0.5);
    transition: all 0.15s ease;
}

.insert-pos-item:hover {
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.insert-pos-first {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.06);
    margin: 0 12px 8px;
}

.insert-pos-first:hover {
    border-color: rgba(34, 197, 94, 0.6);
    background: rgba(34, 197, 94, 0.12);
}

.insert-pos-item-icon {
    font-size: 1.1rem;
    color: #22c55e;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.insert-pos-item-num {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    color: #6b7280;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.insert-pos-item-badge {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 4px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(75, 85, 99, 0.3);
    color: #9ca3af;
    border: 1px solid rgba(75, 85, 99, 0.3);
}

.insert-pos-item-badge.ipb-summary {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.3);
}

.insert-pos-item-badge.ipb-ai-analysis,
.insert-pos-item-badge.ipb-ai-dialog {
    color: #d4af37;
    background: rgba(212, 175, 55, 0.12);
    border-color: rgba(212, 175, 55, 0.3);
}

.insert-pos-item-badge.ipb-comparison,
.insert-pos-item-badge.ipb-companies {
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.3);
}

.insert-pos-item-badge.ipb-section,
.insert-pos-item-badge.ipb-report_title {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.3);
}

.insert-pos-item-badge.ipb-profile {
    color: #f97316;
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.3);
}

.insert-pos-item-badge.ipb-params {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.3);
}

.insert-pos-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    color: #e5e7eb;
}

.insert-pos-item-sub {
    margin-left: 6px;
    font-size: 0.75rem;
    color: #6b7280;
}

.insert-pos-first .insert-pos-item-text {
    color: #22c55e;
    font-weight: 500;
}

.insert-pos-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: rgba(15, 20, 28, 0.5);
    border-bottom: 1px solid rgba(75, 85, 99, 0.25);
}

.insert-pos-label {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.82rem;
    font-weight: 500;
    color: #d4af37;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.insert-pos-select {
    flex: 1;
    min-width: 0;
    padding: 10px 36px 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(75, 85, 99, 0.5);
    background-color: rgba(20, 25, 32, 0.9);
    color: #e5e7eb;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.insert-pos-select:hover {
    border-color: rgba(212, 175, 55, 0.4);
    background-color: rgba(28, 34, 44, 0.95);
}

.insert-pos-select:focus {
    border-color: rgba(212, 175, 55, 0.6);
    outline: none;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.insert-pos-select option {
    background: #1a1f2e;
    color: #e5e7eb;
    padding: 8px;
}

.insert-pos-name-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10030;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.insert-pos-name-dialog {
    width: min(540px, calc(100vw - 28px));
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.32);
    background: linear-gradient(135deg, #1a1f2e 0%, #0f1419 100%);
    box-shadow: 0 18px 56px rgba(0, 0, 0, 0.6), 0 0 24px rgba(212, 175, 55, 0.08);
    padding: 18px 18px 14px;
    display: grid;
    gap: 12px;
}

.insert-pos-name-title {
    color: #d4af37;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.insert-pos-name-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(20, 25, 32, 0.68);
    color: #e5e7eb;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.insert-pos-name-input:focus {
    border-color: rgba(212, 175, 55, 0.65);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.16);
}

.insert-pos-name-input::placeholder {
    color: #6b7280;
}

.insert-pos-name-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.ai-research-widget-prep-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.68);
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.ai-research-widget-prep-dialog {
    width: 560px;
    max-width: 92vw;
    min-height: 320px;
    background: linear-gradient(135deg, #1b2231 0%, #101620 100%);
    border: 1px solid rgba(212, 175, 55, 0.28);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62), 0 0 24px rgba(212, 175, 55, 0.12);
}

.ai-research-widget-prep-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(75, 85, 99, 0.35);
}

.ai-research-widget-prep-title {
    color: #d4af37;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.92rem;
    letter-spacing: 0.03em;
    font-weight: 600;
}

.ai-research-widget-prep-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.ai-research-widget-prep-close:hover {
    color: #ef4444;
}

.ai-research-widget-prep-body {
    padding: 16px 18px 8px;
}

.ai-research-widget-prep-status {
    color: #cbd5e1;
    font-size: 0.86rem;
    margin-bottom: 10px;
    min-height: 20px;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-research-widget-prep-progress-wrap {
    display: grid;
    gap: 8px;
}

.ai-research-widget-prep-progress-bar {
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.ai-research-widget-prep-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.95), rgba(6, 182, 212, 0.72));
    transition: width 0.2s ease;
}

.ai-research-widget-prep-progress-meta {
    font-size: 0.78rem;
    color: #94a3b8;
    font-family: 'Roboto Mono', monospace;
}

.ai-research-widget-prep-stats {
    margin-top: 14px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 10px;
    background: rgba(15, 23, 34, 0.62);
    padding: 12px;
    min-height: 120px;
}

.ai-research-widget-prep-stats.is-placeholder {
    border-style: dashed;
    border-color: rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 34, 0.42);
}

.ai-research-widget-prep-stats-title {
    color: #d4af37;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.ai-research-widget-prep-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.ai-research-widget-prep-stats-placeholder {
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.5;
    padding-top: 8px;
}

.ai-research-widget-prep-stat {
    border: 1px solid rgba(75, 85, 99, 0.35);
    border-radius: 8px;
    background: rgba(17, 24, 39, 0.66);
    padding: 7px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ai-research-widget-prep-stat span {
    color: #9ca3af;
    font-size: 0.72rem;
}

.ai-research-widget-prep-stat strong {
    color: #e5e7eb;
    font-size: 0.84rem;
    font-family: 'Roboto Mono', monospace;
}

.ai-research-widget-prep-error {
    color: #fca5a5;
    font-size: 0.8rem;
    line-height: 1.45;
}

.ai-research-widget-prep-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px 16px;
}

.ai-research-widget-prep-btn {
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(30, 41, 59, 0.55);
    color: #d1d5db;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 12px;
}

.ai-research-widget-prep-btn:hover {
    border-color: rgba(212, 175, 55, 0.38);
}

.ai-research-widget-prep-btn.primary {
    border-color: rgba(34, 197, 94, 0.55);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.18));
    color: #dcfce7;
}

.ai-research-widget-prep-btn.primary:hover {
    border-color: rgba(34, 197, 94, 0.9);
}

.ai-research-plan-approval-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 10021;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.ai-research-plan-approval-dialog {
    width: 760px;
    max-width: 94vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(135deg, #1b2231 0%, #101620 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62), 0 0 24px rgba(212, 175, 55, 0.12);
}

.ai-research-plan-approval-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.45) rgba(15, 23, 34, 0.5);
}

.ai-research-plan-approval-body::-webkit-scrollbar {
    width: 10px;
}

.ai-research-plan-approval-body::-webkit-scrollbar-track {
    background: rgba(15, 23, 34, 0.45);
    border-radius: 999px;
}

.ai-research-plan-approval-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.7), rgba(212, 175, 55, 0.35));
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 34, 0.45);
}

.ai-research-plan-approval-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.9), rgba(212, 175, 55, 0.55));
}

.ai-research-plan-approval-header {
    padding: 16px 18px;
    border-bottom: 1px solid rgba(75, 85, 99, 0.35);
}

.ai-research-plan-approval-title {
    margin: 0;
    color: #d4af37;
    font-size: 1rem;
    font-weight: 700;
}

.ai-research-plan-approval-subtitle {
    margin: 6px 0 0 0;
    color: #94a3b8;
    font-size: 0.82rem;
}

.ai-research-plan-approval-body {
    padding: 14px 18px 8px;
    display: grid;
    gap: 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.ai-research-plan-approval-summary {
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.24);
    background: rgba(15, 23, 34, 0.62);
    padding: 10px 12px;
    color: #cbd5e1;
    font-size: 0.84rem;
}

.ai-research-plan-approval-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.ai-research-plan-approval-stat-card {
    border: 1px solid rgba(75, 85, 99, 0.35);
    border-radius: 10px;
    background: rgba(17, 24, 39, 0.62);
    padding: 9px 10px;
    min-height: 64px;
}

.ai-research-plan-approval-stat-card-wide {
    grid-column: span 2;
}

.ai-research-plan-approval-stat-label {
    color: #94a3b8;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-research-plan-approval-stat-value {
    margin-top: 6px;
    color: #e5e7eb;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    line-height: 1.2;
}

.ai-research-plan-approval-stat-value-text {
    font-size: 0.86rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.ai-research-plan-approval-details {
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    background: rgba(15, 23, 34, 0.5);
    overflow: hidden;
}

.ai-research-plan-approval-details > summary {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #cbd5e1;
    list-style: none;
}

.ai-research-plan-approval-details > summary::-webkit-details-marker {
    display: none;
}

.ai-research-plan-approval-details > summary::before {
    content: '▶';
    margin-right: 8px;
    font-size: 0.68rem;
    color: #d4af37;
    display: inline-block;
    transition: transform 0.2s ease;
}

.ai-research-plan-approval-details[open] > summary::before {
    transform: rotate(90deg);
}

.ai-research-plan-approval-steps,
.ai-research-plan-approval-params {
    padding: 0 12px 12px;
}

.ai-research-plan-approval-steps {
    max-height: min(46vh, 520px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.45) rgba(15, 23, 34, 0.5);
}

.ai-research-plan-approval-steps::-webkit-scrollbar {
    width: 10px;
}

.ai-research-plan-approval-steps::-webkit-scrollbar-track {
    background: rgba(15, 23, 34, 0.45);
    border-radius: 999px;
}

.ai-research-plan-approval-steps::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.7), rgba(212, 175, 55, 0.35));
    border-radius: 999px;
    border: 2px solid rgba(15, 23, 34, 0.45);
}

.ai-research-plan-approval-steps::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.9), rgba(212, 175, 55, 0.55));
}

.ai-research-plan-approval-step {
    border-radius: 8px;
    border: 1px solid rgba(75, 85, 99, 0.35);
    background: rgba(15, 23, 34, 0.64);
    margin-bottom: 8px;
    overflow: hidden;
}

.ai-research-plan-approval-step:last-child {
    margin-bottom: 0;
}

.ai-research-plan-approval-step > summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ai-research-plan-approval-step > summary::-webkit-details-marker {
    display: none;
}

.ai-research-plan-approval-step > summary::before {
    content: '▶';
    margin-right: 8px;
    font-size: 0.68rem;
    color: #d4af37;
    display: inline-block;
    transition: transform 0.2s ease;
}

.ai-research-plan-approval-step[open] > summary::before {
    transform: rotate(90deg);
}

.ai-research-plan-approval-step-title {
    color: #e5e7eb;
    font-size: 0.84rem;
    font-weight: 600;
    flex: 1;
}

.ai-research-plan-approval-step-meta {
    color: #94a3b8;
    font-size: 0.76rem;
    white-space: nowrap;
}

.ai-research-plan-approval-step-body {
    padding: 0 10px 10px;
}

.ai-research-plan-approval-step-prompt {
    margin-top: 6px;
    color: #cbd5e1;
    font-size: 0.8rem;
    line-height: 1.35;
}

.ai-research-plan-approval-step-params {
    margin-top: 8px;
    border-top: 1px dashed rgba(75, 85, 99, 0.35);
    padding-top: 8px;
}

.ai-research-plan-approval-step-params-list {
    margin: 6px 0 0 0;
    padding: 0 0 0 1.1rem;
    color: #cbd5e1;
    font-size: 0.78rem;
    line-height: 1.35;
}

.ai-research-plan-approval-step-params-list li {
    margin-bottom: 4px;
}

.ai-research-plan-approval-step-params-list li:last-child {
    margin-bottom: 0;
}

.ai-research-plan-approval-step-params-empty {
    margin: 6px 0 0 0;
    color: #94a3b8;
    font-size: 0.76rem;
}

.ai-research-plan-approval-param {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed rgba(75, 85, 99, 0.32);
}

.ai-research-plan-approval-param:last-child {
    border-bottom: none;
}

.ai-research-plan-approval-param-name {
    color: #a78bfa;
    font-size: 0.8rem;
}

.ai-research-plan-approval-param-meta {
    color: #94a3b8;
    font-size: 0.74rem;
    white-space: nowrap;
}

.ai-research-plan-approval-revision {
    display: grid;
    gap: 6px;
}

.ai-research-plan-approval-revision label {
    color: #cbd5e1;
    font-size: 0.82rem;
    font-weight: 600;
}

.ai-research-plan-approval-footer {
    padding: 12px 18px 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    border-top: 1px solid rgba(75, 85, 99, 0.35);
    background: rgba(16, 22, 32, 0.96);
}

#ai-research-plan-revise-btn {
    border-color: rgba(212, 175, 55, 0.65);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(245, 158, 11, 0.2));
    color: #fde68a;
}

#ai-research-plan-revise-btn:hover {
    border-color: rgba(212, 175, 55, 0.95);
}

#ai-research-plan-reject-btn {
    border-color: rgba(239, 68, 68, 0.65);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(185, 28, 28, 0.2));
    color: #fecaca;
}

#ai-research-plan-reject-btn:hover {
    border-color: rgba(239, 68, 68, 0.95);
}

.ai-research-plan-approval-step details.ai-research-collapsible:not(.ai-research-plan-approval-step-params) > summary {
    color: #38bdf8;
}

.ai-research-plan-approval-step details.ai-research-collapsible.ai-research-plan-approval-step-params > summary {
    color: #a78bfa;
}


/* LLM security modal */
.llm-security-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 10001;
    justify-content: center;
    align-items: center;
}
.llm-security-modal-overlay.active {
    display: flex;
}
.llm-security-modal {
    background: linear-gradient(145deg, #1a2332 0%, #121820 100%);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 14px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 40px rgba(245, 158, 11, 0.12);
    animation: errorModalSlideIn 0.3s ease;
}
.llm-security-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
}
.llm-security-modal-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 50%;
    color: #f59e0b;
}
.llm-security-modal-title {
    flex: 1;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #fbbf24;
}
.llm-security-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
}
.llm-security-modal-close:hover {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
}
.llm-security-modal-body {
    padding: 20px 22px 8px;
}
.llm-security-modal-lead {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: #94a3b8;
}
.llm-security-modal-message {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #e2e8f0;
    line-height: 1.55;
    white-space: pre-wrap;
}
.llm-security-modal-footer {
    padding: 16px 22px 20px;
    display: flex;
    justify-content: flex-end;
}
.llm-security-modal-btn {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0f172a;
    font-weight: 600;
    cursor: pointer;
}
.llm-security-modal-btn:hover {
    filter: brightness(1.06);
}
