/* Design System Variables */
:root {
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Common layout */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.15);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Specific Resource Colors */
    --color-pubmed: #10b981;
    --color-omim: #f59e0b;
    --color-decipher: #3b82f6;
    --color-alphafold: #ec4899;
    --color-clinvar: #8b5cf6;
    --color-hpo: #06b6d4;
    --color-uniprot: #2563eb;
    --color-gnomad: #f43f5e;
}

/* Light Theme Variables */
body.light-theme {
    --bg-app: #f4f6f9;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f8fafc;
    --bg-header: rgba(255, 255, 255, 0.85);
    --bg-sidebar: #ffffff;
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary: #4f46e5;
    --primary-light: #eff6ff;
    --primary-hover: #4338ca;
    --primary-glow: rgba(79, 70, 229, 0.15);
    
    --bg-input: #f8fafc;
    --border-input: #e2e8f0;
    --text-input: #0f172a;
    
    --bg-card-blue: #eff6ff;
    --bg-card-purple: #faf5ff;
    --bg-card-green: #f0fdf4;
    --bg-card-orange: #fff7ed;
    
    --text-card-blue: #1e40af;
    --text-card-purple: #6b21a8;
    --text-card-green: #166534;
    --text-card-orange: #9a3412;
    
    --bg-overlay: rgba(15, 23, 42, 0.3);
}

/* Dark Theme Variables */
body.dark-theme {
    --bg-app: #080c14;
    --bg-surface: #0f172a;
    --bg-surface-hover: #1e293b;
    --bg-header: rgba(15, 23, 42, 0.85);
    --bg-sidebar: #0f172a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-light: rgba(99, 102, 241, 0.1);
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.25);
    
    --bg-input: #1e293b;
    --border-input: rgba(255, 255, 255, 0.1);
    --text-input: #f8fafc;
    
    --bg-card-blue: rgba(59, 130, 246, 0.08);
    --bg-card-purple: rgba(139, 92, 246, 0.08);
    --bg-card-green: rgba(16, 185, 129, 0.08);
    --bg-card-orange: rgba(245, 158, 11, 0.08);
    
    --text-card-blue: #60a5fa;
    --text-card-purple: #a78bfa;
    --text-card-green: #34d399;
    --text-card-orange: #fbbf24;
    
    --bg-overlay: rgba(0, 0, 0, 0.6);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: var(--radius-full);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* App Layout */
.app-container {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Header styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--bg-header);
}

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

.app-logo-img {
    height: 68px;
    width: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    filter: drop-shadow(0 4px 14px rgba(99, 102, 241, 0.4));
    transition: transform var(--transition-fast);
}

.app-logo-img:hover {
    transform: scale(1.05);
}

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.header-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-text .subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

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

.header-action-btn.btn-compact {
    padding: 8px 12px;
    font-size: 0.75rem;
    gap: 6px;
}

.header-action-btn.btn-compact i {
    width: 14px;
    height: 14px;
}

body.comparison-page {
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.15), transparent 28%),
        radial-gradient(circle at top right, rgba(16, 185, 129, 0.12), transparent 24%),
        var(--bg-app);
}

.comparison-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 20px;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(14, 165, 233, 0.05));
    box-shadow: var(--shadow-sm);
}

.comparison-kicker {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 700;
}

.comparison-hero h2 {
    font-size: 1.9rem;
    margin-bottom: 8px;
}

.comparison-copy {
    max-width: 680px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.comparison-hero-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 12px;
    min-width: 260px;
}

.meta-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 16px;
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.meta-card span {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
}

.meta-card small {
    margin-top: 4px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.72rem;
}

.comparison-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.category-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 720px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.category-search-box i {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.category-search-box input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9375rem;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.comparison-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
    gap: 18px;
    align-items: start;
    padding-bottom: 24px;
}

.category-browser,
.selection-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.category-browser {
    padding: 18px;
}

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

.category-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

.category-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.04));
    box-shadow: var(--shadow-glow);
}

.category-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.category-group {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary);
}

.category-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.category-card h3 {
    font-size: 1.02rem;
    line-height: 1.35;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.category-card-footer {
    display: flex;
    justify-content: flex-start;
}

.category-selected-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    background-color: var(--primary-light);
    border-radius: var(--radius-full);
    padding: 5px 10px;
}

.selection-panel {
    position: sticky;
    top: 96px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
}

.selection-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.selection-panel-header h3 {
    font-size: 1rem;
}

.selection-panel-header span {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.selection-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
    align-content: flex-start;
}

.selection-empty {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.selection-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.selection-pill i {
    width: 14px;
    height: 14px;
}

.selection-help {
    margin-top: 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

.selection-panel-actions {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.selection-panel-actions .btn {
    width: 100%;
    justify-content: center;
}

/* --- Presets Bar --- */
.presets-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.presets-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.presets-label i {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.presets-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preset-btn:hover {
    border-color: var(--primary);
    background-color: var(--primary-light);
    color: var(--primary);
    transform: translateY(-1px);
}

/* --- Matrix Heatmap & Results Toolbar --- */
.results-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input-wrapper.compact input {
    padding: 6px 12px 6px 32px;
    font-size: 0.8125rem;
    width: 180px;
}

.matrix-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.matrix-badge.positive.high {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(99, 102, 241, 0.2));
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.4);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
    font-weight: 700;
}

.matrix-badge.positive.mid {
    background-color: rgba(99, 102, 241, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.matrix-badge.negative,
.matrix-badge.neutral {
    background-color: rgba(148, 163, 184, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    opacity: 0.6;
}

.empty-category-state {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-category-state i {
    width: 42px;
    height: 42px;
    color: var(--text-muted);
}

.empty-category-state h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.comparison-results {
    margin-top: 18px;
    padding: 18px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.comparison-results-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 14px;
}

.comparison-results-header h3 {
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.comparison-results-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.comparison-table-wrap {
    overflow: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 860px;
    background-color: var(--bg-surface);
}

.comparison-table th,
.comparison-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    font-size: 0.84rem;
    white-space: nowrap;
}

.comparison-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--bg-surface-hover);
    font-weight: 700;
    color: var(--text-primary);
}

.comparison-table tbody tr:hover {
    background-color: var(--bg-surface-hover);
}

.comparison-table td:first-child,
.comparison-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: inherit;
}

.comparison-table tbody tr td:first-child {
    font-weight: 600;
    min-width: 280px;
    color: var(--text-primary);
}

.comparison-table tbody tr td:not(:first-child) {
    color: var(--text-secondary);
}

@media (max-width: 1024px) {
    .comparison-layout {
        grid-template-columns: 1fr;
    }

    .selection-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .comparison-hero,
    .comparison-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .comparison-hero-meta {
        min-width: 0;
    }

    .toolbar-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .category-search-box {
        max-width: none;
        width: 100%;
    }

    .comparison-hero h2 {
        font-size: 1.55rem;
    }

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

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-color-hover);
}

.btn-text {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
    transition: color var(--transition-fast);
}
.btn-text:hover {
    color: var(--primary-hover);
}
.btn-text.text-danger {
    color: #ef4444;
}
.btn-text.text-danger:hover {
    color: #dc2626;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.icon-btn:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-color-hover);
}

/* Theme Icons Toggle */
.sun-icon { display: none; }
.moon-icon { display: block; }
body.light-theme .sun-icon { display: block; }
body.light-theme .moon-icon { display: none; }

/* Stat Cards Dashboard */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 768px) {
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon-wrapper.blue { background-color: var(--bg-card-blue); color: var(--text-card-blue); }
.stat-icon-wrapper.purple { background-color: var(--bg-card-purple); color: var(--text-card-purple); }
.stat-icon-wrapper.green { background-color: var(--bg-card-green); color: var(--text-card-green); }
.stat-icon-wrapper.orange { background-color: var(--bg-card-orange); color: var(--text-card-orange); }

.stat-data h3 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}
.stat-data p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--border-color);
}
.stat-progress {
    height: 100%;
    background: linear-gradient(to right, var(--primary), #a855f7);
    transition: width var(--transition-normal);
}

/* Layout Grid */
.main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
    align-items: start;
}
.main-layout.full-width {
    grid-template-columns: 1fr;
}

/* Collapsible Advanced Filters Panel */
.advanced-filters-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
    overflow: visible;
    transition: all var(--transition-normal);
}
.advanced-filters-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: background-color var(--transition-fast);
}
.advanced-filters-trigger:hover {
    background-color: var(--bg-surface-hover);
}
.advanced-filters-trigger .trigger-label {
    display: flex;
    align-items: center;
    gap: 8px;
}
.advanced-filters-trigger .trigger-label i {
    width: 16px;
    height: 16px;
    color: var(--primary);
}
.advanced-filters-trigger .arrow-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform var(--transition-normal);
}
.advanced-filters-panel.open .advanced-filters-trigger .arrow-icon {
    transform: rotate(180deg);
}
.advanced-filters-content {
    display: none;
    padding: 0 20px 20px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}
.advanced-filters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 16px;
}
@media (max-width: 900px) {
    .advanced-filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .advanced-filters-grid {
        grid-template-columns: 1fr;
    }
}

/* Actions Group Right */
.actions-group-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sort Icon Wrapper */
.sort-icon-wrapper {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 4px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}
.sortable:hover .sort-icon-wrapper {
    color: var(--primary);
}

/* Header Table Filter Inputs Row */
.table-filter-row {
    background-color: var(--bg-surface);
}
.table-filter-row th {
    padding: 8px 12px !important;
    border-bottom: 2px solid var(--border-color) !important;
}
.header-filter-wrapper {
    width: 100%;
}
.header-filter-wrapper input {
    width: 100%;
    padding: 6px 10px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-input);
    transition: all var(--transition-fast);
}
.header-filter-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Header select custom styling */
.header-select-parent .custom-select-header {
    padding: 6px 10px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}
.header-select-parent .custom-select-header i {
    width: 14px;
    height: 14px;
}
.header-select-parent .custom-select-body {
    min-width: 200px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.filter-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.search-input-wrapper {
    position: relative;
}
.search-input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-input);
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}
.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

/* Custom Dropdown Multi-Select */
.custom-select-wrapper {
    position: relative;
}
.custom-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-input);
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
    transition: all var(--transition-fast);
}
.custom-select-header:hover {
    border-color: var(--border-color-hover);
}
.custom-select-wrapper.open .custom-select-header {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}
.custom-select-header span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}
.custom-select-header i {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}
.custom-select-wrapper.open .custom-select-header i {
    transform: rotate(180deg);
}

.custom-select-body {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
}
.custom-select-wrapper.open .custom-select-body {
    display: block;
}

.custom-select-search {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-input);
    background-color: var(--bg-input);
    color: var(--text-input);
    font-size: 0.8125rem;
}
.custom-select-search:focus {
    outline: none;
    border-color: var(--primary);
}

.custom-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    transition: background-color var(--transition-fast);
}
.custom-select-option:hover {
    background-color: var(--bg-surface-hover);
}
.custom-select-option.selected {
    background-color: var(--primary-light);
    color: var(--primary);
}
.custom-select-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* Accordion */
.accordion-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    border-top: 1px solid var(--border-color);
    padding: 16px 0 8px 0;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.accordion-arrow {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}
.accordion-trigger.open .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 8px;
}
.accordion-trigger.open + .accordion-content {
    display: flex;
}
.nested-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Content Area styling */
.content-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.results-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.global-search-container {
    position: relative;
    flex-grow: 1;
}
.global-search-container input {
    width: 100%;
    padding: 12px 16px 12px 46px;
    border-radius: var(--radius-lg);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}
.global-search-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}
.global-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

/* Download Dropdown */
.download-dropdown-wrapper {
    position: relative;
}
.download-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    flex-direction: column;
    min-width: 220px;
    overflow: hidden;
    padding: 4px;
}
.download-dropdown.open {
    display: flex;
}
.download-dropdown button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
}
.download-dropdown button:hover {
    background-color: var(--bg-surface-hover);
}
.download-dropdown button i {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

/* Active Chips */
.active-chips-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
    background-color: var(--primary-light);
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 102, 241, 0.15);
}
.chips-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-primary);
    font-weight: 500;
}
.chip button {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-muted);
}
.chip button:hover {
    color: #ef4444;
}
.chip button i {
    width: 12px;
    height: 12px;
}

/* Table Card */
.table-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    position: relative;
}

.table-scroll-container {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.data-table th, .data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--bg-surface-hover);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    user-select: none;
}
.data-table th.sortable {
    cursor: pointer;
}
.data-table th.sortable:hover {
    color: var(--text-primary);
}
.data-table th i {
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-left: 4px;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background-color var(--transition-fast);
}
.data-table tbody tr:hover {
    background-color: var(--bg-surface-hover);
}
.data-table tbody tr.active-row {
    background-color: var(--primary-light);
}

/* Gene Badge cell */
.gene-badge {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--primary);
    letter-spacing: -0.01em;
}

/* Inheritance badges */
.badge-inheritance {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-inheritance.ar { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-inheritance.ad { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-inheritance.xl { background-color: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-inheritance.other { background-color: rgba(100, 116, 139, 0.1); color: #64748b; }

/* OMIM badges */
.badge-omim {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-omim);
    font-weight: 500;
    text-decoration: none;
    font-family: monospace;
}
.badge-omim:hover {
    text-decoration: underline;
}

/* External Link Grid */
.links-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.link-pill {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.625rem;
    font-weight: 700;
    color: #ffffff;
    transition: all var(--transition-fast);
}
.link-pill:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.link-pill.pubmed { background-color: var(--color-pubmed); }
.link-pill.omim { background-color: var(--color-omim); }
.link-pill.decipher { background-color: var(--color-decipher); }
.link-pill.alphafold { background-color: var(--color-alphafold); }
.link-pill.clinvar { background-color: var(--color-clinvar); }
.link-pill.uniprot { background-color: var(--color-uniprot); }
.link-pill.gnomad { background-color: var(--color-gnomad); }

/* Clickable Category Badges in Table */
.cat-cell-clickable {
    cursor: pointer;
}
.badge-category-click {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background-color: rgba(100, 116, 139, 0.05);
    border: 1px solid var(--border-color);
    font-size: 0.8125rem;
    transition: all var(--transition-fast);
    display: inline-block;
}
.cat-cell-clickable:hover .badge-category-click {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* Table states overlays */
.table-loading, .no-results {
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: var(--bg-surface);
}
.table-loading p {
    margin-top: 16px;
    color: var(--text-secondary);
}
.no-results i {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.no-results h3 {
    font-size: 1.125rem;
    margin-bottom: 8px;
}
.no-results p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Footer of Table */
.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--bg-surface-hover);
    border-top: 1px solid var(--border-color);
}
.footer-info-wrapper {
    display: flex;
    align-items: center;
    gap: 24px;
}
.footer-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.page-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}
.page-size-selector select {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    color: var(--text-input);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
}
.page-size-selector select:focus {
    border-color: var(--primary);
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.pagination-btn:hover:not(:disabled) {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.pagination-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}
.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Detail Drawer & Overlay */
.detail-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-overlay);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
}
.detail-drawer-overlay.open {
    display: block;
}

.detail-drawer {
    position: fixed;
    top: 0;
    right: -480px;
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0,0,0,0.15);
    z-index: 250;
    display: flex;
    flex-direction: column;
    transition: right var(--transition-normal);
}
.detail-drawer.open {
    right: 0;
}

.drawer-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.drawer-header-title {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}
.drawer-header-title h2 {
    font-size: 1.5rem;
    line-height: 1.2;
}
.drawer-header-title p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}
.category-badge {
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--primary-light);
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.close-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
}

.drawer-section {
    margin-bottom: 24px;
}
.drawer-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.detail-value {
    font-size: 0.875rem;
    font-weight: 500;
}

.hpo-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.hpo-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--color-hpo);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}
.hpo-link:hover {
    border-color: var(--color-hpo);
    background-color: rgba(6, 182, 212, 0.05);
    transform: translateY(-1px);
}
.hpo-link i {
    width: 14px;
    height: 14px;
}

.associated-features-box {
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.drawer-links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.drawer-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffffff;
    transition: transform var(--transition-fast);
}
.drawer-link-btn:hover {
    transform: translateY(-1px);
}
.drawer-link-btn.pubmed { background-color: var(--color-pubmed); }
.drawer-link-btn.omim { background-color: var(--color-omim); }
.drawer-link-btn.decipher { background-color: var(--color-decipher); }
.drawer-link-btn.alphafold { background-color: var(--color-alphafold); }
.drawer-link-btn.clinvar { background-color: var(--color-clinvar); }
.drawer-link-btn.uniprot { background-color: var(--color-uniprot); }
.drawer-link-btn.gnomad { background-color: var(--color-gnomad); }

/* Drag and Drop Layer overlay */
.drag-drop-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(99, 102, 241, 0.15);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.drag-drop-overlay.drag-active {
    display: flex;
}
.drag-drop-box {
    border: 3px dashed var(--primary);
    border-radius: var(--radius-lg);
    background-color: var(--bg-surface);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 400px;
}
.drag-drop-box i {
    width: 48px;
    height: 48px;
    color: var(--primary);
}

/* Footer info */
.app-footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-muted);
    font-size: 0.8125rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* General Utilities */
.text-center { text-align: center; }
.hidden-mobile { display: flex; }
.hidden-tablet { display: table-cell; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .hidden-tablet {
        display: none;
    }
    .hidden-mobile {
        display: none;
    }
    
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
    
    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .header-actions-group {
        width: 100%;
    }
    
    .results-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .detail-drawer {
        max-width: 100%;
        right: -100%;
    }
}

/* --- About Modal & Language Toggle Styles --- */
.lang-toggle-btn {
    font-weight: 700;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    min-width: 44px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-overlay);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 620px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.96);
    transition: transform var(--transition-normal);
}

.modal-overlay.open .modal-content {
    transform: translateY(0) scale(1);
}

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

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* About Items inside Modal */
.tech-item {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.tech-item h4 {
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tech-item h4 i {
    color: var(--primary);
}

.tech-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.about-note {
    margin-top: 12px;
    font-size: 0.875rem !important;
}

.about-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.about-link:hover {
    text-decoration: underline;
}

.about-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.about-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.about-btn--primary {
    background-color: var(--primary);
    color: #ffffff;
}

.about-btn--primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 0 12px var(--primary-glow);
}

.about-btn--coffee {
    background-color: #ffdd00;
    color: #000000;
}

.about-btn--coffee:hover {
    background-color: #f7d000;
    box-shadow: 0 0 12px rgba(255, 221, 0, 0.4);
}

/* --- Subcategory Badge Styling --- */
.badge-subcategory-click {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-card-purple);
    background-color: var(--bg-card-purple);
    border: 1px solid rgba(139, 92, 246, 0.2);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.badge-subcategory-click:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

/* --- Ig Reference Calculator Modal --- */
.ig-calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.ig-calc-box {
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ig-calc-box label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.ig-calc-box input,
.ig-calc-box select {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
}

.ig-calc-results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 0.82rem;
}

.ig-calc-results-table th,
.ig-calc-results-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.ig-calc-results-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.ig-badge-status {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.ig-badge-status.low {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.ig-badge-status.normal {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.ig-badge-status.high {
    background-color: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

/* --- Active Chips Container & Collapsible Controls --- */
.active-chips-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.chips-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.chips-header-left,
.chips-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chips-count-badge {
    background-color: var(--primary);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.icon-btn-small {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.icon-btn-small:hover {
    color: var(--text-primary);
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.active-chips-container.collapsed .chips-list {
    display: none;
}

.active-chips-container.collapsed {
    padding: 8px 16px;
}

.chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    transition: all var(--transition-normal);
}

/* --- Stat Impact Badge & Animations --- */
.stat-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
}

.stat-impact-badge {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(245, 158, 11, 0.2));
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #f59e0b;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
    animation: impactPulse 1.5s infinite alternate ease-in-out;
}

@keyframes impactPulse {
    0% { transform: scale(1); box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2); }
    100% { transform: scale(1.05); box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4); }
}

@keyframes statCardUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); filter: brightness(1.15); }
    100% { transform: scale(1); }
}

.stat-card.updated {
    animation: statCardUpdate 0.35s ease-out;
}

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

.data-table tbody tr {
    animation: rowFadeIn 0.2s ease-out forwards;
}

/* --- Action Stat Cards in Dashboard Grid --- */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card.action-stat-card {
    cursor: pointer;
    position: relative;
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
    padding-right: 42px;
}

.stat-card.action-stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
    background-color: var(--bg-surface-hover);
}

.stat-card.action-stat-card .action-stat-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.stat-card.action-stat-card:hover .action-stat-arrow {
    color: var(--primary);
    transform: translateY(-50%) translateX(4px);
}

.stat-icon-wrapper.amber {
    background-color: var(--bg-card-orange);
    color: var(--text-card-orange);
}

.stat-icon-wrapper.indigo {
    background-color: var(--bg-card-purple);
    color: var(--text-card-purple);
}

/* --- Header Logo Link --- */
.header-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.header-logo-link:hover .app-logo-img {
    transform: scale(1.06);
    filter: drop-shadow(0 6px 18px rgba(99, 102, 241, 0.5));
}

/* --- Alias Copy Button --- */
.about-btn--alias {
    background-color: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.3);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.about-btn--alias:hover {
    background-color: rgba(16, 185, 129, 0.25);
    border-color: #34d399;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* --- Radar Chart Visualization Card --- */
.radar-chart-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

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

.radar-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.radar-icon-badge {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.radar-title-group h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.radar-title-group p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.radar-canvas-container {
    position: relative;
    width: 100%;
    height: 380px;
}

/* --- Patient Entity Card --- */
.patient-entity-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.08));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.patient-entity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.patient-entity-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.patient-avatar-badge {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 1px solid rgba(245, 158, 11, 0.5);
}

.patient-entity-title h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #fbbf24;
    margin-bottom: 2px;
}

.patient-entity-title p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.patient-entity-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.patient-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fef3c7;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    transition: all var(--transition-fast);
}

.patient-tag-chip.tag-removeable {
    cursor: pointer;
}

.patient-tag-chip.tag-removeable:hover {
    background-color: rgba(239, 68, 68, 0.3);
    border-color: #ef4444;
    color: #ffffff;
}

.patient-tag-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.75rem;
}


/* --- Interactive Parameter Selector (Chips / Cajitas Scrollable) --- */
.ig-param-selector-section {
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.ig-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.ig-selector-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ig-category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ig-category-pill-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ig-category-pill-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.ig-chips-scroll-container {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.ig-chips-group-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ig-chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.param-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.param-chip:hover {
    border-color: var(--primary-light);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.param-chip.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

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

/* --- Dynamic Active Input Cards Grid --- */
.ig-active-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.ig-input-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ig-input-card:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ig-input-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.ig-input-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ig-input-card-unit {
    font-size: 0.72rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.ig-input-card-row {
    width: 100%;
    margin-top: 2px;
}

.ig-input-card-row input {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

/* ==========================================================================
   MOBILE FIRST & RESPONSIVE ADAPTATIONS (Desktop & Mobile Unified)
   ========================================================================== */

/* Touch & tap responsiveness */
html, body {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Category pills in modal ribbon */
.ig-category-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
}
.ig-category-pills::-webkit-scrollbar {
    display: none;
}

.ig-category-pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Table Responsive Wrapper */
.ig-table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    margin-top: 14px;
    border: 1px solid var(--border-color);
}

.ig-calc-results-table {
    margin-top: 0;
    min-width: 480px;
}

/* Responsive Modal (Bottom Sheet on Mobile, Centered Card on Desktop) */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end; /* Bottom sheet effect */
    }

    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88vh;
        border-radius: 20px 20px 0 0 !important;
        margin: 0;
        display: flex;
        flex-direction: column;
        animation: slideUpBottom 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes slideUpBottom {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .modal-header {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--bg-surface);
        padding: 14px 16px;
        border-bottom: 1px solid var(--border-color);
    }

    .modal-header::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background-color: var(--border-color);
        border-radius: 4px;
    }

    .modal-body {
        padding: 14px 16px !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
    }

    .ig-active-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .ig-input-card {
        padding: 8px 10px;
    }

    .ig-input-card-title {
        font-size: 0.78rem;
    }

    .ig-input-card-unit {
        font-size: 0.68rem;
        padding: 1px 6px;
    }

    .ig-input-card-row input,
    .ig-calc-box input,
    .ig-calc-box select {
        font-size: 16px !important; /* Prevents iOS auto zoom */
        padding: 8px 10px;
    }

    .param-chip {
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    /* Modal footer sticky at bottom of sheet */
    .modal-body > div:last-child {
        position: sticky;
        bottom: -14px;
        background: var(--bg-surface);
        padding: 12px 0 6px 0;
        border-top: 1px solid var(--border-color);
        margin-top: 16px !important;
        z-index: 5;
    }

    .modal-body > div:last-child button {
        flex: 1;
        justify-content: center;
        padding: 10px 14px;
    }
}

/* Extra small mobile adjustments */
@media (max-width: 480px) {
    .ig-active-cards-grid {
        grid-template-columns: 1fr;
    }

    .param-chip {
        width: 100%;
        justify-content: flex-start;
    }

    .ig-selector-title {
        font-size: 0.82rem;
    }
}
