:root {
    --bg-dark: #0a0e17;
    --card-bg: rgba(17, 24, 39, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --color-bull: #10b981;
    --color-bear: #ef4444;
    --color-neutral: #6b7280;
    
    --regime-acc: #3b82f6; /* blue */
    --regime-markup: #10b981; /* green */
    --regime-dist: #f97316; /* orange */
    --regime-markdown: #ef4444; /* red */

    --font-text: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Glassmorphism utilities */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* App Layout — full width, no sidebar */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.text-bull { color: var(--color-bull); }
.text-bear { color: var(--color-bear); }
.text-neutral { color: var(--color-neutral); }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
}

/* Tabs Header */
.tabs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 14, 23, 0.95);
}
.tabs-left {
    display: flex;
    align-items: center;
    gap: 4px;
}
.tabs-right {
    display: flex;
    align-items: center;
}
.brand {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-right: 20px;
    background: linear-gradient(90deg, #fff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}
.header-search {
    padding: 7px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-text);
    font-size: 0.85rem;
    width: 180px;
    transition: border-color 0.2s, width 0.3s;
}
.header-search:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.5);
    width: 240px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 15px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--text-main);
    border-bottom-color: var(--color-bull);
}

.tab-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

.tab-pane {
    display: none;
    height: 100%;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #e5e7eb;
}

/* Command Center */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 10px;
}
.section-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #e5e7eb;
}
.toggle-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

/* Alpha Filter Dropdown */
.sortable-col {
    position: relative;
    cursor: pointer;
    user-select: none;
}
.sort-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 2px;
}
.filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #1e293b;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    padding: 6px;
    z-index: 100;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.filter-dropdown.show { display: flex; flex-direction: column; gap: 2px; }
.filter-opt {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    font-size: 0.8rem;
    white-space: nowrap;
}
.filter-opt:hover { background: rgba(255,255,255,0.08); color: #fff; }
.filter-opt.active { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

/* Buy Force Progress Bar (V3 style) */
.buy-force-cell {
    min-width: 160px;
}
.buy-force-bar {
    width: 100%;
    height: 6px;
    background: rgba(239, 68, 68, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.buy-force-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

.heat-cell {
    aspect-ratio: 2/1;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.heat-cell:hover {
    transform: scale(1.02);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.heat-cell .symbol { font-weight: 700; font-size: 1.1rem; }
.heat-cell .price { font-family: var(--font-mono); font-size: 0.85rem; margin-top: 4px; }
.heat-cell .alpha { font-family: var(--font-mono); font-size: 0.75rem; font-weight: bold; margin-top: 2px; }

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th {
    font-family: var(--font-text);
    font-weight: 500;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    background: rgba(17, 24, 39, 0.95);
    z-index: 1;
    cursor: pointer;
}
.data-table th:hover { color: var(--text-main); }
.data-table tr:hover { background: rgba(255,255,255,0.03); }

/* Regime badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-text);
}
.badge.acc { background: rgba(59, 130, 246, 0.2); color: var(--regime-acc); border: 1px solid rgba(59, 130, 246, 0.5); }
.badge.markup { background: rgba(16, 185, 129, 0.2); color: var(--regime-markup); border: 1px solid rgba(16, 185, 129, 0.5); }
.badge.dist { background: rgba(249, 115, 22, 0.2); color: var(--regime-dist); border: 1px solid rgba(249, 115, 22, 0.5); }
.badge.markdown { background: rgba(239, 68, 68, 0.2); color: var(--regime-markdown); border: 1px solid rgba(239, 68, 68, 0.5); }
.badge.neutral { background: rgba(107, 114, 128, 0.2); color: var(--color-neutral); border: 1px solid rgba(107, 114, 128, 0.5); }

/* Deep Dive */
.deep-dive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.deep-dive-header h2 { font-size: 1.5rem; }

.tf-switcher {
    display: flex;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    padding: 4px;
}

.tf-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.tf-btn.active {
    background: var(--card-bg);
    color: var(--text-main);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.chart-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-auto-rows: minmax(250px, auto);
    gap: 20px;
    height: calc(100% - 60px);
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.panel-price { grid-column: span 2; grid-row: span 2; min-height: 400px; }
.panel-cvd, .panel-segment, .panel-obi, .panel-foreign { grid-column: span 1; min-height: 250px; }
.panel-alpha { grid-column: span 1; }

.chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-container {
    flex: 1;
    position: relative;
    width: 100%;
}

.alpha-gauge-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.alpha-score-display {
    font-size: 3rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-bottom: 10px;
}

.avg-sizes-panel {
    margin-top: 20px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.avg-stat {
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avg-stat .label { font-size: 0.75rem; color: var(--text-muted); }
.avg-stat .val { font-family: var(--font-mono); font-weight: bold; margin-top: 5px; }

/* Flow Tracker */
.sector-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.sector-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.sector-card h4 { margin-bottom: 15px; color: var(--text-muted); }
.sector-stat { margin-bottom: 10px; }
.sector-stat .lbl { font-size: 0.75rem; display: block; color: var(--text-muted); }
.sector-stat .v { font-family: var(--font-mono); font-size: 1.1rem; font-weight: bold; }

.movers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.mover-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.mover-card h4 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.mover-list { list-style: none; }
.mover-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.05);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* Alerts */
.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.alerts-filter select, .alerts-filter input {
    padding: 8px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    margin-left: 10px;
}

.alerts-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item {
    background: var(--card-bg);
    border-left: 4px solid var(--color-neutral);
    border-radius: 4px;
    padding: 15px;
    display: flex;
    align-items: flex-start;
}

.alert-item.high { border-left-color: var(--color-bear); }
.alert-item.medium { border-left-color: #f59e0b; }
.alert-item.low { border-left-color: var(--color-bull); }

.alert-time { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); width: 100px; flex-shrink: 0; }
.alert-sym { font-weight: bold; width: 60px; flex-shrink: 0; }
.alert-msg { flex: 1; margin-left: 15px; }

/* Bottom Bar */
.bottom-bar {
    height: 40px;
    background: #05080f;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    z-index: 20;
}

.status-indicator {
    display: flex;
    align-items: center;
    margin-right: 30px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--color-bull);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 8px var(--color-bull);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.mini-ticker {
    display: flex;
    align-items: center;
    margin-right: 20px;
    gap: 15px;
}

.mini-ticker-item {
    display: flex;
    gap: 5px;
}

.system-health {
    margin-left: auto;
    color: var(--text-muted);
}
.system-health .separator { margin: 0 10px; }

/* Selected row in screener */
.data-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}
.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}
.data-table tbody tr.row-selected {
    background: rgba(16, 185, 129, 0.12);
    border-left: 3px solid var(--color-bull);
}
.data-table tbody tr.row-flash {
    animation: rowFlash 0.8s ease-out;
}
@keyframes rowFlash {
    0% { background: rgba(16, 185, 129, 0.4); }
    100% { background: rgba(16, 185, 129, 0.12); }
}

/* Sidebar stock items cursor */
.stock-item {
    cursor: pointer;
}

/* Info tooltip (i) icon */
.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 11px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
    transition: background 0.2s, color 0.2s;
}
.info-tip:hover {
    background: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}
.info-tip:hover::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 12px 14px;
    background: #1e293b;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 400;
    font-family: var(--font-text);
    line-height: 1.5;
    white-space: normal;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: tipFadeIn 0.2s ease-out;
}
.info-tip:hover::before {
    content: '';
    position: absolute;
    top: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #1e293b;
    z-index: 1001;
}
@keyframes tipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}


