/* ============================================================
   TradeScan 365 — Design Token System
   Professional Trading Screener (TradingView-standard)

   Usage: Apply data-theme="dark" or data-theme="light" on <html>
   Default: dark (industry standard for trading platforms)
   ============================================================ */

/* ── Dark Theme (Default) ───────────────────────────────── */
[data-theme="dark"],
:root {
    /* Backgrounds */
    --bg-primary: #131722;
    --bg-surface: #1E222D;
    --bg-surface-hover: #262A35;
    --bg-elevated: #2A2E39;
    --bg-inset: #0E1117;

    /* Text */
    --text-primary: #D1D4DC;
    --text-secondary: #787B86;
    --text-muted: #4A5568;
    --text-heading: #EAECEF;
    --text-inverse: #131722;
    --text-on-accent: #FFFFFF;   /* text on a filled accent/bullish/bearish chip — white reads on all of them in both themes */

    /* Borders */
    --border-primary: #363A45;
    --border-subtle: #2B2B43;
    --border-strong: #4A4E5A;

    /* Accent */
    --accent-primary: #2962FF;
    --accent-primary-hover: #1E50E6;
    --accent-primary-muted: rgba(41, 98, 255, 0.15);

    /* Telegram brand (community CTAs) — intentionally distinct from accent */
    --telegram: #229ED9;
    --telegram-strong: #2AABEE;
    --telegram-gradient: linear-gradient(135deg, #2AABEE, #229ED9);
    --telegram-bg: rgba(34, 158, 217, 0.12);
    --telegram-border: rgba(34, 158, 217, 0.40);
    --telegram-contrast: #ffffff;
    --telegram-ink: #3FB5EC; /* text on --telegram-bg (dark theme) — AA-legible */

    /* Semantic — Bullish / Bearish / Neutral */
    --bullish: #26A69A;
    --bullish-text: #26A69A;
    --bullish-bg: rgba(38, 166, 154, 0.12);
    --bullish-strong: #2DD4A8;
    --bullish-rgb: 38, 166, 154;

    --bearish: #EF5350;
    --bearish-text: #EF5350;
    --bearish-bg: rgba(239, 83, 80, 0.12);
    --bearish-strong: #FF6B6B;
    --bearish-rgb: 239, 83, 80;

    --neutral: #787B86;
    --neutral-bg: rgba(120, 123, 134, 0.1);
    --neutral-rgb: 120, 123, 134;

    /* OI Quadrant Colors */
    --oi-long-buildup: #10B981;
    --oi-long-buildup-bg: rgba(16, 185, 129, 0.12);
    --oi-short-buildup: #EF4444;
    --oi-short-buildup-bg: rgba(239, 68, 68, 0.12);
    --oi-short-covering: #3B82F6;
    --oi-short-covering-bg: rgba(59, 130, 246, 0.12);
    --oi-long-unwinding: #F97316;
    --oi-long-unwinding-bg: rgba(249, 115, 22, 0.12);

    /* Status */
    --warning: #FF9800;
    --warning-bg: rgba(255, 152, 0, 0.12);
    --info: #2196F3;
    --info-bg: rgba(33, 150, 243, 0.12);
    --danger: #F44336;
    --danger-bg: rgba(244, 67, 54, 0.12);
    --success: #4CAF50;
    --success-bg: rgba(76, 175, 80, 0.12);

    /* Accent Secondary */
    --accent-secondary: #7C3AED;

    /* Events */
    --events: #06b6d4;

    /* Lab — admin-only experimental sandbox; visually distinct from --danger red */
    --lab: #EC4899;
    --lab-bg: rgba(236, 72, 153, 0.12);

    /* Top Nav */
    --topnav-bg: #1E222D;
    --topnav-text: #B2B5BE;
    --topnav-text-active: #FFFFFF;
    --topnav-active-bg: rgba(41, 98, 255, 0.15);
    --topnav-active-accent: #2962FF;
    --topnav-hover-bg: rgba(255, 255, 255, 0.05);
    --topnav-border: #2B2B43;
    --topnav-section-text: #787B86;

    /* Dropdown */
    --dropdown-bg: #1E222D;
    --dropdown-border: #363A45;
    --dropdown-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    --dropdown-item-hover: rgba(255, 255, 255, 0.05);
    --dropdown-item-active-bg: rgba(41, 98, 255, 0.15);
    --dropdown-item-active-text: #FFFFFF;

    /* Header */
    --header-bg: #1E222D;
    --header-border: #2B2B43;
    --header-text: #D1D4DC;

    /* Input / Form */
    --input-bg: #1E222D;
    --input-border: #363A45;
    --input-text: #D1D4DC;
    --input-placeholder: #4A5568;
    --input-focus-border: #2962FF;
    --input-focus-ring: rgba(41, 98, 255, 0.2);

    /* Table */
    --table-header-bg: #1A1E2B;
    --table-header-text: #787B86;
    --table-row-odd: #131722;
    --table-row-even: #1A1E2B;
    --table-row-hover: #262A35;
    --table-border: #1E222D;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.35);

    /* Scrollbar */
    --scrollbar-track: #131722;
    --scrollbar-thumb: #363A45;
    --scrollbar-thumb-hover: #4A4E5A;

    /* Badge */
    --badge-live-bg: rgba(38, 166, 154, 0.15);
    --badge-live-text: #26A69A;
    --badge-new-bg: rgba(41, 98, 255, 0.15);
    --badge-new-text: #5B8DEF;

    /* Card */
    --card-bg: #1E222D;
    --card-border: #2B2B43;
    --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ── Light Theme ─────────────────────────────────────────── */
[data-theme="light"] {
    /* Backgrounds */
    --bg-primary: #F0F3FA;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F1F5F9;
    --bg-elevated: #FFFFFF;
    --bg-inset: #E8ECF3;

    /* Text */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --text-heading: #0F172A;
    --text-inverse: #FFFFFF;
    --text-on-accent: #FFFFFF;   /* text on a filled accent/bullish/bearish chip — white reads on all of them in both themes */

    /* Borders */
    --border-primary: #E2E8F0;
    --border-subtle: #F1F5F9;
    --border-strong: #CBD5E1;

    /* Accent */
    --accent-primary: #2962FF;
    --accent-primary-hover: #1E50E6;
    --accent-primary-muted: rgba(41, 98, 255, 0.08);

    /* Telegram brand (community CTAs) */
    --telegram: #229ED9;
    --telegram-strong: #2AABEE;
    --telegram-gradient: linear-gradient(135deg, #2AABEE, #229ED9);
    --telegram-bg: rgba(34, 158, 217, 0.10);
    --telegram-border: rgba(34, 158, 217, 0.35);
    --telegram-contrast: #ffffff;
    --telegram-ink: #136A94; /* text on --telegram-bg (light theme) — AA-legible */

    /* Semantic — Bullish / Bearish / Neutral */
    --bullish: #059669;
    --bullish-text: #059669;
    --bullish-bg: rgba(5, 150, 105, 0.08);
    --bullish-strong: #047857;
    --bullish-rgb: 5, 150, 105;

    --bearish: #DC2626;
    --bearish-text: #DC2626;
    --bearish-bg: rgba(220, 38, 38, 0.08);
    --bearish-strong: #B91C1C;
    --bearish-rgb: 220, 38, 38;

    --neutral: #6B7280;
    --neutral-bg: rgba(107, 114, 128, 0.08);
    --neutral-rgb: 107, 114, 128;

    /* OI Quadrant Colors */
    --oi-long-buildup: #059669;
    --oi-long-buildup-bg: rgba(5, 150, 105, 0.08);
    --oi-short-buildup: #DC2626;
    --oi-short-buildup-bg: rgba(220, 38, 38, 0.08);
    --oi-short-covering: #2563EB;
    --oi-short-covering-bg: rgba(37, 99, 235, 0.08);
    --oi-long-unwinding: #EA580C;
    --oi-long-unwinding-bg: rgba(234, 88, 12, 0.08);

    /* Status */
    --warning: #D97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --info: #2563EB;
    --info-bg: rgba(37, 99, 235, 0.08);
    --danger: #DC2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --success: #16A34A;
    --success-bg: rgba(22, 163, 74, 0.08);

    /* Accent Secondary */
    --accent-secondary: #7C3AED;

    /* Events */
    --events: #0891b2;

    /* Lab — admin-only experimental sandbox; visually distinct from --danger red */
    --lab: #DB2777;
    --lab-bg: rgba(219, 39, 119, 0.08);

    /* Top Nav */
    --topnav-bg: #FFFFFF;
    --topnav-text: #64748B;
    --topnav-text-active: #1E293B;
    --topnav-active-bg: rgba(41, 98, 255, 0.08);
    --topnav-active-accent: #2962FF;
    --topnav-hover-bg: rgba(0, 0, 0, 0.04);
    --topnav-border: #E2E8F0;
    --topnav-section-text: #64748B;

    /* Dropdown */
    --dropdown-bg: #FFFFFF;
    --dropdown-border: #E2E8F0;
    --dropdown-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    --dropdown-item-hover: rgba(0, 0, 0, 0.04);
    --dropdown-item-active-bg: rgba(41, 98, 255, 0.08);
    --dropdown-item-active-text: #1E293B;

    /* Header */
    --header-bg: #FFFFFF;
    --header-border: #E2E8F0;
    --header-text: #1E293B;

    /* Input / Form */
    --input-bg: #FFFFFF;
    --input-border: #E2E8F0;
    --input-text: #1E293B;
    --input-placeholder: #94A3B8;
    --input-focus-border: #2962FF;
    --input-focus-ring: rgba(41, 98, 255, 0.15);

    /* Table */
    --table-header-bg: #F8FAFC;
    --table-header-text: #64748B;
    --table-row-odd: #FFFFFF;
    --table-row-even: #F8FAFC;
    --table-row-hover: #F1F5F9;
    --table-border: #F1F5F9;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);

    /* Scrollbar */
    --scrollbar-track: #F1F5F9;
    --scrollbar-thumb: #CBD5E1;
    --scrollbar-thumb-hover: #94A3B8;

    /* Badge */
    --badge-live-bg: rgba(5, 150, 105, 0.1);
    --badge-live-text: #059669;
    --badge-new-bg: rgba(41, 98, 255, 0.1);
    --badge-new-text: #2962FF;

    /* Card */
    --card-bg: #FFFFFF;
    --card-border: #E2E8F0;
    --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ── Layout Tokens (theme-independent) ──────────────────── */
:root {
    --topnav-height: 56px;
    --content-max-width: 1600px;
}

/* ── Transition Tokens ──────────────────────────────────── */
:root {
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ── Border Radius Tokens ───────────────────────────────── */
:root {
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
}

/* ── Spacing Tokens ─────────────────────────────────────── */
:root {
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
}

/* ── Typography Tokens ──────────────────────────────────── */
:root {
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;

    /* Font sizes */
    --text-xs: 0.75rem;       /* 12px - captions, labels */
    --text-sm: 0.8125rem;     /* 13px - table body */
    --text-base: 0.875rem;    /* 14px - body text */
    --text-md: 0.9375rem;     /* 15px - slightly larger body */
    --text-lg: 1.125rem;      /* 18px - section headers */
    --text-xl: 1.25rem;       /* 20px - page subtitles */
    --text-2xl: 1.5rem;       /* 24px - page titles */
    --text-3xl: 1.75rem;      /* 28px - stat card numbers */
    --text-4xl: 2.25rem;      /* 36px - hero numbers */

    /* Font weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Line heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;

    /* Letter spacing */
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.05em;
    --tracking-wider: 0.1em;
}

/* ── Desktop Typography Overrides ─────────────────────── */
@media (min-width: 1024px) {
    :root {
        --text-xs: 0.8125rem;   /* 13px on desktop (was 12px) */
        --text-sm: 0.875rem;    /* 14px on desktop (was 13px) */
    }
}

/* ── Global Base Styles ─────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-sans);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    overflow-x: hidden;
}

/* ── Scrollbar Styling ──────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ── Option Chain Horizontal Scroll ────────────────────── */
.oc-scroll {
    position: relative;
    overflow-x: auto;
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
}
.oc-scroll.oc-grabbing {
    cursor: grabbing;
    scroll-behavior: auto;
}
/* Thicker horizontal scrollbar for wide tables */
.oc-scroll::-webkit-scrollbar {
    height: 14px;
}
.oc-scroll::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
    border: 2px solid var(--scrollbar-track);
}
.oc-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Edge shadow indicators */
.oc-scroll-wrap {
    position: relative;
}
.oc-scroll-wrap::before,
.oc-scroll-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 14px; /* above scrollbar */
    width: 28px;
    pointer-events: none;
    z-index: 15;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.oc-scroll-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.35), transparent);
    border-radius: var(--radius-md) 0 0 0;
}
.oc-scroll-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(0,0,0,0.35), transparent);
    border-radius: 0 var(--radius-md) 0 0;
}
.oc-scroll-wrap.show-left::before { opacity: 1; }
.oc-scroll-wrap.show-right::after { opacity: 1; }

/* ── Typography Classes ─────────────────────────────────── */
.text-heading {
    color: var(--text-heading);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
}

.text-body {
    color: var(--text-primary);
    font-weight: var(--weight-normal);
    line-height: var(--leading-normal);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-muted);
}

/* Tabular numbers for all financial data */
.tabular-nums,
table td,
table th,
.stat-value,
.price,
.change,
.volume,
.oi-value {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ── Selection Colors ───────────────────────────────────── */
::selection {
    background-color: var(--accent-primary);
    color: #FFFFFF;
}

/* ── Focus Visible ──────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ── Semantic Color Classes ─────────────────────────────── */
.text-bullish { color: var(--bullish-text); }
.text-bearish { color: var(--bearish-text); }
.text-neutral { color: var(--neutral); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-accent  { color: var(--accent-primary); }

/* In-app chart symbol link (replaces the old external-TradingView anchors) */
.qs-symbol-link { color: inherit; text-decoration: none; font-weight: var(--weight-semibold, 600); cursor: pointer; }
.qs-symbol-link:hover { color: var(--accent-primary, #2962FF); text-decoration: underline; }

.bg-bullish  { background-color: var(--bullish-bg); }
.bg-bearish  { background-color: var(--bearish-bg); }
.bg-neutral  { background-color: var(--neutral-bg); }
.bg-warning  { background-color: var(--warning-bg); }
.bg-info     { background-color: var(--info-bg); }
.bg-danger   { background-color: var(--danger-bg); }
.bg-success  { background-color: var(--success-bg); }

/* ── Surface & Card Utilities ───────────────────────────── */
.surface {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.surface-elevated {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    transition: box-shadow var(--transition-normal);
}

.card:hover {
    box-shadow: var(--card-hover-shadow);
}

/* ── Transition Utilities ───────────────────────────────── */
.transition-fast { transition: all var(--transition-fast); }
.transition-normal { transition: all var(--transition-normal); }

/* ── Live Pulse Animation ───────────────────────────────── */
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--bullish);
    border-radius: 50%;
    animation: live-pulse 2s ease-in-out infinite;
}

.live-dot-lg {
    width: 8px;
    height: 8px;
}

/* ── Flash Animations for Real-time Data ────────────────── */
@keyframes flash-bullish {
    0% { background-color: var(--bullish-bg); }
    100% { background-color: transparent; }
}

@keyframes flash-bearish {
    0% { background-color: var(--bearish-bg); }
    100% { background-color: transparent; }
}

.flash-up {
    animation: flash-bullish 0.8s ease-out;
}

.flash-down {
    animation: flash-bearish 0.8s ease-out;
}

/* ── Skeleton Loading ───────────────────────────────────── */
@keyframes skeleton-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

.skeleton {
    background-color: var(--border-subtle);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text {
    height: 0.875rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.skeleton-text-sm {
    height: 0.75rem;
    width: 60%;
}

.skeleton-circle {
    border-radius: 50%;
}

/* ============================================================
   PHASE 5: Professional DataTable, Stat Cards, Filter Panels,
   Badges, Page Layout — Trading Screener Standard
   ============================================================ */

/* ── Professional Data Table ────────────────────────────── */
.qs-table-wrap {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.qs-table-scroll {
    overflow-x: auto;
}

.qs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

/* Header */
.qs-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
    white-space: nowrap;
    user-select: none;
}

.qs-table thead th.text-right {
    text-align: right;
}

.qs-table thead th.text-center {
    text-align: center;
}

/* Numeric header — right aligned to sit above its right-aligned `td.num` data.
   Without this, `<th class="num">` falls through to the base `text-align:left`, so
   numeric column headers drift left of their numbers. */
.qs-table thead th.num {
    text-align: right;
}

/* Sortable header */
.qs-table thead th.sortable {
    cursor: pointer;
}

.qs-table thead th.sortable:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

.qs-table thead th.sortable .sort-arrow {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.625rem;
    vertical-align: middle;
    color: var(--accent-primary);
}

/* ── Chip Toggle Buttons ──────────────────────────────────── */
.qs-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-full);
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
}

.qs-chip:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.qs-chip.active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #FFFFFF;
}

/* ── Segmented Toggle (two-or-more mutually-exclusive views) ── */
.qs-segment {
    display: inline-flex;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.qs-segment-btn {
    padding: 0.35rem 0.75rem;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.qs-segment-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.qs-segment-btn.active {
    background-color: var(--accent-primary);
    color: #FFFFFF;
}

/* Body rows — zebra striping */
.qs-table tbody tr:nth-child(odd) {
    background-color: var(--table-row-odd);
}

.qs-table tbody tr:nth-child(even) {
    background-color: var(--table-row-even);
}

/* Hover — NO transform, NO scale */
.qs-table tbody tr:hover {
    background-color: var(--table-row-hover);
}

/* Cells */
.qs-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--table-border);
    color: var(--text-primary);
    vertical-align: middle;
    white-space: nowrap;
}

.qs-table tbody td.text-right {
    text-align: right;
}

.qs-table tbody td.text-center {
    text-align: center;
}

/* Numeric cells — right aligned, tabular */
.qs-table tbody td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* Symbol/ticker cell — bold, clickable */
.qs-table tbody td.symbol {
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
}

.qs-table tbody td.symbol a {
    color: var(--accent-primary);
    text-decoration: none;
}

.qs-table tbody td.symbol a:hover {
    text-decoration: underline;
}

/* Change% cells — colored text */
.qs-table .change-positive {
    color: var(--bullish-text);
    font-weight: var(--weight-medium);
}

.qs-table .change-negative {
    color: var(--bearish-text);
    font-weight: var(--weight-medium);
}

.qs-table .change-neutral {
    color: var(--neutral);
}

/* Row flash animation for real-time updates */
.qs-table tbody tr.flash-new {
    animation: flash-bullish 0.8s ease-out 0s 3 alternate;
}

/* ── Compact Table Variant ──────────────────────────────── */
.qs-table-compact thead th {
    padding: 0.5rem 0.625rem;
}

.qs-table-compact tbody td {
    padding: 0.375rem 0.625rem;
    font-size: var(--text-xs);
}

/* ── Sticky first column (all viewports) ──────────────── */
.qs-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.qs-table thead th:first-child,
.qs-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: inherit;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.08);
}

/* ── 1366px Laptop Density ────────────────────────────── */
@media (min-width: 1366px) {
    .qs-table thead th {
        padding: 0.75rem 0.875rem;
    }

    .qs-table tbody td {
        padding: 0.5625rem 0.875rem;
    }

    .qs-stats-grid {
        gap: 1.25rem;
    }

    .qs-filter-panel {
        padding: 1.125rem 1.5rem;
    }
}

/* ── Ultra-wide Content Guard (1920px+) ───────────────── */
@media (min-width: 1920px) {
    .qs-stats-grid {
        max-width: var(--content-max-width);
    }
}

/* ── Stat Cards ─────────────────────────────────────────── */
.qs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.qs-stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
    border-left: 4px solid var(--accent-primary);
}

.qs-stat-card.bullish  { border-left-color: var(--bullish); }
.qs-stat-card.bearish  { border-left-color: var(--bearish); }
.qs-stat-card.warning  { border-left-color: var(--warning); }
.qs-stat-card.info     { border-left-color: var(--info); }
.qs-stat-card.success  { border-left-color: var(--success); }
.qs-stat-card.danger   { border-left-color: var(--danger); }

.qs-stat-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.qs-stat-value {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.qs-stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    margin-top: 0.375rem;
}

.qs-stat-change.positive {
    color: var(--bullish-text);
    background-color: var(--bullish-bg);
}

.qs-stat-change.negative {
    color: var(--bearish-text);
    background-color: var(--bearish-bg);
}

/* ── Filter Panel ───────────────────────────────────────── */
.qs-filter-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.qs-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.qs-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 150px;
}

.qs-filter-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--text-secondary);
}

.qs-label {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    letter-spacing: var(--tracking-wide);
}

/* ── Form Inputs (themed) ───────────────────────────────── */
.qs-input,
.qs-select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: var(--text-sm);
    color: var(--input-text);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
}

.qs-input::placeholder {
    color: var(--input-placeholder);
}

.qs-input:focus,
.qs-select:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 2px var(--input-focus-ring);
}

.qs-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23787B86' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* ── Buttons (themed) ───────────────────────────────────── */
.qs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: background-color var(--transition-fast), opacity var(--transition-fast);
    white-space: nowrap;
}

.qs-btn:hover {
    opacity: 0.9;
}

.qs-btn-primary {
    background-color: var(--accent-primary);
    color: #FFFFFF;
}

.qs-btn-primary:hover {
    background-color: var(--accent-primary-hover);
}

.qs-btn-secondary {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.qs-btn-success {
    background-color: var(--bullish);
    color: #FFFFFF;
}

.qs-btn-danger {
    background-color: var(--danger);
    color: var(--text-on-danger, #FFFFFF);
}

.qs-btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: var(--text-xs);
}

/* ── Badges / Pills ─────────────────────────────────────── */
.qs-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
}

.qs-badge-bullish {
    background-color: var(--bullish-bg);
    color: var(--bullish-text);
}

.qs-badge-bearish {
    background-color: var(--bearish-bg);
    color: var(--bearish-text);
}

.qs-badge-warning {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.qs-badge-info {
    background-color: var(--info-bg);
    color: var(--info);
}

.qs-badge-accent {
    background-color: var(--accent-primary-muted);
    color: var(--accent-primary);
}

/* OI Quadrant badges */
.qs-badge-long-buildup {
    background-color: var(--oi-long-buildup-bg);
    color: var(--oi-long-buildup);
}

.qs-badge-short-buildup {
    background-color: var(--oi-short-buildup-bg);
    color: var(--oi-short-buildup);
}

.qs-badge-short-covering {
    background-color: var(--oi-short-covering-bg);
    color: var(--oi-short-covering);
}

.qs-badge-long-unwinding {
    background-color: var(--oi-long-unwinding-bg);
    color: var(--oi-long-unwinding);
}

/* RRG quadrant badges (reuse OI color tokens) */
.qs-badge-rrg-leading    { background-color: var(--oi-long-buildup-bg);    color: var(--oi-long-buildup); }
.qs-badge-rrg-weakening  { background-color: var(--oi-long-unwinding-bg);  color: var(--oi-long-unwinding); }
.qs-badge-rrg-lagging    { background-color: var(--oi-short-buildup-bg);   color: var(--oi-short-buildup); }
.qs-badge-rrg-improving  { background-color: var(--oi-short-covering-bg);  color: var(--oi-short-covering); }

/* ── Tabs (for multi-tab pages like OI Analysis) ────────── */
.qs-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-primary);
    margin-bottom: 1rem;
    overflow-x: auto;
}

.qs-tab {
    padding: 0.625rem 1rem;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.qs-tab:hover {
    color: var(--text-primary);
}

.qs-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    font-weight: var(--weight-semibold);
}

/* ── Page Header ────────────────────────────────────────── */
.qs-page-header {
    margin-bottom: 1.25rem;
}

.qs-page-title {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qs-page-subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ── Empty State ────────────────────────────────────────── */
.qs-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.qs-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.qs-empty-text {
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
}

/* ── Loading Spinner (themed) ───────────────────────────── */
.qs-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.qs-spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Loading Overlay ────────────────────────────────────── */
.qs-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

/* ── Connection Status Banner ───────────────────────────── */
.qs-connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
}

.qs-connection-status.connected {
    background-color: var(--bullish-bg);
    color: var(--bullish-text);
}

.qs-connection-status.disconnected {
    background-color: var(--danger-bg);
    color: var(--danger);
}

.qs-connection-status.reconnecting {
    background-color: var(--warning-bg);
    color: var(--warning);
}

/* ── OI Quadrant Card Borders ───────────────────────────── */
.qs-quadrant-long-buildup {
    border-left: 4px solid var(--oi-long-buildup);
}

.qs-quadrant-short-buildup {
    border-left: 4px solid var(--oi-short-buildup);
}

.qs-quadrant-short-covering {
    border-left: 4px solid var(--oi-short-covering);
}

.qs-quadrant-long-unwinding {
    border-left: 4px solid var(--oi-long-unwinding);
}

/* ── Market Monitor Heatmap ─────────────────────────────── */
/*
   Tijori-style heatmap: 6 intensity bands (deep-green → deep-red) + locked.
   CSS var architecture so the .heat-* classes work regardless of whether
   data-theme is set — dark vars live in :root, light overrides follow.
*/
[data-theme="dark"], :root {
    --heat-deep-green-bg:  rgba(38, 166, 154, 0.55);
    --heat-deep-green-fg:  #C8FBE8;
    --heat-green-bg:       rgba(38, 166, 154, 0.38);
    --heat-green-fg:       #A8F0D8;
    --heat-light-green-bg: rgba(38, 166, 154, 0.22);
    --heat-light-green-fg: #7EE0C8;
    --heat-light-red-bg:   rgba(239, 83, 80, 0.22);
    --heat-light-red-fg:   #FFB0AE;
    --heat-red-bg:         rgba(239, 83, 80, 0.40);
    --heat-red-fg:         #FFBDBB;
    --heat-deep-red-bg:    rgba(239, 83, 80, 0.58);
    --heat-deep-red-fg:    #FFD1CF;
    --heat-locked-bg:      rgba(120, 123, 134, 0.10);
}

[data-theme="light"] {
    --heat-deep-green-bg:  #059669;
    --heat-deep-green-fg:  #FFFFFF;
    --heat-green-bg:       rgba(5, 150, 105, 0.55);
    --heat-green-fg:       #064E3B;
    --heat-light-green-bg: rgba(5, 150, 105, 0.22);
    --heat-light-green-fg: #065F46;
    --heat-light-red-bg:   rgba(220, 38, 38, 0.18);
    --heat-light-red-fg:   #991B1B;
    --heat-red-bg:         rgba(220, 38, 38, 0.42);
    --heat-red-fg:         #7F1D1D;
    --heat-deep-red-bg:    #DC2626;
    --heat-deep-red-fg:    #FFFFFF;
    --heat-locked-bg:      rgba(107, 114, 128, 0.06);
}

/* Apply the classes directly — no theme scoping so they work regardless. */
.heat-deep-green  { background-color: var(--heat-deep-green-bg);  color: var(--heat-deep-green-fg); }
.heat-green       { background-color: var(--heat-green-bg);       color: var(--heat-green-fg); }
.heat-light-green { background-color: var(--heat-light-green-bg); color: var(--heat-light-green-fg); }
.heat-light-red   { background-color: var(--heat-light-red-bg);   color: var(--heat-light-red-fg); }
.heat-red         { background-color: var(--heat-red-bg);         color: var(--heat-red-fg); }
.heat-deep-red    { background-color: var(--heat-deep-red-bg);    color: var(--heat-deep-red-fg); }
.heat-locked      { background-color: var(--heat-locked-bg);      color: var(--text-muted); }

/*
   Cell geometry — padding matches .qs-table thead th so the header text and
   body numbers line up vertically within each column (before the fix: header
   had 0.75rem horizontal padding, body had 0.625rem, so every column was
   visibly ~2px off). min-width keeps value-length variance from resizing cols.
*/
.qs-heat-cell {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    font-weight: var(--weight-semibold);
    text-align: right;
    padding: 0.625rem 0.75rem;
    white-space: nowrap;
    min-width: 96px;
    width: 96px;      /* fixed-width table uses this as the strict column width */
    box-sizing: border-box;
}

/* Heatmap row-label column — sticky so it stays visible on horizontal scroll. */
.qs-heat-rowlabel {
    position: sticky;
    left: 0;
    z-index: 2;
    background-color: var(--bg-surface);
    padding: 0.625rem 0.875rem;
    font-weight: var(--weight-semibold);
    white-space: nowrap;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
    min-width: 180px;
}

.qs-heat-rowlabel small {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: var(--weight-normal);
    margin-top: 0.125rem;
}

/* Expand/collapse chevron on basket rows — rotates 90° when open */
.qs-heat-chevron {
    display: inline-block;
    width: 0.75rem;
    font-size: var(--text-xs);
    color: var(--text-muted);
    transition: transform 0.15s ease;
    user-select: none;
    line-height: 1;
}

/* Weight column cell — centered numeric */
.qs-heat-weight {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    text-align: right;
    padding: 0.625rem 0.75rem;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
    min-width: 72px;
    width: 72px;
    box-sizing: border-box;
    border-left: 1px solid var(--table-border);
}

/* Constituent (child) rows — subtle tint + smaller label so eye reads them
   as secondary rows nested under the parent basket. */
.qs-heatmap tbody tr.qs-heat-child {
    background-color: var(--bg-inset) !important;
}
.qs-heatmap tbody tr.qs-heat-child:hover {
    background-color: var(--table-row-hover) !important;
}
.qs-heatmap tbody tr.qs-heat-child .qs-heat-rowlabel {
    background-color: var(--bg-inset) !important;
    font-weight: var(--weight-normal);
    font-size: var(--text-xs);
}
/* Sticky-cell hover override — without this, the sticky first column stays
   bg-inset while the rest of the row turns table-row-hover, creating an
   ugly two-tone band on hover. */
.qs-heatmap tbody tr.qs-heat-child:hover .qs-heat-rowlabel {
    background-color: var(--table-row-hover) !important;
}
.qs-heat-child-label a:hover {
    text-decoration: underline !important;
}

/*
   Header of the heatmap table — match body cell padding AND right-align by
   default (overriding .qs-table thead th's default text-align:left). Eye
   should move down each column and see the label directly above every value.
*/
/*
   table-layout: fixed makes the declared column widths strict — browsers no
   longer grow a column to fit long header text, which is what was dragging
   "LTP VS 52W HIGH" to ~190px while the 1D column sat at ~100px. The short
   "52W HIGH" label now fits comfortably in the uniform 96px slot.
*/
.qs-heatmap {
    table-layout: fixed;
    width: 100%;
}

.qs-heatmap thead th {
    padding: 0.625rem 0.75rem !important;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 96px;
    width: 96px;
    box-sizing: border-box;
}

.qs-heatmap thead th.qs-heat-rowlabel {
    text-align: left;
    padding: 0.625rem 0.875rem !important;
    min-width: 180px;
    width: 180px;
    z-index: 15;   /* sticky corner (top+left): above the top-sticky data headers (z:10) and left-sticky body column (z:5) */
}

/* Cap the heatmap height so the table BODY scrolls inside the container and the
   sticky <thead> stays pinned while scrolling. Without a cap, .qs-table-scroll
   grows to its full content height, so page scroll carries the whole table —
   header included — off-screen (you'd have to scroll back to the top to read the
   column headers). Scoped to the Market Monitor heatmap only. */
.qs-heatmap-scroll {
    max-height: calc(100vh - var(--topnav-height) - 13rem);
    overflow-y: auto;
}

/* Subtle separator between data columns to give the eye a column grid */
.qs-heatmap tbody td + td,
.qs-heatmap thead th + th {
    border-left: 1px solid var(--table-border);
}

/*
   Tijori-style breadth bar on basket/group rows — a thin colored track
   (red | green in proportion to constituents down/up today) with small count
   labels underneath at the edges. Mirrors the Tijori reference screenshot.
   Segments don't shrink below their proportional share, so a lopsided split
   (e.g. 1 vs 9) never collapses the minority side to invisibility.
*/
.qs-heat-weightbar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
}
.qs-heat-weightbar-track {
    display: flex;
    align-items: stretch;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    gap: 1px;
}
.qs-heat-weightbar-track .wb-seg-red {
    background-color: var(--heat-deep-red-bg);
    min-width: 2px;
}
.qs-heat-weightbar-track .wb-seg-green {
    background-color: var(--heat-deep-green-bg);
    min-width: 2px;
}
.qs-heat-weightbar-counts {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: var(--weight-semibold);
    font-variant-numeric: tabular-nums;
}
.qs-heat-weightbar-counts .wb-count-red {
    color: var(--bearish-text);
}
.qs-heat-weightbar-counts .wb-count-green {
    color: var(--bullish-text);
}

/* Sortable column headers — indicate the active column with accent color on
   both the label and arrow. Click handling lives on an inner <button> so
   Enter/Space work natively for keyboard users and screen readers announce
   the column as a button; aria-sort on the <th> announces sort direction. */
.qs-heatmap thead th.qs-heat-sortable {
    user-select: none;
}
.qs-heatmap thead th.qs-heat-sorted {
    color: var(--accent-primary);
}
.qs-heat-sort-btn {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    cursor: pointer;
    text-align: inherit;
    white-space: nowrap;
}
.qs-heat-sort-btn:hover {
    color: var(--accent-primary);
}
.qs-heat-sort-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 2px;
}
.qs-heat-sort-arrow {
    font-size: 0.75em;
    color: var(--accent-primary);
}

/* ── Percentage Inline (colored +/- text) ───────────────── */
.qs-pct {
    font-weight: var(--weight-medium);
    font-variant-numeric: tabular-nums;
}

.qs-pct.up   { color: var(--bullish-text); }
.qs-pct.down { color: var(--bearish-text); }
.qs-pct.flat { color: var(--neutral); }

/* ── Last Updated Timestamp ─────────────────────────────── */
.qs-last-updated {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: var(--weight-medium);
}

.qs-last-updated .live-dot {
    width: 5px;
    height: 5px;
}

/* ── Data Staleness Indicators ─────────────────────────────── */
.data-fresh {
    color: var(--bullish-text);
}

.data-fresh .staleness-dot {
    background-color: var(--bullish);
}

.data-aging {
    color: var(--warning);
}

.data-aging .staleness-dot {
    background-color: var(--warning);
}

.data-stale {
    color: var(--bearish-text);
}

.data-stale .staleness-dot {
    background-color: var(--bearish);
}

.staleness-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.375rem;
}

/* ── Table Skeleton Loading ────────────────────────────────── */
.qs-table-skeleton {
    width: 100%;
}

.qs-table-skeleton .skeleton-row {
    display: flex;
    gap: 1rem;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--table-border);
}

.qs-table-skeleton .skeleton-row.header {
    background-color: var(--table-header-bg);
}

.qs-table-skeleton .skeleton-cell {
    height: 0.75rem;
    border-radius: var(--radius-xs);
    background-color: var(--border-subtle);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.qs-table-skeleton .skeleton-cell.w-20 { width: 20%; }
.qs-table-skeleton .skeleton-cell.w-15 { width: 15%; }
.qs-table-skeleton .skeleton-cell.w-10 { width: 10%; }
.qs-table-skeleton .skeleton-cell.w-25 { width: 25%; }

/* ============================================================
   PHASE 10: Public Pages — Landing, Pricing, Auth
   Professional marketing pages with theme support
   ============================================================ */

/* ── Public Page Wrapper ──────────────────────────────────── */
.qs-public {
    min-height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* ── Public Header (transparent → solid on scroll) ────────── */
.qs-public-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: color-mix(in srgb, var(--bg-primary) 80%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    transition: background-color var(--transition-normal);
}

.qs-public-header nav {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1rem;
}

.qs-public-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

/* Logo */
.qs-public-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.qs-public-logo .logo-icon {
    width: 40px;
    height: 40px;
    background-color: var(--accent-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.qs-public-logo .logo-icon svg {
    width: 20px;
    height: 20px;
    color: #FFFFFF;
}

.qs-public-logo .logo-text {
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
}

.qs-public-logo .logo-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* Nav links */
.qs-public-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qs-public-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: color var(--transition-fast);
}

.qs-public-nav .nav-link:hover {
    color: var(--text-heading);
}

.qs-public-nav .nav-divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-primary);
    margin: 0 0.25rem;
}

.qs-public-nav .nav-btn-outline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.qs-public-nav .nav-btn-outline:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-strong);
}

.qs-public-nav .nav-btn-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: #FFFFFF;
    background-color: var(--accent-primary);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.qs-public-nav .nav-btn-primary:hover {
    background-color: var(--accent-primary-hover);
}

/* ── Hero Section ─────────────────────────────────────────── */
.qs-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 5rem 1rem 3rem;
}

.qs-hero-content {
    position: relative;
    z-index: 10;
    max-width: 80rem;
    margin: 0 auto;
    text-align: center;
}

.qs-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    background-color: var(--accent-primary-muted);
    border: 1px solid rgba(41, 98, 255, 0.25);
    margin-bottom: 2rem;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--accent-primary);
}

[data-theme="dark"] .qs-hero-badge {
    color: #5B8DEF;
}

.qs-hero h1 {
    font-size: clamp(2.25rem, 5vw, 4.5rem);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: 1.5rem;
    line-height: 1.1;
    letter-spacing: var(--tracking-tight);
}

.qs-hero h1 .accent-text {
    color: var(--accent-primary);
}

.qs-hero-sub {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 48rem;
    margin: 0 auto 2.5rem;
    line-height: var(--leading-relaxed);
}

/* Hero CTA buttons */
.qs-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 4rem;
}

.qs-btn-hero {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.qs-btn-hero.primary {
    color: #FFFFFF;
    background-color: var(--accent-primary);
    box-shadow: 0 4px 14px rgba(41, 98, 255, 0.3);
}

.qs-btn-hero.primary:hover {
    background-color: var(--accent-primary-hover);
    box-shadow: 0 6px 20px rgba(41, 98, 255, 0.4);
}

.qs-btn-hero.secondary {
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.qs-btn-hero.secondary:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-strong);
}

/* Hero stats */
.qs-hero-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    max-width: 56rem;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .qs-hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

.qs-hero-stat {
    text-align: center;
}

.qs-hero-stat .stat-num {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: 0.25rem;
}

.qs-hero-stat .stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* ── Feature Cards Section ────────────────────────────────── */
.qs-features {
    padding: 6rem 1rem;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.qs-features-inner {
    max-width: 80rem;
    margin: 0 auto;
}

.qs-features .section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.qs-features .section-header h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.qs-features .section-header p {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 40rem;
    margin: 0 auto;
}

.qs-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.qs-feature-card {
    padding: 2rem;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.qs-feature-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--card-hover-shadow);
}

.qs-feature-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.qs-feature-icon svg {
    width: 1.75rem;
    height: 1.75rem;
    color: #FFFFFF;
}

.qs-feature-card h3 {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
    margin-bottom: 0.75rem;
}

.qs-feature-card p {
    color: var(--text-secondary);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
}

/* ── CTA Section ──────────────────────────────────────────── */
.qs-cta {
    padding: 6rem 1rem;
}

.qs-cta-card {
    max-width: 56rem;
    margin: 0 auto;
    padding: 3rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    text-align: center;
}

.qs-cta-card h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.qs-cta-card p {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 40rem;
    margin-left: auto;
    margin-right: auto;
}

.qs-cta-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.qs-cta-actions .secondary-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.qs-cta-actions .secondary-link:hover {
    color: var(--text-heading);
}

.qs-cta-actions .secondary-link span {
    text-decoration: underline;
}

/* ── Public Footer ────────────────────────────────────────── */
.qs-public-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
}

.qs-public-footer .footer-inner {
    max-width: 80rem;
    margin: 0 auto;
    padding: 3rem 1rem;
}

.qs-public-footer .footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .qs-public-footer .footer-grid {
        grid-template-columns: 1fr;
    }
}

.qs-public-footer .footer-brand p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    max-width: 28rem;
    margin-top: 1rem;
}

.qs-public-footer h4 {
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.qs-public-footer .footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.qs-public-footer .footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: color var(--transition-fast);
}

.qs-public-footer .footer-links a:hover {
    color: var(--text-heading);
}

.qs-public-footer .footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.qs-public-footer .footer-bottom p {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.qs-public-footer .footer-bottom .footer-note {
    color: var(--text-muted);
    font-size: var(--text-xs);
}

/* ── Auth Card (Login, PendingApproval, AccessDenied) ─────── */
.qs-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    padding: 1rem;
}

.qs-auth-card {
    max-width: 28rem;
    width: 100%;
}

.qs-auth-card .card-main {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.qs-auth-card .card-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.qs-auth-card .card-logo .logo-icon {
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1rem;
    background-color: var(--accent-primary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qs-auth-card .card-logo .logo-icon svg {
    width: 2.5rem;
    height: 2.5rem;
    color: #FFFFFF;
}

.qs-auth-card .card-logo h1 {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.qs-auth-card .card-logo p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.qs-auth-card .card-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

.qs-auth-card .card-footer p {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.qs-auth-card .card-below {
    margin-top: 1.5rem;
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Auth info box */
.qs-auth-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--info-bg);
    border: 1px solid rgba(41, 98, 255, 0.2);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.qs-auth-info svg {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--info);
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.qs-auth-info .info-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-heading);
    margin-bottom: 0.25rem;
}

.qs-auth-info .info-text {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* Auth icon circle (for pending/denied pages) */
.qs-auth-icon {
    width: 6rem;
    height: 6rem;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qs-auth-icon.warning {
    background-color: var(--warning-bg);
    border: 3px solid rgba(255, 152, 0, 0.2);
}

.qs-auth-icon.warning svg {
    width: 3rem;
    height: 3rem;
    color: var(--warning);
}

.qs-auth-icon.danger {
    background-color: var(--danger-bg);
    border: 3px solid rgba(244, 67, 54, 0.2);
}

.qs-auth-icon.danger svg {
    width: 3rem;
    height: 3rem;
    color: var(--danger);
}

/* Auth user info card */
.qs-auth-user {
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}

.qs-auth-user .user-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
}

.qs-auth-user .user-row img {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 2px solid var(--border-primary);
}

.qs-auth-user .user-name {
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
}

.qs-auth-user .user-email {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.qs-auth-user .user-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* Auth reason cards (for AccessDenied) */
.qs-auth-reason {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.qs-auth-reason svg {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--warning);
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.qs-auth-reason p {
    color: var(--text-primary);
    font-size: var(--text-sm);
}

/* Google button (stays white in both themes) */
.qs-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background-color: #FFFFFF;
    color: #374151;
    font-weight: var(--weight-semibold);
    font-size: var(--text-base);
    border: 1px solid #E5E7EB;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.qs-google-btn:hover {
    background-color: #F9FAFB;
    box-shadow: var(--shadow-md);
}

/* ── Pricing Cards ────────────────────────────────────────── */
.qs-pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 72rem;
    margin: 0 auto;
}

.qs-pricing-card {
    position: relative;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem;
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-normal);
}

.qs-pricing-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.qs-pricing-card.featured {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px var(--accent-primary), var(--shadow-lg);
}

.qs-pricing-card.best-value {
    border-color: var(--warning);
}

.qs-pricing-badge {
    position: absolute;
    top: -0.875rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.25rem 1rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    color: #FFFFFF;
    white-space: nowrap;
}

.qs-pricing-badge.popular {
    background-color: var(--accent-primary);
}

.qs-pricing-badge.value {
    background-color: var(--warning);
}

.qs-pricing-name {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.qs-pricing-period {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.qs-pricing-original {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-decoration: line-through;
}

.qs-pricing-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.25rem;
}

.qs-pricing-amount .currency {
    font-size: var(--text-xl);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
}

.qs-pricing-amount .price {
    font-size: var(--text-4xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
}

.qs-pricing-card.featured .qs-pricing-amount .price {
    color: var(--accent-primary);
}

.qs-pricing-card.best-value .qs-pricing-amount .price {
    color: var(--warning);
}

.qs-pricing-save {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.125rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
}

.qs-pricing-save.green {
    background-color: var(--bullish-bg);
    color: var(--bullish-text);
}

.qs-pricing-save.accent {
    background-color: var(--accent-primary-muted);
    color: var(--accent-primary);
}

.qs-pricing-save.warning {
    background-color: var(--warning-bg);
    color: var(--warning);
}

.qs-pricing-monthly {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.qs-pricing-features {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
}

.qs-pricing-features .features-label {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.qs-pricing-card.featured .qs-pricing-features .features-label {
    color: var(--accent-primary);
}

.qs-pricing-card.best-value .qs-pricing-features .features-label {
    color: var(--warning);
}

.qs-pricing-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.qs-pricing-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.qs-pricing-features li svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--bullish);
}

.qs-pricing-card.best-value .qs-pricing-features li svg {
    color: var(--warning);
}

/* Trust indicators */
.qs-trust-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 3rem;
    color: var(--text-muted);
}

.qs-trust-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm);
}

/* FAQ Section */
.qs-faq {
    max-width: 48rem;
    margin: 5rem auto 0;
}

.qs-faq h2 {
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    text-align: center;
    margin-bottom: 2rem;
}

.qs-faq-item {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.qs-faq-item h3 {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.qs-faq-item p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* ── Collapsible variant — used on landing FAQ (native details/summary) ── */
details.qs-faq-collapsible {
    padding: 0;
    cursor: pointer;
}
details.qs-faq-collapsible > summary {
    list-style: none;
    padding: 1.25rem 1.5rem;
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
    position: relative;
    user-select: none;
}
details.qs-faq-collapsible > summary::-webkit-details-marker { display: none; }
details.qs-faq-collapsible > summary::after {
    content: '+';
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}
details.qs-faq-collapsible[open] > summary::after {
    content: '\2212'; /* − minus sign */
}
details.qs-faq-collapsible > p {
    padding: 0 1.5rem 1.25rem;
    margin: 0;
}

/* =====================================================================
   LANDING — WhatsApp CTA, Coverage strip, Product showcase, Community
   ===================================================================== */

/* ── WhatsApp brand button (variant of qs-btn-hero) ────────── */
/* Uses WhatsApp's dark teal #075E54 for WCAG AA contrast (7.18:1
   with white text). The brand-bright #25D366 fails (2.9:1) and the
   mid-tone #128C7E only reaches 4.13 — still below the 4.5 threshold
   that Lighthouse applies to 18px regular text. */
.qs-btn-hero.whatsapp {
    background: #075E54;
    color: #FFFFFF;
    border: none;
}
.qs-btn-hero.whatsapp:hover {
    background: #054640;
    color: #FFFFFF;
}

/* ── Coverage strip (between hero and showcase) ────────────── */
.qs-coverage-strip {
    padding: 1.125rem 1.25rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.6;
}
.qs-coverage-strip strong {
    color: var(--text-heading);
    font-weight: var(--weight-semibold);
}
.qs-coverage-strip .sep {
    margin: 0 0.625rem;
    color: var(--text-muted);
    opacity: 0.6;
}
@media (max-width: 768px) {
    .qs-coverage-strip {
        text-align: left;
        font-size: var(--text-xs);
    }
    .qs-coverage-strip .sep { display: none; }
    .qs-coverage-strip > strong { display: inline-block; margin-top: 0.375rem; }
}

/* ── Product showcase (replaces the old qs-features grid on landing) ── */
.qs-product-section {
    padding: 4rem 1.25rem 3rem;
    max-width: 1280px;
    margin: 0 auto;
}
.qs-product-section .section-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.qs-product-section .section-header h2 {
    font-size: var(--text-3xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin: 0 0 0.5rem;
}
.qs-product-section .section-header p {
    color: var(--text-secondary);
    font-size: var(--text-base);
    margin: 0;
}

.qs-product-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}
@media (max-width: 1023px) {
    .qs-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .qs-product-grid { grid-template-columns: 1fr; gap: 1rem; }
}

.qs-product-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.qs-product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--accent-primary-muted, var(--accent-primary));
}
/* Image area: show FULL screenshot via contain (no edge cropping). Background
   matches card surface so any letterboxing reads as intentional framing.
   16:9 aspect keeps cards uniform height across the grid. */
.qs-product-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    object-position: top center;
    display: block;
    background: var(--bg-surface-hover);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.5rem 0.5rem 0;
    box-sizing: border-box;
}
.qs-product-card-body {
    padding: 0.875rem 1rem 1.125rem;
}
.qs-product-card-name {
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
    font-size: var(--text-base);
    margin: 0 0 0.25rem;
    line-height: 1.3;
}
.qs-product-card-tagline {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    margin: 0;
    line-height: 1.45;
}

/* ── Community / Contact section ──────────────────────────── */
.qs-community-section {
    padding: 3rem 1.25rem 4rem;
    max-width: 1100px;
    margin: 0 auto;
}
.qs-community-section h2 {
    text-align: center;
    font-size: var(--text-2xl);
    font-weight: var(--weight-bold);
    color: var(--text-heading);
    margin: 0 0 0.5rem;
}
.qs-community-section .section-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--text-base);
    margin: 0 0 2rem;
}
.qs-community-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
@media (max-width: 640px) {
    .qs-community-grid { grid-template-columns: 1fr; }
}
.qs-community-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.75rem 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.qs-community-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-hover-shadow);
    border-color: var(--accent-primary-muted, var(--accent-primary));
    text-decoration: none;
    color: inherit;
}
.qs-community-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    margin-bottom: 0.25rem;
}
.qs-community-icon.whatsapp { background: #25D366; }
.qs-community-icon.telegram { background: #229ED9; }
.qs-community-icon.phone    { background: var(--accent-primary); }
.qs-community-card-label {
    font-weight: var(--weight-semibold);
    color: var(--text-heading);
    font-size: var(--text-base);
}
.qs-community-card-value {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.qs-community-card-cta {
    font-size: var(--text-sm);
    color: var(--accent-primary);
    font-weight: var(--weight-medium);
    margin-top: 0.25rem;
}

/* ============================================================
   Strategy Copilot — product tokens ("precision instrument panel")
   Copilot always renders <html data-theme="light|dark"> (App.razor; light unless the viewer picked dark), so these
   html[data-theme] blocks outrank the TradeScan defaults above. Warm-grey neutrals, one deep ink-blue primary, green/red only
   for P&L and Buy/Sell, amber for warnings. Every text colour here is ≥ 4.5:1 on --bg-surface and --bg-primary.
   Fonts are self-hosted (CSP font-src 'self'); OFL licences sit next to the files in /fonts.
   ============================================================ */
@font-face {
    font-family: 'Instrument Sans';
    src: url('../fonts/instrument-sans-var.woff2') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'JetBrains Mono';
    src: url('../fonts/jetbrains-mono-var.woff2') format('woff2');
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

html[data-theme] {
    --font-sans: 'Instrument Sans', 'Segoe UI Variable Text', 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, ui-monospace, monospace;
    --font-num: var(--font-mono);
    --radius-card: 10px;
    --radius-ctl: 6px;
    --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
    --dur-fast: 150ms;
    --dur: 200ms;
    --ctl-h: 2rem;            /* desktop control height (32 px; ≥ 24 px target) */
    --ctl-h-touch: 2.75rem;   /* phone control height (44 px) */
    --shell-side-w: 15rem;
    --shell-side-w-collapsed: 4rem;
    --shell-top-h: 3.5rem;
    --shell-tab-h: 3.75rem;
    --text-2xs: 0.6875rem;    /* 11 px — axis ticks only */
}

html[data-theme="light"] {
    color-scheme: light;
    --bg-primary: #F4F3F0;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F3F2EF;
    --bg-elevated: #FFFFFF;
    --bg-inset: #F7F6F3;
    --bg-sunken: #EEEDE9;
    --text-primary: #23221F;
    --text-heading: #141412;
    --text-secondary: #57544E;
    --text-muted: #6B6862;
    --text-on-accent: #FFFFFF;
    --border-primary: #E2E0DA;
    --border-subtle: #ECEAE5;
    --border-strong: #CBC8C0;
    --accent-primary: #2440A8;
    --accent-primary-hover: #1C3490;
    --accent-primary-muted: rgba(36, 64, 168, 0.08);
    --accent-primary-soft: #EEF1FB;
    --accent-text: #2440A8;
    --focus-ring: rgba(36, 64, 168, 0.45);
    --bullish: #0B7A4B;
    --bullish-text: #0B7A4B;
    --bullish-bg: #E8F4EE;
    --bullish-strong: #086640;
    --bullish-rgb: 11, 122, 75;
    --bearish: #BF3328;
    --bearish-text: #B3301F;
    --bearish-bg: #FBECEA;
    --bearish-strong: #9E2A20;
    --bearish-rgb: 191, 51, 40;
    --warning: #9A5B00;
    --warning-bg: #FCF3E3;
    --warning-border: #EBCB8B;
    --info: #2440A8;
    --info-bg: #EEF1FB;
    --danger: #B3301F;
    --danger-bg: #FBECEA;
    --success: #0B7A4B;
    --success-bg: #E8F4EE;
    --neutral-bg: #EFEEEA;
    --input-bg: #FFFFFF;
    --input-border: #D9D6CF;
    --input-text: #23221F;
    --input-placeholder: #8A867F;
    --input-focus-border: #2440A8;
    --input-focus-ring: rgba(36, 64, 168, 0.18);
    --table-header-bg: #F7F6F3;
    --table-header-text: #57544E;
    --table-row-hover: #F7F6F3;
    --card-bg: #FFFFFF;
    --card-border: #E2E0DA;
    --shadow-sm: 0 1px 2px rgba(20, 20, 18, 0.05);
    --shadow-panel: 0 1px 2px rgba(20, 20, 18, 0.04), 0 8px 24px -12px rgba(20, 20, 18, 0.14);
    --shadow-xl: 0 18px 48px -12px rgba(20, 20, 18, 0.28);
    --chart-grid: #ECEAE5;
    --chart-axis: #CBC8C0;
    --chart-up-fill: rgba(11, 122, 75, 0.13);
    --chart-dn-fill: rgba(191, 51, 40, 0.11);
    --chart-t0: #2440A8;
    --skeleton: #ECEAE5;
    --skeleton-hi: #F6F5F2;
    --scrim: rgba(20, 20, 18, 0.42);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #121213;
    --bg-surface: #1B1B1D;
    --bg-surface-hover: #242427;
    --bg-elevated: #202023;
    --bg-inset: #171719;
    --bg-sunken: #0E0E0F;
    --text-primary: #E8E6E1;
    --text-heading: #F5F4F0;
    --text-secondary: #B3AFA8;
    --text-muted: #9A968F;
    --text-on-accent: #FFFFFF;
    --border-primary: #2E2E32;
    --border-subtle: #262629;
    --border-strong: #3D3D42;
    --accent-primary: #3B5BDB;
    --accent-primary-hover: #4C6AE6;
    --accent-primary-muted: rgba(124, 152, 255, 0.12);
    --accent-primary-soft: #1F2540;
    --accent-text: #9DB0FF;
    --focus-ring: rgba(157, 176, 255, 0.6);
    --bullish: #3DBE85;
    --bullish-text: #4CCB92;
    --bullish-bg: rgba(61, 190, 133, 0.12);
    --bullish-strong: #5AD69E;
    --bullish-rgb: 61, 190, 133;
    --bearish: #F0675B;
    --bearish-text: #FF8076;
    --bearish-bg: rgba(240, 103, 91, 0.12);
    --bearish-strong: #FF948B;
    --bearish-rgb: 240, 103, 91;
    --warning: #E8B04E;
    --warning-bg: rgba(232, 176, 78, 0.12);
    --warning-border: rgba(232, 176, 78, 0.4);
    --info: #9DB0FF;
    --info-bg: rgba(124, 152, 255, 0.12);
    --danger: #FF8076;
    --text-on-danger: #2A0D09;   /* the dark theme's danger is light: dark text on it (AA 7:1), white would be 2.4:1 */
    --danger-bg: rgba(240, 103, 91, 0.12);
    --success: #4CCB92;
    --success-bg: rgba(61, 190, 133, 0.12);
    --neutral-bg: #26262A;
    --input-bg: #161618;
    --input-border: #36363B;
    --input-text: #E8E6E1;
    --input-placeholder: #8C8882;
    --input-focus-border: #7C98FF;
    --input-focus-ring: rgba(124, 152, 255, 0.25);
    --table-header-bg: #1F1F22;
    --table-header-text: #B3AFA8;
    --table-row-hover: #222225;
    --card-bg: #1B1B1D;
    --card-border: #2E2E32;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
    --shadow-xl: 0 18px 48px -12px rgba(0, 0, 0, 0.8);
    --chart-grid: #29292D;
    --chart-axis: #3D3D42;
    --chart-up-fill: rgba(61, 190, 133, 0.16);
    --chart-dn-fill: rgba(240, 103, 91, 0.14);
    --chart-t0: #9DB0FF;
    --skeleton: #252528;
    --skeleton-hi: #2E2E32;
    --scrim: rgba(0, 0, 0, 0.6);
}
