/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 13px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0a0e17;
  color: #e5e7eb;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === COLORS === */
:root {
  --bg-primary: #0a0e17;
  --bg-surface: #111827;
  --bg-surface-alt: #151b2b;
  --bg-hover: #1a2035;
  --bg-header: #0d1220;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #3b82f6;
  --accent-dim: #2563eb;
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --yellow: #eab308;
  --yellow-dim: rgba(234,179,8,0.12);
  --border: #1e293b;
  --border-light: #374151;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Mono', monospace;
  --font-sans: 'Inter', -apple-system, sans-serif;
}

/* === HEADER === */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
  flex-shrink: 0;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: -0.5px;
}
.add-ticker-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.add-ticker-group input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 3px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
.add-ticker-group input:focus { border-color: var(--accent); }
.add-ticker-group input::placeholder { color: var(--text-muted); }
.btn-sm {
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.btn-sm:hover { background: var(--accent-dim); }

/* === SEARCH AUTOCOMPLETE === */
.search-wrapper {
  position: relative;
}
.search-wrapper input {
  width: 220px;
}
.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  width: 320px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.search-dropdown.active {
  display: block;
}
.search-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.search-dropdown-item:last-child {
  border-bottom: none;
}
.search-dropdown-item:hover,
.search-dropdown-item.active {
  background: var(--bg-hover);
}
.search-dropdown-symbol {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  min-width: 52px;
}
.search-dropdown-name {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.search-dropdown-exchange {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-dropdown-empty {
  padding: 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.search-dropdown-loading {
  padding: 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.header-right { flex-shrink: 0; }
.header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.total-mcap { color: var(--text-secondary); font-weight: 500; }
.refresh-timer { color: var(--accent); }

/* === TAB BAR === */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 41px; /* header height */
  z-index: 90;
  padding: 0 12px;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  position: relative;
}
.tab-btn svg {
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.tab-btn:hover {
  color: var(--text-secondary);
}
.tab-btn:hover svg { opacity: 0.8; }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-btn.active svg { opacity: 1; }

/* === TAB PANES === */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  padding: 0;
  position: relative;
}
.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Fill remaining viewport height so thead sticks inside this container */
  max-height: calc(100vh - var(--table-top-offset, 130px));
  max-height: calc(100dvh - var(--table-top-offset, 130px));
}
.table-wrapper::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

/* === TABLE === */
.watchlist-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  table-layout: fixed;
  min-width: 1360px;
}
.watchlist-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg-header);
  border-bottom: 2px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: default;
  user-select: none;
  z-index: 10;
}
.watchlist-table thead th.num { text-align: right; }
.watchlist-table thead th.sortable { cursor: pointer; }
.watchlist-table thead th.sortable:hover { color: var(--accent); }
.watchlist-table thead th .sort-arrow {
  font-size: 9px;
  margin-left: 2px;
  opacity: 0.6;
}
.watchlist-table thead th.sort-active { color: var(--accent); }
.watchlist-table thead th.sort-active .sort-arrow { opacity: 1; }

/* Column widths */
.col-ticker { width: 72px; min-width: 72px; }
.col-name { width: 150px; }
.col-subsector { width: 130px; }
.col-price { width: 68px; }
.col-mcap { width: 74px; }
.col-ev { width: 68px; }
.col-ev-sales { width: 76px; }
.col-ev-fcf { width: 76px; }
.col-perf { width: 66px; }
.col-remove { width: 24px; }

/* Pinned first column (Ticker) */
.watchlist-table:not(.private-table) thead th.col-ticker,
.watchlist-table:not(.private-table) tbody td.cell-ticker {
  position: sticky;
  left: 0;
  z-index: 5;
}
.watchlist-table:not(.private-table) thead th.col-ticker {
  z-index: 15; /* above both sticky-top headers and sticky-left cells */
  background: var(--bg-header);
}
.watchlist-table:not(.private-table) tbody td.cell-ticker {
  background: var(--bg-primary);
}
.watchlist-table:not(.private-table) tbody tr:nth-child(even) td.cell-ticker {
  background: #0e1322; /* matches the even-row tint on --bg-primary */
}
.watchlist-table:not(.private-table) tbody tr:hover td.cell-ticker {
  background: var(--bg-hover);
}
/* Subtle right border on pinned column to show separation when scrolled */
.watchlist-table:not(.private-table) thead th.col-ticker,
.watchlist-table:not(.private-table) tbody td.cell-ticker {
  border-right: 1px solid var(--border);
}
/* Pinned first column (Company Name) — private table */
.private-table thead th.col-company,
.private-table tbody td.private-name-cell {
  position: sticky;
  left: 0;
  z-index: 5;
}
.private-table thead th.col-company {
  z-index: 15;
  background: var(--bg-header);
}
.private-table tbody td.private-name-cell {
  background: var(--bg-primary);
}
.private-table tbody tr:nth-child(even) td.private-name-cell {
  background: #0e1322;
}
.private-table tbody tr:hover td.private-name-cell {
  background: var(--bg-hover);
}
.private-table thead th.col-company,
.private-table tbody td.private-name-cell {
  border-right: 1px solid var(--border);
}
/* Private subsector header — pin label cell */
.private-table .subsector-header td:first-child {
  position: sticky;
  left: 0;
  z-index: 6;
  background: var(--bg-surface-alt);
}

/* Subsector header row — label cell pinned to left */
.watchlist-table:not(.private-table) .subsector-header .subsector-label-cell {
  position: sticky;
  left: 0;
  z-index: 6;
  white-space: nowrap;
  overflow: visible;
}
.watchlist-table:not(.private-table) .subsector-header .subsector-fill-cell {
  /* inherits background from .subsector-header td rule */
}

/* Body rows */
.watchlist-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.watchlist-table tbody tr:nth-child(even) { background: rgba(17,24,39,0.4); }
.watchlist-table tbody tr:hover { background: var(--bg-hover); }
.watchlist-table tbody td {
  padding: 5px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.watchlist-table tbody td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 11.5px;
  letter-spacing: -0.2px;
}

/* Ticker cell */
td.cell-ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  font-size: 12px;
}
td.cell-ticker:hover { text-decoration: underline; }

/* Company name */
td.cell-name {
  color: var(--text-secondary);
  font-size: 11px;
  vertical-align: middle;
}
.cell-name-text {
  display: block;
  line-height: 1.3;
}
.public-hq {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
  letter-spacing: 0.2px;
}

/* Subsector badge */
.subsector-badge {
  display: inline-block;
  background: rgba(59,130,246,0.1);
  color: var(--accent);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid rgba(59,130,246,0.2);
  transition: background 0.15s;
}
.subsector-badge:hover {
  background: rgba(59,130,246,0.2);
}

/* Performance colors */
.val-pos { color: var(--green); }
.val-neg { color: var(--red); }
.val-neutral { color: var(--text-muted); }

/* Remove button */
.remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  padding: 0 4px;
  line-height: 1;
}
tr:hover .remove-btn { opacity: 1; }
.remove-btn:hover { color: var(--red); }

/* === SUBSECTOR GROUP HEADER === */
.subsector-header td {
  padding: 7px 8px 5px;
  background: var(--bg-surface-alt) !important;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}
.subsector-header:hover td { background: var(--bg-surface-alt) !important; }
.subsector-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
}
.subsector-toggle .chevron {
  display: inline-block;
  font-size: 9px;
  transition: transform 0.2s;
  color: var(--text-muted);
  width: 10px;
}
.subsector-toggle .chevron.collapsed { transform: rotate(-90deg); }
.subsector-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 10px;
  margin-left: 4px;
}

/* Hidden rows in collapsed groups */
.row-hidden { display: none; }

/* === CONTEXT MENU (long-press) === */
.context-menu {
  position: fixed;
  z-index: 2000;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  padding: 4px 0;
  min-width: 180px;
  font-family: var(--font-sans);
  font-size: 12px;
  animation: ctxFadeIn 0.12s ease-out;
}
@keyframes ctxFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  user-select: none;
}
.context-menu-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.context-menu-item.danger { color: var(--red); }
.context-menu-item.danger:hover { background: rgba(239,68,68,0.12); color: var(--red); }
.context-menu-item .ctx-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.context-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Subsector picker dropdown */
.subsector-picker {
  position: fixed;
  z-index: 2001;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  padding: 4px 0;
  min-width: 190px;
  max-width: 240px;
  max-height: 360px;
  overflow-y: auto;
  font-family: var(--font-sans);
  font-size: 12px;
  animation: ctxFadeIn 0.12s ease-out;
}
.subsector-picker-header {
  padding: 6px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.subsector-picker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  user-select: none;
}
.subsector-picker-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.subsector-picker-item.active {
  color: var(--accent);
  font-weight: 500;
}
.subsector-picker-check {
  width: 14px;
  font-size: 11px;
  text-align: center;
  flex-shrink: 0;
  color: var(--accent);
}
.subsector-picker-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.subsector-picker-custom {
  color: var(--text-muted);
  font-style: italic;
}
.subsector-picker-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
}
.subsector-picker-input {
  flex: 1;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  color: var(--text-primary);
  font-size: 11px;
  padding: 4px 8px;
  outline: none;
  font-family: var(--font-sans);
}
.subsector-picker-input:focus {
  border-color: var(--accent);
}
.subsector-picker-confirm {
  background: var(--accent);
  border: none;
  border-radius: 3px;
  color: #fff;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  font-weight: 600;
  line-height: 1;
}
.subsector-picker-confirm:hover {
  opacity: 0.85;
}

/* Long-press visual feedback */
tr.long-pressing {
  background: var(--bg-hover) !important;
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

/* === LOADING === */
.loading-overlay {
  padding: 12px 16px;
  display: none;
}
.loading-overlay.active { display: block; }
.skeleton-row {
  height: 28px;
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-surface-alt) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  border-radius: 3px;
  margin-bottom: 4px;
  animation: shimmer 1.5s infinite;
  animation-delay: calc(var(--i) * 0.08s);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === PUBLIC COMPANIES SECTION === */
.public-section {
  border-bottom: none;
}

/* === PRIVATE COMPANIES INLINE ADD === */
.add-private-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.add-private-group input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 3px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
.add-private-group input:focus { border-color: var(--accent); }
.add-private-group input::placeholder { color: var(--text-muted); }
.add-private-group input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === PRIVATE COMPANIES === */
.private-section {
  margin-top: 12px;
  padding: 0 0 8px;
  border-top: 2px solid var(--border);
}
.section-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
}
.section-header-bar h2 {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}
.private-table { min-width: 1050px; }
.private-table thead th { top: 0; position: relative; }

/* Private company name cell with HQ */
.private-name-cell { vertical-align: middle; }
.private-name-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
}
.private-hq {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
  letter-spacing: 0.2px;
}

/* Status badges for public/IPO companies */
.private-status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.status-public {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.status-ipo {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* Lead investors column */
.private-investors {
  color: var(--text-secondary);
  font-size: 11px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === POPUP / MODAL === */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
.popup-overlay.active {
  display: flex;
}
.popup-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-width: 1100px;
  width: 100%;
  position: relative;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}
.popup-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  z-index: 10;
  transition: color 0.15s;
  line-height: 1;
}
.popup-close:hover { color: var(--text-primary); }
.popup-content { min-height: 200px; }

/* Popup sections */
.popup-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.popup-ticker {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.popup-company {
  font-size: 14px;
  color: var(--text-secondary);
}
.popup-price-group {
  margin-left: auto;
  text-align: right;
}
.popup-price {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}
.popup-change {
  font-family: var(--font-mono);
  font-size: 13px;
  margin-left: 8px;
}
.popup-section {
  margin-bottom: 24px;
}
.popup-section-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.popup-chart-container {
  background: var(--bg-primary);
  border-radius: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.chart-period-btns {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.chart-period-btn {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.15s;
}
.chart-period-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.chart-period-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Metrics grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.metric-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
}
.metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}
.metric-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* 4-column metrics grid */
.metrics-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 700px) {
  .metrics-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
.metric-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
  font-family: var(--font-mono);
}

/* Guidance table */
.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 12px;
}
.guide-table th {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: right;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.3px;
  color: var(--text-muted);
}
.guide-table th:first-child {
  text-align: left;
}
.guide-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.guide-table .guide-metric {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

/* Signal badges */
.signal-above { color: var(--green); font-weight: 600; font-size: 11px; }
.signal-below { color: var(--red); font-weight: 600; font-size: 11px; }
.signal-high { color: var(--green); font-size: 11px; opacity: 0.85; }
.signal-low { color: var(--yellow); font-size: 11px; opacity: 0.85; }
.signal-mid { color: var(--text-muted); font-size: 11px; }

/* Revision momentum */
.revision-section {
  margin-top: 4px;
}
.revision-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.revision-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  font-weight: 500;
}
.revision-direction {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.revision-track {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}
.revision-point {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.revision-current {
  border-color: var(--accent);
  background: rgba(0, 200, 255, 0.05);
}
.revision-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.revision-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}
.revision-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.revision-up { color: var(--green); font-weight: 600; }
.revision-down { color: var(--red); font-weight: 600; }
.revision-period { color: var(--text-muted); font-size: 10px; margin-left: auto; }
.revision-bar {
  flex: 1;
  height: 4px;
  background: var(--red);
  border-radius: 2px;
  overflow: hidden;
  max-width: 120px;
}
.revision-bar-fill {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 2px;
}

/* Revenue estimate range table */
.rev-range-table td strong {
  color: var(--accent);
}

/* Spread dispersion badges */
.spread-tight {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}
.spread-tight small {
  font-weight: 400;
  opacity: 0.8;
}
.spread-normal {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}
.spread-wide {
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}
.spread-wide small {
  font-weight: 400;
  opacity: 0.8;
}

/* Narrative text */
.narrative-text {
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-secondary);
  padding: 8px 0;
}

/* Events list */
.events-list {
  list-style: none;
}
.events-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.event-date {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 11px;
  min-width: 90px;
}
.event-type {
  color: var(--text-secondary);
}

/* Popup loading */
.popup-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}
.popup-loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-left: 10px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Private modal form */
.private-modal { max-width: 500px; }
.private-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.private-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.private-form input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 3px;
  outline: none;
}
.private-form input:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 3px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-dim); }
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary:disabled:hover { background: var(--accent); }
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}
.private-form-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 2px 0 4px;
}
.lookup-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.5;
}
.lookup-status.status-loading {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.3);
  color: var(--accent);
}
.lookup-status.status-success {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--green);
}
.lookup-status.status-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red);
}

/* === FOOTER === */
/* === NEWS FEED === */
.news-section {
  margin-top: 12px;
  padding: 0 0 8px;
  border-top: 2px solid var(--border);
}
.news-section .section-header-bar {
  padding: 10px 16px 4px;
}
.news-status {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.news-feed {
  display: flex;
  flex-direction: column;
}
.news-loading {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
}
.news-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
  cursor: pointer;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover {
  background: var(--bg-hover);
}
.news-item:hover .news-title {
  color: var(--accent);
}
.news-ticker-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}
.news-title {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s;
  line-height: 1.4;
}
.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.news-source {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.news-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 42px;
  text-align: right;
}
.news-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
}

.app-footer {
  text-align: center;
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.app-footer a {
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
}
.app-footer a:hover { color: var(--text-secondary); }

/* === SEE MORE / DEEP DIVE === */
.see-more-wrapper {
  text-align: center;
  padding: 16px 0 8px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.see-more-btn {
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 28px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.3px;
}
.see-more-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--text-primary);
}
.see-more-arrow {
  font-size: 10px;
  transition: transform 0.25s ease;
}
.see-more-arrow.rotated {
  transform: rotate(180deg);
}
.deep-dive-container {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 16px;
}
.deep-dive-section {
  margin-bottom: 28px;
}
.deep-dive-loading {
  min-height: 200px;
}

/* Quant Factor Scorecard */
.quant-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.quant-composite {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.composite-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.composite-score {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
}
.quant-factors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
}
.factor-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(30,41,59,0.4);
}
.factor-name {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}
.factor-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.factor-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.factor-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease-out;
  min-width: 2px;
}
.factor-score {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}
.factor-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* Short Interest */
.short-interest-metrics {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.si-big-number {
  min-width: 140px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
}
.si-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.si-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 4px;
}
.si-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  flex: 1;
}
.short-interest-chart-area {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 8px;
  height: 200px;
}
.si-context {
  margin-top: 4px;
}

/* S&P 500 Outperformance */
.outperf-chart-block {
  margin-bottom: 4px;
}
.outperf-header {
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.outperf-big-number {
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: inline-block;
}
.outperf-value {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
}
.outperf-unit {
  font-size: 16px;
  opacity: 0.7;
}
.outperf-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 4px;
}
.outperf-approx {
  font-size: 9px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}
.outperf-chart-container {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  height: 310px;
}

/* Lookback toggle buttons */
.outperf-lookback-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
  flex-shrink: 0;
  margin-top: 4px;
}
.lookback-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.3px;
}
.lookback-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}
.lookback-btn.active {
  background: rgba(59,130,246,0.2);
  color: #60a5fa;
}

/* Cross-Sector Comps Table */
.comps-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.2px;
}
.comps-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.comps-table-wrapper::-webkit-scrollbar {
  height: 6px;
}
.comps-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.comps-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.comps-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
  min-width: 900px;
}
.comps-table thead th {
  background: var(--bg-surface-alt);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}
.comps-table thead th.num {
  text-align: right;
}
.comps-table tbody td {
  padding: 7px 10px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.comps-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.comps-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}
.comps-table tbody tr:last-child td {
  border-bottom: none;
}

/* Target row highlight */
.comps-target-row {
  background: rgba(34,211,238,0.04);
}
.comps-target-row td {
  color: var(--text-primary);
  font-weight: 500;
  border-bottom: 1px solid rgba(34,211,238,0.15);
}

/* Sticky company column */
.comps-sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: inherit;
  min-width: 160px;
}
thead .comps-sticky-col {
  z-index: 3;
  background: var(--bg-surface-alt);
}
.comps-target-row .comps-sticky-col {
  background: rgba(10, 14, 23, 0.97);
}
tbody tr:hover .comps-sticky-col {
  background: rgba(10, 14, 23, 0.97);
}

/* Ticker + name layout in first column */
.comps-ticker {
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
  margin-right: 6px;
}
.comps-name {
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-sans);
}
.comps-sector-cell {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--text-muted);
}

/* Match badges */
.comps-target-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(34,211,238,0.12);
  color: var(--accent);
  border: 1px solid rgba(34,211,238,0.25);
}
.comps-sim-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Narrative under comps table */
.comps-narrative {
  margin-top: 10px;
}

/* ===== EARNINGS SECTION ===== */
.earnings-section {
  margin-top: 24px;
}
.earnings-header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}
.earnings-status {
  font-size: 11px;
  color: #6b7280;
  font-family: 'JetBrains Mono', monospace;
}
.btn-ghost {
  background: transparent;
  border: 1px solid #1e293b;
  color: #94a3b8;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover {
  border-color: #3b82f6;
  color: #e5e7eb;
}
.earnings-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
.earnings-panel {
  background: #0d1117;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 14px;
}
.earnings-panel-title {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px 0;
}
.earnings-empty {
  font-size: 12px;
  color: #4b5563;
  padding: 16px 0;
  text-align: center;
}

/* --- Earnings Cards --- */
.earnings-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.earnings-card {
  background: #111827;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 12px;
  transition: border-color 0.15s;
}
.earnings-card:hover {
  border-color: #374151;
}
.earnings-card.reported {
  border-left: 3px solid #3b82f6;
}
.earnings-card.upcoming {
  border-left: 3px solid #f59e0b;
}
.earnings-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.earnings-card-ticker {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
  color: #e5e7eb;
}
.earnings-card-name {
  font-size: 12px;
  color: #9ca3af;
}
.earnings-card-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #6b7280;
  margin-left: auto;
}
.earnings-card-metrics {
  display: flex;
  gap: 16px;
  margin-bottom: 6px;
}
.earnings-metric {
  display: flex;
  align-items: center;
  gap: 6px;
}
.metric-label {
  font-size: 10px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #e5e7eb;
  font-weight: 500;
}
.metric-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-tag.beat {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.metric-tag.miss {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.metric-tag.inline {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}
.earnings-card-fq {
  font-size: 10px;
  color: #6b7280;
  margin-bottom: 4px;
}
.earnings-card-reaction {
  font-size: 11px;
  color: #9ca3af;
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 8px;
  line-height: 1.4;
}
.earnings-card-reaction.positive { color: #22c55e; }
.earnings-card-reaction.negative { color: #ef4444; }
.earnings-card-countdown {
  font-size: 12px;
  color: #f59e0b;
  margin-bottom: 8px;
}
.earnings-note-btn {
  background: transparent;
  border: 1px solid #1e293b;
  color: #60a5fa;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.earnings-note-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
}

/* --- Next Up (15-45 day preview) --- */
.earnings-next-up {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #1e293b;
}
.earnings-next-up-title {
  font-size: 11px;
  color: #6b7280;
  font-weight: 600;
  margin: 0 0 8px 0;
}
.earnings-next-up-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.earnings-next-up-item {
  display: grid;
  grid-template-columns: 56px 1fr 90px 40px;
  gap: 8px;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 3px;
  align-items: center;
}
.earnings-next-up-item:hover {
  background: #111827;
}
.nui-ticker {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #e5e7eb;
}
.nui-name {
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nui-date {
  font-family: 'JetBrains Mono', monospace;
  color: #6b7280;
  text-align: right;
}
.nui-days {
  font-family: 'JetBrains Mono', monospace;
  color: #f59e0b;
  text-align: right;
}

/* --- Earnings Note Modal --- */
.earnings-note-modal {
  max-width: 720px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
}
.earnings-note-content {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.65;
  color: #d1d5db;
}
.earnings-note-content h2 {
  font-size: 18px;
  color: #f3f4f6;
  margin: 0 0 12px 0;
  font-weight: 700;
}
.earnings-note-content h3 {
  font-size: 14px;
  color: #e5e7eb;
  margin: 20px 0 8px 0;
  font-weight: 600;
}
.earnings-note-content h4 {
  font-size: 12px;
  color: #9ca3af;
  margin: 16px 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.earnings-note-content p {
  margin: 0 0 8px 0;
}
.earnings-note-content strong {
  color: #e5e7eb;
}
.earnings-note-content ul {
  margin: 4px 0 12px 0;
  padding-left: 18px;
}
.earnings-note-content li {
  margin-bottom: 4px;
}
.earnings-note-content hr {
  border: none;
  border-top: 1px solid #1e293b;
  margin: 16px 0;
}
.earnings-note-content a {
  color: #60a5fa;
  text-decoration: none;
}
.earnings-note-content a:hover {
  text-decoration: underline;
}
.earnings-md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 16px 0;
  font-size: 12px;
}
.earnings-md-table th,
.earnings-md-table td {
  padding: 6px 10px;
  border: 1px solid #1e293b;
  text-align: left;
}
.earnings-md-table th {
  background: #111827;
  color: #e5e7eb;
  font-weight: 600;
}
.earnings-md-table td {
  color: #d1d5db;
}
.earnings-note-loading,
.earnings-note-error {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-size: 13px;
}

/* --- Earnings Archive Modal --- */
.earnings-archive-modal {
  max-width: 800px;
  width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
}
.archive-section {
  margin-bottom: 24px;
}
.archive-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.archive-notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.archive-note-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.archive-note-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}
.archive-note-card.archived {
  opacity: 0.7;
}
.archive-note-card.archived:hover {
  opacity: 1;
}
.archive-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.archive-card-ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
}
.archive-card-name {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-card-type {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
}
.archive-card-type.post {
  color: var(--green);
  background: var(--green-dim);
}
.archive-card-type.pre {
  color: var(--accent);
  background: rgba(59,130,246,0.1);
}
.archive-card-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.archive-card-headline {
  font-size: 11px;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 6px;
}
.archive-card-metrics {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}
.archive-metric {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  padding: 2px 6px;
  background: rgba(255,255,255,0.03);
  border-radius: 3px;
}
.archive-metric.positive { color: var(--green); }
.archive-metric.negative { color: var(--red); }
.archive-card-cta {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}

/* === WEEKLY BRIEFING === */
.weekly-briefing-section {
  margin-top: 32px;
}
.weekly-briefing-content {
  padding: 0 4px;
}
.wb-empty {
  color: #6b7280;
  font-size: 0.875rem;
  padding: 24px 0;
  text-align: center;
}
.wb-status {
  color: #6b7280;
  font-size: 0.75rem;
}
.wb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 8px;
  border-bottom: 1px solid #1e2433;
  flex-wrap: wrap;
  gap: 8px;
}
.wb-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e5e7eb;
}
.wb-indices {
  display: flex;
  gap: 16px;
}
.wb-index {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
}
.wb-index.positive { color: #22c55e; }
.wb-index.negative { color: #ef4444; }
.wb-narrative {
  color: #9ca3af;
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 12px 0 16px;
}
.wb-section {
  margin: 20px 0;
}
.wb-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e5e7eb;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wb-section-title .wb-icon {
  color: #3b82f6;
  font-size: 1.1rem;
}
.wb-section-title .wb-subtitle {
  font-weight: 400;
  color: #6b7280;
  font-size: 0.8rem;
  margin-left: 4px;
}
.wb-sub-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 8px;
}

/* --- Cards grid --- */
.wb-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.wb-card {
  background: #111827;
  border: 1px solid #1e2433;
  border-radius: 8px;
  padding: 14px 16px;
  position: relative;
  transition: border-color 0.15s;
}
.wb-card:hover {
  border-color: #2d3748;
}
.wb-value-card {
  border-left: 3px solid #3b82f6;
}
.wb-momentum-card {
  border-left: 3px solid #22c55e;
}
.wb-card-rank {
  position: absolute;
  top: 10px;
  right: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: #4b5563;
}
.wb-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.wb-card-ticker {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1rem;
  color: #e5e7eb;
}
.wb-card-name {
  font-size: 0.8rem;
  color: #9ca3af;
}
.wb-card-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: #d1d5db;
  margin-left: auto;
}
.wb-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.wb-stat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  color: #9ca3af;
}
.wb-stat.positive { color: #22c55e; background: rgba(34,197,94,0.08); }
.wb-stat.negative { color: #ef4444; background: rgba(239,68,68,0.08); }
.wb-card-thesis, .wb-card-bull {
  font-size: 0.8rem;
  color: #d1d5db;
  line-height: 1.45;
  margin-bottom: 6px;
}
.wb-label {
  font-weight: 600;
  font-size: 0.72rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

/* --- Trends & Risks lists --- */
.wb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wb-list-item {
  background: #111827;
  border: 1px solid #1e2433;
  border-radius: 6px;
  padding: 10px 14px;
}
.wb-list-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: #e5e7eb;
  margin-bottom: 4px;
}
.wb-list-detail {
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.45;
}
.wb-risk-item {
  border-left: 3px solid #f59e0b;
}

/* --- Watchlist updates --- */
.wb-updates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}
.wb-update-card {
  background: #111827;
  border: 1px solid #1e2433;
  border-radius: 6px;
  padding: 12px 14px;
}
.wb-update-card.wb-up { border-left: 3px solid #22c55e; }
.wb-update-card.wb-down { border-left: 3px solid #ef4444; }
.wb-update-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.wb-update-ticker {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.9rem;
  color: #e5e7eb;
}
.wb-update-perfs {
  display: flex;
  gap: 8px;
}
.wb-perf {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 3px;
}
.wb-perf.positive { color: #22c55e; background: rgba(34,197,94,0.08); }
.wb-perf.negative { color: #ef4444; background: rgba(239,68,68,0.08); }
.wb-update-headline {
  font-weight: 600;
  font-size: 0.8rem;
  color: #d1d5db;
  margin-bottom: 4px;
}
.wb-update-detail {
  font-size: 0.78rem;
  color: #9ca3af;
  line-height: 1.4;
}
.wb-updates-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wb-compact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #111827;
  border: 1px solid #1e2433;
  border-radius: 4px;
  font-size: 0.78rem;
}
.wb-compact-ticker {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: #e5e7eb;
  min-width: 48px;
}
.wb-compact-headline {
  color: #9ca3af;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wb-archive-link {
  margin-top: 20px;
  text-align: center;
}

/* === EARNINGS CALENDAR === */
.earnings-calendar-section { padding: 0 16px 16px; }
.earnings-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.ecal-day-header {
  background: var(--bg-header);
  padding: 6px 4px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.ecal-cell {
  background: var(--bg-primary);
  min-height: 72px;
  padding: 4px;
  position: relative;
}
.ecal-cell.ecal-today {
  background: rgba(59,130,246,0.06);
}
.ecal-cell.ecal-other-month {
  opacity: 0.35;
}
.ecal-date {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2px;
  padding: 0 2px;
}
.ecal-today .ecal-date {
  color: var(--accent);
  font-weight: 700;
}
.ecal-tickers {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.ecal-ticker-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
}
.ecal-ticker-chip.ecal-pre {
  color: var(--accent);
  background: rgba(59,130,246,0.1);
}
.ecal-ticker-chip.ecal-pre:hover {
  background: rgba(59,130,246,0.2);
}
.ecal-ticker-chip.ecal-post {
  color: var(--green);
  background: var(--green-dim);
}
.ecal-ticker-chip.ecal-post:hover {
  background: rgba(34,197,94,0.2);
}
.ecal-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ecal-nav-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.ecal-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.ecal-month-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 120px;
  text-align: center;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .header-meta { flex-direction: column; gap: 2px; align-items: flex-end; }
  .search-wrapper input { width: 140px; }
  .search-dropdown { width: 260px; }
  .quant-factors-grid { grid-template-columns: 1fr; }
  .short-interest-metrics { flex-direction: column; }
  .si-cards { grid-template-columns: 1fr; }
  .comps-table { min-width: 700px; }
  .earnings-panels { grid-template-columns: 1fr; }
  .tab-btn { padding: 8px 12px; font-size: 11px; }
  .tab-btn svg { width: 12px; height: 12px; }
  .earnings-calendar-grid { grid-template-columns: repeat(7, 1fr); }
  .ecal-cell { min-height: 56px; }
  .ecal-ticker-chip { font-size: 8px; }
}

/* ===== MACRO TAB ===== */
.macro-content { padding: 0; }
.macro-loading, .macro-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Regime Banner */
.macro-regime-banner {
  background: var(--bg-surface);
  padding: 14px 18px;
  margin: 12px 16px;
  border-radius: 6px;
}
.regime-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.regime-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.regime-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.regime-label {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.regime-updated {
  font-size: 11px;
  color: var(--text-muted);
}
.regime-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}
.regime-tilts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tilt-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
}
.tilt-favor { background: var(--green-dim); color: var(--green); }
.tilt-avoid { background: var(--red-dim); color: var(--red); }

/* Pillar Tiles */
.macro-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 0 16px 12px;
}
.macro-pillar-tile {
  background: var(--bg-surface);
  border-radius: 6px;
  padding: 12px 14px;
  min-width: 0;
}
.pillar-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.pillar-icon { font-size: 14px; }
.pillar-header h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}
.pillar-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.pillar-na {
  font-size: 11px;
  color: var(--text-muted);
}

/* Score bar */
.pillar-score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.score-track {
  flex: 1;
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  position: relative;
}
.score-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}
.score-center {
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 1px;
}
.score-val {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  min-width: 34px;
  text-align: right;
}

/* Pillar signals */
.pillar-signals {
  border-top: 1px solid var(--border);
  padding-top: 6px;
}
.pillar-signal {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 0;
  font-size: 10px;
  white-space: nowrap;
}
.pillar-signal-header {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
  margin-bottom: 2px;
}
.signal-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 80px;
  min-width: 80px;
}
.signal-price {
  font-family: var(--font-mono);
  text-align: right;
  color: var(--text-primary);
  min-width: 46px;
  flex-shrink: 0;
}
.signal-dir {
  text-align: center;
  font-size: 11px;
  min-width: 20px;
  flex-shrink: 0;
}
.signal-chg {
  font-family: var(--font-mono);
  text-align: right;
  font-size: 10px;
  min-width: 40px;
  flex-shrink: 0;
}

/* Indices Bar */
.macro-indices-bar {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
}
.index-chip {
  background: var(--bg-surface);
  padding: 6px 12px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  flex: 1;
  min-width: 140px;
}
.index-name {
  color: var(--text-secondary);
  font-weight: 500;
}
.index-price {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-weight: 600;
}
.index-chg {
  font-family: var(--font-mono);
  font-size: 10px;
  margin-left: auto;
}
.vix-high { border-left: 3px solid var(--red); }
.vix-elevated { border-left: 3px solid var(--yellow); }
.vix-low { border-left: 3px solid var(--green); }

/* Two-column layout */
.macro-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px 16px;
}
.macro-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Macro card */
.macro-card {
  background: var(--bg-surface);
  border-radius: 6px;
  padding: 14px;
}
.macro-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Heatmap rows */
.hm-header, .hm-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.hm-header {
  padding: 0 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hm-row {
  padding: 4px 0;
  border-bottom: 1px solid rgba(30,41,59,0.4);
  font-size: 11px;
}
.hm-row:last-child { border-bottom: none; }
.hm-ticker {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 10px;
  min-width: 36px;
  flex-shrink: 0;
}
.hm-name {
  color: var(--text-secondary);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 70px;
  flex: 1 1 70px;
}
.hm-tag {
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.hm-favor { background: var(--green-dim); color: var(--green); }
.hm-avoid { background: var(--red-dim); color: var(--red); }
/* Diverging momentum bar — centered at 0, extends left (red) or right (green) */
.hm-diverge-wrap {
  position: relative;
  height: 22px;
  background: rgba(17,24,39,0.6);
  border-radius: 3px;
  min-width: 120px;
  flex: 1 1 120px;
  overflow: hidden;
}
.hm-diverge-center {
  position: absolute;
  left: 50%;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: var(--border-light);
}
.hm-diverge-bar {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: 2px;
  transition: width 0.4s ease;
  opacity: 0.75;
}
.hm-diverge-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-shadow: 0 0 4px rgba(0,0,0,0.8);
  z-index: 1;
}
.hm-header .hm-diverge-wrap {
  background: none;
  height: auto;
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hm-val {
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
  min-width: 42px;
  flex-shrink: 0;
}

/* Stock Ideas */
.ideas-section { margin-bottom: 12px; }
.ideas-section:last-child { margin-bottom: 0; }
.ideas-heading {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.ideas-own-heading { color: var(--green); }
.ideas-avoid-heading { color: var(--red); }
.idea-row {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 6px;
  padding: 5px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(30,41,59,0.3);
}
.idea-row:last-child { border-bottom: none; }
.idea-ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}
.idea-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.idea-subsector {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.idea-reason {
  grid-column: 1 / -1;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
}
.idea-own { border-left: 2px solid var(--green); padding-left: 8px; }
.idea-avoid { border-left: 2px solid var(--red); padding-left: 8px; }

/* Commodities & Rates */
.commodity-header, .commodity-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.commodity-header {
  padding: 0 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.commodity-row {
  padding: 4px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(30,41,59,0.3);
}
.commodity-row:last-child { border-bottom: none; }
.commodity-name {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 80px;
  flex: 1 1 80px;
}
.commodity-price {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
  min-width: 56px;
  flex-shrink: 0;
}
.commodity-chg {
  font-family: var(--font-mono);
  font-size: 10px;
  text-align: right;
  min-width: 42px;
  flex-shrink: 0;
}

/* Horizontal scroll wrappers — each section scrolls its own content */
.pillar-signals {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pillar-signals .pillar-signal {
  min-width: 480px;
}
.hm-scroll-wrap, .commodity-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile responsive */
@media (max-width: 900px) {
  .macro-pillars { grid-template-columns: 1fr 1fr; }
  .macro-grid-2col { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .macro-pillars { grid-template-columns: 1fr; }
  .macro-indices-bar { flex-direction: column; }
  .index-chip { min-width: unset; }
}

/* ===================================================================
   NOTE ENHANCEMENT STYLES
   1. Confidence / quality header
   2. Note tab bar (Note | Comps | Transcript)
   3. Peer comps panel
   4. Transcript panel
   5. Note search modal
   6. Utility: .pos / .neg / .neutral
   =================================================================== */

/* --- Utility color classes --- */
.pos  { color: var(--green);  }
.neg  { color: var(--red);    }
.neutral { color: var(--text-muted); }

/* ===================================================================
   1. CONFIDENCE HEADER
   =================================================================== */
.note-confidence-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 12px;
  border: 1px solid;
}
.note-confidence-header.conf-tier-high {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
}
.note-confidence-header.conf-tier-medium {
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.25);
}
.note-confidence-header.conf-tier-low {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.22);
}

.conf-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.conf-tier-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.conf-tier-badge.conf-tier-high   { background: rgba(34, 197, 94, 0.18);  color: var(--green); }
.conf-tier-badge.conf-tier-medium { background: rgba(234, 179, 8, 0.18);  color: var(--yellow); }
.conf-tier-badge.conf-tier-low    { background: rgba(239, 68, 68, 0.15);  color: var(--red); }

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

.conf-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}
.conf-pill {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.conf-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.conf-flag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 3px;
  background: rgba(234, 179, 8, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(234, 179, 8, 0.25);
}

/* ===================================================================
   2. NOTE TAB BAR
   =================================================================== */
.note-tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  padding-bottom: 0;
}

.note-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 7px 14px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.02em;
}
.note-tab:hover {
  color: var(--text-primary);
}
.note-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.note-panel {
  display: none;
}
.note-panel.active {
  display: block;
}
.note-panel-loading {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
  text-align: center;
}
.note-panel-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 0;
  text-align: center;
}

/* ===================================================================
   3. PEER COMPS PANEL
   =================================================================== */
.note-comps-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.note-comps-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.note-comps-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.note-comps-subsector {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* Narrative paragraphs */
.comps-narrative {
  display: flex;
  flex-direction: column;
  gap: 10px;
  line-height: 1.55;
}
.comps-para {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.comps-para-label {
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.comps-para-standout {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  background: rgba(59, 130, 246, 0.04);
  border-radius: 0 4px 4px 0;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* Bar charts section */
.comps-bars-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.comps-bars-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: -4px;
}

.comp-metric-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.comp-metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.comp-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
}
.comp-bar-row-target {
  /* slightly highlighted */
}
.comp-bar-ticker {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 36px;
  flex-shrink: 0;
}
.comp-bar-row-target .comp-bar-ticker {
  color: var(--accent);
  font-weight: 700;
}
.comp-bar-track {
  flex: 1;
  height: 7px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.comp-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.comp-bar.bar-target  { background: var(--accent); }
.comp-bar.bar-good    { background: var(--green); }
.comp-bar.bar-neutral { background: var(--text-muted); opacity: 0.5; }

.comp-bar-val {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 42px;
  text-align: right;
  flex-shrink: 0;
}
.comp-bar-val.target-val {
  color: var(--accent);
  font-weight: 700;
}

/* Comps reference table */
.comps-table-details {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.comps-table-summary {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  background: var(--bg-secondary);
  list-style: none;
}
.comps-table-summary::-webkit-details-marker { display: none; }
.comps-table-summary::before {
  content: '▶ ';
  font-size: 9px;
  margin-right: 4px;
  display: inline-block;
  transition: transform 0.2s;
}
.comps-table-details[open] .comps-table-summary::before {
  transform: rotate(90deg);
}
.comps-table-summary:hover { color: var(--text-primary); }

.note-comps-table-wrapper {
  max-height: 260px;
  overflow-y: auto;
}

.comps-unavailable {
  font-size: 13px;
  color: var(--text-muted);
  padding: 16px 0;
  text-align: center;
}

/* ===================================================================
   4. TRANSCRIPT PANEL
   =================================================================== */
.note-transcript-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.transcript-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.transcript-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.transcript-period {
  font-size: 11px;
  color: var(--text-muted);
}

.transcript-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

.transcript-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.transcript-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-secondary);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s, background 0.15s;
}
.transcript-link:hover {
  border-color: var(--accent);
  background: var(--bg-tertiary);
}
.transcript-link-icon {
  color: var(--accent);
  font-size: 14px;
  flex-shrink: 0;
}
.transcript-link-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.transcript-link-name {
  font-size: 13px;
  font-weight: 600;
}
.transcript-link-desc {
  font-size: 11px;
  color: var(--text-muted);
}
.transcript-link-arrow {
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

.transcript-qa-hint {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-radius: 5px;
  padding: 8px 12px;
  line-height: 1.5;
  border: 1px solid var(--border);
}
.transcript-qa-hint strong {
  color: var(--text-secondary);
}

/* ===================================================================
   5. NOTE SEARCH MODAL
   =================================================================== */
.note-search-modal {
  width: min(680px, 94vw);
  max-height: min(600px, 90vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.note-search-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.note-search-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--text-primary);
}
.note-search-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 12px 0;
}

.note-search-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px 10px 2px 4px;
  transition: border-color 0.15s;
}
.note-search-input-row:focus-within {
  border-color: var(--accent);
}
.note-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
  padding: 8px 6px;
  font-family: var(--font-sans);
}
.note-search-input::placeholder { color: var(--text-muted); }
.note-search-kbd {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
  flex-shrink: 0;
}

.note-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 12px;
}
.note-search-results::-webkit-scrollbar { width: 4px; }
.note-search-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.note-search-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 24px 0;
  text-align: center;
}

.note-search-result {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.note-search-result:hover {
  border-color: var(--accent);
  background: var(--bg-tertiary);
}
.search-result-header {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.search-result-ticker {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.search-result-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border-radius: 3px;
}
.search-result-type.pre  { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.search-result-type.post { background: rgba(34, 197, 94, 0.13);  color: var(--green); }
.search-result-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.search-result-archived {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.search-result-excerpt {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}
mark.search-highlight {
  background: rgba(234, 179, 8, 0.25);
  color: var(--yellow);
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
}

/* ===================================================================
   NOTE BODY WRAPPER (preserves existing note content styles)
   =================================================================== */
.note-body-content {
  /* Inherits whatever styles are on the note content container */
}

/* Mobile adjustments for note tabs */
@media (max-width: 600px) {
  .note-tab { padding: 6px 10px 7px; font-size: 11px; }
  .comp-bar-ticker { min-width: 28px; }
  .note-search-modal { width: 100vw; max-height: 100vh; border-radius: 0; }
  .transcript-link { padding: 10px 12px; }
}

/* ===================================================================
   PRIVATE COMPANY DETAIL POPUP
   =================================================================== */

/* --- Modal sizing --- */
.private-detail-modal {
  width: min(820px, 96vw);
  max-height: min(700px, 92vh);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

/* --- Header --- */
.private-detail-header {
  padding: 20px 24px 0;
  flex-shrink: 0;
}

.pd-header-top {
  margin-bottom: 14px;
}

.pd-header-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.pd-company-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.pd-status-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}
.pd-status-private { background: rgba(59, 130, 246, 0.15); color: var(--accent); border: 1px solid rgba(59, 130, 246, 0.3); }
.pd-status-public  { background: rgba(34, 197, 94, 0.13);  color: var(--green);  border: 1px solid rgba(34, 197, 94, 0.3); }
.pd-status-ipo     { background: rgba(234, 179, 8, 0.15);  color: var(--yellow); border: 1px solid rgba(234, 179, 8, 0.3); }

.pd-stage-tag {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 7px;
}

.pd-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pd-subsector-tag {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: 3px;
  padding: 2px 7px;
  border: 1px solid var(--border);
}

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

/* --- Header stats bar --- */
.pd-header-stats {
  display: flex;
  gap: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0 -24px;
  padding: 0 24px;
  background: var(--bg-secondary);
  flex-wrap: wrap;
}

.pd-stat {
  display: flex;
  flex-direction: column;
  padding: 10px 16px 10px 0;
  min-width: 120px;
  flex: 1;
}

.pd-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.pd-stat-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.pd-stat-funding,
.pd-stat-investors {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 11px;
}

/* --- Tab bar --- */
.private-detail-tab-bar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  flex-shrink: 0;
  background: var(--bg-primary);
}

.pd-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.02em;
}
.pd-tab:hover { color: var(--text-primary); }
.pd-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --- Body / scroll area --- */
.private-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 24px;
  min-height: 0;
}
.private-detail-body::-webkit-scrollbar { width: 4px; }
.private-detail-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* --- Sections --- */
.pd-section {
  margin-bottom: 24px;
}

.pd-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.pd-bull-title { color: var(--green); }
.pd-bear-title { color: var(--red); }

.pd-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* --- KV grid for context fields --- */
.pd-kv-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pd-kv-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.pd-kv-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 110px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pd-kv-value {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Metric cards --- */
.pd-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.pd-metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pd-metric-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.pd-metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Research links --- */
.pd-links-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pd-link-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color 0.12s, color 0.12s;
}
.pd-link-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Comps table --- */
.pd-comps-note {
  font-size: 11px;
  color: var(--text-muted);
  margin: -6px 0 12px;
}

.pd-comps-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 20px;
}
.pd-comps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.pd-comps-table thead th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.pd-comps-table thead th.num { text-align: right; }
.pd-comps-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.pd-comps-table tbody tr:last-child td { border-bottom: none; }
.pd-comps-table tbody td.num { text-align: right; font-family: var(--font-mono); font-size: 11px; }
.pd-comp-row { cursor: pointer; transition: background 0.12s; }
.pd-comp-row:hover { background: var(--bg-tertiary); }

.pd-comp-name-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.pd-comp-ticker {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.pd-comp-name {
  font-size: 10px;
  color: var(--text-muted);
}

/* Recommendation badge */
.pd-rec {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 5px;
  border-radius: 3px;
}
.pd-rec-buy, .pd-rec-strong-buy { background: rgba(34,197,94,.15); color: var(--green); }
.pd-rec-hold, .pd-rec-neutral   { background: rgba(234,179,8,.12); color: var(--yellow); }
.pd-rec-sell, .pd-rec-underperform { background: rgba(239,68,68,.12); color: var(--red); }

/* Comps narrative */
.pd-narrative { display: flex; flex-direction: column; gap: 10px; }
.pd-narrative-para {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}
.pd-narrative-label {
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Landscape tab --- */
.pd-landscape-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.pd-competitor-card {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--bg-secondary);
}
.pd-comp-private { border-left: 3px solid var(--accent); }
.pd-comp-public  { border-left: 3px solid var(--green); }

.pd-competitor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.pd-competitor-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.pd-comp-type-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
}
.pd-comp-type-private { background: rgba(59,130,246,.12); color: var(--accent); }
.pd-comp-type-public  { background: rgba(34,197,94,.12);  color: var(--green); }

.pd-comp-ticker-btn {
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  background: rgba(59,130,246,.1);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.pd-comp-ticker-btn:hover { background: rgba(59,130,246,.2); }

.pd-competitor-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Differentiator grid */
.pd-diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pd-diff-card {
  border-radius: 7px;
  padding: 12px 14px;
  border: 1px solid;
}
.pd-diff-moat {
  background: rgba(34,197,94,.05);
  border-color: rgba(34,197,94,.2);
}
.pd-diff-threat {
  background: rgba(239,68,68,.05);
  border-color: rgba(239,68,68,.2);
}
.pd-diff-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.pd-diff-moat .pd-diff-label   { color: var(--green); }
.pd-diff-threat .pd-diff-label { color: var(--red); }
.pd-diff-content {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Thesis tab --- */
.pd-thesis-para {
  font-size: 13px;
  line-height: 1.6;
  margin: 0;
  padding: 12px 14px;
  border-radius: 7px;
  border: 1px solid;
}
.pd-bull-para {
  background: rgba(34,197,94,.05);
  border-color: rgba(34,197,94,.18);
  color: var(--text-secondary);
}
.pd-bear-para {
  background: rgba(239,68,68,.05);
  border-color: rgba(239,68,68,.18);
  color: var(--text-secondary);
}

.pd-catalysts-risks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.pd-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pd-list li {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  padding-left: 14px;
  position: relative;
}
.pd-list li::before {
  position: absolute;
  left: 0;
  font-size: 10px;
}
.pd-list-catalyst li::before { content: '↑'; color: var(--green); }
.pd-list-risk li::before     { content: '⚠'; color: var(--yellow); font-size: 9px; }

/* IPO callout */
.pd-ipo-callout {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(59,130,246,.07);
  border: 1px solid rgba(59,130,246,.2);
  border-radius: 7px;
  flex-wrap: wrap;
}
.pd-ipo-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  flex-shrink: 0;
}
.pd-ipo-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* --- Loading / empty states --- */
.pd-loading, .pd-empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 32px 0;
  text-align: center;
}

/* --- Mobile --- */
@media (max-width: 680px) {
  .private-detail-modal { max-height: 100vh; border-radius: 0; width: 100vw; }
  .pd-header-stats { flex-wrap: wrap; }
  .pd-stat { min-width: 50%; }
  .pd-diff-grid, .pd-catalysts-risks-grid { grid-template-columns: 1fr; }
  .pd-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .pd-tab { padding: 8px 10px 9px; font-size: 11px; }
}

/* ===== SCREENER ===== */
.screener-bar { padding: 0 16px; }
.screener-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.screener-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
}
.screener-toggle.active {
  background: rgba(59,130,246,0.15);
  color: var(--accent);
}
.screener-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin: 4px 0 10px;
}
.screener-add-row { margin-bottom: 8px; }
.screener-col-select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.screener-col-select:focus { border-color: var(--accent); }
.screener-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.screener-filter-row:last-child { border-bottom: none; }
.screener-filter-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 140px;
  flex-shrink: 0;
}
.screener-range-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}
.screener-input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 3px;
  width: 100px;
  outline: none;
}
.screener-input:focus { border-color: var(--accent); }
.screener-range-to { color: var(--text-muted); font-size: 11px; }
.screener-remove-filter {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.screener-remove-filter:hover { color: var(--red); background: var(--red-dim); }
.screener-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  max-height: 120px;
  overflow-y: auto;
}
.screener-checkbox-label {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.screener-checkbox { accent-color: var(--accent); }
.screener-active-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.screener-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(59,130,246,0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 12px;
  white-space: nowrap;
}
.pill-close {
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.pill-close:hover { opacity: 1; }
.screener-clear-all {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.screener-clear-all:hover { color: var(--red); }
.screener-results-count {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.screener-hidden { display: none !important; }
.screener-highlight td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ===== ALERTS ===== */
.alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 4px;
}
.alerts-section { padding: 16px; }
.alerts-description {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 16px;
  line-height: 1.5;
}
.alerts-active {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.alerts-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 12px;
}
.alert-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
}
.alert-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.alert-card-ticker {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}
.alert-card-current {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}
.alert-card-condition {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.alert-card-condition strong { color: var(--text-primary); }
.alert-card-actions { display: flex; justify-content: flex-end; }
.alert-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.alert-delete-btn:hover { color: var(--red); background: var(--red-dim); }

.alert-modal .alert-form { display: flex; flex-direction: column; gap: 12px; }
.alert-modal .alert-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.alert-input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 4px;
  outline: none;
  width: 100%;
}
.alert-input:focus { border-color: var(--accent); }
.alert-value-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.alert-value-unit {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
  width: 16px;
  flex-shrink: 0;
}
.alert-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
.alert-submit:hover { background: var(--accent-dim); }

.alerts-history-section { margin-top: 24px; }
.alerts-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.alert-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
}
.alert-unseen { background: rgba(59,130,246,0.05); }
.alert-history-ticker {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  min-width: 50px;
}
.alert-history-msg { color: var(--text-secondary); flex: 1; }
.alert-history-time { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }

.alert-toast {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: 9999;
  background: var(--bg-surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 260px;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transform: translateX(120%);
  transition: transform 0.3s ease;
}
.alert-toast.show { transform: translateX(0); }
.alert-toast-header {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 4px;
}
.alert-toast-msg { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }

/* ===== EXPORT ===== */
.export-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  position: relative;
}
.export-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 200px;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden;
}
.export-dropdown-item {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.export-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.export-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

/* ===== PERFORMANCE VIZ ===== */
.perfviz-section { padding: 16px; margin-top: 8px; }
.perfviz-controls {
  display: flex;
  gap: 8px;
}
.perfviz-select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.perfviz-select:focus { border-color: var(--accent); }
.perfviz-container {
  margin-top: 12px;
  min-height: 200px;
}
.perfviz-loading {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Heatmap */
.heatmap-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.heatmap-group { }
.heatmap-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  padding-left: 2px;
}
.heatmap-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.heatmap-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  height: 50px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  padding: 2px 6px;
  flex: 0 0 auto;
}
.heatmap-tile:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 2;
}
.heatmap-ticker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.heatmap-perf {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  opacity: 0.9;
}
.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 0;
}
.heatmap-legend-label {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.heatmap-legend-bar {
  width: 200px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, rgb(180,40,40), rgb(80,30,30), rgb(30,30,30), rgb(20,80,40), rgb(34,197,94));
}

/* Scatter */
.scatter-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 6px 0;
}
.scatter-legend-item {
  font-size: 11px;
  color: var(--text-muted);
}
.perfviz-container canvas {
  border-radius: 6px;
  display: block;
  margin: 0 auto;
  max-width: 100%;
}

/* Ghost button variant */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

/* Mobile responsive adjustments for new features */
@media (max-width: 768px) {
  .screener-filter-label { min-width: 100px; font-size: 11px; }
  .screener-input { width: 75px; }
  .heatmap-tile { min-width: 50px; height: 42px; }
  .heatmap-ticker { font-size: 9px; }
  .heatmap-perf { font-size: 9px; }
  .alerts-active { grid-template-columns: 1fr; }
  .export-dropdown { right: -8px; }
}
