/* DESIGN SYSTEM — Unified with Landing Page */
:root {
    /* LIGHT THEME (Cream / Green) */
    --bg-app: #F5F5F0;
    --bg-sidebar: #F8F8F4;
    --bg-header: #F8F8F4;
    --bg-card: #FEFEFE;
    --bg-elevated: #F5F5F0;

    --text-primary: #1A1A18;
    --text-secondary: #555550;
    --text-muted: #8A8A82;

    --border-color: rgba(26, 77, 46, 0.10);
    --border-subtle: #ECEAE3;

    --accent: #274A3A;
    --accent-light: #356B4E;
    --accent-dark: #1A3428;
    --teal: #0ABAB5;
    --teal-light: #2DD4CF;
    --sand: #CCA470;
    --success: #10B981;
    --danger: #EF4444;

    --font-main: 'Montserrat', 'Inter', sans-serif;
    --font-arabic: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', sans-serif;
    --font-mono: 'JetBrains Mono', 'Roboto Mono', monospace;

    --shadow-card: 0 1px 3px rgba(26, 77, 46, 0.06);
}

/* Superscript footnote markers */
sup {
    font-size: 0.7em;
    vertical-align: super;
    line-height: 0;
    color: var(--danger);
}

/* Arabic language styles */
[lang="ar"] {
    direction: rtl;
    font-family: var(--font-arabic);
    font-size: 1.05em;
    /* 5% larger for Arabic */
}

[lang="ar"] body {
    font-family: var(--font-arabic);
}

[lang="ar"] .sidebar,
[lang="ar"] .header,
[lang="ar"] .d-header,
[lang="ar"] .d-sub-header,
[lang="ar"] .section-title,
[lang="ar"] .tab-btn,
[lang="ar"] button,
[lang="ar"] label,
[lang="ar"] h1,
[lang="ar"] h2,
[lang="ar"] h3,
[lang="ar"] h4 {
    font-family: var(--font-arabic);
}

[lang="ar"] .mini-card .label,
[lang="ar"] .metric-label {
    font-size: 0.72rem;
    /* Slightly larger for Arabic labels */
}

/* Force LTR for numeric values in RTL mode - fixes "-2.0%" showing as "2.0%-" */
[lang="ar"] .metric-value,
[lang="ar"] .large-value,
[lang="ar"] .price-value,
[lang="ar"] .delta-positive,
[lang="ar"] .delta-negative,
[lang="ar"] .delta-neutral,
[lang="ar"] .delta-container,
[lang="ar"] .mini-card .value,
[lang="ar"] .pct-change {
    direction: ltr;
    unicode-bidi: isolate;
}

/* Keep values right-aligned in RTL while maintaining LTR direction for numbers */
[lang="ar"] .large-value,
[lang="ar"] .metric-value {
    text-align: right;
}

[data-theme="dark"] {
    /* DARK THEME (Forest Green) */
    --bg-app: #0F1F16;
    --bg-sidebar: #1A3428;
    --bg-header: #1A3428;
    --bg-card: #1C3A2E;
    --bg-elevated: #1A3428;

    --text-primary: #F5F5F0;
    --text-secondary: #BCC0B4;
    --text-muted: #8A9480;

    --border-color: rgba(10, 186, 181, 0.12);
    --border-subtle: rgba(10, 186, 181, 0.06);

    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Dark mode sidebar brand & logo fixes */
[data-theme="dark"] .brand span {
    color: var(--teal);
}

[data-theme="dark"] .brand img {
    filter: brightness(2.2) saturate(0.6);
}

[data-theme="dark"] .sidebar {
    --accent: #0ABAB5;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    font-size: 14px;
    display: flex;
}

/* =========================================
   SIDEBAR (Fixed Left)
   ========================================= */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.brand {
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    text-decoration: none;
}

.brand span {
    color: var(--accent);
}

/* ASSET TOGGLE (Stocks / Funds) — shared across all pages */
.asset-toggle {
    display: flex;
    gap: 0;
    margin: 12px 16px 8px;
    background: var(--bg-elevated);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--border-color);
}

.asset-toggle-btn {
    flex: 1;
    padding: 7px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: 0.3px;
    text-decoration: none;
    text-align: center;
}

.asset-toggle-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.asset-toggle-btn:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-card);
}

/* Sidebar header — pinned search + overview link */
.sidebar-header {
    flex-shrink: 0;
    padding: 16px 0 0;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 0;
    min-height: 0;
}

/* Sidebar footer — pinned at bottom */
.sidebar-footer {
    flex-shrink: 0;
    padding: 0;
    border-top: 1px solid var(--border-color);
}

.nav-section {
    padding: 0 16px;
    margin-bottom: 24px;
}

/* Nav Header */
.nav-header {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.nav-item {
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--border-subtle);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(10, 186, 181, 0.08);
    color: var(--teal);
}

/* PRO badge for gated sidebar items */
.nav-item-pro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(10, 186, 181, 0.2);
    background: rgba(10, 186, 181, 0.04);
    border-left: 3px solid var(--teal);
    box-shadow: 0 0 8px rgba(10, 186, 181, 0.08);
}

.nav-item-pro:hover {
    background: rgba(10, 186, 181, 0.10);
    border-color: rgba(10, 186, 181, 0.35);
    box-shadow: 0 0 12px rgba(10, 186, 181, 0.12);
}

[dir="rtl"] .nav-item-pro {
    border-left: 1px solid rgba(10, 186, 181, 0.2);
    border-right: 3px solid var(--teal);
}

.nav-item-pro::after {
    content: "PRO";
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(10, 186, 181, 0.15);
    color: var(--teal);
    flex-shrink: 0;
    margin-left: 8px;
}

[dir="rtl"] .nav-item-pro::after {
    margin-left: 0;
    margin-right: 8px;
}

/* Sidebar Search */
.sidebar-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.sidebar-search:focus {
    border-color: var(--teal);
}

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

/* Industry Groups in Sidebar */
.industry-group {
    margin-bottom: 4px;
}

.industry-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.industry-header:hover {
    background: var(--border-subtle);
    color: var(--accent);
}

.industry-header .arrow {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s;
    cursor: pointer;
}

.industry-header .count {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: auto;
}

.industry-companies {
    overflow: hidden;
    max-height: 1000px;
    transition: max-height 0.3s ease;
}

.industry-group.collapsed .industry-companies {
    max-height: 0;
}

.industry-group.collapsed .arrow {
    transform: rotate(-90deg);
}

.nav-item.indented {
    padding-left: 28px;
    font-size: 12px;
}

/* Active/Current state highlighting */
.industry-header.active {
    background: var(--border-subtle);
    color: var(--accent);
}

.nav-item.active {
    background: var(--border-subtle);
    color: var(--teal);
    font-weight: 500;
}

/* =========================================
   MAIN AREA (Right)
   ========================================= */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevent flex overflow */
}

/* HEADER */
.top-header {
    height: 60px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.search-container {
    position: relative;
    width: 320px;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-app);
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-main);
    transition: border 0.2s;
}

.search-input:focus {
    border-color: var(--teal);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 9px;
    color: var(--text-muted);
    font-size: 14px;
}

/* DASHBOARD CONTENT */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background-image:
        linear-gradient(rgba(26, 77, 46, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 77, 46, 0.025) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* SITE FOOTER */
.site-footer {
    text-align: center;
    padding: 32px 24px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    margin-top: 48px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.8;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--teal);
}

.footer-separator {
    margin: 0 8px;
    color: var(--border-color);
}

[data-theme="dark"] .content-scroll {
    background-image:
        linear-gradient(rgba(10, 186, 181, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(10, 186, 181, 0.03) 1px, transparent 1px);
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* COMPANY HERO */
.company-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.hero-info h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.ticker-tag {
    background: var(--border-subtle);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 8px;
}

.sector-tag {
    color: var(--text-secondary);
    font-size: 14px;
}

.company-full-name {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.hero-price {
    text-align: right;
}

.price-value {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.price-currency {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

/* DESCRIPTION SECTION */
.profile-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-card);
}

.profile-text {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 15px;
    margin: 0;

}

/* METRIC CARDS */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.metric-sub {
    font-size: 12px;
    margin-top: 8px;
    color: var(--text-muted);
}

/* FINANCIALS TABLE */
.table-section {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    overflow-x: auto;
}

.metrics-section {
    overflow-x: auto;
}

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

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}

th {
    text-align: right;
    padding: 12px 24px;
    background: var(--border-subtle);
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

th:first-child {
    text-align: left;
}

td {
    padding: 16px 24px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-mono);
}

td:first-child {
    text-align: left;
    font-family: var(--font-main);
    color: var(--text-secondary);
    font-weight: 500;
}

tr:last-child td {
    border-bottom: none;
}

/* Delta Rows */
.delta-row td {
    border-top: none;
    padding-top: 0;
    padding-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 500;
}

.delta-container {
    padding: 0;
    margin: 0;
    /* Visually center between this column and the next */
    position: relative;
    /* Move right by 50% of the cell width to sit on the border */
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}




.delta-val {
    display: inline-block;
}

.delta-positive {
    color: var(--success);
}

.delta-negative {
    color: var(--danger);
}

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

/* Expandable Detail Rows */
.has-detail td:first-child {
    cursor: pointer;
}

.detail-toggle {
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 4px 0 4px 6px;
    border-color: transparent transparent transparent var(--text-muted);
    margin-right: 8px;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

[dir="rtl"] .detail-toggle {
    margin-right: 0;
    margin-left: 8px;
}

.has-detail.expanded .detail-toggle {
    transform: rotate(90deg);
}

.detail-row {
    display: none;
}

.detail-row.visible {
    display: table-row;
}

.detail-row td {
    padding: 4px 24px 4px 40px;
    font-size: 11px;
    color: var(--text-muted);
    border-bottom: none;
    font-family: var(--font-main);
    font-weight: 400;
}

[dir="rtl"] .detail-row td {
    padding: 4px 40px 4px 24px;
}

.detail-row td:first-child {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 11px;
}

.detail-row:last-of-type td {
    padding-bottom: 8px;
}


/* UTILS */
.theme-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.theme-btn:hover {
    background: var(--border-subtle);
    color: var(--text-primary);
}


/* DAMODARAN LAYOUT */

/* METADATA HEADER */
.metadata-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    margin-bottom: 32px;
    padding: 0 8px;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.meta-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    font-family: var(--font-mono);
}

/* 3-COLUMN GRID */
.damodaran-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 40px;
    align-items: start;
    /* Align to top */
}

@media (max-width: 1100px) {
    .damodaran-grid {
        grid-template-columns: 1fr;
        /* Stack on smaller screens */
    }
}

.d-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.d-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 8px;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.d-sub-header {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: -4px;
    margin-bottom: 12px;
    font-weight: 500;
    line-height: 1.4;
}

/* DRIVER GROUPS */
.driver-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-card);
}

/* MINI CARDS */
.mini-card {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.mini-card .mini-sub {
    width: 100%;
    order: 1;
    /* Puts subtitle on its own line below */
    font-size: 9px;
    color: var(--text-muted, #8a8a8a);
    font-weight: 400;
    text-transform: none;
    margin-top: 2px;
}

.mini-card:last-child {
    border-bottom: none;
}

.mini-card .label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.mini-card .value {
    font-size: 15px;
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text-primary);
}

/* RATIOS GRID */
.ratios-grid {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    box-shadow: var(--shadow-card);
}

/* HIGHLIGHT CARD */
.highlight-card {
    border: 1px solid var(--border-color);
    background: linear-gradient(to bottom right, var(--bg-card), var(--bg-app));
}

.large-value {
    font-size: 26px;
}

/* CHART CONTROLS */
.chart-header .chart-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}

.chart-header .chart-btn:hover {
    background: var(--border-subtle);
    color: var(--text-primary);
}

.chart-header .chart-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.chart-overlays label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

/* TABS SYSTEM */
.tabs-section {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.tabs-nav {
    display: flex;
    gap: 32px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 0;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

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

.tab-btn.active {
    color: var(--accent);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--teal);
}

.tab-content {
    min-height: 400px;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0.95;
        transform: translateY(5px);
    }

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

/* SETTINGS */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.setting-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* TOGGLE SWITCH */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    /* Grey default */
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--accent);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* RESET BUTTON */
.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* SELECT DROPDOWN (Settings) */
.setting-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-main);
    cursor: pointer;
    outline: none;
    min-width: 120px;
}

.setting-select:focus {
    border-color: var(--accent);
}

/* RTL Support */
[dir="rtl"] .sidebar {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

[dir="rtl"] .gov-mitigating {
    margin-left: 0;
    margin-right: 20px;
    border-radius: 12px 12px 0 12px;
}

[dir="rtl"] .gov-mitigating::before {
    left: auto;
    right: -16px;
    content: "‹";
}

/* COMPACT VIEW */
body.compact {
    font-size: 13px;
}

body.compact .metric-card,
body.compact .company-hero,
body.compact .profile-section,
body.compact .table-section {
    padding: 16px;
    /* Reduced from 24px */
    margin-bottom: 16px;
    /* Reduced from 32px/24px */
}

body.compact .metric-value {
    font-size: 20px;
    /* Reduced from 24px */
}

body.compact .price-value {
    font-size: 24px;
    /* Reduced from 32px */
}

body.compact th,
body.compact td {
    padding: 8px 16px;
    /* Reduced padding */
}

body.compact .damodaran-grid {
    gap: 16px;
    margin-bottom: 20px;
}

body.compact .sidebar {
    width: 220px;
    /* Slimmer sidebar */
}

body.compact .nav-item {
    margin-bottom: 0;
    padding: 6px 12px;
}

/* =========================================
   STORY SECTION  
   ========================================= */
.story-section {
    padding: 16px 24px;
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.story-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.story-oneliner {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
}

.story-source {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    font-weight: 500;
}

/* =========================================
   VALUATION ROW (2 Column: Metrics + Context)
   ========================================= */
.valuation-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
    align-items: start;
}

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

/* Context Column */
.context-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.context-col .d-header {
    margin-bottom: 8px;
}

/* Sub-header takes same space as left column for alignment */
.context-col .d-sub-header {
    margin-top: -4px;
    margin-bottom: 12px;
    font-weight: 500;
    line-height: 1.4;
}

/* Context Box (Collapsible) - styled like driver-group */
.context-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-card);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.context-box:hover {
    border-color: var(--teal);
}

.context-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-right: 6px;
}

.context-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-box.expanded .context-text {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

.context-box::after {
    content: " ▾ more";
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.context-box.expanded::after {
    content: " ▴ less";
}

/* =========================================
   GOVERNANCE TAB
   ========================================= */
.governance-header {
    margin-bottom: 24px;
}

.governance-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.governance-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.governance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

/* Issue Card */
.gov-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-card);
    border-left: 5px solid var(--danger);
    transition: transform 0.2s, box-shadow 0.2s;
}

.gov-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Materiality color variants */
.gov-card.mat-10 {
    border-left-color: #DC2626;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.05), var(--bg-card));
}

.gov-card.mat-9 {
    border-left-color: #EA580C;
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.05), var(--bg-card));
}

.gov-card.mat-8 {
    border-left-color: #F59E0B;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), var(--bg-card));
}

.gov-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.gov-category-icon {
    font-size: 28px;
    line-height: 1;
}

.gov-card-title {
    flex: 1;
}

.gov-card-title h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.gov-card-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.gov-category-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--border-subtle);
    padding: 2px 8px;
    border-radius: 4px;
}

.gov-source-tag {
    font-size: 10px;
    color: var(--text-muted);
}

.gov-agency-badge {
    font-size: 11px;
    background: #FEF3C7;
    color: #92400E;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

[data-theme="dark"] .gov-agency-badge {
    background: #451A03;
    color: #FCD34D;
}

.gov-entity-badge {
    font-size: 11px;
    background: linear-gradient(135deg, #1a5f2a, #2d8a3e);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

[data-theme="dark"] .gov-entity-badge {
    background: linear-gradient(135deg, #166534, #22c55e);
    color: #fff;
}

.gov-description {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Chat-bubble mitigating factor */
.gov-mitigating {
    background: #ECFDF5;
    border-radius: 12px 12px 12px 0;
    padding: 12px 16px;
    position: relative;
    margin-left: 20px;
}

[data-theme="dark"] .gov-mitigating {
    background: #064E3B;
}

.gov-mitigating::before {
    content: "›";
    position: absolute;
    left: -16px;
    top: 10px;
    font-size: 20px;
    color: #059669;
    font-weight: 700;
}

.gov-mitigating-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: #059669;
    margin-bottom: 4px;
}

[data-theme="dark"] .gov-mitigating-label {
    color: #34D399;
}

.gov-mitigating-text {
    font-size: 12px;
    color: #065F46;
    line-height: 1.4;
}

[data-theme="dark"] .gov-mitigating-text {
    color: #A7F3D0;
}

/* Empty state */
.governance-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.governance-empty .empty-icon {
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--success);
}

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

/* Mobile Menu Toggle Button */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}

.menu-toggle:hover {
    background: var(--border-subtle);
}

/* Sidebar Overlay (for mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
}

/* RTL overlay adjustment */
[dir="rtl"] .sidebar-overlay {
    left: 0;
    right: 0;
}

/* =========================================
   TABLET BREAKPOINT (≤1024px)
   ========================================= */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .content-scroll {
        padding: 24px;
    }

    .company-hero {
        padding: 20px;
    }

    .damodaran-grid {
        gap: 16px;
    }

    .metadata-grid {
        gap: 20px;
    }

    .tabs-nav {
        gap: 20px;
    }
}

/* =========================================
   MOBILE BREAKPOINT (≤768px)
   ========================================= */
@media (max-width: 768px) {

    /* Show hamburger menu */
    .menu-toggle {
        display: block;
    }

    /* Header adjustment */
    .top-header {
        justify-content: flex-start;
        padding: 0 16px;
    }

    /* Hide sidebar by default */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        height: 100dvh;
        /* Dynamic viewport height - accounts for mobile browser bars */
        width: 280px;
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    [dir="rtl"] .sidebar {
        left: auto;
        right: -280px;
        transition: right 0.3s ease;
    }

    /* Show sidebar when open */
    body.sidebar-open .sidebar {
        left: 0;
    }

    body[dir="rtl"].sidebar-open .sidebar {
        left: auto;
        right: 0;
    }

    /* Body takes full width */
    body {
        overflow-x: hidden;
    }

    .main-area {
        width: 100%;
    }

    /* Content adjustments */
    .content-scroll {
        padding: 16px;
    }

    .dashboard-container {
        max-width: 100%;
    }

    /* Hero Card - Stack vertically */
    .company-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px;
        margin-bottom: 20px;
    }

    .hero-price {
        text-align: left;
        width: 100%;
        padding-top: 12px;
        border-top: 1px solid var(--border-color);
    }

    [dir="rtl"] .hero-price {
        text-align: right;
    }

    .hero-info h1 {
        font-size: 22px;
    }

    .price-value {
        font-size: 28px;
    }

    /* Valuation Rows - Single column */
    .valuation-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    /* Damodaran Grid - Single column */
    .damodaran-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
        margin-bottom: 24px;
    }

    /* Metadata Grid - Wrap better */
    .metadata-grid {
        gap: 16px;
    }

    .meta-item {
        min-width: 45%;
    }

    /* Profile section */
    .profile-section {
        padding: 16px;
        margin-bottom: 20px;
    }

    /* Tabs - Scrollable */
    .tabs-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tabs-nav {
        gap: 16px;
        min-width: max-content;
        padding-bottom: 2px;
    }

    .tab-btn {
        font-size: 13px;
        white-space: nowrap;
    }

    /* Tables - Horizontal scroll for ALL table containers */
    .table-wrapper,
    .metrics-section,
    .table-section {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    .metrics-table,
    .results-table {
        min-width: 900px;
    }

    th,
    td {
        padding: 10px 12px;
    }

    /* Metric cards */
    .metric-card {
        padding: 16px;
    }

    .metric-value {
        font-size: 20px;
    }

    .large-value {
        font-size: 22px;
    }

    /* Governance grid */
    .governance-grid {
        grid-template-columns: 1fr;
    }

    /* Screener-specific */
    .sector-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sector-row select {
        width: 100%;
    }

    .column-groups {
        grid-template-columns: 1fr;
    }

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

    .action-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .action-buttons {
        justify-content: stretch;
    }

    .action-buttons button {
        flex: 1;
    }

    .results-table {
        display: block;
        overflow-x: auto;
    }

    /* Mobile Sidebar Scrolling Fix - Keep Tools visible */
    .sidebar-nav {
        display: flex;
        flex-direction: column;
        height: calc(100vh - 60px);
        padding-bottom: 0;
    }

    /* Market Universe / Fund Categories section - scrollable with constrained height */
    .sidebar-nav .nav-section:nth-child(2) {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    #company-list,
    #fund-category-list {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 16px;
    }

    /* Tools section - pinned at bottom, always visible */
    .sidebar-nav .nav-section:last-child {
        flex-shrink: 0;
        border-top: 1px solid var(--border-color);
        padding-top: 12px;
        padding-bottom: 16px;
        background: var(--bg-sidebar);
    }
}

/* =========================================
   SMALL MOBILE BREAKPOINT (≤480px)
   ========================================= */
@media (max-width: 480px) {
    .content-scroll {
        padding: 12px;
    }

    .company-hero {
        padding: 12px;
    }

    .hero-info h1 {
        font-size: 18px;
    }

    .ticker-tag {
        font-size: 11px;
        padding: 3px 6px;
    }

    .price-value {
        font-size: 24px;
    }

    .profile-section {
        padding: 12px;
    }

    .profile-text {
        font-size: 13px;
    }

    .metadata-grid {
        gap: 12px;
    }

    .meta-item {
        min-width: 100%;
    }

    .meta-label {
        font-size: 10px;
    }

    .meta-value {
        font-size: 13px;
    }

    .d-header {
        font-size: 11px;
    }

    .mini-card .label {
        font-size: 11px;
    }

    .mini-card .value {
        font-size: 14px;
    }

    .metric-value {
        font-size: 18px;
    }

    .large-value {
        font-size: 20px;
    }

    .context-box {
        padding: 12px;
        font-size: 12px;
    }

    .tab-btn {
        font-size: 12px;
        padding: 10px 0;
    }

    .tabs-nav {
        gap: 12px;
    }

    /* Governance cards */
    .gov-card {
        padding: 14px;
    }

    .gov-card-title h4 {
        font-size: 14px;
    }

    .gov-description {
        font-size: 12px;
    }

    /* Story section */
    .story-section {
        padding: 12px 16px;
    }

    .story-label {
        font-size: 11px;
    }

    .story-oneliner {
        font-size: 13px;
    }

    /* Brand in sidebar */
    .brand {
        font-size: 16px;
        padding: 0 16px;
    }
}

/* =========================================
   SITE FOOTER
   ========================================= */
.site-footer {
    margin-top: 48px;
    padding: 24px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.site-footer p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.site-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--teal);
}

.footer-separator {
    margin: 0 12px;
    color: var(--border-color);
}

/* RTL Footer */
[lang="ar"] .site-footer {
    direction: rtl;
}

/* =========================================
   TERMS PAGE
   ========================================= */
.terms-container {
    max-width: 800px;
    margin: 0 auto;
}

.terms-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.terms-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.terms-updated {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.terms-section {
    margin-bottom: 32px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.terms-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.terms-section p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 0 12px 0;
}

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

.terms-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Highlighted CMA section */
.terms-highlight {
    border-color: var(--accent);
    background: linear-gradient(to bottom right, var(--bg-card), rgba(39, 74, 58, 0.03));
}

.terms-highlight h2 {
    color: var(--accent);
}

.terms-back {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.btn-back {
    display: inline-block;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--border-subtle);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* RTL Terms */
[lang="ar"] .terms-container {
    direction: rtl;
}

[lang="ar"] .btn-back {
    direction: rtl;
}

/* Responsive Terms */
@media (max-width: 768px) {
    .terms-container {
        padding: 0 16px;
    }

    .terms-header h1 {
        font-size: 22px;
    }

    .terms-section {
        padding: 16px;
    }

    .terms-section h2 {
        font-size: 15px;
    }

    .terms-section p {
        font-size: 13px;
    }
}

/* =========================================
   MODEL DISCLAIMER
   ========================================= */
.model-disclaimer {
    font-size: 12px;
    color: var(--text-muted);
    padding: 12px 16px;
    margin-bottom: 20px;
    background: var(--bg-elevated);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
    font-style: italic;
}

[lang="ar"] .model-disclaimer {
    direction: rtl;
    border-left: none;
    border-right: 3px solid var(--accent);
}

/* =========================================
   TABLE FOOTNOTE
   ========================================= */
.table-footnote {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 12px;
    font-style: italic;
}

[lang="ar"] .table-footnote {
    direction: rtl;
    text-align: right;
}

/* =========================================
   FOLLOW BUTTON (Company Hero)
   ========================================= */
.follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    vertical-align: middle;
    margin-left: 12px;
    white-space: nowrap;
    font-family: inherit;
}

[dir="rtl"] .follow-btn {
    margin-left: 0;
    margin-right: 12px;
}

.follow-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(10, 186, 181, 0.06);
}

.follow-btn.following {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.follow-btn.following:hover {
    background: #c0392b;
    border-color: #c0392b;
    color: #fff;
}

.follow-icon {
    font-size: 16px;
    line-height: 1;
}

.follow-label {
    line-height: 1;
}

/* =========================================
   WATCHLIST PAGE
   ========================================= */
.watchlist-container {
    max-width: 1200px;
    margin: 0 auto;
}

.watchlist-header {
    margin-bottom: 24px;
}

.watchlist-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
}

.watchlist-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.watchlist-limit-badge {
    display: inline-block;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 8px;
}

.watchlist-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.watchlist-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.watchlist-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-elevated);
    white-space: nowrap;
}

[dir="rtl"] .watchlist-table th {
    text-align: right;
}

.watchlist-table td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.watchlist-table tbody tr:hover {
    background: var(--bg-elevated);
}

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

.watchlist-ticker {
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
}

.watchlist-ticker:hover {
    text-decoration: underline;
}

.watchlist-remove-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.watchlist-remove-btn:hover {
    border-color: #c0392b;
    color: #c0392b;
    background: rgba(192, 57, 43, 0.06);
}

/* Watchlist Empty State */
.watchlist-empty {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
}

.watchlist-empty .empty-icon {
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
}

.watchlist-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
}

.watchlist-empty p {
    font-size: 14px;
    margin: 0;
}

/* Responsive Watchlist */
@media (max-width: 768px) {
    .watchlist-header h1 {
        font-size: 20px;
    }

    .follow-btn {
        margin-left: 0;
        margin-top: 8px;
    }

    [dir="rtl"] .follow-btn {
        margin-right: 0;
    }
}

/* =========================================
   COMPACT MODE
   Triggered by body.compact class (Settings toggle)
   ========================================= */
body.compact .content-scroll {
    padding: 16px;
}

body.compact .company-hero {
    padding: 16px;
    margin-bottom: 16px;
}

body.compact .hero-info h1 {
    font-size: 22px;
    margin-bottom: 4px;
}

body.compact .price-value {
    font-size: 24px;
}

body.compact .profile-section {
    padding: 16px;
    margin-bottom: 16px;
}

body.compact .profile-text {
    font-size: 13px;
    line-height: 1.5;
}

body.compact .metadata-grid {
    gap: 16px;
    margin-bottom: 16px;
}

body.compact .damodaran-grid {
    gap: 12px;
    margin-bottom: 20px;
}

body.compact .d-col {
    gap: 8px;
}

body.compact .driver-group {
    padding: 10px;
    gap: 6px;
    border-radius: 8px;
}

body.compact .mini-card {
    padding: 4px 0;
}

body.compact .mini-card .label {
    font-size: 11px;
}

body.compact .mini-card .value {
    font-size: 13px;
}

body.compact .metrics-grid {
    gap: 12px;
    margin-bottom: 16px;
}

body.compact .metric-card {
    padding: 14px;
    border-radius: 8px;
}

body.compact .metric-value {
    font-size: 20px;
}

body.compact .metric-label {
    font-size: 12px;
    margin-bottom: 4px;
}

body.compact .section-header {
    padding: 12px 16px;
}

body.compact th {
    padding: 8px 16px;
}

body.compact td {
    padding: 8px 16px;
}

body.compact .table-section {
    border-radius: 8px;
}

body.compact .ratios-grid {
    padding: 10px;
    gap: 10px;
    border-radius: 8px;
}

body.compact .large-value {
    font-size: 22px;
}

body.compact .d-header {
    font-size: 11px;
    margin-bottom: 4px;
    padding-bottom: 4px;
}

body.compact .d-sub-header {
    font-size: 10px;
    margin-bottom: 6px;
}

body.compact .tabs-nav {
    gap: 20px;
}

/* Compact mode for homepage cards */
body.compact .homepage-card {
    padding: 16px;
}

/* Compact mode for screener */
body.compact .screener-table td,
body.compact .screener-table th {
    padding: 6px 12px;
}

/* Compact mode for watchlist */
body.compact .watchlist-table td,
body.compact .watchlist-table th {
    padding: 8px 12px;
}

/* ---- SITE FOOTER SOCIALS ---- */
.site-footer-socials {
    margin-top: 8px !important;
}

.site-footer-socials a {
    color: var(--text-secondary) !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
    transition: color 0.2s, transform 0.2s;
}

.site-footer-socials a:hover {
    color: var(--accent) !important;
    transform: translateY(-1px);
}