/* ═══════════════════════════════════════════════════════════════════
   NEXUS Trading Dashboard – style.css  v8.16.121c (Pro Trader Edition)
   Glassmorphism · Nav Groups · Theme Toggle · FAB · Concentration Warnings
   Animated Counters · Drawdown Chart · Premium Polish
   ═══════════════════════════════════════════════════════════════════ */
:root {
    --bg-primary: #060a13;
    --bg-secondary: #0d1321;
    --bg-card: #131a2b;
    --bg-card-hover: #182040;
    --bg-hover: #1c2744;
    --border: rgba(99,115,155,.18);
    --border-glow: rgba(0,212,170,.25);
    --text-primary: #e8edf5;
    --text-secondary: #8892b0;
    --text-muted: #505a72;
    --accent: #00d4aa;
    --accent-dim: rgba(0,212,170,.10);
    --accent-glow: rgba(0,212,170,.35);
    --positive: #10b981;
    --positive-bg: rgba(16,185,129,.08);
    --negative: #ef4444;
    --negative-bg: rgba(239,68,68,.08);
    --warning: #f59e0b;
    --warning-bg: rgba(245,158,11,.08);
    --info: #8b5cf6;
    --info-bg: rgba(139,92,246,.08);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 30px rgba(0,0,0,.4);
    --shadow-glow: 0 0 20px rgba(0,212,170,.06);
    --glass: rgba(19,26,43,.65);
    --glass-border: rgba(99,115,155,.12);
    --transition: all .25s cubic-bezier(.4,0,.2,1);
    /* Aliases for legacy inline-style references */
    --text: var(--text-primary);
    --red: var(--negative);
    --yellow: var(--warning);
    --green: var(--positive);
    --bg: var(--bg-secondary);
    --card-border: var(--bg-card);
    --success: var(--positive);
    --danger: var(--negative);
    --card: var(--bg-card);
    --primary: var(--accent);
    --blue: #3b82f6;
}

/* ─── LIGHT THEME ─── */
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f5f7;
    --bg-hover: #eef0f3;
    --border: rgba(0,0,0,.08);
    --border-glow: rgba(0,180,150,.25);
    --text-primary: #1a1a2e;
    --text-secondary: #4a5568;
    --text-muted: #8892a0;
    --glass: rgba(255,255,255,.75);
    --glass-border: rgba(0,0,0,.06);
    --shadow: 0 4px 20px rgba(0,0,0,.08);
    --shadow-glow: 0 0 15px rgba(0,180,150,.06);
}
[data-theme="light"] body::before { display: none; }
[data-theme="light"] .header { background: rgba(255,255,255,.90); }
[data-theme="light"] .nav-bar { background: rgba(255,255,255,.85); }
[data-theme="light"] .ticker-bar { background: rgba(245,247,250,.9); }
[data-theme="light"] .dashboard-footer { background: rgba(255,255,255,.95); }
[data-theme="light"] .nav-group-menu { background: rgba(255,255,255,.97); border-color: rgba(0,0,0,.1); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0,212,170,.04), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139,92,246,.03), transparent);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── ANIMATED GRADIENT MESH BACKGROUND ─── */
body::before {
    content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(ellipse 40% 30% at 20% 20%, rgba(0,212,170,.035), transparent),
        radial-gradient(ellipse 35% 35% at 75% 70%, rgba(139,92,246,.03), transparent),
        radial-gradient(ellipse 50% 25% at 50% 50%, rgba(6,182,212,.02), transparent);
    animation: meshShift 25s ease-in-out infinite alternate;
}
@keyframes meshShift {
    0%   { opacity: 1; transform: scale(1) translateY(0); }
    50%  { opacity: .7; transform: scale(1.05) translateY(-2%); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
a { color: var(--accent); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .85; }
b, strong { font-weight: 600; }
::selection { background: rgba(0,212,170,.25); color: #fff; }

/* ─── HEADER ─── */
.header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 28px;
    background: rgba(13,19,33,.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-left h1 {
    font-size: 1.2rem; font-weight: 800; letter-spacing: -0.5px;
    background: linear-gradient(135deg, #00d4aa 0%, #8b5cf6 50%, #06b6d4 100%);
    background-size: 200% auto;
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 6s ease infinite;
}
@keyframes shimmer { 0%,100%{ background-position: 0% center } 50%{ background-position: 200% center } }
.header-right { display: flex; align-items: center; gap: 12px; }
.last-update { font-size: 0.72rem; color: var(--text-muted); }

/* ─── STATUS BADGES ─── */
.status-badge {
    padding: 3px 12px; border-radius: 20px; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.8px;
}
.status-live {
    background: rgba(16,185,129,.12); color: var(--positive);
    border: 1px solid rgba(16,185,129,.4);
    animation: pulse-green 2.5s ease infinite;
    box-shadow: 0 0 12px rgba(16,185,129,.15);
}
.status-paused { background: var(--negative-bg); color: var(--negative); border: 1px solid rgba(239,68,68,.4); }
@keyframes pulse-green { 0%,100%{ box-shadow: 0 0 0 0 rgba(16,185,129,.3) } 50%{ box-shadow: 0 0 0 8px rgba(16,185,129,0) } }

.regime-badge { padding: 3px 12px; border-radius: 20px; font-size: 0.68rem; font-weight: 600; background: rgba(19,26,43,.8); border: 1px solid var(--border); }
.regime-bull, .regime-bullish { color: var(--positive); border-color: rgba(16,185,129,.4); background: var(--positive-bg); }
.regime-bear, .regime-bearish { color: var(--negative); border-color: rgba(239,68,68,.4); background: var(--negative-bg); }
.regime-sideways, .regime-neutral, .regime-unknown { color: var(--warning); border-color: rgba(245,158,11,.4); background: var(--warning-bg); }

/* ─── NAVIGATION BAR — Grouped Dropdowns ─── */
.nav-bar {
    display: flex; gap: 3px; padding: 8px 28px;
    background: rgba(13,19,33,.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 500;
}
.nav-btn {
    background: none; border: none; color: var(--text-muted);
    padding: 5px 10px; border-radius: 6px; font-size: 0.72rem;
    font-weight: 500; cursor: pointer; white-space: nowrap;
    transition: var(--transition); position: relative;
}
.nav-btn:hover { background: rgba(255,255,255,.04); color: var(--text-primary); }
.nav-btn.active {
    background: var(--accent-dim); color: var(--accent); font-weight: 600;
    box-shadow: inset 0 -2px 0 var(--accent);
}
.nav-divider {
    width: 1px; height: 20px; background: rgba(99,115,155,.2);
    margin: 0 4px; align-self: center; flex-shrink: 0;
}
/* Nav Group Dropdown */
.nav-group { position: relative; }
.nav-group-toggle {
    background: none; border: none; color: var(--text-muted);
    padding: 5px 12px; border-radius: 6px; font-size: 0.72rem;
    font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: var(--transition); display: flex; align-items: center; gap: 4px;
}
.nav-group-toggle:hover { background: rgba(255,255,255,.04); color: var(--text-primary); }
.nav-group-toggle.has-active { color: var(--accent); background: var(--accent-dim); }
.nav-caret { font-size: 0.6rem; transition: transform .2s; }
.nav-group.open .nav-caret { transform: rotate(180deg); }
.nav-group-menu {
    display: none; position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%);
    background: rgba(13,19,33,.97); backdrop-filter: blur(16px);
    border: 1px solid rgba(99,115,155,.2); border-radius: var(--radius-sm);
    padding: 6px; min-width: 180px; z-index: 200;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    animation: dropIn .2s ease;
}
.nav-group.open .nav-group-menu { display: flex; flex-direction: column; }
@keyframes dropIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.nav-group-menu .nav-btn {
    width: 100%; text-align: left; padding: 7px 12px; border-radius: 6px;
}
.nav-group-menu .nav-btn:hover { background: rgba(0,212,170,.06); }
.nav-group-menu .nav-btn.active { background: var(--accent-dim); color: var(--accent); }
/* Theme Toggle */
.nav-theme-toggle { font-size: 1rem; padding: 4px 8px; margin-left: auto; }

/* ─── LIVE TICKER BAR ─── */
.ticker-bar {
    display: flex; align-items: center; gap: 0;
    background: rgba(6,10,19,.6);
    border-bottom: 1px solid rgba(99,115,155,.08);
    overflow: hidden; height: 28px; position: relative;
}
.ticker-track {
    display: flex; gap: 32px; white-space: nowrap;
    animation: tickerScroll 40s linear infinite;
    padding: 0 16px;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.ticker-item {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.68rem; font-weight: 600; color: var(--text-secondary);
    padding: 4px 0;
}
.ticker-item .ticker-symbol { color: var(--text-primary); }
.ticker-item .ticker-up { color: var(--positive); }
.ticker-item .ticker-down { color: var(--negative); }
.ticker-item .ticker-neutral { color: var(--text-muted); }

/* ─── REFRESH TIMER ─── */
.refresh-timer {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.68rem; color: var(--text-muted);
}
.refresh-ring {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(99,115,155,.15);
    border-top-color: var(--accent);
    animation: refreshSpin var(--refresh-duration, 15s) linear infinite;
}
@keyframes refreshSpin { to { transform: rotate(360deg); } }

/* ─── KEYBOARD SHORTCUT HINT ─── */
.kbd-hint {
    position: fixed; bottom: 20px; right: 20px; z-index: 50;
    font-size: 0.65rem; color: var(--text-muted);
    background: rgba(13,19,33,.85); backdrop-filter: blur(8px);
    padding: 8px 14px; border-radius: 8px;
    border: 1px solid var(--glass-border);
    opacity: 0; transition: opacity .3s; pointer-events: none;
}
.kbd-hint.visible { opacity: 1; }
kbd {
    display: inline-block; padding: 1px 6px; border-radius: 4px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(99,115,155,.2);
    font-family: inherit; font-size: 0.65rem; font-weight: 600;
    color: var(--accent); margin: 0 2px;
}

/* ─── BUTTONS ─── */
.btn {
    background: rgba(255,255,255,.04); color: var(--text-primary); border: 1px solid var(--border);
    padding: 6px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.78rem;
    font-weight: 500; transition: var(--transition); backdrop-filter: blur(4px);
}
.btn:hover { background: var(--accent-dim); border-color: var(--accent); box-shadow: 0 0 12px rgba(0,212,170,.1); }
.btn-danger { background: rgba(239,68,68,.15); color: #ef4444; border: 1px solid rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.25); box-shadow: 0 0 12px rgba(239,68,68,.15); }
.btn-success { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(0,212,170,.3); }
.btn-success:hover { background: rgba(0,212,170,.2); box-shadow: 0 0 12px rgba(0,212,170,.15); }
.btn-sm { font-size: 0.7rem; padding: 4px 10px; border-radius: 6px; background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--text-primary); cursor: pointer; transition: var(--transition); font-weight: 500; }
.btn-sm:hover { background: var(--accent); color: #000; }

/* ─── DASHBOARD GRID ─── */
.dashboard { padding: 20px 28px; max-width: 1640px; margin: 0 auto; }
.page { display: none; grid-template-columns: repeat(12, 1fr); gap: 16px; align-items: start; }
.page.active { display: grid; animation: pageFadeIn .45s cubic-bezier(.25,.46,.45,.94); }
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(10px); filter: blur(2px); }
    to   { opacity: 1; transform: none; filter: none; }
}

/* ─── STAGGERED CARD ENTRANCE ANIMATION ─── */
.page.active > .card { opacity: 0; animation: cardSlideIn .5s cubic-bezier(.25,.46,.45,.94) forwards; }
.page.active > .card:nth-child(1)  { animation-delay: .05s; }
.page.active > .card:nth-child(2)  { animation-delay: .10s; }
.page.active > .card:nth-child(3)  { animation-delay: .15s; }
.page.active > .card:nth-child(4)  { animation-delay: .20s; }
.page.active > .card:nth-child(5)  { animation-delay: .25s; }
.page.active > .card:nth-child(6)  { animation-delay: .30s; }
.page.active > .card:nth-child(7)  { animation-delay: .35s; }
.page.active > .card:nth-child(8)  { animation-delay: .40s; }
.page.active > .card:nth-child(9)  { animation-delay: .45s; }
.page.active > .card:nth-child(10) { animation-delay: .50s; }
.page.active > .card:nth-child(n+11) { animation-delay: .55s; }
@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(18px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

/* ─── SKELETON LOADING PLACEHOLDERS ─── */
.skeleton {
    background: linear-gradient(90deg, rgba(99,115,155,.06) 25%, rgba(99,115,155,.12) 50%, rgba(99,115,155,.06) 75%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: 6px;
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}
.skeleton * { visibility: hidden; }
@keyframes skeletonPulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 1em; width: 80%; border-radius: 4px; margin: 4px 0; }
.skeleton-kpi { height: 2em; width: 60%; border-radius: 6px; margin: 8px auto; }

/* ─── CARDS — Glassmorphism ─── */
.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    grid-column: span 12;
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    transition: var(--transition);
}
.card:hover { border-color: rgba(99,115,155,.25); }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.card-title { font-weight: 700; font-size: 0.92rem; display: flex; align-items: center; gap: 6px; }
.card-badge {
    display: inline-block; background: var(--accent-dim); color: var(--accent);
    padding: 2px 12px; border-radius: 20px; font-size: 0.68rem; font-weight: 600;
    letter-spacing: 0.3px;
}

/* ─── KPI ROW — Premium Cards ─── */
.kpi-row { grid-column: span 12; display: grid; grid-template-columns: 1fr; gap: 12px; }
.kpi-grid { grid-column: span 12; }
.kpi-row .kpi {
    flex: 1 1 120px; text-align: center; padding: 14px 10px 12px; border-radius: 12px;
    background: rgba(255,255,255,.02); border: 1px solid rgba(99,115,155,.1);
    transition: var(--transition); min-width: 100px;
}
.kpi-row .kpi:hover {
    background: rgba(0,212,170,.04); border-color: rgba(0,212,170,.2);
    transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.2), var(--shadow-glow);
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi-item, .kpi-card {
    text-align: center; padding: 16px 12px 14px; border-radius: 12px;
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(99,115,155,.1);
    transition: var(--transition);
    position: relative; cursor: help;
}
.kpi-item:hover, .kpi-card:hover {
    background: rgba(0,212,170,.04);
    border-color: rgba(0,212,170,.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.2), var(--shadow-glow);
}
.kpi-label {
    font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.7px; margin-bottom: 6px; font-weight: 600;
}
.kpi-value {
    font-size: 1.4rem; font-weight: 800; line-height: 1.2;
    transition: color .3s, transform .2s;
}
.kpi-value.counting { animation: countPop .4s cubic-bezier(.25,.46,.45,.94); }
@keyframes countPop {
    0%   { transform: scale(.85); opacity: .5; }
    60%  { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}
/* ─── LIVE DATA PULSE ─── */
.pulse-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--positive); margin-left: 6px; vertical-align: middle;
    animation: livePulse 1.5s ease infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,.5); }
    50%      { opacity: .5; box-shadow: 0 0 0 6px rgba(16,185,129,0); }
}
.kpi-sub { font-size: 0.66rem; color: var(--text-muted); margin-top: 4px; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.neutral { color: var(--text-primary); }

/* ─── CUSTOM TOOLTIP SYSTEM ─── */
.nexus-tooltip {
    position: fixed; z-index: 99999; pointer-events: none;
    max-width: 360px; padding: 14px 18px;
    background: rgba(13,19,33,.95);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(0,212,170,.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5), 0 0 20px rgba(0,212,170,.08);
    opacity: 0; transform: translateY(4px);
    transition: opacity .2s ease, transform .2s ease;
    font-size: 0.8rem; line-height: 1.55; color: var(--text-secondary);
}
.nexus-tooltip.visible { opacity: 1; transform: translateY(0); }
.nexus-tooltip .tt-title {
    font-size: 0.82rem; font-weight: 700; color: var(--accent);
    margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.nexus-tooltip .tt-body { color: var(--text-secondary); }
.nexus-tooltip .tt-hint {
    margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(99,115,155,.15);
    font-size: 0.72rem; color: var(--text-muted); font-style: italic;
}

/* ─── DATA TABLES — Premium ─── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.data-table th {
    color: var(--text-muted); font-weight: 600; text-transform: uppercase;
    font-size: 0.66rem; letter-spacing: 0.6px; padding: 10px 10px;
    text-align: left; border-bottom: 1px solid rgba(99,115,155,.15);
    white-space: nowrap; position: relative;
}
.data-table th[data-tooltip] { cursor: help; }
.data-table th[data-tooltip]::after {
    content: " ⓘ"; font-size: 0.6rem; opacity: 0.4;
}
.data-table td {
    padding: 8px 10px; border-bottom: 1px solid rgba(99,115,155,.06);
    white-space: nowrap; transition: background .15s;
}
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: rgba(0,212,170,.03); }
.data-table tbody tr:nth-child(even) { background: rgba(255,255,255,.01); }
.data-table tbody tr:nth-child(even):hover { background: rgba(0,212,170,.04); }
.text-center { text-align: center; color: var(--text-muted); padding: 24px !important; }

/* ─── SCROLLABLE ─── */
.scrollable { max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(99,115,155,.2) transparent; }
.scrollable::-webkit-scrollbar { width: 5px; }
.scrollable::-webkit-scrollbar-track { background: transparent; }
.scrollable::-webkit-scrollbar-thumb { background: rgba(99,115,155,.25); border-radius: 3px; }
.scrollable::-webkit-scrollbar-thumb:hover { background: rgba(99,115,155,.4); }

/* ─── CHARTS ─── */
.chart-container { position: relative; height: 220px; }
.chart-container.tall { height: 320px; }

/* ─── HEALTH GRID ─── */
.health-grid { display: flex; flex-direction: column; gap: 6px; }
.health-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; font-size: 0.78rem; border-radius: 6px; transition: background .15s; }
.health-item:hover { background: rgba(255,255,255,.02); }
.health-uptime { margin-left: auto; color: var(--text-muted); font-size: 0.7rem; }

/* ─── STATUS DOTS — Animated ─── */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; flex-shrink: 0; }
.dot-green { background: var(--positive); box-shadow: 0 0 8px rgba(16,185,129,.5); animation: dot-pulse-g 2s infinite; }
.dot-yellow { background: var(--warning); box-shadow: 0 0 8px rgba(245,158,11,.5); animation: dot-pulse-y 2s infinite; }
.dot-red { background: var(--negative); box-shadow: 0 0 8px rgba(239,68,68,.5); animation: dot-pulse-r 2s infinite; }
.dot-gray { background: var(--text-muted); }
@keyframes dot-pulse-g { 0%,100%{ box-shadow: 0 0 4px rgba(16,185,129,.4) } 50%{ box-shadow: 0 0 10px rgba(16,185,129,.6) } }
@keyframes dot-pulse-y { 0%,100%{ box-shadow: 0 0 4px rgba(245,158,11,.4) } 50%{ box-shadow: 0 0 10px rgba(245,158,11,.6) } }
@keyframes dot-pulse-r { 0%,100%{ box-shadow: 0 0 4px rgba(239,68,68,.4) } 50%{ box-shadow: 0 0 10px rgba(239,68,68,.6) } }

/* ─── FILTER BAR ─── */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar select, .filter-bar input {
    background: rgba(255,255,255,.04); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 6px 12px; font-size: 0.78rem; transition: var(--transition);
}
.filter-bar select:focus, .filter-bar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 12px rgba(0,212,170,.1); }

/* ─── MODAL ─── */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(6,10,19,.8); backdrop-filter: blur(6px);
    z-index: 200; display: flex; align-items: center; justify-content: center;
    animation: fadeIn .2s ease;
}
.modal-content { max-width: 850px; width: 92%; max-height: 85vh; overflow-y: auto; scrollbar-width: thin; padding: 24px; }

/* ─── DETAIL GRID ─── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; }
.detail-item { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.02); }
.detail-label { font-size: 0.66rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.4px; }
.detail-value { font-size: 0.88rem; font-weight: 500; margin-top: 3px; }
.detail-divider { border-top: 1px solid rgba(99,115,155,.1); margin: 16px 0; }
.detail-subtitle { font-size: 0.9rem; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.detail-full { grid-column: 1 / -1; padding: 8px 0; }
.code-block { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-size: 0.72rem; font-family: 'JetBrains Mono', 'Fira Code', monospace; overflow-x: auto; max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; color: var(--text-secondary); margin-top: 8px; }

/* ─── BROKER / AI / CONNECTION CARDS — Glassmorphism ─── */
.broker-grid, .ai-grid, .conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.broker-card, .ai-card, .conn-card {
    background: rgba(255,255,255,.025); border: 1px solid var(--glass-border);
    border-radius: var(--radius); padding: 18px; cursor: pointer;
    transition: var(--transition); position: relative; overflow: hidden;
}
.broker-card::before, .ai-card::before, .conn-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0; transition: opacity .3s;
}
.broker-card:hover::before, .ai-card:hover::before, .conn-card:hover::before { opacity: 1; }
.broker-card:hover, .ai-card:hover, .conn-card:hover {
    border-color: rgba(0,212,170,.2); transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,.25), 0 0 20px rgba(0,212,170,.06);
}
.broker-card-header, .ai-card-header, .conn-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-weight: 600; font-size: 0.88rem; }
.broker-name, .ai-name { font-weight: 700; }
.broker-count { color: var(--text-muted); font-size: 0.72rem; }
.broker-stats, .ai-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-label { display: block; font-size: 0.64rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.stat-val { display: block; font-size: 0.88rem; font-weight: 700; word-break: break-word; overflow-wrap: break-word; }
.broker-account-card .stat-val { font-size: 1rem; }
.broker-account-card .stat-label { font-size: 0.7rem; margin-bottom: 2px; }
.conn-card-body { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.6; }
.conn-card-failed { border-color: rgba(239,68,68,.4) !important; background: rgba(239,68,68,.05); }
.conn-card-failed:hover { border-color: rgba(239,68,68,.6) !important; box-shadow: 0 8px 24px rgba(239,68,68,.1); }
.btn-warning { background: rgba(245,158,11,.2); color: #f59e0b; border: 1px solid rgba(245,158,11,.3); }
.btn-warning:hover { background: rgba(245,158,11,.3); }

/* ─── CONNECTION SECTIONS ─── */
.conn-section { margin-bottom: 28px; }
.conn-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ─── TAG CLOUD ─── */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: rgba(255,255,255,.04); border: 1px solid var(--border); padding: 4px 12px; border-radius: 20px; font-size: 0.72rem; color: var(--text-secondary); transition: var(--transition); }
.tag:hover { border-color: var(--accent); background: var(--accent-dim); }

/* ─── TAB BAR ─── */
.tab-bar { display: flex; gap: 4px; margin-bottom: 14px; padding: 4px; background: rgba(255,255,255,.02); border-radius: 10px; }
.tab-btn { background: none; border: none; color: var(--text-muted); padding: 6px 16px; border-radius: 8px; font-size: 0.72rem; cursor: pointer; transition: var(--transition); font-weight: 500; }
.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,.04); }
.tab-btn.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; box-shadow: 0 2px 8px rgba(0,212,170,.1); }

/* ─── GAUGE (Fear & Greed) ─── */
.gauge-container { text-align: center; padding: 24px 0; }
.gauge-value { font-size: 3.2rem; font-weight: 800; line-height: 1; }
.gauge-label { font-size: 0.85rem; color: var(--text-muted); margin-top: 8px; font-weight: 500; }
.extreme-fear { color: #ef4444; text-shadow: 0 0 20px rgba(239,68,68,.3); }
.fear { color: #f97316; text-shadow: 0 0 20px rgba(249,115,22,.3); }
.neutral-fg { color: #eab308; }
.greed { color: #a78bfa; text-shadow: 0 0 20px rgba(167,139,250,.3); }
.extreme-greed { color: #10b981; text-shadow: 0 0 20px rgba(16,185,129,.3); }

/* ─── WORLD STATE / FUNDING / NEWS ITEMS ─── */
.ws-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 6px; border-bottom: 1px solid rgba(99,115,155,.06); font-size: 0.78rem; transition: background .15s; border-radius: 4px; }
.ws-item:hover { background: rgba(255,255,255,.02); }
.ws-label { font-weight: 500; }
.ws-value { font-weight: 600; }
.ws-time { color: var(--text-muted); font-size: 0.68rem; }
.news-item { display: flex; gap: 12px; padding: 10px 6px; border-bottom: 1px solid rgba(99,115,155,.06); font-size: 0.78rem; align-items: center; transition: background .15s; border-radius: 4px; }
.news-item:hover { background: rgba(255,255,255,.02); }
.news-sentiment { min-width: 65px; font-weight: 600; font-size: 0.72rem; padding: 2px 8px; border-radius: 4px; background: rgba(255,255,255,.04); text-align: center; }
.news-headline { flex: 1; }
.news-time { color: var(--text-muted); font-size: 0.68rem; white-space: nowrap; }

/* ─── STAT ROWS ─── */
.stat-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 0.75rem; }
.stat-row span:first-child { color: var(--text-muted); }

/* ─── AGENT PROGRESS BARS ─── */
.agent-bar-item { margin-bottom: 12px; }
.agent-bar-label { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 5px; }
.progress-bar { height: 7px; background: rgba(255,255,255,.04); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .6s cubic-bezier(.4,0,.2,1); }

/* ─── CONTROL PANEL ─── */
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.control-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 8px; background: rgba(255,255,255,.02); }
.control-item label { font-size: 0.82rem; font-weight: 500; }
.control-input { background: rgba(255,255,255,.04); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 12px; width: 100px; font-size: 0.82rem; text-align: right; transition: var(--transition); }
.control-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 12px rgba(0,212,170,.1); }

/* ─── TOGGLE SWITCH ─── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 24px; transition: .3s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 2px; bottom: 2px; background: var(--text-muted); border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--accent-dim); border-color: rgba(0,212,170,.4); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--accent); box-shadow: 0 0 8px rgba(0,212,170,.4); }

/* ─── LEVEL BADGES (alerts) ─── */
.level-error, .level-critical { color: var(--negative); font-weight: 600; }
.level-warning { color: var(--warning); font-weight: 600; }
.level-info { color: var(--info); font-weight: 500; }

/* ─── STATUS LABELS (theses) ─── */
.status-active { color: var(--positive); }
.status-validated { color: var(--accent); }
.status-expired, .status-invalidated { color: var(--negative); }

/* ─── COLLAPSIBLE SECTIONS ─── */
.collapsible .card-header { user-select: none; }
.collapsible .collapse-icon {
    display: inline-block; transition: transform .3s ease; font-size: 0.7rem; color: var(--text-muted);
}
.collapsible.collapsed .collapse-icon { transform: rotate(-90deg); }
.collapsible .collapsible-body {
    max-height: 1200px; overflow: hidden; transition: max-height .4s ease, opacity .3s ease; opacity: 1;
}
.collapsible.collapsed .collapsible-body {
    max-height: 0; opacity: 0; padding: 0; margin: 0;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1200px) {
    .col-3 { grid-column: span 6; }
    .col-4, .col-6, .col-8 { grid-column: span 6; }
}
@media (max-width: 768px) {
    .header { flex-direction: column; gap: 8px; padding: 10px 16px; }
    .nav-bar { padding: 6px 12px; gap: 2px; }
    .nav-btn { padding: 6px 10px; font-size: 0.72rem; }
    .dashboard { padding: 12px; }
    .col-3, .col-4, .col-6, .col-8, .col-12 { grid-column: span 12; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .kpi-item { padding: 12px 8px; }
    .kpi-value { font-size: 1.1rem; }
    .broker-grid, .ai-grid, .conn-grid { grid-template-columns: 1fr; }
    .control-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .nexus-tooltip { max-width: 260px; font-size: 0.75rem; }
}

/* ================================
   Toast Notification System
   ================================ */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 10000;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px;
    border-radius: 10px;
    background: rgba(13,19,33,.92);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 0.82rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    opacity: 0; transform: translateX(100%);
    transition: all 0.35s cubic-bezier(.4,0,.2,1);
    pointer-events: auto;
    max-width: 420px;
}
.toast.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 3px solid var(--positive); }
.toast-error { border-left: 3px solid var(--negative); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-msg { flex: 1; }

/* ================================
   Loading Overlay
   ================================ */
.loading-overlay {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(6,10,19,.75);
    backdrop-filter: blur(6px);
}
.loading-spinner {
    width: 44px; height: 44px;
    border: 3px solid rgba(99,115,155,.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.loading-text {
    margin-top: 14px; color: var(--text-secondary);
    font-size: 0.82rem; font-weight: 500;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================
   Severity & Impact Badges
   ================================ */
.level-critical, .level-error { color: var(--negative); font-weight: 600; }
.level-warning { color: var(--warning); font-weight: 500; }
.level-info { color: var(--info); }

/* ================================
   Monitor Page Specifics
   ================================ */
.freshness-ok { color: var(--positive); }
.freshness-stale { color: var(--warning); }
.freshness-dead { color: var(--negative); }

/* ================================
   Signal Coverage Grid
   ================================ */
.signal-coverage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
    padding: 8px 0;
}
.signal-tile {
    display: flex; flex-direction: column;
    padding: 12px 14px; border-radius: 10px;
    background: rgba(255,255,255,.025);
    border-left: 3px solid var(--accent);
    font-size: 0.78rem;
    transition: var(--transition);
}
.signal-tile:hover { background: rgba(0,212,170,.04); }
.signal-tile.inactive { opacity: 0.45; border-left-color: var(--text-muted); }
.signal-tile .sig-name { font-weight: 600; margin-bottom: 5px; text-transform: capitalize; }
.signal-tile .sig-info { color: var(--text-muted); font-size: 0.7rem; }

/* ═══════════════ Command Center Styles ═══════════════ */
.grid-2col, .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; grid-column: span 12; }
@media (max-width: 768px) { .grid-2col, .grid-2 { grid-template-columns: 1fr; } }

.mode-paper { background: rgba(0,212,170,.15) !important; color: var(--accent) !important; border: 1px solid rgba(0,212,170,.3); }
.mode-live { background: rgba(239,68,68,.15) !important; color: var(--negative) !important; border: 1px solid rgba(239,68,68,.3); animation: pulse-live 2s infinite; }
@keyframes pulse-live { 0%,100% { opacity: 1 } 50% { opacity: 0.7 } }

/* ═══════════════ Trend Indicators ═══════════════ */
.trend-up { color: var(--positive); }
.trend-up::before { content: "▲ "; font-size: 0.6em; }
.trend-down { color: var(--negative); }
.trend-down::before { content: "▼ "; font-size: 0.6em; }

/* ═══════════════ PnL Highlight Cells ═══════════════ */
td.pnl-positive { color: var(--positive); font-weight: 600; background: rgba(16,185,129,.04); }
td.pnl-negative { color: var(--negative); font-weight: 600; background: rgba(239,68,68,.04); }

/* ═══════════════ Section Divider ═══════════════ */
.section-info {
    font-size: 0.72rem; color: var(--text-muted); padding: 6px 0 12px;
    line-height: 1.55; border-bottom: 1px solid rgba(99,115,155,.08);
    margin-bottom: 12px;
}

/* ═══════════════ Badge Colors ═══════════════ */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.72rem; font-weight: 600; }
.badge.positive { background: var(--positive-bg); color: var(--positive); }
.badge.negative { background: var(--negative-bg); color: var(--negative); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.info { background: var(--info-bg); color: var(--info); }

/* ═══════════════ Broker PnL Summary Row ═══════════════ */
.broker-pnl-summary {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px; margin-top: 12px; padding-top: 12px;
    border-top: 1px solid rgba(99,115,155,.1);
}
.broker-pnl-card {
    display: flex; flex-direction: column; gap: 8px; padding: 14px 16px;
    border-radius: 10px; background: rgba(255,255,255,.02); border: 1px solid rgba(99,115,155,.08);
    transition: var(--transition);
}
.broker-pnl-card:hover { background: rgba(255,255,255,.04); border-color: rgba(99,115,155,.15); }
.broker-pnl-header { font-size: 0.85rem; color: var(--text-primary); font-weight: 700; padding-bottom: 6px; border-bottom: 1px solid rgba(99,115,155,.1); }
.broker-pnl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.broker-pnl-grid .stat-label { font-size: 0.68rem; color: var(--text-muted); display: block; }
.broker-pnl-grid .stat-val { font-size: 0.9rem; font-weight: 700; display: block; }
.broker-pnl-icon { font-size: 1.5rem; }
.broker-pnl-details { flex: 1; }
.broker-pnl-name { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.3px; }
.broker-pnl-value { font-size: 1.05rem; font-weight: 800; }

/* ═══════════════ Mini Info Boxes ═══════════════ */
.info-box {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: 10px;
    background: rgba(139,92,246,.05);
    border: 1px solid rgba(139,92,246,.15);
    font-size: 0.78rem; color: var(--text-secondary);
    line-height: 1.5; margin-bottom: 12px;
}
.info-box-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }

/* ═══════════════ Empty State ═══════════════ */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 24px; text-align: center; color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state-text { font-size: 0.88rem; font-weight: 500; }
.empty-state-sub { font-size: 0.75rem; margin-top: 6px; opacity: 0.7; }
/* ═══════════════ HERO SUMMARY CARD ═══════════════ */
.hero-card {
    background: linear-gradient(135deg, rgba(0,212,170,.08) 0%, rgba(139,92,246,.06) 50%, rgba(6,10,19,.95) 100%) !important;
    border: 1px solid rgba(0,212,170,.2) !important;
    position: relative; overflow: hidden;
}
.hero-card::before {
    content: ''; position: absolute; top: -50%; right: -20%;
    width: 400px; height: 400px; border-radius: 50%;
    background: radial-gradient(circle, rgba(0,212,170,.06) 0%, transparent 70%);
    pointer-events: none;
}
.hero-card::after {
    content: ''; position: absolute; bottom: -30%; left: -10%;
    width: 300px; height: 300px; border-radius: 50%;
    background: radial-gradient(circle, rgba(139,92,246,.05) 0%, transparent 70%);
    pointer-events: none;
}
.hero-content {
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; position: relative; z-index: 1;
}
.hero-main { flex: 1; }
.hero-greeting {
    font-size: 0.82rem; color: var(--accent); font-weight: 600;
    text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 4px;
}
.hero-headline {
    font-size: 1.6rem; font-weight: 800; color: var(--text-primary);
    margin-bottom: 16px; line-height: 1.2;
}
.hero-stats {
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
    margin-bottom: 12px;
}
.hero-stat { display: flex; flex-direction: column; gap: 2px; }
.hero-stat-label { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.hero-stat-value { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); }
.hero-stat-divider { width: 1px; height: 36px; background: rgba(99,115,155,.2); }
.hero-sub { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.4; }
.hero-chart { flex-shrink: 0; opacity: 0.9; }
@media (max-width: 768px) {
    .hero-content { flex-direction: column; }
    .hero-chart { display: none; }
    .hero-headline { font-size: 1.2rem; }
    .hero-stats { gap: 12px; }
    .hero-stat-value { font-size: 1rem; }
}

/* ═══════════════ Calendar Heatmap ═══════════════ */
.calendar-heatmap {
    display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 0;
    justify-content: flex-start;
}
.cal-day {
    width: 32px; height: 32px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; font-weight: 600; color: rgba(255,255,255,.7);
    cursor: default; transition: transform 0.15s;
    position: relative;
}
.cal-day:hover { transform: scale(1.2); z-index: 2; }
.cal-day.cal-none { background: rgba(99,115,155,.08); color: rgba(99,115,155,.3); }
.cal-day.cal-win-1 { background: rgba(16,185,129,.2); }
.cal-day.cal-win-2 { background: rgba(16,185,129,.4); }
.cal-day.cal-win-3 { background: rgba(16,185,129,.65); color: #fff; }
.cal-day.cal-loss-1 { background: rgba(239,68,68,.2); }
.cal-day.cal-loss-2 { background: rgba(239,68,68,.4); }
.cal-day.cal-loss-3 { background: rgba(239,68,68,.65); color: #fff; }
.cal-legend {
    display: flex; align-items: center; gap: 8px; margin-top: 8px;
    font-size: 0.68rem; color: var(--text-muted); padding: 0 4px;
}
.cal-legend-item { display: flex; align-items: center; gap: 3px; }
.cal-legend-box { width: 12px; height: 12px; border-radius: 3px; }

/* ═══════════════ Enhanced Trade Rows ═══════════════ */
tr.trade-row-win { background: rgba(16,185,129,.04) !important; }
tr.trade-row-loss { background: rgba(239,68,68,.04) !important; }
tr.trade-row-win td:first-child { border-left: 3px solid var(--positive); }
tr.trade-row-loss td:first-child { border-left: 3px solid var(--negative); }
.trade-pnl-badge {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    font-size: 0.72rem; font-weight: 700;
}
.trade-pnl-badge.positive { background: var(--positive-bg); color: var(--positive); }
.trade-pnl-badge.negative { background: var(--negative-bg); color: var(--negative); }
.trade-side-badge {
    display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px;
    border-radius: 6px; font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase;
}
.trade-side-badge.buy { background: rgba(16,185,129,.12); color: var(--positive); }
.trade-side-badge.sell { background: rgba(239,68,68,.12); color: var(--negative); }
.trade-side-badge.hold { background: rgba(245,158,11,.12); color: var(--warning); }

/* ═══════════════ Sparkline ═══════════════ */
.sparkline-container { display: inline-block; vertical-align: middle; }

/* ═══════════════ FULLSCREEN CHART TOGGLE ═══════════════ */
.chart-fullscreen-btn {
    position: absolute; top: 6px; right: 6px; z-index: 5;
    background: rgba(255,255,255,.04); border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; border-radius: 6px;
    padding: 3px 7px; font-size: 0.72rem; opacity: 0;
    transition: opacity .2s, background .2s;
}
.chart-container:hover .chart-fullscreen-btn { opacity: 1; }
.chart-fullscreen-btn:hover { background: var(--accent-dim); color: var(--accent); }
.chart-container.chart-expanded {
    position: fixed !important; inset: 40px !important;
    z-index: 9998; height: auto !important;
    background: var(--bg-card); border: 1px solid var(--accent);
    border-radius: var(--radius); padding: 20px;
    box-shadow: 0 0 60px rgba(0,0,0,.8);
}

/* ═══════════════ COMMAND PALETTE ═══════════════ */
.cmd-palette {
    position: fixed; top: 15%; left: 50%; transform: translateX(-50%);
    width: 520px; max-width: 90vw; z-index: 10001;
    background: rgba(13,19,33,.96); backdrop-filter: blur(20px);
    border: 1px solid rgba(0,212,170,.25); border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.7), 0 0 30px rgba(0,212,170,.08);
    display: none; overflow: hidden;
}
.cmd-palette.open { display: block; animation: cmdOpen .2s ease; }
@keyframes cmdOpen { from { opacity: 0; transform: translateX(-50%) scale(.95); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.cmd-palette input {
    width: 100%; padding: 16px 20px; font-size: 1rem;
    background: transparent; border: none; border-bottom: 1px solid rgba(99,115,155,.15);
    color: var(--text-primary); outline: none; font-family: inherit;
}
.cmd-palette input::placeholder { color: var(--text-muted); }
.cmd-results {
    max-height: 300px; overflow-y: auto; padding: 8px;
}
.cmd-item {
    padding: 10px 14px; border-radius: 8px; cursor: pointer;
    font-size: 0.85rem; display: flex; align-items: center; gap: 10px;
    transition: background .1s;
}
.cmd-item:hover, .cmd-item.selected { background: var(--accent-dim); color: var(--accent); }
.cmd-item kbd { margin-left: auto; }
.cmd-backdrop {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(6,10,19,.5); backdrop-filter: blur(3px);
    display: none;
}
.cmd-backdrop.open { display: block; }

/* ============================================
   SYSTEM HEALTH SCORE BADGE
   ============================================ */
.system-score-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    background: rgba(0,212,170,.08); border: 1px solid rgba(0,212,170,.2);
    font-size: 0.75rem; font-weight: 700; cursor: pointer;
    transition: all .3s ease;
}
.system-score-badge:hover {
    background: rgba(0,212,170,.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,212,170,.2);
}
.score-ring {
    display: inline-block; width: 24px; height: 24px;
    border-radius: 50%; position: relative;
    background: conic-gradient(var(--accent) 0%, transparent 0%);
    transition: background 1s ease;
}
.score-ring::after {
    content: ''; position: absolute; inset: 3px;
    border-radius: 50%; background: var(--bg-primary);
}
.score-value { font-size: 0.85rem; color: var(--text); }
.score-grade {
    font-size: 0.7rem; padding: 1px 6px; border-radius: 8px;
    font-weight: 800; letter-spacing: 0.5px;
}
.score-grade.grade-a { background: linear-gradient(135deg, #00d4aa, #00b894); color: #000; }
.score-grade.grade-b { background: linear-gradient(135deg, #f9ca24, #f0932b); color: #000; }
.score-grade.grade-c { background: linear-gradient(135deg, #ff6b6b, #ee5a24); color: #fff; }
.score-grade.grade-d { background: linear-gradient(135deg, #ff4757, #c44569); color: #fff; }

/* ============================================
   RISK METRICS GRID
   ============================================ */
.risk-metrics-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
    padding: 8px 0;
}
.risk-metric {
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px; padding: 16px; text-align: center;
    transition: all .3s ease; cursor: pointer; position: relative;
}
.risk-metric:hover {
    background: rgba(0,212,170,.06); border-color: rgba(0,212,170,.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.risk-metric-label {
    font-size: 0.72rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px;
}
.risk-metric-value {
    font-size: 1.4rem; font-weight: 800; color: var(--text);
    font-variant-numeric: tabular-nums;
}
.risk-metric-value.positive { color: var(--positive); }
.risk-metric-value.negative { color: var(--negative); }
.risk-metric-value.neutral { color: var(--text); }
.risk-metric-grade {
    display: inline-block; margin-top: 6px; font-size: 0.65rem;
    padding: 2px 8px; border-radius: 6px; font-weight: 700;
    letter-spacing: 0.5px;
}
.risk-metric-grade.grade-a { background: rgba(0,212,170,.15); color: var(--positive); }
.risk-metric-grade.grade-b { background: rgba(249,202,36,.15); color: #f9ca24; }
.risk-metric-grade.grade-c { background: rgba(255,107,107,.15); color: var(--negative); }

/* ============================================
   PERFORMANCE HEATMAP (Hour × Day)
   ============================================ */
.performance-heatmap-container {
    overflow-x: auto; padding: 4px 0;
}
.perf-heatmap-grid {
    display: grid; grid-template-columns: 50px repeat(24, 1fr);
    gap: 2px; min-width: 700px;
}
.heatmap-header {
    font-size: 0.6rem; color: var(--text-muted); text-align: center;
    padding: 4px 2px; font-weight: 600;
}
.heatmap-day-label {
    font-size: 0.7rem; color: var(--text-muted); font-weight: 600;
    display: flex; align-items: center; padding: 0 4px;
}
.heatmap-cell {
    aspect-ratio: 1; border-radius: 4px; display: flex;
    align-items: center; justify-content: center; font-size: 0.55rem;
    font-weight: 600; cursor: pointer; transition: all .2s;
    min-height: 28px; position: relative;
}
.heatmap-cell:hover {
    transform: scale(1.3); z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.heatmap-cell.positive { background: rgba(0,212,170,.2); color: var(--positive); }
.heatmap-cell.negative { background: rgba(255,107,107,.2); color: var(--negative); }
.heatmap-cell.neutral { background: rgba(255,255,255,.03); color: var(--text-muted); }
.heatmap-cell.hot-positive { background: rgba(0,212,170,.5); color: #000; font-weight: 800; }
.heatmap-cell.hot-negative { background: rgba(255,107,107,.5); color: #fff; font-weight: 800; }

.heatmap-insights {
    display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap;
}
.heatmap-insight {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px; font-size: 0.75rem;
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
}
.heatmap-insight.best { border-color: rgba(0,212,170,.3); }
.heatmap-insight.worst { border-color: rgba(255,107,107,.3); }

/* ============================================
   DASHBOARD FOOTER
   ============================================ */
.dashboard-footer {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 28px; display: flex; align-items: center;
    justify-content: center; gap: 20px;
    background: rgba(6,10,19,.95); backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255,255,255,.05);
    font-size: 0.68rem; color: var(--text-muted);
    z-index: 100; padding: 0 16px;
}
.footer-item { display: inline-flex; align-items: center; gap: 4px; }
.footer-item .status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--text-muted); display: inline-block;
}
.footer-item .status-dot.connected { background: var(--positive); box-shadow: 0 0 4px var(--positive); }
.footer-item .status-dot.disconnected { background: var(--negative); box-shadow: 0 0 4px var(--negative); }

/* add bottom padding to main for footer */
.dashboard { padding-bottom: 40px !important; }

/* ============================================
   VALUE FLASH ANIMATION
   ============================================ */
@keyframes valueFlashGreen {
    0% { background: rgba(0,212,170,.3); } 100% { background: transparent; }
}
@keyframes valueFlashRed {
    0% { background: rgba(255,107,107,.3); } 100% { background: transparent; }
}
.value-flash-positive { animation: valueFlashGreen .8s ease-out; border-radius: 4px; }
.value-flash-negative { animation: valueFlashRed .8s ease-out; border-radius: 4px; }

/* ============================================
   RESPONSIVE: Risk Metrics (merged into main responsive above)
   ============================================ */

/* ============================================
   PRINT STYLESHEET
   ============================================ */
@media print {
    body { background: #fff !important; color: #000 !important; }
    .header, .nav-bar, .ticker-bar, .dashboard-footer, .cmd-palette,
    .toast-container, .loading-overlay, .btn, .filter-bar,
    .info-box, button { display: none !important; }
    .card { background: #fff !important; border: 1px solid #ddd !important;
            box-shadow: none !important; backdrop-filter: none !important;
            break-inside: avoid; page-break-inside: avoid; }
    .kpi-value, .risk-metric-value { color: #000 !important; }
    .page { display: block !important; opacity: 1 !important; }
    .data-table th { background: #f0f0f0 !important; color: #000 !important; }
    .data-table td { color: #333 !important; border-color: #ddd !important; }
    .dashboard { padding: 0 !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   RBAC User Role Badge
   ═══════════════════════════════════════════════════════════════════ */
.user-role-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border);
    font-size: .78rem; cursor: default;
}
.user-role-badge #userRoleName { color: var(--text-primary); font-weight: 500; }
.role-tag {
    padding: 2px 8px; border-radius: 4px; font-size: .7rem;
    font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.role-tag.role-admin   { background: rgba(239,68,68,.2); color: #ef4444; }
.role-tag.role-operator { background: rgba(245,158,11,.2); color: #f59e0b; }
.role-tag.role-viewer  { background: rgba(139,92,246,.2); color: #8b5cf6; }

/* ═══════════════════════════════════════════════════════════════════
   PWA Mobile Optimierung – Touch-Targets, Safe Areas, Offline Banner
   ═══════════════════════════════════════════════════════════════════ */
/* PWA Mobile (consolidated into main responsive above) */

/* PWA Safe Areas (Notch, Home-Indicator) */
@supports (padding: env(safe-area-inset-top)) {
    .header { padding-top: env(safe-area-inset-top); }
    .footer { padding-bottom: env(safe-area-inset-bottom); }
    .nav-bar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

/* Touch-Targets (min 44x44px) für Mobile */
@media (pointer: coarse) {
    .nav-btn, .btn, button { min-height: 44px; min-width: 44px; }
    .filter-bar select, .filter-bar input { min-height: 44px; }
}

/* PWA Standalone-Modus: Kein Browser-Chrome */
@media (display-mode: standalone) {
    .header { padding-top: 8px; }
}

/* Offline-Indicator */
.offline-banner {
    display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
    background: var(--warning); color: #000; text-align: center;
    padding: 6px; font-size: .8rem; font-weight: 600;
}
body.is-offline .offline-banner { display: block; }

/* ═══════════════════════════════════════════════════════════════════
   FLOATING ACTION BUTTON (FAB) — Quick Actions
   ═══════════════════════════════════════════════════════════════════ */
.fab-container {
    position: fixed; bottom: 46px; right: 20px; z-index: 150;
    display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px;
}
.fab-main {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #06b6d4);
    border: none; color: #000; font-size: 1.3rem;
    cursor: pointer; box-shadow: 0 4px 20px rgba(0,212,170,.3);
    transition: all .3s cubic-bezier(.4,0,.2,1);
    display: flex; align-items: center; justify-content: center;
}
.fab-main:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(0,212,170,.45); }
.fab-container.open .fab-main { transform: rotate(45deg); background: var(--text-muted); }
.fab-menu { display: none; flex-direction: column; gap: 6px; padding-bottom: 4px; }
.fab-container.open .fab-menu { display: flex; animation: fabSlideUp .25s ease; }
@keyframes fabSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.fab-action {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 24px;
    background: var(--glass); backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border); color: var(--text-primary);
    font-size: 0.78rem; font-weight: 500; cursor: pointer;
    white-space: nowrap; transition: var(--transition);
}
.fab-action:hover { border-color: var(--accent); background: var(--accent-dim); }
.fab-action.fab-danger { border-color: rgba(239,68,68,.3); }
.fab-action.fab-danger:hover { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.5); }
.fab-action.fab-warning { border-color: rgba(245,158,11,.3); }
.fab-action.fab-warning:hover { background: rgba(245,158,11,.15); }
.fab-action.fab-success { border-color: rgba(16,185,129,.3); }
.fab-action.fab-success:hover { background: rgba(16,185,129,.15); }

/* ═══════════════════════════════════════════════════════════════════
   CONCENTRATION WARNING
   ═══════════════════════════════════════════════════════════════════ */
.concentration-warning {
    margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
    background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.2);
    animation: warnPulse 3s ease infinite;
}
@keyframes warnPulse {
    0%,100% { border-color: rgba(239,68,68,.2); }
    50% { border-color: rgba(239,68,68,.5); }
}
.conc-alert { font-size: 0.82rem; font-weight: 700; color: var(--warning); margin-bottom: 4px; }
.conc-detail { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.5; }

/* ═══════════════════════════════════════════════════════════════════
   IMPROVED RESPONSIVE — Tablets & Mobile
   v8.16.70: col-6/col-8 bleiben bei span 6 (side-by-side) statt span 12
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .col-8 { grid-column: span 8; }
    .col-6 { grid-column: span 6; }
    .col-4, .col-3 { grid-column: span 6; }
    .dashboard { padding: 12px 16px; }
    .risk-metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .perf-heatmap-grid { min-width: 600px; }
}
@media (max-width: 768px) {
    .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; }
    .header { padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
    .header-left h1 { font-size: 1rem; }
    .header-right { gap: 6px; }
    .header-right .last-update { display: none; }
    .nav-bar { padding: 6px 8px; gap: 2px; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .nav-btn { font-size: 0.68rem; padding: 6px 8px; }
    .nav-group-toggle { font-size: 0.68rem; padding: 6px 8px; }
    .nav-group-menu { left: 0; transform: none; min-width: 160px; }
    .dashboard { padding: 8px; max-width: 100%; }
    .card { padding: 14px; }
    .kpi-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
    .kpi-value { font-size: 1.1rem; }
    .hero-stats { flex-direction: column; gap: 8px; }
    .hero-stat-divider { display: none; }
    .broker-grid, .ai-grid, .conn-grid { grid-template-columns: 1fr !important; }
    .risk-metrics-grid { grid-template-columns: 1fr; }
    .system-score-badge { display: none; }
    .dashboard-footer { font-size: 0.6rem; gap: 10px; }
    .fab-container { bottom: 40px; right: 12px; }
    .fab-main { width: 46px; height: 46px; font-size: 1.1rem; }
    .ticker-bar { display: none; }
}
@media (max-width: 480px) {
    .header h1 { font-size: 0.9rem; }
    .header-right > * { font-size: .7rem; }
    .nav-bar { gap: 2px; padding: 4px 8px; overflow-x: auto; flex-wrap: nowrap; }
    .nav-btn { font-size: .65rem; padding: 6px 8px; white-space: nowrap; min-height: 44px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .card { padding: 12px; }
    .data-table { font-size: .7rem; }
    .user-role-badge { font-size: .65rem; padding: 2px 6px; }
    .footer { font-size: .6rem; flex-wrap: wrap; }
}