/* ═══════════════════════════════════════════════════════
   IV Tracker Dashboard — Dark Theme CSS
   ═══════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --bg:          #060a10;
  --surface:     rgba(13, 17, 23, 0.65);
  --surface2:    rgba(22, 27, 34, 0.7);
  --surface3:    rgba(28, 33, 40, 0.8);
  --border:      rgba(255, 255, 255, 0.06);
  --border2:     rgba(255, 255, 255, 0.10);
  --accent:      #10b981;
  --accent-dim:  #059669;
  --green:       #34d399;
  --red:         #f87171;
  --yellow:      #fbbf24;
  --text:        #e6edf3;
  --text-dim:    #7d8590;
  --text-muted:  #484f58;
  --header-h:    30px;
  --win-radius:  10px;
  --glass-blur:  12px;
  --font:        'Tahoma', 'Geneva', sans-serif;
  --font-mono:   'Tahoma', 'Geneva', sans-serif;
}

/* ── Reset / Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(248, 113, 113, 0.03) 0%, transparent 50%);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  overflow-x: hidden;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar            { width: 5px; height: 5px; }
::-webkit-scrollbar-track      { background: var(--bg); }
::-webkit-scrollbar-thumb      { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover{ background: var(--accent-dim); }

/* ── Top Header Bar ─────────────────────────────────────── */
#top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(10, 14, 20, 0.75);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  z-index: 1000;
  user-select: none;
}

#top-bar .logo {
  display: flex; align-items: center; flex-shrink: 0;
}
#top-bar .logo svg { color: var(--accent); }

/* Status dot (replaces market badge + ws badge) */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  cursor: pointer; position: relative;
}
.status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse-dot 1.5s infinite; }
.status-dot.offline { background: var(--red); }
.status-dot.connecting { background: var(--yellow); animation: pulse-dot 0.8s infinite; }
.status-tooltip {
  display: none; position: absolute; top: 16px; left: -40px;
  background: var(--surface3); border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; font-size: 10px; color: var(--text-dim); white-space: nowrap; z-index: 2000;
}
.status-dot:hover .status-tooltip { display: block; }

@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* Tab bar */
.tab-bar {
  display: flex; align-items: center; gap: 2px; flex: 1;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 3px 8px; border: none; border-radius: 4px;
  background: transparent; color: var(--text-dim);
  font-size: 10px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: all 0.15s;
  font-family: var(--font);
}
.tab-btn:hover { background: var(--surface3); color: var(--text); }
.tab-btn.active { background: var(--accent); color: #fff; }

#top-bar .bar-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}

/* Hidden elements (replaced by dot) */
.market-badge, .ws-badge, #last-update { display: none !important; }

/* Bar buttons (icon only, glass) */
.bar-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 5px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: var(--text); cursor: pointer;
  transition: all 0.15s;
}
.bar-btn:hover {
  background: var(--surface3);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── GridStack Container ─────────────────────────────────── */
#grid-container {
  margin-top: var(--header-h);
  padding: 3px;
  min-height: calc(100vh - var(--header-h));
}

.grid-stack { background: transparent; }

/* ── Window Cards ────────────────────────────────────────── */
.grid-stack-item-content {
  background: rgba(13, 17, 23, 0.55);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--win-radius);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.grid-stack-item-content:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ── Window Header (compact, drag handle) ────────────────── */
.win-header {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 6px;
  height: 24px;
  min-height: 24px;
  background: rgba(22, 27, 34, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
}
.win-header:active { cursor: grabbing; }

.win-icon {
  font-size: 11px;
  flex-shrink: 0;
}

.win-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.win-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Expiry dropdown in window header */
.exp-select {
  appearance: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 11px;
  padding: 3px 22px 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238888a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition: border-color 0.15s;
}
.exp-select:hover, .exp-select:focus {
  border-color: var(--accent);
  outline: none;
}
.exp-select option { background: var(--surface3); }

/* Toggle buttons (3min/5min) */
.toggle-group {
  display: flex;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}
.toggle-btn {
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.toggle-btn:last-child { border-right: none; }
.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}
.toggle-btn:hover:not(.active) {
  background: var(--surface2);
  color: var(--text);
}

/* ── Window Body ─────────────────────────────────────────── */
.win-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Compact inline search (in header) */
.search-hdr {
  width: 20px;
  height: 18px;
  padding: 1px 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 11px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  text-align: center;
  transition: width 0.2s ease, border-color 0.15s, background 0.15s, padding 0.15s;
  font-family: var(--font);
}
.search-hdr::placeholder { color: var(--text-muted); }
.search-hdr:focus,
.search-hdr:not(:placeholder-shown) {
  width: 110px;
  border-color: var(--accent);
  background: var(--surface3);
  text-align: left;
  padding: 2px 7px;
  font-size: 11px;
  cursor: text;
}

/* Window manager dropdown */
.win-manager-panel {
  position: fixed;
  top: calc(var(--header-h) + 4px);
  right: 16px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 6px;
  z-index: 1500;
  display: none;
  min-width: 210px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.win-manager-panel.open { display: block; }
.wm-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 8px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.wm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
}
.wm-row:hover { background: var(--surface2); }
.wm-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 13px;
  height: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.wm-icon { font-size: 13px; flex-shrink: 0; }

/* Hidden window */
.grid-stack-item.win-hidden { display: none !important; }

/* ── IV Table ────────────────────────────────────────────── */
.table-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  min-height: 0;
}

table.iv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

table.iv-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

table.iv-table thead th {
  background: rgba(28, 33, 40, 0.6);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 4px 6px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  user-select: none;
}
table.iv-table thead th:first-child  { text-align: left; }
table.iv-table thead th:nth-child(2) { text-align: left; }
table.iv-table thead th:hover { color: var(--text); background: var(--surface2); }
table.iv-table thead th.sort-asc::after  { content: ' ▲'; color: var(--accent); font-size: 9px; }
table.iv-table thead th.sort-desc::after { content: ' ▼'; color: var(--accent); font-size: 9px; }

table.iv-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
table.iv-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.018); }
table.iv-table tbody tr:hover           { background: rgba(99,102,241,0.08); }

table.iv-table tbody td {
  padding: 3px 5px;
  text-align: right;
  white-space: nowrap;
  color: var(--text);
  font-size: 11px;
}
table.iv-table tbody td:first-child  { text-align: left; color: var(--text-muted); font-size: 10px; }
table.iv-table tbody td:nth-child(2) { text-align: left; font-weight: 600; font-family: var(--font-mono); font-size: 11px; }

/* IV color coding */
.iv-high  { color: var(--red)    !important; font-weight: 700; }
.iv-mid   { color: var(--yellow) !important; font-weight: 600; }
.iv-low   { color: var(--green)  !important; }

/* Positive / Negative */
.pos { color: var(--green) !important; }
.neg { color: var(--red)   !important; }

/* Flash animation on IV change */
@keyframes flash-up   { from{ background:rgba(34,197,94,0.12) } to{ background:transparent } }
@keyframes flash-down { from{ background:rgba(239,68,68,0.12) } to{ background:transparent } }
@keyframes flash-new  { from{ background:rgba(99,102,241,0.1) } to{ background:transparent } }

.flash-up   { animation: flash-up   0.4s ease forwards; }
.flash-down { animation: flash-down 0.4s ease forwards; }
.flash-new  { animation: flash-new  0.4s ease forwards; }

/* Empty state */
.empty-msg {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 12px;
}

/* ── History Modal ───────────────────────────────────────── */
#history-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 2000;
  backdrop-filter: blur(2px);
}
#history-overlay.open { display: flex; justify-content: flex-end; }

#history-panel {
  width: min(900px, 100vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
#history-overlay.open #history-panel { transform: translateX(0); }

.history-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface2);
}
.history-header h2 {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}
.history-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border2);
  background: var(--surface3);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.history-close:hover { background: var(--red); color: #fff; border-color: var(--red); }

.history-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.history-filters label {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.history-filters select,
.history-filters input {
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 5px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.history-filters select:focus,
.history-filters input:focus { border-color: var(--accent); }
.history-filters select option { background: var(--surface3); }

.history-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.history-body table.iv-table thead th { background: var(--surface3); }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --header-h: 44px; }

  #top-bar { gap: 8px; padding: 0 10px; }
  #top-bar .logo { font-size: 13px; }

  #last-update { display: none; }

  #history-panel { width: 100vw; border-left: none; }

  .bar-btn { padding: 4px 8px; font-size: 11px; }

  table.iv-table { font-size: 11px; }
  table.iv-table tbody td { padding: 5px 6px; }
  table.iv-table thead th { padding: 6px 6px; font-size: 10px; }
}

@media (max-width: 480px) {
  .win-title { display: none; }
  .win-controls { gap: 4px; }
}

/* ── GridStack overrides ─────────────────────────────────── */
.grid-stack > .grid-stack-item > .grid-stack-item-content {
  inset: 4px;
}
.grid-stack-item.ui-draggable-dragging .grid-stack-item-content {
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(99,102,241,0.25);
}
.grid-stack-item.ui-resizable-resizing .grid-stack-item-content {
  border-color: var(--accent-dim);
}
/* Hide all resize handles except bottom-right */
.ui-resizable-handle { opacity: 0 !important; pointer-events: none !important; }
.ui-resizable-se     { opacity: 1 !important; pointer-events: auto !important; }
.grid-stack-placeholder > .placeholder-content {
  background: rgba(99,102,241,0.08);
  border: 2px dashed var(--accent-dim);
  border-radius: var(--win-radius);
  inset: 4px;
}

/* ── Misc ────────────────────────────────────────────────── */
.num { font-family: var(--font-mono); }

button { cursor: pointer; }
select { cursor: pointer; }

/* No data row */
.no-data td {
  color: var(--text-muted);
  text-align: center !important;
  padding: 20px;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════
   W5 — IV Decay Forecast Model
   ═══════════════════════════════════════════════════════════ */

/* Model badge (Heuristic / ML) */
.model-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.model-badge.heuristic {
  background: rgba(234,179,8,0.15);
  color: var(--yellow);
  border: 1px solid rgba(234,179,8,0.3);
}
.model-badge.ml {
  background: rgba(99,102,241,0.15);
  color: var(--accent);
  border: 1px solid rgba(99,102,241,0.3);
}

/* Model info bar (below header) */
.model-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  background: var(--surface3);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  gap: 10px;
  flex-shrink: 0;
}

.train-btn {
  font-size: 11px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Score cell — bar + number */
.score-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 120px;
}

.score-bar {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
  min-width: 50px;
}

.score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.score-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Score tiers */
.score-fire .score-fill  { background: linear-gradient(90deg, #ef4444, #f97316); }
.score-fire .score-num   { color: #f97316; }

.score-lightning .score-fill { background: linear-gradient(90deg, #eab308, #facc15); }
.score-lightning .score-num  { color: #eab308; }

.score-ok .score-fill    { background: linear-gradient(90deg, #22c55e, #4ade80); }
.score-ok .score-num     { color: #22c55e; }

/* W5 table: wider columns for expiry + score */
#tbl-w5 th:nth-child(2),
#tbl-w5 td:nth-child(2) { text-align: left; min-width: 75px; }

#tbl-w5 th:nth-child(3),
#tbl-w5 td:nth-child(3) { text-align: left; min-width: 85px; }

#tbl-w5 th:last-child,
#tbl-w5 td:last-child   { min-width: 140px; }

/* ═══════════════════════════════════════════════════════════
   W6 — Cream Trades Feed
   ═══════════════════════════════════════════════════════════ */

.cream-feed {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 2px 0;
}

.cream-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  border-left: 3px solid transparent;
  animation: flash-new 0.5s ease;
  flex-wrap: wrap;
}
.cream-row.cream-high { border-left-color: var(--red); }
.cream-row.cream-low  { border-left-color: var(--green); }
.cream-row:hover      { background: rgba(99,102,241,0.06); }

.cream-ts     { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); min-width: 52px; flex-shrink: 0; }
.cream-icon   { font-size: 13px; flex-shrink: 0; }
.cream-sym    { font-weight: 700; font-family: var(--font-mono); min-width: 72px; flex-shrink: 0; }
.cream-strike { color: var(--text-dim); min-width: 78px; flex-shrink: 0; font-size: 11px; }
.cream-action { font-weight: 700; font-size: 11px; min-width: 44px; flex-shrink: 0; letter-spacing: 0.3px; }
.cream-high .cream-action { color: var(--red); }
.cream-low  .cream-action { color: var(--green); }
.cream-iv   { font-family: var(--font-mono); min-width: 52px; text-align: right; flex-shrink: 0; }
.cream-base { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); min-width: 72px; flex-shrink: 0; }
.cream-pct  { font-family: var(--font-mono); font-weight: 600; min-width: 56px; text-align: right; flex-shrink: 0; }
.cream-ltp  { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.cream-edge { font-family: var(--font-mono); font-size: 11px; color: var(--accent); font-weight: 600; flex-shrink: 0; }

.no-cream {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 16px;
  font-size: 12px;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════
   W7: S/R Zones
   ═══════════════════════════════════════════════════════════════ */
.sr-demand      { color: var(--green); font-weight: 600; }
.sr-supply      { color: var(--red);   font-weight: 600; }
.sr-demand-row  { border-left: 3px solid var(--green); }
.sr-supply-row  { border-left: 3px solid var(--red); }
.sr-demand-row:hover, .sr-supply-row:hover { background: rgba(99,102,241,0.06); }
/* Confluence highlight — zone aligns across timeframes */
.sr-confluence  { background: rgba(255, 215, 0, 0.08) !important; }
.sr-confluence:hover { background: rgba(255, 215, 0, 0.15) !important; }
.sr-conf-badge  { font-size: 9px; background: rgba(255, 215, 0, 0.25); color: #ffd700; padding: 1px 4px; border-radius: 3px; margin-left: 4px; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════
   W8: News Feed
   ═══════════════════════════════════════════════════════════════ */
.news-feed {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 2px 0;
}
.news-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  cursor: pointer;
  transition: background 0.2s;
}
.news-row:hover { background: rgba(99,102,241,0.06); }
.news-fno       { border-left-color: var(--accent); }
.news-market    { border-left-color: var(--text-dim); }

.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.news-time   { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.news-source { font-size: 10px; color: var(--text-dim); }
.news-title  { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.4; }

.news-cat-badge {
  font-size: 9px;
  background: rgba(99,102,241,0.2);
  color: var(--accent);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}

/* Highlight animation — new news for 10 seconds */
.news-highlight {
  background: rgba(255, 215, 0, 0.10) !important;
  border-left-color: #ffd700 !important;
  animation: news-pulse 1s ease 3;
}
.news-highlight .news-title {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #fff !important;
}
@keyframes news-pulse {
  0%, 100% { background: rgba(255, 215, 0, 0.10); }
  50%      { background: rgba(255, 215, 0, 0.22); }
}

.no-news {
  text-align: center;
  color: var(--text-muted);
  padding: 28px 16px;
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   W9: OI Dashboard
   ═══════════════════════════════════════════════════════════════ */
.oi-summary {
  display: flex; gap: 8px; padding: 8px 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.oi-card {
  flex: 1; min-width: 200px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; font-size: 11px;
}
.oi-card-sym    { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.oi-card-signal { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.oi-card-row    { color: var(--text-dim); line-height: 1.6; }
.oi-bullish     { color: var(--green); }
.oi-bearish     { color: var(--red); }

.oi-chart-wrap { border-bottom: 1px solid var(--border); }

/* OI Signal badges */
.oi-long-buildup   { color: #22c55e; font-weight: 700; }
.oi-short-buildup  { color: #ef4444; font-weight: 700; }
.oi-short-covering { color: #86efac; font-weight: 600; }
.oi-long-unwinding { color: #fca5a5; font-weight: 600; }

/* W10: OI Alerts */
.oi-alert-feed { flex: 1; overflow-y: auto; min-height: 0; padding: 2px 0; }
.oi-alert-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--text-dim); font-size: 12px;
}
.oi-alert-row:hover { background: rgba(99,102,241,0.06); }
.oi-alert-high   { border-left-color: var(--red); }
.oi-alert-medium { border-left-color: #f59e0b; }
.oi-alert-low    { border-left-color: var(--text-dim); }

.oi-alert-ts   { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); min-width: 50px; flex-shrink: 0; }
.oi-alert-icon { font-size: 13px; flex-shrink: 0; }
.oi-alert-sym  { font-weight: 700; font-family: var(--font-mono); min-width: 72px; flex-shrink: 0; }
.oi-alert-type { font-size: 9px; background: rgba(99,102,241,0.15); color: var(--accent); padding: 1px 5px; border-radius: 3px; font-weight: 600; flex-shrink: 0; }
.oi-alert-msg  { color: var(--text-dim); font-size: 11px; }

/* ═══════════════════════════════════════════════════════════════
   W11: FII/DII Tracker
   ═══════════════════════════════════════════════════════════════ */
.fii-dii-content { padding: 0; overflow-y: auto; }
.fii-signal-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.fii-signal-label { font-size: 14px; }
.fii-signal-reason { color: var(--text-dim); font-size: 11px; flex: 1; }
.fii-date { color: var(--text-muted); font-size: 10px; }

/* ═══════════════════════════════════════════════════════════════
   Clickable symbol cells (all windows)
   ═══════════════════════════════════════════════════════════════ */
td.sym-link {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}
td.sym-link:hover { text-decoration: underline; color: #a5b4fc; }

/* Selected W1 row via keyboard */
#body-w1 tr.row-selected { background: rgba(99,102,241,0.18) !important; }

/* ═══════════════════════════════════════════════════════════════
   Symbol Detail Drawer
   ═══════════════════════════════════════════════════════════════ */
.sym-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  display: none;
}
.sym-overlay.open { display: flex; align-items: stretch; justify-content: flex-end; }

.sym-drawer {
  width: min(500px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.5);
  overflow: hidden;
  animation: slideInRight 0.2s ease;
}
@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.sym-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-shrink: 0;
}
.sym-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.sym-title-row h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
  margin: 0;
}
.sym-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text-dim);
}
.sym-badge.iv-high { background: rgba(239,68,68,0.15);  color: var(--red);   }
.sym-badge.iv-mid  { background: rgba(245,158,11,0.15); color: var(--yellow);}
.sym-badge.iv-low  { background: rgba(16,185,129,0.15); color: var(--green); }
.sym-badge.pos     { background: rgba(16,185,129,0.15); color: var(--green); }
.sym-badge.neg     { background: rgba(239,68,68,0.15);  color: var(--red);   }

.sym-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sym-close { margin-left: auto; }

.sym-chart-wrap {
  position: relative;
  height: 220px;
  flex-shrink: 0;
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.sym-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
}

.sym-table-wrap {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
