/* -------------------------------------------------------------
 * Custom Design System & Premium Aesthetics for OCP Compatibility Web App
 * Built & Maintained by fluidiQ by Magnalytix
 * ------------------------------------------------------------- */

/* Variable Tokens - Dark Theme (Default) */
:root {
    --bg-base: #070b15;
    --bg-card: rgba(13, 20, 38, 0.75);
    --bg-card-hover: rgba(20, 30, 58, 0.85);
    --bg-input: rgba(8, 13, 26, 0.8);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #8a9ab8;
    
    /* Colorblind-safe accents based on the Okabe-Ito palette */
    --accent-teal: #00c896;
    --accent-teal-glow: rgba(0, 200, 150, 0.25);
    --accent-cyan: #56b4e9;
    --accent-cyan-glow: rgba(86, 180, 233, 0.25);
    --accent-gradient: linear-gradient(135deg, #00c896 0%, #56b4e9 100%);
    
    /* CUD-inspired bluish green and vermilion hues; labels and symbols supplement solid colors */
    --color-risk-low: #5ad6af;
    --color-risk-low-bg: rgba(90, 214, 175, 0.1);
    --color-risk-low-border: rgba(90, 214, 175, 0.62);
    --color-risk-moderate: #ead565;
    --color-risk-moderate-bg: rgba(234, 213, 101, 0.09);
    --color-risk-moderate-border: rgba(234, 213, 101, 0.62);
    --color-risk-elevated: #efb36c;
    --color-risk-elevated-bg: rgba(239, 179, 108, 0.1);
    --color-risk-elevated-border: rgba(239, 179, 108, 0.62);
    --color-risk-high: #ff8659;
    --color-risk-high-bg: rgba(255, 134, 89, 0.11);
    --color-risk-high-border: rgba(255, 134, 89, 0.72);
    --color-risk-not-tested: #b0b7c3;
    --color-risk-not-tested-bg: rgba(176, 183, 195, 0.08);
    --color-risk-not-tested-border: rgba(176, 183, 195, 0.5);
    /* Phase badging is separate from the green-to-red risk scale */
    --color-singlephase: #60a5fa;
    --color-singlephase-bg: rgba(96, 165, 250, 0.1);
    --color-singlephase-border: rgba(96, 165, 250, 0.55);
    --color-twophase: #c084fc;
    --color-twophase-bg: rgba(192, 132, 252, 0.1);
    --color-twophase-border: rgba(192, 132, 252, 0.55);

    /* Shadow / Effects */
    --glass-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
    --teal-glow: 0 0 20px 0 rgba(20, 184, 166, 0.3);
    --font-outfit: 'Outfit', sans-serif;
    --font-inter: 'Inter', sans-serif;
    
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;

    /* Opaque surfaces for sticky table headers/columns (translucent cards would show rows scrolling beneath) */
    --bg-surface-solid: #0d1426;
    --bg-table-head: #0a1020;
}

/* Light Theme Variable Overrides */
.light-theme {
    --bg-base: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-input: #ffffff;
    --border-color: rgba(15, 23, 42, 0.08);
    --border-color-hover: rgba(15, 23, 42, 0.16);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #526176;
    
    /* Accessible accent text colors for light backgrounds */
    --accent-teal: #007a5e;
    --accent-teal-glow: rgba(0, 122, 94, 0.1);
    --accent-cyan: #006a8e;
    --accent-cyan-glow: rgba(0, 106, 142, 0.1);
    
    /* Darker counterparts retain at least 4.5:1 contrast on the light canvas */
    --color-risk-low: #006c50;
    --color-risk-low-bg: #eaf8f2;
    --color-risk-low-border: rgba(0, 108, 80, 0.62);
    
    --color-risk-moderate: #716000;
    --color-risk-moderate-bg: #fffbe5;
    --color-risk-moderate-border: rgba(113, 96, 0, 0.62);
    --color-risk-elevated: #855000;
    --color-risk-elevated-bg: #fff4e5;
    --color-risk-elevated-border: rgba(133, 80, 0, 0.62);
    --color-risk-high: #a33e0a;
    --color-risk-high-bg: #fff0e8;
    --color-risk-high-border: rgba(163, 62, 10, 0.68);
    --color-risk-not-tested: #4b5563;
    --color-risk-not-tested-bg: #f8fafc;
    --color-risk-not-tested-border: rgba(75, 85, 99, 0.5);
    --color-singlephase: #1d4ed8;
    --color-singlephase-bg: #eff6ff;
    --color-singlephase-border: rgba(29, 78, 216, 0.55);
    --color-twophase: #7e22ce;
    --color-twophase-bg: #faf5ff;
    --color-twophase-border: rgba(126, 34, 206, 0.55);
    
    /* Shadows */
    --glass-shadow: 0 10px 30px 0 rgba(15, 23, 42, 0.05), 0 1px 3px 0 rgba(15, 23, 42, 0.02);
    --teal-glow: 0 0 15px 0 rgba(20, 184, 166, 0.15);

    --bg-surface-solid: #ffffff;
    --bg-table-head: #f1f5f9;
}

/* Global Reset & Base Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-inter);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Floating Ambient Light Backgrounds */
.gradient-bg-1 {
    position: absolute;
    top: -150px;
    left: -150px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.07) 0%, rgba(20, 184, 166, 0) 70%);
    z-index: -10;
    pointer-events: none;
    filter: blur(80px);
    transition: background 0.3s ease;
}

.gradient-bg-2 {
    position: absolute;
    top: 300px;
    right: -200px;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.06) 0%, rgba(6, 182, 212, 0) 75%);
    z-index: -10;
    pointer-events: none;
    filter: blur(100px);
    transition: background 0.3s ease;
}

.light-theme .gradient-bg-1 {
    background: radial-gradient(circle, rgba(20, 184, 166, 0.05) 0%, rgba(20, 184, 166, 0) 70%);
}

.light-theme .gradient-bg-2 {
    background: radial-gradient(circle, rgba(6, 182, 212, 0.04) 0%, rgba(6, 182, 212, 0) 75%);
}

/* Application Shell Layout */
.app-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    overflow: visible;
    z-index: 1;
}

/* -------------------------------------------------------------
 * Header Styling & Rebranded OCP Logo
 * ------------------------------------------------------------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-area-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ocp-logo-container {
    height: 36px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.ocp-logo-img {
    height: 100%;
    width: auto;
    object-fit: contain;
    /* Soft white outline glow in dark mode for maximum visibility of dark grey brand text */
    filter: brightness(1.05) drop-shadow(0 0 1px rgba(255, 255, 255, 0.4));
    transition: filter 0.3s ease;
}

.brand-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color-hover);
    margin: 0 0.5rem;
    flex-shrink: 0;
}

.logo-area {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.brand-title {
    font-family: var(--font-outfit);
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: var(--text-primary);
}

.beta-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.35rem;
    padding: 0.12rem 0.5rem;
    border: 1px solid var(--color-risk-moderate-border);
    border-radius: 999px;
    background-color: var(--color-risk-moderate-bg);
    color: var(--color-risk-moderate);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
}

.app-header .subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 0.1rem;
}

.header-right-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Site-wide Beta status and community data provenance notice */
.beta-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.55rem 0.75rem 0.55rem 1rem;
    border: 1px solid var(--color-risk-moderate-border);
    border-left-width: 4px;
    border-radius: var(--border-radius-md);
    background-color: var(--color-risk-moderate-bg);
    background-image: none;
}

.beta-notice-icon {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.12rem;
    flex-shrink: 0;
    color: var(--color-risk-moderate);
}

.beta-notice-body {
    flex: 1;
    min-width: 0;
}

.beta-notice p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
}

.beta-notice-summary strong {
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-weight: 700;
}

.beta-notice-details {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.beta-notice-details[hidden] {
    display: none;
}

.beta-notice-details a {
    color: var(--accent-teal);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.16em;
}

.beta-notice-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--color-risk-moderate-border);
    border-radius: 999px;
    background: var(--bg-surface-solid);
    color: var(--text-primary);
    font-family: var(--font-inter);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.beta-notice-toggle:hover {
    border-color: var(--color-risk-moderate);
}

.beta-notice-toggle svg {
    width: 0.85rem;
    height: 0.85rem;
    transition: transform 0.2s ease;
}

.beta-notice-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Theme Toggle Swtich */
.btn-theme-toggle {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.btn-theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
}

.light-theme .btn-theme-toggle {
    background-color: rgba(0, 0, 0, 0.02);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.light-theme .btn-theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: var(--border-color-hover);
    color: var(--text-primary);
}

.btn-theme-toggle i {
    width: 1.2rem;
    height: 1.2rem;
}

/* Premium Partner Attribution Card */
.attribution-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s;
}

.attribution-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-teal);
    box-shadow: 0 8px 30px rgba(20, 184, 166, 0.15);
}

.glow-icon {
    color: var(--accent-teal);
    filter: drop-shadow(0 0 6px var(--accent-teal));
}

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

.attr-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.attr-brand {
    font-family: var(--font-outfit);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.brand-sub {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* -------------------------------------------------------------
 * Interactive Glossary (Failure Mechanisms)
 * ------------------------------------------------------------- */
.glossary-section {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    transition: border-color 0.3s;
}

.glossary-section:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.glossary-details {
    width: 100%;
}

.glossary-summary {
    padding: 1.25rem 1.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-outfit);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none; /* Hide default triangle */
}

.glossary-summary::-webkit-details-marker {
    display: none; /* Hide default triangle in WebKit */
}

.summary-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.summary-title i {
    color: var(--accent-teal);
    width: 1.25rem;
    height: 1.25rem;
}

.accordion-icon {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.glossary-details[open] .accordion-icon {
    transform: rotate(180deg);
}

.glossary-content {
    padding: 0 1.75rem 1.75rem 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(8, 13, 26, 0.3);
}

.glossary-intro {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 1rem 0 1.25rem 0;
    max-width: 1000px;
}

.glossary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.glossary-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: background-color 0.3s, border-color 0.3s;
}

.glossary-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(20, 184, 166, 0.2);
}

.glossary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.35rem;
}

.glossary-title {
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.mechanism-type-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.type-direct {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.type-indirect {
    background: rgba(168, 85, 247, 0.1);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

/* --- Failure Mechanism Chips (table cells, compare cells) --- */
.mechanism-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-width: 220px;
}
.mechanism-chip {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
    white-space: nowrap;
}
.mechanism-chip.type-direct {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
}
.mechanism-chip.type-indirect {
    background: rgba(168, 85, 247, 0.1);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.2);
}
.mechanism-chip-none {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.glossary-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: -webkit-line-clamp 0.3s;
}

.glossary-card:hover p {
    display: block;
    overflow: visible;
}

.glossary-impact {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--text-muted);
    border-top: 1px dashed rgba(255, 255, 255, 0.04);
    padding-top: 0.35rem;
    margin-top: 0.25rem;
}

.glossary-impact-list {
    margin: 0.3rem 0 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.2rem;
}

.glossary-badges {
    display: inline-flex;
    gap: 0.3rem;
}

.glossary-pathway {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.glossary-pathway-label {
    display: inline-block;
    align-self: flex-start;
    margin-top: 0.45rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-cyan);
}

.glossary-pathway-label.pathway-indirect {
    color: #c084fc;
}

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

.glossary-view-records-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-start;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--accent-teal);
    font-family: var(--font-inter);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}
.glossary-view-records-btn:hover {
    background-color: var(--accent-teal-glow);
    border-color: rgba(20, 184, 166, 0.3);
}
.glossary-view-records-btn i {
    width: 0.9rem;
    height: 0.9rem;
}

/* -------------------------------------------------------------
 * Filters Section
 * ------------------------------------------------------------- */
.filters-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1rem 1.5rem 1.25rem;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.6rem;
}

.filters-header h2 {
    font-family: var(--font-outfit);
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.filters-header h2 i {
    color: var(--accent-teal);
    width: 1.25rem;
    height: 1.25rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: 1.2fr repeat(5, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1200px) {
    .filters-grid {
        grid-template-columns: 1.2fr repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* Styled Text Inputs */
.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 0.95rem;
    color: var(--text-muted);
    width: 1rem;
    height: 1rem;
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem 0.75rem 2.4rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-inter);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input-wrapper input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.search-input-wrapper input:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.15);
}

.clear-search-btn {
    position: absolute;
    right: 0.85rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.clear-search-btn:hover {
    color: var(--text-primary);
}

/* Styled Selection Menus */
.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-secondary);
    pointer-events: none;
}

.select-wrapper select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 2rem 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-inter);
    font-size: 0.875rem;
    outline: none;
    appearance: none; /* Hide OS arrow */
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.select-wrapper select:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.15);
}

.select-wrapper select option, 
.select-wrapper select optgroup {
    background-color: #0d1426;
    color: var(--text-primary);
}

/* -------------------------------------------------------------
 * Dynamic Toolbar Actions (Counters and Buttons)
 * ------------------------------------------------------------- */
.results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.results-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.stats-icon {
    color: var(--accent-teal);
    display: flex;
    align-items: center;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* General Button Typography */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-outfit);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: background-color 0.3s, transform 0.2s, border-color 0.3s, box-shadow 0.3s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: #040812;
    padding: 0.75rem 1.25rem;
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(20, 184, 166, 0.4);
    background: linear-gradient(135deg, #18ccb8 0%, #08c8e8 100%);
}

.btn-glow {
    box-shadow: var(--teal-glow);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.25rem;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-reset-filters {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-inter);
}

.btn-reset-filters:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Export Dropdown Widget */
.export-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.btn-export {
    background-color: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1.25rem;
}

.btn-export:hover {
    background-color: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
}

.chevron-sm {
    width: 0.8rem;
    height: 0.8rem;
    transition: transform 0.3s;
}

.export-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 220px;
    background-color: #0b1122;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    padding: 0.5rem;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.export-menu.show {
    display: flex;
    animation: dropdownSlide 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.65rem 0.85rem;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-inter);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s, color 0.2s;
}

.export-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.export-option i {
    width: 1rem;
    height: 1rem;
    color: var(--accent-teal);
}

/* -------------------------------------------------------------
 * Main Data Table Card
 * ------------------------------------------------------------- */
.data-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-scroll-container {
    width: 100%;
    overflow: auto;
    max-height: max(420px, calc(100vh - 7rem));
    overscroll-behavior: contain;
    /* Custom premium scrollbar for table container */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

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

.table-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

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

.compatibility-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: var(--bg-table-head);
    color: var(--text-secondary);
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1.1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    user-select: none;
}

.compatibility-table th.sortable {
    padding: 0;
}

.sort-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1.1rem 1rem;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    text-align: inherit;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.compatibility-table th.text-center .sort-btn {
    justify-content: center;
}

.sort-btn:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.sort-btn:focus-visible {
    outline: 2px solid var(--accent-teal);
    outline-offset: -2px;
}

/* First column stays in view while scrolling horizontally */
.compatibility-table th[data-col="fluid"],
.compatibility-table td[data-col="fluid"] {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: var(--bg-surface-solid);
    box-shadow: 1px 0 0 var(--border-color);
}

.compatibility-table th[data-col="fluid"] {
    z-index: 3;
    background-color: var(--bg-table-head);
}

.sort-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 0.25rem;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.compatibility-table th .sort-btn:hover .sort-icon {
    opacity: 0.8;
}

.compatibility-table th.active-sort {
    color: var(--accent-teal);
}

.compatibility-table th.active-sort .sort-icon {
    opacity: 1;
    color: var(--accent-teal);
}

.compatibility-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    vertical-align: middle;
}

/* Rows Hover state */
.compatibility-table tbody tr {
    transition: background-color 0.2s, transform 0.2s;
}

.compatibility-table tbody tr.record-row {
    cursor: pointer;
}

.compatibility-table tbody tr.record-row:hover {
    background-color: var(--accent-teal-glow);
}

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

/* Search Term Highlighter */
.highlight {
    background-color: rgba(6, 182, 212, 0.25);
    color: #fff;
    padding: 1px 3px;
    border-radius: 3px;
    box-shadow: 0 0 4px rgba(6, 182, 212, 0.3);
}

/* -------------------------------------------------------------
 * Custom Badges (Visual Cues)
 * ------------------------------------------------------------- */
/* Phase badges */
.phase-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    letter-spacing: 0.02em;
    font-family: var(--font-inter);
}

.phase-badge.phase-1 {
    background: var(--color-singlephase-bg);
    color: var(--color-singlephase);
    border: 1px solid var(--color-singlephase-border);
}

.phase-badge.phase-2 {
    background: var(--color-twophase-bg);
    color: var(--color-twophase);
    border: 1px dashed var(--color-twophase-border);
}

/* Risk / Compatibility Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-outfit);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    text-align: center;
    width: 100%;
    max-width: 200px;
    letter-spacing: 0.01em;
    gap: 0.4rem;
}

.status-badge::before,
.report-status-badge::before {
    display: inline-block;
    font-family: var(--font-inter);
    font-weight: 900;
    line-height: 1;
}

.status-badge.risk-low {
    background-color: var(--color-risk-low-bg);
    border: 1px solid var(--color-risk-low-border);
    color: var(--color-risk-low);
    box-shadow: 0 0 10px rgba(90, 214, 175, 0.08);
}

.status-badge.risk-moderate {
    background-color: var(--color-risk-moderate-bg);
    border: 1px solid var(--color-risk-moderate-border);
    color: var(--color-risk-moderate);
    box-shadow: 0 0 10px rgba(234, 213, 101, 0.08);
}

.status-badge.risk-elevated {
    background-color: var(--color-risk-elevated-bg);
    border: 1px solid var(--color-risk-elevated-border);
    color: var(--color-risk-elevated);
    box-shadow: 0 0 10px rgba(239, 179, 108, 0.08);
}

.status-badge.risk-high {
    background-color: var(--color-risk-high-bg);
    border: 1px solid var(--color-risk-high-border);
    color: var(--color-risk-high);
    box-shadow: 0 0 10px rgba(255, 134, 89, 0.08);
}

.status-badge.risk-not-tested {
    background-color: var(--color-risk-not-tested-bg);
    border: 1px solid var(--color-risk-not-tested-border);
    color: var(--color-risk-not-tested);
}

.status-badge.risk-low::before { content: '\2713'; }
.status-badge.risk-moderate::before { content: '!'; }
.status-badge.risk-elevated::before { content: '\25B2'; font-size: 0.68em; }
.status-badge.risk-high::before { content: '\00D7'; font-size: 1.2em; }
.status-badge.risk-not-tested::before { content: '\2014'; }

.status-badge.risk-moderate,
.report-status-badge.warning { background-image: none; }
.status-badge.risk-elevated,
.report-status-badge.elevated { background-image: none; }
.status-badge.risk-high,
.report-status-badge.danger { background-image: none; }
.status-badge.risk-not-tested,
.report-status-badge.neutral { background-image: none; background-size: 8px 8px; }

/* Custom visual alignment cells */
.text-center {
    text-align: center;
}

.flex-align {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* -------------------------------------------------------------
 * Table Pagination Bar
 * ------------------------------------------------------------- */
.table-pagination-bar {
    padding: 1rem 1.5rem;
    background-color: rgba(6, 11, 23, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.page-size-selector {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-size-selector select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    padding: 0.25rem 0.5rem;
    font-family: var(--font-inter);
    outline: none;
    cursor: pointer;
}

.pagination-controls {
    display: flex;
    gap: 0.35rem;
}

.pagination-btn {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.pagination-btn.active {
    background: var(--accent-gradient);
    color: #040812;
    border: none;
    font-weight: 700;
}

.pagination-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-ellipsis {
    color: var(--text-muted);
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* -------------------------------------------------------------
 * Modal Windows (Frosted Card)
 * ------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(3, 7, 18, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1.5rem;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: #0d1326;
    border: 1px solid var(--border-color-hover);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalScaleUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.hidden .modal-card {
    animation: none;
}

.modal-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-outfit);
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
}

.header-icon {
    color: var(--accent-teal);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-info-bar {
    background-color: rgba(20, 184, 166, 0.05);
    border-bottom: 1px solid rgba(20, 184, 166, 0.12);
    padding: 0.85rem 1.75rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.info-icon {
    color: var(--accent-teal);
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.modal-info-bar p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.disclaimer-bar {
    background-color: var(--color-risk-moderate-bg);
    background-image: none;
    border: 1px solid var(--color-risk-moderate-border);
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.disclaimer-bar .disclaimer-icon {
    color: var(--color-risk-moderate);
    width: 1.05rem;
    height: 1.05rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.disclaimer-bar p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.disclaimer-bar a {
    color: var(--accent-teal);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.16em;
}

.disclaimer-bar a:hover {
    text-decoration: underline;
}

.modal-form {
    padding: 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-group.full-width {
    grid-column: span 2;
}

@media (max-width: 600px) {
    .form-group.full-width {
        grid-column: span 1;
    }
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group label.required::after {
    content: ' *';
    color: var(--color-risk-high);
}

.label-optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.75em;
}

.mechanism-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}
@media (max-width: 600px) {
    .mechanism-checkbox-grid {
        grid-template-columns: 1fr;
    }
}
.mechanism-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.mechanism-checkbox-item:hover {
    border-color: var(--border-color-hover);
}
.mechanism-checkbox-item input[type="checkbox"] {
    accent-color: var(--accent-teal);
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}
.mechanism-checkbox-item em {
    color: var(--text-muted);
    font-style: normal;
    font-size: 0.85em;
}

.form-group input[type="text"], 
.form-group textarea {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-inter);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input[type="text"]:focus, 
.form-group textarea:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.15);
}

.form-actions {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 1.25rem;
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.right-actions {
    display: flex;
    gap: 0.75rem;
}

/* -------------------------------------------------------------
 * Misc feature additions
 * ------------------------------------------------------------- */

/* #4 — Advisor export bar */
.advisor-export-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
}
.advisor-export-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: auto;
}
.advisor-export-label i {
    width: 1rem;
    height: 1rem;
}
.btn.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    gap: 0.35rem;
}
.btn.btn-sm i {
    width: 0.9rem;
    height: 0.9rem;
}

/* #6 — Analytics fluid filter bar */
.analytics-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    backdrop-filter: blur(12px);
}
.analytics-filter-bar label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}
.analytics-filter-bar label i {
    width: 1rem;
    height: 1rem;
    color: var(--accent-teal);
}
.analytics-fluid-select-wrapper {
    flex: 1;
    max-width: 320px;
}

/* #7 — Heatmap horizontal scroll hint (mobile only) */
.heatmap-scroll-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    text-align: center;
}
.heatmap-scroll-hint i {
    width: 0.9rem;
    height: 0.9rem;
}
@media (max-width: 768px) {
    .heatmap-scroll-hint {
        display: flex;
    }
}

/* -------------------------------------------------------------
 * Footer Styling
 * ------------------------------------------------------------- */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-disclaimer {
    flex-basis: 100%;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    line-height: 1.5;
}

.footer-disclaimer strong {
    color: var(--text-primary);
}

.footer-attribution {
    font-size: 0.8rem;
}

.footer-brand-link,
.footer-source-link {
    color: var(--text-secondary);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.16em;
    transition: color 0.2s;
}

.footer-brand-link:hover,
.footer-source-link:hover,
.footer-brand-link:focus-visible,
.footer-source-link:focus-visible {
    color: var(--accent-teal);
    text-decoration: underline;
}

.footer-dataset-version {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-inter);
    cursor: help;
}

/* -------------------------------------------------------------
 * Dynamic States & Animations
 * ------------------------------------------------------------- */
.loading-state, 
.empty-state {
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-secondary);
    text-align: center;
}

.loading-spinner {
    padding: 1.5rem;
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--accent-teal);
    border-radius: 50%;
    animation: rotateSpinner 0.8s linear infinite;
}

.empty-state i {
    width: 3rem;
    height: 3rem;
    color: var(--text-muted);
}

.empty-state h3 {
    font-family: var(--font-outfit);
    font-size: 1.15rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 400px;
}

/* CSS Animations keyframes */
@keyframes rotateSpinner {
    to { transform: rotate(360deg); }
}

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

@keyframes modalScaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}



/* -------------------------------------------------------------
 * Theme-Specific Element Overrides
 * ------------------------------------------------------------- */

/* Light Theme Element Custom Adjustments */
.light-theme .ocp-logo-container {
    filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.08));
}

.light-theme .ocp-logo-img {
    filter: none;
}

.light-theme .inner-ocp-core {
    stroke: #f1f5f9; /* Match light base background */
}

.light-theme .attribution-card {
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}

.light-theme .attribution-card:hover {
    border-color: var(--accent-teal);
    box-shadow: 0 4px 20px rgba(20, 184, 166, 0.12);
}

.light-theme .glossary-section {
    background-color: var(--bg-card);
}

.light-theme .glossary-content {
    background: rgba(241, 245, 249, 0.4);
    border-top-color: rgba(15, 23, 42, 0.04);
}

.light-theme .glossary-card {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.05);
}

.light-theme .glossary-card:hover {
    background: #ffffff;
    border-color: rgba(20, 184, 166, 0.3);
}

.light-theme .glossary-card-header {
    border-bottom-color: rgba(15, 23, 42, 0.04);
}

.light-theme .glossary-impact {
    border-top-color: rgba(15, 23, 42, 0.04);
}

.light-theme .filters-card {
    background-color: var(--bg-card);
}

.light-theme .filters-header {
    border-bottom-color: rgba(15, 23, 42, 0.04);
}

.light-theme .search-input-wrapper input {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
    color: var(--text-primary);
}

.light-theme .search-input-wrapper input:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.08);
}

.light-theme .select-wrapper select {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
    color: var(--text-primary);
}

.light-theme .select-wrapper select:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.08);
}

.light-theme .select-wrapper select option,
.light-theme .select-wrapper select optgroup {
    background-color: #ffffff;
    color: var(--text-primary);
}

.light-theme .btn-reset-filters {
    border-color: rgba(15, 23, 42, 0.1);
}

.light-theme .btn-reset-filters:hover {
    background-color: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.2);
}

.light-theme .btn-export {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
}

.light-theme .btn-export:hover {
    background-color: rgba(15, 23, 42, 0.02);
    border-color: rgba(15, 23, 42, 0.2);
}

.light-theme .export-menu {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.light-theme .export-option:hover {
    background-color: rgba(15, 23, 42, 0.03);
}

.light-theme .data-card {
    background-color: #ffffff;
}

.light-theme .compatibility-table th {
    background-color: var(--bg-table-head);
    color: var(--text-secondary);
    border-bottom: 2px solid rgba(15, 23, 42, 0.06);
}

.light-theme .sort-btn:hover {
    background-color: rgba(15, 23, 42, 0.03);
}

.light-theme .compatibility-table td {
    border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}

.light-theme .compatibility-table tbody tr.record-row:hover {
    background-color: #f1f7f5;
}

.light-theme .table-scroll-container::-webkit-scrollbar-thumb {
    background-color: rgba(15, 23, 42, 0.1);
}

.light-theme .table-scroll-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(15, 23, 42, 0.2);
}

.light-theme .table-pagination-bar {
    background-color: rgba(241, 245, 249, 0.4);
    border-top: 1px solid rgba(15, 23, 42, 0.04);
}

.light-theme .page-size-selector select {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
}

.light-theme .pagination-btn {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
}

.light-theme .pagination-btn:hover:not(.disabled):not(.active) {
    background-color: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.18);
}

.light-theme .pagination-btn.active {
    color: #ffffff;
}

.light-theme .modal-overlay {
    background-color: rgba(15, 23, 42, 0.45);
}

.light-theme .modal-card {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}

.light-theme .modal-header {
    border-bottom-color: rgba(15, 23, 42, 0.05);
}

.light-theme .modal-info-bar {
    background-color: rgba(20, 184, 166, 0.04);
    border-bottom-color: rgba(20, 184, 166, 0.08);
}

.light-theme .form-group input[type="text"],
.light-theme .form-group textarea {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.12);
    color: var(--text-primary);
}

.light-theme .form-group input[type="text"]:focus,
.light-theme .form-group textarea:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.08);
}

.light-theme .form-actions {
    border-top-color: rgba(15, 23, 42, 0.05);
}

.light-theme .btn-secondary {
    background-color: #ffffff;
    border-color: rgba(15, 23, 42, 0.1);
}

.light-theme .btn-secondary:hover {
    background-color: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.2);
}

.light-theme .btn-submit-record {
    color: #ffffff;
}

.light-theme .btn-submit-record:hover {
    color: #ffffff;
}

.light-theme .spinner {
    border-color: rgba(15, 23, 42, 0.05);
    border-top-color: var(--accent-teal);
}

/* -------------------------------------------------------------
 * Tabbed Navigation & View Swapping
 * ------------------------------------------------------------- */
.app-nav {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 0.45rem;
    gap: 0.5rem;
    box-shadow: var(--glass-shadow);
    max-width: 100%;
    align-self: flex-start;
}

.app-nav::-webkit-scrollbar {
    display: none;
}

@media (max-width: 1300px) {
    .nav-item {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
    }
}

.nav-item {
    flex-shrink: 0;
    white-space: nowrap;
    background: none;
    border: none;
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0.65rem 1.25rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    transition: background-color 0.25s, color 0.25s, box-shadow 0.25s;
}

.nav-item i {
    width: 1.15rem;
    height: 1.15rem;
    transition: transform 0.25s;
}

.nav-item:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.light-theme .nav-item:hover:not(.active) {
    background-color: rgba(0, 0, 0, 0.02);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: #040812;
    box-shadow: var(--teal-glow);
}

.nav-item.active i {
    transform: scale(1.05);
}

/* Page View Controller */
.app-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: viewFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-view.hidden {
    display: none !important;
}

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

/* -------------------------------------------------------------
 * Expanded Reference View Layouts
 * ------------------------------------------------------------- */
.reference-summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
}

.reference-index {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0.75rem;
    z-index: 120;
    align-self: stretch;
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--glass-shadow);
}

.reference-index-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.reference-index-label i {
    width: 1rem;
    height: 1rem;
    color: var(--accent-teal);
}

.reference-index-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.reference-index-links a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.reference-index-links a:hover,
.reference-index-links a:focus-visible,
.reference-index-links a.active {
    color: var(--text-primary);
    border-color: var(--accent-teal);
    background: var(--accent-teal-glow);
}

.reference-index-links a:focus-visible {
    outline: none;
}

#fluid-architectures,
#interaction-mechanisms,
#compatibility-risk-levels,
#test-protocols,
#failure-mechanisms-glossary {
    scroll-margin-top: 1.5rem;
}

@media (max-width: 760px) {
    .reference-index {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.65rem;
    }

    .reference-index-links {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.2rem;
        scrollbar-width: thin;
    }

    .reference-index-links a {
        flex: 0 0 auto;
    }
}

.ref-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ref-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.light-theme .ref-card-header {
    border-bottom-color: rgba(15, 23, 42, 0.05);
}

.ref-card-header h3 {
    font-family: var(--font-outfit);
    font-size: 1.25rem;
    font-weight: 700;
}

.ref-header-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.ref-card-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.phase-info-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.phase-info-block h4 {
    font-family: var(--font-outfit);
    font-size: 1.05rem;
    font-weight: 600;
}

.phase-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-single {
    background-color: var(--color-singlephase);
    box-shadow: 0 0 8px var(--color-singlephase);
}

.dot-two {
    background-color: var(--color-twophase);
    box-shadow: 0 0 8px var(--color-twophase);
    border-radius: 1px;
    transform: rotate(45deg);
}

.phase-info-block p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.phase-info-block ul {
    list-style-type: none;
    padding-left: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.phase-info-block ul li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.15rem;
}

.phase-info-block ul li::before {
    content: '▪';
    color: var(--accent-teal);
    position: absolute;
    left: 0.2rem;
    font-size: 0.6rem;
    top: 1px;
}

.icon-inline {
    width: 1.1rem;
    height: 1.1rem;
}

.border-top-dash {
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    padding-top: 1.5rem;
}

.light-theme .border-top-dash {
    border-top-color: rgba(15, 23, 42, 0.08);
}

.text-cyan { color: var(--accent-cyan) !important; }
.text-purple { color: var(--color-twophase) !important; }
.text-teal { color: var(--accent-teal) !important; }
.text-amber { color: var(--color-risk-moderate) !important; }

/* Expanded Glossary Styles */
.glossary-section-expanded {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glossary-section-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.75rem;
}

.light-theme .glossary-section-header {
    border-bottom-color: rgba(15, 23, 42, 0.05);
}

.glossary-section-header h3 {
    font-family: var(--font-outfit);
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.glossary-section-header h3 i {
    color: var(--accent-teal);
}

.glossary-section-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Light Theme overrides for expanded cards */
.light-theme .ref-card {
    background-color: #ffffff;
}

.light-theme .glossary-section-expanded {
    background-color: #ffffff;
}

/* Risk Level Definitions (Reference Guide) */
.risk-levels-card {
    grid-column: 1 / -1;
}

.risk-levels-intro {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.risk-level-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.risk-level-item {
    display: flex;
    gap: 1.25rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
}

.risk-level-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.risk-level-indicator {
    width: 1.65rem;
    min-width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #040812;
    font-weight: 900;
    line-height: 1;
}

.light-theme .risk-level-indicator { color: #ffffff; }
.risk-level-indicator.risk-low   { background: var(--color-risk-low); }
.risk-level-indicator.risk-moderate { background: var(--color-risk-moderate); border-radius: 3px; transform: rotate(45deg); }
.risk-level-indicator.risk-elevated  { background: var(--color-risk-elevated); clip-path: polygon(50% 0, 100% 100%, 0 100%); border-radius: 0; }
.risk-level-indicator.risk-high { background: var(--color-risk-high); border-radius: 3px; }
.risk-level-indicator.risk-not-tested   { background: var(--color-risk-not-tested); border-radius: 999px; height: 0.45rem; margin-top: 0.6rem; }

.risk-level-indicator::after { font-size: 0.78rem; }
.risk-level-indicator.risk-low::after { content: '\2713'; }
.risk-level-indicator.risk-moderate::after { content: '!'; transform: rotate(-45deg); }
.risk-level-indicator.risk-elevated::after { content: '\25B2'; font-size: 0.58rem; transform: translateY(0.24rem); }
.risk-level-indicator.risk-high::after { content: '\00D7'; font-size: 1.1rem; }

.risk-level-content {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.risk-level-name {
    font-family: var(--font-outfit);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.risk-level-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.risk-level-eval {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.025);
    border-radius: var(--border-radius-sm);
    border-left: 2px solid var(--border-color-hover);
}

.light-theme .risk-level-eval {
    background: rgba(15, 23, 42, 0.03);
}

.risk-level-eval strong {
    color: var(--text-primary);
}

/* -------------------------------------------------------------
 * Phase 2 CSS additions: Heatmap, Advisor, Compare & Analytics
 * ------------------------------------------------------------- */

/* --- Heatmap Matrix Grid Styles --- */
.heatmap-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.light-theme .heatmap-card {
    background-color: #ffffff;
}
.heatmap-header h2 {
    font-family: var(--font-outfit);
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.heatmap-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.heatmap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}
.legend-dot.risk-low { background-color: var(--color-risk-low); border-radius: 50%; }
.legend-dot.risk-moderate { background-color: var(--color-risk-moderate); border-radius: 2px; transform: rotate(45deg); }
.legend-dot.risk-elevated { background-color: var(--color-risk-elevated); border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.legend-dot.risk-high { background-color: var(--color-risk-high); border-radius: 2px; }
.legend-dot.risk-not-tested { background-color: var(--color-risk-not-tested); height: 4px; border-radius: 999px; }

.heatmap-scroll-container {
    overflow: auto;
    width: 100%;
    max-height: max(480px, calc(100vh - 6rem));
    overscroll-behavior: contain;
}
.heatmap-table {
    width: 100%;
    min-width: 860px;
    border-collapse: separate;
    border-spacing: 0;
}
.heatmap-table th, .heatmap-table td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
}
.heatmap-table th {
    background-color: var(--bg-table-head);
    font-family: var(--font-outfit);
    font-weight: 600;
    color: var(--text-primary);
}
.heatmap-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    vertical-align: bottom;
}
.heatmap-table th.row-label {
    position: sticky;
    left: 0;
    z-index: 1;
    background-color: var(--bg-surface-solid);
}
.heatmap-table thead th.axis-label {
    left: 0;
    z-index: 3;
}
.heatmap-table th.axis-label {
    text-align: left;
    padding-left: 1rem;
    font-size: 0.85rem;
}
.heatmap-table th.row-label {
    text-align: left;
    padding: 0.35rem 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 220px;
}
.heatmap-cell {
    padding: 0 !important;
    font-weight: 700;
    font-size: 0.75rem;
    transition: box-shadow 0.2s;
    height: 72px;
}
.heatmap-cell:hover {
    box-shadow: inset 0 0 0 2px currentColor;
}
.heatmap-cell.cell-risk-low {
    background-color: var(--color-risk-low-bg);
    background-image: none;
    color: var(--color-risk-low);
    border: 1px solid var(--color-risk-low-border);
}
.heatmap-cell.cell-risk-moderate {
    background-color: var(--color-risk-moderate-bg);
    background-image: none;
    color: var(--color-risk-moderate);
    border: 1px solid var(--color-risk-moderate-border);
}
.heatmap-cell.cell-risk-elevated {
    background-color: var(--color-risk-elevated-bg);
    background-image: none;
    color: var(--color-risk-elevated);
    border: 1px solid var(--color-risk-elevated-border);
}
.heatmap-cell.cell-risk-high {
    background-color: var(--color-risk-high-bg);
    background-image: none;
    color: var(--color-risk-high);
    border: 1px solid var(--color-risk-high-border);
}
.heatmap-cell.cell-risk-not-tested {
    background-color: var(--color-risk-not-tested-bg);
    background-image: none;
    background-size: 8px 8px;
    color: var(--color-risk-not-tested);
    border: 1px solid var(--color-risk-not-tested-border);
}

.heatmap-cell-label,
.heatmap-cell-coverage {
    display: block;
}

.heatmap-cell-coverage {
    margin-top: 0.15rem;
    font-size: 0.65rem;
    font-weight: 600;
    opacity: 0.78;
}

/* --- Side-by-Side Comparison View Styles --- */
.compare-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.light-theme .compare-card {
    background-color: #ffffff;
}
.compare-header h2 {
    font-family: var(--font-outfit);
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.compare-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.compare-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.compare-mode-toggle {
    display: inline-flex;
    align-self: flex-start;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 0.25rem;
    gap: 0.25rem;
}
.compare-mode-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-outfit);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.compare-mode-btn:hover {
    color: var(--text-primary);
}
.compare-mode-btn.active {
    background: var(--accent-gradient);
    color: #040812;
}
.compare-mode-btn i {
    width: 1rem;
    height: 1rem;
}

.compare-picker-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.compare-picker-group {
    flex: 1 1 260px;
    min-width: 220px;
}
.compare-picker-row .btn {
    flex-shrink: 0;
}

.compare-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.compare-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--accent-teal-glow);
    border: 1px solid rgba(20, 184, 166, 0.3);
    color: var(--accent-teal);
    font-family: var(--font-outfit);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.5rem 0.4rem 0.85rem;
    border-radius: 20px;
}
.compare-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.15rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}
.compare-chip-remove:hover {
    background-color: rgba(20, 184, 166, 0.25);
}
.compare-chip-remove i {
    width: 0.85rem;
    height: 0.85rem;
}

.compare-empty-state {
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.85rem;
}
.compare-empty-state i {
    width: 2.5rem;
    height: 2.5rem;
}

.compare-scroll-container {
    overflow-x: auto;
    width: 100%;
}
.compare-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}
.compare-table th, .compare-table td {
    padding: 0.75rem 0.6rem;
    text-align: center;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    vertical-align: middle;
}
.compare-table th {
    background-color: rgba(255, 255, 255, 0.02);
    font-family: var(--font-outfit);
    font-weight: 600;
    color: var(--text-primary);
}
.light-theme .compare-table th {
    background-color: rgba(15, 23, 42, 0.02);
}
.compare-table th.axis-label {
    text-align: left;
    padding-left: 1rem;
    font-size: 0.85rem;
}
.compare-table th.row-label {
    text-align: left;
    padding-left: 1rem;
    font-weight: 600;
    font-size: 0.85rem;
}
.compare-cell {
    padding: 0 !important;
    transition: box-shadow 0.2s;
    min-width: 140px;
}
.compare-cell:hover {
    box-shadow: inset 0 0 0 2px currentColor;
}
.compare-cell-label {
    display: block;
    font-weight: 700;
    font-size: 0.78rem;
}
.compare-cell-count {
    display: block;
    font-size: 0.68rem;
    opacity: 0.75;
    margin-top: 0.1rem;
}

.compare-cell-coverage {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.82;
}
.compare-cell-mechanisms {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.4rem;
}
.compare-cell.cell-risk-low {
    background-color: var(--color-risk-low-bg);
    background-image: none;
    color: var(--color-risk-low);
    border: 1px solid var(--color-risk-low-border);
}
.compare-cell.cell-risk-moderate {
    background-color: var(--color-risk-moderate-bg);
    background-image: none;
    color: var(--color-risk-moderate);
    border: 1px solid var(--color-risk-moderate-border);
}
.compare-cell.cell-risk-elevated {
    background-color: var(--color-risk-elevated-bg);
    background-image: none;
    color: var(--color-risk-elevated);
    border: 1px solid var(--color-risk-elevated-border);
}
.compare-cell.cell-risk-high {
    background-color: var(--color-risk-high-bg);
    background-image: none;
    color: var(--color-risk-high);
    border: 1px solid var(--color-risk-high-border);
}
.compare-cell.cell-risk-not-tested {
    background-color: var(--color-risk-not-tested-bg);
    background-image: none;
    background-size: 8px 8px;
    color: var(--color-risk-not-tested);
    border: 1px solid var(--color-risk-not-tested-border);
}

/* --- System Advisor Wizard Styles --- */
.advisor-wizard-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .advisor-wizard-grid {
        grid-template-columns: 1fr;
    }
}
.advisor-selection-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}
.light-theme .advisor-selection-card {
    background-color: #ffffff;
}
.advisor-selection-card h2, .advisor-report-card h2 {
    font-family: var(--font-outfit);
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.advisor-selection-card .description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}
.margin-bottom-md { margin-bottom: 1.25rem; }
.margin-top-sm { margin-top: 0.75rem; }
.margin-top-md { margin-top: 1.25rem; }
.padding-top-md { padding-top: 1.25rem; }
.width-full { width: 100%; }

.advisor-report-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
}
.light-theme .advisor-report-card {
    background-color: #ffffff;
}
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.85rem;
    margin-bottom: 1.25rem;
}
.report-status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.3rem 0.85rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.report-status-badge.neutral { background-color: var(--border-color); color: var(--text-secondary); }
.report-status-badge.good { background-color: var(--color-risk-low-bg); color: var(--color-risk-low); border: 1px solid var(--color-risk-low-border); }
.report-status-badge.warning { background-color: var(--color-risk-moderate-bg); color: var(--color-risk-moderate); border: 1px solid var(--color-risk-moderate-border); }
.report-status-badge.elevated { background-color: var(--color-risk-elevated-bg); color: var(--color-risk-elevated); border: 1px solid var(--color-risk-elevated-border); }
.report-status-badge.danger { background-color: var(--color-risk-high-bg); color: var(--color-risk-high); border: 1px solid var(--color-risk-high-border); }
.report-status-badge.neutral::before { content: '\2014'; }
.report-status-badge.good::before { content: '\2713'; }
.report-status-badge.warning::before { content: '!'; }
.report-status-badge.elevated::before { content: '\25B2'; font-size: 0.68em; }
.report-status-badge.danger::before { content: '\00D7'; font-size: 1.2em; }

.advisor-score-section {
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--border-radius-lg);
}
.light-theme .advisor-score-section {
    background: rgba(15, 23, 42, 0.015);
}
.advisor-risk-counts {
    display: grid;
    grid-template-columns: repeat(5, minmax(74px, 1fr));
    gap: 0.55rem;
    flex: 1;
}

.advisor-risk-count {
    display: flex;
    min-height: 72px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.45rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-input);
}

.advisor-risk-count.risk-low { border: 1px solid var(--color-risk-low-border); }
.advisor-risk-count.risk-moderate { border: 1px solid var(--color-risk-moderate-border); }
.advisor-risk-count.risk-elevated { border: 1px solid var(--color-risk-elevated-border); }
.advisor-risk-count.risk-high { border: 1px solid var(--color-risk-high-border); }
.advisor-risk-count.risk-untested { border: 1px solid var(--color-risk-not-tested-border); }

.advisor-risk-count-value {
    font-family: var(--font-outfit);
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
}

.risk-low .advisor-risk-count-value { color: var(--color-risk-low); }
.risk-moderate .advisor-risk-count-value { color: var(--color-risk-moderate); }
.risk-elevated .advisor-risk-count-value { color: var(--color-risk-elevated); }
.risk-high .advisor-risk-count-value { color: var(--color-risk-high); }
.risk-untested .advisor-risk-count-value { color: var(--color-risk-not-tested); }

.advisor-risk-count-label {
    margin-top: 0.3rem;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: center;
    line-height: 1.15;
}
.score-stats {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
    min-width: 170px;
    justify-content: center;
}
.score-stats strong {
    color: var(--text-primary);
}

@media (max-width: 700px) {
    .advisor-score-section {
        flex-direction: column;
    }

    .advisor-risk-counts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .advisor-risk-count:last-child {
        grid-column: 1 / -1;
    }
}

.empty-advisor-state {
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.85rem;
}
.empty-advisor-state i {
    width: 2.5rem;
    height: 2.5rem;
}
.advisor-table-container {
    width: 100%;
    overflow-x: auto;
}
.advisor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.advisor-table th, .advisor-table td {
    padding: 0.65rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.advisor-table th {
    font-family: var(--font-outfit);
    font-weight: 600;
    color: var(--text-secondary);
}
.btn-remove-component {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}
.btn-remove-component:hover {
    color: var(--color-risk-high);
}
.advisor-warning-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.25rem;
}
.warning-alert-card {
    display: flex;
    gap: 0.75rem;
    background-color: var(--color-risk-high-bg);
    border: 1px solid var(--color-risk-high-border);
    padding: 1rem;
    border-radius: var(--border-radius-md);
    color: var(--color-risk-high);
    font-size: 0.8rem;
    line-height: 1.45;
}
.warning-alert-card.warning-amber {
    background-color: var(--color-risk-moderate-bg);
    border: 1px solid var(--color-risk-moderate-border);
    color: var(--color-risk-moderate);
}
.warning-alert-card.warning-orange {
    background-color: var(--color-risk-elevated-bg);
    border: 1px solid var(--color-risk-elevated-border);
    color: var(--color-risk-elevated);
}
.alert-icon {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    margin-top: 1px;
}
.alert-text-box h5 {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}


/* --- Analytics & Metrics Dashboard Styles --- */
.analytics-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}
@media (max-width: 1024px) {
    .analytics-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .analytics-stats-grid {
        grid-template-columns: 1fr;
    }
}
.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}
.light-theme .stat-card {
    background-color: #ffffff;
}
.stat-card:hover {
    transform: translateY(-2px);
}
.stat-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background-color: var(--accent-teal-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-teal);
    flex-shrink: 0;
}
.stat-content {
    display: flex;
    flex-direction: column;
}
.stat-num {
    font-family: var(--font-outfit);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.analytics-charts-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 1.5rem;
}
.analytics-charts-grid .chart-card:nth-child(3) {
    grid-column: 1 / -1;
}
@media (max-width: 1024px) {
    .analytics-charts-grid {
        grid-template-columns: 1fr;
    }
    .analytics-charts-grid .chart-card:nth-child(3) {
        grid-column: auto;
    }
}
.chart-subnote {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: -0.75rem;
}
.chart-subnote a {
    color: var(--accent-teal);
}
.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.light-theme .chart-card {
    background-color: #ffffff;
}
.chart-card h3 {
    font-family: var(--font-outfit);
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.65rem;
}
.coverage-gap-card {
    margin-top: 1.5rem;
}
.coverage-gap-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}
.coverage-gap-heading h3 {
    margin-bottom: 0.35rem;
}
.coverage-gap-key {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
}
.coverage-gap-intro {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: -0.45rem;
}
.coverage-gap-table-wrap {
    overflow-x: auto;
}
.coverage-gap-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 540px;
}
.coverage-gap-table th,
.coverage-gap-table td {
    text-align: left;
    padding: 0.8rem 0.65rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}
.coverage-gap-table th {
    color: var(--text-secondary);
    font-family: var(--font-outfit);
    font-weight: 600;
}
.coverage-gap-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.coverage-gap-table tbody tr[data-category]:hover,
.coverage-gap-table tbody tr[data-category]:focus-within {
    background: var(--accent-teal-glow);
}
.coverage-gap-count {
    color: var(--color-risk-not-tested);
    font-weight: 700;
}
.evidence-attribution {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.45rem;
    color: var(--accent-teal);
    font-size: 0.72rem;
    font-weight: 600;
}
.evidence-attribution svg {
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 auto;
}
.coverage-progress {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.coverage-progress-track {
    width: min(180px, 55vw);
    height: 0.45rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
}
.coverage-progress-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent-teal);
}
.protocol-library-card {
    grid-column: 1 / -1;
}
.protocol-tabs {
    display: inline-flex;
    gap: 0.35rem;
    margin-top: 1.1rem;
    padding: 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: rgba(15, 23, 42, 0.16);
}
.light-theme .protocol-tabs {
    background: rgba(15, 23, 42, 0.025);
}
.protocol-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    border: none;
    border-radius: var(--border-radius-sm);
    background: none;
    color: var(--text-muted);
    font-family: var(--font-inter);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.protocol-tab svg {
    width: 0.9rem;
    height: 0.9rem;
}
.protocol-tab:hover {
    color: var(--text-primary);
}
.protocol-tab.active {
    background: var(--accent-teal-glow);
    color: var(--accent-teal);
}
.protocol-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}
.protocol-card[hidden] {
    display: none;
}
.protocol-card {
    padding: 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: rgba(15, 23, 42, 0.16);
}
.light-theme .protocol-card {
    background: rgba(15, 23, 42, 0.025);
}
.protocol-card h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
}
.protocol-scope {
    display: inline-block;
    margin-bottom: 0.6rem;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: var(--accent-teal-glow);
    color: var(--accent-teal);
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}
.protocol-card h4 svg {
    width: 1rem;
    height: 1rem;
    color: var(--accent-teal);
}
.protocol-card ul {
    display: grid;
    gap: 0.5rem;
    padding-left: 1.15rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
}
.protocol-card dl {
    display: grid;
    gap: 0.55rem;
}
.protocol-card dl div {
    display: grid;
    grid-template-columns: 8rem 1fr;
    gap: 0.65rem;
    font-size: 0.84rem;
}
.protocol-card dt {
    color: var(--accent-teal);
    font-weight: 700;
}
.protocol-card dd {
    color: var(--text-secondary);
}
.protocol-note {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.76rem;
}
@media (max-width: 700px) {
    .coverage-gap-heading {
        flex-direction: column;
    }
    .protocol-grid {
        grid-template-columns: 1fr;
    }
    .protocol-card dl div {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}
.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

.analytics-charts-grid .chart-card:first-child .chart-container {
    height: 420px;
}

@media (forced-colors: active) {
    .status-badge,
    .report-status-badge,
    .heatmap-cell,
    .compare-cell,
    .advisor-risk-count {
        forced-color-adjust: auto;
        border-color: currentColor !important;
    }

    .legend-dot,
    .risk-level-indicator,
    .phase-dot {
        forced-color-adjust: none;
        background: CanvasText !important;
        color: Canvas !important;
    }
}
.mobile-nav-container {
    display: none;
}
.mobile-filters-trigger-bar {
    display: none;
}
.mobile-filters-apply-box {
    display: none;
}
.btn-close-filters {
    display: none;
}
.filters-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(3, 7, 18, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    transition: opacity 0.3s ease;
}
.filters-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
}
.filter-chevron-icon {
    display: none;
}

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

/* Mobile responsive alignment */
@media (max-width: 768px) {
    /* Container Padding Adjustment */
    .app-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    /* Data card bleeds past the container padding to fill the screen edge-to-edge */
    .data-card {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    /* Inner scroll container adds breathing room for the record cards */
    .table-scroll-container {
        padding: 0.75rem;
    }

    /* Header Compact Layout */
    .app-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        padding-bottom: 0.65rem;
    }
    .logo-area-wrapper {
        gap: 0.4rem;
        align-items: center;
    }
    .btn-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text-secondary);
        width: 36px;
        height: 36px;
        cursor: pointer;
        border-radius: var(--border-radius-sm);
        transition: background-color 0.2s, color 0.2s;
    }
    .btn-menu-toggle:hover {
        background-color: rgba(255, 255, 255, 0.05);
        color: var(--text-primary);
    }
    .light-theme .btn-menu-toggle:hover {
        background-color: rgba(0, 0, 0, 0.03);
    }
    .btn-menu-toggle i {
        width: 1.25rem;
        height: 1.25rem;
    }
    .ocp-logo-container {
        height: 28px;
    }
    .brand-divider {
        height: 18px;
        margin: 0 0.25rem;
    }
    .brand-title {
        font-size: 1.1rem;
    }
    .brand-title-row {
        gap: 0.35rem;
    }
    .beta-badge {
        min-height: 1.15rem;
        padding: 0.1rem 0.38rem;
        font-size: 0.58rem;
    }
    .beta-notice {
        padding: 0.75rem;
        gap: 0.6rem;
    }
    .app-header .subtitle {
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 0.7rem;
        max-width: 160px;
    }
    .btn-theme-toggle {
        width: 36px;
        height: 36px;
    }
    .btn-theme-toggle i {
        width: 1rem;
        height: 1rem;
    }

    /* Mobile Navigation Dropdown */
    .app-nav {
        display: none !important;
    }
    .mobile-nav-container {
        display: block;
        position: relative;
        margin-bottom: 0.5rem;
        width: 100%;
    }
    .mobile-nav-trigger {
        width: 100%;
        background: var(--bg-card);
        backdrop-filter: blur(12px);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-md);
        padding: 0.75rem 1.25rem;
        font-family: var(--font-outfit);
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--text-primary);
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        transition: border-color 0.3s, box-shadow 0.3s;
    }
    .mobile-nav-trigger:hover {
        border-color: var(--accent-teal);
        box-shadow: 0 0 10px rgba(20, 184, 166, 0.15);
    }
    .mobile-nav-trigger span {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .mobile-nav-trigger span i {
        color: var(--accent-teal);
        width: 1.1rem;
        height: 1.1rem;
    }
    .mobile-nav-trigger .chevron-icon {
        width: 1.1rem;
        height: 1.1rem;
        transition: transform 0.3s ease;
        color: var(--text-secondary);
    }
    .mobile-nav-container.open .mobile-nav-trigger .chevron-icon {
        transform: rotate(180deg);
    }
    .mobile-nav-dropdown {
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        right: 0;
        background: var(--bg-card);
        backdrop-filter: blur(20px);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-lg);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
        display: flex;
        flex-direction: column;
        padding: 0.5rem;
        z-index: 150;
        gap: 0.35rem;
    }
    .mobile-nav-dropdown.hidden {
        display: none;
    }
    .mobile-nav-item {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
        background: none;
        border: none;
        text-align: left;
        padding: 0.75rem 1rem;
        border-radius: var(--border-radius-md);
        color: var(--text-secondary);
        font-family: var(--font-inter);
        font-size: 0.85rem;
        font-weight: 500;
        cursor: pointer;
        transition: background-color 0.2s, color 0.2s;
    }
    .mobile-nav-item:hover {
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-primary);
    }
    .light-theme .mobile-nav-item:hover {
        background: rgba(0, 0, 0, 0.03);
    }
    .mobile-nav-item.active {
        background: var(--accent-gradient);
        color: #040812 !important;
    }
    .mobile-nav-item.active i {
        color: #040812 !important;
    }
    .mobile-nav-item i {
        width: 1.1rem;
        height: 1.1rem;
        color: var(--accent-teal);
        flex-shrink: 0;
    }

    /* Mobile Filters Trigger Bar & Counts */
    .mobile-filters-trigger-bar {
        display: flex;
        width: 100%;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
    }
    .mobile-filter-btn {
        flex-grow: 1;
        justify-content: center;
        height: 42px;
    }
    .filter-count-badge {
        background: var(--accent-teal);
        color: #040812;
        border-radius: 50%;
        font-size: 0.7rem;
        font-weight: 700;
        padding: 1px 6px;
        margin-left: 0.4rem;
        display: inline-block;
    }
    .filter-count-badge:empty {
        display: none;
    }
    #btn-mobile-reset-filters {
        height: 42px;
        padding: 0 1rem;
    }

    .attribution-card {
        width: 100%;
    }

    /* Toolbar Actions Split Grid */
    .results-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .toolbar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        width: 100%;
    }
    .export-dropdown-wrapper {
        width: 100%;
    }
    .btn-export {
        width: 100%;
        padding: 0.75rem 1rem;
    }
    .export-menu {
        width: 100%;
    }
    .btn-primary.btn-glow {
        width: 100%;
        padding: 0.75rem 1rem;
    }

    /* Compact record cards: material + result up top, only non-empty details below */
    .table-scroll-container {
        max-height: none;
        overflow: visible;
    }
    .compatibility-table,
    .compatibility-table tbody {
        display: block;
    }
    .compatibility-table thead {
        display: none; /* Hide headers row */
    }
    .compatibility-table tbody tr.record-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 0.75rem;
        row-gap: 0.2rem;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius-md);
        margin-bottom: 0.75rem;
        padding: 0.85rem 1rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    }
    .light-theme .compatibility-table tbody tr.record-row {
        background: #ffffff;
    }
    .compatibility-table tbody tr.empty-row,
    .compatibility-table tbody tr.empty-row td {
        display: block;
    }
    .compatibility-table tbody tr.record-row td {
        display: flex;
        align-items: baseline;
        gap: 0.6rem;
        grid-column: 1 / -1;
        padding: 0.15rem 0 0;
        border: none;
        font-size: 0.82rem;
        text-align: left;
        min-width: 0;
    }
    .compatibility-table tbody tr.record-row td.cell-empty {
        display: none !important;
    }
    .compatibility-table tbody tr.record-row td::before {
        content: attr(data-label);
        flex: 0 0 6.25rem;
        font-weight: 700;
        color: var(--text-secondary);
        text-transform: uppercase;
        font-size: 0.66rem;
        letter-spacing: 0.05em;
    }
    /* Card header: material name, fluid family, and the result badge */
    .compatibility-table tbody tr.record-row td[data-col="material"] {
        grid-column: 1;
        grid-row: 1;
        padding: 0;
        font-size: 1rem;
        font-weight: 700;
    }
    .compatibility-table tbody tr.record-row td[data-col="fluid"] {
        grid-column: 1;
        grid-row: 2;
        position: static;
        padding: 0;
        background: none;
        box-shadow: none;
        color: var(--text-secondary);
    }
    .compatibility-table tbody tr.record-row td[data-col="fluid"] strong {
        font-weight: 600;
    }
    .compatibility-table tbody tr.record-row td[data-col="compatibility"] {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: start;
        padding: 0;
    }
    .compatibility-table tbody tr.record-row td[data-col="material"]::before,
    .compatibility-table tbody tr.record-row td[data-col="fluid"]::before,
    .compatibility-table tbody tr.record-row td[data-col="compatibility"]::before {
        display: none;
    }
    .compatibility-table tbody tr.record-row .status-badge {
        width: auto;
        white-space: nowrap;
    }
    /* Detail rows, in reading order */
    .compatibility-table tbody tr.record-row td[data-col="application"] {
        order: 1;
        margin-top: 0.45rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }
    .compatibility-table tbody tr.record-row td[data-col="class"] { order: 2; }
    .compatibility-table tbody tr.record-row td[data-col="phase"] { order: 3; }
    .compatibility-table tbody tr.record-row td[data-col="mechanisms"] { order: 4; }
    .compatibility-table tbody tr.record-row td[data-col="properties"] { order: 5; }
    .compatibility-table tbody tr.record-row td[data-col="remarks"] {
        order: 6;
        display: block;
        max-width: none !important;
    }
    .compatibility-table tbody tr.record-row td[data-col="remarks"]::before {
        display: block;
        margin-bottom: 0.1rem;
    }
    .compatibility-table .cell-stack {
        display: inline;
    }
    .compatibility-table .cell-stack .cell-subtext {
        display: inline;
        margin-left: 0.3rem;
    }
    .compatibility-table .cell-stack .cell-subtext::before {
        content: '\00B7\00A0';
    }
    .app-footer {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .app-header .subtitle {
        display: none;
    }
    .brand-title {
        font-size: 1rem;
    }
    .modal-overlay {
        padding: 0.5rem;
    }
    .modal-form {
        padding: 1rem;
        gap: 1rem;
    }
}

/* -------------------------------------------------------------
 * Usability pass: utilities, landmarks & focus
 * ------------------------------------------------------------- */
.hidden:not(.modal-overlay):not(.filters-backdrop):not(.drawer-overlay):not(.mobile-nav-dropdown):not(.app-view) {
    display: none !important;
}

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

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

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

.skip-link {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2000;
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-md);
    background: var(--accent-teal);
    color: #040812;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-200%);
    transition: transform 0.15s ease;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

.app-main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    outline: none;
}

.btn:focus-visible,
.nav-item:focus-visible,
.mobile-nav-item:focus-visible,
.export-option:focus-visible,
.pagination-btn:focus-visible,
.compare-mode-btn:focus-visible,
.compare-chip-remove:focus-visible,
.clear-search-btn:focus-visible,
.modal-close-btn:focus-visible,
.btn-remove-component:focus-visible,
.glossary-view-records-btn:focus-visible,
.beta-notice-toggle:focus-visible,
.filter-chip:focus-visible,
.filter-chip-clear:focus-visible,
.record-link:focus-visible,
.protocol-tab:focus-visible,
.coverage-gap-btn:focus-visible {
    outline: 2px solid var(--accent-teal);
    outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* -------------------------------------------------------------
 * Database table: record links, compact cells, column visibility
 * ------------------------------------------------------------- */
.record-link {
    padding: 0;
    border: none;
    background: none;
    color: var(--text-primary);
    font: inherit;
    font-weight: 600;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: var(--border-color-hover);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    cursor: pointer;
}

.record-link:hover {
    color: var(--accent-teal);
    text-decoration-color: currentColor;
}

.compatibility-table tbody tr.record-row:hover td[data-col="fluid"] {
    background-color: color-mix(in srgb, var(--accent-teal) 8%, var(--bg-surface-solid));
}

.cell-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.cell-stack {
    display: flex;
    flex-direction: column;
}

.cell-subtext {
    font-size: 0.72rem;
}

.remarks-cell {
    font-size: 0.8rem;
    max-width: 320px;
}

.provisional-flag {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    cursor: help;
}

.provisional-flag svg {
    width: 0.8rem;
    height: 0.8rem;
}

.compatibility-table.hide-col-phase [data-col="phase"],
.compatibility-table.hide-col-class [data-col="class"],
.compatibility-table.hide-col-properties [data-col="properties"],
.compatibility-table.hide-col-mechanisms [data-col="mechanisms"],
.compatibility-table.hide-col-remarks [data-col="remarks"] {
    display: none !important;
}

.dropdown-menu-note {
    padding: 0.35rem 0.6rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.column-menu {
    width: 250px;
}

.column-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
}

.column-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.light-theme .column-option:hover {
    background-color: rgba(15, 23, 42, 0.04);
}

.column-option input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent-teal);
}

/* Active filter chips */
.active-filter-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: -0.5rem;
}

.active-filter-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.active-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.55rem 0.3rem 0.75rem;
    border: 1px solid rgba(20, 184, 166, 0.35);
    border-radius: 999px;
    background-color: var(--accent-teal-glow);
    color: var(--text-primary);
    font-family: var(--font-inter);
    font-size: 0.78rem;
    cursor: pointer;
}

.filter-chip:hover {
    border-color: var(--accent-teal);
}

.filter-chip-key {
    color: var(--accent-teal);
    font-weight: 700;
}

.filter-chip svg {
    width: 0.8rem;
    height: 0.8rem;
    color: var(--text-secondary);
}

.filter-chip-clear {
    padding: 0.3rem 0.5rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.16em;
    cursor: pointer;
}

.filter-chip-clear:hover {
    color: var(--text-primary);
}

.empty-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.empty-suggestion-count {
    color: var(--text-muted);
    font-weight: 500;
}

/* -------------------------------------------------------------
 * Heatmap: category rows, distribution bars, material drill-down
 * ------------------------------------------------------------- */
.heatmap-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.legend-symbol {
    font-weight: 800;
    width: 0.8rem;
    text-align: center;
}

.heatmap-table thead th {
    min-width: 128px;
}

.heatmap-fluid-name {
    display: block;
    margin-bottom: 0.3rem;
    line-height: 1.25;
}

.heatmap-expand-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    background: none;
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.heatmap-expand-btn:hover {
    background-color: var(--accent-teal-glow);
}

.heatmap-expand-btn:focus-visible,
.heatmap-cell-btn:focus-visible,
.compare-cell-btn:focus-visible,
.matrix-select-btn:focus-visible {
    outline: 2px solid var(--accent-teal);
    outline-offset: -3px;
}

.heatmap-expand-btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--accent-teal);
    transition: transform 0.2s ease;
}

.heatmap-expand-btn[aria-expanded="true"] svg {
    transform: rotate(90deg);
}

.heatmap-row-text {
    display: flex;
    flex-direction: column;
}

.heatmap-row-count {
    color: var(--text-muted);
    font-family: var(--font-inter);
    font-size: 0.7rem;
    font-weight: 500;
}

.heatmap-cell-btn,
.compare-cell-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: 0.55rem 0.5rem;
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.heatmap-cell-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    opacity: 0.7;
}

.risk-distribution {
    display: flex;
    width: 100%;
    max-width: 120px;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    gap: 1px;
    background: var(--border-color);
}

.risk-seg {
    display: block;
    min-width: 3px;
}

.risk-seg.risk-low { background-color: var(--color-risk-low); }
.risk-seg.risk-moderate { background-color: var(--color-risk-moderate); }
.risk-seg.risk-elevated { background-color: var(--color-risk-elevated); }
.risk-seg.risk-high { background-color: var(--color-risk-high); }
.risk-seg.risk-not-tested { background-color: var(--color-risk-not-tested); opacity: 0.55; }

.risk-count-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
}

.risk-count-chip.risk-low { color: var(--color-risk-low); }
.risk-count-chip.risk-moderate { color: var(--color-risk-moderate); }
.risk-count-chip.risk-elevated { color: var(--color-risk-elevated); }
.risk-count-chip.risk-high { color: var(--color-risk-high); }
.risk-count-chip.risk-not-tested { color: var(--color-risk-not-tested); }

.heatmap-material-row th.material-label {
    padding-left: 2.2rem;
    font-family: var(--font-inter);
    font-weight: 500;
}

.heatmap-material-name {
    display: block;
    font-size: 0.8rem;
}

.heatmap-material-sub {
    display: block;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 400;
}

.heatmap-material-cell {
    height: 44px;
}

.heatmap-material-cell .heatmap-cell-btn {
    flex-direction: row;
    gap: 0.35rem;
    padding: 0.35rem;
}

.heatmap-cell-symbol {
    font-weight: 900;
}

/* -------------------------------------------------------------
 * Record detail drawer
 * ------------------------------------------------------------- */
.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: flex;
    justify-content: flex-end;
    background-color: rgba(3, 7, 18, 0.55);
    backdrop-filter: blur(4px);
    /* Become visible immediately on open (so focus can move in), hide only after the fade-out */
    transition: opacity 0.25s ease, visibility 0s linear 0s;
}

.drawer-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

.drawer-panel {
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    height: 100%;
    background: var(--bg-surface-solid);
    border-left: 1px solid var(--border-color-hover);
    box-shadow: -20px 0 50px rgba(0, 0, 0, 0.35);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-overlay.hidden .drawer-panel {
    transform: translateX(100%);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.drawer-eyebrow {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.drawer-header h2 {
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.25;
}

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

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.drawer-result {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: rgba(148, 163, 184, 0.06);
}

.drawer-result .status-badge {
    width: auto;
    font-size: 0.95rem;
}

.drawer-result p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.drawer-section h3 {
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    font-weight: 700;
}

.drawer-section > p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.55;
}

.drawer-dl {
    display: grid;
    gap: 0.5rem;
}

.drawer-dl-row {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    gap: 0.75rem;
    font-size: 0.84rem;
}

.drawer-dl dt {
    color: var(--text-muted);
    font-weight: 600;
}

.drawer-dl dd {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.drawer-link {
    color: var(--accent-teal);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.16em;
}

.drawer-mechanism-list {
    display: grid;
    gap: 0.75rem;
    list-style: none;
}

.drawer-mechanism-list p {
    margin-top: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.drawer-fluid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.drawer-fluid-table th,
.drawer-fluid-table td {
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.drawer-fluid-table thead th {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.drawer-fluid-table tbody th {
    font-weight: 500;
}

.drawer-fluid-table tr.is-current {
    background: var(--accent-teal-glow);
}

.drawer-fluid-table .status-badge {
    width: auto;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
}

.drawer-current-tag {
    margin-left: 0.3rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: var(--accent-teal);
    color: #040812;
    font-size: 0.65rem;
    font-weight: 700;
}

.drawer-footnote {
    margin-top: 0.6rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.drawer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.drawer-actions .btn-primary {
    flex: 1 1 100%;
    text-decoration: none;
}

@media (max-width: 600px) {
    .drawer-panel {
        width: 100%;
        border-left: none;
    }
    .drawer-dl-row {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }
}

/* -------------------------------------------------------------
 * System Advisor: build across all fluids
 * ------------------------------------------------------------- */
.form-hint {
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.74rem;
    line-height: 1.4;
}

.advisor-add-message {
    min-height: 1.2rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.advisor-choose-fluid {
    font-size: 0.78rem;
    font-style: italic;
}

.advisor-fluid-matrix-wrap {
    margin-top: 0.75rem;
    overflow-x: auto;
}

.advisor-fluid-matrix {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.78rem;
}

.advisor-fluid-matrix th,
.advisor-fluid-matrix td {
    padding: 0.45rem 0.4rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    vertical-align: middle;
}

.advisor-fluid-matrix thead th {
    color: var(--text-secondary);
    font-family: var(--font-outfit);
    font-weight: 600;
    line-height: 1.25;
}

.advisor-fluid-matrix tbody th,
.advisor-fluid-matrix tfoot th,
.advisor-fluid-matrix thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 160px;
    background: var(--bg-surface-solid);
    text-align: left;
}

.matrix-component-name {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
}

.matrix-component-sub {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 400;
}

.advisor-fluid-matrix th.is-selected,
.advisor-fluid-matrix td.is-selected {
    box-shadow: inset 2px 0 0 var(--accent-teal), inset -2px 0 0 var(--accent-teal);
}

.advisor-fluid-matrix thead th.is-selected {
    color: var(--accent-teal);
}

.matrix-cell {
    font-weight: 700;
    white-space: nowrap;
}

.matrix-cell.cell-risk-low { background-color: var(--color-risk-low-bg); color: var(--color-risk-low); }
.matrix-cell.cell-risk-moderate { background-color: var(--color-risk-moderate-bg); background-image: none; color: var(--color-risk-moderate); }
.matrix-cell.cell-risk-elevated { background-color: var(--color-risk-elevated-bg); background-image: none; color: var(--color-risk-elevated); }
.matrix-cell.cell-risk-high { background-color: var(--color-risk-high-bg); background-image: none; color: var(--color-risk-high); }
.matrix-cell.cell-risk-not-tested { background-color: var(--color-risk-not-tested-bg); background-image: none; background-size: 8px 8px; color: var(--color-risk-not-tested); }

.matrix-symbol {
    margin-right: 0.25rem;
    font-weight: 900;
}

.advisor-fluid-matrix tfoot td {
    vertical-align: top;
}

.matrix-status {
    display: inline-flex;
    margin-bottom: 0.4rem;
    font-size: 0.62rem;
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
}

.matrix-select-btn {
    display: flex;
    width: 100%;
}

.warning-alert-card.warning-neutral {
    background-color: var(--color-risk-not-tested-bg);
    border: 1px solid var(--color-risk-not-tested-border);
    color: var(--color-risk-not-tested);
}

.advisor-export-bar {
    flex-wrap: wrap;
}

/* -------------------------------------------------------------
 * Analytics & forms
 * ------------------------------------------------------------- */
.coverage-gap-btn {
    padding: 0;
    border: none;
    background: none;
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: var(--border-color-hover);
    text-underline-offset: 0.2em;
    cursor: pointer;
}

.form-group input[type="url"],
.form-group input[type="search"] {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    font-family: var(--font-inter);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input[type="url"]:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 10px rgba(20, 184, 166, 0.15);
}

.form-group-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

#form-fluid-family {
    margin-top: 0.5rem;
}

.form-draft-note {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.form-draft-note svg {
    width: 0.85rem;
    height: 0.85rem;
}

.left-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .active-filter-row {
        margin-top: 0;
    }
    .toolbar-actions {
        grid-template-columns: 1fr 1fr;
    }
    .toolbar-actions #btn-open-contribute {
        grid-column: 1 / -1;
    }
    .column-menu-wrapper .btn-export {
        width: 100%;
    }
    .export-label-extra {
        display: none;
    }
    .column-menu {
        left: 0;
        right: auto;
    }
    .beta-notice {
        padding: 0.55rem 0.65rem;
    }
    .beta-notice-toggle-label {
        display: none;
    }
    .heatmap-table th.row-label {
        min-width: 170px;
    }
    .heatmap-toolbar {
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 0.95rem;
        line-height: 1.2;
    }
}

/* -------------------------------------------------------------
 * Reduced motion
 * ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* -------------------------------------------------------------
 * Print: the current view on white paper, without app chrome
 * ------------------------------------------------------------- */
@media print {
    :root,
    .light-theme {
        --bg-base: #ffffff;
        --bg-card: #ffffff;
        --bg-surface-solid: #ffffff;
        --bg-table-head: #f1f5f9;
        --text-primary: #000000;
        --text-secondary: #333333;
        --text-muted: #555555;
        --border-color: #cbd5e1;
    }

    html,
    body {
        overflow: visible !important;
        background: #ffffff !important;
        color: #000000;
    }

    .gradient-bg-1,
    .gradient-bg-2,
    .skip-link,
    .header-right-controls,
    .app-nav,
    .mobile-nav-container,
    .mobile-filters-trigger-bar,
    .filters-card,
    .filters-backdrop,
    .toolbar-actions,
    .active-filter-row .filter-chip svg,
    .filter-chip-clear,
    .table-pagination-bar,
    .beta-notice-toggle,
    .heatmap-toolbar .btn,
    .heatmap-scroll-hint,
    .compare-controls,
    .advisor-selection-card,
    .advisor-export-bar,
    .matrix-select-btn,
    .analytics-filter-bar,
    .reference-index,
    .modal-overlay,
    .drawer-overlay,
    .footer-attribution {
        display: none !important;
    }

    .beta-notice-details[hidden] {
        display: grid !important;
    }

    .app-container {
        max-width: none;
        padding: 0;
    }

    .data-card,
    .filters-card,
    .heatmap-card,
    .compare-card,
    .advisor-report-card,
    .chart-card,
    .stat-card,
    .ref-card,
    .glossary-section-expanded {
        box-shadow: none !important;
        backdrop-filter: none !important;
        background: #ffffff !important;
        break-inside: auto;
    }

    .advisor-wizard-grid {
        grid-template-columns: 1fr;
    }

    .table-scroll-container,
    .heatmap-scroll-container,
    .compare-scroll-container,
    .advisor-fluid-matrix-wrap {
        max-height: none !important;
        overflow: visible !important;
    }

    .compatibility-table th,
    .heatmap-table th,
    .compatibility-table td[data-col="fluid"] {
        position: static !important;
    }

    .compatibility-table tr,
    .heatmap-table tr {
        break-inside: avoid;
    }

    .status-badge,
    .heatmap-cell,
    .compare-cell,
    .matrix-cell,
    .risk-seg,
    .report-status-badge {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .record-link,
    .coverage-gap-btn {
        text-decoration: none;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.7em;
        color: #555555;
        word-break: break-all;
    }
}

/* -------------------------------------------------------------
 * Wrapping fixes: nav, table headers, drawer header actions
 * ------------------------------------------------------------- */
/* Between tablet and small-laptop widths the tabs show icons only (label stays for screen readers, full name on hover) */
@media (min-width: 769px) and (max-width: 980px) {
    .app-nav .nav-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    .app-nav .nav-item {
        padding: 0.6rem 0.85rem;
    }
}

/* Short headers on one line, with the sort arrow right beside its label */
.compatibility-table th {
    white-space: nowrap;
}

.sort-btn {
    gap: 0.35rem;
}

.sort-btn .sort-icon {
    margin-left: 0;
}

/* Badges never break mid-word (e.g. SINGLE- / PHASE) */
.phase-badge,
.status-badge {
    white-space: nowrap;
}

/* Record drawer header: copy-link + close icon buttons */
.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.drawer-copy-status {
    color: var(--accent-teal);
    font-size: 0.75rem;
    font-weight: 600;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

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

.icon-btn svg {
    width: 1.1rem;
    height: 1.1rem;
}

.icon-btn:focus-visible,
.modal-close-btn:focus-visible {
    outline: 2px solid var(--accent-teal);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

#record-drawer-title:focus {
    outline: none;
}

.drawer-inline-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.75rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--accent-teal);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.16em;
    cursor: pointer;
}

.drawer-inline-action svg {
    width: 0.9rem;
    height: 0.9rem;
}

.drawer-inline-action:focus-visible {
    outline: 2px solid var(--accent-teal);
    outline-offset: 2px;
}

@media print {
    .drawer-header-actions,
    .drawer-inline-action {
        display: none !important;
    }
}

/* Compact database: related fields share cells; the page owns vertical scrolling. */
html, body { overflow-x: clip; }
.app-container { max-width: 1840px; padding: 18px 28px; gap: 14px; }
.app-header { padding-bottom: 10px; }
.brand-title { font-size: 1.3rem; }
.app-header .subtitle { font-size: .75rem; }
.ocp-logo-container { height: 30px; }
.app-nav { background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 0; gap: 10px; }
.app-nav .nav-item { font-size: .86rem; padding: 8px 14px; }
.app-nav svg { width: 18px; height: 18px; }
.beta-notice { padding: 7px 12px; border-radius: 6px; }
.beta-notice p { font-size: .72rem; }
.header-right-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-right-controls #btn-open-contribute { padding: 8px 12px; min-height: 36px; font-size: .78rem; box-shadow: none; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); }
.header-right-controls #btn-open-contribute svg { width: 16px; height: 16px; }
#view-database { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
#view-database.hidden { display: none; }
#view-database .filters-card { position: static; padding: 0; background: none; box-shadow: none; border: 0; border-radius: 0; backdrop-filter: none; width: 100%; transform: none; max-height: none; }
#view-database .filters-grid { display: grid; grid-template-columns: minmax(150px,1.05fr) repeat(5,minmax(0,1fr)) auto; gap: 10px; align-items: end; overflow: visible; padding: 0; margin: 0; }
#view-database .filter-group { min-width: 0; gap: 5px; }
#view-database .filter-group label { font-size: .74rem; letter-spacing: 0; }
#view-database .filter-group select { width: 100%; min-height: 38px; font-size: .78rem; padding: 8px 25px 8px 10px; border-radius: 6px; }
#view-database .search-group input { height: 38px; font-size: .78rem; padding: 8px 28px 8px 30px; border-radius: 6px; }
#view-database .search-icon { left: 10px; width: 14px; height: 14px; }
#view-database .clear-search-btn { right: 5px; }
#view-database #btn-reset-filters { height: 38px; padding: 0 10px; border: 1px solid var(--border-color); background: none; color: var(--text-secondary); font-size: .76rem; }
#view-database .active-filter-row { margin: 0; }
#view-database .data-card { overflow: visible; border-radius: 8px; box-shadow: none; backdrop-filter: none; background: var(--bg-surface-solid); }
#view-database .results-toolbar { min-height: 38px; padding: 3px 16px; border-bottom: 1px solid var(--border-color); gap: 8px; }
#view-database .results-stats { flex-wrap: wrap; font-size: .77rem; gap: 6px; color: var(--text-secondary); }
#view-database .toolbar-actions { gap: 7px; }
#view-database .toolbar-actions .btn { min-height: 30px; padding: 4px 6px; font-size: .77rem; border: 0; background: transparent; box-shadow: none; }
#view-database .toolbar-actions svg { width: 15px; height: 15px; }
#view-database .export-menu { z-index: 20; }
#view-database .table-scroll-container { overflow: visible; max-height: none; overscroll-behavior: auto; }
#data-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; }
#data-table thead { position: sticky; top: 0; z-index: 5; }
#data-table th { position: static; letter-spacing: 0; text-transform: none; font-size: .74rem; border-bottom: 1px solid var(--border-color); }
#data-table th[data-col="material"] { width: 22%; }
#data-table th[data-col="class"] { width: 13%; }
#data-table th[data-col="fluid"] { width: 18%; box-shadow: none; }
#data-table th[data-col="compatibility"] { width: 18%; }
#data-table th[data-col="properties"] { width: 15%; }
#data-table th[data-col="mechanisms"] { width: 14%; padding: 7px 12px; }
#data-table th .sort-btn { padding: 7px 12px; min-height: 34px; font: inherit; line-height: 18px; gap: 6px; white-space: normal; text-align: left; justify-content: flex-start; }
#data-table .sort-icon svg { width: 13px; height: 13px; }
#data-table td { position: static; padding: 13px 12px; vertical-align: top; box-shadow: none; font-size: .82rem; border-bottom: 1px solid var(--border-color); background: transparent; overflow-wrap: anywhere; }
#data-table tbody tr:nth-child(even) { background: rgba(148,163,184,.035); }
#data-table tbody tr.record-row:hover { background: var(--accent-teal-glow); }
#data-table tbody tr.record-row:hover td[data-col="fluid"] { background: transparent; }
#data-table .record-link { color: var(--text-primary); font-size: .88rem; line-height: 1.5; font-weight: 650; text-decoration: none; }
#data-table .record-link:hover { text-decoration: underline; color: var(--accent-teal); }
.reading-application { margin-top: 4px; color: var(--text-secondary); font-size: .76rem; font-weight: 400; }
#data-table td[data-col="fluid"] strong { font-weight: 450; line-height: 1.5; }
.reading-phase { color: var(--text-muted); margin-top: 6px; font-size: .69rem; }
#data-table .status-badge { width: auto; border-radius: 5px; font-size: .78rem; padding: 3px 9px; }
.reading-note { font-size: .71rem; line-height: 1.5; color: var(--text-secondary); margin-top: 9px; }
#data-table td[data-col="class"], #data-table td[data-col="properties"], #data-table td[data-col="mechanisms"] { font-size: .75rem; line-height: 1.45; }
#data-table .cell-subtext { font-size: .69rem; }
#data-table .mechanism-chip { white-space: normal; font-size: .68rem; padding: 3px 6px; }
#view-database .table-pagination-bar { padding: 12px; }
#mobile-sort, #mobile-inline-filters { display: none; }
.density-control { display: inline-flex; padding: 2px; border: 1px solid var(--border-color); border-radius: 5px; }
.density-control button { border: 0; background: none; color: var(--text-muted); padding: 4px 8px; border-radius: 3px; font: inherit; font-size: .69rem; cursor: pointer; }
.density-control button[aria-pressed="true"] { background: var(--accent-teal-glow); color: var(--accent-teal); }
.density-control button:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 1px; }
#sort-status { margin-left: 12px; padding-left: 14px; border-left: 1px solid var(--border-color); color: var(--text-muted); font-size: .72rem; }
#btn-reset-sort { color: var(--text-secondary); white-space: nowrap; }
#btn-reset-sort:disabled { opacity: .4; cursor: default; }
#btn-reset-sort:focus-visible { outline: 2px solid var(--accent-teal); outline-offset: 2px; }
@media(min-width:769px) {
    .compact-records #data-table td { padding-top: 8px; padding-bottom: 8px; vertical-align: middle; }
    .compact-records .reading-application, .compact-records .reading-phase { margin-top: 1px; }
    .compact-records .reading-note { margin-top: 4px; }
    .compact-records #data-table .record-link { font-size: .84rem; }
}
@media(min-width:769px) and (max-width:1100px) {
    .app-container { padding: 16px; }
    #view-database .filters-grid { grid-template-columns: repeat(3,minmax(0,1fr)) auto; gap: 12px; }
    #view-database #btn-reset-filters { grid-column: 4; grid-row: 1 / 3; align-self: end; }
    .app-nav .nav-label { position: static; width: auto; height: auto; clip: auto; overflow: visible; }
}
@media(max-width:768px) {
    .app-container { padding: 12px; gap: 10px; }
    .app-header { flex-wrap: nowrap; gap: 8px; padding-bottom: 8px; }
    .logo-area-wrapper { min-width: 0; gap: 7px; }
    .brand-title { font-size: .9rem; line-height: 1.25; }
    .brand-title-row { align-items: flex-start; }
    .app-header .subtitle, .brand-divider { display: none; }
    .ocp-logo-container { height: 24px; }
    .header-right-controls { margin: 0; }
    .mobile-nav-container { display: flex; gap: 8px; margin: 0; }
    .mobile-nav-trigger { flex: 1; min-width: 0; padding: 8px 10px; min-height: 44px; }
    .mobile-nav-container #btn-open-contribute { min-height: 44px; padding: 8px 10px; font-size: .76rem; white-space: nowrap; background: none; }
    .mobile-nav-container #btn-open-contribute svg { width: 15px; height: 15px; }
    .beta-notice { padding: 8px; gap: 7px; }
    .beta-notice p { font-size: .65rem; line-height: 1.45; }
    .beta-notice-icon { width: 14px; height: 14px; }
    .beta-notice-toggle { min-width: 36px; min-height: 36px; }
    #view-database .filters-card { z-index: auto; }
    #view-database .filters-grid { display: grid !important; grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
    #view-database .filters-grid > .filter-group:not(.search-group), #view-database .filters-grid #btn-reset-filters { display: none; }
    #view-database .search-group label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
    #view-database .search-group input { height: 44px; font-size: 16px; }
    #mobile-inline-filters { display: inline-flex; min-height: 44px; padding: 8px 12px; font-size: .8rem; white-space: nowrap; }
    #view-database .mobile-filters-open .filters-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    #view-database .mobile-filters-open .filter-group:not(.search-group) { display: flex; }
    #view-database .mobile-filters-open #btn-reset-filters { display: inline-flex; min-height: 44px; }
    #view-database .filter-group select { min-height: 44px; font-size: 16px; }
    #view-database .data-card { background: none; border: 0; margin: 0; }
    #view-database .results-toolbar { display: grid; grid-template-columns: 1fr auto; padding: 0 0 10px; gap: 6px; }
    #view-database .results-stats { font-size: .78rem; }
    #sort-status, .density-control { display: none; }
    #view-database .toolbar-actions { display: flex; grid-column: 2; grid-row: 1; gap: 8px; width: auto; }
    #view-database .toolbar-actions .btn { min-height: 44px; }
    #mobile-sort { display: block; grid-column: 1 / -1; width: 100%; min-height: 44px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-surface-solid); color: var(--text-primary); padding: 8px 10px; font: inherit; font-size: 16px; }
    #view-database .export-dropdown-wrapper { width: auto; }
    #view-database .export-menu { width: min(300px,calc(100vw - 24px)); }
    #view-database .table-scroll-container { padding: 0; }
    #data-table thead { display: none; }
    #data-table tbody tr.record-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: none; background: var(--bg-surface-solid); }
    #data-table tbody tr.record-row td { display: block; width: auto; min-width: 0; padding: 0; border: 0; font-size: .75rem; font-weight: 400; }
    #data-table tbody tr.record-row td::before { display: none; }
    #data-table tbody tr.record-row td[data-col="material"] { grid-column: 1 / -1; grid-row: 1; padding-right: 98px; }
    #data-table tbody tr.record-row td[data-col="fluid"] { grid-column: 1 / -1; grid-row: 2; font-size: .8rem; }
    #data-table tbody tr.record-row td[data-col="compatibility"] { display: contents; }
    #data-table tbody tr.record-row .status-badge { grid-column: 2; grid-row: 1; align-self: start; justify-self: end; font-size: .68rem; padding: 3px 7px; }
    #data-table .record-link { font-size: .9rem; line-height: 1.4; }
    #data-table .reading-application { font-size: .73rem; margin-top: 1px; line-height: 1.35; }
    #data-table .reading-phase { display: inline; font-size: .7rem; }
    #data-table .reading-phase::before { content: ' · '; }
    #data-table .reading-note { grid-column: 1 / -1; grid-row: 5; margin: 0; padding-top: 5px; border-top: 1px solid var(--border-color); font-size: .73rem; line-height: 1.4; }
    #data-table tbody tr.record-row td[data-col="class"] { grid-column: 1; grid-row: 3; padding-top: 4px; }
    #data-table tbody tr.record-row td[data-col="mechanisms"] { grid-column: 2; grid-row: 3; padding-top: 4px; }
    #data-table tbody tr.record-row td[data-col="properties"] { grid-column: 1 / -1; grid-row: 4; line-height: 1.4; }
    #data-table tbody tr.record-row td[data-col="class"]::before,
    #data-table tbody tr.record-row td[data-col="mechanisms"]::before,
    #data-table tbody tr.record-row td[data-col="properties"]::before { display: block; content: attr(data-label); color: var(--text-muted); font-size: .65rem; font-weight: 500; text-transform: none; letter-spacing: 0; margin: 0 0 2px; }
    #data-table tbody tr.record-row td[data-col="properties"]::before { display: inline; margin-right: 8px; }
    #data-table .cell-stack { display: flex; flex-direction: row; flex-wrap: wrap; gap: 3px 6px; }
    #data-table .cell-subtext { font-size: inherit; }
    #data-table .mechanism-chip { padding: 2px 5px; }
    #view-database .table-pagination-bar { padding: 10px 0; flex-wrap: wrap; gap: 12px; }
}

/* Compact analysis views: keep controls close to their results. */
#view-compare .compare-card, #view-heatmap .heatmap-card,
#view-advisor .card, #view-analytics .chart-card { padding: 16px 20px; }
.compare-header, .heatmap-header { margin-bottom: 12px; }
.compare-header h2, .heatmap-header h2, #view-advisor h2 { margin-bottom: 6px; font-size: 1.1rem; }
.compare-header p, .heatmap-header p, #view-advisor .description { font-size: .8rem; line-height: 1.5; margin-bottom: 10px; }
.compare-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 16px; margin-bottom: 12px; }
.compare-mode-toggle { margin: 0; flex-shrink: 0; }
.compare-mode-btn { padding: 9px 12px; font-size: .8rem; }
.compare-picker-row { flex: 1; min-width: 300px; gap: 8px; margin: 0; align-items: end; }
.compare-picker-group { margin: 0; }
.compare-picker-row select, .compare-picker-row .btn { min-height: 38px; padding-top: 8px; padding-bottom: 8px; font-size: .8rem; }
.compare-chip-row { flex-basis: 100%; gap: 6px; }
.compare-chip-row[hidden] { display: none; }
.compare-chip { padding: 5px 10px; }
.compare-column-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; }
.compare-column-heading .compare-chip-remove { flex-shrink: 0; min-width: 30px; min-height: 30px; }
.compare-column-heading svg { width: 16px; height: 16px; }
.compare-table th, .compare-table td { padding: 8px 12px; }
.compare-cell-btn { padding: 8px; }
.compare-empty-state { padding: 24px 12px; }
.heatmap-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.heatmap-legend { gap: 8px 16px; margin: 0; font-size: .75rem; }
.heatmap-table th, .heatmap-table td { padding: 6px 10px; }
.heatmap-table thead th { font-size: .76rem; }
.heatmap-cell-btn { padding: 5px 6px; min-height: 44px; }
.heatmap-category-toggle { padding: 6px 0; }
.advisor-wizard-grid { display: flex; flex-direction: column; gap: 12px; }
.advisor-selection-card { display: grid; grid-template-columns: minmax(180px,1fr) minmax(0,3fr); gap: 8px 16px; }
.advisor-selection-card > h2, .advisor-selection-card > .description { grid-column: 1 / -1; margin: 0; }
.advisor-selection-card .form-group { margin: 0; min-width: 0; }
.advisor-selection-card .form-hint { font-size: .7rem; margin-top: 4px; }
.advisor-selection-card .component-add-box { display: grid; grid-template-columns: minmax(140px,1fr) minmax(180px,1.5fr) auto; align-items: end; gap: 8px; border: 0; padding: 0; margin: 0; }
.advisor-selection-card .component-add-box h4 { display: none; }
.advisor-selection-card select { min-height: 38px; padding-top: 8px; padding-bottom: 8px; font-size: .8rem; }
#btn-advisor-add { width: auto; margin: 0; min-height: 38px; padding: 8px 12px; font-size: .8rem; }
.advisor-add-message { grid-column: 1 / -1; margin: 0; }
.advisor-add-message:empty { display: none; }
.advisor-report-card .report-header { padding-bottom: 8px; margin-bottom: 10px; }
.advisor-report-card .disclaimer-bar { padding: 8px 10px; margin-bottom: 10px; }
.advisor-score-section { padding: 10px 12px; gap: 10px 20px; margin: 0; align-items: center; flex-wrap: wrap; }
.advisor-risk-counts { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 420px; }
.advisor-risk-count { display: flex; flex: 1 0 auto; flex-direction: row; align-items: center; justify-content: center; gap: 6px; padding: 7px 9px; min-width: 0; min-height: 34px; border-radius: 6px; }
.advisor-risk-count-value { font-size: 1rem; }
.advisor-risk-count-label { font-size: .68rem; margin: 0; white-space: nowrap; }
.score-stats { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: .75rem; }
.score-stats p { margin: 0; }
.wetted-components-list-wrapper, .advisor-fluid-matrix-section { margin-top: 10px; padding-top: 10px; }
.advisor-table th, .advisor-table td { padding: 8px 12px; }
.advisor-table th:first-child { width: 55%; }
.advisor-table .reading-application { margin-top: 2px; }
.empty-advisor-state { padding: 22px 12px; min-height: 0; }
.advisor-export-bar { padding-top: 10px; margin-top: 10px; gap: 8px; }
.analytics-stats-grid { gap: 0; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.analytics-stats-grid .stat-card { border: 0; border-radius: 0; box-shadow: none; padding: 12px 16px; gap: 10px; border-right: 1px solid var(--border-color); }
.analytics-stats-grid .stat-icon { width: 30px; height: 30px; padding: 5px; }
.analytics-stats-grid .stat-num { font-size: 1.35rem; line-height: 1.2; }
.analytics-stats-grid .stat-label { font-size: .72rem; }
.analytics-filter-bar { padding: 0; margin-bottom: 12px; gap: 10px; }
.analytics-charts-grid { gap: 12px; }
.chart-card h3 { margin-bottom: 10px; font-size: .95rem; }
.chart-container { height: 270px; }
.analytics-charts-grid .chart-card:first-child .chart-container { height: 350px; }
.chart-subnote { margin: 0 0 8px; font-size: .72rem; }
.coverage-gap-card { margin-top: 12px; }
@media(max-width:768px) {
    #view-compare .compare-card, #view-heatmap .heatmap-card,
    #view-advisor .card, #view-analytics .chart-card { padding: 12px; }
    .compare-controls { display: flex; gap: 8px; }
    .compare-mode-toggle { width: 100%; }
    .compare-mode-btn { flex: 1; min-height: 44px; }
    .compare-picker-row { min-width: 0; width: 100%; display: grid; grid-template-columns: 1fr auto; }
    .compare-picker-group { grid-column: 1 / -1; }
    .compare-picker-row select, .advisor-selection-card select { font-size: 16px; min-height: 44px; }
    .compare-picker-row .btn, #btn-advisor-add { min-height: 44px; }
    .compare-column-heading .compare-chip-remove { min-width: 44px; min-height: 44px; }
    .heatmap-legend { gap: 6px 12px; }
    .heatmap-toolbar .btn { min-height: 44px; }
    .advisor-selection-card { grid-template-columns: minmax(0,1fr); }
    .advisor-selection-card .component-add-box { grid-template-columns: minmax(0,1fr) auto; }
    .advisor-selection-card .component-add-box .form-group { grid-column: 1 / -1; }
    .advisor-selection-card #btn-advisor-add { grid-column: 1 / -1; width: 100%; }
    .advisor-score-section { align-items: stretch; flex-direction: column; }
    .advisor-risk-counts { gap: 4px; flex: none; }
    .advisor-risk-count { padding: 4px 7px; }
    .analytics-stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .analytics-stats-grid .stat-card { padding: 10px; gap: 6px; }
    .analytics-stats-grid .stat-num { font-size: 1.1rem; }
    .analytics-filter-bar { flex-wrap: wrap; }
    .analytics-fluid-select-wrapper { width: 100%; }
    .analytics-filter-bar select { min-height: 44px; font-size: 16px; }
}
