/* ═══════════════════════════════════════════════════
   Stage 2 Scanner — Premium Dark Dashboard Theme
   ═══════════════════════════════════════════════════ */

:root {
    /* Core Palette */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.85);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);

    /* Accent Colors */
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-pink: #ec4899;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-green: linear-gradient(135deg, #10b981, #06b6d4);
    --gradient-amber: linear-gradient(135deg, #f59e0b, #ec4899);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(59, 130, 246, 0.3);

    /* Shadows */
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);
    --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.15);

    /* Spacing */
    --radius: 14px;
    --radius-sm: 8px;
    --gap: 1.5rem;

    /* Font */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Reset ─── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ─── Background Pattern ─── */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(59,130,246,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(139,92,246,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6,182,212,0.03) 0%, transparent 80%);
    pointer-events: none;
    z-index: 0;
}

/* ─── Top Bar ─── */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background: rgba(10, 14, 23, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.version-badge {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.idle { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.complete { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.loading { background: var(--accent-amber); box-shadow: 0 0 6px var(--accent-amber); animation: pulse 1s infinite; }
.status-dot.error { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.last-update {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Button ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled,
button:disabled {
    cursor: not-allowed !important;
    pointer-events: none;
    opacity: 0.45;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 0.9rem;
}

/* ─── Dashboard Layout ─── */
.dashboard {
    position: relative;
    z-index: 1;
    max-width: 1440px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

/* ─── Summary Cards ─── */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--gap);
    margin-bottom: 1.5rem;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
}

.card-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.card-content {
    display: flex;
    flex-direction: column;
}

.card-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.card-value {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.card-sub {
    font-size: 0.75rem;
    color: var(--accent-green);
    font-weight: 600;
}

.summary-card.highlight .card-value {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-card.highlight-green .card-value {
    background: var(--gradient-green);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.chart-card, .table-card {
    padding: 1.5rem;
}

.chart-card h2, .table-card h2, .card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.card-header h2 {
    margin-bottom: 0;
}

/* ─── Charts ─── */
.chart-container {
    position: relative;
    height: 320px;
}

.chart-container.chart-tall {
    height: 420px;
}

/* ─── Tabs ─── */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: rgba(17, 24, 39, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    overflow-x: auto;
}

.tab {
    padding: 0.6rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab.active {
    color: white;
    background: var(--gradient-primary);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Grid Layouts ─── */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
}

/* ─── Data Tables ─── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: rgba(30, 41, 59, 0.95);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.06);
}

.data-table tbody td {
    padding: 0.65rem 1rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.data-table tbody td.wrap {
    white-space: normal;
    max-width: 400px;
    line-height: 1.5;
}

.market-intel-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.market-intel-subtitle {
    display: block;
    color: var(--text-muted);
    font-size: 0.76rem;
    margin-top: 0.25rem;
}

.market-intel-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.market-intel-actions .search-input {
    min-width: 220px;
}

.market-intel-actions .market-intel-issue-select {
    min-width: 340px;
}

.market-intel-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
}

.market-intel-current {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    gap: 1.1rem;
    align-items: start;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 0;
}

.market-intel-current-main {
    min-width: 0;
}

.market-intel-current-side {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: flex-start;
}

.market-intel-kicker {
    color: var(--accent-cyan);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.market-intel-current h3 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 700;
    margin: 0.2rem 0;
    line-height: 1.35;
}

.market-intel-issue-meta,
.market-intel-chip-row {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.market-intel-selected-briefing {
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.6;
    margin-top: 0.75rem;
    max-height: 10.5rem;
    overflow: auto;
}

.market-intel-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.55rem;
}

.market-intel-chip {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: var(--text-secondary);
    padding: 0.1rem 0.45rem;
    background: rgba(255, 255, 255, 0.025);
}

.market-intel-table-wrap {
    max-height: 620px;
    overflow: auto;
}

.market-intel-table td.wrap-title {
    min-width: 320px;
    max-width: 560px;
    white-space: normal;
}

.market-intel-table td.market-intel-summary-cell,
.market-intel-table td.market-intel-fit-cell {
    min-width: 260px;
    max-width: 440px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.market-intel-table td.market-intel-fit-cell {
    color: var(--text-muted);
}

.market-intel-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.market-intel-status.eligible {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.22);
}

.market-intel-status.excluded {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.22);
}

.market-intel-status.review {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.22);
}

@media (max-width: 760px) {
    .market-intel-actions,
    .market-intel-actions .search-input,
    .market-intel-actions .btn {
        width: 100%;
    }

    .market-intel-actions .market-intel-issue-select {
        min-width: 0;
    }

    .market-intel-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .market-intel-current {
        grid-template-columns: 1fr;
    }

    .market-intel-table td.wrap-title {
        min-width: 240px;
    }
}

/* Cell styling */
.cell-ticker {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-cyan) !important;
    letter-spacing: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(6, 182, 212, 0.05);
}

.cell-ticker::after {
    content: none;
}

.cell-ticker:hover {
    background: rgba(6, 182, 212, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.2);
}

.cell-positive {
    color: var(--accent-green) !important;
    font-weight: 600;
}

.cell-negative {
    color: var(--accent-red) !important;
    font-weight: 600;
}

.cell-score {
    font-weight: 700;
    font-family: var(--font-mono);
}

.score-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.score-bar-bg {
    display: inline-block;
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.score-bar-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ─── Search Input ─── */
.search-input {
    padding: 0.5rem 1rem;
    background: #1e293b; /* More solid dark background */
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: #ffffff; /* Explicitly white text */
    font-family: var(--font-main);
    font-size: 0.8rem;
    outline: none;
    transition: all 0.2s ease;
    min-width: 200px;
}

.search-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select.search-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    cursor: pointer;
}

select.search-input option {
    background: #1e293b;
    color: #ffffff;
    padding: 10px 12px;
}

select.search-input option:hover,
select.search-input option:checked {
    background: #1e3a5f;
    color: #ffffff;
}

/* date inputs in dark theme */
input[type="date"].search-input {
    color-scheme: dark;
}

/* ─── News Grid ─── */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1rem;
    max-height: 700px;
    overflow-y: auto;
    padding: 1rem;
}

.news-item {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.news-item:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.news-item-impact-low {
    border-left: 3px solid rgba(59, 130, 246, 0.35);
}

.news-item-impact-medium {
    border-left: 3px solid rgba(245, 158, 11, 0.75);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.12);
}

.news-item-impact-high {
    border-left: 3px solid rgba(239, 68, 68, 0.85);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.16);
}

.news-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.news-ticker {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-cyan);
    font-size: 0.8rem;
}

.news-sentiment {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.sentiment-positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.sentiment-negative {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.sentiment-neutral {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

.news-title {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-primary);
}

.news-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.news-title a:hover {
    color: var(--accent-blue);
}

.news-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.news-meta-strong {
    color: #cbd5e1;
    font-size: 0.74rem;
}

.news-summary-zh {
    font-size: 0.78rem;
    line-height: 1.55;
    color: #d7dfeb;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
    padding-top: 0.55rem;
}

.news-actions {
    margin-top: auto;
    padding-top: 0.25rem;
}

.news-read-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.78rem;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.28);
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    font-size: 0.74rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.news-read-link:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.16);
    color: #cfe0ff;
}

.news-filters {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.news-filters .search-input {
    min-width: 180px;
    height: 34px;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    font-size: 0.75rem;
}

.news-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 34px;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
}

.news-toggle input[type="checkbox"] {
    accent-color: var(--accent-blue);
}

.news-debug-panel {
    margin: 0 1rem 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(245, 158, 11, 0.18);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), rgba(15, 23, 42, 0.38));
}

.news-debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.news-debug-header h3 {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.news-debug-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.news-debug-list {
    display: grid;
    gap: 0.75rem;
}

.news-debug-item {
    padding: 0.9rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-sm);
    background: rgba(2, 6, 23, 0.3);
}

.news-debug-title {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
}

.news-debug-meta {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.news-debug-reason {
    margin-top: 0.55rem;
    font-size: 0.76rem;
    line-height: 1.5;
    color: #fcd34d;
}

.news-debug-scores {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.filter-btn {
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 999px;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    grid-column: 1 / -1;
}

/* ─── Loading Overlay ─── */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.loading-sub {
    color: var(--text-muted) !important;
    font-weight: 400 !important;
    font-size: 0.85rem !important;
    margin-top: 0.25rem;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ─── iOS Safe Area ─── */
body {
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.6rem 0.75rem;
        padding-top: calc(0.6rem + env(safe-area-inset-top));
    }
    .top-bar-left {
        width: 100%;
        justify-content: space-between;
    }
    .top-bar-right {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    .top-bar-right .status-indicator {
        grid-column: 1 / -1;
        justify-content: center;
    }
    .top-bar-right .last-update {
        grid-column: 1 / -1;
        text-align: center;
    }
    .top-bar-right #autoRefreshSelect {
        width: 100%;
        min-width: 0;
    }
    .top-bar-right .btn {
        width: 100%;
        justify-content: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.78rem;
    }
    .dashboard {
        padding: 0.75rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
    .summary-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }
    .summary-card {
        padding: 0.75rem 0.85rem;
        gap: 0.6rem;
    }
    .card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
        border-radius: 10px;
    }
    .card-value {
        font-size: 1.1rem;
    }
    .card-label {
        font-size: 0.68rem;
    }

    /* Tabs - wrap into grid on mobile */
    .tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.2rem;
        padding: 0.25rem;
        margin-bottom: 1rem;
        overflow-x: visible;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab {
        padding: 0.5rem 0.3rem;
        font-size: 0.72rem;
        min-height: 44px; /* iOS minimum tap target */
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
    }
    /* Last row: 3 tabs centered */
    .tab:nth-child(5) { grid-column: 1 / 2; }
    .tab:nth-child(6) { grid-column: 2 / 3; }
    .tab:nth-child(7) { grid-column: 3 / 5; }

    /* Cards */
    .chart-card, .table-card {
        padding: 1rem;
    }
    .card h2, .chart-card h2, .table-card h2 {
        font-size: 0.9rem;
    }
    .chart-container {
        height: 240px;
    }
    .chart-container.chart-tall {
        height: 300px;
    }

    /* Tables */
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
    .data-table {
        font-size: 0.75rem;
    }
    .data-table thead th {
        padding: 0.6rem 0.65rem;
        font-size: 0.65rem;
    }
    .data-table tbody td {
        padding: 0.55rem 0.65rem;
    }

    /* News */
    .news-grid {
        grid-template-columns: 1fr;
        max-height: none;
        padding: 0.5rem;
    }
    .news-filters {
        gap: 0.3rem;
    }
    .news-filters .search-input {
        min-width: 0;
        flex: 1 1 140px;
    }
    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    /* Search inputs */
    .search-input {
        min-width: 0;
        width: 100%;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.55rem 0.8rem;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .summary-card {
        flex-direction: column;
        text-align: center;
        padding: 0.65rem;
        gap: 0.35rem;
    }
    .card-icon {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    .card-value {
        font-size: 1rem;
    }

    /* Breakout info cards - stack on mobile */
    .card [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .logo h1 {
        font-size: 1rem;
    }
    .logo-icon {
        font-size: 1.2rem;
    }

    /* Toast repositioned for iOS */
    .toast {
        bottom: calc(1rem + env(safe-area-inset-bottom));
        right: 0.75rem;
        left: 0.75rem;
        text-align: center;
    }
}

/* Logout Button */
.btn-logout {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
}
.btn-logout:hover {
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}

/* ═══════════════════════════════════════════════════
   Paper Trading Styles
   ═══════════════════════════════════════════════════ */

/* Trader Controls Bar */
.trader-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.trader-controls-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.trader-controls-left h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.trader-controls-right {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.trader-execution-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
}

.trader-execution-menu span {
    white-space: nowrap;
}

.trader-execution-menu select {
    min-width: 150px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1px solid rgba(6, 182, 212, 0.24);
    background: rgba(8, 13, 23, 0.92);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 700;
}

.backtest-command-box[hidden] {
    display: none !important;
}

#tab-intraday[hidden] {
    display: none !important;
}

/* Trader Summary Grid */
.trader-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--gap);
    margin-top: 1rem;
}

.trader-card .card-value.cell-positive { color: var(--accent-green); }
.trader-card .card-value.cell-negative { color: var(--accent-red); }
.trader-card .card-sub.cell-positive { color: var(--accent-green); }
.trader-card .card-sub.cell-negative { color: var(--accent-red); }

.alpaca-portfolio-card {
    padding: 1.25rem 1.35rem 1.1rem;
    min-height: 360px;
}

.alpaca-portfolio-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.alpaca-portfolio-title-block h2 {
    margin: 0 0 1.35rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.alpaca-portfolio-value-row {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    margin-bottom: 0.55rem;
}

#alpacaPortfolioValue {
    color: var(--text-primary);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0;
}

.alpaca-portfolio-pnl {
    font-size: 1rem;
    font-weight: 700;
}

.alpaca-portfolio-pnl.cell-positive {
    color: var(--accent-green);
}

.alpaca-portfolio-pnl.cell-negative {
    color: var(--accent-red);
}

.alpaca-portfolio-asof {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
}

.alpaca-portfolio-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.alpaca-range-btn {
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.45rem 0.7rem;
    min-width: 42px;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.alpaca-range-btn:hover,
.alpaca-range-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.alpaca-range-btn.refresh {
    min-width: auto;
    color: var(--accent-cyan);
    border-color: rgba(66, 214, 200, 0.16);
}

.alpaca-portfolio-chart-wrap {
    position: relative;
    height: 230px;
    margin-top: 1.25rem;
}

#alpacaPortfolioChart {
      width: 100%;
      height: 100%;
      min-width: 0;
  }

.alpaca-portfolio-chart-status {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.86rem;
    pointer-events: none;
}

.alpaca-portfolio-chart-status.visible {
    display: flex;
}

@media (max-width: 768px) {
    #tab-trader .alpaca-portfolio-card {
        padding: 1rem;
        min-height: 320px;
    }

    #tab-trader .alpaca-portfolio-header {
        flex-direction: column;
        gap: 0.85rem;
    }

    #tab-trader .alpaca-portfolio-actions {
        width: 100%;
        justify-content: flex-start;
    }

    #tab-trader .alpaca-range-btn {
        padding: 0.4rem 0.55rem;
        min-width: 38px;
        font-size: 0.78rem;
    }

    #tab-trader .alpaca-portfolio-chart-wrap {
        height: 190px;
        margin-top: 1rem;
    }
}

.asset-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
    align-items: stretch;
}

.asset-summary-card {
    padding: 1rem 1.2rem;
    width: 100%;
}

.asset-summary-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 0.85rem;
}

.asset-summary-card-bear .asset-summary-title {
    color: var(--accent-red);
}

.asset-summary-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.asset-summary-metrics div {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px;
}

.asset-summary-metrics span {
    display: block;
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.asset-summary-metrics strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.trader-positions-grid {
    grid-template-columns: 1fr;
}

.trader-positions-grid .trader-positions-card,
.trader-positions-grid #traderSettingsPanel {
    grid-column: 1 / -1;
    width: 100%;
}

.live-strategy-card {
    padding: 1.2rem 1.4rem;
}

.live-strategy-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 0.8rem;
}

.live-strategy-panel {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 14px;
}

.live-strategy-title {
    color: var(--accent-cyan);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.live-strategy-block {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.live-strategy-block + .live-strategy-block {
    margin-top: 10px;
}

.live-strategy-block strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.strategy-config-panel {
    margin-top: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}

.strategy-config-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.strategy-config-title {
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 700;
}

.strategy-config-subtitle,
.strategy-config-status,
.strategy-config-summary {
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.45;
}

.strategy-config-status {
    margin-top: 8px;
    overflow-wrap: anywhere;
}

.strategy-config-select {
    width: 100%;
    padding: 7px 8px;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    font-size: 0.82rem;
}

.strategy-config-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    white-space: nowrap;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid rgba(148,163,184,0.22);
    background: rgba(148,163,184,0.12);
    color: #cbd5e1;
}

.strategy-config-badge.approved {
    border-color: rgba(34,197,94,0.28);
    background: rgba(34,197,94,0.14);
    color: #bbf7d0;
}

.strategy-config-badge.legacy {
    border-color: rgba(59,130,246,0.28);
    background: rgba(59,130,246,0.14);
    color: #bfdbfe;
}

.strategy-config-badge.blocked {
    border-color: rgba(239,68,68,0.3);
    background: rgba(239,68,68,0.14);
    color: #fecaca;
}

.strategy-config-badge.warning {
    border-color: rgba(245,158,11,0.3);
    background: rgba(245,158,11,0.14);
    color: #fde68a;
}

.strategy-config-badge.muted {
    border-color: rgba(148,163,184,0.18);
    background: rgba(148,163,184,0.09);
    color: #94a3b8;
}

.daytrade-config-panel {
    margin-top: 14px;
    padding: 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
}

.daytrade-config-header,
.daytrade-config-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.daytrade-config-title {
    color: var(--text-primary);
    font-size: 0.86rem;
    font-weight: 800;
}

.daytrade-config-subtitle,
.daytrade-config-path,
.daytrade-config-note {
    color: var(--text-secondary);
    font-size: 0.74rem;
    line-height: 1.45;
}

.daytrade-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.daytrade-config-card {
    border: 1px solid rgba(148,163,184,0.16);
    border-radius: 8px;
    background: rgba(15,23,42,0.35);
    padding: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.daytrade-config-card-active {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(34, 197, 94, 0.04);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.12);
}

.daytrade-config-card-enabled {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.03);
}

.daytrade-config-card-head strong {
    color: var(--text-primary);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.daytrade-config-path {
    margin-top: 6px;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    overflow-wrap: anywhere;
}

.daytrade-config-note {
    margin-top: 8px;
}

.daytrade-config-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
}

.daytrade-config-metrics div {
    min-width: 0;
    padding: 7px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.035);
}

.daytrade-config-metrics span,
.daytrade-config-metrics strong {
    display: block;
    overflow-wrap: anywhere;
}

.daytrade-config-metrics span {
    color: var(--text-muted);
    font-size: 0.68rem;
    margin-bottom: 2px;
}

.daytrade-config-metrics strong {
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 700;
}

.strategy-cell,
.reason-cell {
    min-width: 220px;
    max-width: 260px;
    white-space: normal;
    overflow-wrap: anywhere;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.45;
}

.strategy-cell {
    color: var(--accent-cyan);
}

#holdingsTable,
#tradeHistoryTable {
    table-layout: fixed;
}

#holdingsTable {
    min-width: 1480px;
}

#tradeHistoryTable {
    min-width: 1180px;
}

#holdingsTable th,
#holdingsTable td,
#tradeHistoryTable th,
#tradeHistoryTable td {
    vertical-align: top;
}

#holdingsTable .paper-col-ticker { width: 6%; }
#holdingsTable .paper-col-type { width: 6%; }
#holdingsTable .paper-col-qty { width: 5%; }
#holdingsTable .paper-col-price { width: 7%; }
#holdingsTable .paper-col-value { width: 8%; }
#holdingsTable .paper-col-pnl { width: 8%; }
#holdingsTable .paper-col-pct { width: 5%; }
#holdingsTable .paper-col-score { width: 5%; }
#holdingsTable .paper-col-term { width: 8%; }
#holdingsTable .paper-col-reason { width: 14%; }
#holdingsTable .paper-col-entry-strategy { width: 11%; }
#holdingsTable .paper-col-exit-strategy { width: 10%; }

#tradeHistoryTable .paper-history-col-time { width: 14%; }
#tradeHistoryTable .paper-history-col-action { width: 8%; }
#tradeHistoryTable .paper-history-col-ticker { width: 8%; }
#tradeHistoryTable .paper-history-col-type { width: 8%; }
#tradeHistoryTable .paper-history-col-price { width: 8%; }
#tradeHistoryTable .paper-history-col-qty { width: 8%; }
#tradeHistoryTable .paper-history-col-score { width: 7%; }
#tradeHistoryTable .paper-history-col-pnl { width: 9%; }
#tradeHistoryTable .paper-history-col-strategy { width: 15%; }
#tradeHistoryTable .paper-history-col-reason { width: 15%; }

#holdingsTable .cell-ticker,
#tradeHistoryTable .cell-ticker {
    display: table-cell;
    white-space: nowrap;
}

#holdingsTable .paper-text-cell,
#tradeHistoryTable .paper-text-cell {
    min-width: 0;
    max-width: none;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
    line-height: 1.38;
}

#holdingsTable .strategy-cell,
#tradeHistoryTable .strategy-cell {
    color: #67e8f9;
}

#holdingsTable .term-cell {
    color: #f8fafc;
    font-weight: 600;
}

#holdingsTable .reason-cell,
#tradeHistoryTable .reason-cell {
    color: var(--text-secondary);
}

/* Action Badges */
.badge-running {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

.badge-stopped {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.badge-stock {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.badge-crypto {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.badge-bear {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.badge-sp500 {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.action-buy {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.action-sell {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Button Variants */
.btn-green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.btn-green:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-1px); }
.btn-green:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-amber {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.btn-amber:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-1px); }
.btn-amber:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.btn-danger:hover:not(:disabled) { filter: brightness(1.15); transform: translateY(-1px); }
.btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }

/* Settings Form */
.trader-settings-card {
    padding: 1.5rem;
}

.trader-settings-card h2 {
    display: none;
}

.rules-panel {
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    overflow: hidden;
}

.rules-panel summary {
    list-style: none;
    cursor: pointer;
    padding: 0.95rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
}

.rules-panel summary::-webkit-details-marker {
    display: none;
}

.rules-panel summary::after {
    content: '+';
    color: var(--accent-cyan);
    font-size: 1.1rem;
    line-height: 1;
}

.rules-panel[open] summary::after {
    content: '-';
}

.rules-panel-body {
    padding-top: 0.25rem;
}

.settings-group {
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0.95rem 1rem;
    background: rgba(255,255,255,0.025);
}

.settings-group + .settings-group {
    margin-top: 0.9rem;
}

.settings-group-stock {
    border-color: rgba(34, 211, 238, 0.16);
}

.settings-group-crypto {
    border-color: rgba(251, 191, 36, 0.16);
}

.settings-group-risk {
    border-color: rgba(99, 102, 241, 0.2);
}

.settings-group-bear {
    border-color: rgba(239, 68, 68, 0.18);
}

.settings-group-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.settings-group-note {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.85rem;
}

.settings-inline-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.settings-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin-top: 10px;
}

.settings-toggle-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.attribution-detail {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.35;
}

.muted-inline {
    color: var(--text-muted);
}

.finviz-builder {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.finviz-filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr) auto;
    gap: 8px;
    align-items: stretch;
}

.finviz-filter-row select {
    width: 100%;
    padding: 0.45rem 0.6rem;
    min-width: 0;
    background-color: #111827 !important;
    background-image: none !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: var(--radius-sm);
    color: #f1f5f9 !important;
    font-size: 0.82rem;
    font-family: var(--font-main);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color-scheme: dark;
    box-shadow: none;
}

.finviz-filter-row select option,
.finviz-filter-row select optgroup {
    background-color: #111827 !important;
    color: #f1f5f9 !important;
}

.finviz-filter-row .finviz-filter-select,
.finviz-filter-row .finviz-value-select {
    height: 38px;
}

.finviz-filter-row button {
    padding: 0.45rem 0.8rem;
    white-space: nowrap;
    align-self: stretch;
    height: 38px;
    justify-self: end;
}

.finviz-remove-btn {
    background: rgba(239, 68, 68, 0.14);
    color: #fda4af;
    border: 1px solid rgba(239, 68, 68, 0.18);
    border-radius: 10px;
    font-weight: 600;
    min-width: 92px;
    padding: 0 0.9rem;
}

.finviz-remove-btn:hover {
    background: rgba(239, 68, 68, 0.22);
    color: #fecaca;
}

.finviz-builder-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.finviz-builder-actions .btn {
    background: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.5rem 0.95rem;
    box-shadow: none;
}

.finviz-builder-actions .btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: translateY(-1px);
}

.finviz-builder-empty {
    padding: 0.7rem 0.8rem;
    border: 1px dashed var(--border-subtle);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    background: rgba(255,255,255,0.02);
}

@media (max-width: 768px) {
    .finviz-filter-row {
        grid-template-columns: 1fr;
    }
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.setting-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.setting-row input[type="number"],
.setting-row input[type="text"] {
    width: 120px;
    padding: 0.4rem 0.6rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-align: right;
    transition: border-color 0.2s;
}

.setting-row input[type="number"]:focus,
.setting-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.setting-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent-green);
    box-shadow: var(--shadow-card), 0 0 20px rgba(16, 185, 129, 0.2);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-error {
    border-color: var(--accent-red);
    box-shadow: var(--shadow-card), 0 0 20px rgba(239, 68, 68, 0.2);
}

/* Pulse Animation */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.2); }
    50% { box-shadow: 0 0 8px 2px rgba(16, 185, 129, 0.3); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive — Trader */
@media (max-width: 1200px) {
    .trader-summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .asset-summary-metrics,
    .live-strategy-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .trader-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 0.85rem;
    }
    .trader-controls-left {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        gap: 0.5rem;
    }
    .trader-controls-left h2 {
        font-size: 0.95rem;
        width: 100%;
    }
    .trader-controls-left span {
        margin-left: 0 !important;
    }
    .trader-controls-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
    }
    .trader-execution-menu {
        grid-column: 1 / -1;
        justify-content: space-between;
        min-height: 44px;
    }
    .trader-execution-menu select {
        flex: 1;
        min-width: 0;
    }
    .trader-controls-right .btn {
        min-height: 44px;
        justify-content: center;
        font-size: 0.78rem;
    }
    .trader-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
    }
    .trader-summary-grid .summary-card {
        flex-direction: column;
        text-align: center;
        gap: 0.35rem;
    }
    .asset-summary-grid,
    .settings-inline-grid,
    .settings-toggle-grid {
        grid-template-columns: 1fr;
    }
    .asset-summary-card {
        padding: 0.8rem;
    }
    .asset-summary-metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .asset-summary-metrics div {
        padding: 6px;
    }
    .asset-summary-metrics span {
        font-size: 0.65rem;
    }
    .asset-summary-metrics strong {
        font-size: 0.82rem;
    }
    .live-strategy-card {
        padding: 0.85rem;
    }
    .live-strategy-block {
        font-size: 0.76rem;
    }
}

@media (max-width: 480px) {
    .trader-summary-grid {
        grid-template-columns: 1fr 1fr;
    }
    .asset-summary-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Backtest Stats */
.stat-item {
    background: rgba(255,255,255,0.03);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ─── Strategy Settings Card ─── */
.strategy-settings-card {
    padding: 1.25rem 1.5rem;
}

/* ─── Mobile Extras ─── */
@media (max-width: 768px) {
    .breakout-info-grid {
        grid-template-columns: 1fr !important;
    }
    .setting-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }
    .setting-row label {
        font-size: 0.8rem;
    }
    .setting-row input[type="number"],
    .setting-row input[type="text"] {
        width: 100%;
        font-size: 16px; /* Prevent iOS zoom */
    }
    .setting-row select {
        width: 100% !important;
        font-size: 16px;
    }
    .settings-group-title {
        font-size: 0.85rem;
    }

    /* Strategy Settings Card */
    .strategy-settings-card {
        padding: 0.85rem;
    }
    .strategy-settings-card h2 {
        font-size: 0.88rem;
        margin-bottom: 0.6rem;
    }

    /* Breakout table — mobile card layout */
    .strategy-settings-card .data-table thead {
        display: none;
    }
    .strategy-settings-card .data-table,
    .strategy-settings-card .data-table tbody {
        display: block;
    }
    .strategy-settings-card .data-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem 0.75rem;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
        border-bottom: 1px solid var(--border-subtle);
    }
    .strategy-settings-card .data-table tbody td {
        padding: 0.2rem 0;
        white-space: normal;
        font-size: 0.78rem;
    }
    .strategy-settings-card .data-table tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.65rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 600;
        margin-bottom: 2px;
    }
    /* Reasons column spans full width */
    .strategy-settings-card .data-table tbody td:last-child {
        grid-column: 1 / -1;
    }
    /* Row number hidden on mobile */
    .strategy-settings-card .data-table tbody td:first-child {
        display: none;
    }

    /* Momentum info card inline flex → stack */
    .card [style*="display: flex"][style*="justify-content: space-between"][style*="align-items: flex-start"] {
        flex-direction: column !important;
        gap: 0.5rem;
    }

    /* Industry table — mobile card layout */
    #tab-industry .table-card .data-table thead {
        display: none;
    }
    #tab-industry .table-card .data-table,
    #tab-industry .table-card .data-table tbody {
        display: block;
    }
    #tab-industry .table-card .data-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.3rem 0.75rem;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
    }
    #tab-industry .table-card .data-table tbody td {
        padding: 0.2rem 0;
        white-space: normal !important;
        max-width: none !important;
        font-size: 0.78rem;
    }
    #tab-industry .table-card .data-table tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.65rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 600;
        margin-bottom: 2px;
    }
    /* Row number hidden */
    #tab-industry .table-card .data-table tbody td:first-child {
        display: none;
    }
    /* Industry name spans full width as card header */
    #tab-industry .table-card .data-table tbody td:nth-child(2) {
        grid-column: 1 / -1;
        font-size: 0.88rem;
        font-weight: 600;
        color: var(--text-primary);
        padding-bottom: 0.25rem;
        border-bottom: 1px solid var(--border-subtle);
        margin-bottom: 0.15rem;
    }
    /* Tickers span full width */
    #tab-industry .table-card .data-table tbody td:last-child {
        grid-column: 1 / -1;
    }

    /* Finviz industry table — horizontal scroll on mobile */
    #finvizIndustryTable {
        min-width: 480px;
    }
    #tab-industry #finvizIndustryTable thead {
        display: table-header-group;
    }
    #tab-industry #finvizIndustryTable,
    #tab-industry #finvizIndustryTable tbody {
        display: table;
        width: 100%;
    }
    #tab-industry #finvizIndustryTable tbody tr {
        display: table-row;
        background: none;
        border: none;
        border-radius: 0;
        padding: 0;
        margin: 0;
    }
    #tab-industry #finvizIndustryTable tbody td {
        display: table-cell;
        padding: 0.45rem 0.6rem;
        white-space: nowrap;
        font-size: 0.78rem;
    }
    #tab-industry #finvizIndustryTable tbody td::before { display: none; }
    #tab-industry #finvizIndustryTable tbody td:first-child { display: table-cell; }

    /* Industry summary KPI cards — 2 columns on mobile */
    #industrySummaryCards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ── Paper Trade: mobile card mixin ── */
    #holdingsTable,
    #tradeHistoryTable,
    #tab-trader .grid-2col .data-table {
        min-width: 0 !important;
        table-layout: auto !important;
    }
    #holdingsTable colgroup,
    #tradeHistoryTable colgroup {
        display: none;
    }
    #holdingsTable .cell-ticker,
    #tradeHistoryTable .cell-ticker {
        display: block;
        white-space: normal;
    }
    /* Holdings table */
    #holdingsTable thead { display: none; }
    #holdingsTable, #holdingsTable tbody { display: block; }
    #holdingsTable tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 0.3rem 0.6rem;
        padding: 0.7rem;
        margin-bottom: 0.5rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
    }
    #holdingsTable tbody td {
        padding: 0.15rem 0;
        white-space: normal !important;
        font-size: 0.78rem;
    }
    #holdingsTable tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.6rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 600;
        margin-bottom: 1px;
    }
    /* Ticker spans full row as header */
    #holdingsTable tbody td:first-child {
        grid-column: 1 / -1;
        font-size: 0.9rem;
        padding-bottom: 0.25rem;
        border-bottom: 1px solid var(--border-subtle);
        margin-bottom: 0.1rem;
    }

    /* Trade History (all 3 tables) */
    #tradeHistoryTable thead,
    #tab-trader .grid-2col .data-table thead { display: none; }

    #tradeHistoryTable,
    #tradeHistoryTable tbody,
    #tab-trader .grid-2col .data-table,
    #tab-trader .grid-2col .data-table tbody { display: block; }

    #tradeHistoryTable tbody tr,
    #tab-trader .grid-2col .data-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.25rem 0.6rem;
        padding: 0.7rem;
        margin-bottom: 0.5rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
    }
    #tradeHistoryTable tbody td,
    #tab-trader .grid-2col .data-table tbody td {
        padding: 0.15rem 0;
        white-space: normal !important;
        max-width: none !important;
        font-size: 0.78rem;
    }
    #tradeHistoryTable tbody td::before,
    #tab-trader .grid-2col .data-table tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.6rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 600;
        margin-bottom: 1px;
    }
    /* Reason spans full width */
    #tradeHistoryTable tbody td:last-child,
    #tab-trader .grid-2col .data-table tbody td:last-child {
        grid-column: 1 / -1;
    }

    /* Empty state rows — keep single column */
    #holdingsTable tbody tr:only-child td.empty-state,
    #tradeHistoryTable tbody tr:only-child td.empty-state,
    #tab-trader .grid-2col .data-table tbody tr:only-child td.empty-state,
    #btTradesTable tbody tr:only-child td.empty-state {
        grid-column: 1 / -1;
    }
    #holdingsTable tbody tr:only-child td.empty-state::before,
    #tradeHistoryTable tbody tr:only-child td.empty-state::before,
    #tab-trader .grid-2col .data-table tbody tr:only-child td.empty-state::before,
    #btTradesTable tbody tr:only-child td.empty-state::before {
        display: none;
    }
    #holdingsTable tbody tr:only-child,
    #tradeHistoryTable tbody tr:only-child,
    #tab-trader .grid-2col .data-table tbody tr:only-child,
    #btTradesTable tbody tr:only-child {
        display: block;
    }

    /* Paper Trade log panels — full height on mobile */
    #traderLogBody {
        height: 180px !important;
        font-size: 0.68rem !important;
    }

    /* ── Backtest: mobile optimizations ── */
    /* Strategy description — stack entry/exit */
    #tab-backtest [style*="grid-template-columns: 1fr 1fr"][style*="gap: 12px"] {
        grid-template-columns: 1fr !important;
    }
    /* Strategy settings — stack 3-col to 1-col */
    #tab-backtest [style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    /* Backtest universe + results — stack side-by-side to vertical */
    #tab-backtest [style*="display: flex"][style*="gap: 20px"] {
        flex-direction: column !important;
    }
    /* Checkboxes + Save & Sync row — wrap */
    #tab-backtest [style*="display: flex"][style*="gap: 20px"][style*="margin-top: 12px"] {
        flex-wrap: wrap !important;
    }
    /* Backtest filter bar */
    #portfolioResults [style*="display: flex"][style*="gap: 10px"] {
        flex-direction: column !important;
    }
    #portfolioResults [style*="display: flex"][style*="gap: 8px"] {
        flex-direction: column !important;
    }
    #portfolioResults .search-input {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* Backtest trades table — mobile card layout */
    #btTradesTable thead { display: none; }
    #btTradesTable, #btTradesTable tbody { display: block; }
    #btTradesTable tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.25rem 0.6rem;
        padding: 0.7rem;
        margin-bottom: 0.5rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-subtle);
        border-radius: 10px;
    }
    #btTradesTable tbody td {
        padding: 0.15rem 0;
        white-space: normal !important;
        font-size: 0.78rem;
    }
    #btTradesTable tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.6rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 600;
        margin-bottom: 1px;
    }
    /* Ticker as card header */
    #btTradesTable tbody td:first-child {
        grid-column: 1 / -1;
        font-size: 0.9rem;
        padding-bottom: 0.25rem;
        border-bottom: 1px solid var(--border-subtle);
        margin-bottom: 0.1rem;
    }
    /* Reason spans full width */
    #btTradesTable tbody td:last-child {
        grid-column: 1 / -1;
    }

    /* Performance Summary stats grid */
    #portfolioSummaryGrid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    /* Backtest stats grid */
    .stat-item {
        padding: 8px;
    }
    .stat-value {
        font-size: 0.95rem;
    }

    /* TradingView Modal — fullscreen on mobile */
    .tv-modal-content {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        border-radius: 0 !important;
        padding: 10px !important;
    }
    .tv-modal-content [style*="flex: 1; display: flex; gap: 15px"] {
        flex-direction: column !important;
    }
    #backtestResults {
        max-height: 200px;
    }
    #backtestSummary {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }
}

/* ─── iOS Specific Fixes ─── */
@supports (-webkit-touch-callout: none) {
    /* Fix iOS momentum scrolling in all scroll containers */
    .table-wrapper,
    .news-grid,
    .tabs {
        -webkit-overflow-scrolling: touch;
    }

    /* Prevent iOS double-tap zoom on buttons */
    .btn, .tab, .filter-btn {
        touch-action: manipulation;
    }

    /* Fix iOS input styling */
    input, select, textarea {
        -webkit-appearance: none;
        appearance: none;
        border-radius: 0;
    }
    select {
        border-radius: var(--radius-sm);
    }
    input[type="number"],
    input[type="text"] {
        border-radius: var(--radius-sm);
    }
    input[type="checkbox"] {
        -webkit-appearance: checkbox;
        appearance: checkbox;
    }
}

/* 2026 UI refresh overrides */
:root {
    --bg-primary: #06101b;
    --bg-secondary: #0b1726;
    --bg-card: rgba(8, 20, 35, 0.78);
    --bg-card-hover: rgba(13, 28, 46, 0.92);
    --bg-glass: rgba(255, 255, 255, 0.035);
    --accent-blue: #68a8ff;
    --accent-purple: #8ea3c7;
    --accent-cyan: #42d6c8;
    --accent-green: #41d98a;
    --accent-amber: #f6bc67;
    --accent-red: #ff6b78;
    --accent-pink: #ff8f70;
    --gradient-primary: linear-gradient(135deg, #42d6c8 0%, #68a8ff 55%, #b8c8ff 100%);
    --gradient-green: linear-gradient(135deg, #41d98a 0%, #42d6c8 100%);
    --gradient-amber: linear-gradient(135deg, #f6bc67 0%, #ff8f70 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.015));
    --text-primary: #edf4ff;
    --text-secondary: #9ab0c9;
    --text-muted: #6f8299;
    --border-subtle: rgba(150, 180, 220, 0.12);
    --border-glow: rgba(104, 168, 255, 0.34);
    --shadow-card: 0 18px 48px rgba(0, 0, 0, 0.28);
    --shadow-glow-blue: 0 0 40px rgba(104, 168, 255, 0.18);
    --shadow-glow-green: 0 0 40px rgba(65, 217, 138, 0.15);
    --radius: 22px;
    --radius-sm: 14px;
    --gap: 1.25rem;
    --font-main: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

body {
    background:
        radial-gradient(circle at top left, rgba(66, 214, 200, 0.12), transparent 26%),
        radial-gradient(circle at 85% 18%, rgba(104, 168, 255, 0.14), transparent 22%),
        linear-gradient(180deg, #07121f 0%, #050c15 100%);
    color: var(--text-primary);
}

body::before {
    background:
        radial-gradient(circle at 12% 0%, rgba(66, 214, 200, 0.16), transparent 28%),
        radial-gradient(circle at 88% 12%, rgba(104, 168, 255, 0.16), transparent 24%),
        radial-gradient(circle at 50% 100%, rgba(246, 188, 103, 0.08), transparent 26%);
    opacity: 1;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
    background-size: 84px 84px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,0.4), transparent 90%);
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
}

.top-bar {
    padding: 1rem 2rem;
    background: rgba(5, 12, 21, 0.78);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(150, 180, 220, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.logo {
    gap: 0.9rem;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(66, 214, 200, 0.18), rgba(104, 168, 255, 0.14));
    border: 1px solid rgba(104, 168, 255, 0.28);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 24px rgba(0, 0, 0, 0.2);
}

.logo h1 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    background: linear-gradient(135deg, #edf4ff 0%, #9edbff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.version-badge {
    background: rgba(104, 168, 255, 0.1);
    color: #bcd7ff;
    border: 1px solid rgba(104, 168, 255, 0.22);
}

.status-indicator,
.last-update {
    color: var(--text-secondary);
}

.btn {
    min-height: 42px;
    padding: 0.68rem 1.15rem;
    border-radius: 999px;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #42d6c8 0%, #5d9cff 100%);
    color: #05101d;
    box-shadow: 0 14px 28px rgba(66, 214, 200, 0.14);
}

.btn-primary:hover {
    box-shadow: 0 18px 32px rgba(104, 168, 255, 0.2);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-icon {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard {
    max-width: 1520px;
    padding: 2rem 2rem 4rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
    gap: 1.25rem;
    margin-bottom: 1.4rem;
}

.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 1.6rem;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(9, 22, 38, 0.88), rgba(5, 14, 24, 0.96)),
        var(--gradient-glass);
    border: 1px solid rgba(150, 180, 220, 0.14);
    box-shadow: var(--shadow-card);
}

.hero-panel::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(66, 214, 200, 0.2), transparent 70%);
    filter: blur(10px);
    opacity: 0.8;
    pointer-events: none;
}

.hero-panel::after {
    content: '';
    position: absolute;
    inset: auto 0 0 auto;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(104, 168, 255, 0.16), transparent 70%);
    pointer-events: none;
}

.hero-copy-panel,
.hero-command-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.1rem;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    border: 1px solid rgba(66, 214, 200, 0.2);
    background: rgba(66, 214, 200, 0.08);
    color: var(--accent-cyan);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-title {
    max-width: 14ch;
    font-size: clamp(2.1rem, 4vw, 3.4rem);
    line-height: 0.98;
    margin: 0;
}

.hero-description {
    max-width: 54ch;
    color: var(--text-secondary);
    font-size: 0.98rem;
    line-height: 1.75;
}

.hero-story-grid,
.hero-mini-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.hero-mini-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-story-card,
.hero-mini-card,
.breakout-info-card {
    position: relative;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
    border: 1px solid rgba(150, 180, 220, 0.12);
}

.hero-story-label,
.hero-mini-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-story-card strong,
.hero-mini-card strong {
    display: block;
    font-size: 0.94rem;
    line-height: 1.5;
}

.hero-command-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.hero-command-kicker {
    color: var(--accent-amber);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-command-header h3 {
    font-size: 1.45rem;
    margin-top: 0.35rem;
}

.hero-quote {
    padding-top: 1.1rem;
    border-top: 1px solid rgba(150, 180, 220, 0.12);
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.summary-cards {
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.summary-card {
    position: relative;
    min-height: 138px;
    align-items: flex-start;
    padding: 1.35rem 1.35rem 1.2rem;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(8, 20, 35, 0.9), rgba(5, 14, 24, 0.96)),
        var(--gradient-glass);
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, rgba(66, 214, 200, 0.9), rgba(104, 168, 255, 0.6), transparent);
}

.card-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #d9f7f3;
    background: linear-gradient(145deg, rgba(66, 214, 200, 0.18), rgba(104, 168, 255, 0.12));
    border: 1px solid rgba(104, 168, 255, 0.18);
}

.card-label {
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.card-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    line-height: 1.05;
}

.card-sub {
    margin-top: 0.45rem;
}

.card,
.chart-card,
.table-card {
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(8, 20, 35, 0.82), rgba(5, 14, 24, 0.96)),
        var(--gradient-glass);
    border: 1px solid rgba(150, 180, 220, 0.11);
    box-shadow: var(--shadow-card);
}

.chart-card,
.table-card {
    padding: 1.4rem;
}

.chart-card h2,
.table-card h2,
.card h2 {
    font-size: 1.05rem;
}

.tabs {
    gap: 0.45rem;
    padding: 0.45rem;
    margin-bottom: 1.4rem;
    background: rgba(6, 15, 26, 0.72);
    border-radius: 999px;
    border: 1px solid rgba(150, 180, 220, 0.1);
    backdrop-filter: blur(16px);
}

.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-height: 42px;
    padding: 0.7rem 1.05rem;
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.06);
}

.tab.active {
    color: #06101b;
    background: linear-gradient(135deg, #42d6c8 0%, #77abff 100%);
    box-shadow: 0 14px 24px rgba(66, 214, 200, 0.18);
}

.tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.65rem;
    font-weight: 700;
}

.grid-2col {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

.chart-container {
    height: 340px;
}

.breakout-table-shell {
    overflow: hidden;
}

.breakout-intel-card {
    margin-bottom: 1.5rem;
    padding: 1.3rem;
    border-left: none;
    border: 1px solid rgba(66, 214, 200, 0.18);
    background:
        linear-gradient(145deg, rgba(66, 214, 200, 0.08), rgba(255,255,255,0.02)),
        linear-gradient(180deg, rgba(8, 20, 35, 0.88), rgba(5, 14, 24, 0.96));
}

.breakout-intel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.breakout-chip {
    margin-bottom: 0.7rem;
}

.breakout-intel-title {
    margin-bottom: 0.55rem;
}

.breakout-intel-copy {
    max-width: 62ch;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.7;
}

.breakout-badge {
    background: rgba(66, 214, 200, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(66, 214, 200, 0.18);
}

.breakout-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin-top: 1rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.breakout-info-card strong {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--accent-cyan);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.search-input {
    background: rgba(11, 23, 38, 0.92);
    border: 1px solid rgba(150, 180, 220, 0.12);
    border-radius: 999px;
    color: var(--text-primary);
    min-height: 42px;
    padding: 0.65rem 1rem;
}

.search-input:focus {
    border-color: rgba(104, 168, 255, 0.4);
    box-shadow: 0 0 0 4px rgba(104, 168, 255, 0.1);
}

.table-wrapper {
    border-radius: 18px;
}

.data-table thead th {
    background: rgba(18, 33, 52, 0.96);
    color: #b7c8dd;
}

.data-table tbody tr:hover {
    background: rgba(66, 214, 200, 0.05);
}

.cell-ticker {
    color: #92f0ea !important;
    background: rgba(66, 214, 200, 0.09);
}

.news-grid {
    gap: 1.1rem;
}

.news-item {
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(12, 24, 40, 0.9), rgba(7, 16, 27, 0.96));
}

.strategy-settings-card {
    padding: 1.35rem 1.35rem 1.1rem;
}

@media (max-width: 1180px) {
    .hero-grid,
    .grid-2col {
        grid-template-columns: 1fr;
    }

    .hero-title {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 0.85rem 1rem;
    }

    .dashboard {
        padding: 1.2rem 1rem 3rem;
    }

    .hero-grid {
        gap: 0.9rem;
    }

    .hero-panel {
        padding: 1.15rem;
        border-radius: 22px;
    }

    .hero-story-grid,
    .hero-mini-grid,
    .summary-cards,
    .breakout-info-grid {
        grid-template-columns: 1fr;
    }

    .summary-card {
        min-height: auto;
    }

    .tabs {
        border-radius: 24px;
    }

    .tab {
        min-height: 40px;
    }

    .breakout-intel-header {
        flex-direction: column;
    }
}

/* ─── Mobile Layout Refresh ─── */
@media (max-width: 768px) {
    .transition-command-center,
    .transition-metrics-grid,
    .scanner-command-center,
    .scanner-command-metrics,
    .scanner-pill-row,
    .stocks-mode-legend,
    .transition-phase-rail,
    .industry-command-center,
    .industry-command-metrics,
    .industry-pill-row {
        grid-template-columns: 1fr;
    }

    .transition-overview-header {
        flex-direction: column;
    }

    .scanner-overview-header {
        flex-direction: column;
    }

    .industry-overview-header {
        flex-direction: column;
    }

    .transition-overview-badge {
        width: 100%;
        text-align: center;
    }

    .scanner-overview-badge {
        width: 100%;
        text-align: center;
    }

    .industry-overview-badge {
        width: 100%;
        text-align: center;
    }

    .transition-phase-card,
    .transition-metric-card {
        min-height: auto;
    }

    .top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.85rem;
        padding: calc(0.8rem + env(safe-area-inset-top, 0px)) 1rem 0.9rem;
    }

    .top-bar-left {
        justify-content: space-between;
        gap: 0.75rem;
    }

    .top-bar-right {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.65rem;
        align-items: stretch;
    }

    #statusIndicator,
    #lastUpdate {
        min-height: 42px;
        padding: 0.7rem 0.8rem;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid var(--border-subtle);
    }

    #lastUpdate {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        text-align: right;
    }

    #autoRefreshSelect,
    #refreshBtn,
    #authActionBtn {
        width: 100%;
        min-width: 0 !important;
        margin-right: 0 !important;
        justify-content: center;
        min-height: 44px;
    }

    .dashboard {
        padding: 1rem 0.9rem 2rem;
    }

    .hero-grid {
        margin-top: 0.15rem;
    }

    .hero-command-panel {
        display: none;
    }

    .hero-panel {
        padding: 1rem;
    }

    .hero-title {
        font-size: 1.4rem;
        line-height: 1.15;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .hero-story-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .summary-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .summary-card {
        padding: 1rem;
        align-items: flex-start;
    }

    .card-icon {
        width: 44px;
        height: 44px;
        font-size: 1.35rem;
    }

    .tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0.55rem;
        padding: 0.35rem;
        border-radius: 18px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        flex: 0 0 auto;
        min-width: max-content;
        white-space: nowrap;
        padding-inline: 0.95rem;
        min-height: 42px;
        scroll-snap-align: start;
    }

    .chart-container {
        height: 240px;
    }

    .chart-container.chart-tall {
        height: 300px;
    }

    .card-header {
        align-items: stretch;
    }

    .card-header .search-input,
    .news-filters .search-input,
    .news-filters .filter-btn {
        width: 100%;
    }

    .news-filters {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.6rem;
        width: 100%;
    }

    .news-toggle {
        width: 100%;
        justify-content: space-between;
    }

    #tab-stocks .data-table thead,
    #tab-crypto .data-table thead {
        display: none;
    }

    #tab-stocks .data-table,
    #tab-stocks .data-table tbody,
    #tab-crypto .data-table,
    #tab-crypto .data-table tbody {
        display: block;
    }

    #tab-stocks .data-table tbody tr,
    #tab-crypto .data-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem 0.8rem;
        padding: 0.85rem;
        margin-bottom: 0.6rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
    }

    #tab-stocks .data-table tbody td,
    #tab-crypto .data-table tbody td {
        padding: 0.15rem 0;
        white-space: normal !important;
        font-size: 0.8rem;
    }

    #tab-stocks .data-table tbody td::before,
    #tab-crypto .data-table tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.64rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 600;
        margin-bottom: 2px;
    }

    #tab-stocks .data-table tbody td:first-child,
    #tab-crypto .data-table tbody td:first-child {
        grid-column: 1 / -1;
        font-size: 0.92rem;
        font-weight: 700;
        padding-bottom: 0.3rem;
        margin-bottom: 0.1rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    #tab-stocks .table-card,
    #tab-crypto .table-card,
    #tab-news .card,
    #tab-breakout .table-card {
        padding: 1rem;
    }

    #tab-breakout .data-table thead,
    #tab-industry .data-table thead,
    #tab-trader .data-table thead,
    #tab-ibkr .data-table thead {
        display: none;
    }

    #tab-breakout .data-table,
    #tab-breakout .data-table tbody,
    #tab-industry .data-table,
    #tab-industry .data-table tbody,
    #tab-trader .data-table,
    #tab-trader .data-table tbody,
    #tab-ibkr .data-table,
    #tab-ibkr .data-table tbody {
        display: block;
    }

    #tab-breakout .data-table tbody tr,
    #tab-industry .data-table tbody tr,
    #tab-trader .data-table tbody tr,
    #tab-ibkr .data-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem 0.8rem;
        padding: 0.85rem;
        margin-bottom: 0.6rem;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
    }

    #tab-breakout .data-table tbody td,
    #tab-industry .data-table tbody td,
    #tab-trader .data-table tbody td,
    #tab-ibkr .data-table tbody td {
        padding: 0.15rem 0;
        white-space: normal !important;
        font-size: 0.8rem;
    }

    #tab-breakout .data-table tbody td::before,
    #tab-industry .data-table tbody td::before,
    #tab-trader .data-table tbody td::before,
    #tab-ibkr .data-table tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.64rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        font-weight: 600;
        margin-bottom: 2px;
    }

    #tab-breakout .data-table tbody td:first-child,
    #tab-industry .data-table tbody td:first-child,
    #tab-trader .data-table tbody td:first-child,
    #tab-ibkr .data-table tbody td:first-child {
        grid-column: 1 / -1;
        font-size: 0.92rem;
        font-weight: 700;
        padding-bottom: 0.3rem;
        margin-bottom: 0.1rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    #tab-breakout .data-table tbody tr:only-child,
    #tab-industry .data-table tbody tr:only-child,
    #tab-trader .data-table tbody tr:only-child,
    #tab-ibkr .data-table tbody tr:only-child {
        display: block;
    }

    #tab-breakout .data-table tbody tr:only-child td.empty-state,
    #tab-industry .data-table tbody tr:only-child td.empty-state,
    #tab-trader .data-table tbody tr:only-child td.empty-state,
    #tab-ibkr .data-table tbody tr:only-child td.empty-state {
        display: block;
        padding: 1rem 0;
    }

    #tab-breakout .data-table tbody tr:only-child td.empty-state::before,
    #tab-industry .data-table tbody tr:only-child td.empty-state::before,
    #tab-trader .data-table tbody tr:only-child td.empty-state::before,
    #tab-ibkr .data-table tbody tr:only-child td.empty-state::before {
        display: none;
    }

    #tab-trader .settings-form,
    #tab-ibkr .settings-form,
    #tab-backtest .settings-form {
        grid-template-columns: 1fr !important;
    }

    #tab-trader .setting-row,
    #tab-trader .rules-panel-body .setting-row {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    #tab-trader [style*="display: flex"][style*="gap: 6px"],
    #tab-trader [style*="display:flex"][style*="gap:8px"],
    #tab-trader [style*="display:flex"][style*="gap: 8px"],
    #tab-ibkr [style*="display:flex"][style*="gap: 12px"],
    #tab-backtest [style*="display:flex"][style*="gap: 10px"],
    #tab-backtest [style*="display: flex"][style*="gap: 10px"] {
        flex-wrap: wrap !important;
    }

    #tab-trader .btn,
    #tab-ibkr .btn,
    #tab-backtest .btn {
        justify-content: center;
    }

    #tab-ibkr [style*="grid-template-columns: 1fr 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    #tab-ibkr [style*="display:flex"][style*="gap: 12px"][style*="align-items:center"] {
        align-items: stretch !important;
    }

    #ibkrStatusText {
        width: 100%;
        justify-content: center;
    }

    #tab-backtest .card > [style*="display: flex"][style*="gap: 20px"] {
        flex-direction: column !important;
    }

    #portfolioStats,
    #portfolioResults,
    #downloadStatusPanel,
    #analysisLogPanel {
        width: 100%;
    }

    #portfolioSummaryGrid {
        grid-template-columns: 1fr !important;
    }

    #analysisLogBody,
    #traderLogBody {
        height: 180px !important;
    }

    #tvModal {
        padding: 0 !important;
    }

    #tvModal .tv-modal-content {
        width: 100vw !important;
        height: 100dvh !important;
        max-width: none !important;
        border-radius: 0 !important;
        padding: 0.8rem !important;
    }

    #tvModal .modal-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
        margin-bottom: 0.75rem !important;
    }

    #tvModal .modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        gap: 0.5rem;
        align-items: center;
    }

    #tvModal .modal-actions .btn {
        width: 100%;
        margin-right: 0 !important;
    }

    #tvModal .tv-modal-content > div:last-child {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    #tvModal .tv-modal-content > div:last-child > div:first-child {
        flex: 1 1 auto !important;
        min-height: 48vh;
    }

    #stage2Panel {
        min-width: 0 !important;
        max-width: none !important;
        width: 100% !important;
        max-height: 34vh;
    }
}

@media (max-width: 480px) {
    .top-bar-left {
        flex-wrap: wrap;
    }

    .top-bar-right {
        grid-template-columns: 1fr;
    }

    #lastUpdate {
        justify-content: flex-start;
        text-align: left;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 1.28rem;
    }

    .dashboard {
        padding-inline: 0.75rem;
    }

    .chart-container {
        height: 220px;
    }

    .chart-container.chart-tall {
        height: 260px;
    }

    .card,
    .chart-card,
    .table-card,
    .hero-panel,
    .summary-card {
        border-radius: 18px;
    }

    .card-header h2,
    .chart-card h2,
    .table-card h2 {
        font-size: 0.95rem;
    }

    #tvModal .tv-modal-content {
        padding: 0.65rem !important;
    }

    #tvModal .modal-actions {
        grid-template-columns: 1fr;
    }

    #stage2Panel {
        max-height: 38vh;
        padding: 0.9rem !important;
    }
}

/* ─── Market Stage Banner ─── */
.transition-command-center {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.transition-overview-card {
    padding: 1.4rem;
}

.transition-section-kicker {
    display: inline-flex;
    width: fit-content;
    padding: 0.32rem 0.72rem;
    margin-bottom: 0.9rem;
    border-radius: 999px;
    background: rgba(66, 214, 200, 0.08);
    border: 1px solid rgba(66, 214, 200, 0.18);
    color: var(--accent-cyan);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.transition-overview-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.transition-overview-header h2 {
    margin-bottom: 0.45rem;
}

.transition-overview-copy {
    max-width: 66ch;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.7;
}

.transition-overview-badge {
    flex-shrink: 0;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    background: rgba(66, 214, 200, 0.1);
    border: 1px solid rgba(66, 214, 200, 0.18);
    color: #c7fff8;
    font-size: 0.74rem;
    font-weight: 600;
}

.transition-overview-badge.fallback {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.24);
    color: #fde68a;
}

.transition-phase-rail {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
}

.transition-phase-card {
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid rgba(150, 180, 220, 0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    min-height: 172px;
}

.transition-phase-ready {
    border-color: rgba(16, 185, 129, 0.28);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.08);
}

.transition-phase-warming {
    border-color: rgba(245, 158, 11, 0.24);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.08);
}

.transition-phase-waiting {
    opacity: 0.86;
}

.transition-phase-step {
    display: block;
    margin-bottom: 0.42rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.transition-phase-title {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.95rem;
}

.transition-phase-detail {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.6;
}

.transition-phase-signal {
    display: block;
    margin-top: 0.75rem;
    color: #d9e7f6;
    font-size: 0.76rem;
    line-height: 1.5;
}

.transition-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.transition-metric-card {
    padding: 1.2rem;
    min-height: 154px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.transition-metric-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.transition-metric-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    line-height: 1;
}

.transition-metric-sub {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.55;
}

.stocks-mode-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.stocks-mode-card {
    padding: 1rem 1.1rem;
    border-radius: 18px;
    border: 1px solid rgba(150, 180, 220, 0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.stocks-mode-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--accent-cyan);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stocks-mode-card strong {
    display: block;
    margin-bottom: 0.38rem;
    font-size: 0.92rem;
}

.stocks-mode-card p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.6;
}

.scanner-command-center {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.95fr);
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.scanner-overview-card {
    padding: 1.4rem;
}

.scanner-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.scanner-overview-copy {
    max-width: 64ch;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.7;
}

.scanner-overview-badge {
    flex-shrink: 0;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: #d1fae5;
    font-size: 0.74rem;
    font-weight: 600;
}

.scanner-overview-badge.fallback {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.24);
    color: #fde68a;
}

.scanner-pill-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
}

.scanner-pill-card {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(150, 180, 220, 0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.scanner-pill-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.scanner-pill-value {
    display: block;
    font-size: 0.88rem;
    line-height: 1.5;
}

.scanner-command-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.industry-command-center {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.95fr);
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.industry-overview-card {
    padding: 1.4rem;
}

.industry-overview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.industry-overview-copy {
    max-width: 64ch;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.7;
}

.industry-overview-badge {
    flex-shrink: 0;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    background: rgba(104, 168, 255, 0.1);
    border: 1px solid rgba(104, 168, 255, 0.2);
    color: #d8e8ff;
    font-size: 0.74rem;
    font-weight: 600;
}

.industry-overview-badge.fallback {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.24);
    color: #fde68a;
}

.industry-pill-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
}

.industry-pill-card {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(150, 180, 220, 0.12);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.industry-pill-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.industry-pill-value {
    display: block;
    font-size: 0.88rem;
    line-height: 1.5;
}

.industry-command-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.market-stage-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 0.9rem 1.4rem;
    border-radius: 12px;
    border: 1.5px solid #334155;
    background: rgba(148,163,184,0.08);
    transition: border-color 0.3s, background 0.3s;
}

.mkt-stage-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mkt-stage-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.mkt-stage-title {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}

.mkt-stage-label {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: #e2e8f0;
}

.mkt-stage-strategies {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mkt-strategy-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1.5px solid transparent;
    transition: all 0.3s;
}

.mkt-strategy-badge.active {
    border-color: currentColor;
    background: rgba(255,255,255,0.08);
    color: #e2e8f0;
}

.mkt-strategy-badge.inactive {
    border-color: #334155;
    background: transparent;
    color: #475569;
    text-decoration: line-through;
    opacity: 0.5;
}

.mkt-stage-sma {
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    min-width: 140px;
    text-align: right;
}

/* ─── Stage Sub-Tabs ─── */
.stage-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stage-tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.55rem 1.2rem;
    border-radius: 8px;
    border: 1.5px solid #334155;
    background: transparent;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1.3;
}

.stage-tab:hover {
    border-color: #475569;
    color: #e2e8f0;
    background: rgba(255,255,255,0.04);
}

.stage-tab.active {
    border-color: #6366f1;
    background: rgba(99,102,241,0.12);
    color: #e2e8f0;
}

.stage-tab[data-stage="stage2"].active  { border-color: #22c55e; background: rgba(34,197,94,0.1); }
.stage-tab[data-stage="stage13"].active { border-color: #f59e0b; background: rgba(245,158,11,0.1); }
.stage-tab[data-stage="stage4"].active  { border-color: #ef4444; background: rgba(239,68,68,0.1); }

.stage-tab-sub {
    font-size: 0.72rem;
    font-weight: 400;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stage-tab.active .stage-tab-sub { color: #94a3b8; }

.stage-loading {
    padding: 1.2rem 1.4rem;
    color: #94a3b8;
    font-size: 0.88rem;
}

.badge-strategy {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99,102,241,0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99,102,241,0.3);
}

.badge-strategy.bear {
    background: rgba(239,68,68,0.12);
    color: #fca5a5;
    border-color: rgba(239,68,68,0.3);
}

/* ─── Stocks Tab Stage Hint ─── */
.stocks-stage-hint {
    padding: 0.65rem 1.1rem;
    border-radius: 8px;
    border-left: 3px solid #334155;
    background: rgba(148,163,184,0.06);
    font-size: 0.88rem;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 1rem;
    transition: all 0.3s;
}

/* Theme Leadership */
.theme-command-center {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.6fr);
    gap: var(--gap);
}

.theme-hero-card,
.theme-panel {
    padding: 1.35rem;
}

.theme-hero-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.theme-hero-header h2 {
    font-size: 1.35rem;
    line-height: 1.2;
    margin: 0.2rem 0 0.45rem;
}

.theme-copy {
    color: var(--text-secondary);
    max-width: 620px;
    font-size: 0.9rem;
}

.theme-live-badge,
.theme-refresh-note,
.theme-status {
    border: 1px solid rgba(6, 182, 212, 0.24);
    background: rgba(6, 182, 212, 0.08);
    color: #67e8f9;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.theme-context-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-top: 1rem;
}

.theme-context-chip {
    min-width: 0;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.48);
    padding: 0.65rem 0.75rem;
}

.theme-context-chip span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.theme-context-chip strong {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.theme-regime-card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    justify-content: space-between;
    border-left: 4px solid var(--accent-cyan);
    padding: 1.25rem;
}

.theme-regime-body {
    display: flex;
    align-items: center;
    gap: 14px;
}

.theme-regime-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(6, 182, 212, 0.32);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 800;
}

.theme-regime-card h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    line-height: 1.2;
}

.theme-regime-card h3 + span {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.4;
}

.theme-regime-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 10px;
}

.theme-regime-pill-row .badge {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 999px;
    padding: 4px 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.theme-regime-meta {
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

.hf-source-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.hf-source-links-inline {
    display: inline-flex;
    margin-top: 0;
    vertical-align: middle;
}

.hf-source-link {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(6, 182, 212, 0.24);
    background: rgba(6, 182, 212, 0.08);
    color: #67e8f9;
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.hf-source-link:hover {
    border-color: rgba(6, 182, 212, 0.42);
    background: rgba(6, 182, 212, 0.15);
    color: #cffafe;
}

.hf-source-note {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    white-space: normal;
}

.theme-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 0.75rem;
    margin-top: 1.1rem;
}

.theme-metric {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    padding: 0.85rem;
    min-width: 0;
}

.theme-metric span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.theme-metric strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.3rem;
    line-height: 1.15;
    max-width: 100%;
    overflow-wrap: anywhere;
}

#themeTopName {
    font-size: 1.15rem;
}

.theme-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 0.85rem;
}

.theme-map-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.74);
    padding: 0.9rem;
    min-height: 184px;
}

/* --- Premium Theme Status Colors --- */
/* Dominant: Emerald Green (Bull Leader, Stage 2 Dominant Trend - Stage 2 Bull Run) */
.theme-map-card.theme-status-dominant,
.theme-leader-group.theme-status-dominant {
    border-color: rgba(16, 185, 129, 0.45) !important;
    background: rgba(16, 185, 129, 0.08) !important;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.04);
}
.theme-status-dominant .theme-status {
    border-color: rgba(16, 185, 129, 0.35) !important;
    background: rgba(16, 185, 129, 0.12) !important;
    color: #34d399 !important;
}

/* Strong: Electric Violet/Purple (Established pullbacks & EMA21/SMA50 reclaims) */
.theme-map-card.theme-status-strong,
.theme-leader-group.theme-status-strong {
    border-color: rgba(139, 92, 246, 0.45) !important;
    background: rgba(139, 92, 246, 0.07) !important;
    box-shadow: 0 0 14px rgba(139, 92, 246, 0.04);
}
.theme-status-strong .theme-status {
    border-color: rgba(139, 92, 246, 0.35) !important;
    background: rgba(139, 92, 246, 0.14) !important;
    color: #c084fc !important;
}

/* Emerging: Golden Amber (Actionable early setups, Early Stage 2 breakouts) */
.theme-map-card.theme-status-emerging,
.theme-leader-group.theme-status-emerging {
    border-color: rgba(245, 158, 11, 0.4) !important;
    background: rgba(245, 158, 11, 0.06) !important;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.04);
}
.theme-status-emerging .theme-status {
    border-color: rgba(245, 158, 11, 0.3) !important;
    background: rgba(245, 158, 11, 0.12) !important;
    color: #fcd34d !important;
}

/* Watch: Muted Slate (Basing, Stage 1 & 3 watch list) */
.theme-map-card.theme-status-watch,
.theme-leader-group.theme-status-watch {
    border-color: rgba(148, 163, 184, 0.2) !important;
    background: rgba(148, 163, 184, 0.03) !important;
}
.theme-status-watch .theme-status {
    border-color: rgba(148, 163, 184, 0.15) !important;
    background: rgba(148, 163, 184, 0.08) !important;
    color: #94a3b8 !important;
}

.theme-map-top,
.theme-score-row,
.theme-mini-stats,
.theme-leader-group-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.theme-leader-group-head {
    flex-wrap: wrap;
    align-items: flex-start;
}

.theme-rank {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.theme-map-card h3 {
    margin: 0.65rem 0 0.55rem;
    font-size: 1rem;
    line-height: 1.25;
}

.theme-map-context-row,
.theme-leader-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.theme-map-context-row {
    margin-bottom: 0.45rem;
}

.theme-context-label,
.theme-risk-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.16rem 0.48rem;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.25;
    white-space: nowrap;
}

.theme-context-label {
    border: 1px solid rgba(6, 182, 212, 0.24);
    background: rgba(6, 182, 212, 0.08);
    color: #67e8f9;
}

.theme-risk-badge {
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(148, 163, 184, 0.08);
    color: #cbd5e1;
}

.theme-risk-aggressive {
    border-color: rgba(96, 165, 250, 0.35);
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
}

.theme-risk-cyclical {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.10);
    color: #fcd34d;
}

.theme-risk-defensive,
.theme-risk-core {
    border-color: rgba(34, 197, 94, 0.32);
    background: rgba(34, 197, 94, 0.10);
    color: #86efac;
}

.theme-risk-extreme,
.theme-risk-bear {
    border-color: rgba(239, 68, 68, 0.38);
    background: rgba(239, 68, 68, 0.11);
    color: #fca5a5;
}

.theme-map-subline {
    min-height: 1.15rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.theme-score-row strong {
    font-family: var(--font-mono);
    color: #f8fafc;
}

.theme-score-row span,
.theme-top-tickers,
.theme-mini-stats {
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.theme-strength-track {
    height: 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    overflow: hidden;
    margin: 0.65rem 0;
}

.theme-strength-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #06b6d4, #f59e0b);
}

.theme-top-tickers {
    min-height: 2.3rem;
}

.theme-mini-stats {
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.theme-leader-board {
    display: grid;
    gap: 0.9rem;
}

.theme-leader-group {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    padding: 0.85rem;
}

.theme-leader-group-head span {
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.theme-leader-title-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.theme-leader-title-stack strong {
    overflow-wrap: anywhere;
}

.theme-leader-title-stack span {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.theme-leader-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.theme-leader-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary);
    padding: 0.38rem 0.55rem;
    cursor: pointer;
    font: inherit;
}

.theme-leader-chip span {
    color: #93c5fd;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

/* Market Map */
.market-map-shell {
    display: grid;
    gap: 1rem;
}

.market-map-command {
    display: grid;
    grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
    gap: 1rem;
}

.market-map-regime-card,
.market-map-leader-card,
.market-map-panel {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.72);
    padding: 1.15rem;
    min-width: 0;
}

.market-map-regime-card {
    border-left: 4px solid var(--accent-cyan);
}

.market-map-regime-main {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 0.75rem;
}

.market-map-regime-code {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(6, 182, 212, 0.32);
    border-radius: 8px;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 800;
}

.market-map-regime-main h2,
.market-map-leader-card h2,
.market-map-panel-head h2 {
    margin: 0;
    line-height: 1.2;
}

.market-map-regime-main h2,
.market-map-leader-card h2 {
    font-size: 1.45rem;
}

.market-map-regime-main span:not(.market-map-regime-code),
.market-map-leader-card p,
.market-map-panel-head span {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.market-map-regime-pills,
.market-map-leader-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1rem;
}

.market-map-regime-pills span,
.market-map-leader-strip span {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    padding: 0.24rem 0.62rem;
    font-size: 0.7rem;
    font-weight: 800;
}

.market-map-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.market-map-kpi {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    padding: 0.85rem;
    min-width: 0;
}

.market-map-kpi span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.market-map-kpi strong {
    display: block;
    margin-top: 0.28rem;
    color: var(--text-primary);
    font-size: 1.08rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.market-map-rotation-panel {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.64));
}

.market-map-rotation-head {
    align-items: center;
}

.market-map-window-toggle {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.market-map-window-toggle button {
    min-width: 48px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 800;
    padding: 0.36rem 0.58rem;
}

.market-map-window-toggle button.active {
    background: rgba(6, 182, 212, 0.18);
    color: #67e8f9;
}

.market-map-method-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -0.25rem 0 0.9rem;
}

.market-map-method-strip span {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    padding: 0.22rem 0.58rem;
    font-size: 0.68rem;
    font-weight: 800;
}

.market-map-flow-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1.25fr) minmax(280px, 0.75fr);
    gap: 0.9rem;
    align-items: stretch;
}

.market-map-flow-card {
    min-width: 0;
    border: 1px solid rgba(6, 182, 212, 0.22);
    border-radius: 8px;
    background: rgba(6, 182, 212, 0.055);
    padding: 0.9rem;
}

.market-map-flow-route {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    color: var(--text-primary);
    font-weight: 800;
}

.market-map-flow-from,
.market-map-flow-to {
    min-width: 0;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.market-map-flow-from {
    color: #fca5a5;
}

.market-map-flow-to {
    color: #86efac;
}

.market-map-flow-arrow {
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.market-map-flow-meta,
.market-map-flow-proof,
.market-map-flow-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.72rem;
}

.market-map-flow-meta span,
.market-map-flow-proof span {
    border-radius: 999px;
    padding: 0.18rem 0.48rem;
    font-size: 0.68rem;
    font-weight: 800;
}

.market-map-flow-meta span {
    border: 1px solid rgba(34, 197, 94, 0.24);
    background: rgba(34, 197, 94, 0.08);
    color: #bbf7d0;
}

.market-map-flow-proof span {
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
}

.market-map-flow-footer {
    align-items: center;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.market-map-flow-footer strong,
.market-map-flow-footer span {
    min-width: 0;
}

.market-map-flow-footer strong {
    color: var(--text-primary);
}

.market-map-flow-footer span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-map-rotation-board {
    position: relative;
    min-height: 360px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(248, 113, 113, 0.055), transparent 48%, rgba(34, 197, 94, 0.06)),
        linear-gradient(180deg, rgba(34, 197, 94, 0.045), transparent 48%, rgba(248, 113, 113, 0.05));
    overflow: hidden;
}

.market-map-rotation-cross {
    position: absolute;
    background: rgba(148, 163, 184, 0.22);
    pointer-events: none;
}

.market-map-rotation-cross-x {
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
}

.market-map-rotation-cross-y {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
}

.market-map-rotation-axis {
    position: absolute;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    pointer-events: none;
}

.market-map-rotation-axis-x {
    right: 12px;
    bottom: 10px;
}

.market-map-rotation-axis-y {
    left: 10px;
    top: 10px;
}

.market-map-rotation-quadrant {
    position: absolute;
    color: rgba(226, 232, 240, 0.7);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    pointer-events: none;
}

.market-map-rotation-quadrant.q-leading {
    right: 12px;
    top: 12px;
    color: #86efac;
}

.market-map-rotation-quadrant.q-weakening {
    right: 12px;
    bottom: 30px;
    color: #fde68a;
}

.market-map-rotation-quadrant.q-improving {
    left: 12px;
    top: 30px;
    color: #67e8f9;
}

.market-map-rotation-quadrant.q-lagging {
    left: 12px;
    bottom: 12px;
    color: #fca5a5;
}

.market-map-rotation-dot {
    position: absolute;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.92);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    padding: 0;
    z-index: 2;
}

.market-map-rotation-dot:focus-visible {
    outline: 2px solid #38bdf8;
    outline-offset: 3px;
}

.market-map-rotation-popover {
    position: absolute;
    right: 12px;
    top: 48px;
    width: min(360px, calc(100% - 24px));
    max-height: calc(100% - 72px);
    overflow: hidden;
    border: 1px solid rgba(56, 189, 248, 0.38);
    border-radius: 10px;
    background: rgba(7, 15, 30, 0.98);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
    z-index: 20;
}

.market-map-rotation-popover[hidden] {
    display: none;
}

.market-map-popover-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.market-map-popover-head > div {
    display: grid;
    gap: 0.15rem;
}

.market-map-popover-head strong {
    color: var(--text-primary);
    font-size: 0.88rem;
}

.market-map-popover-head span {
    color: var(--text-muted);
    font-size: 0.65rem;
}

.market-map-popover-head button {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
}

.market-map-popover-list {
    display: grid;
    gap: 0.35rem;
    max-height: 280px;
    overflow-y: auto;
    padding: 0.65rem;
}

.market-map-popover-stock {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 0.1rem 0.55rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.68);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.market-map-popover-stock:hover,
.market-map-popover-stock:focus-visible {
    border-color: rgba(56, 189, 248, 0.48);
    background: rgba(14, 116, 144, 0.16);
}

.market-map-popover-stock strong {
    grid-row: 1 / span 2;
    color: #7dd3fc;
}

.market-map-popover-stock span,
.market-map-popover-stock small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-map-popover-stock span {
    font-size: 0.7rem;
}

.market-map-popover-stock small {
    color: var(--text-muted);
    font-size: 0.62rem;
}

.market-map-rotation-dot span {
    font-size: 0.72rem;
    line-height: 1;
}

.market-map-rotation-dot small {
    position: absolute;
    right: -3px;
    top: -6px;
    min-width: 17px;
    height: 17px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.34);
    color: var(--text-secondary);
    font-size: 0.58rem;
    line-height: 15px;
}

.market-map-rotation-dot.rotate-in {
    border-color: rgba(34, 197, 94, 0.72);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
}

.market-map-rotation-dot.early-watch {
    border-color: rgba(6, 182, 212, 0.7);
    box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.1);
    color: #a5f3fc;
}

.market-map-rotation-dot.hold-leader {
    border-color: rgba(250, 204, 21, 0.66);
    color: #fef08a;
}

.market-map-rotation-dot.rotate-out {
    border-color: rgba(248, 113, 113, 0.72);
    color: #fecaca;
}

.market-map-rotation-label {
    position: absolute;
    transform: translateX(-50%);
    max-width: 150px;
    color: rgba(226, 232, 240, 0.76);
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-align: center;
    z-index: 1;
    pointer-events: none;
}

.market-map-action-tape {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.market-map-action-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.74rem;
}

.market-map-action-head strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.market-map-action-row {
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-left-width: 4px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
    padding: 0.74rem;
}

.market-map-action-row.rotate-in {
    border-left-color: #22c55e;
}

.market-map-action-row.early-watch {
    border-left-color: #06b6d4;
}

.market-map-action-row.hold-leader {
    border-left-color: #facc15;
}

.market-map-action-row.rotate-out {
    border-left-color: #f87171;
}

.market-map-action-row strong,
.market-map-action-row span,
.market-map-action-row small {
    min-width: 0;
}

.market-map-action-row strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.82rem;
}

.market-map-action-row div > span {
    display: block;
    margin-top: 0.16rem;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.market-map-action-row small {
    display: block;
    margin-top: 0.48rem;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 800;
}

.market-map-action-proof {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 0.55rem;
}

.market-map-action-proof span {
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-secondary);
    padding: 0.16rem 0.42rem;
    font-size: 0.64rem;
    font-weight: 800;
}

.market-map-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
    gap: 1rem;
}

.market-map-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.95rem;
}

.market-map-panel-head h2 {
    font-size: 1.12rem;
}

.market-map-heat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.7rem;
}

.market-map-heat-card {
    min-width: 0;
    min-height: 150px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-primary);
    padding: 0.85rem;
    text-align: left;
    cursor: default;
    font: inherit;
}

.market-map-heat-rank,
.market-map-heat-meta,
.market-map-heat-foot {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.market-map-heat-card strong {
    display: block;
    margin: 0.34rem 0 0.28rem;
    font-size: 0.98rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.market-map-strength-track {
    display: block;
    height: 7px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.15);
    overflow: hidden;
    margin: 0.75rem 0;
}

.market-map-strength-track span {
    display: block;
    height: 100%;
    background: #94a3b8;
}

.market-map-heat-foot {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: center;
}

.market-map-heat-foot span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.market-map-strength-leader {
    border-color: rgba(16, 185, 129, 0.42);
    background: rgba(16, 185, 129, 0.075);
}

.market-map-strength-strong {
    border-color: rgba(6, 182, 212, 0.38);
    background: rgba(6, 182, 212, 0.065);
}

.market-map-strength-neutral {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.06);
}

.market-map-strength-weak {
    border-color: rgba(239, 68, 68, 0.36);
    background: rgba(239, 68, 68, 0.055);
}

.market-map-strength-leader .market-map-strength-track span { background: #10b981; }
.market-map-strength-strong .market-map-strength-track span { background: #06b6d4; }
.market-map-strength-neutral .market-map-strength-track span { background: #f59e0b; }
.market-map-strength-weak .market-map-strength-track span { background: #ef4444; }

.market-map-rank-list {
    display: grid;
    gap: 1rem;
}

.market-map-rank-group h3 {
    margin: 0 0 0.55rem;
    color: var(--text-secondary);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.market-map-rank-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 8px;
    padding: 0.62rem 0.7rem;
    margin-top: 0.45rem;
}

.market-map-rank-row strong,
.market-map-rank-row span {
    display: block;
    min-width: 0;
}

.market-map-rank-row strong {
    color: var(--text-primary);
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.market-map-rank-row span {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.market-map-rank-row em {
    flex: 0 0 auto;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-style: normal;
    font-weight: 800;
}

.market-map-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.market-map-chart-box {
    height: 320px;
    min-height: 320px;
}

.market-map-chart-box canvas {
    width: 100% !important;
    height: 100% !important;
}

.market-map-score-pill {
    display: inline-flex;
    min-width: 54px;
    justify-content: center;
    border-radius: 999px;
    padding: 0.18rem 0.52rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 800;
}

.market-map-score-pill.market-map-strength-leader { color: #86efac; }
.market-map-score-pill.market-map-strength-strong { color: #67e8f9; }
.market-map-score-pill.market-map-strength-neutral { color: #fcd34d; }
.market-map-score-pill.market-map-strength-weak { color: #fca5a5; }

.market-map-table {
    min-width: 980px;
}

.market-map-ticker-cell {
    white-space: normal;
    max-width: 360px;
}

.theme-leader-chip.market-intel-leader-chip {
    border-color: rgba(34, 197, 94, 0.46);
    background: rgba(34, 197, 94, 0.10);
}

.theme-leader-chip.market-intel-leader-chip:hover {
    border-color: rgba(34, 197, 94, 0.68) !important;
    background: rgba(34, 197, 94, 0.16) !important;
}

.theme-leader-chip .market-intel-mini-badge {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.20);
    border: 1px solid rgba(34, 197, 94, 0.42);
    border-radius: 999px;
    padding: 1px 5px;
    font-family: var(--font-body);
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.25;
}

.market-intel-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.market-intel-title-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(34, 197, 94, 0.42);
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
    padding: 2px 8px;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.35;
}

.market-intel-stage2-card {
    border: 1px solid rgba(34, 197, 94, 0.24);
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.08);
    padding: 8px;
    margin: 0 0 10px;
}

.market-intel-stage2-head {
    color: #86efac;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.market-intel-stage2-row {
    display: block;
    color: inherit;
    text-decoration: none;
    padding: 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.market-intel-stage2-row:hover .market-intel-stage2-title {
    color: #bbf7d0;
}

.market-intel-stage2-title {
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.35;
}

.market-intel-stage2-meta {
    color: var(--text-muted);
    font-size: 0.66rem;
    line-height: 1.35;
    margin-top: 2px;
}

.theme-extension-badge {
    border: 1px solid rgba(245, 158, 11, 0.25);
    background: rgba(245, 158, 11, 0.08);
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    color: #fcd34d;
    font-size: 0.72rem;
}

@media (max-width: 980px) {
    .theme-command-center {
        grid-template-columns: 1fr;
    }

    .theme-hero-header {
        flex-direction: column;
    }

    .theme-context-strip {
        grid-template-columns: 1fr;
    }

    .theme-regime-body {
        align-items: flex-start;
    }

    .market-map-command,
    .market-map-grid,
    .market-map-chart-grid,
    .market-map-flow-grid {
        grid-template-columns: 1fr;
    }

    .market-map-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .market-map-chart-box {
        height: 280px;
        min-height: 280px;
    }

    .market-map-rotation-board {
        min-height: 330px;
    }
}

@media (max-width: 560px) {
    .market-map-kpi-grid,
    .market-map-heat-grid {
        grid-template-columns: 1fr;
    }

    .market-map-regime-main {
        align-items: flex-start;
    }

    .market-map-heat-foot {
        align-items: flex-start;
        flex-direction: column;
    }

    .market-map-heat-foot span:last-child {
        white-space: normal;
    }

    .market-map-rotation-head,
    .market-map-flow-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .market-map-window-toggle {
        width: 100%;
    }

    .market-map-window-toggle button {
        flex: 1 1 0;
    }

    .market-map-flow-route {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .market-map-flow-arrow {
        transform: rotate(90deg);
    }

    .market-map-flow-footer span {
        white-space: normal;
    }

    .market-map-rotation-board {
        min-height: 300px;
    }

    .market-map-rotation-label {
        display: none;
    }

    .market-map-action-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.2rem;
    }
}

/* Focused Paper Trading Dashboard */
.shadow-mode-panel {
    margin-top: 1rem;
    padding: 1.25rem;
    border-color: rgba(32, 199, 231, 0.28) !important;
    background: linear-gradient(135deg, rgba(8, 25, 38, 0.98), rgba(8, 18, 30, 0.98)) !important;
}
.swing-shadow-panel { margin-top: 1rem; }
.shadow-inline-meta { color: var(--text-secondary); font-size: .68rem; font-weight: 500; margin-left: .4rem; }
.shadow-mode-header { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; }
.shadow-mode-header h2 { margin:.15rem 0 .35rem; font-size:1.08rem; }
.shadow-mode-header p { margin:0; max-width:720px; color:var(--text-secondary); font-size:.82rem; line-height:1.5; }
.shadow-mode-eyebrow { color:var(--accent-cyan); font:700 .65rem var(--font-mono); letter-spacing:.12em; }
.shadow-mode-actions { display:flex; align-items:center; gap:.6rem; flex-shrink:0; }
.shadow-safety-badge { padding:.42rem .62rem; border:1px solid rgba(16,185,129,.42); border-radius:999px; background:rgba(16,185,129,.11); color:#6ee7b7; font:700 .68rem var(--font-mono); letter-spacing:.04em; white-space:nowrap; }
.shadow-mode-state { display:flex; align-items:center; gap:.7rem; margin-top:1rem; padding:.75rem .85rem; border:1px solid var(--console-rule); border-radius:6px; background:rgba(7,17,27,.72); }
.shadow-mode-state > div { display:grid; gap:.14rem; }
.shadow-mode-state strong { font-size:.82rem; }
.shadow-mode-state span:not(.shadow-status-dot) { color:var(--text-secondary); font-size:.75rem; }
.shadow-mode-state.active { border-color:rgba(16,185,129,.3); }
.shadow-mode-state.error { border-color:rgba(239,68,68,.35); }
.shadow-status-dot { width:9px; height:9px; border-radius:50%; background:#64748b; flex:0 0 auto; }
.shadow-status-dot.active { background:#34d399; box-shadow:0 0 0 4px rgba(52,211,153,.11); }
.shadow-status-dot.waiting { background:#f59e0b; box-shadow:0 0 0 4px rgba(245,158,11,.1); }
.shadow-status-dot.error { background:#ef4444; box-shadow:0 0 0 4px rgba(239,68,68,.1); }
.shadow-kpi-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.65rem; margin-top:.8rem; }
.shadow-kpi-grid > div { display:grid; gap:.25rem; padding:.7rem .8rem; border:1px solid var(--console-rule); border-radius:5px; background:#07111b; }
.shadow-kpi-grid span { color:var(--text-muted); font-size:.68rem; text-transform:uppercase; letter-spacing:.04em; }
.shadow-kpi-grid strong { font:700 1rem var(--font-mono); color:var(--text-primary); }
.shadow-funnel { display:flex; align-items:stretch; gap:.45rem; margin-top:.8rem; overflow-x:auto; }
.shadow-funnel-step { min-width:130px; flex:1; display:flex; align-items:center; justify-content:space-between; gap:.6rem; padding:.62rem .72rem; border:1px solid rgba(32,199,231,.18); border-radius:5px; background:rgba(32,199,231,.045); }
.shadow-funnel-step span { color:var(--text-secondary); font-size:.72rem; }
.shadow-funnel-step strong { color:var(--accent-cyan); font:700 .85rem var(--font-mono); }
.shadow-funnel-arrow { align-self:center; color:#3b647b; }
.shadow-mode-detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:.8rem; margin-top:.85rem; }
.shadow-mode-detail-grid > div { padding:.8rem; border:1px solid var(--console-rule); border-radius:5px; background:rgba(7,17,27,.72); min-width:0; }
.shadow-mode-detail-grid h3 { margin:0 0 .55rem; color:var(--text-secondary); font-size:.75rem; text-transform:uppercase; letter-spacing:.04em; }
.shadow-list { display:grid; gap:.35rem; max-height:190px; overflow:auto; }
.shadow-list-row { display:flex; justify-content:space-between; align-items:center; gap:.8rem; padding:.48rem .55rem; border-bottom:1px solid rgba(148,163,184,.1); font-size:.74rem; }
.shadow-list-row span { color:var(--text-secondary); overflow:hidden; text-overflow:ellipsis; }
.shadow-list-row strong { color:var(--text-primary); font-family:var(--font-mono); white-space:nowrap; }
.shadow-list-row.candidate strong { color:#6ee7b7; }
.shadow-empty { padding:.65rem .25rem; color:var(--text-muted); font-size:.74rem; }
@media (max-width: 760px) {
    .shadow-mode-header { flex-direction:column; }
    .shadow-mode-actions { width:100%; justify-content:space-between; }
    .shadow-kpi-grid { grid-template-columns:1fr 1fr; }
    .shadow-funnel { display:grid; grid-template-columns:1fr 1fr; overflow:visible; }
    .shadow-funnel-step { min-width:0; }
    .shadow-funnel-arrow { display:none; }
    .shadow-mode-detail-grid { grid-template-columns:1fr; }
}
.focus-dashboard::before {
    background:
        radial-gradient(ellipse at 12% 0%, rgba(6,182,212,0.08) 0%, transparent 42%),
        radial-gradient(ellipse at 82% 8%, rgba(16,185,129,0.07) 0%, transparent 36%),
        linear-gradient(180deg, rgba(15,23,42,0.35), rgba(10,14,23,0));
}

.focus-top-bar {
    padding: 0.8rem 1.6rem;
}

.focus-logo {
    gap: 0.75rem;
}

.logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: #67e8f9;
    font-family: var(--font-mono);
    font-weight: 700;
}

.logo-subtitle {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
    margin-top: -0.15rem;
}

.compact-select {
    min-width: 155px;
    margin-right: 0;
    cursor: pointer;
    padding: 0.42rem 0.7rem;
}

.focus-shell {
    max-width: 1520px;
}

.focus-overview {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
    margin-bottom: 1.2rem;
    padding: 1.25rem 1.35rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.62);
}

.focus-overview h2 {
    margin: 0.25rem 0 0.35rem;
    font-size: 1.75rem;
    letter-spacing: 0;
}

.focus-overview p {
    max-width: 760px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.focus-overview-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.focus-overview-actions .btn:not(.btn-primary) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.focus-tabs {
    margin-bottom: 1.3rem;
}

.focus-tabs .tab {
    min-width: 155px;
    justify-content: center;
}

.focus-dashboard .theme-command-center {
    grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.7fr);
}

.focus-dashboard .theme-hero-card,
.focus-dashboard .theme-panel,
.focus-dashboard .table-card,
.focus-dashboard .trader-controls,
.focus-dashboard .trader-settings-card {
    border-radius: 8px;
}

.focus-dashboard .theme-map-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (max-width: 1120px) {
    .focus-top-bar,
    .top-bar-right,
    .focus-overview {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-bar-right {
        width: 100%;
        gap: 0.7rem;
    }

    .focus-overview-actions {
        justify-content: flex-start;
    }

    .focus-dashboard .theme-command-center {
        grid-template-columns: 1fr;
    }
}

/* Premium Settings Layout & Tooltips */
.setting-desc {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.setting-desc label {
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    white-space: normal !important; /* 防止繼承 .setting-row label 的 nowrap 導致撐開版面 */
}

.setting-desc span {
    font-size: 0.7rem !important;
    color: var(--text-secondary) !important;
    white-space: normal !important;
    line-height: 1.4;
}

#tab-trader .rules-panel-body .setting-row {
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    align-items: flex-start;
}

#tab-trader .rules-panel-body .setting-row:last-child {
    border-bottom: none;
}

#tab-trader .rules-panel-body .setting-row select {
    width: 150px !important;
    min-width: 150px !important;
    flex-shrink: 0;
    box-sizing: border-box;
}

#tab-trader .rules-panel-body .setting-row[style*="display: block"] select {
    width: 100% !important;
    min-width: 0 !important;
}

#tab-trader .rules-panel-body .setting-row input[type="checkbox"] {
    align-self: center;
    flex-shrink: 0;
}

#tab-trader .rules-panel-body .settings-inline-grid {
    grid-template-columns: 1fr; /* Make them stack beautifully with descriptions */
    gap: 0;
}

@media (min-width: 768px) {
    #tab-trader .rules-panel-body .settings-inline-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 24px;
    }
}

/* Cross-Theme Leader Tape Responsive Optimization */
.theme-leader-tape {
    table-layout: fixed;
    width: 100% !important;
    font-size: 0.74rem !important; /* 稍微縮小字體以在一屏塞入更多內容 */
}

.theme-leader-tape th,
.theme-leader-tape td {
    padding: 0.35rem 0.25rem !important; /* 收窄 padding */
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 指定每欄的寬度百分比/像素 */
.theme-leader-tape th:nth-child(1), /* # */
.theme-leader-tape td:nth-child(1) {
    width: 25px;
}

.theme-leader-tape th:nth-child(2), /* Ticker */
.theme-leader-tape td:nth-child(2) {
    width: 50px;
    font-weight: 700;
}

.theme-leader-tape th:nth-child(3), /* Theme */
.theme-leader-tape td:nth-child(3) {
    text-align: left;
    max-width: 110px;
}

.theme-leader-tape th:nth-child(4), /* Score */
.theme-leader-tape td:nth-child(4) {
    width: 40px;
}

.theme-leader-tape th:nth-child(5), /* RS */
.theme-leader-tape td:nth-child(5) {
    width: 40px;
}

.theme-leader-tape th:nth-child(6),
.theme-leader-tape td:nth-child(6) { width: 55px; }

.theme-leader-tape th:nth-child(7),
.theme-leader-tape td:nth-child(7),
.theme-leader-tape th:nth-child(8),
.theme-leader-tape td:nth-child(8) { width: 42px; }

.theme-leader-tape th:nth-child(9),
.theme-leader-tape td:nth-child(9),
.theme-leader-tape th:nth-child(10),
.theme-leader-tape td:nth-child(10) { width: 54px; }

.theme-leader-tape th:nth-child(11),
.theme-leader-tape td:nth-child(11) { width: 65px; }

@media (max-width: 1440px) {
    /* 隱藏 High% 和 SMA50% 兩欄，確保一般寬度下 100% 不超出 */
    .theme-leader-tape th:nth-child(9),
    .theme-leader-tape td:nth-child(9),
    .theme-leader-tape th:nth-child(10),
    .theme-leader-tape td:nth-child(10) {
        display: none !important;
    }
}

/* ─── Hedge Funds Flow Premium Styles ─── */
.hf-sector-row {
    padding: 4px 0;
    transition: transform 0.2s ease;
}
.hf-sector-row:hover {
    transform: translateX(4px);
}
#hfSectorsContainer {
    max-height: 480px;
    overflow-y: auto;
    padding-right: 6px;
}

/* ─── Split Panel & Interactive Leader Tape Styles ─── */
#themeLeaderTapeCard {
    overflow: hidden;
    width: min(2200px, calc(100vw - 32px));
    margin-left: 50%;
    transform: translateX(-50%);
}

.tape-split-container {
    display: grid;
    grid-template-columns: minmax(360px, 0.75fr) minmax(760px, 2.25fr);
    gap: 14px;
    padding: 0.75rem 1rem 1rem;
    height: clamp(880px, calc(100vh - 200px), 1200px);
    min-height: 800px;
    align-items: stretch;
    overflow: hidden;
}

.tape-table-panel {
    overflow-y: auto;
    height: auto;
    min-height: 0;
    min-width: 0;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
}

#tapeChartPanel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: auto;
    min-height: 0;
    padding: 8px 8px 56px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
}

.tape-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.tape-chart-title-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    min-width: 0;
}

.tape-chart-title-stack h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--accent-cyan);
    min-width: 120px;
}

.tape-symbol-form {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.tape-symbol-input {
    width: 150px;
    height: 30px;
    padding: 5px 9px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(15, 23, 42, 0.86);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    outline: none;
}

.tape-symbol-input:focus {
    border-color: rgba(6, 182, 212, 0.55);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.12);
}

.tape-symbol-submit {
    height: 30px;
    padding: 4px 9px !important;
    font-size: 0.72rem !important;
    border-color: rgba(6,182,212,0.3) !important;
    color: var(--accent-cyan) !important;
}

#tapeChartContainer {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.buy-info-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 40;
    width: min(520px, calc(100% - 20px));
    padding: 8px;
    border-radius: 7px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(2, 6, 23, 0.88);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

.buy-info-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.buy-info-ready .buy-info-head {
    color: #86efac;
}

.buy-info-gap .buy-info-head,
.buy-info-missing .buy-info-head {
    color: #fbbf24;
}

.buy-info-head strong {
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.buy-info-gates {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.buy-info-gate {
    min-width: 0;
    padding: 7px;
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.72);
}

.buy-info-gate.gate-pass {
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(22, 101, 52, 0.42);
}

.buy-info-gate.gate-fail {
    border-color: rgba(239, 68, 68, 0.62);
    background: rgba(127, 29, 29, 0.52);
}

.buy-info-gate.gate-wait {
    border-color: rgba(245, 158, 11, 0.58);
    background: rgba(120, 53, 15, 0.52);
}

.buy-info-gate-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 17px;
    margin-bottom: 4px;
    border-radius: 999px;
    font-size: 0.58rem;
    font-weight: 900;
    font-family: var(--font-mono);
}

.gate-pass .buy-info-gate-state {
    color: #052e16;
    background: #86efac;
}

.gate-wait .buy-info-gate-state {
    color: #451a03;
    background: #fbbf24;
}

.gate-fail .buy-info-gate-state {
    color: #450a0a;
    background: #fca5a5;
}

.buy-info-gate strong {
    display: block;
    color: #f8fafc;
    font-size: 0.72rem;
    line-height: 1.1;
}

.buy-info-gate small {
    display: block;
    margin-top: 3px;
    color: rgba(226, 232, 240, 0.82);
    font-size: 0.59rem;
    font-family: var(--font-mono);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 760px) {
    .buy-info-overlay {
        width: calc(100% - 16px);
        top: 8px;
        left: 8px;
    }

    .buy-info-gates {
        grid-template-columns: 1fr;
    }
}

.tape-row {
    cursor: pointer;
    transition: background 0.15s ease, border-left 0.15s ease;
}

tr.tape-row:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Keep decision diagnostics after the legacy chart rules in cascade order. */
.buy-info-overlay {
    top: 12px;
    width: min(430px, calc(50% - 18px));
    padding: 10px;
    pointer-events: auto;
    backdrop-filter: blur(10px);
}
.buy-info-swing { left: 12px; right: auto; }
.buy-info-day { left: auto; right: 12px; }
.buy-info-head { align-items: flex-start; margin-bottom: 8px; text-transform: none; letter-spacing: 0; }
.buy-info-head > div { display: grid; gap: 2px; }
.buy-info-head > div > strong { font-size: 0.9rem; }
.buy-info-mode { color: var(--text-muted); font-size: 0.6rem; letter-spacing: 0.08em; }
.buy-info-progress { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.66rem; white-space: nowrap; }
.buy-info-next { display: grid; gap: 2px; margin-bottom: 8px; padding: 7px 8px; border-left: 3px solid #f59e0b; background: rgba(245, 158, 11, 0.12); }
.buy-info-next.is-ready { border-left-color: #22c55e; background: rgba(34, 197, 94, 0.12); }
.buy-info-next span { color: var(--text-muted); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.06em; }
.buy-info-next strong { color: var(--text-primary); font-size: 0.72rem; line-height: 1.25; }
.buy-info-gates { display: grid; grid-template-columns: 1fr; gap: 5px; }
.buy-info-gate { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: start; gap: 8px; padding: 7px 8px; background: rgba(15, 23, 42, 0.82); }
.buy-info-gate-state { min-width: 0; width: 58px; height: 20px; margin: 0; }
.buy-info-gate strong { font-size: 0.72rem; }
.buy-info-gate small { white-space: normal; overflow: visible; text-overflow: clip; font-family: var(--font-sans); font-size: 0.64rem; line-height: 1.25; }
.buy-info-need { color: #fcd34d !important; }
.gate-pass .buy-info-need { color: #86efac !important; }
.tape-chart-control-row { align-items: stretch; }
.indicator-toggle { display: inline-grid; gap: 1px; min-width: 92px; text-align: left; }
.indicator-toggle small { color: var(--text-muted); font-size: 0.56rem; font-weight: 500; line-height: 1.1; }
.indicator-toggle[aria-pressed="true"] small { color: inherit; opacity: 0.8; }

@media (max-width: 900px) {
    .buy-info-overlay { width: calc(100% - 24px); }
    .buy-info-day { top: 304px; left: 12px; right: auto; }
}

tr.tape-row.active-row {
    background: rgba(59, 130, 246, 0.16) !important;
    border-left: 3px solid var(--accent-cyan) !important;
}

tr.tape-row.active-row td {
    color: var(--text-primary) !important;
    font-weight: 700;
}

.theme-leader-chip {
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.theme-leader-chip:hover {
    background: rgba(59, 130, 246, 0.15) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
    transform: translateY(-1px);
}

.theme-leader-chip.active-chip {
    border-color: var(--accent-cyan) !important;
    background: rgba(6, 182, 212, 0.18) !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3) !important;
    transform: none !important;
}

.theme-leader-chip.active-chip span {
    color: var(--accent-cyan) !important;
    font-weight: 600;
}

.theme-leader-chip.fully-qualified-chip:not(.active-chip) {
    border-color: rgba(16, 185, 129, 0.45) !important;
    background: rgba(16, 185, 129, 0.08) !important;
    color: #a7f3d0 !important;
}

.theme-leader-chip.fully-qualified-chip:not(.active-chip) span {
    color: #34d399 !important;
}

@media (max-width: 1024px) {
    .tape-split-container {
        display: flex;
        flex-direction: column !important;
        height: auto !important;
    }
    #tapeChartPanel {
        height: clamp(540px, calc(100vh - 120px), 680px) !important;
        margin-top: 10px;
        padding-bottom: 60px;
    }
    .tape-chart-header {
        align-items: stretch;
        flex-direction: column;
    }
    .tape-symbol-form,
    .tape-symbol-input {
        width: 100%;
    }
    .tape-symbol-input {
        flex: 1 1 auto;
        min-width: 0;
    }
    .tape-symbol-submit {
        flex: 0 0 auto;
    }
}

/* Chart Timeframe Selector Styles */
.tape-timeframe-dock {
    position: static;
    flex: 0 0 auto;
    align-self: flex-start;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding: 5px 7px;
    background: rgba(3, 7, 18, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 6px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(8px);
}

.tf-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #f8fafc;
    padding: 4px 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.tf-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.tf-btn.active {
    background: rgba(6, 182, 212, 0.12) !important;
    color: var(--accent-cyan) !important;
    border-color: rgba(6, 182, 212, 0.25) !important;
}

.tf-calendar-btn {
    margin-left: 4px;
    padding-inline: 7px;
    border-left-color: rgba(148, 163, 184, 0.18);
}

@media (max-width: 1024px) {
    .tape-timeframe-dock {
        max-width: 100%;
        overflow-x: auto;
    }
}

.tape-chart-control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    padding: 5px 6px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    align-items: center;
}

.tape-control-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0 4px;
}

.indicator-toggle {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: var(--text-secondary);
    padding: 4px 9px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 999px;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.indicator-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: rgba(148, 163, 184, 0.28);
}

.indicator-toggle.active {
    background: rgba(6, 182, 212, 0.14);
    color: #67e8f9;
    border-color: rgba(6, 182, 212, 0.34);
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.08) inset;
}

.indicator-toggle.unavailable,
.indicator-toggle.unavailable:hover {
    opacity: 0.38;
    cursor: not-allowed;
    background: rgba(15, 23, 42, 0.46);
    color: var(--text-muted);
    border-color: rgba(148, 163, 184, 0.1);
    box-shadow: none;
}

.tape-chart-legend {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding: 2px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    align-items: center;
    justify-content: flex-start;
    color: var(--text-secondary);
}

.tape-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.tape-legend-swatch {
    display: inline-block;
    width: 13px;
    height: 3px;
    border-radius: 1px;
}

@keyframes spin-anim {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.spin-animation {
    animation: spin-anim 1.5s linear infinite;
}
#pipelineRefreshBtn:hover {
    color: var(--text-primary) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

/* ─── Intraday Strategy Styling ─── */
.console-log-wrapper {
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.85);
}

.console-log-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.console-log-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.console-log-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.console-log-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-header-toggle {
    display: none;
    align-items: center;
    gap: 0.35rem;
    min-height: 34px;
    padding: 0.4rem 0.65rem;
    border: 1px solid rgba(6, 182, 212, 0.28);
    border-radius: 999px;
    background: rgba(6, 182, 212, 0.1);
    color: #67e8f9;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mobile-header-toggle:hover {
    background: rgba(6, 182, 212, 0.16);
    border-color: rgba(6, 182, 212, 0.42);
    color: #d7fbff;
}

#mobileHeaderToggleIcon {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1;
}

@media (max-width: 768px) {
    .mobile-header-toggle {
        display: inline-flex;
        flex-shrink: 0;
    }

    .mobile-header-controls {
        max-height: 360px;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        transition: max-height 0.18s ease, opacity 0.18s ease, visibility 0.18s ease;
    }

    body.mobile-header-collapsed .focus-top-bar {
        gap: 0;
    }

    body.mobile-header-collapsed .mobile-header-controls {
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
}

/* ═══════════════════════════════════════════════════
   Strategy Details Styling
   ═══════════════════════════════════════════════════ */
.strategy-details-wrap {
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
}

.strategy-header {
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.strategy-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0;
    background: linear-gradient(135deg, #fff 30%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.strategy-header p {
    font-size: 1rem;
    color: var(--text-muted);
    margin: 0;
}

.strategy-section {
    margin-bottom: 3rem;
}

.strategy-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
}

.strategy-section-title h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.strategy-badge {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.strategy-badge.cyan {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.strategy-badge.green {
    background: rgba(34, 197, 94, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.strategy-badge.orange {
    background: rgba(249, 115, 22, 0.12);
    color: var(--accent-orange);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.strategy-badge.purple {
    background: rgba(139, 92, 246, 0.12);
    color: var(--accent-purple);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.strategy-badge.blue {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.strategy-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.strategy-card:hover {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.strategy-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: var(--text-primary);
}

.strategy-card ul {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.strategy-card li {
    margin-bottom: 0.5rem;
}

.strategy-note {
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--accent-orange);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
}

.strategy-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.strategy-item {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1.5rem;
}

.strategy-item h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.strategy-table-wrap {
    overflow-x: auto;
    margin-top: 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
}

.strategy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.strategy-table th, .strategy-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.strategy-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 600;
}

.strategy-table tr:last-child td {
    border-bottom: none;
}

.strategy-card-large {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.strategy-card-large h3 {
    margin: 0 0 1.25rem 0;
    font-size: 1.15rem;
}

.strategy-flow {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.flow-step {
    border-left: 2px solid var(--border-subtle);
    padding-left: 1rem;
    margin-left: 0.5rem;
}

.flow-step h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.flow-step p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ─── Trade Decision & Diagnostics Panel ─── */
.tape-diagnostic-panel {
    background: rgba(15, 23, 42, 0.45);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px;
    height: 250px;
    min-height: 250px;
    flex: 0 0 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

.diagnostic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 6px;
    margin-bottom: 4px;
}

.diagnostic-header h4 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.diagnostic-status-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}
.diagnostic-header-actions { display:flex; align-items:center; gap:7px; }
.diagnostic-close { width:24px; height:24px; padding:0; border:1px solid var(--console-rule-strong); border-radius:4px; background:transparent; color:var(--text-muted); font-size:1.05rem; line-height:1; cursor:pointer; }
.diagnostic-close:hover { color:var(--console-ink); border-color:var(--accent-cyan); }

.status-holding {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.25);
}

.status-candidate {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.25);
}

.status-watching {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.25);
}

.status-paused {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.2);
}

.diagnostic-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
}

.diagnostic-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    height: 100%;
}

.diagnostic-col-title {
    font-size: 0.72rem;
    font-weight: 750;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.04);
    padding-bottom: 4px;
}

/* Entrance gate checklist styling */
.gate-checklist {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 10px;
    overflow-y: auto;
    padding-right: 4px;
}

.gate-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-secondary);
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    min-width: 0;
}

.gate-icon {
    font-size: 0.76rem;
    flex-shrink: 0;
}

.gate-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.gate-value {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Diagnostic active position detail */
.diagnostic-pos-info {
    grid-column: 1 / -1;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.18);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.72rem;
    color: var(--text-primary);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.diagnostic-pos-info strong {
    color: #34d399;
}

.diagnostic-pos-info span {
    color: var(--text-secondary);
}

/* Diagnostic trades list */
.diagnostic-trades-list {
    overflow-y: auto;
    flex: 1 1 auto;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.15);
    padding-right: 2px;
}

.diagnostic-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem;
}

.diagnostic-table th {
    position: sticky;
    top: 0;
    background: rgba(10, 14, 23, 0.95);
    z-index: 10;
    padding: 4px 6px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.diagnostic-table td {
    padding: 4px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.diagnostic-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.diagnostic-table tr:last-child td {
    border-bottom: none;
}

@media (max-width: 1024px) {
    .tape-diagnostic-panel {
        height: auto !important;
        min-height: 0 !important;
    }
    .diagnostic-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
}

/* Dynamic status chip classes for Context Leadership */
.theme-leader-chip.holding-chip:not(.active-chip) {
    border-color: rgba(56, 189, 248, 0.45) !important;
    background: rgba(56, 189, 248, 0.08) !important;
    color: #bae6fd !important;
}

.theme-leader-chip.holding-chip:not(.active-chip) span {
    color: #38bdf8 !important;
}

.theme-leader-chip.early-chip:not(.active-chip) {
    border-color: rgba(245, 158, 11, 0.45) !important;
    background: rgba(245, 158, 11, 0.08) !important;
    color: #fde68a !important;
}

.theme-leader-chip.early-chip:not(.active-chip) span {
    color: #fbbf24 !important;
}

.theme-leader-chip.entry-gap-chip {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    max-width: 220px;
    min-height: 44px;
    white-space: normal;
}

.entry-gap-chip-main {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.1;
}

.entry-gap-chip-note {
    display: block;
    max-width: 100%;
    color: #fcd34d !important;
    font-size: 0.58rem;
    font-weight: 650;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.strategy-watch-group {
    display: grid;
    gap: 0.35rem;
    width: 100%;
    padding: 0.45rem;
    border: 1px solid rgba(148, 163, 184, 0.13);
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.32);
}

.strategy-watch-group + .strategy-watch-group {
    margin-top: 0.35rem;
}

.strategy-watch-group-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 0.62rem;
}

.strategy-watch-group-head strong,
.strategy-watch-group-head span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.strategy-watch-group-head strong {
    color: var(--text-primary);
}

.strategy-watch-group-head span::before {
    content: "›";
    margin-right: 0.35rem;
    color: var(--text-muted);
}

.strategy-watch-group-head small {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--text-muted);
}

.strategy-watch-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.legacy-watch-column {
    display: none !important;
}

.signals-sections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.strategy-watch-board {
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: #06101a;
}

.strategy-watch-board-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.strategy-watch-board-head h4 {
    margin: 0;
    color: #e8f3fb;
    font: 700 0.82rem var(--font-mono);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.strategy-watch-board-head p {
    margin: 0.18rem 0 0;
    color: var(--text-muted);
    font-size: 0.68rem;
}

.strategy-watch-search {
    display: grid;
    grid-template-columns: auto minmax(180px, 260px);
    align-items: center;
    gap: 0.55rem;
    color: var(--text-muted);
    font: 700 0.62rem var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.strategy-watch-search input {
    width: 100%;
    min-height: 34px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 5px;
    background: #091522;
    color: var(--text-primary);
    font: 500 0.72rem var(--font-mono);
    padding: 0 0.65rem;
}

.strategy-watch-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.strategy-watch-tabs button {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.18rem 0.7rem;
    min-height: 60px;
    padding: 0.7rem 1rem;
    border: 0;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
    background: #08131f;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
}

.strategy-watch-tabs button:last-child {
    border-right: 0;
}

.strategy-watch-tabs button::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: transparent;
}

.strategy-watch-tabs button.active {
    background: #0b1926;
    color: #f8fafc;
}

.strategy-watch-tabs button.swing.active::after {
    background: #f59e0b;
}

.strategy-watch-tabs button.day.active::after {
    background: #a78bfa;
}

.strategy-watch-tabs button > span {
    font: 700 0.78rem var(--font-mono);
}

.strategy-watch-tabs button > small {
    grid-column: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted) !important;
    font-size: 0.61rem !important;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.strategy-watch-tabs button > strong {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    min-width: 34px;
    padding: 0.24rem 0.38rem;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.1);
    color: currentColor;
    font: 700 0.72rem var(--font-mono);
    text-align: center;
}

.strategy-watch-workspace {
    display: grid;
    grid-template-columns: 235px minmax(0, 1fr);
    min-height: 320px;
}

.strategy-watch-taxonomy {
    max-height: 430px;
    overflow-y: auto;
    padding: 0.55rem;
    border-right: 1px solid rgba(148, 163, 184, 0.14);
    background: #07111b;
}

.strategy-watch-taxonomy-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.12rem 0.55rem;
    width: 100%;
    margin: 0 0 0.28rem;
    padding: 0.55rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
}

.strategy-watch-taxonomy-item:hover,
.strategy-watch-taxonomy-item.active {
    border-color: rgba(56, 189, 248, 0.3);
    background: rgba(56, 189, 248, 0.08);
}

.strategy-watch-taxonomy-item span,
.strategy-watch-taxonomy-item strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.strategy-watch-taxonomy-item span {
    color: var(--text-muted);
    font-size: 0.6rem;
}

.strategy-watch-taxonomy-item strong {
    color: #dbeafe;
    font-size: 0.68rem;
}

.strategy-watch-taxonomy-item small {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    color: var(--text-muted);
    font: 700 0.62rem var(--font-mono);
}

.strategy-watch-results {
    min-width: 0;
    overflow-x: auto;
}

.strategy-watch-columns,
.strategy-watch-row {
    display: grid;
    grid-template-columns: 52px minmax(140px, 1.05fr) minmax(180px, 1.25fr) 86px minmax(180px, 1.35fr);
    align-items: center;
    min-width: 780px;
}

.strategy-watch-columns {
    min-height: 36px;
    padding: 0 0.7rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    color: #71849a;
    font: 700 0.58rem var(--font-mono);
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.strategy-watch-row {
    width: 100%;
    min-height: 62px;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.strategy-watch-row:hover,
.strategy-watch-row:focus-visible {
    background: rgba(56, 189, 248, 0.06);
    outline: none;
}

.strategy-watch-row.active-chip {
    background: rgba(6, 182, 212, 0.12);
    box-shadow: inset 3px 0 0 var(--accent-cyan);
}

.strategy-watch-rank {
    color: #64748b;
    font: 700 0.68rem var(--font-mono);
}

.strategy-watch-stock,
.strategy-watch-classification,
.strategy-watch-setup {
    display: grid;
    gap: 0.16rem;
    min-width: 0;
    padding-right: 0.8rem;
}

.strategy-watch-stock strong {
    color: #7dd3fc;
    font: 800 0.8rem var(--font-mono);
}

.strategy-watch-stock small,
.strategy-watch-classification small,
.strategy-watch-setup small {
    min-width: 0;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.61rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.strategy-watch-classification strong,
.strategy-watch-setup strong {
    min-width: 0;
    overflow: hidden;
    color: #dbeafe;
    font-size: 0.69rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.strategy-watch-setup strong,
.strategy-watch-setup small {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

@media (max-width: 700px) {
    .strategy-watch-columns { display: none; }
    .strategy-watch-row {
        min-width: 0;
        grid-template-columns: 30px minmax(0, 1fr) 74px;
        gap: 8px;
    }
    .strategy-watch-classification { display: none; }
    .strategy-watch-score { grid-column: 3; grid-row: 1; }
    .strategy-watch-setup { grid-column: 2 / -1; }
}

.strategy-watch-score {
    display: grid;
    gap: 0.3rem;
    padding-right: 0.85rem;
}

.strategy-watch-score > strong {
    color: #f8fafc;
    font: 800 0.72rem var(--font-mono);
}

.strategy-watch-score > i {
    display: block;
    height: 3px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(148, 163, 184, 0.14);
}

.strategy-watch-score > i > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #38bdf8;
}

@media (max-width: 900px) {
    .strategy-watch-workspace {
        grid-template-columns: 1fr;
    }

    .strategy-watch-taxonomy {
        display: flex;
        gap: 0.35rem;
        max-height: none;
        overflow-x: auto;
        padding: 0.5rem;
        border-right: 0;
        border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    }

    .strategy-watch-taxonomy-item {
        flex: 0 0 190px;
        margin: 0;
    }
}

@media (max-width: 620px) {
    .signals-sections-grid {
        grid-template-columns: 1fr;
    }

    .strategy-watch-board-head {
        align-items: stretch;
        flex-direction: column;
    }

    .strategy-watch-search {
        grid-template-columns: 1fr;
    }

    .strategy-watch-tabs button {
        min-height: 66px;
        padding: 0.65rem;
    }

    .strategy-watch-tabs button > span {
        font-size: 0.68rem;
    }
}

.chip-status-badge {
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 3px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.1;
}

.chip-status-badge.badge-holding {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.holding-signal-chip .chip-status-badge.badge-holding {
    display: none;
}

.chip-term-badge {
    font-size: 0.55rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.1;
}

.chip-term-badge.term-day {
    background: rgba(244, 114, 182, 0.16);
    color: #f9a8d4;
    border: 1px solid rgba(244, 114, 182, 0.34);
}

.chip-term-badge.term-mid {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.34);
}

.chip-term-badge.term-long {
    background: rgba(56, 189, 248, 0.16);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.34);
}

.chip-term-badge.term-hedge,
.chip-term-badge.term-broker,
.chip-term-badge.term-manual {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.34);
}

.chip-status-badge.badge-ready {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.chip-status-badge.badge-early {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Mobile polish pass for modern iPhones and dense dashboard views. */
@media (max-width: 760px) {
    html {
        font-size: 13.5px;
    }

    body {
        width: 100%;
        max-width: 100vw;
        overflow-x: clip;
    }

    .top-bar,
    .dashboard,
    .card,
    .chart-card,
    .table-card,
    .theme-hero-card,
    .theme-panel,
    .trader-controls,
    .trader-settings-card,
    .market-map-panel,
    .daytrade-config-panel {
        max-width: 100%;
    }

    .focus-top-bar {
        position: sticky;
        align-items: stretch;
        padding: calc(0.7rem + env(safe-area-inset-top, 0px)) max(0.85rem, env(safe-area-inset-left, 0px)) 0.75rem max(0.85rem, env(safe-area-inset-right, 0px));
    }

    .top-bar-left,
    .focus-logo {
        min-width: 0;
    }

    .logo h1 {
        font-size: 1.06rem;
        line-height: 1.1;
        overflow-wrap: anywhere;
    }

    .logo-subtitle {
        font-size: 0.68rem;
        line-height: 1.2;
    }

    .mobile-header-toggle {
        min-width: 76px;
        justify-content: center;
    }

    .top-bar-right.mobile-header-controls {
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
    }

    #pipelineStatusIndicator,
    #marketIntelStatusIndicator,
    #statusIndicator,
    #lastUpdate {
        min-width: 0;
        justify-content: flex-start !important;
        overflow-wrap: anywhere;
    }

    #pipelineStatusIndicator,
    #marketIntelStatusIndicator {
        grid-column: 1 / -1;
        min-height: 40px;
    }

    #pipelineStatusText,
    #marketIntelStatusText,
    .status-text,
    #lastUpdate {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #autoRefreshSelect,
    #langToggleBtn,
    #refreshBtn,
    #authActionBtn {
        width: 100%;
        min-width: 0 !important;
        margin: 0 !important;
        min-height: 42px;
    }

    .dashboard.focus-shell {
        width: 100%;
        padding: 0.85rem max(0.75rem, env(safe-area-inset-left, 0px)) calc(1.4rem + env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-right, 0px));
    }

    .focus-overview {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding: 1rem;
        border-radius: 10px;
    }

    .focus-overview h2 {
        font-size: 1.18rem;
        line-height: 1.22;
    }

    .focus-overview p {
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .focus-tabs {
        margin: 0.85rem 0 1rem;
        padding: 0.3rem;
        border-radius: 10px;
    }

    .focus-tabs .tab {
        min-height: 40px;
        padding: 0.48rem 0.74rem;
        font-size: 0.74rem;
        border-radius: 8px;
    }

    .focus-dashboard .theme-hero-card,
    .focus-dashboard .theme-panel,
    .focus-dashboard .table-card,
    .focus-dashboard .trader-controls,
    .focus-dashboard .trader-settings-card,
    .chart-card,
    .table-card,
    .card {
        border-radius: 10px;
    }

    .theme-hero-card,
    .theme-panel,
    .table-card,
    .chart-card,
    .trader-settings-card,
    .market-map-panel {
        padding: 0.95rem;
    }

    .theme-hero-header,
    .card-header,
    .market-map-panel-head,
    .daytrade-config-header,
    .trader-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .theme-hero-header,
    .theme-regime-body,
    .theme-leader-group-head,
    .card-header,
    .market-map-panel-head,
    .daytrade-config-header,
    .daytrade-config-card-head,
    .trader-controls,
    .trader-controls-left,
    .trader-controls-right {
        min-width: 0;
    }

    .theme-hero-header h2,
    .theme-regime-card h3,
    .market-map-regime-main h2,
    .market-map-leader-card h2,
    .market-map-panel-head h2 {
        font-size: 1rem;
        line-height: 1.25;
    }

    .theme-copy,
    .market-map-regime-main span:not(.market-map-regime-code),
    .market-map-leader-card p,
    .market-map-panel-head span {
        font-size: 0.76rem;
    }

    .theme-context-strip,
    .theme-metric-grid,
    .market-map-kpi-grid,
    .market-intel-summary-grid,
    .trader-summary-grid,
    .settings-inline-grid,
    .settings-toggle-grid,
    .daytrade-config-grid {
        grid-template-columns: 1fr !important;
    }

    .theme-map-grid,
    .theme-leader-board,
    .market-map-command,
    .market-map-grid,
    .market-map-chart-grid,
    .market-map-flow-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    .market-map-flow-card,
    .market-map-heat-card,
    .theme-map-card,
    .theme-leader-group,
    .daytrade-config-card {
        padding: 0.78rem;
        border-radius: 8px;
    }

    .market-map-method-strip {
        gap: 6px;
    }

    .market-map-method-strip span,
    .market-map-flow-meta span,
    .market-map-flow-proof span,
    .theme-regime-pill-row .badge,
    .market-map-regime-pills span,
    .market-map-leader-strip span {
        border-radius: 6px;
        line-height: 1.25;
        white-space: normal;
    }

    .market-map-flow-route {
        font-size: 0.82rem;
    }

    .market-map-chart-box,
    .chart-container {
        height: 260px;
        min-height: 260px;
    }

    .chart-container.chart-tall {
        height: 320px;
        min-height: 320px;
    }

    .market-intel-current {
        grid-template-columns: 1fr;
    }

    .market-intel-actions,
    .market-intel-current-side,
    .focus-overview-actions,
    .trader-controls-right,
    .modal-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .market-intel-actions .search-input,
    .market-intel-actions .market-intel-issue-select,
    .card-header .search-input,
    #themeLeaderSearch,
    #portfolioResults .search-input,
    .compact-select {
        width: 100% !important;
        min-width: 0 !important;
    }

    .theme-leader-chip-row,
    .theme-regime-pill-row,
    .market-map-regime-pills,
    .market-map-leader-strip,
    .market-map-flow-meta,
    .market-map-flow-proof {
        gap: 0.42rem;
    }

    .theme-leader-chip,
    .theme-context-label,
    .theme-risk-badge,
    .market-intel-title-badge {
        max-width: 100%;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .daytrade-config-metrics {
        grid-template-columns: 1fr;
    }

    .daytrade-config-card-head {
        gap: 0.55rem;
    }

    .daytrade-config-card-head .strategy-config-badge,
    .daytrade-config-header .strategy-config-badge {
        align-self: flex-start;
        white-space: normal;
    }

    .table-wrapper {
        margin-inline: -0.25rem;
        padding-bottom: 0.15rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 720px;
    }

    .theme-leader-tape,
    .market-map-table {
        min-width: 760px;
    }

    #tab-trader .data-table,
    #tab-breakout .data-table,
    #tab-industry .data-table,
    #tab-ibkr .data-table {
        min-width: 0;
    }

    #tvModal .tv-modal-content {
        width: 100dvw !important;
        height: 100dvh !important;
        padding: calc(0.65rem + env(safe-area-inset-top, 0px)) max(0.65rem, env(safe-area-inset-left, 0px)) calc(0.65rem + env(safe-area-inset-bottom, 0px)) max(0.65rem, env(safe-area-inset-right, 0px)) !important;
    }

    #tvModal .modal-actions {
        grid-template-columns: 1fr 1fr;
    }

    #tvModal .modal-actions select,
    #tvModal .modal-actions .btn {
        min-width: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 460px) {
    html {
        font-size: 13px;
    }

    .focus-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        gap: 0.42rem;
    }

    .focus-tabs .tab {
        min-width: 0;
        width: 100%;
        white-space: normal;
        line-height: 1.2;
        padding-inline: 0.45rem;
    }

    .top-bar-right.mobile-header-controls {
        grid-template-columns: 1fr;
    }

    #statusIndicator,
    #lastUpdate {
        justify-content: flex-start;
        text-align: left;
    }

    .summary-cards,
    .trader-summary-grid {
        grid-template-columns: 1fr !important;
    }

    .summary-card,
    .trader-summary-grid .summary-card {
        flex-direction: row;
        align-items: center;
        text-align: left;
    }

    .market-map-window-toggle {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .market-map-window-toggle button {
        min-width: 0;
        padding-inline: 0.35rem;
    }

    .market-map-chart-box,
    .chart-container {
        height: 240px;
        min-height: 240px;
    }

    .chart-container.chart-tall {
        height: 290px;
        min-height: 290px;
    }

    .asset-summary-metrics {
        grid-template-columns: 1fr !important;
    }

    #tvModal .modal-actions {
        grid-template-columns: 1fr;
    }
}

/* Reference dashboard: compact institutional hierarchy. */
:root {
    --ref-bg: #02080e;
    --ref-panel: #06111b;
    --ref-panel-alt: #081722;
    --ref-rule: #1a3141;
    --ref-rule-soft: #112735;
    --ref-ink: #e8f3fb;
    --ref-muted: #92a5b6;
    --ref-cyan: #17bde1;
    --ref-green: #35d17a;
    --ref-amber: #f5b642;
    --ref-red: #ff636a;
}

body.focus-dashboard { background: var(--ref-bg); color: var(--ref-ink); }
.focus-top-bar {
    display: grid !important;
    grid-template-columns: auto minmax(320px, 1fr) auto;
    align-items: stretch;
    gap: 1rem;
    min-height: 56px;
    padding: 0 1.15rem;
    border-bottom-color: var(--ref-rule);
    background: #030910;
}
.top-bar-left { align-self: center; }
.focus-logo .logo-mark { width: 30px; height: 30px; border-radius: 3px; }
.logo h1 { font-size: 1rem; letter-spacing: -0.02em; }
.logo-subtitle { display: none; }
.mobile-header-toggle { display: none; }
.focus-top-bar .focus-tabs {
    position: static;
    display: flex !important;
    align-self: stretch;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    scrollbar-width: none;
}
.focus-top-bar .focus-tabs::-webkit-scrollbar { display: none; }
.focus-top-bar .focus-tabs .tab {
    flex: 0 0 auto;
    min-height: 56px;
    padding: 0 1rem;
    color: #c9d7e4;
    font-size: 0.77rem;
    font-weight: 500;
}
.focus-top-bar .focus-tabs .tab::after { right: 1rem; left: 1rem; }
.focus-top-bar .focus-tabs .tab.active { color: var(--ref-cyan); background: transparent; }
.focus-top-bar .focus-tabs .tab.active::after { background: var(--ref-cyan); }
.top-bar-right { align-self: center; flex-wrap: nowrap; }
@media (min-width: 1120px) {
    #pipelineStatusIndicator,
    #marketIntelStatusIndicator,
    #lastUpdate { display: none !important; }
    .top-bar-right .btn,
    .top-bar-right .compact-select { min-height: 32px; font-size: 0.72rem; }
}

.dashboard.focus-shell { max-width: none; padding: 0.75rem 0.9rem 2rem; }
.focus-overview { display: none; }
.reference-dashboard { display: block; }
.reference-market-strip {
    display: grid;
    grid-template-columns: minmax(260px, 1.45fr) minmax(0, 4fr);
    min-height: 96px;
    border: 1px solid var(--ref-rule);
    background: var(--ref-panel);
}
.reference-regime-summary {
    display: grid;
    align-content: center;
    gap: 0.35rem;
    padding: 1rem 1.2rem;
    border-right: 1px solid var(--ref-rule);
}
.reference-label,
.reference-market-metrics span,
.reference-panel-head span,
.reference-portfolio-value-row span,
.reference-exposure span,
.reference-portfolio-metrics span {
    color: var(--ref-muted);
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.065em;
    text-transform: uppercase;
}
.reference-regime-summary strong { color: var(--ref-green); font-size: 1.05rem; letter-spacing: 0.01em; }
.reference-regime-summary small { color: #a9bac8; font-size: 0.74rem; }
.reference-market-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.reference-market-metrics > div { display: grid; align-content: center; gap: 0.38rem; min-width: 0; padding: 0.9rem 1rem; border-right: 1px solid var(--ref-rule); }
.reference-market-metrics > div:last-child { border-right: 0; }
.reference-market-metrics strong { overflow: hidden; color: var(--ref-ink); font-size: 0.94rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.reference-market-metrics > div:first-child strong { color: var(--ref-green); }

.reference-dashboard-grid { display: grid; grid-template-columns: minmax(0, 2.28fr) minmax(300px, 0.98fr); gap: 0.75rem; margin-top: 0.75rem; }
.reference-primary-column,.reference-sidebar { display: grid; align-content: start; gap: 0.75rem; min-width: 0; }
.reference-panel { overflow: hidden; border: 1px solid var(--ref-rule); border-radius: 2px; background: var(--ref-panel); }
.reference-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 42px; padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--ref-rule); }
.reference-panel-head > div { min-width: 0; }.reference-panel-head h2 { margin: 0; color: var(--ref-ink); font-family: 'IBM Plex Sans',sans-serif; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.reference-panel-head span { display: block; margin-top: 0.2rem; text-transform: none; letter-spacing: 0; font-size: 0.68rem; font-weight: 400; }
.reference-text-action { flex: 0 0 auto; padding: 0; border: 0; background: transparent; color: var(--ref-cyan); font-size: 0.71rem; font-weight: 600; }
.reference-text-action:hover { color: #7ceafd; text-decoration: underline; }
.reference-table-wrap { overflow-x: auto; }
.reference-table { width: 100%; min-width: 700px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.reference-table th { padding: 0.56rem 0.7rem; border-bottom: 1px solid var(--ref-rule); color: #9baebe; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.055em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.reference-table td { padding: 0.57rem 0.7rem; border-bottom: 1px solid var(--ref-rule-soft); color: #cbd9e5; font-size: 0.74rem; line-height: 1.15; white-space: nowrap; }
.reference-table tbody tr:last-child td { border-bottom: 0; }.reference-table tbody tr:hover { background: rgba(23,189,225,.045); }
.reference-rank { width: 42px; color: var(--ref-ink) !important; text-align: center; }.reference-context { max-width: 260px; overflow: hidden; color: var(--ref-ink) !important; font-weight: 600; text-overflow: ellipsis; }.reference-score { color: var(--ref-green) !important; font-weight: 600; }
.reference-status,.reference-signal { display: inline-block; padding: 0.17rem 0.36rem; border: 1px solid #264556; border-radius: 2px; color: #b9cad8; font-size: 0.61rem; font-weight: 600; letter-spacing: 0.035em; text-transform: uppercase; }
.reference-status-dominant,.reference-status-strong,.reference-signal-qualified { border-color: rgba(53,209,122,.46); background: rgba(53,209,122,.08); color: var(--ref-green); }.reference-status-emerging,.reference-signal-watch { border-color: rgba(245,182,66,.45); background: rgba(245,182,66,.07); color: var(--ref-amber); }
.reference-strength { display: block; width: 94px; height: 4px; overflow: hidden; background: #142532; }.reference-strength i { display: block; height: 100%; background: var(--ref-green); }
.reference-ticker { padding: 0; border: 0; background: transparent; color: var(--ref-cyan); font: inherit; font-weight: 700; }.reference-ticker:hover { text-decoration: underline; }.reference-company { max-width: 178px; overflow: hidden; text-overflow: ellipsis; }.reference-positive { color: var(--ref-green) !important; }.reference-negative { color: var(--ref-red) !important; }.reference-neutral { color: var(--ref-muted) !important; }.reference-loading { padding: 1.4rem !important; color: var(--ref-muted) !important; text-align: center; }

.reference-sidebar { grid-template-rows: auto 1fr; }.reference-portfolio-panel { padding-bottom: 0.9rem; }.reference-portfolio-value-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 0.75rem; padding: 1rem 0.9rem; }.reference-portfolio-value-row div { display: grid; gap: 0.36rem; }.reference-portfolio-value-row strong { color: var(--ref-ink); font-size: 1.35rem; letter-spacing: -0.03em; }.reference-portfolio-value-row div:last-child strong { font-size: 0.88rem; letter-spacing: 0; }.reference-exposure { display: grid; gap: 0.45rem; padding: 0.8rem 0.9rem; border-top: 1px solid var(--ref-rule); border-bottom: 1px solid var(--ref-rule); }.reference-exposure > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }.reference-exposure > div:first-child strong { color: var(--ref-ink); font-size: 0.77rem; }.reference-exposure-track { height: 6px; overflow: hidden; background: #122530; }.reference-exposure-track span { display: block; height: 100%; background: var(--ref-cyan); transition: width .22s ease; }.reference-portfolio-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 0.8rem; }.reference-portfolio-metrics div { display: grid; gap: 0.28rem; min-height: 56px; padding: 0.65rem 0.9rem; border-right: 1px solid var(--ref-rule); border-bottom: 1px solid var(--ref-rule-soft); }.reference-portfolio-metrics div:nth-child(even) { border-right: 0; }.reference-portfolio-metrics div:nth-last-child(-n+2) { border-bottom: 0; }.reference-portfolio-metrics strong { color: var(--ref-ink); font-size: 0.82rem; }
.reference-activity-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }.reference-activity-list li { position: relative; padding: 0.8rem 0.9rem 0.8rem 1.65rem; border-bottom: 1px solid var(--ref-rule-soft); color: #c3d2de; font-size: 0.74rem; line-height: 1.35; }.reference-activity-list li:last-child { border-bottom: 0; }.reference-activity-list li::before { position: absolute; left: 0.9rem; top: 1.1rem; width: 6px; height: 6px; border-radius: 50%; background: var(--ref-cyan); content: ''; }.reference-activity-list li:first-child::before { background: var(--ref-green); }

/* Preserve the detailed research workspace below the reference decision view. */
#tab-themes > .theme-command-center { margin-top: 1.1rem; }
#tab-themes > #themeLeaderTapeCard { margin-top: 1rem !important; }

@media (max-width: 1100px) {
    .focus-top-bar { grid-template-columns: auto minmax(0,1fr); gap: 0; padding: 0 0.7rem; }
    .focus-top-bar .focus-tabs { grid-column: 1 / -1; order: 3; min-height: 43px; border-top: 1px solid var(--ref-rule); }
    .focus-top-bar .focus-tabs .tab { min-height: 42px; padding-inline: 0.78rem; }
    .top-bar-right { display: none !important; }
    .reference-dashboard-grid { grid-template-columns: minmax(0,1.65fr) minmax(280px,.92fr); }
    .reference-market-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .reference-market-metrics > div:nth-child(3) { border-right: 0; }
}

@media (max-width: 760px) {
    .focus-top-bar { position: sticky; top: 0; z-index: 100; min-height: 52px; padding: 0 0.6rem; }
    .top-bar-left { min-height: 52px; }.mobile-header-toggle { display: inline-flex; }.focus-top-bar .focus-tabs { position: static; order: 3; width: calc(100% + 1.2rem); margin-inline: -0.6rem; padding-inline: 0.6rem; }.focus-top-bar .focus-tabs .tab { min-height: 42px; font-size: 0.7rem; }
    body:not(.mobile-header-collapsed) .focus-top-bar { align-items: start; }.top-bar-right.mobile-header-controls { grid-column: 1 / -1; width: 100%; }
    .dashboard.focus-shell { padding: 0.65rem 0.55rem 1.5rem; }.reference-market-strip { grid-template-columns: 1fr; }.reference-regime-summary { border-right: 0; border-bottom: 1px solid var(--ref-rule); padding: 0.85rem; }.reference-market-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }.reference-market-metrics > div { min-height: 63px; padding: 0.72rem 0.78rem; border-bottom: 1px solid var(--ref-rule); }.reference-market-metrics > div:nth-child(odd) { border-right: 1px solid var(--ref-rule); }.reference-market-metrics > div:nth-child(even) { border-right: 0; }.reference-market-metrics > div:nth-last-child(-n+2) { border-bottom: 0; }
    .reference-dashboard-grid { grid-template-columns: 1fr; }.reference-panel-head { min-height: 46px; padding: 0.66rem 0.75rem; }.reference-panel-head h2 { font-size: 0.72rem; }.reference-text-action { font-size: 0.66rem; }.reference-table { min-width: 650px; }.reference-table th,.reference-table td { padding: 0.55rem 0.6rem; }.reference-portfolio-value-row { padding: 0.9rem 0.75rem; }.reference-portfolio-value-row strong { font-size: 1.18rem; }.reference-exposure,.reference-portfolio-metrics div { padding-inline: 0.75rem; }
    #tab-themes > .theme-command-center { margin-top: 0.8rem; }.theme-command-center,.tape-split-container { grid-template-columns: 1fr !important; }.theme-map-grid { grid-template-columns: 1fr !important; }.trader-controls-right { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }.trader-controls-right > .trader-execution-menu:first-child { grid-column: 1 / -1; }
    input:not([type='checkbox']):not([type='radio']),select { border-radius: 3px !important; }
    input[type='checkbox'],input[type='radio'] { min-width: 18px; min-height: 18px; padding: 0; background: initial !important; }
}

/* Institutional decision-console pass: shared across every dashboard tab. */
:root { --console-bg:#050b12; --console-panel:#09131f; --console-panel-raised:#0d1a28; --console-rule:#1d3143; --console-rule-strong:#2a465d; --console-ink:#edf5fb; --console-muted:#8396a9; --console-cyan:#20c7e7; --console-blue:#318ae8; --console-radius:6px; }
body.focus-dashboard,.focus-dashboard::before { background:var(--console-bg); }
.focus-dashboard::before,.focus-overview::after { display:none; }
.focus-top-bar { position:sticky; top:0; z-index:100; min-height:62px; background:rgba(5,11,18,.97); border-bottom:1px solid var(--console-rule); box-shadow:none; }
.focus-logo .logo-mark { border-radius:5px; background:#0b2432; border-color:#1a687c; color:#8cebf4; }
.logo h1,.card h2,.chart-card h2,.table-card h2,.theme-hero-header h2,.theme-regime-card h3,.trader-controls-left h2 { font-family:'IBM Plex Sans',sans-serif; font-weight:600; letter-spacing:-.015em; }
.top-bar-right { justify-content:flex-end; }
.status-indicator,#pipelineStatusIndicator,#marketIntelStatusIndicator,#lastUpdate { font-size:.7rem !important; color:var(--console-muted) !important; }
.dashboard.focus-shell { max-width:1760px; padding-top:1.15rem; }
.focus-overview { min-height:104px; padding:1.35rem 1.5rem; border-radius:var(--console-radius); background:var(--console-panel); border:1px solid var(--console-rule); box-shadow:none; }
.focus-overview h2 { max-width:900px; font-size:clamp(1.3rem,2vw,1.7rem); }.focus-overview p { margin-top:.45rem; color:var(--console-muted); }.transition-section-kicker { color:var(--console-cyan); }
.focus-tabs { position:sticky; top:62px; z-index:90; display:flex !important; flex-wrap:nowrap; margin:.85rem 0 1rem; border:1px solid var(--console-rule); border-radius:var(--console-radius); background:#07101a; box-shadow:none; }
.focus-tabs .tab { flex:0 0 auto; min-height:44px; padding:.72rem 1.05rem; font-size:.78rem; font-weight:600; color:#91a4b7; }.focus-tabs .tab.active { color:#dffaff; background:rgba(32,199,231,.08); }.focus-tabs .tab.active::after { right:.8rem; left:.8rem; height:2px; background:var(--console-cyan); }
.card,.focus-dashboard .theme-hero-card,.focus-dashboard .theme-panel,.focus-dashboard .table-card,.focus-dashboard .trader-controls,.focus-dashboard .trader-settings-card,.chart-card,.table-card,.market-intel-panel,.asset-summary-card,.strategy-settings-card { border:1px solid var(--console-rule) !important; border-radius:var(--console-radius) !important; background:var(--console-panel) !important; box-shadow:none !important; }
.card:hover { border-color:var(--console-rule-strong) !important; }.card-header,.market-intel-current,.strategy-config-panel-header { border-bottom:1px solid var(--console-rule); }
.theme-command-center { gap:1rem; }.theme-hero-card,.theme-panel { padding:1.15rem !important; }.theme-hero-header { gap:1rem; align-items:flex-start; }.theme-copy,.market-intel-subtitle,.strategy-config-subtitle { color:var(--console-muted) !important; }
.theme-live-badge,.theme-refresh-note,.theme-status,.strategy-config-badge { border-radius:4px !important; border-color:var(--console-rule-strong) !important; background:#0c1e2c !important; }
.theme-context-chip,.theme-metric,.theme-map-card,.theme-leader-group,.signal-col,.asset-summary-metrics div { border-radius:4px !important; background:#07111b !important; border-color:var(--console-rule) !important; box-shadow:none !important; }
.theme-context-chip,.theme-metric { min-height:66px; }.theme-context-chip strong,.theme-metric strong,.card-value,.asset-summary-metrics strong { color:var(--console-ink) !important; }.theme-context-chip span,.theme-metric span,.card-label,.data-table thead th { color:var(--console-muted) !important; }
.theme-map-grid { gap:.55rem; }.theme-map-card { padding:.85rem !important; }.theme-map-card h3 { font-size:.94rem; }.theme-strength-track { background:#142230 !important; }
.table-wrapper,.tape-table-panel,#tapeChartPanel,.market-intel-table-wrap { border-color:var(--console-rule) !important; border-radius:4px !important; background:#07111b !important; }.data-table { font-size:.78rem; }.data-table thead th { background:#0b1723 !important; border-bottom-color:var(--console-rule-strong) !important; font-weight:600; }.data-table td { border-bottom-color:rgba(42,70,93,.65) !important; }.data-table tbody tr:hover { background:rgba(32,199,231,.055) !important; }
.search-input,.compact-select,.tape-symbol-input,input,select { border-radius:4px !important; border-color:var(--console-rule-strong) !important; background:#060f18 !important; color:var(--console-ink) !important; }.btn { border-radius:4px; font-weight:600; }.btn-primary { background:var(--console-blue); box-shadow:none; }.btn-primary:hover { background:#42a0f4; box-shadow:none; }
.summary-card,.trader-summary-grid .summary-card { min-height:132px; border-top:2px solid var(--console-cyan) !important; }.trader-controls { padding:1rem !important; }.trader-controls-right { gap:.55rem !important; }.trader-execution-menu { min-height:48px; border-radius:4px !important; border-color:var(--console-rule) !important; background:#07111b !important; }
.daytrade-config-panel,.strategy-config-panel { border-color:var(--console-rule) !important; background:#07111b !important; border-radius:4px !important; }.empty-state { color:var(--console-muted) !important; border:1px dashed var(--console-rule-strong); border-radius:4px; background:transparent; }.modal-content,.modal-card { border-radius:6px !important; border-color:var(--console-rule-strong) !important; background:var(--console-panel-raised) !important; }
@media (max-width:960px) { .theme-command-center { grid-template-columns:1fr !important; }.theme-map-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; }.focus-overview { min-height:96px; }.trader-controls-left,.trader-controls-right { width:100%; }.trader-controls-right { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:760px) { .focus-top-bar { min-height:56px; }.focus-tabs { top:56px; margin-top:.7rem; }.dashboard.focus-shell { padding-top:.7rem; }.focus-overview { padding:1rem; }.focus-overview h2 { font-size:1.2rem; line-height:1.22; }.focus-overview p { font-size:.79rem; line-height:1.5; }.focus-tabs .tab { min-height:42px; padding-inline:.82rem; }.card-header { align-items:flex-start; }.theme-context-strip,.theme-metric-grid,.theme-map-grid,.signals-sections-grid,.trader-controls-right { grid-template-columns:1fr !important; }.theme-context-chip,.theme-metric { min-height:58px; }.theme-hero-card,.theme-panel,.trader-controls { padding:.85rem !important; }.data-table { min-width:680px; font-size:.74rem; }.table-wrapper { overflow-x:auto; overscroll-behavior-x:contain; }.summary-card,.trader-summary-grid .summary-card { min-height:102px; }.market-intel-actions { align-items:stretch; }.market-intel-actions .search-input,.market-intel-actions .market-intel-issue-select { width:100% !important; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto !important; transition-duration:.01ms !important; animation-duration:.01ms !important; } }

/* Quantum Blazar UI consolidation.
   Visual-only layer: preserves existing controls, data, IDs, and interactions.
   ========================================================================== */
:root {
    --bg-primary: #070d16;
    --bg-secondary: #0b1422;
    --bg-card: rgba(12, 22, 36, 0.88);
    --bg-card-hover: rgba(18, 32, 51, 0.96);
    --text-primary: #eaf1fb;
    --text-secondary: #9aaac0;
    --text-muted: #60728b;
    --border-subtle: rgba(148, 163, 184, 0.13);
    --accent-blue: #3b9dff;
    --accent-cyan: #41d4e8;
    --accent-green: #38c68b;
    --accent-amber: #f5b74d;
    --accent-red: #f06f78;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow-card: 0 14px 34px rgba(0, 0, 0, 0.19);
    --font-main: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.focus-dashboard {
    background: #070d16;
    font-family: var(--font-main);
    letter-spacing: 0.002em;
}

.focus-dashboard::before {
    background:
        radial-gradient(ellipse at 12% -10%, rgba(30, 122, 186, 0.12), transparent 38%),
        radial-gradient(ellipse at 88% 6%, rgba(22, 135, 109, 0.08), transparent 30%),
        linear-gradient(180deg, #091320 0%, #070d16 56%);
}

.focus-top-bar {
    min-height: 68px;
    padding: 0.72rem clamp(1rem, 2.5vw, 2.5rem);
    background: rgba(6, 13, 22, 0.88);
    border-bottom-color: rgba(148, 163, 184, 0.15);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.focus-logo .logo-mark {
    width: 34px;
    height: 34px;
    display: block;
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    background: transparent;
}

.logo h1 {
    color: #f3f7fc;
    background: none;
    -webkit-text-fill-color: currentColor;
    font-family: 'Space Grotesk', var(--font-main);
    font-size: 1.06rem;
    letter-spacing: -0.025em;
}

.logo-subtitle {
    color: #72839b;
    font-size: 0.68rem;
}

.top-bar-right {
    gap: 0.7rem;
}

.status-indicator,
#pipelineStatusIndicator,
#marketIntelStatusIndicator {
    border-radius: 6px !important;
    background: rgba(148, 163, 184, 0.045) !important;
    border-color: rgba(148, 163, 184, 0.13) !important;
}

.btn,
button,
.tab,
.search-input,
select {
    font-family: var(--font-main);
}

.btn {
    min-height: 34px;
    padding: 0.43rem 0.85rem;
    border-radius: 6px;
}

.btn-primary {
    background: #237bda;
    box-shadow: 0 5px 14px rgba(35, 123, 218, 0.22);
}

.btn-primary:hover {
    background: #318cee;
    box-shadow: 0 7px 18px rgba(35, 123, 218, 0.28);
}

.dashboard.focus-shell {
    max-width: 1680px;
    padding: clamp(1rem, 2vw, 1.75rem) clamp(1rem, 2.5vw, 2.5rem) 3rem;
}

.focus-overview {
    position: relative;
    overflow: hidden;
    min-height: 136px;
    padding: 1.5rem 1.65rem;
    border-radius: 10px;
    border-color: rgba(87, 163, 210, 0.18);
    background: linear-gradient(100deg, rgba(13, 31, 49, 0.96), rgba(10, 22, 36, 0.88));
    box-shadow: var(--shadow-card);
}

.focus-overview::after {
    content: '';
    position: absolute;
    right: -8%;
    top: -100%;
    width: 40%;
    height: 280%;
    pointer-events: none;
    background: radial-gradient(ellipse, rgba(65, 212, 232, 0.08), transparent 65%);
}

.focus-overview > * { position: relative; z-index: 1; }

.focus-overview h2 {
    max-width: 850px;
    color: #f0f5fb;
    font-family: 'Space Grotesk', var(--font-main);
    font-size: clamp(1.32rem, 2vw, 1.8rem);
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.focus-overview p {
    max-width: 830px;
    color: #a9b7c9;
    font-size: 0.9rem;
}

.transition-section-kicker {
    color: #68d9e9;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.11em;
}

.focus-tabs {
    gap: 0;
    padding: 0;
    overflow-x: auto;
    border-radius: 8px;
    background: rgba(5, 12, 21, 0.78);
    border-color: rgba(148, 163, 184, 0.14);
    scrollbar-width: none;
}

.focus-tabs::-webkit-scrollbar { display: none; }

.focus-tabs .tab {
    position: relative;
    min-width: 0;
    padding: 0.76rem 1rem;
    color: #91a1b7;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.focus-tabs .tab::after {
    position: absolute;
    content: '';
    right: 0.9rem;
    bottom: 0;
    left: 0.9rem;
    height: 2px;
    background: transparent;
}

.focus-tabs .tab:hover { background: rgba(148, 163, 184, 0.055); }
.focus-tabs .tab.active { color: #eaf7ff; background: rgba(51, 143, 231, 0.10); }
.focus-tabs .tab.active::after { background: #42cce2; }

.card,
.focus-dashboard .theme-hero-card,
.focus-dashboard .theme-panel,
.focus-dashboard .table-card,
.focus-dashboard .trader-controls,
.focus-dashboard .trader-settings-card {
    border-radius: 10px;
    border-color: rgba(148, 163, 184, 0.13);
    background: linear-gradient(155deg, rgba(15, 28, 44, 0.92), rgba(9, 18, 31, 0.9));
    box-shadow: var(--shadow-card);
}

.card:hover { border-color: rgba(94, 189, 224, 0.24); }

.card h2,
.chart-card h2,
.table-card h2 {
    font-family: 'Space Grotesk', var(--font-main);
    font-size: 1.02rem;
    letter-spacing: -0.015em;
}

.theme-context-strip,
.theme-metric-grid {
    gap: 0.6rem;
}

.theme-context-chip,
.theme-metric {
    min-height: 70px;
    padding: 0.7rem 0.78rem;
    border-radius: 7px;
    border-color: rgba(148, 163, 184, 0.12);
    background: rgba(4, 12, 22, 0.3);
}

.theme-context-chip span,
.theme-metric span,
.card-label,
.data-table thead th {
    color: #77899f;
    font-size: 0.65rem;
    letter-spacing: 0.075em;
}

.theme-context-chip strong,
.theme-metric strong {
    color: #e8f3fb;
    font-family: var(--font-mono);
}

.theme-map-grid { gap: 0.75rem; }

.theme-map-card,
.theme-leader-group,
.signal-col {
    border-radius: 8px !important;
    box-shadow: none;
}

.table-wrapper {
    border: 1px solid rgba(148, 163, 184, 0.11);
    border-radius: 7px;
    background: rgba(3, 10, 18, 0.28);
}

.data-table { font-size: 0.78rem; }

.data-table thead th {
    background: rgba(17, 32, 50, 0.98);
    padding: 0.68rem 0.8rem;
}

.data-table td { padding: 0.66rem 0.8rem; }
.data-table tbody tr:hover { background: rgba(48, 146, 222, 0.075); }

#themeLeaderTapeCard {
    width: min(2200px, calc(100vw - clamp(2rem, 5vw, 5rem)));
}

.tape-split-container { gap: 1rem; }

.tape-table-panel,
#tapeChartPanel {
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    background: rgba(4, 12, 22, 0.38);
}

.tape-chart-header { padding: 0.95rem 1rem 0; }
.tape-chart-title-stack h3 { font-family: 'Space Grotesk', var(--font-main); }

.search-input,
.compact-select,
.tape-symbol-input {
    min-height: 34px;
    border-radius: 6px;
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(3, 10, 18, 0.62);
    color: #e5eef9;
}

.search-input:focus,
.compact-select:focus,
.tape-symbol-input:focus {
    border-color: rgba(65, 212, 232, 0.72);
    box-shadow: 0 0 0 3px rgba(65, 212, 232, 0.10);
    outline: none;
}

@media (max-width: 1120px) {
    .focus-top-bar { align-items: stretch; }
    .top-bar-right { width: 100%; }
    .focus-tabs .tab { flex: 0 0 auto; }
    #themeLeaderTapeCard { width: 100%; margin-left: 0; transform: none; }
}

@media (max-width: 760px) {
    .focus-top-bar {
        gap: 0.55rem;
        min-height: 58px;
        padding: calc(0.65rem + env(safe-area-inset-top, 0px)) max(0.8rem, env(safe-area-inset-left, 0px)) 0.6rem max(0.8rem, env(safe-area-inset-right, 0px));
    }

    .logo-mark { width: 31px !important; height: 31px !important; }
    .logo h1 { font-size: 0.98rem; }
    .logo-subtitle { display: none; }

    .mobile-header-toggle {
        min-width: 0;
        min-height: 32px;
        padding: 0.32rem 0.6rem;
        border-radius: 6px;
    }

    .top-bar-right.mobile-header-controls {
        grid-template-columns: 1fr 1fr;
        padding-top: 0.2rem;
    }

    body.mobile-header-collapsed .top-bar-right.mobile-header-controls {
        max-height: 0;
        min-height: 0;
        margin: 0;
        padding-top: 0;
        padding-bottom: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    #pipelineStatusIndicator,
    #marketIntelStatusIndicator { min-height: 36px; }

    .dashboard.focus-shell {
        padding: 0.8rem max(0.7rem, env(safe-area-inset-left, 0px)) calc(1.1rem + env(safe-area-inset-bottom, 0px)) max(0.7rem, env(safe-area-inset-right, 0px));
    }

    .focus-overview {
        min-height: 0;
        padding: 1rem;
        border-radius: 8px;
    }

    .focus-overview h2 { font-size: 1.18rem; }
    .focus-overview p { font-size: 0.8rem; }

    .focus-tabs {
        position: sticky;
        top: calc(58px + env(safe-area-inset-top, 0px));
        z-index: 30;
        margin-top: 0.7rem;
        margin-bottom: 0.85rem;
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
    }

    .focus-tabs .tab {
        min-height: 42px;
        padding: 0.66rem 0.82rem;
        font-size: 0.73rem;
        white-space: nowrap;
    }

    .focus-dashboard .theme-hero-card,
    .focus-dashboard .theme-panel,
    .focus-dashboard .table-card,
    .focus-dashboard .trader-controls,
    .focus-dashboard .trader-settings-card,
    .card { border-radius: 8px; }

    .theme-context-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .theme-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .theme-context-chip,
    .theme-metric { min-height: 62px; padding: 0.6rem; }

    .theme-context-chip strong,
    .theme-metric strong { font-size: 0.92rem; }

    .card-header { gap: 0.6rem; }
    .table-wrapper { border-radius: 6px; }
    .data-table { font-size: 0.75rem; }

    #themeLeaderTapeCard { width: 100%; }
    .tape-split-container { padding: 0.65rem; gap: 0.75rem; }
    .tape-table-panel { max-height: 420px; }
    #tapeChartPanel { height: 510px !important; }
}

@media (max-width: 460px) {
    .top-bar-right.mobile-header-controls { grid-template-columns: 1fr; }
    .focus-tabs { top: calc(55px + env(safe-area-inset-top, 0px)); }
    .theme-context-strip,
    .theme-metric-grid { grid-template-columns: 1fr; }
    .theme-context-chip,
    .theme-metric { min-height: 56px; }
    #tapeChartPanel { height: 470px !important; }
}
/* Market Map research hierarchy */
.market-watch-shell { display:grid; gap:12px; }
.market-watch-header { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; padding:18px 20px; border:1px solid var(--console-rule); border-radius:6px; background:var(--console-panel); }
.market-watch-header h2 { margin:3px 0 4px; color:var(--console-ink); font-size:1.55rem; }
.market-watch-header p { margin:0; color:var(--console-muted); font-size:.8rem; }
.market-watch-header-meta { max-width:48%; color:var(--console-muted); font:.68rem var(--font-mono); text-align:right; }
.market-watch-toolbar { display:grid; grid-template-columns:minmax(180px,1fr) minmax(160px,.8fr) minmax(160px,.65fr) auto; align-items:end; gap:10px; padding:12px; border:1px solid var(--console-rule); border-radius:6px; background:var(--console-panel); }
.market-watch-search,.market-watch-filter { display:grid; gap:5px; color:var(--console-muted); font-size:.66rem; text-transform:uppercase; letter-spacing:.06em; }
.market-watch-search input,.market-watch-filter select { width:100%; min-height:40px; }
.market-watch-shortcuts { min-height:40px; display:grid; align-content:center; justify-items:end; gap:2px; color:var(--console-muted); }
.market-watch-shortcuts span { display:flex; align-items:center; gap:4px; font-size:.68rem; }
.market-watch-shortcuts small { font-size:.62rem; }
.market-watch-shortcuts kbd { min-width:22px; padding:3px 5px; border:1px solid var(--console-rule-strong); border-radius:3px; background:#07111b; color:#bcebf4; font:700 .65rem var(--font-mono); text-align:center; }
.market-watch-workspace { display:grid; grid-template-columns:minmax(310px,360px) minmax(0,1fr); gap:12px; align-items:start; }
.market-watch-list-panel,.market-watch-chart { min-width:0; border:1px solid var(--console-rule); border-radius:6px; background:var(--console-panel); }
.market-watch-list-panel { position:sticky; top:12px; overflow:hidden; }
.market-watch-list-head { min-height:46px; display:flex; align-items:center; justify-content:space-between; padding:0 12px; border-bottom:1px solid var(--console-rule); color:var(--console-ink); font-size:.74rem; }
.market-watch-list-head span { color:var(--console-cyan); font:700 .68rem var(--font-mono); }
.market-watch-list { max-height:calc(100vh - 230px); min-height:620px; overflow:auto; padding:6px; scrollbar-gutter:stable; }
.market-watch-row { width:100%; min-height:64px; display:grid; grid-template-columns:28px 58px minmax(0,1fr) 54px; align-items:center; gap:7px; padding:7px 8px; border:1px solid transparent; border-bottom-color:rgba(42,70,93,.58); border-radius:4px; background:transparent; color:var(--console-ink); text-align:left; cursor:pointer; }
.market-watch-row:hover { background:rgba(32,199,231,.055); }
.market-watch-row.active { border-color:rgba(32,199,231,.62); background:rgba(32,199,231,.1); box-shadow:inset 3px 0 0 var(--console-cyan); }
.market-watch-row:focus-visible { outline:2px solid #7dd3fc; outline-offset:-2px; }
.market-watch-rank { color:var(--console-muted); font:600 .64rem var(--font-mono); }
.market-watch-symbol,.market-watch-industry,.market-watch-score { min-width:0; display:grid; gap:3px; }
.market-watch-symbol strong { color:#dffaff; font:800 .83rem var(--font-mono); letter-spacing:.03em; }
.market-watch-row small { color:var(--console-muted); font-size:.6rem; line-height:1.2; }
.market-watch-industry { color:#b6c7d7; font-size:.68rem; line-height:1.25; }
.market-watch-score { justify-items:end; font-family:var(--font-mono); }
.market-watch-score strong { color:#a5f3fc; font-size:.72rem; }
.market-watch-chart { overflow:hidden; }
.market-watch-row .market-watch-readiness { color:#fbbf24; overflow-wrap:anywhere; }
.market-watch-row .readiness-0 { color:#6ee7b7; }
.market-watch-row .readiness-2 { color:#fda4af; }
.paper-watch-funnel { margin:8px 0 4px; color:#bae6fd; }
.paper-watch-coverage { color:#a7f3d0; }
.paper-watch-coverage[data-coverage="mismatch"] { color:#fda4af; font-weight:700; }
.market-watch-chart #tapeChartPanel { min-height:820px; padding-bottom:58px; border:0 !important; background:#07111b !important; }
.market-watch-chart #tapeChartContainer { min-height:660px; }
.market-watch-chart .tape-chart-control-row { gap:3px; padding-inline:5px; }
.market-watch-chart .indicator-toggle { flex:1 1 auto; min-width:84px; padding-inline:6px; }
.market-map-ticker-button { margin:1px; padding:3px 5px; border:1px solid rgba(32,199,231,.18); border-radius:3px; background:rgba(32,199,231,.08); cursor:pointer; }
.market-map-ticker-button:hover,.market-map-ticker-button:focus-visible { border-color:var(--console-cyan); color:#dffaff; }

@media (max-width:960px) {
  .market-watch-workspace { grid-template-columns:minmax(280px,320px) minmax(0,1fr); }
  .market-watch-row { grid-template-columns:24px 54px minmax(0,1fr); }
  .market-watch-score { display:none; }
}

@media (max-width:760px) {
  .market-watch-header { align-items:flex-start; flex-direction:column; padding:14px; }
  .market-watch-header-meta { max-width:none; text-align:left; }
  .market-watch-toolbar { grid-template-columns:1fr 1fr; }
  .market-watch-shortcuts { grid-column:1 / -1; justify-items:start; }
  .market-watch-workspace { grid-template-columns:1fr; }
  .market-watch-list-panel { position:static; }
  .market-watch-list { min-height:0; max-height:none; display:flex; gap:6px; overflow-x:auto; overflow-y:hidden; padding:7px; scroll-snap-type:x proximity; }
  .market-watch-row { flex:0 0 182px; min-height:76px; grid-template-columns:24px 52px minmax(0,1fr); scroll-snap-align:start; }
  .market-watch-industry { font-size:.62rem; }
  .market-watch-chart #tapeChartPanel { min-height:0; }
  .market-watch-chart #tapeChartContainer { height:clamp(360px,55dvh,520px) !important; min-height:360px; }
}

@media (max-width:460px) {
  .market-watch-toolbar { grid-template-columns:1fr; }
  .market-watch-shortcuts { grid-column:auto; }
}

.market-breadth-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.market-breadth-metric { padding:14px; border:1px solid rgba(74,222,128,.16); border-radius:10px; background:rgba(12,26,42,.72); display:grid; gap:6px; }
.market-breadth-metric span,.market-breadth-metric small { color:var(--text-muted); font-size:.76rem; }
.market-breadth-metric strong { color:#dcecff; font-size:1.35rem; }
.market-breadth-metric i { display:block; height:5px; overflow:hidden; background:rgba(148,163,184,.12); border-radius:999px; }
.market-breadth-metric i b { display:block; height:100%; background:linear-gradient(90deg,#06b6d4,#22c55e); border-radius:inherit; }
.market-map-context-panel #themeMapGrid,.market-map-context-panel #marketMapThemeMapGrid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.market-map-research-panel #tapeChartPanel { min-height:920px; background:transparent; border:0; padding:0; }
.market-map-research-panel #tapeChartIndicatorControls { margin:0 0 8px; padding:7px 9px; gap:6px; border:1px solid var(--console-rule); border-radius:4px; background:#07111b; }
.market-map-research-panel #tapeChartLegend { display:none !important; }
.market-map-research-panel #tapeChartContainer { min-height:760px; }
.market-map-research-panel #tapeChartTimeframes { justify-content:flex-start; overflow-x:auto; }

@media (max-width: 760px) {
  .market-breadth-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .market-breadth-metric { padding:11px; }
  .market-map-context-panel #themeMapGrid,.market-map-context-panel #marketMapThemeMapGrid { grid-template-columns:1fr; }
  .market-map-context-panel #themeMapGrid .theme-map-card:nth-child(n+7),.market-map-context-panel #marketMapThemeMapGrid .theme-map-card:nth-child(n+7) { display:none; }
  .market-map-research-panel #tapeChartPanel { min-height:0 !important; }
  .market-map-research-panel #tapeChartContainer { min-height:430px; height:500px !important; flex:none; }
  .market-map-research-panel .tape-chart-header { gap:10px; align-items:flex-start; }
  .market-map-research-panel #tapeChartResolutions { max-width:100%; overflow-x:auto; }
}
/* Regime-at-a-glance visual and compact trend state. */
.theme-regime-visual { display:flex; align-items:center; gap:18px; margin:14px 0 10px; }
.theme-regime-gauge { --regime-color:var(--accent-cyan); width:78px; height:78px; border-radius:50%; display:grid; place-items:center; align-content:center; gap:1px; background:radial-gradient(circle at center,#07111b 57%,transparent 58%),conic-gradient(var(--regime-color) var(--regime-progress),#1a2d3c 0); box-shadow:inset 0 0 0 1px rgba(148,163,184,.18); }
.theme-regime-gauge strong { color:var(--regime-color); font:700 1.1rem var(--font-mono); }.theme-regime-gauge span { color:var(--text-muted); font-size:.58rem; text-transform:uppercase; letter-spacing:.08em; }
.theme-regime-lane { flex:1; display:grid; grid-template-columns:repeat(4,1fr); gap:5px; position:relative; }.theme-regime-lane::before { content:""; position:absolute; left:8%; right:8%; top:50%; height:2px; background:#1a2d3c; z-index:0; }.theme-regime-lane span { position:relative; z-index:1; justify-self:center; width:31px; height:31px; display:grid; place-items:center; border-radius:50%; border:1px solid #294258; background:#07111b; color:var(--text-muted); font:700 .68rem var(--font-mono); }.theme-regime-lane span.active { color:var(--stage-color); border-color:var(--stage-color); box-shadow:0 0 0 4px color-mix(in srgb,var(--stage-color) 15%,transparent); }
.reference-trend { font:700 .72rem var(--font-mono); white-space:nowrap; }.reference-trend-up { color:#34d399; }.reference-trend-down { color:#fb7185; }.reference-trend-flat { color:var(--text-muted); }
@media (max-width:760px) { .theme-regime-visual { gap:12px; }.theme-regime-gauge { width:64px; height:64px; }.theme-regime-lane span { width:26px; height:26px; font-size:.61rem; } }

/* Scanner action queue belongs beside leadership evidence, not inside chart research. */
.reference-action-queue { margin-top:14px; }.reference-action-queue:empty { display:none; }
#referenceActionQueueMount .leadership-signals-dashboard { display:flex !important; padding:14px !important; gap:12px !important; border:1px solid var(--console-rule-strong) !important; border-radius:6px; background:#07111b !important; }
#referenceActionQueueMount .leadership-signals-dashboard > div:first-child { padding-bottom:10px; border-bottom:1px solid var(--console-rule); }
#referenceActionQueueMount .leadership-signals-dashboard h3 { font:700 .8rem var(--font-mono) !important; letter-spacing:.06em; text-transform:uppercase; }
#referenceActionQueueMount .signals-legend { gap:8px !important; font-size:.65rem !important; }
#referenceActionQueueMount .signals-sections-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:8px !important; }
#referenceActionQueueMount .signal-col { min-height:104px; padding:9px !important; border-radius:4px !important; }
#referenceActionQueueMount .signal-chips-row { display:grid !important; grid-template-columns:repeat(3,minmax(0,1fr)); align-content:start; gap:5px !important; max-height:126px; overflow:auto; padding-right:2px; }
#referenceActionQueueMount .theme-leader-chip.signal-mini-card { position:relative; width:100% !important; min-height:40px; padding:6px 7px 9px !important; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:1px 5px; overflow:hidden; border-radius:4px !important; font-size:.64rem; text-align:left; }
#referenceActionQueueMount .signal-mini-card::after { content:""; position:absolute; height:2px; left:7px; bottom:5px; width:var(--signal-score,0%); max-width:calc(100% - 14px); background:currentColor; opacity:.9; border-radius:99px; }
#referenceActionQueueMount .signal-mini-card strong { font-size:.7rem; letter-spacing:.02em; }
#referenceActionQueueMount .signal-mini-card .chip-status-badge,
#referenceActionQueueMount .signal-mini-card .entry-gap-chip-note { display:none !important; }
@media (max-width:960px) { #referenceActionQueueMount .signals-sections-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; } }
@media (max-width:560px) { #referenceActionQueueMount .signals-sections-grid { grid-template-columns:1fr !important; } #referenceActionQueueMount .signal-chips-row { grid-template-columns:repeat(3,minmax(0,1fr)); } #referenceActionQueueMount .leadership-signals-dashboard { padding:11px !important; } }

/* Keep strategy targets adjacent to the Watch List chart. */
#watchListActionQueueMount { margin-top:12px; }
#watchListActionQueueMount .leadership-signals-dashboard { display:flex !important; padding:12px !important; gap:10px !important; border:1px solid var(--console-rule) !important; border-radius:4px; background:#07111b !important; }
#watchListActionQueueMount .leadership-signals-dashboard > div:first-child { padding-bottom:8px; border-bottom:1px solid var(--console-rule); }
#watchListActionQueueMount .leadership-signals-dashboard h3 { font:700 .75rem var(--font-mono) !important; letter-spacing:.05em; text-transform:uppercase; }
#watchListActionQueueMount .signals-legend { gap:7px !important; font-size:.62rem !important; }
#watchListActionQueueMount .signals-sections-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; gap:7px !important; }
#watchListActionQueueMount .signal-col { min-height:88px; padding:8px !important; border-radius:4px !important; }
#watchListActionQueueMount .signal-chips-row { display:grid !important; grid-template-columns:repeat(3,minmax(0,1fr)); align-content:start; gap:5px !important; max-height:108px; overflow:auto; }
#watchListActionQueueMount .theme-leader-chip.signal-mini-card { position:relative; width:100% !important; min-height:36px; padding:5px 6px 8px !important; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:1px 4px; overflow:hidden; border-radius:4px !important; font-size:.61rem; text-align:left; }
#watchListActionQueueMount .signal-mini-card::after { content:""; position:absolute; height:2px; left:6px; bottom:4px; width:var(--signal-score,0%); max-width:calc(100% - 12px); background:currentColor; opacity:.9; border-radius:99px; }
#watchListActionQueueMount .signal-mini-card strong { font-size:.68rem; letter-spacing:.02em; }
#watchListActionQueueMount .signal-mini-card .chip-status-badge,#watchListActionQueueMount .signal-mini-card .entry-gap-chip-note { display:none !important; }
#watchListActionQueueMount .strategy-watch-paused { grid-column:1 / -1; color:var(--text-muted); font-size:.65rem; font-style:italic; padding:5px 1px; }
@media (max-width:960px) { #watchListActionQueueMount .signals-sections-grid { grid-template-columns:repeat(2,minmax(0,1fr)) !important; } }
@media (max-width:560px) { #watchListActionQueueMount .signals-sections-grid { grid-template-columns:1fr !important; } }

/* Canonical phone layout. Keep this final so legacy mobile layers cannot
   reintroduce full-width tabs, clipped charts, or unreachable header controls. */
@media (max-width: 760px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .focus-top-bar {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 0;
        padding-inline: max(0.65rem, env(safe-area-inset-left, 0px)) max(0.65rem, env(safe-area-inset-right, 0px));
    }

    .focus-top-bar .top-bar-left {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-width: 0;
    }

    .focus-top-bar .focus-tabs {
        grid-column: 1 / -1;
        display: flex !important;
        width: calc(100% + 1.3rem);
        max-width: none;
        margin: 0.45rem -0.65rem 0;
        padding: 0 0.65rem;
        overflow-x: auto;
        overflow-y: hidden;
        border: 0;
        border-top: 1px solid var(--console-rule);
        border-radius: 0;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    .focus-top-bar .focus-tabs .tab {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: max-content !important;
        min-height: 44px;
        padding: 0.7rem 0.9rem;
        white-space: nowrap !important;
        scroll-snap-align: start;
    }

    body:not(.mobile-header-collapsed) .top-bar-right.mobile-header-controls {
        grid-column: 1 / -1;
        display: grid !important;
        width: 100%;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.5rem;
        padding: 0.65rem 0 0.25rem;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.mobile-header-collapsed .top-bar-right.mobile-header-controls {
        display: none !important;
    }

    .dashboard.focus-shell,
    .tab-content,
    .reference-dashboard,
    .reference-dashboard-grid,
    .reference-primary-column,
    .reference-sidebar,
    .market-map-panel,
    .market-map-research-panel,
    .theme-command-center,
    .theme-hero-card,
    .theme-panel,
    .card,
    .chart-card,
    .table-card {
        min-width: 0;
        max-width: 100%;
    }

    .reference-table-wrap,
    .table-wrapper,
    .market-map-table-wrap,
    .tape-table-panel {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        touch-action: pan-x pan-y;
        scrollbar-gutter: stable;
        -webkit-overflow-scrolling: touch;
    }

    .reference-table { min-width: 590px; }
    .data-table { min-width: 620px; }
    .market-map-table { min-width: 680px; }

    .tape-split-container {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible;
    }

    #tapeChartPanel,
    .market-map-research-panel #tapeChartPanel {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible;
        padding-bottom: 0.6rem;
    }

    #tapeChartContainer,
    .market-map-research-panel #tapeChartContainer {
        height: clamp(360px, 55dvh, 520px) !important;
        min-height: 360px !important;
        flex: none;
    }

    .tape-chart-header,
    .tape-chart-title-stack,
    .tape-symbol-form {
        width: 100%;
        min-width: 0;
    }

    .tape-chart-title-stack { align-items: stretch; }
    .tape-symbol-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .tape-symbol-input { width: 100%; min-width: 0; min-height: 44px; }
    .tape-symbol-submit,
    .tf-btn,
    .indicator-toggle,
    #tapeChartIndicatorsBtn,
    #tapeChartDiagnosticsBtn,
    #tapeChartTvBtn {
        min-height: 44px !important;
        padding-inline: 0.8rem !important;
        touch-action: manipulation;
    }

    #tapeChartResolutions,
    #tapeChartIndicatorControls,
    .tape-timeframe-dock {
        flex-wrap: nowrap;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    #tapeChartIndicatorControls { padding-bottom: 0.35rem; }
    .tape-timeframe-dock { align-self: stretch; box-shadow: none; }

    #referenceActionQueueMount .signal-chips-row,
    #watchListActionQueueMount .signal-chips-row {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    #referenceActionQueueMount .theme-leader-chip.signal-mini-card,
    #watchListActionQueueMount .theme-leader-chip.signal-mini-card {
        min-height: 44px;
    }

    #tab-hedgefunds .grid-2col > *,
    #tab-hedgefunds .tree-branches > *,
    #tab-strategy .grid-2col > *,
    #tab-strategy .tree-branches > * {
        width: 100%;
        min-width: 0 !important;
        max-width: 100%;
    }

    #tab-hedgefunds .grid-2col > .theme-panel {
        height: auto !important;
        min-height: 330px;
    }
}

@media (max-width: 460px) {
    body:not(.mobile-header-collapsed) .top-bar-right.mobile-header-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .reference-market-metrics,
    .reference-portfolio-value-row,
    .reference-portfolio-metrics {
        grid-template-columns: minmax(0, 1fr);
    }

    .reference-market-metrics > div,
    .reference-portfolio-metrics div {
        border-right: 0 !important;
    }
}
.discord-alert-test-panel {
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.28);
}

.discord-alert-status {
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.discord-alert-status[data-state="ready"] { color: var(--accent-green); }
.discord-alert-status[data-state="warning"] { color: var(--accent-yellow); }
.discord-alert-status[data-state="error"] { color: var(--accent-red); }

.discord-alert-test-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.discord-alert-test-actions .btn {
    width: 100%;
    border: 1px solid rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.16);
    color: #93c5fd;
}

.discord-alert-test-actions .discord-buy-test {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.14);
    color: #86efac;
}

.discord-alert-test-actions .discord-sell-test {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

@media (max-width: 720px) {
    .discord-alert-test-actions {
        grid-template-columns: 1fr;
    }
}
