/* ============================================================
   COMPLETE CSS
   ============================================================ */

:root {
    --primary: #1a5d7a;
    --primary-light: #2c7da0;
    --primary-dark: #0e3e52;
    --secondary: #7ab3c8;
    --accent: #e07a5f;
    --accent-light: #f4a261;

    --gray-50: #f5f7fa;
    --gray-100: #e2e8f0;
    --gray-200: #cbd5e1;
    --gray-300: #94a3b8;
    --gray-600: #475569;
    --gray-800: #1e293b;

    --white: #ffffff;
    --blue-light: #e0f2fe;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);

    --shadow-card:
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(0, 0, 0, 0.02);

    --shadow-hover:
        0 12px 32px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(44, 125, 160, 0.15);

    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
}


/* ============================================================
   GLOBAL RESET
   ============================================================ */

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

html {
    scroll-behavior: smooth;
}


/* ============================================================
   BODY
   ============================================================ */

body {
    font-family:
        'Inter',
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        'Helvetica Neue',
        sans-serif;

    background: linear-gradient(
        135deg,
        #f5f7fa 0%,
        #eef2f6 100%
    );

    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}


/* ============================================================
   CONTAINER
   ============================================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
}


/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--white);

    /* Highlight for follow_up column as a divider in all_data view */
    .highlight-followup-divider {
        padding-right: 30px !important;
        border-right: 1px solid #e2e8f0 !important;
    }
    
    .highlight-followup-divider th {
        padding-right: 30px !important;
        border-right: 2px solid #cbd5e1 !important;
    }
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 28px;

    box-shadow: var(--shadow-card);

    transition: all 0.25s ease;

    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.card::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 4px;

    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--secondary),
            var(--accent-light)
        );
}

.card-title {
    font-size: 1.1rem;
    font-weight: 800;

    margin-bottom: 24px;
    padding-bottom: 12px;

    border-bottom: 2px solid var(--primary-light);

    display: flex;
    align-items: center;
    gap: 12px;

    flex-wrap: wrap;

    color: var(--gray-800);
}

.step-badge {
    background:
        linear-gradient(
            135deg,
            var(--primary) 0%,
            var(--primary-dark) 100%
        );

    color: white;

    width: 32px;
    height: 32px;

    border-radius: var(--radius-xs);

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 0.85rem;
    font-weight: 800;

    box-shadow: var(--shadow-md);
}


/* ============================================================
   BUTTONS
   ============================================================ */

.btn-primary {
    background:
        linear-gradient(
            135deg,
            var(--primary) 0%,
            var(--primary-dark) 100%
        );

    color: white;
    border: none;

    padding: 12px 32px;

    border-radius: 999px;

    font-size: 0.95rem;
    font-weight: 700;

    cursor: pointer;

    transition:
        all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    background: var(--gray-200);
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;

    color: var(--primary);

    border: 2px solid var(--primary-light);

    padding: 10px 24px;

    border-radius: 999px;

    font-size: 0.9rem;
    font-weight: 700;

    cursor: pointer;

    transition: all 0.2s ease;
}

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

    transform: translateY(-2px);
}

.btn-outline-small {
    background: transparent;

    color: var(--primary);

    border: 2px solid var(--primary-light);

    padding: 6px 16px;

    border-radius: 999px;

    font-size: 0.75rem;
    font-weight: 700;

    cursor: pointer;
}

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


/* ============================================================
   IMAGE PLACEHOLDER
   ============================================================ */

.image-placeholder {
    text-align: center;

    padding: 2rem;

    margin-bottom: 1.5rem;

    background: var(--gray-50);

    border-radius: var(--radius-md);

    border: 1px dashed var(--gray-200);
}

.image-placeholder svg {
    width: 64px;
    height: 64px;

    opacity: 0.6;

    margin-bottom: 0.5rem;
}

.image-placeholder span {
    color: var(--gray-600);

    font-size: 0.875rem;

    font-weight: 500;
}

.image-placeholder small {
    color: var(--gray-300);

    font-size: 0.75rem;
}


/* ============================================================
   NDD GRID
   ============================================================ */

.ndd-grid {
    display: flex;

    flex-wrap: wrap;

    gap: 0.625rem;
}

.ndd-item {
    display: inline-flex;

    align-items: center;

    gap: 0.5rem;

    padding: 0.5rem 1rem;

    background: var(--gray-50);

    border: 1.5px solid var(--gray-200);

    border-radius: 40px;

    cursor: pointer;

    transition: all 0.2s ease;

    width: auto;
}

.ndd-item:hover {
    background: var(--gray-100);

    border-color: var(--primary-light);

    transform: translateY(-2px);
}

.ndd-item.selected {
    background: var(--primary);

    border-color: var(--primary);
}

.ndd-item.selected label {
    color: white;
}

.ndd-item.selected .ndd-code {
    color: rgba(255, 255, 255, 0.8);
}

.ndd-item.selected .ndd-count {
    background: rgba(255, 255, 255, 0.2);

    color: white;
}

.ndd-item input {
    width: 16px;
    height: 16px;

    cursor: pointer;

    accent-color: var(--primary);
}

.ndd-item label {
    font-size: 0.8125rem;

    font-weight: 500;

    color: var(--gray-800);

    cursor: pointer;

    margin: 0;
}

.ndd-code {
    font-size: 0.6875rem;

    color: var(--gray-500);

    font-family: monospace;
}

.ndd-count {
    font-size: 0.6875rem;

    color: var(--gray-600);

    background: var(--gray-100);

    padding: 0.125rem 0.5rem;

    border-radius: 20px;
}


/* ============================================================
   TARGET AREA NDD GRID
   ============================================================ */

#targetAreaNddGrid {
    display: flex;

    flex-wrap: wrap;

    gap: 0.625rem;
}

#targetAreaNddGrid .ndd-item {
    display: inline-flex;

    align-items: center;

    gap: 0.5rem;

    padding: 0.5rem 1rem;

    background: var(--gray-50);

    border: 1.5px solid var(--gray-200);

    border-radius: 40px;

    cursor: pointer;

    transition: all 0.2s ease;

    width: auto;
}

#targetAreaNddGrid .ndd-item:hover {
    background: var(--gray-100);

    border-color: var(--primary-light);

    transform: translateY(-2px);
}

#targetAreaNddGrid .ndd-item.selected {
    background: var(--primary);

    border-color: var(--primary);
}

#targetAreaNddGrid .ndd-item.selected label {
    color: white;
}

#targetAreaNddGrid .ndd-item.selected .ndd-code {
    color: rgba(255, 255, 255, 0.8);
}

#targetAreaNddGrid .ndd-item.selected .ndd-count {
    background: rgba(255, 255, 255, 0.2);

    color: white;
}

#targetAreaNddGrid .ndd-item label {
    font-size: 0.8125rem;

    font-weight: 500;

    color: var(--gray-800);

    cursor: pointer;

    margin: 0;
}

#targetAreaNddGrid .ndd-code {
    font-size: 0.6875rem;

    color: var(--gray-500);

    font-family: monospace;
}

#targetAreaNddGrid .ndd-count {
    font-size: 0.6875rem;

    color: var(--gray-600);

    background: var(--gray-100);

    padding: 0.125rem 0.5rem;

    border-radius: 20px;
}


/* ============================================================
   NDD INFO SECTION
   ============================================================ */

#nddInfoSection {
    overflow: visible;
}

.ndd-total {
    margin-bottom: 1rem;

    padding-bottom: 0.5rem;

    font-size: 0.875rem;

    font-weight: 500;

    color: var(--primary);

    border-bottom: 1px dashed var(--gray-200);
}

.ndd-info-content {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(280px, 1fr)
        );

    gap: 1rem;

    max-height: none;

    overflow-y: visible;
}

.ndd-info-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1rem 1.15rem;
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    height: auto;
    min-height: 100px;
    position: relative;
}

.ndd-info-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    border-left-color: var(--primary);
    transform: translateY(-2px);
    z-index: 5;
}

.ndd-card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 0.5rem;
}

.ndd-info-card h4,
.ndd-card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
    white-space: normal;
    word-wrap: break-word;
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.ndd-short-name {
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.8125rem;
}

.icd-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.775rem;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.ndd-info-card:hover .icd-badge {
    background: var(--blue-light);
    border-color: rgba(2, 132, 199, 0.25);
}

.icd-label {
    color: var(--gray-500);
    font-weight: 600;
}

.icd-code-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: all 0.15s ease;
}

.icd-code-link:hover {
    color: var(--primary-dark, #0369a1);
    background: rgba(2, 132, 199, 0.12);
    border-radius: 3px;
    padding: 0 2px;
}

.ndd-info-card p,
.ndd-card-desc {
    font-size: 0.8125rem;
    color: var(--gray-600);
    line-height: 1.55;
    margin: 0;
    display: block;
    overflow: visible;
    word-break: break-word;
    white-space: normal;
}

.ndd-info-card:hover p,
.ndd-info-card:hover .ndd-card-desc {
    color: var(--gray-800);
}

.ndd-info-card .study-count {
    font-size: 0.6875rem;

    color: var(--primary);

    font-weight: 500;

    margin-top: 0.5rem;

    padding-top: 0.5rem;

    border-top:
        1px solid
        rgba(26, 93, 122, 0.2);
}


/* ============================================================
   CHARTS
   ============================================================ */

.graphs-grid {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 1.5rem;
}

.graph-card {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: all 0.2s;
    border: 1px solid var(--gray-100);
    display: flex;
    flex-direction: column;
}

.graph-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.graph-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.85rem;
    gap: 0.5rem;
    flex-shrink: 0;
}

.graph-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.graph-subtitle {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Hide "Click bars to filter" badge */
.graph-badge {
    display: none !important;
}

.graph-container {
    position: relative;
    height: 350px;
    min-height: 330px;
    flex: 1;
}

.graph-note {
    font-size: 0.6875rem;

    color: var(--gray-300);

    text-align: center;

    padding-top: 0.75rem;

    border-top: 1px solid var(--gray-100);
}


/* ============================================================
   FILTERS BAR
   ============================================================ */

.filters-bar {
    background: white;

    border: 1px solid var(--gray-200);

    border-radius: var(--radius-lg);

    padding: 1rem 1.5rem;

    margin-bottom: 2rem;

    box-shadow: var(--shadow-card);
}

.filters-header {
    display: flex;

    align-items: center;

    gap: 0.75rem;

    margin-bottom: 0.75rem;

    padding-bottom: 0.5rem;

    border-bottom: 1px solid var(--gray-100);
}

.filters-label {
    font-weight: 700;

    font-size: 0.8125rem;

    color: var(--gray-800);

    text-transform: uppercase;

    letter-spacing: 0.5px;
}

.filters-list {
    display: flex;

    flex-wrap: wrap;

    gap: 0.5rem;
}

.search-tag {
    background:
        linear-gradient(
            135deg,
            var(--blue-light) 0%,
            rgba(224, 242, 254, 0.6) 100%
        );

    padding: 0.25rem 0.75rem;

    border-radius: 20px;

    font-size: 0.6875rem;

    color: var(--primary-dark);

    border:
        1px solid
        rgba(44, 125, 160, 0.2);
}

.tag-remove {
    cursor: pointer;

    font-weight: bold;

    margin-left: 0.25rem;
}

.filter-placeholder {
    font-size: 0.75rem;

    color: var(--gray-300);

    font-style: italic;
}


/* ============================================================
   PAGE HEADER
   ============================================================ */

.page-header {
    text-align: center;

    margin-bottom: 42px;
}

.page-header h1 {
    font-size: 2.5rem;

    font-weight: 800;

    margin-bottom: 12px;

    background:
        linear-gradient(
            135deg,
            var(--gray-800) 0%,
            var(--primary) 100%
        );

    -webkit-background-clip: text;

    background-clip: text;

    color: transparent;
}

.page-header .subtitle {
    font-size: 1rem;

    color: var(--gray-600);
}


/* ============================================================
   ACTION FOOTER
   ============================================================ */

.action-footer {
    text-align: center;

    padding: 1rem 0;
}

.action-hint {
    font-size: 0.6875rem;

    color: var(--gray-300);

    margin-top: 0.75rem;
}


/* ============================================================
   ADVANCED PAGE
   ============================================================ */

.advanced-header {
    text-align: center;

    margin-bottom: 1.5rem;
}

.advanced-header h1 {
    font-size: 2rem;

    font-weight: 700;

    color: #1a5d7a;

    margin-bottom: 0.5rem;
}

.advanced-header .subtitle {
    color: #718096;

    font-size: 0.9375rem;
}

.back-to-basic {
    margin-bottom: 1.5rem;
}

.back-button {
    display: inline-flex;

    align-items: center;

    gap: 0.5rem;

    padding: 0.5rem 1rem;

    background: #f7fafc;

    border: 1px solid #e2e8f0;

    border-radius: 8px;

    color: #4a5568;

    text-decoration: none;

    font-size: 0.8125rem;

    font-weight: 500;

    transition: all 0.2s;
}

.back-button:hover {
    background: #edf2f7;

    border-color: #cbd5e0;

    color: #1a5d7a;
}

.search-summary-card {
    background: #f7fafc;

    border-radius: 12px;

    padding: 1rem;
}

.search-summary-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 0.75rem;

    padding-bottom: 0.5rem;

    border-bottom: 1px solid #e2e8f0;
}

.results-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 1rem;

    padding-bottom: 0.75rem;

    border-bottom: 1px solid #e2e8f0;
}

.table-wrapper {
    overflow-x: auto;

    border-radius: 12px;

    border: 1px solid #e2e8f0;

    background: white;
}

.results-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 0.75rem;
}

.results-table th {
    background: #f7fafc;

    padding: 0.75rem;

    text-align: left;

    font-weight: 600;

    border-bottom: 1px solid #e2e8f0;
}

.results-table td {
    padding: 0.75rem;

    border-bottom: 1px solid #edf2f7;

    color: #2d3748;
}

.results-table a {
    color: #1a5d7a;

    text-decoration: none;
}

.pagination {
    display: flex;

    justify-content: center;

    gap: 0.5rem;

    margin-top: 1.5rem;
}

.pagination a {
    padding: 0.375rem 0.75rem;

    background: white;

    border: 1px solid #e2e8f0;

    border-radius: 6px;

    text-decoration: none;

    color: #4a5568;

    cursor: pointer;
}

.pagination a.current {
    background: #1a5d7a;

    color: white;

    border-color: #1a5d7a;
}

.pagination a.disabled {
    opacity: 0.5;

    cursor: not-allowed;
}

.no-results {
    text-align: center;

    padding: 3rem;

    color: #718096;
}

.advanced-grid {
    display: flex;

    flex-wrap: nowrap;

    gap: 20px;

    margin: 24px 0;
}

.advanced-item {
    flex: 1;

    min-width: 0;
}

.advanced-item label {
    display: block;

    font-size: 0.75rem;

    font-weight: 800;

    text-transform: uppercase;

    color: var(--gray-600);

    margin-bottom: 8px;

    letter-spacing: 0.5px;
}

.advanced-item select {
    width: 100%;

    padding: 10px 14px;

    border: 2px solid var(--gray-200);

    border-radius: var(--radius-sm);

    font-size: 0.9rem;

    font-weight: 500;

    background: var(--white);

    transition: all 0.2s ease;
}

.section-selector {
    display: flex;

    justify-content: center;

    gap: 16px;

    flex-wrap: wrap;

    margin: 0 0 32px 0;
}

.section-btn,
.view-btn {
    padding: 10px 24px;

    border: 2px solid var(--gray-200);

    background: var(--white);

    border-radius: 999px;

    cursor: pointer;

    font-size: 0.9rem;

    font-weight: 700;

    color: var(--gray-600);

    transition: all 0.2s ease;
}

.section-btn:hover,
.view-btn:hover {
    border-color: var(--primary-light);

    color: var(--primary);

    transform: translateY(-2px);
}

.section-btn.active,
.view-btn.active {
    background:
        linear-gradient(
            135deg,
            var(--primary) 0%,
            var(--primary-dark) 100%
        );

    border-color: var(--primary);

    color: var(--white);
}

.filter-dropdown {
    width: 100%;

    padding: 10px 14px;

    border: 2px solid var(--gray-200);

    border-radius: var(--radius-sm);

    font-size: 0.9rem;

    font-weight: 500;

    background: var(--white);

    cursor: pointer;
}

.filter-label {
    font-weight: 700;

    font-size: 0.75rem;

    text-transform: uppercase;

    letter-spacing: 0.5px;

    color: var(--gray-600);

    margin-bottom: 8px;
}


/* ============================================================
   ============================================================
   NIBS SECTION
   50 / 50 SPLIT + TRUE DROPDOWN INFO PANEL
   ============================================================
   ============================================================ */


/* ------------------------------------------------------------
   MAIN NIBS LAYOUT (2 Columns: Image Placeholder | Options)
   ------------------------------------------------------------ */

.nibs-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    width: 100%;
    margin-top: 12px;
    align-items: stretch;
    position: relative;
}


/* ------------------------------------------------------------
   LEFT SIDE (Image Placeholder - Original Size)
   ------------------------------------------------------------ */

.nibs-left {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-width: 0;
}

.nibs-image-placeholder {
    width: 100%;
    flex: 1 1 auto;
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.nibs-image-placeholder:hover {
    border-color: var(--primary-light);
    background: var(--blue-light);
}

.nibs-image-placeholder svg {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.nibs-image-placeholder span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-600);
}

.nibs-image-placeholder small {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 3px;
}


/* ------------------------------------------------------------
   RIGHT SIDE (Options List - Original Size)
   ------------------------------------------------------------ */

.nibs-right {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    align-self: stretch;
    position: relative;
}

.nibs-options-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    height: 100%;
    justify-content: space-between;
}

.nibs-option {
    width: 100%;
    min-width: 0;
    flex: 1 1 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-sizing: border-box;
    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.nibs-option:hover {
    border-color: var(--primary-light);
    background: var(--blue-light);
    transform: translateX(3px);
}

.nibs-option.selected {
    background: var(--blue-light);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
    transform: translateX(3px);
}

.nibs-option.selected .nibs-option-title {
    color: var(--primary);
    font-weight: 800;
}

.nibs-option.selected .nibs-option-desc {
    color: var(--gray-700);
}

.nibs-option-radio {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-radio {
    width: 17px;
    height: 17px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nibs-option.selected .custom-radio {
    border-color: var(--primary);
    background: rgba(26, 93, 122, 0.15);
}

.nibs-option.selected .custom-radio::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.nibs-option-content {
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}

.nibs-option-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gray-800);
    margin-bottom: 2px;
    line-height: 1.25;
}

.nibs-option-desc {
    font-size: 0.68rem;
    color: var(--gray-600);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ------------------------------------------------------------
   HOVERING CARD (Appears on top of the options with arrow)
   ------------------------------------------------------------ */

.nibs-hovering-card {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 62%;
    min-width: 250px;
    max-width: 360px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-md);
    border: 1px solid rgba(44, 125, 160, 0.22);
    border-left: 3.5px solid var(--primary);
    box-shadow: -6px 8px 24px rgba(15, 59, 79, 0.16);
    padding: 14px 16px;
    box-sizing: border-box;
    z-index: 25;
    display: flex;
    flex-direction: column;
    overflow: visible;
    animation: nibsPopIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.nibs-hover-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Prominent Connecting Arrow pointing towards the selected option */
.nibs-hover-arrow {
    position: absolute;
    left: -14px;
    top: 20px;
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-right: 14px solid var(--primary);
    filter: drop-shadow(-3px 0 3px rgba(0, 0, 0, 0.12));
    transition: top 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 30;
}

.nibs-hover-arrow::after {
    content: "";
    position: absolute;
    left: 3px;
    top: -9px;
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-right: 11px solid #ffffff;
}

/* Close button on the hovering card */
.nibs-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--gray-400);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}

.nibs-close-btn:hover {
    color: var(--gray-700);
    background: rgba(0, 0, 0, 0.06);
}

.nibs-badge-tag {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    background: var(--blue-light);
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    margin-bottom: 5px;
    width: fit-content;
}

.nibs-dynamic-info .nibs-info-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 4px 0;
    line-height: 1.3;
    padding-right: 20px;
}

.nibs-dynamic-info #selectedNibsDesc {
    font-size: 0.75rem;
    color: var(--gray-700);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.nibs-dynamic-info .nibs-info-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-top: auto;
}

.nibs-dynamic-info .nibs-info-details p,
.nibs-dynamic-info .nibs-info-details div {
    font-size: 0.7rem;
    color: var(--gray-800);
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(44, 125, 160, 0.1);
    border-radius: var(--radius-xs);
    margin: 0;
    line-height: 1.35;
}


/* ------------------------------------------------------------
   POPIN ANIMATION
   ------------------------------------------------------------ */

@keyframes nibsPopIn {
    from {
        opacity: 0;
        transform: translateX(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}


/* ============================================================
   NIBS RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
    .nibs-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .nibs-left {
        height: auto;
        min-height: 0;
    }

    .nibs-image-placeholder {
        flex: none;
        height: 140px;
        min-height: 140px;
    }

    .nibs-options-list {
        height: auto;
        gap: 8px;
    }

    .nibs-option {
        flex: 0 0 auto;
        padding: 9px 12px;
    }

    .nibs-hovering-card {
        width: 75%;
    }
}

@media (max-width: 480px) {
    .nibs-layout {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .nibs-image-placeholder {
        flex: none;
        height: 120px;
        min-height: 120px;
        padding: 1rem;
    }

    .nibs-image-placeholder svg {
        width: 32px;
        height: 32px;
    }

    .nibs-image-placeholder span {
        font-size: 0.75rem;
    }

    .nibs-image-placeholder small {
        font-size: 0.6rem;
    }

    .nibs-option {
        padding: 8px 10px;
        gap: 8px;
    }

    .custom-radio {
        width: 14px;
        height: 14px;
    }

    .custom-radio::after {
        width: 6px !important;
        height: 6px !important;
    }

    .nibs-option-title {
        font-size: 0.78rem;
    }

    .nibs-option-desc {
        font-size: 0.6rem;
    }

    .nibs-hovering-card {
        width: 100%;
        left: 0;
        right: 0;
        top: auto;
        bottom: 0;
        max-height: 80%;
        box-shadow: 0 -6px 20px rgba(0,0,0,0.15);
    }

    .nibs-hover-arrow {
        display: none;
    }
}


/* ============================================================
   FOOTER
   ============================================================ */

footer {
    background: #1e293b;

    color: #94a3b8;

    padding: 2rem;

    text-align: center;

    margin-top: 3rem;
}

footer p {
    margin: 0.5rem 0;
}


/* ============================================================
   ReCaNT STYLE FOOTER
   ============================================================ */

footer.footer {
    background-color: rgba(236, 243, 246, 1);

    color: #334155;

    text-align: left;

    padding: 0;

    margin-top: 3rem;
}

footer.footer a {
    text-decoration: none;
}

footer.footer a:hover {
    text-decoration: underline;
}

footer.footer .footer-text {
    color: #334155;
}

footer.footer .credits {
    color: #475569;

    font-size: 0.8rem;
}

footer.footer h6 {
    color: #1a5d7a;
}


/* ============================================================
   MAIN
   ============================================================ */

main {
    min-height: calc(100vh - 200px);
}


/* ============================================================
   TABLE HEADER
   ============================================================ */

.results-table thead tr {
    background: var(--primary) !important;
}

.results-table th {
    background: var(--primary) !important;

    color: white !important;

    font-weight: 600;

    padding: 12px;

    text-align: left;

    border-bottom:
        2px solid
        var(--primary-dark);
}


/* ============================================================
   INLINE ADVANCED.JS TABLES
   ============================================================ */

.data-table thead tr,
.results-container table thead tr {
    background: var(--primary) !important;
}

.data-table th,
.results-container table th {
    background: var(--primary) !important;

    color: white !important;
}


/* ============================================================
   DATA VIEW TABLE
   ============================================================ */

table.data-view thead tr,
table.data-view thead th {
    background: var(--primary) !important;

    color: white !important;
}


/* ============================================================
   GENERAL INFO ANIMATION
   ============================================================ */

@keyframes fadeIn {

    from {
        opacity: 0;

        transform:
            translateY(-10px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }
}


/* ============================================================
   FULL FORM FINDER
   ============================================================ */

.ff-layout {
    display: flex;

    gap: 12px;

    align-items: stretch;

    flex-wrap: wrap;
}

.ff-input {
    flex: 1;

    min-width: 260px;

    padding: 12px 16px;

    border:
        2px solid
        var(--gray-200);

    border-radius: var(--radius-sm);

    font-size: 0.9rem;

    font-weight: 500;

    color: var(--gray-800);

    background: var(--white);

    transition: all 0.2s ease;

    outline: none;
}

.ff-input:hover {
    border-color: var(--primary-light);
}

.ff-input:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px
        rgba(26, 93, 122, 0.12);
}

.ff-input::placeholder {
    color: var(--gray-300);

    font-weight: 400;
}

.ff-hint {
    font-size: 0.75rem;

    color: var(--gray-600);

    margin-top: 10px;

    line-height: 1.5;
}

.ff-hint code {
    background: var(--gray-100);

    padding: 2px 6px;

    border-radius: 4px;

    font-size: 0.75rem;

    color: var(--primary-dark);
}

#fullFormResults {
    margin-top: 16px;
}


/* ============================================================
   FULL FORM SUMMARY
   ============================================================ */

.ff-summary {
    display: flex;

    gap: 12px;

    flex-wrap: wrap;

    margin-bottom: 12px;
}

.ff-summary-found,
.ff-summary-notfound {
    font-size: 0.75rem;

    font-weight: 700;

    padding: 5px 14px;

    border-radius: 20px;
}

.ff-summary-found {
    background: #dcfce7;

    color: #166534;

    border: 1px solid #86efac;
}

.ff-summary-notfound {
    background: #fee2e2;

    color: #991b1b;

    border: 1px solid #fca5a5;
}


/* ============================================================
   FULL FORM RESULTS TABLE
   ============================================================ */

.ff-table {
    width: 100%;

    border-collapse: collapse;

    font-size: 0.875rem;

    background: var(--white);

    border:
        1px solid
        var(--gray-200);

    border-radius: var(--radius-sm);

    overflow: hidden;
}

.ff-table thead th {
    background: var(--primary);

    color: white;

    font-weight: 600;

    padding: 10px 14px;

    text-align: left;

    font-size: 0.8rem;

    letter-spacing: 0.3px;
}

.ff-table tbody td {
    padding: 10px 14px;

    border-bottom:
        1px solid
        var(--gray-100);

    color: var(--gray-800);

    vertical-align: top;
}

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

.ff-table tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.ff-table tbody tr:hover {
    background: var(--blue-light);
}

.ff-term {
    font-family:
        'JetBrains Mono',
        'Courier New',
        monospace;

    font-weight: 700;

    color: var(--primary-dark);

    white-space: nowrap;
}

.ff-full {
    color: var(--gray-800);

    line-height: 1.5;
}

.ff-notfound .ff-badge {
    display: inline-block;

    background: #fee2e2;

    color: #991b1b;

    font-size: 0.7rem;

    font-weight: 700;

    padding: 3px 10px;

    border-radius: 20px;

    border: 1px solid #fca5a5;
}


/* ============================================================
   FULL FORM LOADING / EMPTY / ERROR
   ============================================================ */

.ff-loading {
    text-align: center;

    padding: 20px;

    color: var(--gray-600);

    font-size: 0.875rem;
}

.ff-empty {
    text-align: center;

    padding: 20px;

    color: var(--gray-500);

    font-size: 0.8125rem;

    font-style: italic;
}

.ff-error {
    background: #fee2e2;

    border: 1px solid #fca5a5;

    color: #991b1b;

    padding: 12px 16px;

    border-radius: var(--radius-sm);

    font-size: 0.85rem;

    font-weight: 600;
}


/* ============================================================
   NIBS PURPOSE RADIO OPTIONS
   ============================================================ */

.nibs-purpose-option {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--white);
}

.nibs-purpose-option:hover {
    border-color: var(--primary-light);
    background: var(--blue-light);
}

.nibs-purpose-option input[type="radio"] {
    display: none;
}

.nibs-purpose-option span {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.9rem;
}

.nibs-purpose-option small {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.nibs-purpose-option input[type="radio"]:checked + span {
    color: var(--primary);
}

.nibs-purpose-option input[type="radio"]:checked {
    border-color: var(--primary);
    background: var(--blue-light);
}


/* ============================================================
   INTERACTIVE BRAIN - NEW SECTION
   ============================================================ */

/* Interactive Brain Container */
.interactive-brain-container {
    display: flex;
    gap: 20px;
    min-height: 600px;
}

.interactive-brain-wrapper {
    width: 100%;
    height: 700px;
    min-height: 580px;
    position: relative;
    overflow: hidden;
}

.brain-iframe {
    width: 100%;
    height: 100%;
    min-height: 580px;
    border: none;
    border-radius: 12px;
    background: var(--card-bg, #ffffff);
    overflow: hidden;
    border: 1px solid var(--gray-200);
    display: block;
}

@media (max-width: 1200px) {
    .interactive-brain-wrapper {
        height: 640px;
        min-height: 540px;
    }
    .brain-iframe {
        min-height: 540px;
    }
}

/* Left Control Panel */
.brain-control-panel {
    flex: 0 0 380px;
    display: flex;
    flex-direction: column;
    background: var(--panel-bg, #f8f9fa);
    border-right: 1px solid var(--border-color, #e2e8f0);
    padding: 20px;
    max-height: 700px;
    overflow: hidden;
}

.brain-control-panel .panel-header {
    flex-shrink: 0;
    margin-bottom: 15px;
}

.brain-control-panel .panel-header .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.brain-control-panel .panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary, #1a202c);
}

.brain-control-panel .panel-header p {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    color: var(--text-secondary, #4a5568);
    line-height: 1.4;
}

.theme-btn {
    background: var(--btn-bg, #e2e8f0);
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.theme-btn:hover {
    background: var(--btn-hover, #cbd5e0);
}

/* Opacity Slider */
.opacity-slider-container {
    margin-top: 8px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary, #4a5568);
    margin-bottom: 4px;
}

.opacity-slider-container input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--slider-bg, #cbd5e0);
    border-radius: 2px;
    outline: none;
}

.opacity-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary, #1a5d7a);
    cursor: pointer;
}

/* Panel Content */
.brain-control-panel .panel-content {
    display: flex;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.brain-control-panel .column-left,
.brain-control-panel .column-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.brain-control-panel .column-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #4a5568);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* BA Search */
.ba-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--input-bg, #ffffff);
    color: var(--text-primary, #1a202c);
    margin-bottom: 8px;
}

.ba-search-input:focus {
    outline: none;
    border-color: var(--primary, #1a5d7a);
    box-shadow: 0 0 0 3px rgba(26, 93, 122, 0.1);
}

/* BA List */
.ba-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.ba-list::-webkit-scrollbar {
    width: 4px;
}

.ba-list::-webkit-scrollbar-track {
    background: var(--scroll-track, #f1f1f1);
    border-radius: 2px;
}

.ba-list::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb, #cbd5e0);
    border-radius: 2px;
}

.ba-item {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.85rem;
}

.ba-item:hover {
    background: var(--hover-bg, #edf2f7);
}

.ba-item input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.ba-item .ba-name {
    flex: 1;
    color: var(--text-primary, #1a202c);
}

.ba-item .ba-count {
    font-size: 0.7rem;
    color: var(--text-muted, #718096);
    background: var(--count-bg, #edf2f7);
    padding: 1px 8px;
    border-radius: 10px;
}

.ba-item.selected {
    background: var(--selected-bg, #e8f0fe);
}

/* Targets List */
.targets-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.targets-list::-webkit-scrollbar {
    width: 4px;
}

.targets-list::-webkit-scrollbar-track {
    background: var(--scroll-track, #f1f1f1);
    border-radius: 2px;
}

.targets-list::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb, #cbd5e0);
    border-radius: 2px;
}

.target-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s;
}

.target-item:hover {
    background: var(--hover-bg, #edf2f7);
}

.target-item .target-name {
    color: var(--text-primary, #1a202c);
}

.target-item .target-count {
    font-size: 0.7rem;
    color: var(--text-muted, #718096);
    background: var(--count-bg, #edf2f7);
    padding: 1px 8px;
    border-radius: 10px;
}

/* Brain Plot Container */
.brain-plot-container {
    flex: 1;
    min-height: 600px;
    background: var(--plot-bg, #1a1a2e);
    position: relative;
}

#brain-plot {
    width: 100%;
    height: 100%;
    min-height: 600px;
}

/* Button Group for BA list */
.brain-control-panel .btn-group {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.brain-control-panel .btn-sm {
    padding: 4px 12px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    background: var(--btn-bg, #ffffff);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary, #1a202c);
}

.brain-control-panel .btn-sm:hover {
    background: var(--primary, #1a5d7a);
    color: #ffffff;
    border-color: var(--primary, #1a5d7a);
}

/* Dark Mode Styles */
.brain-control-panel.dark-mode {
    background: #1a1a2e;
    border-right-color: #2d3748;
}

.brain-control-panel.dark-mode .panel-header h3 {
    color: #e2e8f0;
}

.brain-control-panel.dark-mode .panel-header p {
    color: #a0aec0;
}

.brain-control-panel.dark-mode .column-title {
    color: #a0aec0;
}

.brain-control-panel.dark-mode .ba-search-input {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.brain-control-panel.dark-mode .ba-item {
    color: #e2e8f0;
}

.brain-control-panel.dark-mode .ba-item:hover {
    background: #2d3748;
}

.brain-control-panel.dark-mode .ba-item .ba-count {
    background: #2d3748;
    color: #a0aec0;
}

.brain-control-panel.dark-mode .target-item {
    color: #e2e8f0;
}

.brain-control-panel.dark-mode .target-item:hover {
    background: #2d3748;
}

.brain-control-panel.dark-mode .target-item .target-count {
    background: #2d3748;
    color: #a0aec0;
}

.brain-control-panel.dark-mode .btn-sm {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

.brain-control-panel.dark-mode .btn-sm:hover {
    background: #4a5568;
}

.brain-control-panel.dark-mode .theme-btn {
    background: #2d3748;
    color: #e2e8f0;
}

.brain-control-panel.dark-mode .theme-btn:hover {
    background: #4a5568;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 992px) {
    .interactive-brain-container {
        flex-direction: column;
    }
    
    .brain-control-panel {
        flex: none;
        width: 100%;
        max-height: 400px;
        border-right: none;
        border-bottom: 1px solid var(--border-color, #e2e8f0);
    }
    
    .brain-plot-container {
        min-height: 400px;
        height: 500px;
    }
    
    #brain-plot {
        min-height: 400px;
        height: 500px;
    }
}

@media (max-width: 900px) {

    .graphs-grid {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {

    .container {
        padding: 20px 16px;
    }

    .card {
        padding: 20px;
    }

    .page-header h1 {
        font-size: 1.85rem;
    }

    .advanced-grid {
        flex-direction: column;
    }

    .section-selector {
        gap: 10px;
    }

    .ff-layout {
        flex-direction: column;
    }

    .ff-input {
        min-width: 100%;
    }

    .ff-term {
        white-space: normal;
    }

    .brain-control-panel .panel-content {
        flex-direction: column;
    }
    
    .brain-control-panel {
        max-height: 500px;
    }
}

@media (max-width: 600px) {
    .brain-control-panel {
        max-height: 500px;
    }
    
    .brain-plot-container {
        height: 350px;
    }
    
    #brain-plot {
        height: 350px;
    }
}

@media (max-width: 480px) {
    .brain-control-panel .panel-header h3 {
        font-size: 0.95rem;
    }
    
    .brain-control-panel .panel-header p {
        font-size: 0.75rem;
    }
    
    .brain-control-panel .column-left,
    .brain-control-panel .column-right {
        min-width: 0;
    }
    
    .ba-item {
        font-size: 0.78rem;
        padding: 4px 6px;
    }
    
    .target-item {
        font-size: 0.78rem;
        padding: 3px 6px;
    }
}

/* Card with dropdowns needs overflow visible so floating menus are not clipped */
.card.filters-card,
.filters-card,
.card:has(.multi-select-dropdown) {
    position: relative !important;
    z-index: 20 !important;
    overflow: visible !important;
}

.card.filters-card.has-open-dropdown,
.card.filters-card:has(.open),
.filters-card.has-open-dropdown,
.card:has(.multi-select-dropdown.open) {
    z-index: 50 !important;
}

/* ============================================================
   MULTI-SELECT DROPDOWN COMPONENT
   ============================================================ */
.multi-select-dropdown {
    position: relative;
    width: 100%;
}

.multi-select-dropdown.open {
    z-index: 60;
}

.multi-select-trigger {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    background: var(--white);
    color: var(--gray-800);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    user-select: none;
    outline: none;
    box-sizing: border-box;
}

.multi-select-trigger:hover {
    border-color: var(--primary-light);
}

.multi-select-dropdown.open .multi-select-trigger,
.multi-select-trigger:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.multi-select-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
    flex: 1;
}

.multi-select-label.has-selection {
    color: var(--primary);
    font-weight: 600;
}

.multi-select-arrow {
    font-size: 0.75rem;
    color: var(--gray-500);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.multi-select-dropdown.open .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    min-width: 280px;
    background: #ffffff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    z-index: 100;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInDropdown 0.15s ease-out;
}

.multi-select-dropdown.open .multi-select-menu {
    display: flex;
}

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

.multi-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--gray-50, #f8fafc);
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.78rem;
}

.multi-select-count {
    font-weight: 600;
    color: var(--gray-600);
}

.multi-select-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-text-small {
    background: none;
    border: none;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.btn-text-small:hover {
    background: rgba(30, 58, 138, 0.08);
    text-decoration: underline;
}

.action-divider {
    color: var(--gray-300);
    font-size: 0.75rem;
}

.multi-select-search-box {
    padding: 6px 8px;
    border-bottom: 1px solid var(--gray-100, #f1f5f9);
    background: #ffffff;
}

.multi-select-search {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.8rem;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.multi-select-search:focus {
    border-color: var(--primary);
}

.multi-select-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 4px 0;
}

.multi-select-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: none;
    gap: 8px;
    font-size: 0.83rem;
    color: var(--gray-800);
}

.multi-select-item:hover {
    background-color: var(--gray-50, #f1f5f9);
}

.multi-select-item.selected {
    background-color: #f0fdf4;
    font-weight: 600;
}

.multi-select-item input[type="checkbox"] {
    cursor: pointer;
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
    margin: 0;
    flex-shrink: 0;
}

.multi-select-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-item-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    background: var(--gray-100, #e2e8f0);
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
    flex-shrink: 0;
}

.multi-select-empty {
    padding: 14px 12px;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.82rem;
    font-style: italic;
}

/* Mobile Touch Helper Hint */
.mobile-touch-hint {
    display: none;
    text-align: center;
    padding: 7px 12px;
    margin-top: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #166534;
}

@media (max-width: 1200px) {
    .graph-container {
        height: 440px;
        min-height: 420px;
    }
}

@media (max-width: 850px) {
    .mobile-touch-hint {
        display: block;
    }
    .interactive-brain-wrapper {
        height: 520px;
        min-height: 460px;
    }
    .brain-iframe {
        min-height: 460px;
    }
    .graph-container {
        height: 320px !important;
        min-height: 300px !important;
    }
}

@media (max-width: 480px) {
    .interactive-brain-wrapper {
        height: 460px;
        min-height: 400px;
    }
    .brain-iframe {
        min-height: 400px;
    }
    .graph-container {
        height: 300px !important;
        min-height: 280px !important;
    }
    .graph-card {
        padding: 0.85rem 0.75rem !important;
    }
    .graph-header {
        margin-bottom: 0.35rem !important;
    }
    .graph-note {
        padding-top: 0.4rem !important;
        margin-top: 0.4rem !important;
    }
}

/* Footer mobile responsiveness */
@media (max-width: 768px) {
    footer.footer .footer-text {
        flex: 1 1 100% !important;
        justify-content: center !important;
        text-align: center !important;
        margin-bottom: 12px;
        flex-direction: column !important;
    }
    footer.footer .footer-text > div {
        text-align: center !important;
    }
    footer.footer img {
        margin: 8px auto 0 !important;
        max-width: 100px !important;
        width: 30% !important;
    }
}