/* ============================================================
   TRADESKI — Premium Financial Terminal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ===== CSS VARIABLES ===== */
:root {
    --bg-primary:      #07090D;
    --bg-secondary:    #0C0F16;
    --bg-card:         #0C0F16;
    --bg-hover:        rgba(59, 130, 246, 0.04);

    /* Blue accent — primary */
    --amber:           #3B82F6;
    --amber-dim:       rgba(59, 130, 246, 0.16);
    --amber-faint:     rgba(59, 130, 246, 0.06);

    /* Legacy aliases — keep for any runtime reads */
    --cyan:            #3B82F6;
    --cyan-dim:        rgba(59, 130, 246, 0.16);
    --cyan-faint:      rgba(59, 130, 246, 0.06);
    --purple:          #3B82F6;
    --purple-dim:      rgba(59, 130, 246, 0.16);

    /* Semantic */
    --green:           #16A34A;
    --green-dim:       rgba(22, 163, 74, 0.12);
    --red:             #DC2626;
    --red-dim:         rgba(220, 38, 38, 0.12);
    --yellow:          #CA8A04;
    --orange:          #EA580C;

    /* Text */
    --text-primary:    #D1D5DB;
    --text-secondary:  #6B7280;
    --text-muted:      #374151;

    /* Borders */
    --border:          rgba(255, 255, 255, 0.07);
    --border-hover:    rgba(59, 130, 246, 0.30);
    --border-strong:   rgba(59, 130, 246, 0.55);

    /* Shadows — restrained */
    --glow-sm:         0 0 12px rgba(59, 130, 246, 0.08);
    --glow-md:         0 0 22px rgba(59, 130, 246, 0.13);
    --glow-lg:         0 0 36px rgba(59, 130, 246, 0.18);

    /* Layout */
    --header-h:        54px;
    --ticker-h:        34px;
    --status-h:        26px;
    --sidebar-w:       228px;
    --toolbar-h:       42px;

    /* Sharp edges */
    --radius:          2px;
    --radius-sm:       1px;
    --radius-xs:       1px;

    /* Fonts */
    --display:         'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:            'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --sans:            'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;

    --ease:            cubic-bezier(0.4, 0, 0.2, 1);
    --t:               0.15s;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { cursor: pointer; outline: none; }
select { outline: none; }
input  { outline: none; }
a      { color: inherit; text-decoration: none; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--sans);
    font-size: 13px;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar            { width: 3px; height: 3px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: var(--amber-dim); border-radius: 1px; }
::-webkit-scrollbar-thumb:hover{ background: var(--amber); }

/* ===== GRAIN TEXTURE ===== */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    opacity: 0.028;
    pointer-events: none;
    z-index: 0;
}

/* ===== HEADER ===== */
.app-header {
    height: var(--header-h);
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    position: relative;
    z-index: 100;
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 5%, var(--amber) 40%, var(--amber) 60%, transparent 95%);
    opacity: 0.18;
}

.header-left  { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.header-right { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.header-center {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    margin: 0 16px;
}

/* EST time in market status */
.status-time {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text-muted);
    opacity: 0.7;
    padding-left: 4px;
    border-left: 1px solid var(--border);
    margin-left: 4px;
}

/* ===== NEWS HEADER TICKER ===== */
.news-header-wrap {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    height: 100%;
    display: flex;
    align-items: center;
}

.news-header-ticker {
    display: flex;
    align-items: center;
    white-space: nowrap;
    animation: scroll-left 60s linear infinite;
    will-change: transform;
    gap: 0;
}
.news-header-ticker:hover { animation-play-state: paused; }

.news-tick-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--t) var(--ease);
    flex-shrink: 0;
}
.news-tick-item:hover { color: var(--text-primary); }
.news-tick-loading { color: var(--text-muted); font-style: italic; }

.news-tick-dot {
    font-size: 9px;
    flex-shrink: 0;
}
.news-tick-item.news-tick-bullish .news-tick-dot { color: var(--green); }
.news-tick-item.news-tick-bearish .news-tick-dot { color: var(--red); }
.news-tick-item.news-tick-neutral .news-tick-dot { color: var(--text-muted); }

.news-tick-title {
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.news-tick-source {
    font-size: 9px;
    color: var(--amber);
    opacity: 0.55;
    flex-shrink: 0;
}

.news-tick-sep {
    color: var(--text-muted);
    padding: 0 8px;
    font-size: 9px;
    opacity: 0.4;
    flex-shrink: 0;
}

/* Logo */
.logo { display: flex; align-items: center; gap: 9px; }

.logo-icon {
    font-size: 17px;
    color: var(--amber);
    animation: pulse-icon 5s ease-in-out infinite;
}

.logo-text {
    font-family: var(--display);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-primary);
}

/* Market Status */
.market-status {
    display: flex; align-items: center; gap: 7px;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.3);
}

.status-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}
.status-dot.open   { background: var(--green); box-shadow: 0 0 6px var(--green); animation: blink 2s ease-in-out infinite; }
.status-dot.closed { background: var(--red); }
.status-dot.pre    { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); animation: blink 3s ease-in-out infinite; }

/* Header Price Display */
.header-price-item {
    display: flex; align-items: center; gap: 9px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.25);
    transition: border-color var(--t) var(--ease);
}
.header-price-item:hover { border-color: var(--border-hover); }

.hp-symbol { font-family: var(--mono); font-weight: 600; font-size: 12px; color: var(--text-secondary); }
.hp-price  { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }
.hp-change { font-family: var(--mono); font-size: 11px; }
.hp-price.up,  .hp-change.up   { color: var(--green); }
.hp-price.down, .hp-change.down { color: var(--red); }
.hp-price.neutral               { color: var(--text-primary); }

/* WS Indicator */
.ws-indicator {
    display: flex; align-items: center; gap: 6px;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-muted);
}
.ws-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); }
.ws-dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); animation: blink 1.5s ease-in-out infinite; }
.ws-label  { font-size: 10px; }

/* Clock */
.clock {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--amber);
    letter-spacing: 1px;
    min-width: 70px;
    text-align: right;
}

/* ===== TICKER TAPE ===== */
.ticker-wrap {
    height: var(--ticker-h);
    flex-shrink: 0;
    background: rgba(7, 9, 13, 0.97);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    z-index: 50;
}

.ticker-inner {
    height: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.ticker-tape {
    display: flex;
    align-items: center;
    animation: scroll-left 80s linear infinite;
    white-space: nowrap;
    will-change: transform;
}

.ticker-item {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 0 22px;
    font-family: var(--mono);
    font-size: 11px;
    border-right: 1px solid var(--border);
}
.ticker-symbol  { color: var(--amber); letter-spacing: 0.5px; font-weight: 600; }
.ticker-price   { color: var(--text-primary); }
.ticker-change.up   { color: var(--green); }
.ticker-change.down { color: var(--red); }
.ticker-sep { color: var(--text-muted); padding: 0 4px; }

/* ===== MACRO RIBBON ===== */
.macro-ribbon {
    height: 46px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    position: relative;
    z-index: 40;
}

.macro-ribbon-inner {
    height: 100%;
    display: flex;
    align-items: stretch;
}

.macro-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-right: 1px solid var(--border);
    gap: 2px;
    min-width: 0;
    cursor: default;
    transition: background var(--t) var(--ease);
}
.macro-item:last-child { border-right: none; }
.macro-item:hover      { background: var(--bg-hover); }
.macro-item.macro-loading { flex: 1; }

.macro-label {
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.macro-value {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.macro-value.up      { color: var(--green); }
.macro-value.down    { color: var(--red); }
.macro-value.neutral { color: var(--text-primary); }

.macro-date {
    font-family: var(--mono);
    font-size: 8px;
    color: var(--text-muted);
    white-space: nowrap;
}

.macro-error {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* ===== PORTFOLIO PANEL ===== */
.portfolio-total-badge {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--amber);
    letter-spacing: 0.5px;
}

.portfolio-list {
    max-height: 220px;
    overflow-y: auto;
}

.portfolio-item {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: background var(--t) var(--ease);
}
.portfolio-item:last-child { border-bottom: none; }
.portfolio-item:hover      { background: var(--bg-hover); }

.pf-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pf-symbol {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.pf-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    padding: 0 2px;
    line-height: 1;
    transition: color var(--t) var(--ease);
}
.pf-delete-btn:hover { color: var(--red); }

.pf-row2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.pf-shares { font-family: var(--mono); font-size: 10px; color: var(--text-secondary); }

.pf-value {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

.pf-pnl {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
}
.pf-pnl.up   { color: var(--green); }
.pf-pnl.down { color: var(--red); }

.pf-no-price { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }

.portfolio-form { display: flex; flex-direction: column; gap: 6px; }

.portfolio-form-row {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pf-input {
    flex: 1;
    min-width: 0;
    padding: 5px 7px;
    font-size: 11px;
}

.pf-add-btn {
    flex-shrink: 0;
    padding: 5px 9px;
    font-size: 10px;
    font-family: var(--mono);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* ===== APP BODY ===== */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ===== SIDEBARS ===== */
.sidebar-left, .sidebar-right {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    overflow-y: auto;
}
.sidebar-left  { border-right: 1px solid var(--border); }
.sidebar-right { border-left:  1px solid var(--border); }

/* ===== PANELS ===== */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--t) var(--ease);
}
.panel:hover { border-color: rgba(59, 130, 246, 0.18); }
.panel-grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.25);
}

.panel-footer {
    padding: 8px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}

.panel-title {
    font-family: var(--display);
    font-size: 9px;
    letter-spacing: 2.5px;
    color: var(--amber);
    font-weight: 600;
    text-transform: uppercase;
}

/* ===== WATCHLIST ===== */
.watchlist { padding: 4px; }

.watchlist-item {
    display: flex;
    flex-direction: column;
    padding: 8px 10px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--t) var(--ease);
    margin-bottom: 2px;
}
.watchlist-item:hover  { background: var(--bg-hover); border-color: var(--border); }
.watchlist-item.active { background: rgba(59, 130, 246, 0.06); border-color: var(--amber-dim); }

.wl-top  { display: flex; align-items: center; justify-content: space-between; }
.wl-left { display: flex; flex-direction: column; gap: 1px; }

.wl-symbol { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.wl-name   { font-size: 10px; color: var(--text-muted); }

.wl-right  { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.wl-price  { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.wl-change { font-family: var(--mono); font-size: 10px; }

.wl-price.up,   .wl-change.up   { color: var(--green); }
.wl-price.down, .wl-change.down { color: var(--red); }
.wl-price.neutral               { color: var(--text-primary); }

.wl-sparkline {
    display: block;
    width: 100%;
    height: 28px;
    margin-top: 5px;
    border-radius: 1px;
    opacity: 0.8;
}

/* ===== WATCHLIST TICKER ===== */
.wl-tape-wrap {
    overflow: hidden;
    padding: 4px 4px;
}
.wl-tape {
    display: flex;
    gap: 4px;
    width: max-content;
    animation: scroll-left 28s linear infinite;
    will-change: transform;
}
.wl-tape:hover { animation-play-state: paused; }

.wl-chip {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-base);
    flex-shrink: 0;
    transition: all var(--t) var(--ease);
    position: relative;
}
.wl-chip:hover  { background: var(--bg-hover); border-color: rgba(59,130,246,0.35); }
.wl-chip.active { background: rgba(59,130,246,0.06); border-color: var(--amber-dim); }

.wl-chip .wl-symbol {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 11px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}
.wl-chip .wl-price-row { display: flex; gap: 5px; align-items: center; }
.wl-chip .wl-price  { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.wl-chip .wl-change { font-family: var(--mono); font-size: 9px; }
.wl-chip .wl-remove-btn {
    position: absolute;
    top: 2px; right: 3px;
    font-size: 9px;
    padding: 0 2px;
    opacity: 0;
    transition: opacity var(--t);
}
.wl-chip:hover .wl-remove-btn { opacity: 1; }

/* ===== CHART AREA ===== */
.chart-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-toolbar {
    height: var(--toolbar-h);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    gap: 12px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; }
.toolbar-label {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.symbol-search-wrap { display: flex; align-items: center; gap: 4px; }
.symbol-input {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    width: 140px;
    transition: border-color var(--t);
}
.symbol-input::placeholder { color: var(--text-muted); font-weight: 400; }
.symbol-input:focus { border-color: var(--amber); }

.symbol-go-btn {
    background: var(--amber);
    color: #000;
    border: none;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: opacity var(--t);
}
.symbol-go-btn:hover { opacity: 0.82; }

.wl-remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color var(--t);
}
.wl-remove-btn:hover { color: var(--red); }

.timeframe-group { display: flex; gap: 1px; }
.tf-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--t) var(--ease);
    letter-spacing: 0.5px;
}
.tf-btn:hover  { color: var(--text-primary); border-color: var(--border); }
.tf-btn.active { color: var(--amber); border-color: var(--amber-dim); background: var(--amber-faint); }

.indicator-toggles { display: flex; gap: 3px; }
.ind-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 10px;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    transition: all var(--t) var(--ease);
    letter-spacing: 0.5px;
}
.ind-btn.active { color: var(--amber); border-color: var(--amber-dim); background: var(--amber-faint); }
.ind-btn:hover  { border-color: var(--border-hover); color: var(--text-primary); }

.chart-container {
    flex: 1;
    min-height: 0;
    position: relative;
}

.chart-loading {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
    font-family: var(--mono);
    font-size: 12px;
    background: var(--bg-primary);
    z-index: 10;
}
.chart-loading.hidden { display: none; }

/* Regular arrow cursor inside the chart instead of the large crosshair */
#price-chart .drag,
#price-chart .nsewdrag,
#price-chart .ewdrag,
#price-chart .nsdrag,
#price-chart .nwse-drg,
#price-chart .nesw-drg { cursor: default !important; }

/* ===== MARKET DATA STRIP ===== */
.market-data-strip {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    overflow-x: auto;
    scrollbar-width: none;
}
.market-data-strip::-webkit-scrollbar { display: none; }

.md-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 6px 14px;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    transition: background var(--t);
}
.md-item:hover { background: var(--bg-hover); }
.md-selected { border-right-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.05) !important; }

.md-label {
    font-family: var(--mono);
    font-size: 8px;
    color: var(--text-muted);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    white-space: nowrap;
}
.md-value {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}
.md-value.up   { color: var(--green); }
.md-value.down { color: var(--red); }

.md-range-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 6px 14px;
    flex: 1;
    min-width: 160px;
}
.md-range-track {
    position: relative;
    height: 2px;
    background: rgba(255,255,255,0.07);
    border-radius: 1px;
}
.md-range-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: var(--cyan);
    border-radius: 1px;
}
.md-range-cursor {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--cyan);
    border: 1.5px solid var(--bg-card);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.stat-cell {
    padding: 9px 12px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 2px;
    transition: background var(--t);
}
.stat-cell:hover { background: var(--bg-hover); }
.stat-cell:nth-child(2n) { border-right: none; }

.stat-label {
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.stat-value.up   { color: var(--green); }
.stat-value.down { color: var(--red); }
.stat-value.span-full { grid-column: 1 / -1; }

.range-cell {
    grid-column: 1 / -1;
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--border);
}
.range-label {
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 7px;
}

.range-track {
    height: 2px;
    background: rgba(255,255,255,0.05);
    border-radius: 1px;
    position: relative;
}
.range-fill {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, var(--red), var(--yellow), var(--green));
    border-radius: 1px;
}
.range-cursor {
    position: absolute;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--amber);
    border: 2px solid var(--bg-primary);
    top: 50%; transform: translate(-50%, -50%);
}
.range-extremes {
    display: flex; justify-content: space-between;
    margin-top: 5px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
}

/* ===== SIDEBAR TABS ===== */
.sidebar-tabs {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.sidebar-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 2px;
    padding: 8px 4px;
    cursor: pointer;
    transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
    text-transform: uppercase;
    margin-bottom: -1px;
}
.sidebar-tab:hover  { color: var(--text-primary); }
.sidebar-tab.active { color: var(--amber); border-bottom-color: var(--amber); }

.tab-pane {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* News tab sentiment row */
.news-tab-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.news-tab-label {
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ===== INDICATORS PANEL ===== */
.indicators-panel { padding: 5px; display: flex; flex-direction: column; gap: 3px; }

.ind-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.15);
    transition: border-color var(--t);
}
.ind-card:hover { border-color: var(--border-hover); }

.ind-header-static {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
}

.ind-detail {
    padding: 2px 8px 6px;
    border-top: 1px solid var(--border);
}

.ind-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 3px;
}
.ind-name {
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: 1px;
    color: var(--text-secondary);
    text-transform: uppercase;
}
.ind-val   { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.ind-sub   { font-family: var(--mono); font-size: 9px; color: var(--text-secondary); }
.ind-trend { font-family: var(--mono); font-size: 9px; font-weight: 600; }

.signal-chip {
    font-family: var(--mono);
    font-size: 7px;
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 600;
    border: 1px solid transparent;
    flex-shrink: 0;
}
.signal-chip.buy     { color: var(--green); background: var(--green-dim); border-color: rgba(22,163,74,0.25); }
.signal-chip.sell    { color: var(--red);   background: var(--red-dim);   border-color: rgba(220,38,38,0.25); }
.signal-chip.neutral { color: var(--text-muted); background: rgba(255,255,255,0.04); border-color: var(--border); }

/* RSI Gauge */
.gauge-track {
    height: 2px;
    background: rgba(255,255,255,0.05);
    border-radius: 1px;
    position: relative;
    overflow: hidden;
    margin-top: 5px;
}
.gauge-fill {
    height: 100%;
    border-radius: 1px;
    transition: width 0.6s var(--ease), background 0.6s;
}
.gauge-fill.oversold   { background: var(--green); }
.gauge-fill.neutral    { background: var(--amber); }
.gauge-fill.overbought { background: var(--red); }

.gauge-marks {
    position: absolute; inset: 0;
    pointer-events: none;
}
.gauge-mark {
    position: absolute; top: 0; bottom: 0;
    width: 1px; background: rgba(255,255,255,0.12);
}

/* ===== ALERTS LIST ===== */
.alerts-list { padding: 4px; max-height: 120px; overflow-y: auto; }

.alert-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 3px;
    background: rgba(0,0,0,0.15);
    font-size: 11px;
    transition: border-color var(--t);
}
.alert-row:hover     { border-color: var(--border-hover); }
.alert-row-left      { display: flex; flex-direction: column; gap: 1px; }
.alert-sym-type      { font-family: var(--mono); font-weight: 600; color: var(--amber); font-size: 11px; }
.alert-thresh        { font-family: var(--mono); font-size: 9px; color: var(--text-muted); }

.del-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
    transition: color var(--t), background var(--t);
}
.del-btn:hover { color: var(--red); background: var(--red-dim); }

/* ===== SIGNAL FEED ===== */
.alerts-feed {
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feed-item {
    padding: 7px 10px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: 2px solid var(--amber);
    background: rgba(59, 130, 246, 0.04);
    font-size: 11px;
    line-height: 1.4;
}
.feed-item.alert { border-left-color: var(--orange); background: rgba(234,88,12,0.04); }
.feed-item.buy   { border-left-color: var(--green);  background: rgba(22,163,74,0.04); }
.feed-item.sell  { border-left-color: var(--red);    background: rgba(220,38,38,0.04); }

.feed-time {
    display: block;
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 3px;
}

.feed-empty {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 8px;
    font-family: var(--mono);
}

/* ===== BADGE ===== */
.badge {
    font-family: var(--mono);
    font-size: 10px;
    padding: 1px 7px;
    border-radius: 2px;
    background: var(--amber-dim);
    color: var(--amber);
    border: 1px solid var(--amber-dim);
    min-width: 22px;
    text-align: center;
}

.symbol-badge {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: 1px;
}

/* ===== BUTTONS ===== */
.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 22px; height: 22px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    transition: all var(--t) var(--ease);
}
.btn-icon:hover { border-color: var(--amber); color: var(--amber); }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.5px;
    transition: all var(--t) var(--ease);
}
.btn-secondary:hover { border-color: var(--amber); color: var(--amber); background: var(--bg-hover); }

.btn-primary {
    background: var(--amber-faint);
    border: 1px solid var(--amber-dim);
    color: var(--amber);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 1px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all var(--t) var(--ease);
}
.btn-primary:hover { background: rgba(59, 130, 246, 0.12); }

.full-width { width: 100%; }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.82);
    z-index: 500;
    display: flex; align-items: center; justify-content: center;
    animation: fade-in 0.18s ease;
}

.modal {
    background: #0C0F16;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    width: 360px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.7);
}

.modal-header {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}

.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.form-input {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 12px;
    width: 100%;
    transition: border-color var(--t), box-shadow var(--t);
}
.form-input:focus { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(245,158,11,0.07); }
.form-input option { background: #0C0F16; }

/* ===== STATUS BAR ===== */
.status-bar {
    height: var(--status-h);
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.status-brand { color: var(--text-muted); opacity: 0.5; }

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    width: 14px; height: 14px;
    border: 1px solid var(--border);
    border-top-color: var(--amber);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

/* ===== SKELETON ===== */
.skeleton .hp-price { color: var(--text-muted); }

/* ===== FLASH ANIMATIONS ===== */
@keyframes flash-up {
    0%   { background: rgba(22, 163, 74, 0.20); }
    100% { background: transparent; }
}
@keyframes flash-down {
    0%   { background: rgba(220, 38, 38, 0.20); }
    100% { background: transparent; }
}
.flash-up   { animation: flash-up   0.9s ease-out forwards; }
.flash-down { animation: flash-down 0.9s ease-out forwards; }

/* ===== KEYFRAMES ===== */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

@keyframes pulse-icon {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes scroll-left {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== SKI CHATBOT ===== */

.ski-fab {
    position: fixed;
    bottom: calc(var(--status-h) + 18px);
    right: 20px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--amber);
    border-radius: var(--radius-sm);
    cursor: pointer;
    z-index: 500;
    transition: background var(--t) var(--ease), box-shadow var(--t) var(--ease);
    user-select: none;
}
.ski-fab:hover {
    background: var(--amber-faint);
    box-shadow: var(--glow-md);
}
.ski-fab-icon {
    font-size: 13px;
    color: var(--amber);
}
.ski-fab-label {
    font-family: var(--display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--amber);
}
.ski-fab-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
}

.ski-panel {
    position: fixed;
    bottom: calc(var(--status-h) + 72px);
    right: 20px;
    width: 380px;
    height: 520px;
    background: #09090D;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    z-index: 500;
    box-shadow: 0 12px 48px rgba(0,0,0,0.75);
    animation: slide-up 0.2s var(--ease);
    overflow: hidden;
}
.ski-panel.hidden { display: none; }

.ski-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.4);
    flex-shrink: 0;
}
.ski-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ski-icon {
    font-size: 16px;
    color: var(--amber);
    animation: pulse-icon 5s ease-in-out infinite;
}
.ski-title {
    font-family: var(--display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--amber);
}
.ski-subtitle {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.ski-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #09090D;
}

.ski-message {
    display: flex;
    animation: fade-in 0.16s var(--ease);
}
.ski-message-user      { justify-content: flex-end; }
.ski-message-assistant { justify-content: flex-start; }

.ski-bubble {
    max-width: 85%;
    padding: 8px 12px;
    font-size: 12.5px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: var(--radius-sm);
}
.ski-message-user .ski-bubble {
    background: var(--amber-dim);
    border: 1px solid rgba(59, 130, 246, 0.22);
    color: var(--text-primary);
    font-family: var(--sans);
}
.ski-message-assistant .ski-bubble {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 12px;
}
.ski-message-assistant .ski-bubble.loading {
    color: var(--text-secondary);
    font-style: italic;
}

.ski-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.35);
    flex-shrink: 0;
}

.ski-input {
    flex: 1;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-primary);
    transition: border-color var(--t) var(--ease);
}
.ski-input:focus { border-color: var(--amber); }
.ski-input::placeholder { color: var(--text-muted); }

.ski-send-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--amber);
    border: none;
    color: #000;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity var(--t) var(--ease);
}
.ski-send-btn:hover    { opacity: 0.82; }
.ski-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== NEWS FEED ===== */

.news-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    max-height: 340px;
}

.news-item {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    transition: background var(--t) var(--ease);
    animation: fade-in 0.2s var(--ease);
}
.news-item:last-child { border-bottom: none; }
.news-item:hover      { background: var(--bg-hover); }

.news-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.news-sentiment {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 2px 6px;
    border-radius: 1px;
    flex-shrink: 0;
}
.news-sentiment.bullish {
    background: var(--green-dim);
    border: 1px solid rgba(22, 163, 74, 0.3);
    color: var(--green);
}
.news-sentiment.bearish {
    background: var(--red-dim);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: var(--red);
}
.news-sentiment.neutral {
    background: rgba(107, 114, 128, 0.12);
    border: 1px solid rgba(107, 114, 128, 0.22);
    color: var(--text-secondary);
}

.news-title {
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}
.news-title:hover { color: var(--amber); }

.news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}
.news-source {
    font-family: var(--mono);
    font-size: 9.5px;
    color: var(--amber);
    opacity: 0.65;
}
.news-time {
    font-family: var(--mono);
    font-size: 9.5px;
    color: var(--text-muted);
}

/* Aggregate sentiment chip */
.sentiment-chip {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 2px 7px;
    border-radius: 1px;
    background: rgba(107, 114, 128, 0.12);
    border: 1px solid rgba(107, 114, 128, 0.22);
    color: var(--text-secondary);
    transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.sentiment-chip.bullish {
    background: var(--green-dim);
    border-color: rgba(22, 163, 74, 0.3);
    color: var(--green);
}
.sentiment-chip.bearish {
    background: var(--red-dim);
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--red);
}
.sentiment-chip.neutral {
    background: rgba(202, 138, 4, 0.10);
    border-color: rgba(202, 138, 4, 0.25);
    color: var(--yellow);
}

/* ===== SCREENER ===== */

.screener-btn {
    font-family: var(--display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 1px solid var(--border-hover);
    color: var(--amber);
    transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.screener-btn:hover {
    border-color: var(--amber);
    background: var(--amber-faint);
}

.modal-wide {
    width: min(92vw, 960px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.screener-filters {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }

.filter-label {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.filter-range {
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-input {
    width: 72px;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 11px;
    transition: border-color var(--t) var(--ease);
}
.filter-input:focus { border-color: var(--amber); }
.filter-input::placeholder { color: var(--text-muted); }

.filter-select {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--mono);
    font-size: 11px;
    transition: border-color var(--t) var(--ease);
    min-width: 140px;
}
.filter-select:focus { border-color: var(--amber); }

.filter-sep { color: var(--text-muted); font-size: 11px; }

.filter-reset {
    margin-left: auto;
    align-self: flex-end;
    padding: 5px 12px;
    font-size: 10px;
}

.screener-table-wrap {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.screener-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.screener-table thead {
    position: sticky;
    top: 0;
    background: #0C0F16;
    z-index: 1;
}

.screener-table th {
    padding: 9px 12px;
    text-align: left;
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

.screener-table th.sortable {
    cursor: pointer;
    transition: color var(--t) var(--ease);
}
.screener-table th.sortable:hover  { color: var(--text-secondary); }
.screener-table th.sortable.sorted { color: var(--amber); }

.sort-icon { font-size: 10px; opacity: 0.5; margin-left: 3px; }
.screener-table th.sorted .sort-icon { opacity: 1; }

.screener-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 12px;
    white-space: nowrap;
}

.screener-row { transition: background var(--t) var(--ease); }
.screener-row:hover { background: var(--bg-hover); }
.screener-row:last-child td { border-bottom: none; }

.sc-symbol {
    font-family: var(--mono);
    font-weight: 600;
    color: var(--amber);
    cursor: pointer;
    font-size: 12px;
}
.sc-symbol:hover { text-decoration: underline; }

.sc-name   { color: var(--text-secondary); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.sc-price, .sc-pe, .sc-mcap, .sc-high, .sc-low { font-family: var(--mono); }
.sc-sector { font-size: 10px; color: var(--text-secondary); font-family: var(--mono); }

.sc-perf {
    font-family: var(--mono);
    font-weight: 600;
    font-size: 12px;
}
.sc-perf.positive { color: var(--green); }
.sc-perf.negative { color: var(--red); }

.screener-loading {
    text-align: center;
    padding: 40px !important;
    color: var(--text-secondary);
    font-family: var(--mono);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
