/* ══ CARLYLE CORPORATE THEME ════════════════════════════════════
   Light, minimal, institutional. Matches Carlyle PE deck aesthetic.
   Font: Calibri/Helvetica Neue feel via Inter
   ════════════════════════════════════════════════════════════════ */

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

:root {
  /* Exact Carlyle RGB palette */
  --c-dark-blue: rgb(22,32,64);
  --c-sky-blue: rgb(149,218,255);
  --c-indigo: rgb(49,71,143);
  --c-light-indigo: rgb(176,188,228);
  --c-green: rgb(57,108,101);
  --c-light-green: rgb(216,240,221);
  --c-brown: rgb(98,70,60);
  --c-taupe: rgb(209,199,189);
  --c-dark-gray: rgb(101,101,101);
  --c-light-gray: rgb(230,230,230);
  --c-pale-blue: rgb(221,244,255);
  --c-salmon: rgb(240,196,188);
  --c-champagne: rgb(251,246,237);
  --c-plum: rgb(117,45,79);

  /* UI mapping - LIGHT mode */
  --bg: #FAFBFC;
  --bg2: #F4F5F7;
  --card: #FFFFFF;
  --card2: #F8F9FB;
  --border: #E2E6EC;
  --border-light: #D0D6E0;
  --text: rgb(22,32,64);
  --text-dim: rgb(101,101,101);
  --text-muted: rgb(140,148,165);
  --accent: rgb(49,71,143);
  --accent2: rgb(57,108,101);
  --danger: rgb(180,50,50);
  --warning: rgb(180,130,40);
  --success: rgb(57,108,101);
}

/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Calibri', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* ── Header ──────────────────────────────────────────────────── */
.header {
  background: var(--c-dark-blue);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-brand { display: flex; align-items: center; gap: 16px; }
.logo-group { display: flex; align-items: baseline; gap: 12px; }
.logo { font-size: 17px; font-weight: 600; color: #fff; letter-spacing: 0.5px; }
.logo-icon { color: var(--c-sky-blue); }
.subtitle { font-size: 10px; color: var(--c-light-indigo); letter-spacing: 1.5px; text-transform: uppercase; font-weight: 500; }
.header-right { display: flex; align-items: center; gap: 16px; }
#clock { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--c-light-indigo); }

/* ── Ticker ──────────────────────────────────────────────────── */
.ticker {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 5px 32px;
  overflow: hidden;
  white-space: nowrap;
}
.ticker-scroll { font-size: 11px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

/* ── Navigation ──────────────────────────────────────────────── */
.nav-tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  overflow-x: auto;
  gap: 0;
}
.nav-tab {
  padding: 11px 18px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.nav-tab:hover { color: var(--text); background: var(--bg2); }
.nav-tab.active {
  color: var(--c-dark-blue);
  font-weight: 600;
  border-bottom-color: var(--c-indigo);
}

/* ── Main ────────────────────────────────────────────────────── */
.main { padding: 20px 32px; max-width: 1600px; margin: 0 auto; }
.tab-pane { display: none; animation: fadeIn 0.15s ease-out; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card2);
}
.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-dark-blue);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── Stats Grid ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 18px;
  transition: all 0.15s;
  border-top: 3px solid var(--c-indigo);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.stat-card.clickable { cursor: pointer; }
.stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--c-dark-blue); font-family: 'JetBrains Mono', monospace; }
.stat-sub { font-size: 10px; color: var(--text-muted); margin-top: 3px; }

/* ── Grid ────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── Tables ──────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--card2);
  position: sticky;
  top: 0;
  z-index: 2;
}
td {
  padding: 7px 12px;
  border-bottom: 1px solid #F0F2F5;
  vertical-align: middle;
  color: var(--text);
}
tr:hover { background: rgba(49,71,143,0.03); }
tr:nth-child(even) { background: #FAFBFD; }
.table-wrap { overflow: auto; }
.sticky-head th { position: sticky; top: 0; z-index: 2; }
.sticky-col { position: sticky; left: 0; background: var(--card); z-index: 1; }

/* ── Rate Colors ─────────────────────────────────────────────── */
.rate-high { color: var(--c-green); font-weight: 700; }
.rate-med { color: var(--c-indigo); font-weight: 600; }
.rate-low { color: var(--text-dim); }

/* Numbers */
.rate-high, .rate-med, .rate-low, .stat-value, td[style*="tabular-nums"] {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.badge-blue { background: var(--c-pale-blue); color: var(--c-indigo); }
.badge-green { background: var(--c-light-green); color: var(--c-green); }
.badge-purple { background: rgba(117,45,79,0.1); color: var(--c-plum); }
.badge-orange { background: var(--c-champagne); color: var(--c-brown); }
.badge-cyan { background: var(--c-pale-blue); color: var(--c-green); }
.badge-yellow { background: var(--c-champagne); color: rgb(140,100,20); }
.badge-gray { background: #F0F2F5; color: var(--c-dark-gray); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-dim);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg2); color: var(--text); border-color: var(--border-light); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-green { border-color: var(--c-green); color: var(--c-green); }
.btn-green:hover { background: var(--c-light-green); }

/* ── Filter Bars ─────────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px;
}
.filter-bar input, .filter-bar select {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
}
.filter-bar input:focus, .filter-bar select:focus {
  outline: none;
  border-color: var(--c-indigo);
  box-shadow: 0 0 0 2px rgba(49,71,143,0.1);
}

/* ── News ────────────────────────────────────────────────────── */
.news-item { padding: 10px 16px; border-bottom: 1px solid #F0F2F5; }
.news-item:hover { background: #FAFBFD; }
.news-headline { font-size: 12px; color: var(--text); margin-bottom: 3px; }
.news-headline a { color: var(--c-indigo); text-decoration: none; }
.news-headline a:hover { text-decoration: underline; }
.news-meta { font-size: 10px; color: var(--text-muted); }
.news-source { color: var(--c-green); font-weight: 500; }

/* ── Loading ─────────────────────────────────────────────────── */
.loading { color: var(--text-muted); text-align: center; padding: 24px; font-size: 12px; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  background: var(--c-dark-blue);
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--c-light-indigo);
}
.footer-brand { color: var(--c-sky-blue); font-weight: 600; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Tab Toolbar ─────────────────────────────────────────────── */
.tab-toolbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; margin-bottom: 14px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 4px; font-size: 11px;
}
.source-line { color: var(--text-muted); font-size: 11px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.toolbar-actions .btn { font-size: 11px; padding: 4px 10px; }

/* ── Detail Panel ────────────────────────────────────────────── */
.detail-panel {
  position: fixed; top: 0; right: -500px; width: 500px; height: 100vh;
  background: #fff; border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0,0,0,0.08);
  z-index: 1000; transition: right 0.25s ease;
  display: flex; flex-direction: column; overflow: hidden;
}
.detail-panel.open { right: 0; }
.detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: var(--c-dark-blue);
}
.detail-title { font-size: 15px; font-weight: 600; color: #fff; }
.detail-close {
  background: none; border: 1px solid rgba(255,255,255,0.2); color: #fff;
  width: 28px; height: 28px; border-radius: 4px; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.detail-close:hover { background: rgba(255,255,255,0.1); }
.detail-body { flex: 1; overflow-y: auto; padding: 20px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.detail-table th { text-align: left; padding: 6px 8px; color: var(--text-muted); border-bottom: 2px solid var(--border); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-table td { padding: 6px 8px; border-bottom: 1px solid #F0F2F5; }
.detail-table tr:hover { background: #FAFBFD; }
.detail-stat { background: var(--bg2); border-radius: 4px; padding: 12px; border: 1px solid var(--border); }
.detail-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.detail-stat-value { font-size: 14px; font-weight: 600; color: var(--text); }

/* ── Clickable ───────────────────────────────────────────────── */
.clickable-row { cursor: pointer; transition: background 0.15s; }
.clickable-row:hover { background: rgba(49,71,143,0.04) !important; }
.link-text { color: var(--c-indigo); cursor: pointer; transition: color 0.15s; }
.link-text:hover { color: var(--c-dark-blue); text-decoration: underline; }

.detail-panel.open::before {
  content: ""; position: fixed; top: 0; left: 0; right: 500px; bottom: 0;
  background: rgba(22,32,64,0.15); z-index: -1;
}

@media (max-width: 600px) {
  .detail-panel { width: 100vw; right: -100vw; }
  .detail-panel.open::before { right: 0; }
  .header { padding: 10px 16px; }
  .main { padding: 12px 16px; }
  .nav-tabs { padding: 0 12px; }
}

/* ── Pricing Sub-tabs ───────────────────────────────────────── */
.sub-tab-bar { display:flex; gap:4px; padding:0 0 12px 0; border-bottom:1px solid var(--border); margin-bottom:16px; flex-wrap:wrap; }
.sub-tab { padding:5px 14px; border-radius:20px; font-size:12px; font-weight:500; cursor:pointer; color:var(--text-dim); background:var(--card2); transition:all 0.15s; border:1px solid transparent; }
.sub-tab:hover { color:var(--text); border-color:var(--border); }
.sub-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.modal-content {
  background: var(--card, #1a2332); border: 1px solid var(--border, #2a3a55);
  border-radius: 10px; padding: 28px; max-width: 700px; width: 90%;
  max-height: 80vh; overflow-y: auto; position: relative;
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; font-size: 20px;
  color: var(--text-dim, #8899aa); cursor: pointer;
}
.modal-close:hover { color: #fff; }

/* ══ App Shell — Sidebar Layout ══════════════════════════════════ */
body { margin: 0; overflow: hidden; }

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: #0d1117;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
  flex-shrink: 0;
}

.sidebar.collapsed { width: 52px; min-width: 52px; }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .sidebar-logo-text { display: none; }
.sidebar.collapsed .nav-item[data-tab] { justify-content: center; padding: 9px 0; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  white-space: nowrap;
}

.logo-icon { font-size: 18px; }

.sidebar-toggle {
  background: none;
  border: none;
  color: #8b949e;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: #21262d; color: #c9d1d9; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  color: #6e7681;
  padding: 12px 14px 3px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item[data-tab] {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  margin: 1px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: #8b949e;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  overflow: hidden;
}
.nav-item[data-tab]:hover { background: #21262d; color: #c9d1d9; }
.nav-item[data-tab].active { background: rgba(88,166,255,0.15); color: #58a6ff; }

.nav-icon { font-size: 15px; min-width: 18px; text-align: center; flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer-nav {
  border-top: 1px solid var(--border);
  padding: 6px 0;
  flex-shrink: 0;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  background: #161b22;
  border-bottom: 1px solid var(--border);
  height: 36px;
  flex-shrink: 0;
  overflow: hidden;
}

.topbar .ticker-bar {
  flex: 1;
  overflow: hidden;
  padding: 0;
  border: none;
  background: none;
  height: 100%;
  display: flex;
  align-items: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-size: 12px;
  color: #8b949e;
  white-space: nowrap;
  flex-shrink: 0;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg);
}

/* Sub-tabs inside modules */
.sub-tab-bar {
  display: flex;
  gap: 4px;
  padding: 0 0 14px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.sub-tab {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-dim);
  background: var(--card2);
  transition: all 0.15s;
  border: none;
  white-space: nowrap;
}
.sub-tab:hover { color: var(--text); background: var(--border); }
.sub-tab.active { background: #58a6ff; color: #fff; }

/* Live indicator in topbar */
.live-indicator { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: #3fb950; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #3fb950; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.4; } }
.header-sep { color: #30363d; }

/* Ticker scroll inside topbar */
.topbar .ticker-scroll {
  font-size: 11px;
  color: #8b949e;
  font-family: 'JetBrains Mono', monospace;
  padding-left: 12px;
  white-space: nowrap;
}

/* ── Stat card animation ── */
.stat-card .stat-value {
  transition: color 0.3s ease;
}
.stat-card.stat-updating .stat-value {
  color: var(--accent, #58a6ff);
}

/* ── Click-in animations ── */
@keyframes rowSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardPop {
  0%   { opacity: 0; transform: scale(0.97) translateY(6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.table-animate tr {
  animation: rowSlideIn 0.25s ease both;
}
.table-animate tr:nth-child(1)  { animation-delay: 0.02s; }
.table-animate tr:nth-child(2)  { animation-delay: 0.05s; }
.table-animate tr:nth-child(3)  { animation-delay: 0.08s; }
.table-animate tr:nth-child(4)  { animation-delay: 0.11s; }
.table-animate tr:nth-child(5)  { animation-delay: 0.14s; }
.table-animate tr:nth-child(6)  { animation-delay: 0.17s; }
.table-animate tr:nth-child(7)  { animation-delay: 0.20s; }
.table-animate tr:nth-child(8)  { animation-delay: 0.22s; }
.table-animate tr:nth-child(9)  { animation-delay: 0.24s; }
.table-animate tr:nth-child(n+10) { animation-delay: 0.26s; }

.card-animate {
  animation: cardPop 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}

.chart-wrap-animate {
  animation: fadeUp 0.4s ease both;
}

/* ── Source popover ─────────────────────────────────────────────────────── */
.src-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: rgba(49,71,143,0.08);
  color: var(--c-indigo);
  font-size: 8px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 3px;
  vertical-align: middle;
  transition: all 0.15s;
  font-family: 'JetBrains Mono', monospace;
  user-select: none;
  flex-shrink: 0;
}
.src-icon:hover {
  background: rgba(49,71,143,0.18);
  transform: scale(1.12);
}
.src-popover {
  position: fixed;
  z-index: 2000;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 12px 16px;
  max-width: 380px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text);
  display: none;
  pointer-events: auto;
}
.src-popover.active { display: block; }
.src-popover .src-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.src-popover .src-text { color: var(--text-dim); margin-bottom: 6px; }
.src-popover .src-link { color: var(--c-indigo); text-decoration: none; font-size: 11px; }
.src-popover .src-link:hover { text-decoration: underline; }
.src-popover .src-date { color: var(--text-muted); font-size: 10px; margin-top: 4px; }

/* ── Mobile Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  
  .sidebar {
    position: fixed;
    top: 0; left: -280px;
    width: 280px; min-width: 280px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.25s ease;
  }
  .sidebar.mobile-open { left: 0; }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  .sidebar-overlay.active { display: block; }
  
  .main-area { width: 100%; }
  
  .topbar {
    padding-left: 8px;
  }
  
  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 18px;
    cursor: pointer;
    margin-right: 8px;
    flex-shrink: 0;
  }
  .mobile-menu-btn:hover { background: var(--card2); }
  
  .content-area { padding: 10px; }
  
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
  
  .table-wrap { font-size: 11px; }
  .table-wrap th, .table-wrap td { padding: 4px 6px; }
  
  .tab-toolbar { flex-wrap: wrap; gap: 6px; }
  .source-line { max-width: 100%; }
}

@media (min-width: 769px) {
  .mobile-menu-btn { display: none !important; }
  .sidebar-overlay { display: none !important; }
}

/* ── Source Citation Panel ───────────────────────────────────── */
.source-panel {
  position: fixed;
  top: 0; right: -360px;
  width: 360px; height: 100vh;
  background: #0d1117;
  border-left: 1px solid var(--border);
  z-index: 1001;
  transition: left 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.4);
}
.source-panel.open { right: 0; }
.source-panel-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
}
.source-panel-overlay.active { display: block; }
.source-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.source-panel-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  letter-spacing: 0.5px; text-transform: uppercase;
}
.source-panel-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 22px; cursor: pointer; padding: 0 4px;
}
.source-panel-close:hover { color: #fff; }
.source-panel-body {
  flex: 1; overflow-y: auto; padding: 0;
}
.source-section {
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}
.source-section-title {
  font-size: 10px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 8px;
}
.source-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 4px 0; font-size: 11px; line-height: 1.5;
}
.source-item .source-num {
  color: var(--text-dim); font-weight: 700; font-size: 10px;
  min-width: 18px; flex-shrink: 0; padding-top: 1px;
}
.source-item .source-text {
  color: var(--text-muted);
}
.source-item .source-text strong {
  color: var(--text); font-weight: 600;
}
.source-btn {
  position: fixed;
  bottom: 20px; right: 20px;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 16px;
  cursor: pointer;
  z-index: 998;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.source-btn:hover { transform: scale(1.1); }
@media (max-width: 768px) {
  .source-panel { width: 100vw; right: -100vw; }
  .source-btn { bottom: 14px; right: 14px; height: 28px; padding: 0 10px; font-size: 10px; }
}
