/* Page root wrapper — stocks/index.blade.php:72 used .stocks-screener-page with no CSS rule */
.stocks-screener-page { min-height: 100vh; background: var(--bg); }

:root {
    --halal: var(--success);
    --halal-bg: #dcfce7;
    --halal-light: var(--success);
    --halal-dark: #15803d;
    --mixed: #eab308;
    --mixed-bg: #fef9c3;
    --mixed-dark: #a16207;
    --haram: var(--danger);
    --haram-bg: #fee2e2;
    --haram-dark: var(--danger);

    /* --success / --danger intentionally NOT redeclared here —
       previous self-referential `--success: var(--success)` killed the
       token on /stock (CSS guaranteed-invalid fallback), which broke
       every .live-badge / .halal-* / hero-stat color. Inherit from
       design-system/base/tokens.css instead. */
    --success-bg: #dcfce7;
    --danger-bg: #fee2e2;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    /* Screener-local extended palette — no canonical equivalent */
    --navy-accent:  #1a3a7e; /* mid-blue used in hero/filter gradients */
    --teal-active:  #0e8b7a; /* active-state teal used in range/sector selections */
    --gold-active:  #c89320; /* active-state gold used in halal/stat badges */
    --text-2: var(--text-mid);
    --text-3: var(--text-muted);
}

/* SCOPED RESETS — previously these were `*`, `html`, `body`, `.container`
   at page scope, leaking into header/footer/nav/breadcrumb and colliding
   with Bootstrap .container (1320px) to misalign the entire page shell.
   Scoped now so mockup defaults apply only inside .stocks-screener-page. */
.stocks-screener-page * { box-sizing: border-box; }
.stocks-screener-page {
    font-family: 'Almarai', sans-serif;
    color: var(--navy-deep);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
.stocks-screener-page .num { font-family: 'Inter', sans-serif; font-variant-numeric: tabular-nums; }
.stocks-screener-page > .hero > .container,
.stocks-screener-page > .heatmap-section > .container,
.stocks-screener-page > .screener-section > .container,
.stocks-screener-page > section > .container { max-width: 1440px; margin: 0 auto; padding: 0 20px; }

.hero {
    background:
        radial-gradient(ellipse at 30% 30%, rgba(240,183,63,0.15), transparent 45%),
        radial-gradient(ellipse at 70% 80%, rgba(26,188,156,0.1), transparent 50%),
        linear-gradient(180deg, var(--navy-deep) 0%, var(--navy-deep) 60%, var(--navy) 100%);
    color: white;
    padding: 60px 0 50px;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(240,183,63,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(240,183,63,0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
    pointer-events: none;
}
.hero-content {
    position: relative;
    text-align: center;
    max-width: 880px;
    margin: 0 auto 40px;
}
.hero-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.hero-badge {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    font-weight: 700;
}
.live-badge {
    background: rgba(22,163,74,0.15);
    border-color: rgba(22,163,74,0.4);
    color: var(--success);
}
.live-badge .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
    animation: pulse 1.8s ease-in-out infinite;
}
.aaoifi-badge {
    background: rgba(240,183,63,0.15);
    border-color: rgba(240,183,63,0.4);
    color: var(--gold-light);
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Explicit color required: typography.css sets h1..h6 { color: var(--text) }
   which beats the inherited white from .hero. Without this rule, the plain
   H1 text between .accent-gold/.accent-teal spans went invisible on the
   dark navy hero. Same reasoning applies to every hN on a dark surface here. */
.hero h1 {
    font-size: clamp(18px, 2.5vw, 28px);
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
    line-height: 1.4;
}
.hero h1 .accent-gold {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero h1 .accent-teal {
    background: linear-gradient(135deg, var(--teal-light), var(--teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-subtitle {
    font-size: 17px;
    opacity: 0.85;
    max-width: 700px;
    margin: 0 auto;
}

.market-tabs {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 36px 0 30px;
    flex-wrap: wrap;
}
.market-tab {
    background: rgba(255,255,255,0.06);
    border: 2px solid rgba(255,255,255,0.15);
    padding: 18px 30px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    color: white;
    font-family: inherit;
    transition: all .3s;
    backdrop-filter: blur(10px);
    min-width: 240px;
}
.market-tab:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(240,183,63,0.5);
    transform: translateY(-3px);
}
.market-tab.active {
    background: linear-gradient(135deg, rgba(240,183,63,0.2), rgba(240,183,63,0.1));
    border-color: var(--gold);
    box-shadow: 0 10px 30px rgba(240,183,63,0.25);
}
/* Regional-indicator emoji (🇸🇦 🇺🇸) fall back to letter-box glyphs
   ("SA" / "US") on Windows Chrome if the system font doesn't supply
   true flag glyphs. Forcing the emoji font stack restores the flag
   rendering. Keeps Almarai for everything else via font-family: inherit
   on the parent button. */
.mt-flag {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", "EmojiOne Color", "Android Emoji", sans-serif;
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}
.market-tab.active .mt-flag {
    background: rgba(240,183,63,0.15);
}
.mt-info {
    text-align: right;
    flex: 1;
}
.mt-name {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 2px;
}
.mt-count {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 700;
}
.market-tab.active .mt-count {
    color: var(--gold-light);
    opacity: 1;
}

.hero-stats {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    max-width: 1100px;
    margin: 0 auto;
}
.hero-stat {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: all .3s;
}
.hero-stat:hover {
    transform: translateY(-3px);
    background: rgba(255,255,255,0.08);
}
.hero-stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.hero-stat.total::before { background: linear-gradient(90deg, var(--gold), var(--gold-active)); }
.hero-stat.halal::before { background: linear-gradient(90deg, var(--halal-light), var(--halal)); }
.hero-stat.mixed::before { background: linear-gradient(90deg, #fbbf24, #eab308); }
.hero-stat.haram::before { background: linear-gradient(90deg, #ef4444, var(--haram)); }

.hero-stat .stat-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}
.hero-stat .label {
    font-size: 11px;
    opacity: 0.65;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
    margin-bottom: 8px;
}
.hero-stat .value {
    font-family: 'Inter', sans-serif;
    font-size: 36px;
    font-weight: 900;
    color: white;
    line-height: 1;
    direction: ltr;
    margin-bottom: 6px;
}
.hero-stat .value.halal-v { color: var(--success); }
.hero-stat .value.mixed-v { color: #fbbf24; }
.hero-stat .value.haram-v { color: var(--danger); }
.hero-stat .value.gold-v { color: var(--gold-light); }
.hero-stat .percent-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: 10px 0 6px;
}
.hero-stat .percent-fill {
    height: 100%;
    border-radius: 3px;
}
.hero-stat.total .percent-fill { background: linear-gradient(90deg, var(--gold), var(--gold-active)); width: 100%; }
.hero-stat.halal .percent-fill { background: linear-gradient(90deg, var(--halal-light), var(--halal)); width: 67%; }
.hero-stat.mixed .percent-fill { background: linear-gradient(90deg, #fbbf24, #eab308); width: 20%; }
.hero-stat.haram .percent-fill { background: linear-gradient(90deg, #ef4444, var(--haram)); width: 13%; }
.hero-stat .sub {
    font-size: 11px;
    opacity: 0.6;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    direction: ltr;
}

.heatmap-section {
    background: var(--bg);
    padding: 60px 0 40px;
}
.heatmap-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 30px 32px;
    overflow: hidden;
}
.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.heatmap-title-block h2 {
    font-size: 24px;
    color: var(--navy);
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.heatmap-title-block h2::before {
    content: '\1F5FA\FE0F';
    font-size: 26px;
}
.heatmap-title-block p {
    font-size: 13px;
    color: var(--text-2);
}
.heatmap-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.heatmap-mode {
    display: flex;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 4px;
}
.heatmap-mode-btn {
    padding: 7px 14px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-2);
    border-radius: 7px;
    cursor: pointer;
    transition: all .2s;
}
.heatmap-mode-btn.active {
    background: var(--navy);
    color: white;
    box-shadow: 0 2px 6px rgba(10,31,68,0.2);
}
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-2);
    font-weight: 700;
}
.legend-gradient {
    display: flex;
    align-items: center;
    gap: 3px;
    background: linear-gradient(90deg, var(--haram) 0%, #f59e0b 35%, var(--text-muted) 50%, #84cc16 65%, var(--halal) 100%);
    height: 10px;
    width: 120px;
    border-radius: 5px;
    border: 1px solid var(--border);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 3px;
    background: var(--bg-muted);
    padding: 3px;
    border-radius: var(--radius);
    min-height: 460px;
}

.sector-group {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 6px;
    overflow: hidden;
    padding: 2px;
    position: relative;
}
.sector-group-header {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-2);
    padding: 4px 6px 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sector-group-tiles {
    display: grid;
    gap: 2px;
    flex: 1;
}

.sector-group.size-mega { grid-column: span 5; grid-row: span 2; }
.sector-group.size-mega .sector-group-tiles { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); }
.sector-group.size-large { grid-column: span 4; grid-row: span 2; }
.sector-group.size-large .sector-group-tiles { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.sector-group.size-medium { grid-column: span 3; grid-row: span 1; }
.sector-group.size-medium .sector-group-tiles { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.sector-group.size-small { grid-column: span 3; grid-row: span 1; }
.sector-group.size-small .sector-group-tiles { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }

a.hm-tile { text-decoration: none; color: inherit; }
a.hm-tile:hover { color: inherit; }
a.hm-tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hm-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: all .2s;
    color: white;
    text-align: center;
    overflow: hidden;
    min-height: 48px;
}
.hm-tile:hover {
    transform: scale(1.05);
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    outline: 2px solid white;
}
.hm-tile .tile-ticker {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 2px;
    direction: ltr;
}
.hm-tile .tile-change {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 800;
    opacity: 0.95;
    direction: ltr;
}
.hm-tile .halal-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.9);
}
.hm-tile .halal-dot.halal { background: var(--success); }
.hm-tile .halal-dot.mixed { background: #facc15; }
.hm-tile .halal-dot.haram { background: var(--danger); }

.hm-tile.v-strong-down { background: var(--danger); }
.hm-tile.v-down { background: var(--danger); }
.hm-tile.v-slight-down { background: var(--danger); }
.hm-tile.v-neutral { background: var(--text-muted); }
.hm-tile.v-slight-up { background: #86efac; color: #064e3b; }
.hm-tile.v-up { background: var(--success); }
.hm-tile.v-strong-up { background: #15803d; }
.hm-tile.v-mega-up { background: #14532d; }

.hm-tile.mcap-mega { grid-column: span 2; grid-row: span 2; }
.hm-tile.mcap-large { grid-column: span 2; }
.hm-tile.mcap-large .tile-ticker { font-size: 13px; }
.hm-tile.mcap-mega .tile-ticker { font-size: 16px; }
.hm-tile.mcap-mega .tile-change { font-size: 11px; }

.heatmap-info {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
    font-size: 12px;
    color: var(--text-2);
    flex-wrap: wrap;
    align-items: center;
}
.heatmap-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.heatmap-info-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.5);
}
.heatmap-info-dot.halal { background: var(--success); }
.heatmap-info-dot.mixed { background: #facc15; }
.heatmap-info-dot.haram { background: var(--danger); }
.heatmap-info-size {
    font-weight: 800;
    color: var(--navy);
}

.screener-section {
    background: var(--bg);
    padding: 20px 0 70px;
}
.screener-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 28px;
    align-items: start;
}

.filters-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: sticky;
    top: 20px;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.filters-panel::-webkit-scrollbar { width: 6px; }
.filters-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.filters-header {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--navy), var(--navy-accent));
    color: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.filters-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.filters-header h3 {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.filters-header h3::before { content: '\2699\FE0F'; font-size: 19px; }
.filters-reset {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: all .2s;
}
.filters-reset:hover {
    background: rgba(255,255,255,0.18);
}
.active-count {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 700;
}
.active-count strong {
    color: var(--gold-light);
    font-family: 'Inter', sans-serif;
    margin: 0 3px;
}

.filter-group {
    border-bottom: 1px solid var(--border);
}
.filter-group:last-child { border-bottom: none; }
.filter-head {
    padding: 16px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background .2s;
    min-height: 44px;
}
.filter-head:hover { background: var(--bg-muted); }
.filter-head h4 {
    font-size: 14px;
    color: var(--navy);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-head h4 .fg-icon {
    font-size: 16px;
}
.filter-head .toggle-arrow {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    font-size: 12px;
    transition: transform .25s;
}
.filter-group.open .toggle-arrow {
    transform: rotate(180deg);
    color: var(--gold-active);
}
.filter-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .3s ease;
    overflow: hidden;
}
.filter-group.open .filter-body {
    grid-template-rows: 1fr;
}
.filter-inner {
    overflow: hidden;
    min-height: 0;
    padding: 16px 22px 18px;
}

/* Disabled filter group — used for "coming soon" filters where the
   underlying data column isn't wired yet (e.g. live stock price). */
.filter-group--disabled { opacity: 0.78; }
.filter-group--disabled .filter-head h4 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-group--disabled .filter-body { grid-template-rows: 1fr; }
.filter-soon-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--gold, #d4af37);
    color: var(--navy, #152d50);
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.6;
}
.filter-disabled-note {
    margin: 0;
    padding: 10px 12px;
    background: var(--bg-muted, rgba(21, 45, 80, 0.04));
    border-inline-start: 3px solid var(--gold, #d4af37);
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-2, #536273);
}
.filter-disabled-note strong { color: var(--navy, #152d50); font-weight: 700; }

.halal-filter-body .filter-inner {
    padding: 16px 22px 20px;
}
.halal-options {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}
.halal-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .2s;
    background: var(--bg-card);
    min-height: 44px;
}
.halal-option:hover {
    border-color: var(--border);
    background: var(--bg-muted);
}
.halal-option.active.all { border-color: var(--navy); background: rgba(10,31,68,0.04); }
.halal-option.active.halal { border-color: var(--halal); background: var(--halal-bg); }
.halal-option.active.mixed { border-color: var(--mixed); background: var(--mixed-bg); }
.halal-option.active.haram { border-color: var(--haram); background: var(--haram-bg); }
.halal-option .indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.8) inset;
    border: 1px solid var(--border);
}
.halal-option.all .indicator { background: var(--navy); }
.halal-option.halal .indicator { background: var(--halal); }
.halal-option.mixed .indicator { background: var(--mixed); }
.halal-option.haram .indicator { background: var(--haram); }
.halal-option .label-block {
    flex: 1;
}
.halal-option .label-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--navy-deep);
    line-height: 1.2;
}
.halal-option .label-desc {
    font-size: 10px;
    color: var(--text-3);
    font-weight: 700;
    margin-top: 2px;
}
.halal-option.active .label-desc {
    color: var(--text-2);
}
.halal-option .count {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-3);
    font-weight: 900;
    background: var(--bg-muted);
    padding: 5px 12px;
    border-radius: 999px;
    min-width: 48px;
    text-align: center;
}
.halal-option.active .count {
    background: rgba(255,255,255,0.7);
    color: var(--navy-deep);
}

.aaoifi-note {
    padding: 10px 12px;
    background: linear-gradient(135deg, rgba(240,183,63,0.08), rgba(240,183,63,0.03));
    border: 1px solid rgba(240,183,63,0.3);
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-2);
    font-weight: 700;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.aaoifi-note::before {
    content: '\1F54C';
    font-size: 16px;
    flex-shrink: 0;
}
.aaoifi-note strong {
    color: var(--gold-active);
}

.sector-list {
    display: grid;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    padding-inline-end: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}
.sector-list::-webkit-scrollbar { width: 5px; }
.sector-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sector-list::-webkit-scrollbar-track { background: transparent; }

/* Inline hint for filters whose data source needs disclosure
   (e.g. "السعر المستهدف" = analyst target, not spot price). */
.filter-hint {
    font-size: 11px;
    color: var(--text-3, #7a8699);
    line-height: 1.5;
    margin-block-end: 10px;
    padding: 8px 10px;
    background: var(--bg-muted, #f6f8fb);
    border-inline-start: 3px solid var(--teal, #1abc9c);
    border-radius: 6px;
}
.sector-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all .15s;
    background: var(--bg);
    border: 1px solid var(--border);
    min-height: 44px;
}
.sector-item:hover { background: var(--bg-muted); border-color: var(--border); }
.sector-item.active {
    background: rgba(26,188,156,0.08);
    border-color: var(--teal);
}
.sector-item .check {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: white;
}
.sector-item.active .check {
    background: var(--teal);
    border-color: var(--teal);
    color: white;
    font-size: 11px;
    font-weight: 800;
}
.sector-item.active .check::before { content: '\2713'; }
.sector-item .name {
    font-size: 12px;
    font-weight: 700;
    color: var(--navy-deep);
    flex: 1;
}
.sector-item .count {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: var(--text-3);
    font-weight: 800;
}

.range-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}
.range-input-wrap {
    position: relative;
}
.range-input-wrap label {
    display: block;
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 800;
    margin-bottom: 4px;
}
.range-input-wrap input {
    width: 100%;
    padding: 9px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--navy);
    background: var(--bg-card);
    text-align: center;
    direction: ltr;
}
.range-input-wrap input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(26,188,156,0.1);
}
.range-slider {
    margin-top: 6px;
    position: relative;
    height: 32px;
}
.range-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bg-muted);
    border-radius: 2px;
    transform: translateY(-50%);
}
.range-fill {
    position: absolute;
    top: 0;
    right: 15%;
    left: 10%;
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--teal-active));
    border-radius: 2px;
}
.range-handle {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    background: white;
    border: 3px solid var(--teal);
    border-radius: 50%;
    transform: translate(50%, -50%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.range-handle.left { right: 10%; }
.range-handle.right { right: 85%; }
.range-presets {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.range-preset {
    padding: 8px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-2);
    cursor: pointer;
    transition: all .15s;
    min-height: 36px;
}
.range-preset:hover { background: var(--bg-muted); }
.range-preset.active {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
}

.mcap-categories {
    display: grid;
    gap: 6px;
}
.mcap-cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    min-height: 44px;
}
.mcap-cat:hover { background: var(--bg-muted); }
.mcap-cat.active {
    background: rgba(240,183,63,0.08);
    border-color: var(--gold);
}
.mcap-cat .cat-name {
    font-size: 12px;
    font-weight: 800;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 6px;
}
.mcap-cat .cat-size {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: var(--text-3);
    font-weight: 700;
    direction: ltr;
}

.exchange-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.exchange-chip {
    padding: 10px 16px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 999px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-2);
    cursor: pointer;
    transition: all .2s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.exchange-chip:hover {
    border-color: var(--teal);
    color: var(--teal-active);
}
.exchange-chip.active {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
}

.performance-options {
    display: grid;
    gap: 6px;
}
.perf-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    min-height: 44px;
}
.perf-option:hover { background: var(--bg-muted); }
.perf-option .perf-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.perf-option.gainers .perf-icon { background: var(--success-bg); color: var(--success); }
.perf-option.losers .perf-icon { background: var(--danger-bg); color: var(--danger); }
.perf-option.active-vol .perf-icon { background: rgba(26,188,156,0.1); color: var(--teal-active); }
.perf-option.active {
    background: rgba(26,188,156,0.08);
    border-color: var(--teal);
}
.perf-option.gainers.active {
    background: var(--success-bg);
    border-color: var(--success);
}
.perf-option.losers.active {
    background: var(--danger-bg);
    border-color: var(--danger);
}
.perf-option .perf-name {
    font-size: 12px;
    font-weight: 800;
    color: var(--navy);
    flex: 1;
}

.rating-options {
    display: grid;
    gap: 6px;
}
.rating-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    min-height: 44px;
    transition: all .2s;
}
.rating-option:hover { background: var(--bg-muted); }
.rating-option.active {
    background: rgba(240, 183, 63, 0.1);
    border-color: var(--gold, #f0b73f);
    box-shadow: 0 0 0 1px var(--gold, #f0b73f) inset;
}
.rating-option.active .stars {
    color: var(--gold-active, #c98f1c);
}
.rating-option .stars {
    color: var(--gold);
    font-size: 12px;
    letter-spacing: 1px;
    flex-shrink: 0;
}
.rating-option .rating-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--navy);
    flex: 1;
}
.rating-option .rating-count {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: var(--text-3);
    font-weight: 800;
}

.results-area {
    min-width: 0;
}

.tier-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-bottom: 2px solid var(--border);
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tier-tabs::-webkit-scrollbar { display: none; }
.tier-tab {
    padding: 12px 20px;
    color: var(--text-3);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}
.tier-tab:hover {
    color: var(--gold);
}
.tier-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.results-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
}
.results-count {
    display: flex;
    align-items: center;
    gap: 10px;
}
.results-count .num-result {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 900;
    color: var(--navy);
}
.results-count .label {
    font-size: 13px;
    color: var(--text-2);
    font-weight: 700;
}
.results-count .sub {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 700;
}
.sort-dropdown {
    position: relative;
}
.sort-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 800;
    color: var(--navy);
    cursor: pointer;
    transition: all .2s;
}
.sort-btn:hover {
    border-color: var(--teal);
}
.sort-btn .icon { color: var(--teal); }
.sort-btn .arrow { color: var(--text-3); font-size: 10px; }

.view-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 10px;
    padding: 4px;
    border: 1.5px solid var(--border);
}
.view-btn {
    padding: 7px 12px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-2);
    border-radius: 7px;
    cursor: pointer;
    transition: all .2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.view-btn.active {
    background: var(--navy);
    color: white;
    box-shadow: 0 2px 6px rgba(10,31,68,0.2);
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}
.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--teal);
    color: var(--teal-active);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}
.active-filter-chip .remove {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--teal);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    font-weight: 800;
    transition: all .2s;
}
.active-filter-chip .remove:hover {
    background: var(--navy);
}

.stocks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* Empty state (AJAX partial — no filter matches) */
.stocks-empty { text-align: center; padding: 60px 20px; grid-column: 1 / -1; }
.stocks-empty__icon { font-size: 48px; opacity: .3; margin-bottom: 16px; }
.stocks-empty__title { color: var(--navy); margin-bottom: 8px; }
.stocks-empty__text { color: var(--text-2); margin-bottom: 16px; }
.stock-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all .3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.stock-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--teal), var(--teal-active));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .3s;
}
.stock-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--teal);
}
.stock-card:hover::before { transform: scaleX(1); }
.stock-card.halal::before { background: linear-gradient(90deg, var(--halal), #15803d); transform: scaleX(1); }
.stock-card.mixed::before { background: linear-gradient(90deg, var(--mixed), #a16207); transform: scaleX(1); }
.stock-card.haram::before { background: linear-gradient(90deg, var(--haram), var(--danger)); transform: scaleX(1); }

.sc-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}
.sc-logo-wrap {
    display: flex;
    gap: 11px;
    align-items: center;
}
.sc-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-weight: 900;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(10,31,68,0.1);
}
.sc-logo.apple { background: linear-gradient(135deg, var(--navy-deep), #334155); }
.sc-logo.msft { background: linear-gradient(135deg, #0078d4, #0f6cbd); }
.sc-logo.tsla { background: linear-gradient(135deg, var(--danger), var(--danger)); }
.sc-logo.nvda { background: linear-gradient(135deg, var(--success), #15803d); }
.sc-logo.amzn { background: linear-gradient(135deg, #f59e0b, #d97706); }
.sc-logo.googl { background: linear-gradient(135deg, #4285f4, #1a73e8); }
.sc-logo.meta { background: linear-gradient(135deg, #1877f2, #0866ff); }
.sc-logo.jnj { background: linear-gradient(135deg, #cc0000, #8b0000); }
.sc-logo.lly { background: linear-gradient(135deg, var(--danger), #7c2d12); }

.sc-name-block {
    flex: 1;
    min-width: 0;
}
.sc-ticker {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 900;
    color: var(--navy);
    line-height: 1;
    margin-bottom: 3px;
    direction: ltr;
}
.sc-company {
    font-size: 12px;
    color: var(--text-2);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    /* Content-derived direction: short company-name labels mix
       pure English ("Apple Inc"), pure Arabic ("سهم ديزني"), and AR+EN
       composites ("سهم شركة UnitedHealth"). `plaintext` derives paragraph
       direction from the first strong character of the content so each
       case aligns naturally — English flushes inline-end (visual left in
       RTL card), Arabic flushes inline-start (visual right). This is
       opposite to .article-main rule where `isolate` is correct because
       long-form Arabic must not flip on stray first-char English. */
    unicode-bidi: plaintext;
    text-align: start;
}
.sc-exchange {
    font-size: 10px;
    color: var(--text-3);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    margin-top: 2px;
    direction: ltr;
}

.sc-halal-badge {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.sc-halal-badge.halal {
    background: var(--halal-bg);
    color: var(--halal-dark);
}
.sc-halal-badge.mixed {
    background: var(--mixed-bg);
    color: var(--mixed-dark);
}
.sc-halal-badge.haram {
    background: var(--haram-bg);
    color: var(--haram-dark);
}
.sc-halal-badge::before {
    content: '\25CF';
    font-size: 12px;
}

.sc-price-block {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border);
}
.sc-price {
    font-family: 'Inter', sans-serif;
    font-size: 28px;
    font-weight: 900;
    color: var(--navy);
    line-height: 1;
    direction: ltr;
}
.sc-price .currency {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 700;
    margin-inline-end: 4px;
}
.sc-price .price-na {
    color: var(--text-3, var(--text-muted, #6b7280));
    font-weight: 600;
}
.sc-change {
    text-align: left;
    direction: ltr;
}
.sc-change .amount {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 3px;
}
.sc-change .percent {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 999px;
}
.sc-change.up .amount { color: var(--success); }
.sc-change.up .percent { background: var(--success-bg); color: var(--success); }
.sc-change.down .amount { color: var(--danger); }
.sc-change.down .percent { background: var(--danger-bg); color: var(--danger); }

.sc-sparkline {
    height: 42px;
    margin-bottom: 14px;
    opacity: 0.85;
}
.sc-sparkline svg {
    width: 100%;
    height: 100%;
}

.sc-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-top: 4px;
}
.sc-metric {
    text-align: center;
    padding: 8px 4px;
    background: var(--bg);
    border-radius: 8px;
}
.sc-metric .k {
    font-size: 9px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 800;
    margin-bottom: 3px;
}
.sc-metric .v {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 800;
    color: var(--navy);
    direction: ltr;
}

.sc-halal-reason {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 8px;
    border-inline-end: 3px solid var(--border);
    font-size: 11px;
    color: var(--text-2);
    font-weight: 700;
    line-height: 1.6;
}
.stock-card.halal .sc-halal-reason { border-inline-end-color: var(--halal); }
.stock-card.mixed .sc-halal-reason { border-inline-end-color: var(--mixed); }
.stock-card.haram .sc-halal-reason { border-inline-end-color: var(--haram); }
.sc-halal-reason strong {
    color: var(--navy);
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stocks-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: none;
}
.stocks-table-wrap.visible { display: block; }
.stocks-grid.hidden { display: none; }
/* iOS momentum scrolling on the horizontal-overflow screener table. */
.stocks-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stocks-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}
.stocks-table th {
    text-align: right;
    padding: 14px 16px;
    background: var(--navy);
    color: white;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.stocks-table th.num-col { text-align: center; }
.stocks-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.stocks-table tbody tr { transition: background .15s; }
.stocks-table tbody tr:hover td { background: var(--bg-muted); }
.stocks-table tbody tr:last-child td { border-bottom: none; }
.stocks-table td.stock-cell {
    font-weight: 800;
}
.stocks-table td.stock-cell .ticker {
    font-family: 'Inter', sans-serif;
    color: var(--navy);
    font-size: 14px;
    direction: ltr;
}
.stocks-table td.stock-cell .name {
    font-size: 11px;
    color: var(--text-2);
    font-weight: 700;
    margin-top: 2px;
}
.stocks-table td.num-cell {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    color: var(--navy);
    text-align: center;
    direction: ltr;
    unicode-bidi: isolate; /* RTL-safe numeric rendering */
}
.stocks-table td.change-cell {
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    text-align: center;
    direction: ltr;
    unicode-bidi: isolate; /* RTL-safe numeric rendering */
}
.stocks-table td.change-cell.up { color: var(--success); }
.stocks-table td.change-cell.down { color: var(--danger); }
.stocks-table td.halal-cell {
    text-align: center;
}
/* Halal status badge — glyph per status (✓ ✗ ~ ?) reinforces color cue with
   shape for color-blind users. Blade adds aria-label + title. 16×16 keeps row
   height stable. */
.stocks-table .halal-mini-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: var(--bg-card, #fff);
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    font-family: var(--font-primary, inherit);
}
.stocks-table .halal-mini-badge.halal { background: var(--halal); }
.stocks-table .halal-mini-badge.halal::before { content: "\2713"; }     /* ✓ */
.stocks-table .halal-mini-badge.mixed { background: var(--mixed); }
.stocks-table .halal-mini-badge.mixed::before { content: "\007E"; }      /* ~ */
.stocks-table .halal-mini-badge.haram { background: var(--haram); }
.stocks-table .halal-mini-badge.haram::before { content: "\2715"; }      /* ✕ */

.stock-card.mix::before { background: linear-gradient(90deg, var(--mixed), #a16207); transform: scaleX(1); }
.stock-card.unknown::before { background: linear-gradient(90deg, var(--text-muted), var(--text-mid)); transform: scaleX(1); }
.sc-halal-badge.mix { background: var(--mixed-bg); color: var(--mixed-dark); }
.sc-halal-badge.unknown { background: #f1f5f9; color: var(--text-mid); }
.stock-card.mix .sc-halal-reason { border-inline-end-color: var(--mixed); }
.stock-card.unknown .sc-halal-reason { border-inline-end-color: var(--text-muted); }
.stocks-table .halal-mini-badge.mix { background: var(--mixed); }
.stocks-table .halal-mini-badge.mix::before { content: "\007E"; }        /* ~ (same as .mixed) */
.stocks-table .halal-mini-badge.unknown { background: var(--text-muted); }
.stocks-table .halal-mini-badge.unknown::before { content: "?"; }

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
}
.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-2);
    cursor: pointer;
    transition: all .2s;
}
.page-btn:hover {
    border-color: var(--teal);
    color: var(--teal-active);
}
.page-btn.active {
    background: linear-gradient(135deg, var(--navy), var(--navy-accent));
    color: white;
    border-color: var(--navy);
    box-shadow: 0 3px 10px rgba(10,31,68,0.2);
}
.page-btn.dots {
    border: none;
    background: none;
    cursor: default;
}

.aaoifi-section {
    background: var(--bg-card);
    padding: 70px 0;
}
.section-head {
    text-align: center;
    margin-bottom: 44px;
}
.section-head .eyebrow {
    display: inline-block;
    background: linear-gradient(135deg, rgba(240,183,63,0.1), rgba(26,188,156,0.1));
    color: var(--gold-active);
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 14px;
    border: 1px solid rgba(240,183,63,0.25);
}
.section-head h2 {
    font-size: 32px;
    color: var(--navy);
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}
.section-head p {
    color: var(--text-2);
    font-size: 15px;
    max-width: 680px;
    margin: 0 auto;
}
.aaoifi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
}
.aaoifi-card {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    text-align: center;
    transition: all .3s;
    border-top: 4px solid var(--gold);
    position: relative;
}
.aaoifi-card::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: linear-gradient(90deg, var(--teal), var(--teal-active));
    border-radius: 0 0 2px 2px;
}
.aaoifi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}
.aaoifi-number {
    font-family: 'Inter', sans-serif;
    font-size: 44px;
    font-weight: 900;
    color: var(--gold);
    line-height: 1;
    margin-bottom: 10px;
    direction: ltr;
}
.aaoifi-icon {
    font-size: 32px;
    margin-bottom: 12px;
}
.aaoifi-card h4 {
    font-size: 16px;
    color: var(--navy);
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.4;
}
.aaoifi-card .threshold {
    font-size: 13px;
    color: var(--teal-active);
    font-weight: 800;
    margin-bottom: 12px;
    padding: 6px 12px;
    background: rgba(26,188,156,0.1);
    border-radius: 999px;
    display: inline-block;
    direction: ltr;
}
.aaoifi-card p {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.7;
}

.aaoifi-source-note {
    max-width: 820px;
    margin: 40px auto 0;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(10,31,68,0.03), rgba(240,183,63,0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.8;
}
.aaoifi-source-note strong {
    color: var(--navy);
}

.trust-section {
    background: var(--bg-card);
    padding: 70px 0;
}
.authorities-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    max-width: 1100px;
    margin: 0 auto;
}
.authority-card {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 22px;
    text-align: center;
    transition: all .3s;
    border-top: 4px solid var(--gold);
}
.authority-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold);
}
.authority-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--navy), var(--navy-accent));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 34px;
    box-shadow: 0 8px 20px rgba(10,31,68,0.15);
}
.authority-card h4 {
    font-size: 17px;
    color: var(--navy);
    font-weight: 800;
    margin-bottom: 4px;
}
.authority-card .role {
    font-size: 11px;
    color: var(--gold-active);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
.authority-card p {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.7;
    margin-bottom: 14px;
}
.authority-stats {
    display: flex;
    justify-content: center;
    gap: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.authority-stat {
    text-align: center;
}
.authority-stat .n {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 900;
    color: var(--halal);
    line-height: 1;
    direction: ltr;
}
.authority-stat .l {
    font-size: 9px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 800;
    margin-top: 3px;
}

.editorial {
    background: var(--bg);
    padding: 80px 0;
}
.editorial-wrap {
    max-width: 860px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 50px 60px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
}
.editorial-wrap::before {
    content: '';
    position: absolute;
    top: 0;
    right: 30px;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--gold), var(--gold-active));
    border-radius: 0 0 4px 4px;
}
.editorial-label {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold), var(--gold-active));
    color: var(--navy);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(240,183,63,0.25);
}
.editorial h2 {
    font-size: 28px;
    color: var(--navy);
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
    line-height: 1.3;
}
.editorial-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-3);
}
.editorial-meta .author-block {
    display: flex; align-items: center; gap: 10px;
}
.editorial-meta .avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-active));
    color: var(--navy);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 14px;
}
.editorial-meta .author-name {
    color: var(--navy-deep);
    font-weight: 800;
    display: block;
}
.editorial-content h3 {
    font-size: 20px;
    color: var(--navy);
    font-weight: 800;
    margin: 28px 0 12px;
}
.editorial-content h3::before {
    content: '\25C6';
    color: var(--gold);
    margin-inline-start: 8px;
    font-size: 14px;
}
.editorial-content p {
    color: var(--text-2);
    font-size: 15px;
    line-height: 1.95;
    margin-bottom: 14px;
}
.editorial-content strong { color: var(--navy); }
.editorial-content ul { list-style: none; margin-bottom: 20px; }
.editorial-content ul li {
    padding: 8px 24px 8px 0;
    position: relative;
    color: var(--text-2);
    font-size: 15px;
    line-height: 1.85;
}
.editorial-content ul li::before {
    content: '\2713';
    position: absolute;
    right: 0;
    top: 8px;
    color: var(--gold);
    font-weight: 800;
}

.faq { background: var(--bg-card); padding: 70px 0; }
.faq-list { max-width: 820px; margin: 0 auto; }
.faq-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow .25s, border-color .25s, background .25s;
}
.faq-item.open {
    box-shadow: var(--shadow-md);
    border-color: var(--gold);
    background: var(--bg-card);
}
.faq-q {
    padding: 18px 22px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    color: var(--navy);
    font-size: 16px;
    user-select: none;
}
.faq-q:hover { background: var(--bg-muted); }
.faq-q .toggle {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg-muted);
    color: var(--gold-active);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 18px;
    transition: all .25s;
    flex-shrink: 0;
    margin-inline-end: 12px;
}
.faq-item.open .toggle {
    background: var(--gold);
    color: var(--navy);
    transform: rotate(45deg);
}
.faq-a {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .3s ease;
}
.faq-item.open .faq-a {
    grid-template-rows: 1fr;
}
.faq-a-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 22px 20px;
    color: var(--text-2);
    font-size: 14.5px;
    line-height: 1.85;
}

.broker-cta {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-accent) 100%);
    color: white;
    padding: 70px 0;
    position: relative;
    overflow: hidden;
}
.broker-cta::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 50%;
    background: radial-gradient(circle at right, rgba(240,183,63,0.2), transparent 70%);
}
.cta-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 50px;
    align-items: center;
    position: relative;
}
.cta-grid h2 {
    font-size: 32px;
    margin-bottom: 14px;
    line-height: 1.3;
    letter-spacing: -0.5px;
}
.cta-grid h2 .accent {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.cta-grid p { opacity: 0.88; font-size: 16px; margin-bottom: 24px; }
.cta-features {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}
.cta-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
}
.cta-feature::before { content: '\2713'; color: var(--gold-light); font-weight: 800; }
.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-active));
    color: var(--navy);
    padding: 14px 26px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    transition: all .25s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(240,183,63,0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(240,183,63,0.4);
}
.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1.5px solid rgba(255,255,255,0.25);
    padding: 14px 26px;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.cta-buttons { display: flex; gap: 14px; flex-wrap: wrap; }

.broker-card-cta {
    background: var(--bg-card);
    color: var(--navy-deep);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-xl);
    border: 2px solid rgba(240,183,63,0.4);
    position: relative;
    overflow: hidden;
}
.broker-card-cta::before {
    content: '\645\648\635\649 \628\647';
    position: absolute;
    top: 16px;
    left: -34px;
    background: linear-gradient(135deg, var(--gold), var(--gold-active));
    color: var(--navy);
    padding: 4px 36px;
    font-size: 10px;
    font-weight: 800;
    transform: rotate(-45deg);
    letter-spacing: 0.8px;
    box-shadow: 0 4px 10px rgba(240,183,63,0.3);
}
.bcc-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border);
}
.bcc-logo {
    width: 54px; height: 54px;
    background: linear-gradient(135deg, var(--navy), var(--navy-accent));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: var(--gold);
    font-size: 22px;
    font-weight: 900;
}
.bcc-head h4 {
    font-size: 17px;
    color: var(--navy);
    font-weight: 800;
    margin-bottom: 3px;
}
.bcc-rating {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.bcc-rating .stars { color: var(--gold); }
.bcc-rating .score { color: var(--navy); font-weight: 800; font-family: 'Inter', sans-serif; }
.bcc-rating .reviews { color: var(--text-3); font-weight: 700; }
.bcc-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 14px;
}
.bcc-spec { text-align: center; }
.bcc-spec .k {
    font-size: 9px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 800;
    margin-bottom: 3px;
}
.bcc-spec .v {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: var(--navy);
    direction: ltr;
}
.bcc-regs {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.bcc-reg {
    padding: 3px 10px;
    background: rgba(26,188,156,0.08);
    border: 1px solid rgba(26,188,156,0.25);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    color: var(--teal-active);
}
.bcc-cta {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--success), #15803d);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(22,163,74,0.3);
}

.related { background: var(--bg-card); padding: 70px 0; }
.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.tool-card {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: all .25s;
    display: flex;
    align-items: center;
    gap: 18px;
}
.tool-card:hover {
    border-color: var(--gold);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.tool-card .icon {
    width: 54px; height: 54px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.tool-card:nth-child(1) .icon { background: linear-gradient(135deg, var(--gold), var(--gold-active)); color: var(--navy); }
.tool-card:nth-child(2) .icon { background: linear-gradient(135deg, var(--teal), var(--teal-active)); color: white; }
.tool-card:nth-child(3) .icon { background: linear-gradient(135deg, var(--navy-accent), var(--navy)); color: white; }
.tool-card:nth-child(4) .icon { background: linear-gradient(135deg, #8b5cf6, #6d28d9); color: white; }
.tool-card:nth-child(5) .icon { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.tool-card:nth-child(6) .icon { background: linear-gradient(135deg, var(--halal), var(--halal-dark)); color: white; }
.tool-card h4 {
    font-size: 16px;
    color: var(--navy);
    font-weight: 800;
    margin-bottom: 4px;
}
.tool-card p { font-size: 13px; color: var(--text-2); }

@media (max-width: 1280px) {
    .screener-layout { grid-template-columns: 280px 1fr; }
    .stocks-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-stats { grid-template-columns: repeat(2, 1fr); }
    .heatmap-grid { grid-template-columns: repeat(8, 1fr); }
    .sector-group.size-mega { grid-column: span 4; }
    .sector-group.size-large { grid-column: span 4; }
    .sector-group.size-medium { grid-column: span 4; }
    .sector-group.size-small { grid-column: span 4; }
    .aaoifi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .screener-layout { grid-template-columns: 1fr; }
    .filters-panel {
        position: static;
        max-height: none;
    }
    .hero h1 { font-size: 22px; }
    .market-tab { min-width: auto; }
    .market-tabs { flex-direction: column; align-items: stretch; }
    .cta-grid { grid-template-columns: 1fr; }
    .authorities-grid { grid-template-columns: repeat(2, 1fr); }
    .tools-grid { grid-template-columns: 1fr 1fr; }
    .editorial-wrap { padding: 36px 28px; }
    .results-toolbar { grid-template-columns: 1fr; gap: 12px; }
    .results-count { justify-content: space-between; }
    .heatmap-grid {
        grid-template-columns: repeat(4, 1fr);
        min-height: 320px;
    }
    .sector-group.size-mega,
    .sector-group.size-large,
    .sector-group.size-medium,
    .sector-group.size-small {
        grid-column: span 4;
        grid-row: span 1;
    }
    .sector-group .sector-group-tiles {
        grid-template-columns: repeat(4, 1fr) !important;
        grid-template-rows: auto !important;
    }
    .heatmap-header { flex-direction: column; align-items: stretch; }
    .heatmap-controls { justify-content: space-between; }
}
@media (max-width: 640px) {
    .hero { padding: 40px 0 30px; }
    .hero h1 { font-size: 18px; }
    .hero-subtitle { font-size: 14px; }
    .hero-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .hero-stat { padding: 16px 12px; }
    .hero-stat .value { font-size: 26px; }
    .stocks-grid { grid-template-columns: 1fr; }
    .aaoifi-grid { grid-template-columns: 1fr; }
    .authorities-grid { grid-template-columns: 1fr; }
    .tools-grid { grid-template-columns: 1fr; }
    .section-head h2 { font-size: 24px; }
    .sc-price { font-size: 24px; }
    .view-btn span { display: none; }
    .editorial-wrap { padding: 28px 20px; }
    .pagination { flex-wrap: wrap; }
    .heatmap-grid { grid-template-columns: repeat(3, 1fr); }
    /* Match base-rule specificity (.size-* .tiles = 0-3-0) to avoid !important */
    .sector-group.size-mega .sector-group-tiles,
    .sector-group.size-large .sector-group-tiles,
    .sector-group.size-medium .sector-group-tiles,
    .sector-group.size-small .sector-group-tiles {
        grid-template-columns: repeat(3, 1fr);
    }
    .heatmap-wrap { padding: 20px 16px; }
    .heatmap-title-block h2 { font-size: 20px; }
}

/* Heatmap tiles readable at 320px */
@media (max-width: 480px) {
    .hm-tile { font-size: 11px; padding: 4px 2px; min-height: 44px; }
    .hm-tile .tile-ticker { font-size: 8px; }
    .hm-tile .tile-change { font-size: 9px; }
}

/* Filter sidebar collapsed on mobile */
.filter-mobile-toggle {
    display: none;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
    cursor: pointer;
    margin-bottom: 16px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    transition: all .2s;
}
.filter-mobile-toggle:hover { border-color: var(--teal); color: var(--teal); }
.filter-mobile-toggle svg { width: 18px; height: 18px; }

@media (max-width: 1024px) {
    .filter-mobile-toggle { display: flex; }
    .filters-panel { display: none; }
    .filters-panel.mobile-open { display: block; }
}
@media (max-width: 640px) {
    .filters-panel.mobile-open { max-height: none; position: static; overflow: visible; }
    .filter-group { border-bottom: 1px solid var(--border); }
    .filter-group:not(.open) .filter-body { display: none; }
    .filter-group.open .filter-body { display: block; }
}
/* 768px tablet rules */
@media (max-width: 768px) {
    .hero-subtitle { font-size: 13px; }
    .heatmap-controls { flex-wrap: wrap; gap: 8px; }
    .section-head h2 { font-size: 22px; }
    .editorial-h2 { font-size: 22px; }
}
/* 360px small mobile */
@media (max-width: 480px) {
    .hero-stats { grid-template-columns: 1fr; }
    .hero-stat .value { font-size: 22px; }
    .heatmap-grid { grid-template-columns: repeat(2, 1fr); }
    .sector-group .sector-group-tiles { grid-template-columns: repeat(2, 1fr) !important; }
}

.heatmap-info-item.stk-push-end { margin-inline-start: auto; }
.stk-search-input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 14px; }
.stk-search-submit { margin-block-start: 8px; width: 100%; padding: 10px; background: var(--navy); color: var(--text-on-navy, #fff); border: none; border-radius: 8px; cursor: pointer; font-family: var(--font); font-size: 14px; transition: background .2s; }
.stk-search-submit:hover { background: var(--navy-deep); }
.stk-empty-state { text-align: center; padding: 60px 20px; }
.stk-empty-state-icon { font-size: 48px; opacity: 0.3; margin-block-end: 16px; }
.stk-empty-state h3 { color: var(--navy); margin-block-end: 8px; }
.stk-empty-state p { color: var(--text-2); margin-block-end: 16px; }
.stk-disclaimer-wrap { padding-block-end: 32px; }
.sc-logo--default { background: linear-gradient(135deg, var(--navy), var(--navy-light)); }

/* ── View-all button replaces /stock pagination (P2 #10) ── */
.stocks-view-all-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 32px 20px 8px; text-align: center;
}
.stocks-view-all-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 32px;
  background: var(--navy); color: #fff;
  border-radius: 10px; font-size: 16px; font-weight: 700;
  text-decoration: none;
  transition: background .18s, transform .18s;
}
.stocks-view-all-btn:hover { background: var(--navy-light); transform: translateY(-2px); }
.stocks-sub-links {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  font-size: 14px;
}
.stocks-sub-links a { color: var(--teal); text-decoration: none; font-weight: 500; }
.stocks-sub-links a:hover { text-decoration: underline; }
.stocks-sub-links span { color: var(--text-muted); }

/* ── GCC Exchange Collection Section ── */
.gcc-exchanges-section { padding: 48px 0 32px; background: var(--surface-1, #f8f9fa); }
.gcc-exchanges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
}
.gcc-exchange-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid var(--border-light, #e5e7eb);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary, #1a1a2e);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.gcc-exchange-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-2px); border-color: var(--teal); }
.gcc-flag { font-size: 32px; line-height: 1; flex-shrink: 0; }
.gcc-exchange-info h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: var(--navy); }
.gcc-exchange-info p { margin: 0; font-size: 13px; color: var(--text-muted, #6b7280); }
@media (max-width: 768px) { .gcc-exchanges-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .gcc-exchanges-grid { grid-template-columns: 1fr; } }

/* GCC all-exchanges directory link — Googlebot crawl path. */
.gcc-all-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border: 1px solid var(--teal);
    border-radius: 8px;
    color: var(--teal);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.gcc-all-link:hover {
    background: var(--teal);
    color: #fff;
}
