/* ==========================================================================
   Long Equity - Datavis Module
   Modern Light Design System & Refined Aesthetics
   ========================================================================== */

:root {
    /* Base Light Neutral Scale */
    --bg-main: #ffffff;
    --card-bg: #ffffff;
    --pane-bg: #ffffff;

    /* Typography Colors matching Portfolio Builder & Landing Page */
    --text-dark: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Borders & Hairlines */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --border-subtle: #f1f5f9;

    /* Long Equity Signature Brand & Accent System */
    --primary-color: #0f172a;
    --primary-accent: #0284c7;
    --primary-accent-hover: #0369a1;
    --primary-accent-light: #e0f2fe;

    /* Typography Fonts matching Portfolio Builder & Landing Page */
    --font-sans: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-ui: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* RAG Status Colors */
    --rag-green: #10b981;
    --rag-green-bg: rgba(16, 185, 129, 0.1);
    --rag-green-border: rgba(16, 185, 129, 0.25);

    --rag-yellow: #f59e0b;
    --rag-yellow-bg: rgba(245, 158, 11, 0.1);
    --rag-yellow-border: rgba(245, 158, 11, 0.25);

    --rag-red: #ef4444;
    --rag-red-bg: rgba(239, 68, 68, 0.1);
    --rag-red-border: rgba(239, 68, 68, 0.25);

    /* Radii */
    --radius: 14px;
    --radius-sm: 8px;
    --radius-pill: 9999px;

    /* Layered Box Shadows matching Portfolio Builder & Landing Page */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.02);
    --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.07), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
    --shadow-dropdown: 0 14px 36px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.05);

    /* Smooth Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Sleek Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body,
html {
    height: 100%;
    min-height: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: var(--font-sans);
    overflow: hidden;
    letter-spacing: -0.015em;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
}

.app-layout {
    display: flex;
    flex-direction: column;
    flex: 1 1 0%;
    min-height: 0;
    height: calc(100vh - var(--lq-header-h, 0px));
    height: calc(100dvh - var(--lq-header-h, 0px));
    max-height: calc(100vh - var(--lq-header-h, 0px));
    max-height: calc(100dvh - var(--lq-header-h, 0px));
    width: 100%;
    background: var(--bg-main);
    overflow: hidden;
}

/* ==========================================================================
   Top Navigation Header (Clean, Polished & Modern)
   ========================================================================== */
.top-nav-header {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 1rem;
    height: 46px;
    flex-shrink: 0;
    z-index: 50;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02);
    gap: 0.75rem;
    width: 100%;
    position: relative;
}

.header-nav-toggles {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 0.35rem;
    max-width: 100%;
    margin-left: auto;
}

.nav-toggles-group {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    flex-wrap: nowrap;
}

/* Left-Aligned Spotlight Search */
.search-container {
    position: relative;
    width: 320px;
    max-width: 360px;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 1 320px;
    flex-shrink: 1;
    z-index: 60;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
}

#companySearch {
    width: 100%;
    height: 32px;
    padding: 0 1rem 0 2.2rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-dark);
    font-family: var(--font-sans);
    outline: none;
    transition: all var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
}

#companySearch::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

#companySearch:hover {
    background-color: #ffffff;
    border-color: #cbd5e1;
}

#companySearch:focus {
    background-color: #ffffff;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12), 0 1px 3px rgba(0, 0, 0, 0.04);
}

#companySearch.search-input-hidden {
    opacity: 0;
    pointer-events: none;
}

/* Selected company display */
.search-selected-display {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0 1rem 0 0.75rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-xs);
    cursor: text;
    pointer-events: auto;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.search-selected-display:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.search-selected-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 5px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.search-selected-label {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-dark);
    font-family: var(--font-sans);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom Dropdown for Search */
.custom-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 320px;
    background: #ffffff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    border: 1px solid var(--border-color);
    z-index: 100;
    display: none;
    overflow: hidden;
    max-height: 380px;
    overflow-y: auto;
}

.dropdown-item {
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid #f8fafc;
    font-size: 0.82rem;
    font-family: var(--font-sans);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.active {
    background: #f1f5f9;
}

.dd-match {
    background: var(--primary-accent-light);
    color: var(--primary-accent);
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.dd-logo {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 4px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.dd-info-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
}

/* Top Right Action Controls */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    justify-content: flex-end;
    justify-self: end;
    flex-shrink: 0;
    min-width: 0;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.25rem 0.55rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    height: 28px;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.view-toggle-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--text-dark);
}

.view-toggle-btn.btn-active {
    background: #ecfdf5;
    border-color: rgba(16, 185, 129, 0.4);
    color: #047857;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.12);
}

.view-toggle-btn.btn-active:hover {
    background: #d1fae5;
    border-color: rgba(16, 185, 129, 0.6);
    color: #065f46;
}

.view-toggle-btn.active-valuation {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
    font-weight: 700;
}

.view-toggle-btn.active-valuation:hover {
    background: #ffedd5;
    border-color: #fdba74;
}

.view-toggle-btn.active-hidden {
    background: var(--primary-accent-light);
    border-color: rgba(2, 132, 199, 0.35);
    color: var(--primary-accent);
}

#toggleRagRatingBtn {
    display: none !important;
}

/* ==========================================================================
   3Y / 5Y / 10Y Horizon Slider Toggle
   ========================================================================== */
.horizon-toggle-container {
    display: inline-flex;
    align-items: center;
    position: relative;
    user-select: none;
    flex-shrink: 0;
    margin-left: 0.1rem;
}

.horizon-toggle-track {
    display: inline-flex;
    align-items: center;
    position: relative;
    background: #f1f5f9;
    padding: 1.5px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    gap: 1px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    height: 26px;
}

.horizon-toggle-btn {
    position: relative;
    z-index: 2;
    border: none;
    background: transparent;
    padding: 0 0.45rem;
    height: 100%;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-muted);
    border-radius: 5px;
    cursor: pointer;
    transition: color 0.18s ease;
    line-height: 22px;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 26px;
}

.horizon-toggle-btn:hover {
    color: var(--text-dark);
}

.horizon-toggle-btn.is-active {
    color: var(--text-dark);
}

.horizon-toggle-thumb {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 2px;
    width: calc((100% - 6px) / 3);
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    pointer-events: none;
}

.horizon-toggle-track[data-period="3"] .horizon-toggle-thumb {
    transform: translateX(0);
}

.horizon-toggle-track[data-period="5"] .horizon-toggle-thumb {
    transform: translateX(calc(100% + 1px));
}

.horizon-toggle-track[data-period="10"] .horizon-toggle-thumb {
    transform: translateX(calc(200% + 2px));
}

.selected-pill-badge {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-dark);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
}

.mini-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 3px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Workspace Container: 3-Pane View
   (Left Pane: ~11.5% Filters, Center Pane: ~52% Database, Right Pane: ~36.5% Visualiser)
   ========================================================================== */
.workspace-container {
    display: flex;
    flex-direction: row;
    flex: 1 1 0%;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    background: var(--bg-main);
    position: relative;
}

/* --------------------------------------------------------------------------
   Pane 1: Left Filters Sidebar (~11.5% Width)
   -------------------------------------------------------------------------- */
.filters-pane {
    flex: 0 0 236px;
    min-width: 220px;
    max-width: 255px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    height: 100%;
    overflow: hidden;
    flex-shrink: 0;
}

.filters-pane-header {
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.filter-header-title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--text-dark);
    letter-spacing: -0.015em;
}

.filter-header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.reset-filter-btn {
    border: 1px solid rgba(2, 132, 199, 0.2);
    background: #f0f9ff;
    color: var(--primary-accent);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.18rem 0.5rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

.reset-filter-btn:hover {
    background: var(--primary-accent-light);
    color: var(--primary-accent-hover);
    box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.25);
}

.close-filter-drawer-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-color);
    background: #f1f5f9;
    color: #475569;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.close-filter-drawer-btn:hover {
    background: #e2e8f0;
    color: var(--text-dark);
}

.filters-pane-body {
    padding: 0.45rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.42rem;
    overflow-y: auto;
    flex: 1;
}

.filter-section-divider {
    display: flex;
    align-items: center;
    margin: 0.45rem 0 0.1rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.filter-section-divider span {
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

/* Expandable Filter Sections (Growth down to Qualitative Factors) */
.filter-expandable-section {
    margin-bottom: 0.38rem;
}

.filter-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 0.28rem 0.5rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.filter-section-header:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.filter-expandable-section.is-open>.filter-section-header {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.filter-section-header label {
    cursor: pointer;
    margin-bottom: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
    line-height: 1.2;
    transition: color var(--transition-fast);
}

.filter-section-header:hover label {
    color: var(--primary-accent);
}

.expand-toggle-icon {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    line-height: 1;
    font-family: inherit;
    transition: color var(--transition-fast);
    padding: 0 0.1rem;
}

.filter-section-header:hover .expand-toggle-icon {
    color: var(--primary-accent);
}

.filter-section-body {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
    margin-top: 0.3rem;
    padding: 0.1rem 0.15rem 0.2rem;
}

.filter-section-body.hidden {
    display: none !important;
}

.accordion-active-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-accent);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
    display: inline-block;
    flex-shrink: 0;
}

.accordion-active-dot.hidden {
    display: none !important;
}

.qualitative-group {
    margin-bottom: 0.55rem;
}

.qualitative-group:last-child {
    margin-bottom: 0.15rem;
}

.qualitative-group-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.qualitative-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
}

.filter-field label {
    font-size: 0.67rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: 0.48rem;
    color: #94a3b8;
    pointer-events: none;
}

.input-with-icon input {
    width: 100%;
    height: 28px;
    padding: 0 0.45rem 0 1.55rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--text-dark);
    font-family: var(--font-sans);
    outline: none;
    transition: all var(--transition-fast);
}

.input-with-icon input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.input-with-icon input:hover {
    border-color: #cbd5e1;
}

.input-with-icon input:focus {
    background: #ffffff;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.styled-select {
    height: 28px;
    padding: 0 1.25rem 0 0.48rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-dark);
    font-family: var(--font-sans);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.45rem center;
    transition: all var(--transition-fast);
    width: 100%;
}

.styled-select:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.styled-select:focus {
    background-color: #ffffff;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

.styled-select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.mt-1 {
    margin-top: 0.35rem;
}

.sort-control-wrapper {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.sort-control-wrapper .styled-select {
    flex: 1;
}

.sort-dir-btn {
    height: 31px;
    width: 31px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.65rem;
    color: var(--text-dark);
    font-weight: 800;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sort-dir-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Filter Pills Toolbar & Action Buttons (Select All / Clear) */
.filter-pills-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.15rem;
}

.filter-action-btn {
    appearance: none;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.18rem 0.45rem;
    border-radius: 5px;
    cursor: pointer;
    line-height: 1.2;
    transition: all var(--transition-fast);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    user-select: none;
    box-shadow: var(--shadow-xs);
}

.filter-action-btn:hover {
    background: #eff6ff;
    border-color: #cbd5e1;
    color: var(--primary-accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.filter-action-btn:active {
    transform: scale(0.96);
}

/* Filter Pills (Portfolio, Watchlist, Smart Money, Serial Acquirers, Country, Qualitative) */
.filter-pills-wrap,
.country-pills-grid,
.qualitative-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    padding-top: 0.1rem;
}

#qualityScorePillsContainer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.32rem;
    width: 100%;
}

#qualityScorePillsContainer .filter-pill-btn {
    justify-content: center;
    text-align: center;
    padding: 0.2rem 0.3rem;
    width: 100%;
    font-size: 0.67rem;
    box-sizing: border-box;
    white-space: nowrap;
}

.filter-pill-btn,
.country-pill-btn,
.qual-pill-btn {
    appearance: none;
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: var(--radius-pill);
    padding: 0.18rem 0.46rem;
    font-size: 0.67rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    white-space: nowrap;
    line-height: 1.2;
    font-family: var(--font-sans);
    user-select: none;
    box-shadow: var(--shadow-xs);
}

.filter-pill-btn:hover,
.country-pill-btn:hover,
.qual-pill-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text-dark);
    transform: translateY(-1px);
}

.filter-pill-btn:active,
.country-pill-btn:active,
.qual-pill-btn:active {
    transform: scale(0.97);
}

.filter-pill-btn.active,
.country-pill-btn.active,
.qual-pill-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.filter-pill-btn.active:hover,
.country-pill-btn.active:hover,
.qual-pill-btn.active:hover {
    background: #1e293b;
    border-color: #1e293b;
}

/* Screens Subgroup & Custom Saved Screens */
.screens-subgroup-title {
    font-size: 0.65rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.25rem;
}

.saved-screens-subgroup {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
}

.saved-screens-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.save-screen-trigger-btn {
    appearance: none;
    border: 1px dashed #cbd5e1;
    background: #ffffff;
    color: var(--primary-accent);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.22rem 0.55rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

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

.save-screen-form {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.35rem;
    margin-bottom: 0.4rem;
    transition: all var(--transition-fast);
}

.save-screen-form.hidden {
    display: none !important;
}

.save-screen-input-row {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.save-screen-input {
    flex: 1;
    min-width: 0;
    height: 27px;
    padding: 0 0.45rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-dark);
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast);
}

.save-screen-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.save-screen-confirm-btn {
    height: 27px;
    padding: 0 0.55rem;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition-fast);
    flex-shrink: 0;
}

.save-screen-confirm-btn:hover {
    background: #1e293b;
}

.save-screen-cancel-btn {
    height: 27px;
    width: 27px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.save-screen-cancel-btn:hover {
    background: #f1f5f9;
    color: var(--text-dark);
}

.saved-screens-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.no-saved-screens-hint {
    font-size: 0.67rem;
    color: #94a3b8;
    font-style: italic;
    padding: 0.15rem 0;
}

.saved-screen-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 999px;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
    max-width: 100%;
}

.saved-screen-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
}

.saved-screen-chip.active {
    background: #0f172a;
    border-color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.saved-screen-apply-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #334155;
    font-size: 0.69rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 0.22rem 0.25rem 0.22rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 175px;
    line-height: 1.2;
}

.saved-screen-chip:hover .saved-screen-apply-btn {
    color: var(--text-dark);
}

.saved-screen-chip.active .saved-screen-apply-btn {
    color: #ffffff;
}

.saved-screen-icon {
    font-size: 0.65rem;
    line-height: 1;
    opacity: 0.85;
}

.saved-screen-delete-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.22rem 0.42rem 0.22rem 0.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
    transition: all var(--transition-fast);
}

.saved-screen-delete-btn:hover {
    color: #ef4444;
    transform: scale(1.15);
}

.saved-screen-chip.active .saved-screen-delete-btn {
    color: #94a3b8;
}

/* Custom Multiple Watchlists */
.watchlist-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
    max-width: 100%;
}

.watchlist-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
}

.watchlist-chip.active {
    background: #0f172a;
    border-color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.watchlist-apply-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.67rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 0.18rem 0.25rem 0.18rem 0.46rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    line-height: 1.2;
}

.watchlist-chip:hover .watchlist-apply-btn {
    color: var(--text-dark);
}

.watchlist-chip.active .watchlist-apply-btn {
    color: #ffffff;
}

.watchlist-star-bullet {
    font-size: 0.65rem;
    color: #f59e0b;
    line-height: 1;
}

.watchlist-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    line-height: 1;
}

.watchlist-chip.active .watchlist-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.watchlist-rename-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.18rem 0.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: color 0.15s ease, background 0.15s ease;
}

.watchlist-rename-btn:hover {
    color: #0284c7;
    background: rgba(2, 132, 199, 0.1);
}

.watchlist-chip.active .watchlist-rename-btn {
    color: #94a3b8;
}

.watchlist-chip.active .watchlist-rename-btn:hover {
    color: #38bdf8;
    background: rgba(255, 255, 255, 0.15);
}

.watchlist-delete-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.18rem 0.38rem 0.18rem 0.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
    transition: all var(--transition-fast);
}

.watchlist-delete-btn:hover {
    color: #ef4444;
    transform: scale(1.15);
}

.watchlist-chip.active .watchlist-delete-btn {
    color: #94a3b8;
}

.watchlist-chip.active .watchlist-delete-btn:hover {
    color: #f87171;
}

.cm-watchlists-container {
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.cm-watchlists-container::-webkit-scrollbar {
    width: 4px;
}

.cm-watchlists-container::-webkit-scrollbar-track {
    background: transparent;
}

.cm-watchlists-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.company-cm-item .cm-wl-name {
    font-weight: 700;
}

/* Custom Multiple Portfolios */
.portfolio-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    background: #ffffff;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
    max-width: 100%;
}

.portfolio-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
}

.portfolio-chip.active {
    background: #0f172a;
    border-color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.portfolio-apply-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.22rem 0.35rem 0.22rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    line-height: 1.2;
}

.portfolio-chip:hover .portfolio-apply-btn {
    color: var(--text-dark);
}

.portfolio-chip.active .portfolio-apply-btn {
    color: #ffffff;
}

.portfolio-bullet {
    font-size: 0.65rem;
    line-height: 1;
}

.portfolio-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.58rem;
    font-family: var(--font-mono);
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    line-height: 1;
}

.portfolio-chip.active .portfolio-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.portfolio-rename-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.18rem 0.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: color 0.15s ease, background 0.15s ease;
}

.portfolio-rename-btn:hover {
    color: #0284c7;
    background: rgba(2, 132, 199, 0.1);
}

.portfolio-chip.active .portfolio-rename-btn {
    color: #94a3b8;
}

.portfolio-chip.active .portfolio-rename-btn:hover {
    color: #38bdf8;
    background: rgba(255, 255, 255, 0.15);
}

.portfolio-builder-link-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.18rem 0.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: color 0.15s ease, background 0.15s ease;
    text-decoration: none;
}

.portfolio-builder-link-btn:hover {
    color: #0284c7;
    background: rgba(2, 132, 199, 0.1);
}

.portfolio-chip.active .portfolio-builder-link-btn {
    color: #94a3b8;
}

.portfolio-chip.active .portfolio-builder-link-btn:hover {
    color: #38bdf8;
    background: rgba(255, 255, 255, 0.15);
}

.portfolio-delete-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.18rem 0.4rem 0.18rem 0.2rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    line-height: 1;
    transition: all var(--transition-fast);
}

.portfolio-delete-btn:hover {
    color: #ef4444;
    transform: scale(1.15);
}

.portfolio-chip.active .portfolio-delete-btn {
    color: #94a3b8;
}

.portfolio-chip.active .portfolio-delete-btn:hover {
    color: #f87171;
}

.cm-portfolios-container {
    max-height: 180px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.cm-portfolios-container::-webkit-scrollbar {
    width: 4px;
}

.cm-portfolios-container::-webkit-scrollbar-track {
    background: transparent;
}

.cm-portfolios-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.company-cm-item .cm-port-name {
    font-weight: 700;
}

.company-cm-item.in-portfolio {
    background: rgba(2, 132, 199, 0.08);
}

.company-cm-item.in-portfolio:hover {
    background: rgba(2, 132, 199, 0.15);
}

/* Terminal Guide Link (In Left Sidebar Under Business Models) */
.filter-terminal-guide-wrap {
    margin-top: 0.35rem;
    padding: 0.25rem 0.1rem 0.5rem 0.1rem;
    display: flex;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-terminal-guide-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    height: 30px;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-pill);
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: #475569;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-sans);
    text-decoration: none;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.sidebar-terminal-guide-link:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--primary-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.sidebar-terminal-guide-link svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.filters-pane-footer {
    padding: 0.65rem 0.85rem;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.filters-count-info {
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
    display: block;
    text-align: center;
    background: #f8fafc;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    border: 1px solid #f1f5f9;
}

.apply-filters-mobile-btn {
    display: none;
    width: 100%;
    padding: 0.5rem;
    background: #0f172a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 750;
    margin-top: 0.4rem;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--transition-fast);
}

.apply-filters-mobile-btn:hover {
    background: #1e293b;
}

.filters-backdrop {
    display: none;
}

/* Sidebar collapsed state */
.workspace-container.filters-collapsed .filters-pane {
    display: none !important;
}

/* --------------------------------------------------------------------------
   Pane 2: Center Database Table Pane (Resizable, Default ~52%)
   -------------------------------------------------------------------------- */
.database-pane {
    flex: 1 1 calc(var(--db-split-percent, 52%));
    min-width: 280px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-right: none;
    height: 100%;
    overflow: hidden;
    position: relative;
    transition: flex 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.workspace-container.database-collapsed .database-pane {
    display: none !important;
}

.workspace-container.visualizer-collapsed .database-pane {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    border-right: none;
}

/* --------------------------------------------------------------------------
   Pane Resizer / Splitter
   -------------------------------------------------------------------------- */
.pane-resizer {
    width: 6px;
    height: 100%;
    background: var(--border-color);
    cursor: col-resize;
    position: relative;
    flex-shrink: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.pane-resizer::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -5px;
    right: -5px;
    z-index: 1;
}

.resizer-handle {
    width: 4px;
    height: 36px;
    border-radius: 4px;
    background: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    pointer-events: none;
    transition: all var(--transition-fast);
}

.resizer-grip-line {
    width: 2px;
    height: 14px;
    background: #94a3b8;
    border-radius: 1px;
    pointer-events: none;
    transition: background var(--transition-fast);
}

.pane-resizer:hover,
.pane-resizer:focus-visible {
    background: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
    outline: none;
}

.pane-resizer:hover .resizer-handle,
.pane-resizer:focus-visible .resizer-handle {
    background: #3b82f6;
    height: 48px;
    width: 5px;
}

.pane-resizer:hover .resizer-grip-line,
.pane-resizer:focus-visible .resizer-grip-line {
    background: #ffffff;
}

.workspace-container.is-resizing .pane-resizer,
.pane-resizer.is-active {
    background: #2563eb !important;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.5) !important;
}

.workspace-container.is-resizing .resizer-handle,
.pane-resizer.is-active .resizer-handle {
    background: #2563eb !important;
    height: 56px !important;
    width: 6px !important;
}

.workspace-container.is-resizing .resizer-grip-line,
.pane-resizer.is-active .resizer-grip-line {
    background: #ffffff !important;
}

.workspace-container.is-resizing,
body.is-resizing {
    cursor: col-resize !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.workspace-container.is-resizing .database-pane,
.workspace-container.is-resizing .visualizer-pane {
    transition: none !important;
}

.workspace-container.is-resizing iframe,
.workspace-container.is-resizing canvas,
.workspace-container.is-resizing .database-table-wrapper {
    pointer-events: none;
}

.workspace-container.database-collapsed .pane-resizer,
.workspace-container.visualizer-collapsed .pane-resizer {
    display: none !important;
}

/* Database Toolbar */
.database-toolbar {
    padding: 0.35rem 0.85rem;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
    gap: 0.75rem;
    height: 38px;
}

.database-title-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.database-section-heading {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}


.database-meta-info {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: #475569;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
}

/* --------------------------------------------------------------------------
   Database Table View & Typography
   -------------------------------------------------------------------------- */
.database-table-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #ffffff;
}

.database-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.76rem;
    text-align: left;
    font-family: var(--font-sans);
}

.database-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #64748b;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.42rem 0.55rem;
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    white-space: nowrap;
    user-select: none;
    box-shadow: 0 1px 0 var(--border-color);
}

.database-table thead th.sortable {
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.database-table thead th.sortable:hover {
    background: #f1f5f9;
    color: var(--text-dark);
}

.th-content {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.th-content.th-right {
    justify-content: flex-end;
}

.sort-arrow {
    font-size: 0.65rem;
    opacity: 0.4;
    transition: opacity var(--transition-fast);
}

th.sorted-asc .sort-arrow,
th.sorted-desc .sort-arrow {
    opacity: 1;
    color: var(--primary-accent);
    font-weight: 900;
}

/* Table Rows */
.database-table tbody tr {
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid #f1f5f9;
}

.database-table tbody tr:hover {
    background-color: #f8fafc;
}

.database-table tbody tr.active-row {
    background-color: #f0f9ff !important;
}

.database-table tbody tr.active-row td:first-child {
    border-left: 3px solid var(--primary-accent);
}

.database-table td {
    padding: 0.34rem 0.55rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

/* Sticky Columns */
.col-ticker {
    width: 78px;
    font-weight: 700;
    font-family: var(--font-mono);
    position: sticky;
    left: 0;
    z-index: 2;
    background: #ffffff;
}

thead th.col-ticker {
    z-index: 12;
    background: #f8fafc;
}

tbody tr:hover td.col-ticker {
    background: #f8fafc;
}

tbody tr.active-row td.col-ticker {
    background: #f0f9ff;
}

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

.table-company-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 4px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 1px;
    flex-shrink: 0;
}

.ticker-badge-sm {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.col-name {
    max-width: 155px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    font-family: var(--font-sans);
    color: #334155;
    position: sticky;
    left: 78px;
    z-index: 2;
    background: #ffffff;
}

thead th.col-name {
    z-index: 12;
    background: #f8fafc;
}

tbody tr:hover td.col-name {
    background: #f8fafc;
}

tbody tr.active-row td.col-name {
    background: #f0f9ff;
}

/* Column separator styling */
.col-separator,
thead th.col-separator,
tbody td.col-separator {
    border-right: 1px solid var(--border-color) !important;
}

.company-name-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    width: 100%;
}

.company-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    flex: 1;
    min-width: 0;
    max-width: 156px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.8rem;
    color: #334155;
}

/* LE Portfolio Badges */
.le-portfolio-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.62rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-pill);
    flex-shrink: 0;
    white-space: nowrap;
    line-height: 1.2;
}

.le-portfolio-badge.portfolio,
.le-portfolio-badge.le-portfolio {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.le-portfolio-badge.watchlist,
.le-portfolio-badge.le-watchlist {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    border: 1px solid rgba(37, 99, 235, 0.28);
}

.le-portfolio-badge.global-compounder {
    background: rgba(124, 58, 237, 0.1);
    color: #6d28d9;
    border: 1px solid rgba(124, 58, 237, 0.28);
}

.le-portfolio-badge.sm {
    font-size: 0.58rem;
    padding: 0.1rem 0.35rem;
}

.col-screens {
    width: 220px;
    min-width: 170px;
    padding: 0.45rem 0.65rem;
}

thead th.col-screens {
    text-align: left;
}

thead th.col-screens .th-content {
    justify-content: flex-start;
}

tbody td.col-screens {
    text-align: left;
}

.screens-pills-wrap {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
    white-space: nowrap;
}

.col-portfolio {
    width: 145px;
    min-width: 140px;
    text-align: center;
    padding: 0.45rem 0.65rem;
}

thead th.col-portfolio {
    text-align: center;
}

thead th.col-portfolio .th-content {
    justify-content: center;
}

tbody td.col-portfolio {
    text-align: center;
}

.col-flag {
    width: 115px;
    min-width: 100px;
    text-align: center;
    padding: 0.45rem 0.65rem;
}

thead th.col-flag {
    text-align: center;
}

thead th.col-flag .th-content {
    justify-content: center;
}

tbody td.col-flag {
    text-align: center;
}

.flag-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    flex-shrink: 0;
    white-space: nowrap;
    line-height: 1.2;
}

.flag-badge.smart-money {
    background: rgba(124, 58, 237, 0.1);
    color: #6d28d9;
    border: 1px solid rgba(124, 58, 237, 0.28);
}

.flag-badge.serial-acquirer {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Qualitative Factors Table Column & Badges */
.col-qualitative {
    width: 120px;
    min-width: 105px;
    text-align: left;
    padding: 0.45rem 0.65rem;
    font-size: 0.74rem;
    white-space: nowrap;
}

.col-sector,
.col-qualitative.col-sector,
thead th.col-sector,
tbody td.col-sector {
    width: 90px;
    min-width: 80px;
    max-width: 105px;
    padding: 0.45rem 0.35rem;
}

thead th.col-qualitative {
    text-align: left;
}

thead th.col-qualitative .th-content {
    justify-content: flex-start;
}

tbody td.col-qualitative {
    text-align: left;
}

.qual-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0.16rem 0.46rem;
    border-radius: 4px;
    line-height: 1.2;
    white-space: nowrap;
}

.qual-badge.qual-sector {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.63rem;
    padding: 0.12rem 0.35rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

/* Customer Column Badges */
.qual-badge.qual-customer-business {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.28);
}

.qual-badge.qual-customer-consumer {
    background: rgba(225, 29, 72, 0.09);
    color: #be123c;
    border: 1px solid rgba(225, 29, 72, 0.26);
}

.qual-badge.qual-customer-mix {
    background: rgba(147, 51, 234, 0.1);
    color: #7e22ce;
    border: 1px solid rgba(147, 51, 234, 0.28);
}

.qual-badge.qual-positive {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.qual-badge.qual-moderate {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.qual-badge.qual-negative {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.qual-badge.qual-neutral {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-weight: 600;
}

.qual-empty {
    color: #94a3b8;
    font-size: 0.74rem;
}

.num-col {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.col-country {
    width: 95px;
    min-width: 80px;
    max-width: 105px;
    font-size: 0.76rem;
    font-weight: 500;
    font-family: var(--font-sans);
    color: var(--text-secondary);
    white-space: nowrap;
    padding: 0.45rem 0.45rem;
    text-align: left;
}

thead th.col-country {
    text-align: left;
}

thead th.col-country .th-content {
    justify-content: flex-start;
}

tbody td.col-country {
    text-align: left;
}

.country-text {
    display: inline-block;
    white-space: nowrap;
}

.col-mktcap {
    font-weight: 700;
    color: var(--text-dark);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.76rem;
    text-align: right;
    width: 92px;
}

.col-score {
    width: 102px;
    text-align: right;
}

.table-score-pills {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.score-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.1rem 0.32rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.score-tag.green {
    background: var(--rag-green-bg);
    color: #047857;
}

.score-tag.yellow {
    background: var(--rag-yellow-bg);
    color: #b45309;
}

.score-tag.red {
    background: var(--rag-red-bg);
    color: #b91c1c;
}

.col-metric {
    text-align: right;
    min-width: 82px;
}

.metric-cell-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    width: 100%;
}

/* High-DPI RAG Circles with subtle ring */
.rag-circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.rag-circle.green {
    background: var(--rag-green);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}

.rag-circle.yellow {
    background: var(--rag-yellow);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.18);
}

.rag-circle.red {
    background: var(--rag-red);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.18);
}

.metric-value {
    font-size: 0.76rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.empty-table-msg {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* 10yr Market Cap Sparkline Column */
.col-sparkline {
    width: 86px;
    min-width: 86px;
    text-align: right;
    padding: 0.2rem 0.45rem;
    vertical-align: middle;
}

thead th.col-sparkline {
    text-align: right;
    width: 86px;
    min-width: 86px;
}

.sparkline-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 100%;
}

.sparkline-svg {
    display: block;
    overflow: visible;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.04));
}

/* --------------------------------------------------------------------------
   Pane 3: Right Pane: Data Visualiser (~48% Default)
   -------------------------------------------------------------------------- */
.visualizer-pane {
    flex: 1 1 calc(100% - var(--db-split-percent, 52%));
    min-width: 280px;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    position: relative;
    padding: 0;
    box-sizing: border-box;
    transition: flex 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.workspace-container.visualizer-collapsed .visualizer-pane {
    display: none !important;
}

.workspace-container.database-collapsed .visualizer-pane {
    flex: 1 1 100% !important;
    min-width: 0 !important;
}

.visualizer-inner {
    flex: 1 1 0%;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 0.75rem 1rem 0.75rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Visualiser Action Toolbar & PNG Export Button (Hidden across data terminal) */
.visualizer-pane-toolbar {
    display: none !important;
}

.visualizer-download-btn,
#downloadVisualizerBtn {
    display: none !important;
}

.visualizer-download-btn:hover {
    background: #f8fafc;
    color: var(--text-dark, #0f172a);
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}

.visualizer-download-btn:active {
    transform: translateY(1px);
}

.visualizer-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.visualizer-download-btn svg {
    flex-shrink: 0;
}

@keyframes visualizerSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .visualizer-pane-toolbar {
        top: 0.45rem;
        right: 0.5rem;
    }

    .visualizer-download-btn .btn-label {
        display: none;
    }

    .visualizer-download-btn {
        padding: 0.28rem 0.38rem;
    }
}

/* Centralised Brand Hero */
.brand-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    padding-right: 0;
    width: 100%;
    flex-shrink: 0;
}

.header-main-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-width: 0;
    width: 100%;
}

.header-sub-row {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    min-width: 0;
    width: 100%;
}

.ticker-badge {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 0.16rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-dark);
}

.country-badge {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 0.16rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.company-logo {
    width: 34px;
    height: 34px;
    max-width: 34px;
    max-height: 34px;
    object-fit: contain;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    flex-shrink: 0;
}

.company-name {
    font-size: 1.35rem;
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--text-dark);
    letter-spacing: -0.025em;
    line-height: 1.2;
    margin: 0;
    text-align: center;
}

.market-cap {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-sans);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.cap-value {
    color: var(--text-dark);
    font-family: var(--font-mono);
    font-weight: 700;
}

.scorecard-row {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 0.18rem 0.6rem;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-xs);
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-shrink: 0;
}

.scorecard-row span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Charts Grid */
.dashboard-content {
    container-type: inline-size;
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(170px, 1fr);
    gap: 0.65rem;
    flex: 1 1 auto;
}

@container (max-width: 540px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@container (min-width: 541px) and (max-width: 960px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container (min-width: 961px) and (max-width: 1350px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@container (min-width: 1351px) {
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.workspace-container.database-collapsed .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* 12 Chart Cards */
.chart-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.35rem;
    gap: 0.35rem;
}

.badge-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: flex-end;
    max-width: 55%;
}

.card-header h3 {
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-sans);
    color: #0f172a;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

.valuation-card-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.12rem 0.45rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-pill, 9999px);
    font-size: 0.62rem;
    font-family: var(--font-sans, system-ui, sans-serif);
    font-weight: 600;
    color: #0284c7;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.2;
}

.valuation-card-pill:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25);
}

.trend-badge {
    padding: 0.16rem 0.45rem;
    border-radius: var(--radius-pill);
    font-size: 0.64rem;
    font-family: var(--font-mono);
    font-weight: 600;
    color: white;
    text-shadow: none;
    white-space: nowrap;
    box-shadow: none;
}

.chart-container {
    flex: 1 1 auto;
    min-height: 110px;
    position: relative;
}

.chart-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.growth-message {
    margin-top: 0.35rem;
    font-size: 0.68rem;
    font-family: var(--font-ui);
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    width: 100%;
    text-align: center;
    line-height: 1.3;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.45rem;
}

.dashboard-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.4rem;
    padding-bottom: 0.15rem;
    flex-shrink: 0;
}

.dashboard-footer span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Tooltips (Header & Table)
   ========================================================================== */
.cell-tooltip {
    position: fixed;
    background: #0f172a;
    color: #ffffff;
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translate(-50%, -100%);
    max-width: 260px;
    text-align: center;
    line-height: 1.35;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.cell-tooltip.tooltip-header-mode {
    transform: translate(-50%, 0);
}

.cell-tooltip.tooltip-header-mode::after {
    top: -6px;
    bottom: auto;
    border-color: transparent transparent #0f172a transparent;
}

.cell-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
}

.tooltip-title {
    font-weight: 800;
    font-size: 0.8rem;
    color: #f8fafc;
    margin-bottom: 0.2rem;
}

.tooltip-desc {
    color: #cbd5e1;
    font-size: 0.74rem;
    line-height: 1.3;
}

/* ==========================================================================
   Column Header Context Menu / Right-Click Filter Dropdown Window (Light Theme)
   ========================================================================== */
.col-filter-dropdown {
    position: fixed;
    z-index: 1200;
    width: 295px;
    background: #ffffff;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 18px 40px -4px rgba(15, 23, 42, 0.16), 0 6px 14px -2px rgba(15, 23, 42, 0.08);
    padding: 0.95rem;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: colFilterFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top left;
    user-select: none;
}

@keyframes colFilterFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-6px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.col-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #f1f5f9;
}

.col-filter-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.col-filter-title {
    font-weight: 700;
    font-size: 0.84rem;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 230px;
}

.col-filter-subtitle {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.col-filter-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.col-filter-close:hover {
    background: #f1f5f9;
    color: var(--text-dark);
}

.col-filter-active-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 0.38rem 0.55rem;
    border-radius: 6px;
    font-size: 0.72rem;
    color: #2563eb;
    font-weight: 700;
}

.col-filter-active-remove {
    background: transparent;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
    opacity: 0.8;
}

.col-filter-active-remove:hover {
    opacity: 1;
    color: #ef4444;
}

.col-filter-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

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

.col-filter-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.col-filter-condition-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.col-filter-condition-toggle.compact {
    width: 78px;
    flex-shrink: 0;
    gap: 2px;
    padding: 2px;
}

.col-condition-btn {
    background: transparent;
    border: none;
    color: #64748b;
    padding: 0.42rem 0.5rem;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.col-filter-condition-toggle.compact .col-condition-btn {
    padding: 0.35rem 0.25rem;
    font-size: 0.78rem;
    font-weight: 800;
}

.col-condition-btn:hover {
    color: var(--text-dark);
    background: rgba(255, 255, 255, 0.6);
}

.col-condition-btn.active {
    background: #3b82f6;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.28);
}

.col-condition-btn.active[data-condition="lte"] {
    background: #f87171;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(248, 113, 113, 0.32);
}

/* Specific styling for Greens and Reds quality subgroup toggles */
.quality-filter-subgroup:first-child .col-condition-btn.active {
    background: #059669;
    box-shadow: 0 2px 5px rgba(5, 150, 105, 0.28);
}

.quality-filter-subgroup:last-child .col-condition-btn.active {
    background: #f87171;
    box-shadow: 0 2px 5px rgba(248, 113, 113, 0.32);
}

.condition-symbol {
    font-weight: 800;
    font-size: 0.82rem;
}

.col-filter-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.col-filter-input-prefix,
.col-filter-input-suffix {
    position: absolute;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 600;
    pointer-events: none;
}

.col-filter-input-prefix {
    left: 0.65rem;
}

.col-filter-input-suffix {
    right: 0.65rem;
}

.col-filter-input {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    color: var(--text-dark);
    padding: 0.46rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.col-filter-input::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.col-filter-input:focus {
    background: #ffffff;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.col-filter-input.has-prefix {
    padding-left: 1.45rem;
}

.col-filter-input.has-suffix {
    padding-right: 1.75rem;
}

.col-filter-hint {
    font-size: 0.66rem;
    color: var(--text-muted);
    line-height: 1.25;
}

/* Quality Score Dual Filter Subgroups */
.quality-filter-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.quality-filter-subgroup {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: #f8fafc;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.quality-filter-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quality-color-badge {
    font-size: 0.72rem;
    font-weight: 700;
}

.quality-color-badge.green-badge {
    color: #059669;
}

.quality-color-badge.red-badge {
    color: #dc2626;
}

.quality-input-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.quality-input-row .col-filter-input {
    padding: 0.38rem 2.8rem 0.38rem 0.6rem;
    font-size: 0.8rem;
    background: #ffffff;
}

/* Hide spin buttons to prevent overlap with unit suffix */
.quality-input-row input[type="number"]::-webkit-outer-spin-button,
.quality-input-row input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quality-input-row input[type="number"] {
    -moz-appearance: textfield;
}

.col-filter-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.col-preset-chip {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: #475569;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: var(--font-mono);
    padding: 0.22rem 0.55rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.12s ease;
}

.col-preset-chip:hover {
    background: var(--primary-accent-light);
    border-color: rgba(2, 132, 199, 0.4);
    color: var(--primary-accent);
}

.col-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.55rem;
    border-top: 1px solid #f1f5f9;
}

.btn-ghost-sm {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-ghost-sm:hover {
    background: #f1f5f9;
    color: var(--text-dark);
}

.btn-primary-sm {
    background: #0f172a;
    border: none;
    color: #ffffff;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    text-align: center;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.btn-primary-sm:hover {
    background: #000000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

/* Header Active Filter Badge */
th.th-has-filter {
    background: #e0f2fe !important;
    border-top: 2px solid var(--primary-accent) !important;
}

.th-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--primary-accent);
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 0.12rem 0.35rem;
    border-radius: var(--radius-pill);
    margin-left: 0.3rem;
    vertical-align: middle;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25);
    transition: background 0.15s ease;
}

.th-filter-badge:hover {
    background: #2563eb;
}

.th-filter-badge.badge-lte {
    background: #f87171;
}

.th-filter-badge.badge-lte:hover {
    background: #ef4444;
}

.th-filter-badge-x {
    display: inline-block;
    margin-left: 2px;
    font-weight: 800;
    font-size: 0.68rem;
    opacity: 0.75;
    line-height: 1;
}

.th-filter-badge-x:hover {
    opacity: 1;
    color: #fca5a5;
}

/* ==========================================================================
   Valuation Calculator
   ========================================================================== */
.valuation-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1.15fr) minmax(290px, 1fr);
    grid-template-rows: auto auto auto;
    column-gap: 0.85rem;
    row-gap: 0.75rem;
    align-items: stretch;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
}

.val-grid-chart-top {
    grid-column: 1;
    grid-row: 1;
}

.val-grid-inputs-top {
    grid-column: 2;
    grid-row: 1;
}

.val-grid-chart-bottom {
    grid-column: 1;
    grid-row: 2;
}

.val-grid-hist-bottom {
    grid-column: 2;
    grid-row: 2;
    margin-top: 0 !important;
}

.val-grid-disclaimer {
    grid-column: 2;
    grid-row: 3;
    font-size: 11px;
    color: #a1a1aa;
    margin: 0;
    line-height: 1.5;
}

.valuation-chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.valuation-chart-card .chart-container {
    flex: 1 1 auto;
    min-height: 185px;
    height: auto;
}

.valuation-inputs-col {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 0;
    min-width: 0;
}

.valuation-inputs-col .val-cagr-card {
    margin-top: auto;
}

.val-col-headers {
    display: grid;
    grid-template-columns: 1.15fr repeat(3, 1fr);
    gap: 0.45rem;
    margin-bottom: 0.4rem;
}

.val-col-header {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.val-row {
    display: grid;
    grid-template-columns: 1.15fr repeat(3, 1fr);
    gap: 0.45rem;
    align-items: center;
    margin-bottom: 0.45rem;
}

.val-row-label {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.val-input-wrap {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 0.3rem 0.45rem;
    gap: 0.2rem;
    height: 32px;
    box-sizing: border-box;
    min-width: 0;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.val-input-wrap:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.val-readonly-wrap {
    background: #f8fafc;
    border-color: #f1f5f9;
}

.val-readonly-wrap:focus-within {
    border-color: #f1f5f9;
    box-shadow: none;
}

.val-currency,
.val-suffix {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    line-height: 1;
}

.val-fcf-color {
    color: #c2410c;
}

.val-yield-color {
    color: #9d174d;
}

.val-input {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark);
    font-family: inherit;
    outline: none;
    width: 100%;
    font-variant-numeric: tabular-nums;
    min-width: 0;
    -moz-appearance: textfield;
}

.val-input::-webkit-inner-spin-button,
.val-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.val-readonly {
    cursor: default;
    color: var(--text-muted);
}

/* Growth Rate cells */
.val-growth-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem 0.4rem;
    height: 32px;
    box-sizing: border-box;
    min-width: 0;
    transition: all var(--transition-fast);
}

.val-growth-val {
    font-size: 0.8rem;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.val-growth-cell.positive {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.28);
    color: #059669;
}

.val-growth-cell.negative {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.28);
    color: #dc2626;
}

/* Dedicated Est. 2-yr CAGR Row Below */
.val-cagr-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.55rem;
    padding: 0.55rem 0.85rem;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.val-cagr-card.positive {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.14) 100%);
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.12);
}

.val-cagr-card.negative {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08) 0%, rgba(220, 38, 38, 0.14) 100%);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.12);
}

.val-cagr-card-left {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.val-cagr-card-label {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.val-cagr-card-desc {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
}

.val-cagr-card-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.85rem;
    border-radius: 9px;
    font-weight: 800;
    font-size: 1.02rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    min-width: 85px;
    border: 1.5px solid transparent;
}

.val-cagr-card-badge.positive {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.val-cagr-card-badge.negative {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(239, 68, 68, 0.35);
}

.val-cagr-card-val {
    line-height: 1;
}

/* Historical Growth & Valuation Multiple Comparison Card */
.val-hist-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0.65rem;
    margin-top: 0.65rem;
    padding: 0.8rem 0.95rem;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.val-hist-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.val-hist-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1 1 auto;
}

.val-hist-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.val-hist-subtitle {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.25;
}

.val-hist-horizon-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid rgba(148, 163, 184, 0.25);
    white-space: nowrap;
    flex-shrink: 0;
}

.val-hist-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    width: 100%;
    box-sizing: border-box;
}

.val-hist-metric-box {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.55rem 0.65rem;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 8px;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.val-hist-diff-metric-box.expensive {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(220, 38, 38, 0.09) 100%);
    border-color: rgba(239, 68, 68, 0.35);
}

.val-hist-diff-metric-box.cheaper {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.09) 100%);
    border-color: rgba(16, 185, 129, 0.35);
}

.val-hist-diff-metric-box.neutral {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.28);
}

.val-hist-metric-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.25rem;
    line-height: 1.25;
    min-height: 26px;
    display: flex;
    align-items: flex-start;
}

.val-hist-metric-val-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    min-width: 0;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.val-hist-metric-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-dark);
    line-height: 1.15;
}

.val-hist-metric-val.positive {
    color: #059669;
}

.val-hist-metric-val.negative {
    color: #dc2626;
}

.val-hist-metric-val.expensive {
    color: #dc2626;
}

.val-hist-metric-val.cheaper {
    color: #059669;
}

.val-hist-metric-val.neutral {
    color: #475569;
}

.val-hist-metric-unit {
    font-size: 0.64rem;
    font-weight: 700;
    color: #94a3b8;
}

.val-hist-metric-sub {
    font-size: 0.64rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.25;
    min-height: 18px;
    display: flex;
    align-items: center;
}

.val-hist-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 9999px;
    font-size: 0.60rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.2;
    flex-shrink: 0;
}

.val-hist-status-pill.expensive {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 1px 6px rgba(239, 68, 68, 0.3);
}

.val-hist-status-pill.cheaper {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 1px 6px rgba(16, 185, 129, 0.3);
}

.val-hist-status-pill.neutral {
    background: #64748b;
    color: #ffffff;
}

.val-hist-explanation-box {
    display: flex;
    flex-direction: column;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1.5px solid transparent;
    transition: all var(--transition-fast);
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

.val-hist-explanation-box.expensive {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, rgba(220, 38, 38, 0.09) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.val-hist-explanation-box.cheaper {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.09) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.val-hist-explanation-box.neutral {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.28);
}

.val-hist-diff-expl {
    font-size: 0.71rem;
    line-height: 1.45;
    color: #334155;
    word-break: normal;
    overflow-wrap: break-word;
    margin: 0;
}

.val-hist-diff-expl strong {
    font-weight: 700;
    color: var(--text-dark);
}

/* ==========================================================================
   Valuation Benchmark Tool (10-Year FCF Yield Benchmark Chart & Comparison)
   ========================================================================== */
.valuation-comparison-view {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding-bottom: 2rem;
    flex-shrink: 0;
}

.valuation-view-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding-bottom: 2.5rem;
}

.valuation-benchmark-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    margin-top: 0.5rem;
}

.valuation-benchmark-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    padding: 1.15rem 1.35rem 1.35rem;
    position: relative;
    box-sizing: border-box;
    width: 100%;
}

.benchmark-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}

.benchmark-card-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary, #475569);
}

.benchmark-card-title svg {
    color: var(--text-dark, #0f172a);
}

.benchmark-toolbar {
    margin-bottom: 0.85rem;
}

.benchmark-legend-groups {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
}

.benchmark-legend-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.benchmark-reference-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding-left: 0.75rem;
    border-left: 1.5px solid var(--border-color, #e2e8f0);
}

.benchmark-reference-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, #64748b);
    margin-right: 0.2rem;
}

.benchmark-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Manrope', system-ui, sans-serif;
    color: var(--text-dark, #0f172a);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.benchmark-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-0.5px);
}

.benchmark-chip.is-selected-company {
    background: #0b0f19;
    border-color: #0b0f19;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
    font-weight: 700;
}

.benchmark-chip.is-selected-company .benchmark-yield {
    color: rgba(255, 255, 255, 0.9);
}

.benchmark-chip.is-hidden {
    opacity: 0.35;
    text-decoration: line-through;
}

.benchmark-swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.benchmark-chip.is-selected-company .benchmark-swatch {
    background-color: #ffffff !important;
    box-shadow: none;
}

.benchmark-yield {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary, #475569);
}

.benchmark-chip.is-band-chip {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

.benchmark-chip.is-treasury-chip {
    background: #fffdf9;
    border: 1.5px dashed #78471e;
    color: #5c3414;
}

.benchmark-chip.is-treasury-chip .benchmark-yield {
    color: #78471e;
}

.benchmark-treasury-swatch {
    position: relative;
    width: 16px;
    height: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.benchmark-treasury-swatch::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 2px dashed #78471e;
    transform: translateY(-50%);
}

.benchmark-treasury-swatch::after {
    content: '';
    width: 5px;
    height: 5px;
    background: #ffffff;
    border: 1.6px solid #78471e;
    transform: rotate(45deg);
    position: relative;
    z-index: 1;
}

.benchmark-band-swatch {
    width: 14px;
    height: 8px;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.38);
    border-top: 1.5px dashed #64748b;
    border-bottom: 1.5px dashed #64748b;
    flex-shrink: 0;
}

.benchmark-canvas-box {
    position: relative;
    width: 100%;
    height: 540px;
}

/* Selected Company vs Index Comparison Card */
.benchmark-comparison-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-left: 4px solid var(--text-dark, #0f172a);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    padding: 1.1rem 1.35rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
    width: 100%;
}

.benchmark-comparison-card.is-empty {
    border: 1px dashed var(--border-color, #e2e8f0);
    border-left: 4px solid var(--text-muted, #64748b);
    background: #f8fafc;
    box-shadow: none;
}

.benchmark-comparison-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0.65rem;
}

.benchmark-comparison-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-dark, #0f172a);
}

.benchmark-comparison-title-vs {
    font-weight: 500;
    color: var(--text-muted, #64748b);
}

.benchmark-comparison-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dark, #0f172a);
    flex-shrink: 0;
}

.benchmark-comparison-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.benchmark-comparison-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 9999px;
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    color: var(--text-secondary, #475569);
}

.benchmark-comparison-pill.is-dark {
    background: var(--text-dark, #0f172a);
    border-color: var(--text-dark, #0f172a);
    color: #ffffff;
}

.benchmark-comparison-text {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.6;
    color: var(--text-secondary, #475569);
}

.benchmark-comparison-text strong {
    color: var(--text-dark, #0f172a);
    font-weight: 700;
}

.benchmark-comparison-text .cmp-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dark, #0f172a);
}

.val-bench-footer-note {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
}

@media (max-width: 1280px) {
    .benchmark-legend-groups {
        gap: 0.45rem;
    }

    .benchmark-legend-strip {
        gap: 0.35rem;
    }

    .benchmark-chip {
        padding: 3px 8px;
        font-size: 0.7rem;
        gap: 5px;
    }

    .benchmark-yield {
        font-size: 0.67rem;
    }

    .benchmark-reference-group {
        border-left: none;
        padding-left: 0;
        gap: 0.35rem;
    }
}

@media (max-width: 768px) {
    .benchmark-canvas-box {
        height: 420px;
    }

    .benchmark-reference-group {
        border-left: none;
        padding-left: 0;
        margin-top: 4px;
    }
}

@media (min-width: 769px) and (min-height: 600px) {
    .visualizer-inner:has(#charts-grid.valuation-comparison-view) {
        padding: 0.5rem 1rem 0.65rem 1rem;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .visualizer-top-bar {
        margin-bottom: 0.15rem;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .brand-hero {
        gap: 0.28rem;
        margin-bottom: 0.45rem;
        padding-bottom: 0.45rem;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .company-logo {
        width: 28px;
        height: 28px;
        max-width: 28px;
        max-height: 28px;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .company-name {
        font-size: 1.2rem;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .dashboard-content {
        flex: 0 0 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .valuation-comparison-view {
        flex: 0 0 auto;
        min-height: 0;
        height: auto;
        max-width: 1280px;
        gap: 0.75rem;
        padding-bottom: 0.75rem;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .valuation-benchmark-card {
        flex: 0 0 auto;
        min-height: 0;
        height: auto;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 0.85rem 1.15rem 0.9rem;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .benchmark-card-header {
        margin-bottom: 0.5rem;
        flex-shrink: 0;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .benchmark-toolbar {
        margin-bottom: 0.55rem;
        flex-shrink: 0;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .benchmark-canvas-box {
        flex: 0 0 auto;
        height: clamp(280px, 44vh, 460px);
        min-height: 280px;
        overflow: hidden;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .benchmark-comparison-card {
        flex-shrink: 0;
        padding: 0.85rem 1.15rem;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .benchmark-comparison-header {
        margin-bottom: 0.4rem;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) .benchmark-comparison-text {
        line-height: 1.5;
    }

    .visualizer-inner:has(#charts-grid.valuation-comparison-view) > .dashboard-footer {
        margin-top: 0.35rem;
        padding: 0.1rem 0 0.15rem 0;
    }
}

[data-theme="dark"] .valuation-benchmark-card,
[data-theme="dark"] .benchmark-comparison-card {
    background: var(--card-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .benchmark-chip {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .benchmark-chip.is-selected-company {
    background: #ffffff;
    border-color: #ffffff;
    color: #0f172a;
}

[data-theme="dark"] .benchmark-comparison-card.is-empty {
    background: #1e293b;
}

[data-theme="dark"] .benchmark-comparison-pill {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .benchmark-comparison-pill.is-dark {
    background: #ffffff;
    border-color: #ffffff;
    color: #0f172a;
}

/* ==========================================================================
   RAG Rating Configuration & Settings
   ========================================================================== */
.rag-rating-container {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    width: 100%;
}

.rag-hero-header {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
    padding-bottom: 0.25rem;
}

.rag-hero-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.rag-hero-title-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.rag-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(245, 158, 11, 0.15) 50%, rgba(239, 68, 68, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.25);
    flex-shrink: 0;
}

.rag-hero-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    margin: 0;
}

.rag-metrics-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    background: #e2e8f0;
    border: 1.5px solid #cbd5e1;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 750;
    color: #1e293b;
}

.rag-hero-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

.rag-actions-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.rag-action-btn {
    padding: 0.25rem 0.65rem;
    border-radius: 7px;
    font-size: 0.72rem;
    font-weight: 650;
    border: 1.5px solid #cbd5e1;
    background: #e2e8f0;
    color: #334155;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.rag-action-btn:hover {
    background: #cbd5e1;
    border-color: #94a3b8;
    color: #0f172a;
}

.rag-active-company-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.rag-company-info-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rag-company-mini-logo {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: contain;
}

.rag-company-name-text {
    font-size: 0.82rem;
    font-weight: 750;
    color: var(--text-dark);
}

.rag-live-scorecard {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.rag-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.rag-score-badge.green {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.rag-score-badge.yellow {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.rag-score-badge.red {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.rag-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
}

.rag-search-box {
    position: relative;
    flex: 1 1 180px;
    min-width: 140px;
}

.rag-search-input {
    width: 100%;
    height: 32px;
    padding: 0 0.75rem 0 1.85rem;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 7px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dark);
    box-sizing: border-box;
}

.rag-search-icon {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.rag-category-pills {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.rag-cat-pill {
    padding: 0.25rem 0.65rem;
    border-radius: 7px;
    font-size: 0.72rem;
    font-weight: 650;
    border: 1.5px solid #cbd5e1;
    background: #e2e8f0;
    color: #334155;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.rag-cat-pill:hover {
    background: #cbd5e1;
    border-color: #94a3b8;
    color: #0f172a;
}

.rag-cat-pill.active {
    background: #059669;
    border-color: #047857;
    color: #ffffff;
    font-weight: 750;
    box-shadow: 0 2px 4px rgba(5, 150, 105, 0.25);
}

/* Quality Scoring Table View */
.rag-table-view {
    width: 100%;
}

.rag-table-wrapper {
    width: 100%;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.02);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rag-metrics-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
    font-size: 0.8rem;
    min-width: 680px;
}

.rag-metrics-table thead th {
    position: sticky;
    top: 0;
    background: #f8fafc;
    color: #475569;
    font-size: 0.69rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.8rem 1rem;
    border-bottom: 1.5px solid #e2e8f0;
    white-space: nowrap;
    user-select: none;
    z-index: 2;
}

.rag-metrics-table thead th.col-rag-metric {
    min-width: 220px;
    width: 38%;
}

.rag-metrics-table thead th.col-rag-desc,
.rag-metrics-table td.col-rag-desc,
.rag-metrics-table thead th.col-rag-direction,
.rag-metrics-table td.col-rag-direction {
    display: none;
}

.rag-metrics-table thead th.col-rag-thresh {
    min-width: 150px;
    width: 23%;
}

.rag-metrics-table thead th.col-rag-thresh.green {
    color: #047857;
}

.rag-metrics-table thead th.col-rag-thresh.red {
    color: #b91c1c;
}

.rag-metrics-table thead th.col-rag-status {
    min-width: 130px;
    width: 16%;
    text-align: center;
}

.rag-metrics-table tbody tr {
    transition: background-color var(--transition-fast), opacity var(--transition-fast);
}

.rag-metrics-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

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

.rag-metrics-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Metric Cell & Hover Title */
.rag-table-metric-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

.rag-table-metric-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    border-radius: 6px;
    padding: 0.15rem 0.35rem;
    margin: -0.15rem -0.35rem;
    transition: background-color var(--transition-fast);
    outline: none;
}

.rag-table-metric-title-wrap:hover {
    background: rgba(37, 99, 235, 0.08);
}

.rag-table-metric-title-wrap:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

.rag-table-metric-name {
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--text-dark);
    line-height: 1.25;
    transition: color var(--transition-fast);
}

.rag-table-metric-title-wrap:hover .rag-table-metric-name {
    color: #1d4ed8;
    text-decoration: underline dotted #94a3b8;
    text-underline-offset: 3px;
}

.rag-metric-info-hint {
    font-size: 0.7rem;
    color: #94a3b8;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    user-select: none;
}

.rag-table-metric-title-wrap:hover .rag-metric-info-hint {
    color: #ffffff;
    background: #2563eb;
    border-color: #1d4ed8;
    transform: scale(1.1);
}

.rag-table-metric-info .rag-cat-tag {
    font-size: 0.63rem;
    font-weight: 750;
    padding: 0.12rem 0.42rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Status Cell */
.rag-metrics-table td.col-rag-status {
    text-align: center;
}

/* Empty State */
.rag-table-empty {
    text-align: center;
    padding: 3rem 1.5rem !important;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Direction Badges */
.rag-direction-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 750;
    padding: 0.22rem 0.55rem;
    border-radius: 6px;
    white-space: nowrap;
}

.rag-direction-badge.dir-higher {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.rag-direction-badge.dir-lower {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.28);
}

/* Quality Scoring Metric Floating Tooltip */
.rag-metric-floating-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 380px;
    min-width: 290px;
    width: max-content;
    pointer-events: none;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.35), 0 4px 12px rgba(15, 23, 42, 0.18);
    border-radius: 12px;
}

.rag-metric-floating-tooltip.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(4px);
}

.rag-tooltip-card {
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 0.9rem 1.05rem;
    font-size: 0.78rem;
    line-height: 1.45;
    box-sizing: border-box;
}

.rag-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.65rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.rag-tooltip-title {
    font-weight: 800;
    font-size: 0.88rem;
    color: #f8fafc;
    letter-spacing: -0.01em;
}

.rag-tooltip-header .rag-direction-badge.dir-higher {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.4);
}

.rag-tooltip-header .rag-direction-badge.dir-lower {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border-color: rgba(165, 180, 252, 0.4);
}

.rag-tooltip-section {
    margin-top: 0.6rem;
}

.rag-tooltip-section:first-of-type {
    margin-top: 0;
}

.rag-tooltip-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}

.rag-tooltip-desc {
    color: #e2e8f0;
    font-size: 0.76rem;
    line-height: 1.45;
    margin: 0;
    font-weight: 450;
}

.rag-tooltip-val {
    margin-top: 0.2rem;
}

.rag-dir-text {
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.rag-dir-text.dir-higher {
    color: #34d399;
}

.rag-dir-text.dir-lower {
    color: #a5b4fc;
}

/* Active / Deactive Toggle Button */
.rag-card-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.26rem 0.65rem;
    border-radius: 999px;
    border: 1.5px solid #cbd5e1;
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 750;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    user-select: none;
}

.rag-card-toggle-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: var(--text-dark);
}

.rag-card-toggle-btn.active {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.45);
    color: #047857;
}

.rag-card-toggle-btn.active:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.65);
}

.rag-toggle-track {
    width: 22px;
    height: 13px;
    background: #cbd5e1;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s ease;
    display: inline-block;
    flex-shrink: 0;
}

.rag-card-toggle-btn.active .rag-toggle-track {
    background: #10b981;
}

.rag-toggle-thumb {
    position: absolute;
    top: 1.5px;
    left: 1.5px;
    width: 10px;
    height: 10px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.rag-card-toggle-btn.active .rag-toggle-thumb {
    transform: translateX(9px);
}

.rag-toggle-text {
    font-size: 0.72rem;
    font-weight: 750;
    line-height: 1;
}

/* Disabled Row State */
.rag-metric-row.rag-row-disabled {
    opacity: 0.46;
    background-color: #fafbfc;
}

.rag-metric-row.rag-row-disabled:hover {
    opacity: 0.72;
    background-color: #f8fafc;
}

.rag-metric-row.rag-row-disabled .rag-table-metric-name {
    color: #64748b;
}

.rag-metric-row.rag-row-disabled .rag-input-wrap {
    background: #f1f5f9;
    border-color: #e2e8f0;
    box-shadow: none;
}

.rag-metric-row.rag-row-disabled .rag-number-input {
    color: #94a3b8;
    cursor: not-allowed;
}

/* Backward-compatible card styling fallback */
.rag-rating-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 0.85rem;
    width: 100%;
}

.rag-metric-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.85rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    gap: 0.65rem;
}

.rag-metric-card.rag-card-disabled {
    opacity: 0.52;
    background: #f8fafc;
    border: 1.5px dashed #cbd5e1;
}

.rag-card-desc {
    font-size: 0.73rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

/* Threshold Inputs Row */
.rag-threshold-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
}

.rag-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rag-control-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 750;
}

.rag-control-label.green {
    color: #059669;
}

.rag-control-label.red {
    color: #dc2626;
}

.rag-input-wrap {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 0 0.45rem;
    height: 32px;
    transition: all var(--transition-fast);
}

.rag-input-wrap:focus-within {
    border-color: var(--brand-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.rag-input-wrap.green-wrap {
    border-color: rgba(16, 185, 129, 0.4);
    background: #ffffff;
}

.rag-input-wrap.green-wrap:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.rag-input-wrap.red-wrap {
    border-color: rgba(239, 68, 68, 0.4);
    background: #ffffff;
}

.rag-input-wrap.red-wrap:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.rag-input-dot {
    font-size: 0.7rem;
    margin-right: 0.3rem;
    line-height: 1;
    user-select: none;
    display: inline-flex;
    align-items: center;
}

.rag-input-op {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-right: 0.25rem;
    user-select: none;
}

.rag-number-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 750;
    color: var(--text-dark);
    padding: 0;
    outline: none;
    font-variant-numeric: tabular-nums;
}

.rag-input-unit {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-left: 0.25rem;
    user-select: none;
}

/* Toast */
.rag-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #ffffff;
    padding: 0.65rem 1.15rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 650;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    animation: ragToastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.rag-toast.fade-out {
    opacity: 0;
    transform: translateY(8px);
}

@keyframes ragToastIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@container (max-width: 760px) {
    .rag-rating-grid {
        grid-template-columns: 1fr;
    }

    .rag-hero-title-row {
        padding-right: 0;
    }

    .valuation-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        row-gap: 1rem;
        max-width: 600px;
        margin: 0 auto;
    }

    .val-grid-chart-top {
        grid-column: 1;
        grid-row: auto;
        order: 1;
    }

    .val-grid-chart-bottom {
        grid-column: 1;
        grid-row: auto;
        order: 2;
    }

    .val-grid-inputs-top {
        grid-column: 1;
        grid-row: auto;
        order: 3;
        width: 100%;
    }

    .val-grid-hist-bottom {
        grid-column: 1;
        grid-row: auto;
        order: 4;
        width: 100%;
    }

    .val-grid-disclaimer {
        grid-column: 1;
        grid-row: auto;
        order: 5;
    }

    .valuation-chart-card .chart-container {
        height: 185px;
        flex: none;
    }
}

@container (max-width: 340px) {
    .val-hist-metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Responsive Adaptations & Layout Overhaul (Smartphones, iPads & Tablets)
   Preserves 100% desktop/laptop fidelity for wide viewports (>1024px)
   ========================================================================== */

/* Laptops / Narrow Desktop Screens */
@media (max-width: 1400px) {
    .filters-pane {
        min-width: 220px;
        flex: 0 0 236px;
    }

    .workspace-container.database-collapsed .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Laptops & Compact Desktops (981px - 1250px) */
@media (max-width: 1250px) and (min-width: 981px) {
    .search-container {
        flex: 0 1 250px;
        min-width: 170px;
    }

    .view-toggle-btn {
        padding: 0.22rem 0.45rem;
        font-size: 0.70rem;
        gap: 0.22rem;
    }

    .header-nav-toggles {
        gap: 0.25rem;
    }

    .nav-toggles-group {
        gap: 0.22rem;
    }
}

/* Tablets, iPad Landscape & iPad Portrait (<= 980px) */
@media (max-width: 980px) {

    /* Header layout for iPad & Narrow Desktop */
    .top-nav-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.45rem 0.85rem;
        gap: 0.35rem;
        height: auto;
    }

    .header-left {
        display: none;
    }

    .header-right {
        display: none;
    }

    .header-center {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.4rem;
    }

    .search-container {
        position: static;
        transform: none;
        flex: 0 0 auto;
        height: auto;
        min-width: 0;
        width: 100%;
        max-width: 540px;
    }

    .header-nav-toggles {
        width: 100%;
        margin-left: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
    }

    .nav-toggles-group {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .horizon-toggle-container {
        display: flex !important;
        justify-content: center;
        width: 100%;
        margin: 0.15rem auto 0 auto;
    }

    .view-toggle-btn {
        padding: 0.28rem 0.55rem;
        font-size: 0.72rem;
    }

    /* Workspace stays full height (no broken page scroll displacement) */
    .workspace-container {
        display: flex;
        flex-direction: row;
        height: 100%;
        flex: 1;
        min-height: 0;
        overflow: hidden;
        position: relative;
    }

    .pane-resizer {
        display: none !important;
    }

    /* Filters Drawer on Tablet / iPad */
    .filters-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 95;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .workspace-container.filters-drawer-open .filters-backdrop,
    .filters-backdrop.is-active {
        opacity: 1;
        pointer-events: auto;
    }

    .filters-pane {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 320px;
        max-width: 85vw;
        height: 100%;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-dropdown);
        border-right: 1px solid var(--border-color);
        display: flex !important;
    }

    .workspace-container.filters-drawer-open .filters-pane,
    .filters-pane.is-drawer-open {
        transform: translateX(0);
    }

    .close-filter-drawer-btn {
        display: inline-flex !important;
    }

    .apply-filters-mobile-btn {
        display: block !important;
    }

    .filters-pane-body {
        display: flex;
        flex-direction: column;
    }

    /* Pane sizing when one or both panes are active */
    .database-pane {
        flex: 1 1 50% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 100%;
    }

    .visualizer-pane {
        flex: 1 1 50% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: 100%;
        max-height: 100%;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 0;
        box-sizing: border-box;
    }

    .visualizer-inner {
        flex: 1 1 0%;
        min-height: 0;
        height: 100%;
        max-height: 100%;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding: 0.85rem 1rem 1rem 1rem;
        box-sizing: border-box;
    }

    .workspace-container.database-collapsed .visualizer-pane {
        flex: 1 1 100% !important;
    }

    .workspace-container.visualizer-collapsed .database-pane {
        flex: 1 1 100% !important;
    }

    /* iPad Charts Grid: clean 2-column layout */
    .dashboard-grid,
    .workspace-container.database-collapsed .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.85rem;
    }

    .chart-card {
        padding: 0.95rem;
        border-radius: 14px;
    }

    .chart-container {
        min-height: 165px;
    }

    /* iPad Valuation Calculator: dynamic sizing handled via @container query */
}

/* Smartphones & Small Mobile Devices (< 768px) */
@media (max-width: 768px) {

    /* Compact, Touch-Optimized Mobile Header */
    .top-nav-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 0.45rem 0.65rem;
        gap: 0.35rem;
        position: relative;
    }

    .header-left {
        display: none;
    }

    .header-right {
        display: none;
    }

    .header-center {
        width: 100%;
        gap: 0.35rem;
    }

    .search-container {
        flex: 0 0 auto;
        height: auto;
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    #companySearch {
        height: 36px;
        font-size: 16px;
        /* Prevents auto-zoom in iOS Safari */
        padding-left: 2.15rem;
        border-radius: 10px;
    }

    /* Custom Dropdown on Mobile */
    .custom-dropdown {
        position: fixed;
        top: calc(92px + var(--lq-header-h, 0px));
        left: 8px;
        right: 8px;
        max-height: 60vh;
        z-index: 250;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }

    .dropdown-item {
        padding: 0.7rem 0.85rem;
        font-size: 0.82rem;
    }

    /* Mobile Segmented View Switcher / Tab Bar & 5Y/10Y Toggle Row */
    .header-nav-toggles {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.3rem;
        align-items: center;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }

    .nav-toggles-group {
        display: flex;
        width: 100%;
        background: #e2e8f0;
        padding: 2.5px;
        border-radius: 9px;
        gap: 2px;
        justify-content: stretch;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .view-toggle-btn {
        flex: 1 1 0;
        min-width: 0;
        padding: 0.35rem 0.2rem;
        font-size: 0.68rem;
        font-weight: 700;
        border: none;
        background: transparent;
        border-radius: 7px;
        box-shadow: none;
        justify-content: center;
        gap: 0.2rem;
    }

    .view-toggle-btn svg {
        width: 12px;
        height: 12px;
    }

    .view-toggle-btn span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .view-toggle-btn.btn-active {
        background: #ffffff;
        color: var(--text-dark);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    }

    .view-toggle-btn.btn-active:hover {
        background: #ffffff;
        color: var(--text-dark);
    }

    .horizon-toggle-container {
        display: flex !important;
        justify-content: center;
        width: 100%;
        margin-top: 0.15rem;
        margin-left: 0;
    }

    .horizon-toggle-track {
        height: 24px;
    }

    /* Mobile Workspace & Panes */
    .workspace-container {
        flex-direction: column;
        height: 100%;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .database-pane {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
    }

    .visualizer-pane {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 0;
        box-sizing: border-box;
    }

    .visualizer-inner {
        flex: 1 1 0%;
        min-height: 0;
        height: 100%;
        max-height: 100%;
        overflow-y: auto !important;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding: 0.75rem 0.75rem 1rem 0.75rem;
        box-sizing: border-box;
    }

    /* Touch-Optimized Table */
    .database-toolbar {
        padding: 0.5rem 0.75rem;
    }

    .database-section-heading {
        font-size: 0.84rem;
    }

    .database-table-wrapper {
        -webkit-overflow-scrolling: touch;
    }

    .database-table thead th {
        padding: 0.55rem 0.45rem;
        font-size: 0.65rem;
    }

    .database-table td {
        padding: 0.55rem 0.45rem;
        font-size: 0.75rem;
        height: 42px;
    }

    .col-ticker {
        width: 66px;
        min-width: 66px;
    }

    .col-name {
        max-width: 125px;
        left: 66px;
    }

    .company-name-text {
        max-width: 105px;
    }

    /* Brand Hero on Mobile */
    .brand-hero {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 0.85rem;
        padding-bottom: 0.75rem;
        gap: 0.45rem;
    }

    .header-main-row {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .company-logo {
        width: 36px;
        height: 36px;
        border-radius: 9px;
    }

    .company-name {
        font-size: 1.25rem;
        line-height: 1.2;
    }

    .header-sub-row {
        gap: 0.35rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .ticker-badge,
    .country-badge {
        padding: 0.15rem 0.45rem;
        font-size: 0.74rem;
        border-radius: 6px;
    }

    .market-cap {
        font-size: 0.78rem;
    }

    .scorecard-row {
        font-size: 0.74rem;
        gap: 0.45rem;
        padding: 0.2rem 0.55rem;
    }

    /* Charts Grid on Mobile: 1 single clean column */
    .dashboard-grid,
    .workspace-container.database-collapsed .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    .chart-card {
        padding: 0.85rem;
        border-radius: 14px;
    }

    .card-header h3 {
        font-size: 0.82rem;
    }

    .trend-badge {
        font-size: 0.63rem;
        padding: 0.2rem 0.48rem;
    }

    .chart-container {
        min-height: 175px;
    }

    /* Valuation Calculator Mobile */
    .valuation-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        row-gap: 1rem;
        max-width: 100%;
    }

    .val-grid-chart-top {
        grid-column: 1;
        grid-row: auto;
        order: 1;
    }

    .val-grid-chart-bottom {
        grid-column: 1;
        grid-row: auto;
        order: 2;
    }

    .val-grid-inputs-top {
        grid-column: 1;
        grid-row: auto;
        order: 3;
        width: 100%;
    }

    .val-grid-hist-bottom {
        grid-column: 1;
        grid-row: auto;
        order: 4;
        width: 100%;
    }

    .val-grid-disclaimer {
        grid-column: 1;
        grid-row: auto;
        order: 5;
    }

    .val-col-headers {
        grid-template-columns: 1.05fr repeat(3, 1fr);
        gap: 0.25rem;
    }

    .val-row {
        grid-template-columns: 1.05fr repeat(3, 1fr);
        gap: 0.25rem;
        margin-bottom: 0.55rem;
    }

    .val-row-label {
        font-size: 0.70rem;
    }

    .val-input-wrap {
        height: 36px;
        padding: 0.25rem 0.3rem;
    }

    .val-input {
        font-size: 0.76rem;
    }

    .val-growth-cell {
        height: 36px;
        padding: 0.25rem 0.3rem;
    }

    .val-growth-val {
        font-size: 0.75rem;
    }

    .val-cagr-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 0.45rem;
        padding: 0.65rem 0.75rem;
    }

    .val-cagr-card-badge {
        align-self: center;
        min-width: 100px;
        font-size: 0.95rem;
        padding: 0.35rem 0.75rem;
    }

    .val-hist-card {
        padding: 0.7rem 0.75rem;
    }

    .valuation-chart-card .chart-container {
        height: 185px;
        flex: none;
    }

    /* Filter Drawer Touch Targets */
    .filter-field label {
        font-size: 0.70rem;
    }

    .styled-select {
        height: 38px;
        font-size: 16px;
        /* Prevents auto zoom */
    }

    .input-with-icon input {
        height: 38px;
        font-size: 16px;
    }

    .filter-pill-btn,
    .country-pill-btn,
    .qual-pill-btn {
        padding: 0.32rem 0.6rem;
        font-size: 0.74rem;
    }
}

/* ==========================================================================
   Terminal Bottom Guide Link (Above Site Footer)
   ========================================================================== */
.terminal-guide-footer-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    text-align: center;
    padding: 0.35rem 1rem;
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 70;
}

.terminal-footer-sep {
    color: #cbd5e1;
    font-size: 0.75rem;
    user-select: none;
}

.terminal-footer-disclaimer-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.73rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    letter-spacing: -0.01em;
}

.terminal-footer-disclaimer-btn:hover {
    color: var(--primary-accent);
    background: #f0f9ff;
}

.terminal-footer-disclaimer-btn.active {
    color: var(--primary-accent);
    background: #e0f2fe;
}

.disclaimer-btn-icon {
    display: inline-flex;
    align-items: center;
    color: inherit;
}

.disclaimer-btn-chevron {
    font-size: 0.65rem;
    transition: transform var(--transition-fast);
    display: inline-block;
}

.terminal-footer-disclaimer-btn.active .disclaimer-btn-chevron {
    transform: rotate(180deg);
}

.terminal-guide-footer-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: var(--font-sans);
    font-size: 0.73rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    transition: color var(--transition-fast);
    letter-spacing: -0.01em;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
}

.terminal-guide-footer-link:hover {
    color: var(--primary-accent);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* ==========================================================================
   Regulatory Notice & Disclaimer Drawer (Anchored to Bottom Bar)
   ========================================================================== */
.disclaimer-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9980;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.disclaimer-drawer-backdrop.hidden {
    display: none !important;
}

.disclaimer-drawer {
    position: fixed;
    bottom: 33px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 900px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.16);
    z-index: 9990;
    overflow: hidden;
    animation: disclaimerSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.disclaimer-drawer.hidden {
    display: none !important;
}

@keyframes disclaimerSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 16px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.disclaimer-drawer-inner {
    display: flex;
    flex-direction: column;
    max-height: 60vh;
}

.disclaimer-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: #f8fafc;
}

.disclaimer-drawer-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.disclaimer-drawer-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #e0f2fe;
    color: var(--primary-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.disclaimer-drawer-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-sans);
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.disclaimer-drawer-close {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.65rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.disclaimer-drawer-close:hover {
    color: var(--text-dark);
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.disclaimer-close-x {
    font-size: 1rem;
    line-height: 1;
}

.disclaimer-drawer-body {
    padding: 1.25rem;
    overflow-y: auto;
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.disclaimer-drawer-body p {
    margin: 0;
}

.disclaimer-drawer-body strong {
    color: var(--text-dark);
    font-weight: 700;
}

.disclaimer-drawer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.25rem;
    border-top: 1px solid var(--border-light);
    background: #f8fafc;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--text-light);
}

.disclaimer-drawer-dismiss-btn {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.75rem;
    font-family: var(--font-sans);
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    background: #ffffff;
    transition: all var(--transition-fast);
}

.disclaimer-drawer-dismiss-btn:hover {
    border-color: var(--primary-accent);
    color: var(--primary-accent);
    background: #f0f9ff;
}

@media (max-width: 640px) {
    .terminal-guide-footer-wrap {
        flex-direction: column;
        gap: 0.35rem;
        padding: 0.45rem 0.75rem;
    }

    .terminal-footer-sep {
        display: none;
    }

    .disclaimer-drawer {
        width: 100%;
        left: 0;
        transform: none;
        border-radius: 14px 14px 0 0;
    }
}

/* ==========================================================================
   Save / Rename Screen Modal Dialog
   ========================================================================== */
.save-screen-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
    box-sizing: border-box;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.save-screen-modal-backdrop.hidden {
    display: none !important;
}

.save-screen-modal-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    animation: modalSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.save-screen-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 0.75rem;
}

.save-screen-modal-title-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.save-screen-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f0f9ff;
    color: #0284c7;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.save-screen-modal-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-sans);
    color: #0f172a;
    line-height: 1.3;
}

.save-screen-modal-subtitle {
    margin: 0.25rem 0 0 0;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    color: #64748b;
    line-height: 1.4;
}

.save-screen-modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease;
}

.save-screen-modal-close:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.save-screen-modal-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.save-screen-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.save-screen-modal-label {
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: var(--font-sans);
    color: #334155;
}

.save-screen-modal-input {
    width: 100%;
    height: 38px;
    padding: 0 0.85rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #0f172a;
    background: #ffffff;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.save-screen-modal-input:focus {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.save-screen-modal-hint {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
}

.save-screen-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    padding-top: 0.5rem;
}

.saved-screen-rename-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 11px;
    padding: 0 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: color 0.15s ease, background 0.15s ease;
}

.saved-screen-rename-btn:hover {
    color: #0284c7;
    background: rgba(2, 132, 199, 0.1);
}

/* ==========================================================================
   Terminal Layout Footer Rules
   ========================================================================== */
body>.lq-site-footer {
    display: none !important;
}

.datavis-footer-container {
    width: 100%;
    margin-top: 2rem;
    box-sizing: border-box;
}

.datavis-footer-container .lq-site-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    background: transparent;
}

/* ==========================================================================
   Company Table Right-Click Context Menu & Watchlist Indicator
   ========================================================================== */
.company-context-menu {
    position: fixed;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    min-width: 230px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-family: var(--font-sans);
    user-select: none;
    -webkit-user-select: none;
    animation: cmFadeIn 0.12s ease-out;
}

@keyframes cmFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.company-context-menu.hidden {
    display: none !important;
}

.company-cm-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 8px 8px;
}

.company-cm-logo {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

.company-cm-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.company-cm-ticker {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 0.78rem;
    color: var(--text-dark);
    line-height: 1.2;
}

.company-cm-name {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.company-cm-divider {
    height: 1px;
    background: var(--border-color);
    margin: 3px 0 5px 0;
}

.company-cm-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-dark);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.12s ease, color 0.12s ease;
}

.company-cm-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.company-cm-item .cm-icon {
    flex-shrink: 0;
    color: #64748b;
    transition: color 0.12s ease, fill 0.12s ease;
}

.company-cm-item:hover .cm-icon {
    color: #0284c7;
}

.company-cm-item.in-watchlist {
    color: #dc2626;
}

.company-cm-item.in-watchlist .cm-icon {
    color: #dc2626;
    fill: #fecaca;
}

.company-cm-item.in-watchlist:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.watchlist-star-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
    font-size: 0.72rem;
    margin-left: 3px;
    cursor: default;
    line-height: 1;
}

[data-theme="dark"] .company-context-menu {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .company-cm-ticker {
    color: #f1f5f9;
}

[data-theme="dark"] .company-cm-name {
    color: #94a3b8;
}

[data-theme="dark"] .company-cm-divider {
    background: #334155;
}

[data-theme="dark"] .company-cm-item {
    color: #e2e8f0;
}

[data-theme="dark"] .company-cm-item:hover {
    background: #334155;
    color: #ffffff;
}

[data-theme="dark"] .watchlist-chip {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .watchlist-chip:hover {
    background: #334155;
    border-color: #475569;
}

[data-theme="dark"] .watchlist-chip.active {
    background: #38bdf8;
    border-color: #38bdf8;
}

[data-theme="dark"] .watchlist-chip.active .watchlist-apply-btn {
    color: #0f172a;
}

[data-theme="dark"] .watchlist-chip.active .watchlist-count {
    background: rgba(15, 23, 42, 0.25);
    color: #0f172a;
}

[data-theme="dark"] .watchlist-chip.active .watchlist-rename-btn {
    color: #0f172a;
}

[data-theme="dark"] .watchlist-chip.active .watchlist-delete-btn {
    color: #0f172a;
}

[data-theme="dark"] .portfolio-chip {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .portfolio-chip:hover {
    background: #334155;
    border-color: #475569;
}

[data-theme="dark"] .portfolio-chip.active {
    background: #38bdf8;
    border-color: #38bdf8;
}

[data-theme="dark"] .portfolio-chip.active .portfolio-apply-btn {
    color: #0f172a;
}

[data-theme="dark"] .portfolio-chip.active .portfolio-count {
    background: rgba(15, 23, 42, 0.25);
    color: #0f172a;
}

[data-theme="dark"] .portfolio-chip.active .portfolio-rename-btn {
    color: #0f172a;
}

[data-theme="dark"] .portfolio-chip.active .portfolio-builder-link-btn {
    color: #0f172a;
}

[data-theme="dark"] .portfolio-chip.active .portfolio-delete-btn {
    color: #0f172a;
}

[data-theme="dark"] .company-cm-item.in-portfolio {
    background: rgba(56, 189, 248, 0.15);
}

[data-theme="dark"] .company-cm-item.in-portfolio:hover {
    background: rgba(56, 189, 248, 0.25);
}

/* Priced-in Growth Minimal Focused View */
.priced-in-growth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0 1.25rem 0;
    box-sizing: border-box;
}

.pig-card-wrap {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    box-sizing: border-box;
}

.pig-main-card {
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 12px);
    padding: 1.1rem 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
}

.pig-metrics-grid,
.pig-3x3-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

/* 3x3 Table Placement:
   Row 1: S&P Yield (col 1), S&P CAGR (col 2), empty (col 3)
   Row 2: X Yield (col 1), X Implied (col 2), empty (col 3)
   Row 3: empty (col 1), X Historic (col 2), Difference (col 3)
*/
.pig-cell-1-1 {
    grid-column: 1;
    grid-row: 1;
}

.pig-cell-1-2 {
    grid-column: 2;
    grid-row: 1;
}

.pig-cell-2-1 {
    grid-column: 1;
    grid-row: 2;
}

.pig-cell-2-2 {
    grid-column: 2;
    grid-row: 2;
}

.pig-cell-3-2 {
    grid-column: 2;
    grid-row: 3;
}

.pig-cell-3-3 {
    grid-column: 3;
    grid-row: 3;
}

@media (max-width: 768px) {

    .pig-metrics-grid,
    .pig-3x3-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .pig-cell-1-1,
    .pig-cell-1-2,
    .pig-cell-2-1,
    .pig-cell-2-2,
    .pig-cell-3-2,
    .pig-cell-3-3 {
        grid-column: auto !important;
        grid-row: auto !important;
    }
}

/* S&P 500 Benchmark Row Styling (Distinct Colour) */
.pig-metric-box.pig-sp-benchmark-box {
    background: linear-gradient(135deg, rgba(241, 245, 249, 0.95) 0%, rgba(226, 232, 240, 0.7) 100%) !important;
    border-color: rgba(148, 163, 184, 0.5) !important;
    box-shadow: 0 1px 4px rgba(100, 116, 139, 0.08);
}

.pig-metric-box.pig-sp-benchmark-box:hover {
    background: linear-gradient(135deg, rgba(241, 245, 249, 1) 0%, rgba(226, 232, 240, 0.9) 100%) !important;
    border-color: rgba(100, 116, 139, 0.6) !important;
}

.pig-metric-box.pig-sp-benchmark-box .val-hist-metric-label {
    color: #475569 !important;
    font-weight: 800;
}

[data-theme="dark"] .pig-metric-box.pig-sp-benchmark-box {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(51, 65, 85, 0.5) 100%) !important;
    border-color: rgba(100, 116, 139, 0.5) !important;
}

/* Charts Row Underneath Table */
.pig-charts-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.95rem;
    width: 100%;
    margin-top: 1rem;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .pig-charts-row {
        grid-template-columns: 1fr;
    }
}

.pig-chart-card {
    background: #ffffff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 12px);
    padding: 1.15rem 1.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    min-height: 250px;
    box-sizing: border-box;
}

.pig-chart-container {
    position: relative;
    flex: 1;
    width: 100%;
    min-height: 190px;
}

.pig-metric-box {
    padding: 0.75rem 0.95rem !important;
    min-height: 92px !important;
    border-radius: 9px !important;
    transition: all var(--transition-fast, 0.15s ease);
}

.pig-metric-box:hover {
    border-color: rgba(203, 213, 225, 1);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.pig-metric-box .val-hist-metric-val {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 1.18rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    line-height: 1.15 !important;
}

.pig-metric-box .val-hist-metric-unit {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-left: 0.3rem;
    align-self: baseline;
}

.pig-metric-val-wrap {
    display: flex;
    align-items: baseline;
    gap: 0;
    min-width: 0;
    margin-bottom: 0.15rem;
}

.pig-editable-wrap {
    display: inline-flex;
    align-items: baseline;
    position: relative;
    max-width: 100%;
    cursor: text;
}

.pig-editable-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-dark, #0f172a);
    line-height: 1.15;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0;
    margin: 0;
    width: auto;
    field-sizing: content;
    outline: none;
    -moz-appearance: textfield;
    transition: border-color var(--transition-fast, 0.15s ease), color var(--transition-fast, 0.15s ease);
}

.pig-editable-val::-webkit-outer-spin-button,
.pig-editable-val::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pig-editable-val:focus {
    color: #0284c7 !important;
    border-bottom: 2px solid #0284c7;
}

.pig-editable-wrap:focus-within .pig-val-percent {
    color: #0284c7 !important;
}

.pig-val-percent {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.18rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-dark, #0f172a);
    line-height: 1.15;
    margin-left: 0.04rem;
    pointer-events: none;
    user-select: none;
    transition: color var(--transition-fast, 0.15s ease);
}

[data-theme="dark"] .pig-editable-val,
[data-theme="dark"] .pig-val-percent {
    color: #f1f5f9;
}

/* Priced-in Growth Difference Explanation */
.val-hist-metric-sub.pig-diff-sub-wrap {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.28rem !important;
    min-height: auto !important;
    width: 100%;
    margin-top: 0.2rem;
}

.pig-diff-desc {
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.30;
    color: var(--text-muted, #64748b);
    letter-spacing: -0.01em;
}

[data-theme="dark"] .pig-diff-desc {
    color: #94a3b8;
}

/* Priced-in Growth 6-Bar Visualiser */
.pig-bar-chart-section {
    margin-top: 1.05rem;
    padding-top: 0.95rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    width: 100%;
    box-sizing: border-box;
}

.pig-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.55rem;
}

.pig-chart-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-dark, #0f172a);
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.pig-chart-subtitle {
    font-size: 0.70rem;
    color: var(--text-muted, #64748b);
    font-weight: 500;
}

.pig-bar-chart-container {
    position: relative;
    width: 100%;
    height: 260px;
    box-sizing: border-box;
}

[data-theme="dark"] .pig-bar-chart-section {
    border-top-color: rgba(51, 65, 85, 0.6);
}

[data-theme="dark"] .pig-chart-title {
    color: #f1f5f9;
}

.pig-footer-note {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 0.5rem;
    padding-bottom: 0.15rem;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light, #94a3b8);
    letter-spacing: 0.02em;
}

[data-theme="dark"] .pig-footer-note {
    color: #64748b;
}

/* --------------------------------------------------------------------------
   Visualiser Company Comparison Styles
   -------------------------------------------------------------------------- */
.visualizer-comp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.45rem 0.65rem;
    margin-bottom: 0.65rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    flex-shrink: 0;
}

.visualizer-comp-toolbar.is-idle {
    justify-content: flex-start;
    background: transparent;
    border: none;
    padding: 0 0 0.45rem 0;
}

.comp-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex-wrap: wrap;
}

.comp-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.comp-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #1e293b;
    font-size: 0.76rem;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 0.32rem 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.comp-trigger-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #eff6ff;
}

.comp-toolbar-chips {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.comp-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.74rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.comp-chip.primary {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.comp-chip.secondary {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

.comp-chip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.comp-chip-vs {
    font-size: 0.68rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
}

.comp-chip-remove {
    background: transparent;
    border: none;
    color: #475569;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.comp-chip-remove:hover {
    color: #dc2626;
}

.comp-change-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #475569;
    padding: 0.2rem 0.45rem;
    cursor: pointer;
    transition: all 0.12s ease;
}

.comp-change-btn:hover {
    border-color: #64748b;
    color: #64748b;
    background: #f1f5f9;
}

.comp-view-switcher {
    display: inline-flex;
    align-items: center;
    background: #e2e8f0;
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.comp-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 0.22rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.12s ease;
}

.comp-view-btn.is-active {
    background: #ffffff;
    color: #0f172a;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Comparison Dropdown Box */
.comp-dropdown-container {
    position: absolute;
    top: calc(100% + 4px);
    left: 0.5rem;
    width: 340px;
    max-width: 92vw;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.comp-dropdown-container.hidden {
    display: none !important;
}

.comp-dd-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.comp-dd-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.35rem 0.55rem;
    flex: 1 1 auto;
}

.comp-dd-search-wrap svg {
    color: #64748b;
    flex-shrink: 0;
}

.comp-dd-input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.78rem;
    font-family: var(--font-sans);
    color: #0f172a;
    width: 100%;
}

.comp-dd-close-btn {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
}

.comp-dd-close-btn:hover {
    color: #0f172a;
}

.comp-dd-results {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
}

.comp-dd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s ease;
    gap: 0.5rem;
}

.comp-dd-item:hover {
    background: #f1f5f9;
}

.comp-dd-item-left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex: 1 1 auto;
}

.comp-dd-logo {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.comp-dd-no-logo {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: #e2e8f0;
    flex-shrink: 0;
}

.comp-dd-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.comp-dd-ticker {
    font-size: 0.74rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #0f172a;
}

.comp-dd-name {
    font-size: 0.68rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.comp-dd-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.comp-dd-mcap {
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: #334155;
}

.comp-dd-scores {
    font-size: 0.64rem;
    color: #64748b;
}

.comp-dd-empty {
    text-align: center;
    padding: 1.5rem 0.5rem;
    font-size: 0.76rem;
    color: #94a3b8;
}

/* Comparison Hero Dual Layout */
.brand-hero.comp-hero-active {
    padding-bottom: 0.75rem;
}

.comp-hero-wrap {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.comp-hero-card {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.comp-hero-card.comp-hero-pri {
    border-top: 3px solid #2563eb;
}

.comp-hero-card.comp-hero-sec {
    border-top: 3px solid #8da0b3;
}

.comp-hero-vs-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    font-size: 0.68rem;
    font-weight: 800;
    color: #64748b;
    flex-shrink: 0;
    align-self: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.comp-ticker-pri {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
}

.comp-ticker-sec {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

/* Side by Side Grid Layout */
.dashboard-grid.comparison-grid-side-by-side {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem !important;
}

@media (max-width: 768px) {
    .dashboard-grid.comparison-grid-side-by-side {
        grid-template-columns: 1fr !important;
    }

    .comp-hero-wrap {
        flex-direction: column;
        gap: 0.5rem;
    }

    .comp-hero-card.comp-hero-sec {
        max-width: 100%;
        width: 100%;
    }
}

.comp-side-card.is-primary {
    border-left: 3px solid #2563eb;
}

.comp-side-card.is-secondary {
    border-left: 3px solid #8da0b3;
}

.comp-card-ticker-pill {
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: var(--font-mono);
    line-height: 1;
}

.comp-card-ticker-pill.pri {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.comp-card-ticker-pill.sec {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

/* Overlay Card Layout */
.comp-overlay-badges {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.comp-overlay-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    font-size: 0.72rem;
    color: #64748b;
    padding-top: 0.35rem;
    border-top: 1px dashed #f1f5f9;
    margin-top: 0.35rem;
}

.comp-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

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

/* Visualiser Top Bar & Comparison Actions */
.visualizer-top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    margin-bottom: 0.35rem;
    position: relative;
    z-index: 70;
    flex-shrink: 0;
}

.visualizer-top-actions {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.rf-top-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #1e293b;
    font-size: 0.76rem;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 0.32rem 0.72rem;
    text-decoration: none;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    white-space: nowrap;
}

.rf-top-link:hover {
    border-color: #1B7C69;
    color: #1B7C69;
    background: #E6F7F3;
}

.rf-top-link.hidden {
    display: none !important;
}

.visualizer-comp-action-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.visualizer-top-actions .comp-dropdown-container {
    top: calc(100% + 6px);
    bottom: auto;
    right: 0;
    left: auto;
}

.comp-active-pill-top,
.comp-active-pill-bottom {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.28rem 0.6rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.comp-active-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
}

/* Visualiser Comparator Zone (Below Main Company Details) */
.visualizer-comparator-zone {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.15rem auto 1.15rem auto;
    position: relative;
    z-index: 30;
}

.visualizer-comparator-zone.hidden {
    display: none !important;
}

.comp-comparator-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-top: 2px solid #8da0b3;
    border-radius: 9px;
    padding: 0.45rem 0.75rem 0.5rem 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    max-width: 520px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.visualizer-comparator-zone .comp-dropdown-container {
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    width: 380px;
    max-width: 95vw;
}

.comp-card-top-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.comp-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.comp-card-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8da0b3;
    flex-shrink: 0;
}

.comp-card-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.comp-card-co-info {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.comp-card-logo {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.comp-card-name {
    font-size: 0.78rem;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.comp-card-name strong {
    font-family: var(--font-mono);
    color: #0f172a;
    font-weight: 700;
}

.comp-card-remove-btn {
    background: none;
    border: none;
    font-size: 1.15rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 0.2rem;
    margin-left: auto;
    border-radius: 4px;
    transition: color 0.15s ease, background-color 0.15s ease;
    flex-shrink: 0;
}

.comp-card-remove-btn:hover {
    color: #ef4444;
    background-color: #fee2e2;
}

.comp-card-bottom-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.68rem;
    color: #64748b;
    flex-wrap: wrap;
    width: 100%;
}

.comp-card-bottom-left {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.comp-card-country {
    font-size: 0.65rem;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.comp-card-mcap {
    font-size: 0.68rem;
    color: #64748b;
    white-space: nowrap;
}

.comp-card-mcap strong {
    color: #0f172a;
    font-family: var(--font-mono);
}

.comp-card-scores {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.66rem;
    white-space: nowrap;
}

.comp-card-scores strong {
    font-size: 0.68rem;
}

.comp-badge-mini {
    font-size: 0.6rem !important;
    padding: 0.08rem 0.35rem !important;
}

.comp-change-btn {
    padding: 0.2rem 0.55rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.comp-change-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.visualizer-inner>.dashboard-footer {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.4rem 0 0.8rem 0;
    flex-shrink: 0;
}

[data-theme="dark"] .visualizer-top-bar .comp-trigger-btn,
[data-theme="dark"] .visualizer-top-bar .rf-top-link,
[data-theme="dark"] .comp-active-pill-bottom,
[data-theme="dark"] .comp-active-pill-top,
[data-theme="dark"] .comp-dropdown-container {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .comp-trigger-btn,
[data-theme="dark"] .rf-top-link {
    color: #e2e8f0;
}

[data-theme="dark"] .rf-top-link:hover {
    background: #334155;
    color: #38D4B7;
    border-color: #38D4B7;
}

[data-theme="dark"] .comp-trigger-btn:hover {
    background: #334155;
    color: #60a5fa;
    border-color: #60a5fa;
}

[data-theme="dark"] .comp-active-label {
    color: #94a3b8;
}

[data-theme="dark"] .comp-dd-search-wrap {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .comp-dd-input {
    background: transparent;
    color: #f1f5f9;
}

[data-theme="dark"] .comp-dd-item:hover {
    background: #334155;
}

[data-theme="dark"] .comp-dd-ticker {
    color: #f1f5f9;
}

[data-theme="dark"] .comp-dd-mcap {
    color: #cbd5e1;
}

[data-theme="dark"] .comp-sec-tag {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .comp-comparator-card {
    background: #1e293b;
    border-color: #334155;
    border-top-color: #8da0b3;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .comp-card-tag {
    color: #94a3b8;
}

[data-theme="dark"] .comp-card-name {
    color: #cbd5e1;
}

[data-theme="dark"] .comp-card-name strong {
    color: #f1f5f9;
}

[data-theme="dark"] .comp-card-country {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .comp-card-mcap strong {
    color: #f1f5f9;
}

[data-theme="dark"] .comp-card-remove-btn {
    color: #64748b;
}

[data-theme="dark"] .comp-card-remove-btn:hover {
    color: #f87171;
    background-color: rgba(239, 68, 68, 0.15);
}

[data-theme="dark"] .comp-change-btn {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

[data-theme="dark"] .comp-change-btn:hover {
    background: #334155;
    border-color: #475569;
    color: #ffffff;
}