:root {
  --bg: #08101e;
  --card: #0f1923;
  --card2: #131f2e;
  --panel: #0d1829;
  --border: #1a2d45;
  --text: #dce8f5;
  --muted: #566882;
  --bull: #22c55e;
  --bear: #ef4444;
  --neutral: #64748b;
  --blue: #3b82f6;
  --orange: #f59e0b;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
}
#ticker-bar {
  background: #070d18;
  border-bottom: 1px solid var(--border);
  padding: 5px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  overflow-x: auto;
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 54px;
}
#ticker-bar::-webkit-scrollbar { height: 3px; }
#ticker-bar::-webkit-scrollbar-thumb { background: #1a2d45; }
.live-badge {
  font-size: 10px;
  font-weight: 800;
  color: #ff9933;
  border: 1px solid #ff993355;
  border-radius: 4px;
  padding: 2px 7px;
  letter-spacing: 1px;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  margin-right: 4px;
  animation: pulse 1.5s infinite;
}
.live-dot.stale { background: #f59e0b; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.ticker-item { display: flex; flex-direction: column; gap: 0; cursor: default; min-width: 74px; }
.t-label { font-size: 9px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.t-price { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.t-chg { font-size: 10px; font-weight: 500; }
.t-spark { line-height: 0; margin-top: 2px; }
.up { color: var(--bull); }
.dn { color: var(--bear); }
#mkt-status { margin-left: auto; font-size: 10px; color: var(--muted); flex-shrink: 0; }
.t-skeleton { width: 65px; height: 40px; background: #1a2d45; border-radius: 4px; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { 0% { opacity: .4; } 50% { opacity: .7; } 100% { opacity: .4; } }
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 9px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
header h1 {
  font-size: 15px;
  font-weight: 800;
  background: linear-gradient(100deg, #ff9933 0%, #ffffff 50%, #138808 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
#search {
  background: #08101e;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 6px 12px;
  font-size: 12px;
  width: 230px;
  outline: none;
  transition: border-color .15s;
}
#search:focus { border-color: var(--blue); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
#updated, #next-refresh { font-size: 10px; color: var(--muted); white-space: nowrap; }
#refresh-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); opacity: 0; transition: opacity .3s; }
#refresh-pulse.active { animation: blink .6s 3; }
@keyframes blink { 0%,100% { opacity: 0; } 50% { opacity: 1; } }
.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  line-height: 1;
}
.icon-btn:hover { border-color: var(--blue); color: var(--text); }
.icon-btn.on { border-color: #f59e0b; color: #f59e0b; }
.refresh-wrap { display: flex; align-items: center; gap: 6px; }
.refresh-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
#refresh-window {
  background: #08101e;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 8px;
  font-size: 11px;
  outline: none;
}
#refresh-window:focus { border-color: var(--blue); }
.main { display: flex; flex: 1; overflow: hidden; }
.news-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}
.sort-bar {
  padding: 24px 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.sort-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.sort-btn, .filt-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.sort-btn:hover, .filt-btn:hover { border-color: var(--blue); color: var(--text); }
.sort-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 700; }
.filt-btn.bull-on { background: #052e1a; border-color: var(--bull); color: #4ade80; font-weight: 700; }
.filt-btn.bear-on { background: #3b0000; border-color: var(--bear); color: #fca5a5; font-weight: 700; }
.filt-btn.bm-on { background: #1c1200; border-color: var(--orange); color: var(--orange); font-weight: 700; }
.scope-btn.scope-on { background: #10261e; border-color: #1f8a5b; color: #8ef0c5; font-weight: 700; }
.time-btn.time-on { background: #0d2447; border-color: var(--blue); color: #bfdbfe; font-weight: 700; }
.bar-sep { color: var(--border); font-size: 16px; user-select: none; }
.sort-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding-left: 4px;
}
#filter-badge {
  display: none;
  align-items: center;
  gap: 8px;
  background: #0d1829;
  border-bottom: 1px solid #1a2d45;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--orange);
  flex-shrink: 0;
}
#filter-badge.show { display: flex; }
.clr-btn {
  background: transparent;
  border: 1px solid #f59e0b44;
  border-radius: 5px;
  color: var(--orange);
  padding: 2px 8px;
  font-size: 10px;
  cursor: pointer;
}
.clr-btn:hover { background: #f59e0b1a; }
.system-status-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  background: #0c1522;
}
.sys-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text);
  background: #102038;
  border: 1px solid #1f3a5c;
  border-radius: 999px;
  padding: 3px 8px;
}
.sys-pill.sys-muted {
  color: var(--muted);
  background: #0f1926;
  border-color: #1a2d45;
}
.sys-pill.sys-ok {
  color: #86efac;
  background: #052e1a;
  border-color: #166534;
}
.sys-pill.sys-warn {
  color: #fbbf24;
  background: #2b1b00;
  border-color: #7c4a03;
}
#feed { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
#feed::-webkit-scrollbar { width: 5px; }
#feed::-webkit-scrollbar-thumb { background: #1a2d45; border-radius: 3px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  transition: border-color .15s, transform .1s, box-shadow .15s;
  animation: slideIn .25s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.card:hover { border-color: #243d5e; transform: translateY(-1px); box-shadow: 0 4px 20px #00000044; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.45; flex: 1; }
.wl-tag {
  display: inline-block;
  font-size: 8px;
  font-weight: 800;
  background: var(--orange);
  color: #000;
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 5px;
  vertical-align: middle;
}
.card-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.badge {
  font-size: 8px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}
.b-sector { background: #0d2447; color: #60a5fa; }
.b-local { background: #10261e; color: #8ef0c5; }
.b-global { background: #241537; color: #d8b4fe; }
.b-bull { background: #052e1a; color: #4ade80; }
.b-bear { background: #3b0000; color: #fca5a5; }
.b-neut { background: #1a1f2e; color: #94a3b8; }
.card-summary { font-size: 11.5px; color: var(--muted); line-height: 1.55; margin-bottom: 10px; }
.card-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.meta { display: flex; gap: 8px; align-items: center; }
.meta-src { font-size: 10px; color: var(--blue); font-weight: 600; }
.meta-time { font-size: 10px; color: var(--muted); }
.impact-row { display: flex; align-items: center; gap: 6px; }
.imp-lbl { font-size: 9px; color: var(--muted); }
.imp-track { width: 58px; height: 4px; background: #1a2d45; border-radius: 2px; overflow: hidden; }
.imp-fill { height: 100%; border-radius: 2px; transition: width .6s ease; }
.imp-hi .imp-fill { background: var(--bear); }
.imp-md .imp-fill { background: var(--orange); }
.imp-lo .imp-fill { background: var(--bull); }
.card-actions { display: flex; align-items: center; gap: 6px; }
.read-btn {
  font-size: 10px;
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  padding: 3px 9px;
  border: 1px solid #1a3a5f;
  border-radius: 5px;
  transition: background .15s;
  white-space: nowrap;
}
.read-btn:hover { background: #0d2447; }
.bm-btn {
  background: transparent;
  border: none;
  color: #646d78;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  min-width: 26px;
  min-height: 26px;
  padding: 1px 3px;
  opacity: 1;
  text-shadow: 0 0 8px rgba(100, 109, 120, .18);
  transition: color .15s, opacity .15s, text-shadow .15s, transform .15s;
}
.bm-btn:hover { color: #fbbf24; text-shadow: 0 0 10px #f59e0b66; transform: translateY(-1px); }
.bm-btn.bm-on {
  color: #fbbf24;
  opacity: 1;
  text-shadow: 0 0 10px #f59e0b66;
}
#no-results { display: none; text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 50px 20px; color: var(--muted); font-size: 13px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sidebar { width: 430px; flex-shrink: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--card2); }
.tab-bar { display: flex; border-bottom: 1px solid var(--border); background: var(--card); flex-shrink: 0; }
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 9px 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .3px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-pane { display: none; flex: 1; overflow-y: auto; }
.tab-pane.active { display: block; }
.tab-pane::-webkit-scrollbar { width: 5px; }
.tab-pane::-webkit-scrollbar-thumb { background: #1a2d45; border-radius: 3px; }
.pane-inner { display: flex; flex-direction: column; min-height: 100%; }
.panel-band { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-sub { font-size: 9px; color: var(--muted); font-weight: 400; letter-spacing: 0; text-transform: none; margin-left: 4px; }
.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.overview-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ov-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.ov-value { font-size: 14px; font-weight: 800; line-height: 1.2; }
.ov-detail { font-size: 10px; color: var(--muted); line-height: 1.45; margin-top: auto; }
.tone-bull .ov-value, .tone-bull .desk-text, .tone-bull .hm-move, .tone-bull .stat-value { color: #4ade80; }
.tone-bear .ov-value, .tone-bear .desk-text, .tone-bear .hm-move, .tone-bear .stat-value { color: #fca5a5; }
.tone-neutral .ov-value, .tone-neutral .desk-text, .tone-neutral .hm-move, .tone-neutral .stat-value { color: var(--text); }
.desk-list, .board-list, .levels-list, .watch-signals, .port-list { display: flex; flex-direction: column; gap: 8px; }
.desk-item, .board-row, .key-card, .watch-card, .summary-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}
.desk-item { display: flex; align-items: flex-start; gap: 8px; }
.desk-icon { font-size: 12px; color: var(--orange); line-height: 1.2; }
.desk-text { font-size: 11px; line-height: 1.55; color: var(--text); }
.board-row { display: grid; grid-template-columns: minmax(0,1.2fr) auto auto; align-items: center; gap: 8px; }
.board-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.board-name strong { font-size: 11px; }
.board-meta { font-size: 10px; color: var(--muted); }
.board-pct { font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.board-bias { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.key-card { display: flex; flex-direction: column; gap: 8px; }
.key-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.key-name { font-size: 12px; font-weight: 800; }
.key-price { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; }
.key-meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.mini-stat { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; }
.stat-value { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.signal-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .4px;
}
.chip-bull { background: #052e1a; color: #4ade80; }
.chip-bear { background: #3b0000; color: #fca5a5; }
.chip-neutral { background: #1a1f2e; color: #cbd5e1; }
.wl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.wl-chip {
  background: #0d2447;
  border: 1px solid #1a3a5f;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  color: #60a5fa;
  display: flex;
  align-items: center;
  gap: 5px;
}
.wl-rm { color: #ef4444; font-size: 14px; line-height: 1; cursor: pointer; opacity: .6; }
.wl-rm:hover { opacity: 1; }
.wl-row, .port-add-row { display: flex; gap: 6px; }
.suggest-wrap { position: relative; }
.suggest-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  background: #08101e;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.suggest-menu.show { display: block; }
.suggest-item {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #0d1829;
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: #0d1829; }
.suggest-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.suggest-symbol { font-size: 11px; font-weight: 800; color: #60a5fa; }
.suggest-name { font-size: 10px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest-sector { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; align-self: center; white-space: nowrap; }
#wl-inp, #ticker-inp, .port-add-row input {
  background: #08101e;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 9px;
  font-size: 12px;
  outline: none;
  min-width: 0;
}
#wl-inp:focus, #ticker-inp:focus, .port-add-row input:focus { border-color: var(--blue); }
#wl-inp, #ticker-inp { flex: 1; text-transform: uppercase; }
#wl-add, #ticker-add, .port-add-btn {
  background: var(--blue);
  border: none;
  border-radius: 6px;
  color: #fff;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
#port-sym { width: 68px; text-transform: uppercase; }
#port-qty { width: 58px; }
#port-buy { width: 78px; }
.watch-card { display: flex; flex-direction: column; gap: 8px; }
.watch-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.watch-symbol { font-size: 12px; font-weight: 800; color: #60a5fa; }
.watch-name { font-size: 10px; color: var(--muted); }
.watch-price { text-align: right; font-variant-numeric: tabular-nums; }
.watch-metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.watch-note { font-size: 10px; color: var(--muted); line-height: 1.45; }
.port-item { display: grid; grid-template-columns: 62px minmax(0,1fr) 80px 108px 16px; gap: 8px; align-items: center; font-size: 11px; padding: 8px 0; border-bottom: 1px solid #0d1829; }
.port-sym { font-weight: 800; color: var(--blue); }
.port-detail { color: var(--muted); font-size: 10px; min-width: 0; }
.port-cur, .port-pnl { text-align: right; font-variant-numeric: tabular-nums; }
.port-pnl { font-weight: 700; font-size: 10px; }
.port-rm { color: var(--bear); cursor: pointer; opacity: .55; font-size: 14px; line-height: 1; text-align: right; }
.port-rm:hover { opacity: 1; }
.port-total { margin-top: 5px; font-size: 11px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.summary-card { min-height: 72px; display: flex; flex-direction: column; gap: 5px; }
.breadth-pill { font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.breadth-bull { background: #052e1a; color: #4ade80; }
.breadth-bear { background: #3b0000; color: #fca5a5; }
.breadth-neut { background: #1a1f2e; color: #94a3b8; }
.heatmap { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
.hm-cell {
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  transition: transform .15s, filter .15s, outline .1s;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 92px;
  user-select: none;
}
.hm-cell:hover { filter: brightness(1.2); transform: scale(1.02); }
.hm-cell.active-filter { outline: 2px solid #fff; outline-offset: 1px; }
.hm-name { font-size: 12px; font-weight: 800; }
.hm-cnt, .hm-sent { font-size: 10px; opacity: .9; font-weight: 700; }
.hm-move { font-size: 10px; font-weight: 700; }
.hm-bar-wrap { margin-top: auto; height: 3px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; }
.hm-bar-fill { height: 100%; border-radius: 2px; background: rgba(255,255,255,.55); }
#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a2d45;
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 12px;
  opacity: 0;
  transition: all .3s;
  z-index: 999;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 1180px) {
  .main { flex-direction: column; }
  .news-panel { border-right: none; border-bottom: 1px solid var(--border); min-height: 44%; }
  .sidebar { width: 100%; min-height: 56%; }
}
