:root {
  --bg:        #0a1628;
  --blue:      #c9a84c;
  --blue-lt:   rgba(201,168,76,0.10);
  --blue-bd:   rgba(201,168,76,0.35);
  --text:      #e8eaf0;
  --muted:     #7a8fa6;
  --green:     #2ecc8a;
  --red:       #e55a5a;
  --white:     #0d1f3c;
  --border:    #1e3a5f;
  --radius:    8px;
  --nav-h:     52px;
  --strip-h:   68px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Nav ─────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 300;
  background: #0d1f3c; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: var(--nav-h); gap: 16px;
}
.nav-logo {
  font-size: 22px; font-weight: 800; letter-spacing: -0.5px;
  color: var(--text); flex-shrink: 0; white-space: nowrap;
}
.nav-logo span { color: #c9a84c; }

.nav-center {
  display: flex; align-items: center; gap: 10px;
  flex: 1; justify-content: center; overflow: hidden;
}
.nav-time  { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.nav-sep   { color: var(--border); }
.nav-date  { font-size: 13px; color: var(--muted); white-space: nowrap; }
.nav-countdown {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--blue-lt); color: #c9a84c;
  border: 1px solid var(--blue-bd); border-radius: 100px;
  padding: 2px 10px;
}
.nav-countdown.open   { background: rgba(46,204,138,0.10); color: var(--green); border-color: rgba(46,204,138,0.35); }
.nav-countdown.closed { background: rgba(255,255,255,0.04); color: var(--muted); border-color: var(--border); }

.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-data-updated { font-size: 11px; color: var(--muted); white-space: nowrap; letter-spacing: 0.2px; }

.btn-analyst {
  background: rgba(201,168,76,0.12); border: 1px solid rgba(201,168,76,0.45);
  color: #c9a84c; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 6px; cursor: pointer;
  white-space: nowrap; transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.btn-analyst:hover  { background: rgba(201,168,76,0.22); border-color: #c9a84c; }
.btn-analyst.active { background: #c9a84c; color: #071020; border-color: #c9a84c; }

.btn-refresh-ai {
  background: #c9a84c; color: #071020; border: none;
  font-size: 13px; font-weight: 600; padding: 7px 16px; border-radius: 6px;
  cursor: pointer; white-space: nowrap; transition: background 0.14s;
}
.btn-refresh-ai:hover    { background: #b5912e; }
.btn-refresh-ai:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-gear {
  width: 34px; height: 34px; border-radius: 6px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 16px; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.14s, border-color 0.14s;
}
.btn-gear:hover { color: var(--text); border-color: #2a4a6a; }

/* ── Market Strip ─────────────────────────────────────────────────────── */
.strip-outer {
  position: sticky; top: var(--nav-h); z-index: 200;
  background: #0d1f3c; border-bottom: 1px solid var(--border);
  overflow: hidden;
  height: var(--strip-h);
}

.market-strip {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  height: var(--strip-h);
  width: 100%;
}
.strip-loading { padding: 0 20px; font-size: 12px; color: var(--muted); display: flex; align-items: center; }

.strip-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 0 4px; min-width: 0;
  cursor: default; transition: background 0.12s; text-align: center;
}
.strip-chip:hover { background: rgba(255,255,255,0.04); }
.chip-label {
  font-size: 11px; font-weight: 700; color: #ffffff;
  text-transform: uppercase; letter-spacing: 0.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.chip-price {
  font-size: 15px; font-weight: 600; color: #e8eaf0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.chip-change {
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.chip-change.up   { color: #2ecc8a; }
.chip-change.down { color: #e55a5a; }
.chip-change.flat { color: var(--muted); }

/* Subtle vertical divider on first chip of each non-index group */
.chip-group-start { border-left: 1px solid #2a5080; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.layout {
  display: flex; align-items: stretch;
  width: 100%;
  padding: 16px 12px 0;
  min-height: calc(100vh - var(--nav-h) - var(--strip-h));
}

/* ── Sidebars ─────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: #071020;
  border: 0.5px solid var(--border); border-radius: var(--radius);
  min-height: 100vh;
}
.sidebar-left  { margin-left: 0; border-radius: 0; border-left: none; border-top: none; border-bottom: none; }
.sidebar-right { margin-right: 0; border-radius: 0; border-right: none; border-top: none; border-bottom: none; }

/* Sticky inner wrapper — content follows scroll, background fills column */
.sb-sticky {
  position: sticky; top: calc(var(--nav-h) + var(--strip-h) + 16px);
  max-height: calc(100vh - var(--nav-h) - var(--strip-h) - 32px);
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sb-sticky::-webkit-scrollbar       { width: 3px; }
.sb-sticky::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Left sidebar — flex column so wl-items fills and scrolls independently */
.sidebar-left .sb-sticky {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--nav-h) - var(--strip-h) - 32px);
  overflow: hidden;
}

/* Sidebar head */
.sb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #071020; z-index: 5;
}
.sb-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted);
}
.sb-add-btn {
  width: 20px; height: 20px; border-radius: 4px;
  border: 1px solid var(--border); background: transparent;
  color: #c9a84c; font-size: 16px; font-weight: 600; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, border-color 0.12s;
}
.sb-add-btn:hover { background: rgba(201,168,76,0.12); border-color: rgba(201,168,76,0.5); }

/* Watchlist add form */
.wl-add-form {
  display: none; padding: 8px 10px;
  background: rgba(201,168,76,0.08); border-bottom: 1px solid rgba(201,168,76,0.25);
}
.wl-add-form.visible { display: block; }
.wl-input {
  width: 100%; border: 1px solid var(--border); border-radius: 5px;
  padding: 5px 8px; font-size: 13px; color: var(--text); background: #0a1628;
  text-transform: uppercase; margin-bottom: 6px;
}
.wl-input:focus { outline: none; border-color: #c9a84c; }
.wl-form-btns { display: flex; gap: 6px; }
.wl-btn-submit {
  flex: 1; background: #c9a84c; color: #071020; border: none;
  border-radius: 5px; padding: 5px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background 0.12s;
}
.wl-btn-submit:hover { background: #b5912e; }
.wl-btn-cancel {
  flex: 1; background: transparent; border: 1px solid var(--border);
  border-radius: 5px; padding: 5px; font-size: 12px; color: var(--muted);
  cursor: pointer;
}

/* Watchlist items — fills remaining flex space, scrolls only when needed */
.wl-items {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.wl-items::-webkit-scrollbar       { width: 3px; }
.wl-items::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sb-empty { padding: 12px 12px; font-size: 12px; color: var(--muted); text-align: center; }

.wl-item {
  padding: 8px 10px; border-bottom: 0.5px solid var(--border);
  position: relative; transition: background 0.1s;
}
.wl-item:last-child { border-bottom: none; }
.wl-item:hover { background: rgba(255,255,255,0.03); }

.wl-row1 { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.wl-symbol { font-size: 14px; font-weight: 700; color: var(--text); font-family: monospace; }
.wl-chg   { font-size: 13px; font-weight: 700; white-space: nowrap; }
.wl-chg.up   { color: var(--green); }
.wl-chg.down { color: var(--red); }
.wl-chg.flat { color: var(--muted); }
.wl-row2 { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 1px; }
.wl-name  { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.wl-price { font-size: 13px; color: var(--text); font-family: monospace; white-space: nowrap; }

.wl-remove {
  display: none; position: absolute; top: 5px; right: 5px;
  width: 16px; height: 16px; border-radius: 3px;
  border: none; background: transparent; color: var(--muted);
  font-size: 12px; cursor: pointer; align-items: center; justify-content: center;
  transition: color 0.12s, background 0.12s;
}
.wl-item:hover .wl-remove { display: flex; }
.wl-remove:hover { color: var(--red); background: rgba(229,90,90,0.15); }

/* Right sidebar sections */
.sb-section  { padding: 10px 10px 8px; }
.sb-divider  { height: 0.5px; background: var(--border); }
.sb-section .sb-title { display: block; margin-bottom: 2px; }
.sb-subtitle { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.gainers-title { color: var(--green); }
.losers-title  { color: var(--red); }

/* Sidebar movers */
.movers-list { display: flex; flex-direction: column; }
.mover-item {
  padding: 6px 0; border-bottom: 0.5px solid var(--border);
}
.mover-item:last-child { border-bottom: none; }
.mv-row1 { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.mv-sym  { font-size: 14px; font-weight: 700; font-family: monospace; color: var(--text); }
.mv-chg  { font-size: 13px; font-weight: 700; white-space: nowrap; }
.mv-chg.up   { color: var(--green); }
.mv-chg.down { color: var(--red); }
.mv-row2 { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-top: 1px; }
.mv-name   { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.mv-price  { font-size: 13px; color: var(--text); font-family: monospace; white-space: nowrap; }
.mv-pct-secondary { font-size: 11px; color: var(--muted); font-family: monospace; }

/* ── Center ───────────────────────────────────────────────────────────── */
.center { flex: 1; min-width: 0; padding: 0 16px; }

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: #0d1f3c; border: 0.5px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px 10px;
}
.card-icon  { font-size: 15px; }
.card-title { font-size: 14px; font-weight: 700; color: var(--text); }

/* ── Morning Summary ──────────────────────────────────────────────────── */
.summary-card { border: 1px solid #c9a84c; background: #0d1f3c; }
.summary-card .card-title { font-size: 13px; }
.summary-date {
  margin-left: auto; font-size: 11px; color: var(--muted);
  background: #091524; border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 100px; white-space: nowrap;
}

/* Collapsible header */
.summary-card-head {
  cursor: pointer; user-select: none;
  transition: background 0.12s;
}
.summary-card-head:hover { background: rgba(255,255,255,0.02); }

.summary-chevron {
  color: var(--muted); flex-shrink: 0; margin-left: 8px;
  transform: rotate(180deg); /* starts expanded — chevron points up */
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.summary-card.collapsed .summary-chevron { transform: rotate(0deg); }

.summary-collapse-hint {
  display: none; font-size: 11px; color: var(--muted);
  margin-left: 8px; white-space: nowrap;
}
.summary-card.collapsed .summary-collapse-hint { display: inline; }

/* Collapse animation — grid trick */
.summary-body {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4,0,0.2,1);
}
.summary-card.collapsed .summary-body { grid-template-rows: 0fr; }
.summary-inner { overflow: hidden; }
.summary-bullets {
  list-style: none; padding: 0 16px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.summary-bullets li {
  font-family: 'Inter', sans-serif;
  font-size: 14px; font-weight: 400; color: #e8eaf0; line-height: 1.8;
  padding-left: 14px; position: relative;
}
.summary-bullets li::before {
  content: '•'; position: absolute; left: 0;
  color: #c9a84c; font-weight: 700;
}
.summary-bullets li strong { font-weight: 700; color: #c9a84c; }

/* ── New to Watch (sidebar) ───────────────────────────────────────────── */
.state-text { font-size: 12px; color: var(--muted); padding: 4px 16px 12px; }

.ntw-sb-head {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; margin-bottom: 8px;
}
.ntw-sb-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: #c9a84c; flex: 1;
}
.ntw-sb-head-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ntw-sb-count {
  font-size: 10px; font-weight: 700; color: #c9a84c;
  background: rgba(201,168,76,0.12); border: 1px solid rgba(201,168,76,0.35);
  padding: 1px 5px; border-radius: 100px; line-height: 1.6;
}
.ntw-sb-chevron {
  color: var(--muted); flex-shrink: 0;
  transform: rotate(180deg);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.ntw-sb-chevron.rotated { transform: rotate(0deg); }

.ntw-sb-body {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4,0,0.2,1);
}
.ntw-sb-body.collapsed { grid-template-rows: 0fr; }
.ntw-sb-inner { overflow: hidden; }

.mv-row3 {
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px; margin-top: 2px;
}
.mv-ipo-date, .mv-ipo-price {
  font-size: 10px; color: var(--muted); white-space: nowrap;
}
.mv-ipo-date { flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* ── Add-to-watchlist button ──────────────────────────────────────────── */
.wl-add-btn {
  width: 20px; height: 20px; flex-shrink: 0;
  background: transparent; border: 1px solid var(--border); border-radius: 4px;
  color: var(--muted); font-size: 14px; font-weight: 700; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.wl-add-btn:hover:not(.saved):not(:disabled) {
  border-color: #c9a84c; color: #c9a84c; background: rgba(201,168,76,0.10);
}
.wl-add-btn.saved {
  border-color: var(--green); color: var(--green);
  background: rgba(46,204,138,0.10); cursor: default; font-size: 11px;
}
.wl-add-btn.just-added { animation: pop 0.3s cubic-bezier(0.34,1.56,0.64,1); }
@keyframes pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* ── Heatmap ──────────────────────────────────────────────────────────── */
.heatmap-wrap { padding: 0; }
.heatmap-header {
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border);
  display: flex; justify-content: center;
}
.view-toggle {
  display: flex; gap: 2px;
  background: #071020; border: 1px solid var(--border); border-radius: 7px;
  padding: 3px;
}
.view-toggle-btn {
  padding: 5px 18px; border-radius: 5px; border: none;
  background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.view-toggle-btn.active { background: #c9a84c; color: #071020; }
.view-toggle-btn:not(.active):hover { background: rgba(255,255,255,0.06); color: var(--text); }

.heatmap-strip { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px 14px; }

.heatmap-pill {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 16px; border-radius: 6px; border: 1px solid transparent;
  cursor: default; white-space: nowrap;
  transition: transform 0.14s, box-shadow 0.14s, filter 0.12s;
}
.heatmap-pill:hover { transform: translateY(-2px); filter: brightness(1.12); }
.heatmap-pill.up   {
  background: #0d3d24; border-color: #2ecc8a;
  box-shadow: 0 2px 10px rgba(46,204,138,0.18);
}
.heatmap-pill.down {
  background: #3d0d0d; border-color: #e55a5a;
  box-shadow: 0 2px 10px rgba(229,90,90,0.18);
}
.heatmap-pill.flat {
  background: rgba(255,255,255,0.04); border-color: var(--border);
  box-shadow: 0 2px 6px rgba(0,0,0,0.20);
}
.hm-name { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; }
.hm-val  { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }
.hm-val.up   { color: #2ecc8a; }
.hm-val.down { color: #e55a5a; }
.hm-val.flat { color: var(--muted); }

/* ── Sector Accordion ─────────────────────────────────────────────────── */
.sectors-accordion { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }

.sec-item {
  background: #0d1f3c; border: 0.5px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.sec-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; user-select: none;
  transition: background 0.12s;
}
.sec-head:hover { background: #112340; }
.sec-bar { width: 4px; height: 28px; border-radius: 2px; flex-shrink: 0; }
.sec-head-left {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.sec-label { font-size: 15px; font-weight: 600; color: var(--text); white-space: nowrap; flex-shrink: 0; }
.sec-badge {
  font-size: 13px; font-weight: 700; padding: 2px 8px;
  border-radius: 100px; white-space: nowrap; flex-shrink: 0;
}
.sec-badge.up   { color: var(--green); background: rgba(46,204,138,0.15); }
.sec-badge.down { color: var(--red);   background: rgba(229,90,90,0.15); }
.sec-badge.flat { color: var(--muted); background: rgba(255,255,255,0.05); }
.sec-chevron {
  color: var(--muted); flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.sec-item.open .sec-chevron { transform: rotate(180deg); }

/* Accordion expand — grid trick */
.sec-body {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows 0.1s ease-out;
}
.sec-item.open .sec-body { grid-template-rows: 1fr; }
.sec-inner { overflow: hidden; }

/* Two-panel expanded layout */
.sec-content-row {
  display: flex; align-items: stretch;
  border-top: 0.5px solid var(--border);
}
.sec-left {
  flex-shrink: 0;
  border-right: 0.5px solid var(--border);
}
.sec-right {
  flex: 1; min-width: 0;
  padding: 0; background: #091524;
  display: flex; flex-direction: column; justify-content: flex-start;
}

/* Ticker table — compact, fixed-width columns, left-aligned */
.sec-table {
  width: auto; border-collapse: collapse; table-layout: fixed;
}
.sec-table th {
  padding: 6px 8px; font-size: 11px; color: var(--muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  background: #091524; border-bottom: 0.5px solid var(--border);
  text-align: left; white-space: nowrap;
}
.sec-table th.col-px,
.sec-table th.col-chg,
.sec-table th.col-pe,
.sec-table th.col-ps,
.sec-table th.col-mc  { color: #ffffff; }
.sec-table th.col-tk   { width: 60px; }
.sec-table th.col-nm   { width: 170px; }
.sec-table th.col-px   { width: 90px;  text-align: right; }
.sec-table th.col-chg  { width: 90px;  text-align: right; }
.sec-table th.col-pe   { width: 55px;  text-align: right; }
.sec-table th.col-ps   { width: 50px;  text-align: right; }
.sec-table th.col-mc   { width: 65px;  text-align: right; }
.sec-table th.col-r40  { width: 45px;  text-align: right; }
.sec-table th.col-save { width: 30px;  text-align: center; }

.sec-table td { padding: 7px 8px; border-bottom: 0.5px solid var(--border); }
.sec-table tr:last-child td { border-bottom: none; }
.sec-table .col-tk   { font-family: monospace; font-weight: 700; font-size: 14px; }
.sec-table .col-nm   { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-table .col-px   { text-align: right; font-family: monospace; font-size: 14px; white-space: nowrap; }
.sec-table .col-chg  { text-align: right; font-family: monospace; font-size: 14px; font-weight: 700; white-space: nowrap; }
.sec-table .col-save { text-align: center; padding: 4px 6px; }
.col-chg.up   { color: var(--green); }
.col-chg.down { color: var(--red); }
.col-chg.flat { color: var(--muted); }

/* Financial metric cells */
.fin-cell { text-align: right; font-family: monospace; font-size: 13px; font-weight: 600; color: #ffffff; white-space: nowrap; }

/* Sector header financial metrics */
.sec-header-metrics {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.shm-item  { display: flex; align-items: center; gap: 3px; }
.shm-label { font-size: 11px; color: #c9a84c; font-weight: 600; letter-spacing: 0.2px; }
.shm-val   { font-size: 14px; color: #ffffff; font-weight: 600; font-family: monospace; }

/* Loading pulse for financial data */
.fin-loading { color: var(--muted); }
@keyframes finPulse { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }
.fin-loading { animation: finPulse 1.2s ease-in-out infinite; }

/* Footer strip at the bottom of sec-left — holds the Generate button */
.sec-footer {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
}

/* Generate AI Overview button */
.sec-ai-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 14px; border-radius: 6px;
  border: 1px solid rgba(201,168,76,0.50); background: #1e3a5f; color: #c9a84c;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.12s;
  margin: 0;
}
.sec-ai-btn:hover:not(:disabled) { background: #243f6a; }
.sec-ai-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.sec-ai-text {
  font-family: 'Inter', sans-serif;
  padding: 16px; font-size: 14px; font-weight: 400; color: #dde3ed; line-height: 1.8;
}

/* ── AI Narrative ─────────────────────────────────────────────────────── */
.narrative-wrap { border: 1px solid #c9a84c; }
.narrative-wrap .card-title { font-size: 12px; }
.narrative-body {
  padding: 0 20px 18px; font-size: 15px; color: var(--text); line-height: 1.85;
  display: flex; flex-direction: column; gap: 0;
}

/* ── Skeletons ────────────────────────────────────────────────────────── */
.skel-text, .skel-li {
  display: block; border-radius: 4px;
  background: linear-gradient(90deg, #1a3050 25%, #243f6a 50%, #1a3050 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite;
}
.skel-text { height: 14px; }
.skel-li   { height: 14px; }
.w100 { width: 100%; }
.w90  { width: 90%; }
.w85  { width: 85%; }
.w80  { width: 80%; }
.w70  { width: 70%; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── NTW tooltip ──────────────────────────────────────────────────────── */
.ntw-tip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: #0d1f3c; color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 12px; font-size: 12px; line-height: 1.5;
  max-width: 260px; opacity: 0; transition: opacity 0.12s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.ntw-tip.visible { opacity: 1; }

/* ── Analyst panel ────────────────────────────────────────────────────── */
.analyst-overlay {
  position: fixed; inset: 0; z-index: 4500;
  background: rgba(0,0,0,0.35); opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.analyst-overlay.visible { opacity: 1; pointer-events: all; }

.analyst-panel {
  position: fixed; top: 0; right: -440px; z-index: 4600;
  width: 420px; height: 100vh;
  background: #0d1f3c; border-left: 1px solid #c9a84c;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.55);
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
}
.analyst-panel.open { right: 0; }

.analyst-header {
  background: #c9a84c; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.analyst-title { font-size: 14px; font-weight: 700; color: #071020; letter-spacing: 0.2px; }
.analyst-close {
  background: transparent; border: none; color: #071020;
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 2px;
  opacity: 0.65; transition: opacity 0.12s;
}
.analyst-close:hover { opacity: 1; }

.analyst-chat {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.analyst-chat::-webkit-scrollbar       { width: 3px; }
.analyst-chat::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.analyst-suggestions { display: flex; flex-direction: column; gap: 7px; }
.analyst-sugg-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); margin-bottom: 2px;
}
.analyst-sugg-btn {
  background: rgba(201,168,76,0.07); border: 1px solid rgba(201,168,76,0.22);
  border-radius: 8px; padding: 10px 12px;
  font-size: 13px; color: var(--text); text-align: left; cursor: pointer;
  line-height: 1.4; transition: background 0.12s, border-color 0.12s;
}
.analyst-sugg-btn:hover { background: rgba(201,168,76,0.15); border-color: rgba(201,168,76,0.50); }

.analyst-msg { display: flex; flex-direction: column; max-width: 90%; }
.analyst-msg.user      { align-self: flex-end; }
.analyst-msg.assistant { align-self: flex-start; }
.analyst-bubble {
  padding: 10px 14px; border-radius: 10px;
  font-size: 13px; line-height: 1.6; word-break: break-word;
}
.analyst-msg.user .analyst-bubble {
  background: #c9a84c; color: #071020; font-weight: 500;
  border-radius: 10px 10px 2px 10px;
  white-space: pre-wrap;
}
.analyst-msg.assistant .analyst-bubble {
  background: #091524; color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: 10px 10px 10px 2px;
}
.analyst-msg.loading .analyst-bubble { color: var(--muted); font-style: italic; }

/* Markdown element styles inside assistant bubbles */
.analyst-bubble h3 { font-size: 14px; font-weight: 700; color: #e8eaf0; margin: 8px 0 3px; }
.analyst-bubble h4 { font-size: 13px; font-weight: 700; color: #c9a84c; margin: 6px 0 2px; }
.analyst-bubble ul { margin: 4px 0; padding-left: 18px; }
.analyst-bubble li { margin: 2px 0; }
.analyst-bubble hr { border: none; border-top: 1px solid #2a4a6a; margin: 8px 0; }
.analyst-bubble code { background: rgba(255,255,255,0.12); border-radius: 3px; padding: 1px 5px; font-family: monospace; font-size: 11px; }
.analyst-bubble strong { color: #e8eaf0; }
.analyst-bubble .md-gap { height: 5px; }

.analyst-input-wrap {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
  background: #0d1f3c;
}
.analyst-input {
  flex: 1; background: #091524; border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px;
  font-size: 13px; color: var(--text); resize: none;
  font-family: inherit; line-height: 1.45;
  max-height: 120px; overflow-y: auto;
}
.analyst-input:focus { outline: none; border-color: #c9a84c; }
.analyst-input::placeholder { color: var(--muted); }
.analyst-send {
  background: #c9a84c; color: #071020; border: none;
  border-radius: 8px; padding: 9px 16px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; transition: background 0.12s;
}
.analyst-send:hover:not(:disabled) { background: #b5912e; }
.analyst-send:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── AI badge (broad market view) ────────────────────────────────────── */
.ai-badge {
  display: inline-block; vertical-align: middle;
  font-size: 9px; font-weight: 700; letter-spacing: 0.3px;
  color: #c9a84c; background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.40); border-radius: 3px;
  padding: 0 3px; margin-left: 4px; line-height: 1.6;
}

/* ── Alert notification banner ────────────────────────────────────────── */
.alert-banner {
  position: fixed; top: -140px; left: 50%; transform: translateX(-50%);
  z-index: 9000; width: 500px; max-width: calc(100vw - 32px);
  background: #0d1f3c; border: 2px solid #c9a84c; border-radius: 10px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,168,76,0.25);
  transition: top 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.alert-banner.visible { top: 62px; }
.alert-banner-inner {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
}
.alert-banner-bell { font-size: 28px; flex-shrink: 0; }
.alert-banner-content { flex: 1; min-width: 0; }
.alert-banner-ticker { font-size: 15px; font-weight: 700; color: #c9a84c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-banner-detail { font-size: 13px; color: var(--text); margin-top: 3px; }
.alert-banner-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px; flex-shrink: 0;
}
.alert-banner-close:hover { color: var(--text); }

/* ── Alert context menu ────────────────────────────────────────────────── */
.alert-menu {
  position: fixed; z-index: 8000; display: none;
  background: #0d1f3c; border: 1px solid #c9a84c; border-radius: 8px;
  padding: 12px; width: 210px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,168,76,0.15);
}
.alert-menu.visible { display: block; }

.alert-menu-head { padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.alert-menu-ticker { display: block; font-size: 15px; font-weight: 700; color: var(--text); font-family: monospace; }
.alert-menu-name   { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

.alert-price-input {
  width: 100%; box-sizing: border-box;
  background: #0a1628; border: 1px solid var(--border); border-radius: 5px;
  padding: 7px 10px; font-size: 13px; color: var(--text); margin-bottom: 8px;
}
.alert-price-input:focus { outline: none; border-color: #c9a84c; }

.alert-dir-row { display: flex; gap: 6px; margin-bottom: 10px; }
.alert-dir-btn {
  flex: 1; padding: 6px; border-radius: 5px;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.12s;
}
.alert-dir-btn.active { background: rgba(201,168,76,0.15); border-color: #c9a84c; color: #c9a84c; }

.alert-menu-btns { display: flex; gap: 6px; }
.alert-save-btn {
  flex: 1; background: #c9a84c; color: #071020; border: none;
  border-radius: 5px; padding: 7px; font-size: 12px; font-weight: 700;
  cursor: pointer; transition: background 0.12s;
}
.alert-save-btn:hover { background: #b5912e; }
.alert-cancel-btn {
  flex: 1; background: transparent; border: 1px solid var(--border);
  border-radius: 5px; padding: 7px; font-size: 12px; color: var(--muted); cursor: pointer;
}

.alert-existing-row {
  font-size: 12px; color: var(--text); margin-bottom: 8px;
  padding: 6px 8px; background: rgba(255,255,255,0.04); border-radius: 4px;
}
.alert-action-btn {
  display: block; width: 100%; padding: 7px 8px; margin-bottom: 5px;
  border: 1px solid var(--border); border-radius: 5px;
  background: transparent; color: var(--text);
  font-size: 12px; text-align: left; cursor: pointer; transition: background 0.12s;
}
.alert-action-btn:hover      { background: rgba(255,255,255,0.06); }
.alert-delete-btn            { color: var(--red);   border-color: rgba(229,90,90,0.30); }
.alert-delete-btn:hover      { background: rgba(229,90,90,0.10); }
.alert-clear-btn             { color: var(--green); border-color: rgba(46,204,138,0.30); }
.alert-clear-btn:hover       { background: rgba(46,204,138,0.10); }

/* ── Watchlist bell icon & row layout ─────────────────────────────────── */
.wl-row1-left { display: flex; align-items: center; gap: 3px; }
.wl-bell { font-size: 10px; flex-shrink: 0; line-height: 1; cursor: default; }
.wl-bell-active    { color: #c9a84c; }
.wl-bell-triggered { color: var(--green); font-size: 11px; font-weight: 700; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .sidebar-right { display: none; }
}
@media (max-width: 860px) {
  .sidebar-left { display: none; }
  .center { padding: 0 12px; }
}
@media (max-width: 600px) {
  .nav-center { display: none; }
  .center { padding: 0 8px; }
  .layout { padding: 10px 0 32px; }
}

/* ── Ticker right-click context menu ──────────────────────────────────── */
.ticker-ctx-menu {
  position: fixed; z-index: 9500; display: none;
  background: #0d1f3c; border: 1px solid #c9a84c; border-radius: 8px;
  min-width: 220px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  user-select: none;
}
.ticker-ctx-menu.visible { display: block; }

.ctx-header {
  padding: 10px 14px;
  border-bottom: 0.5px solid #1e3a5f;
}
.ctx-hdr-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.ctx-hdr-ticker { font-size: 15px; font-weight: 700; color: #c9a84c; font-family: monospace; }
.ctx-hdr-price  { font-size: 11px; color: #e8eaf0; font-family: monospace; white-space: nowrap; }
.ctx-hdr-bot {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 3px;
}
.ctx-hdr-name   { font-size: 11px; color: #7a8fa6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ctx-hdr-change { font-size: 11px; font-family: monospace; white-space: nowrap; font-weight: 600; }
.ctx-hdr-change.up   { color: var(--green); }
.ctx-hdr-change.down { color: var(--red); }
.ctx-hdr-change.flat { color: #7a8fa6; }

.ctx-item {
  display: flex; align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-top: 0.5px solid #1e3a5f;
  transition: background 0.15s;
}
.ctx-item:hover { background: #1e3a5f; }
.ctx-icon {
  font-size: 16px; width: 20px; flex-shrink: 0; margin-right: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.ctx-icon-alert   { color: #e55a5a; }
.ctx-icon-chart   { color: #2ecc8a; }
.ctx-icon-wl      { color: #c9a84c; }
.ctx-icon-wl.in-wl { color: #2ecc8a; }
.ctx-icon-analyst { color: #7a8fa6; }
.ctx-item span    { font-size: 13px; font-weight: 500; color: #e8eaf0; }
.ctx-item.ctx-in-wl span { color: #2ecc8a; }

/* ── Chart lightbox ───────────────────────────────────────────────────── */
.chart-overlay {
  position: fixed; inset: 0; z-index: 9600;
  background: rgba(0,0,0,0.75); display: none;
}
.chart-overlay.visible { display: block; }

.chart-modal {
  position: fixed; z-index: 9700;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 760px; max-width: calc(100vw - 32px);
  height: 600px; max-height: calc(100vh - 32px);
  background: #0a1628; border: 1px solid #c9a84c; border-radius: 12px; overflow: hidden;
  display: none; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.85);
}
.chart-modal.visible { display: flex; }

/* Header */
.chart-modal-header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; flex-shrink: 0;
  background: #0d1f3c; border-bottom: 1px solid #c9a84c;
}
.chart-hdr-left  { flex: 1; min-width: 0; }
.chart-hdr-right { text-align: right; flex-shrink: 0; }
.chart-sym   { display: block; font-size: 22px; font-weight: 700; color: #c9a84c; font-family: monospace; line-height: 1.2; }
.chart-cname { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-cprice  { display: block; font-size: 20px; font-weight: 700; color: #ffffff; font-family: monospace; line-height: 1.2; }
.chart-cchange { display: block; font-size: 13px; font-weight: 600; font-family: monospace; margin-top: 2px; }
.chart-cchange.up   { color: var(--green); }
.chart-cchange.down { color: var(--red); }
.chart-cchange.flat { color: var(--muted); }
.chart-hdr-actions { display: flex; align-items: center; gap: 6px; margin-left: 8px; flex-shrink: 0; }
.chart-hdr-btn {
  width: 32px; height: 32px;
  background: transparent; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.chart-hdr-btn:hover { border-color: #c9a84c; color: #c9a84c; }
.chart-modal.maximized { width: 90vw; height: 85vh; }

/* Toolbar */
.chart-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; flex-shrink: 0;
  background: #091524; border-bottom: 0.5px solid #1e3a5f;
}
.chart-tf-group   { display: flex; gap: 4px; }
.chart-type-group { display: flex; gap: 4px; }

.chart-tf-btn {
  padding: 4px 12px; border-radius: 5px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer; transition: all 0.12s;
}
.chart-tf-btn:hover  { border-color: #c9a84c; color: #c9a84c; }
.chart-tf-btn.active { background: rgba(201,168,76,0.12); border-color: #c9a84c; color: #c9a84c; }

.chart-type-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 5px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer; transition: all 0.12s;
}
.chart-type-btn i { font-size: 14px; }
.chart-type-btn:hover  { border-color: #c9a84c; color: #c9a84c; }
.chart-type-btn.active { background: rgba(201,168,76,0.12); border-color: #c9a84c; color: #c9a84c; }

/* Chart area */
.chart-tv-wrap {
  flex: 0 0 58%; min-height: 0; position: relative;
  background: #091524; overflow: hidden;
}
.chart-tv-wrap iframe { width: 100%; height: 100%; border: none; display: block; }
.chart-tv-wrap .chart-spinner {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

/* Analysis */
.chart-analysis-wrap {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 12px 20px 14px;
  background: #091524; border-top: 0.5px solid #1e3a5f;
}
.chart-analysis-text    { font-size: 13px; color: #dde3ed; line-height: 1.75; }
.chart-analysis-loading { color: var(--muted); font-style: italic; }
.chart-no-data          { color: var(--muted); font-size: 13px; text-align: center; }

.chart-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(201,168,76,0.2); border-top-color: #c9a84c;
  animation: chartSpin 0.8s linear infinite;
}
@keyframes chartSpin { to { transform: rotate(360deg); } }
