/* سوق الأسهم الافتراضي — Base styles. Mobile-first, RTL. Professional
   fintech look (not a game): navy/ink primary, muted surfaces, green/red
   reserved strictly for gain/loss with an icon alongside color (never
   color alone) for accessibility. */

:root {
    --ink-900: #0b1f3a;
    --ink-800: #132a4d;
    --ink-700: #1c3660;
    --surface-0: #f6f8fb;
    --surface-1: #ffffff;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --primary: #1c3660;
    --primary-hover: #142748;
    --success: #157347;
    --success-bg: #e8f6ee;
    --danger: #b91c1c;
    --danger-bg: #fbebeb;
    --radius: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--surface-0);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- Topbar ---------- */
.topbar {
    background: var(--ink-900);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow-sm);
}
.topbar__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #fff; }
.brand__mark {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #2563eb, #1c3660);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
}
.brand__name { font-size: 15px; }
.main-nav { display: flex; align-items: center; gap: 4px; font-size: 13.5px; flex-wrap: wrap; }
.main-nav a {
    display: inline-flex; align-items: center; gap: 5px;
    color: #cbd5e1; padding: 7px 9px; border-radius: 8px;
}
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.main-nav a.is-active { color: #fff; background: rgba(37,99,235,.28); }
.nav-icon { font-size: 15px; line-height: 1; }
.inline-form { display: inline; }
.link-button {
    background: none; border: none; color: #cbd5e1; font: inherit; cursor: pointer; padding: 6px 4px;
}
.link-button:hover { color: #fff; }

.nav-bell { position: relative; padding-inline-end: 6px !important; }
.badge {
    position: absolute; top: 2px; inset-inline-end: 0;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: #dc2626; color: #fff; border-radius: 999px;
    font-size: 10px; font-weight: 700; line-height: 1;
    box-shadow: 0 0 0 2px var(--ink-900);
}

.nav-dropdown { position: relative; }
.nav-dropdown summary {
    display: inline-flex; align-items: center; gap: 5px;
    color: #cbd5e1; padding: 7px 9px; border-radius: 8px; cursor: pointer; list-style: none;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-dropdown summary::after { content: ' ▾'; font-size: 11px; }
.nav-dropdown[open] summary::after { content: ' ▴'; }
.nav-dropdown__menu {
    display: flex; flex-direction: column; gap: 2px;
    background: var(--ink-800); border-radius: 8px; padding: 8px;
    margin-top: 4px;
}
.nav-dropdown__menu a { color: #cbd5e1; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; }
.nav-dropdown__menu a:hover { background: var(--ink-700); color: #fff; }
.nav-dropdown__logout {
    width: 100%; text-align: right; background: none; border: none; font: inherit; cursor: pointer;
    color: #fca5a5; padding: 8px 10px; border-radius: 6px; font-size: 13.5px;
}
.nav-dropdown__logout:hover { background: rgba(220,38,38,.15); color: #fecaca; }

/* Primary sections move into .bottom-nav on narrow screens — a scannable
   tab bar (the pattern investors already expect from trading apps) beats
   cramming five text+icon links into the top bar until it wraps. */
.main-nav a.main-nav__link { display: none; }

main.has-bottom-nav { padding-bottom: 76px; }

.bottom-nav {
    display: flex; align-items: stretch;
    position: fixed; bottom: 0; inset-inline: 0; z-index: 25;
    background: var(--ink-900);
    box-shadow: 0 -2px 12px rgba(0,0,0,.18);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav__item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: #94a3b8; padding: 5px 2px; border-radius: 10px; font-size: 10.5px;
}
.bottom-nav__item span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav__icon { font-size: 19px; line-height: 1; }
.bottom-nav__item.is-active { color: #fff; background: rgba(37,99,235,.28); }

/* ---------- Status pills / pagination ---------- */
.status-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.status-pill--active { background: var(--success-bg); color: var(--success); }
.status-pill--suspended { background: #fff3e0; color: #b45309; }
.status-pill--banned { background: var(--danger-bg); color: var(--danger); }
.status-pill--pending_activation { background: #f1f5f9; color: var(--text-muted); }

.sim-badge {
    display: inline-flex; align-items: center; gap: 5px;
    background: #eff6ff; color: #1d4ed8; border: 1px solid #dbeafe;
    padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
    cursor: help;
}

.record-banner {
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    border: 1px solid #fcd34d; color: #92400e;
    border-radius: var(--radius); padding: 12px 16px;
    font-weight: 700; font-size: 14px; text-align: center;
    margin-bottom: 16px;
}
.record-badge {
    display: inline-flex; align-items: center; gap: 3px;
    background: #fef3c7; color: #92400e; border: 1px solid #fcd34d;
    border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 600;
    margin-inline-start: 6px;
}

.live-pulse-dot {
    width: 9px; height: 9px; border-radius: 50%; background: #22c55e; flex-shrink: 0;
    box-shadow: 0 0 0 rgba(34,197,94,0.5);
    animation: live-pulse 1.8s infinite;
}
@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
    70% { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.card--celebrate { border-color: #bbf7d0; box-shadow: 0 0 0 3px rgba(34,197,94,0.12), var(--shadow-sm); }

.confetti-burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-piece {
    position: absolute; top: -12px; width: 8px; height: 8px; border-radius: 2px;
    opacity: 0.9; animation: confetti-fall 1.6s ease-in forwards;
}
@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 0.9; }
    100% { transform: translateY(220px) rotate(360deg); opacity: 0; }
}

.realized-pnl--pop { animation: pnl-pop 0.5s ease-out; display: inline-block; }
@keyframes pnl-pop {
    0% { transform: scale(0.6); opacity: 0; }
    60% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); }
}

.edu-tip {
    display: flex; gap: 10px; align-items: flex-start;
    background: #f0fdf4; border: 1px solid #dcfce7; border-radius: var(--radius);
    padding: 12px 14px; font-size: 13px;
}
.edu-tip__icon { font-size: 16px; line-height: 1.3; }
.edu-tip__title { font-weight: 700; margin-bottom: 2px; }
.edu-tip__body { color: var(--text-muted); }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pagination__link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--border);
    font-size: 13px; color: var(--text-primary);
}
.pagination__link--active { background: var(--primary); border-color: var(--primary); color: #fff; }

.admin-quicklinks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-quicklink { text-align: center; font-weight: 600; font-size: 14px; padding: 18px 12px; }
.admin-quicklink:hover { border-color: var(--primary); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 11px 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn--primary { background: #2563eb; color: #fff; }
.btn--primary:hover { background: #1d4ed8; }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 14px; font-size: 13px; }
.btn--outline { background: transparent; border-color: rgba(255,255,255,.4); color: #fff; }

/* ---------- Cards / forms ---------- */
.card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}
.form-page {
    max-width: 420px;
    margin: 40px auto;
    padding: 0 16px;
}
.form-page h1 { font-size: 20px; margin: 0 0 20px; }

/* ---------- Auth pages (login/register split layout) ---------- */
.auth-page { display: grid; grid-template-columns: 1fr; }
.auth-page__panel {
    background: linear-gradient(160deg, var(--ink-900), var(--ink-700));
    color: #fff; padding: 40px 24px; position: relative; overflow: hidden;
}
.auth-page__panel-inner { max-width: 380px; margin: 0 auto; position: relative; z-index: 1; }
.auth-page__panel-inner h2 { font-size: 21px; margin: 16px 0 8px; }
.auth-page__panel-inner > p { color: #cbd5e1; font-size: 14.5px; margin: 0 0 26px; }
.auth-page__glow {
    position: absolute; inset: -25% -15% auto auto; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(37,99,235,.35), transparent 70%);
    filter: blur(30px); pointer-events: none;
}
.auth-page__perks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-page__perks li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: #e2e8f0; }
.auth-page__perk-icon {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; margin-top: 1px;
    background: rgba(74,222,128,.18); color: #4ade80;
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.auth-page__form { display: flex; align-items: center; justify-content: center; padding: 36px 16px; }
.auth-page__form-inner { width: 100%; max-width: 380px; }

@media (min-width: 860px) {
    .auth-page { grid-template-columns: 1fr 1fr; }
    .auth-page__panel { padding: 56px 40px; }
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
.field input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    background: #fff;
}
.field input:focus { outline: 2px solid #2563eb33; border-color: #2563eb; }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 5px; }
.field-checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--text-muted); }
.field-checkbox input { width: auto; margin-top: 3px; }
.form-footer-link { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }

.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin: 16px 0; }
.alert--success { background: var(--success-bg); color: var(--success); }
.alert--danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Forum index: category cards with latest-activity ---------- */
.forum-cat-list { display: flex; flex-direction: column; gap: 10px; }
.forum-cat-card {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.forum-cat-card__icon {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px;
    background: var(--surface-0); display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.forum-cat-card__main { flex: 1 1 200px; min-width: 0; }
.forum-cat-card__name { font-weight: 700; font-size: 15px; }
.forum-cat-card__desc { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.forum-cat-card__count { color: var(--text-muted); font-size: 11.5px; margin-top: 4px; }
.forum-cat-card__latest {
    flex: 1 1 240px; min-width: 0; border-inline-start: 1px solid var(--border);
    padding-inline-start: 14px; font-size: 12.5px;
}
.forum-cat-card__latest-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.forum-cat-card__latest-body { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.forum-cat-card__latest-meta { color: var(--text-muted); margin-top: 4px; }
.forum-cat-card__latest-meta strong { color: var(--text-primary); }
@media (max-width: 639px) {
    .forum-cat-card__latest { border-inline-start: none; padding-inline-start: 0; flex-basis: 100%; padding-top: 10px; border-top: 1px solid var(--border); }
}

/* ---------- Leaderboard podium (top 3) ---------- */
.podium { display: flex; gap: 10px; align-items: flex-end; margin: 20px 0; }
.podium__slot {
    flex: 1; text-align: center; background: var(--surface-1); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 8px;
}
.podium__slot--1 { order: 2; padding-top: 24px; border-color: #f59e0b; }
.podium__slot--2 { order: 1; }
.podium__slot--3 { order: 3; }
.podium__medal { font-size: 26px; line-height: 1; margin-bottom: 6px; }
.podium__name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium__value { font-size: 15px; font-weight: 700; margin-top: 4px; }

/* ---------- Forum post author card ---------- */
.forum-post { display: flex; gap: 18px; flex-wrap: wrap; }
.forum-post__author { flex: 0 0 150px; }
.forum-post__author-stats { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--text-muted); margin-top: 10px; }
.forum-post__author-stats span { color: var(--text-primary); font-weight: 600; }
.forum-post__body { flex: 1 1 320px; min-width: 0; }
@media (max-width: 639px) {
    .forum-post__author { flex: 1 1 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
    .forum-post__author-stats { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
}

/* ---------- Day-range indicator (stock page) ---------- */
.day-range__labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.day-range__track { position: relative; height: 6px; border-radius: 999px; background: var(--border); }
.day-range__marker {
    position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--surface-1); box-shadow: var(--shadow-sm);
    transform: translate(50%, -50%);
}

/* ---------- Landing ---------- */
.hero {
    background: linear-gradient(180deg, var(--ink-900), var(--ink-700));
    color: #fff;
    padding: 48px 16px;
    overflow: hidden;
}
.hero__inner { max-width: 1100px; margin: 0 auto; display: grid; gap: 28px; }
.hero__content { text-align: center; }
.hero__content h1 { font-size: 28px; margin: 0 0 12px; }
.hero__content p { color: #cbd5e1; font-size: 16px; max-width: 480px; margin: 0 auto 24px; }
.hero__content .btn--primary { font-size: 16px; padding: 14px 28px; }

.hero__visual { position: relative; height: 200px; }
.hero__visual canvas { position: relative; z-index: 1; width: 100%; height: 100%; }
.hero__glow {
    position: absolute; inset: 10% -5% auto -5%; height: 180px;
    background: radial-gradient(ellipse at center, rgba(21,115,71,.30), transparent 70%);
    filter: blur(18px); pointer-events: none;
}
.hero__chip {
    position: absolute; z-index: 2; background: rgba(255,255,255,.08); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.16); border-radius: 10px; padding: 8px 12px;
    font-size: 12px; color: #cbd5e1; box-shadow: 0 8px 20px rgba(0,0,0,.3); line-height: 1.5;
}
.hero__chip--1 { top: 4%; inset-inline-end: 4%; }
.hero__chip--2 { bottom: 8%; inset-inline-start: 2%; }

@media (min-width: 860px) {
    .hero { padding: 60px 16px; }
    .hero__inner { grid-template-columns: 1fr 1fr; align-items: center; gap: 40px; }
    .hero__content { text-align: start; }
    .hero__content p { margin: 0 0 24px; }
    .hero__visual { height: 260px; }
}

/* ---------- Market pulse widgets (landing page) ---------- */
.pulse-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pulse-card {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 16px 18px; position: relative; overflow: hidden;
}
.pulse-card__label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 4px; }
.pulse-card__value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.pulse-card__change { font-size: 13px; font-weight: 600; margin-top: 2px; }
.pulse-card__symbol { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.pulse-card__sparkline { position: relative; width: 100%; height: 44px; margin-top: 8px; }
.pulse-card--tasi { grid-column: 1 / -1; }

.ticker-strip {
    overflow: hidden; padding: 4px 0 10px;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
}
.ticker-strip__track {
    display: flex; gap: 8px; width: max-content;
    animation: ticker-scroll 40s linear infinite;
}
.ticker-strip:hover .ticker-strip__track { animation-play-state: paused; }
@keyframes ticker-scroll {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}
.ticker-pill {
    flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px;
    padding: 8px 14px; font-size: 13px; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.ticker-pill__symbol { font-weight: 600; }

/* Full-bleed variant sitting at the very top of the landing page, right
   under the site header — like a real market ticker tape, not just another
   card in the page flow. Sits outside .container on purpose (no side
   padding constraint) so it visually spans the whole viewport. */
.ticker-strip--top {
    background: var(--ink-900); padding: 10px 0; margin: 0;
}
.ticker-strip--top .ticker-pill { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); box-shadow: none; }
.ticker-strip--top .ticker-pill .text-muted { color: #94a3b8; }

@media (prefers-reduced-motion: reduce) {
    .ticker-strip__track { animation: none; }
    .ticker-strip { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (min-width: 640px) {
    .pulse-grid { grid-template-columns: repeat(3, 1fr); }
    .pulse-card--tasi { grid-column: auto; }
}

.features { padding: 40px 16px; }
.features-grid {
    display: grid; grid-template-columns: 1fr; gap: 16px;
    max-width: 1100px; margin: 0 auto;
}
.feature-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.feature-card h3 { margin: 0 0 8px; font-size: 16px; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ---------- Dashboard ---------- */
.dashboard { padding: 20px 16px 40px; max-width: 1100px; margin: 0 auto; }
.portfolio-summary {
    background: linear-gradient(135deg, var(--ink-900), var(--ink-700));
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}
.portfolio-summary__label { font-size: 13px; color: #cbd5e1; margin-bottom: 6px; }
.portfolio-summary__value { font-size: 32px; font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.stat-tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-tile__label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.stat-tile__value { font-size: 19px; font-weight: 700; }

/* ---------- Market breadth strip (market page) ---------- */
.market-breadth {
    display: flex; flex-wrap: wrap; gap: 0;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 8px; box-shadow: var(--shadow-sm);
}
.market-breadth__item {
    flex: 1; min-width: 92px; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 4px 8px; border-inline-start: 1px solid var(--border);
}
.market-breadth__item:first-child { border-inline-start: none; }
.market-breadth__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.market-breadth__dot--up { background: var(--success); }
.market-breadth__dot--down { background: var(--danger); }
.market-breadth__count { font-size: 17px; font-weight: 700; }
.market-breadth__item--value .market-breadth__count { font-size: 14px; }
.market-breadth__label { font-size: 11px; color: var(--text-muted); }

/* ---------- Collapsible sector groups (market page) ---------- */
.sector-group { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.sector-group__summary {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer;
    list-style: none; background: var(--surface-0);
}
.sector-group__summary::-webkit-details-marker { display: none; }
.sector-group__summary:hover { background: var(--border); }
.sector-group__summary::after { content: '▾'; color: var(--text-muted); font-size: 12px; }
.sector-group[open] .sector-group__summary::after { content: '▴'; }
.sector-group__name { font-weight: 700; flex: 1; }
.sector-group__count { color: var(--text-muted); font-size: 13px; }
.sector-group__pulse { display: flex; gap: 10px; font-size: 13px; font-weight: 600; }
.sector-group__body { padding: 10px 16px 4px; }

/* ---------- Summary + chart row (dashboard) — mobile-first, unlike the
   equal-width .spotlight-grid/.features-grid 2-col rows elsewhere, because a
   squeezed-narrow Chart.js canvas is genuinely unreadable, not just tight. ---------- */
.dashboard-summary-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) {
    .dashboard-summary-row { grid-template-columns: 1fr 1.4fr; }
}

/* ---------- Stock search/autocomplete (orders page, forum new-topic) ---------- */
.stock-autocomplete { position: relative; }
.stock-autocomplete__list {
    position: absolute; z-index: 30; top: 100%; inset-inline: 0; margin-top: 4px;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: var(--shadow-sm); max-height: 260px; overflow-y: auto;
}
.stock-autocomplete__item { padding: 9px 12px; font-size: 14px; cursor: pointer; }
.stock-autocomplete__item:hover { background: var(--surface-0); }
.stock-autocomplete__item + .stock-autocomplete__item { border-top: 1px solid var(--border); }

/* ---------- Investor identity card (portfolio page) ---------- */
.investor-card {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 14px 18px; margin-bottom: 16px;
}
.investor-card__identity { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 220px; }
.investor-card__avatar {
    flex: none; width: 46px; height: 46px; border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1c3660); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 18px;
}
.investor-card__info { flex: 1; min-width: 0; }
.investor-card__name { font-weight: 700; font-size: 15.5px; }
.investor-card__meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.investor-card__rank {
    margin-inline-start: auto; display: flex; align-items: center; gap: 8px;
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 999px;
    padding: 6px 14px 6px 8px; color: var(--text-primary);
}
.investor-card__rank-icon { font-size: 20px; }
.investor-card__rank-label { font-size: 10.5px; color: #92400e; }
.investor-card__rank-value { font-size: 15px; font-weight: 800; color: #92400e; }

/* ---------- Dashboard two-column layout (logged-in home) ---------- */
.dashboard-layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 860px) {
    /* First DOM child lands in the rightmost grid column under dir="rtl"
       — no explicit ordering needed for "name on the right" here. */
    .dashboard-layout { grid-template-columns: 260px 1fr; }
}
.dashboard-main { min-width: 0; }
.dashboard-sidebar {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 24px 18px; text-align: center;
}
.dashboard-sidebar__avatar {
    width: 68px; height: 68px; border-radius: 50%; margin: 0 auto 12px;
    background: linear-gradient(135deg, #2563eb, #1c3660); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 26px;
}
.dashboard-sidebar__name { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.dashboard-sidebar__meta { color: var(--text-muted); font-size: 12.5px; line-height: 1.9; margin-bottom: 16px; }
.dashboard-sidebar__rank {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 999px;
    padding: 8px 16px 8px 10px; color: var(--text-primary);
}
.dashboard-sidebar__holdings { text-align: start; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.dashboard-sidebar__holdings h3 { margin: 0 0 8px; font-size: 14px; }
.dashboard-sidebar__holding {
    display: flex; justify-content: space-between; gap: 8px;
    padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.dashboard-sidebar__holdings-link { display: block; margin-top: 10px; font-size: 12.5px; }

/* ---------- Best/worst holding spotlight (portfolio page) ---------- */
.spotlight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.spotlight-card {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px;
}
.spotlight-card__label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.spotlight-card__name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.spotlight-card__pct { font-size: 18px; font-weight: 800; }

/* ---------- Position weight bar (holdings table) ---------- */
.weight-bar { background: var(--border); border-radius: 999px; height: 4px; margin-top: 6px; overflow: hidden; width: 100px; max-width: 100%; }
.weight-bar__fill { background: var(--primary); height: 100%; border-radius: 999px; }
.weight-bar__label { font-size: 11px; color: var(--text-muted); }

/* ---------- Allocation composition bar (portfolio page) ---------- */
.alloc-bar { display: flex; height: 16px; border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.alloc-bar__seg { height: 100%; }
.alloc-bar__seg:not(:last-child) { border-inline-end: 2px solid var(--surface-1); }
.alloc-legend { display: flex; flex-direction: column; gap: 9px; }
.alloc-legend__row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.alloc-legend__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.alloc-legend__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alloc-legend__pct { font-weight: 700; flex: none; width: 48px; text-align: left; }
.alloc-legend__value { color: var(--text-muted); flex: none; width: 100px; text-align: left; }

.figure--positive { color: var(--success); }
.figure--negative { color: var(--danger); }
.figure-icon { font-size: 12px; margin-inline-end: 3px; }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 16px; }

/* ---------- Utility ---------- */
.text-muted { color: var(--text-muted); }
.mt-24 { margin-top: 24px; }

.site-footer { padding: 24px 16px 40px; text-align: center; }
.site-footer p { color: var(--text-muted); font-size: 12.5px; max-width: 640px; margin: 0 auto; }

@media (min-width: 640px) {
    .features-grid { grid-template-columns: repeat(3, 1fr); }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .stat-grid--6 { grid-template-columns: repeat(3, 1fr); }
    .admin-quicklinks { grid-template-columns: repeat(4, 1fr); }
    .nav-dropdown__menu {
        position: absolute; inset-inline-start: 0; top: 100%;
        min-width: 180px; box-shadow: var(--shadow-sm); z-index: 30;
    }
    .main-nav a.main-nav__link { display: inline-flex; }
    .bottom-nav { display: none; }
    main.has-bottom-nav { padding-bottom: 0; }
}

@media (min-width: 860px) {
    .stat-grid--6 { grid-template-columns: repeat(6, 1fr); }
}
