/* ============================================================
   Investment Research — refined dark design system
   Purple-forward, layered depth, stronger type hierarchy.
   ============================================================ */
:root {
  /* base + elevation */
  --bg: #0b0e15;
  --bg-grad:
    radial-gradient(1100px 520px at 88% -12%, rgba(138, 108, 255, 0.10) 0%, transparent 58%),
    radial-gradient(900px 500px at 4% 4%, rgba(91, 140, 255, 0.06) 0%, transparent 60%);
  --surface: #141a25;
  --surface-2: #1b2230;
  --surface-3: #242d3e;
  --line: #232c3c;
  --line-soft: #1a2230;

  /* text */
  --text: #eef1f9;
  --muted: #9aa6bd;
  --faint: #69748c;

  /* accent — purple is the hero, blue is its companion */
  --accent: #8a6cff;
  --accent-600: #785bf5;
  --accent-700: #6244df;
  --accent-2: #5b8cff;
  --accent-soft: rgba(138, 108, 255, 0.14);
  --accent-line: rgba(138, 108, 255, 0.38);
  --accent-glow: rgba(138, 108, 255, 0.40);
  --grad-hero: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  --grad-btn: linear-gradient(180deg, var(--accent) 0%, var(--accent-700) 100%);

  /* signals */
  --buy: #41e08a;
  --hold: #f5c451;
  --sell: #ff6b6b;
  --buy-soft: rgba(65, 224, 138, 0.13);
  --hold-soft: rgba(245, 196, 81, 0.13);
  --sell-soft: rgba(255, 107, 107, 0.13);

  /* radii */
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;

  /* elevation */
  --ring: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30), var(--ring);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.46), var(--ring);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55), var(--ring);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- type scale ---------- */
h1 { font-size: 19px; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.015em; }
h3 {
  font-size: 11.5px; margin: 22px 0 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted);
}
h4 { font-weight: 650; }
code { background: var(--surface-2); padding: 1.5px 6px; border-radius: 5px; font-size: 12px; font-family: var(--mono); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.pos { color: var(--buy); } .neg { color: var(--sell); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11, 14, 21, 0.78);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding: 14px 26px;
}
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h1 { display: inline-flex; align-items: center; }
h1::before {
  content: "◆"; color: var(--accent); margin-right: 9px; font-size: 16px;
  text-shadow: 0 0 16px var(--accent-glow);
}
.status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.disclaimer { color: var(--faint); font-size: 10.5px; margin: 8px 0 0; line-height: 1.55; max-width: 1100px; }

.pill {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; font-size: 12px; font-weight: 550; color: var(--muted);
}
.pill.on { color: var(--buy); border-color: rgba(65, 224, 138, 0.42); background: var(--buy-soft); }
.pill.off { color: var(--faint); }

button {
  background: var(--grad-btn);
  color: #fff; border: none; border-radius: var(--r-sm);
  padding: 9px 16px; font-size: 13px; cursor: pointer; font-weight: 600; letter-spacing: 0.01em;
  transition: transform 0.06s ease, filter 0.16s ease, box-shadow 0.16s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 4px 14px rgba(138, 108, 255, 0.30);
}
button:hover { filter: brightness(1.07); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 6px 20px var(--accent-glow); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: default; box-shadow: none; filter: saturate(0.7); }
.logout { color: var(--muted); text-decoration: none; font-size: 13px; margin-left: 2px; padding: 5px 9px; border-radius: 7px; transition: background 0.15s ease, color 0.15s ease; }
.logout:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line);
  background: rgba(15, 19, 29, 0.55); overflow-x: auto;
  position: sticky; top: 55px; z-index: 30; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  position: relative;
  background: transparent; color: var(--muted); border-radius: 0;
  padding: 14px 16px; font-weight: 600; font-size: 13px; white-space: nowrap;
  box-shadow: none; border-bottom: 2px solid transparent;
  transition: color 0.15s ease;
}
.tab:hover { color: var(--text); filter: none; box-shadow: none; transform: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); background: transparent; }
.tab.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px 2px 0 0; box-shadow: 0 0 12px var(--accent-glow);
}

main { padding: 26px 26px 80px; max-width: 1360px; margin: 0 auto; }
.tab-panel { display: none; animation: fade 0.24s ease; }
.tab-panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- filters / inputs ---------- */
.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
input, select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 13px; font-size: 13px; outline: none; font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
input:hover, select:hover { border-color: var(--surface-3); }
input { min-width: 240px; }

/* ---------- tables ---------- */
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.asset-table { display: block; max-height: calc(100vh - 250px); overflow-y: auto; }
.asset-table thead th { position: sticky; top: 0; z-index: 1; }
thead th {
  background: var(--surface-2); color: var(--faint); font-weight: 700; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.07em; text-align: left; padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
tbody tr { transition: background 0.12s ease, box-shadow 0.12s ease; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); cursor: pointer; box-shadow: inset 2px 0 0 var(--accent); }
table tr td:first-child, table tr th:first-child { padding-left: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: currentColor; }
.badge.buy { background: var(--buy-soft); color: var(--buy); box-shadow: inset 0 0 0 1px rgba(65, 224, 138, 0.22); }
.badge.hold { background: var(--hold-soft); color: var(--hold); box-shadow: inset 0 0 0 1px rgba(245, 196, 81, 0.22); }
.badge.sell { background: var(--sell-soft); color: var(--sell); box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.22); }
.src { font-size: 11px; color: var(--faint); }

.scorebar { background: var(--surface-3); border-radius: 6px; height: 6px; width: 66px; overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 7px; }
.scorebar > span { display: block; height: 100%; background: var(--grad-hero); border-radius: 6px; box-shadow: 0 0 10px var(--accent-glow); }

.empty { color: var(--muted); padding: 52px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-md); }

/* ---------- layout helpers ---------- */
.two-col { display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 10px; max-width: 380px; }

.summary { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.summary > div {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 17px 22px; min-width: 132px; flex: 1;
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.summary > div::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: var(--grad-hero); opacity: 0.55;
}
.summary .k { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 650; }
.summary .v { font-size: 25px; font-weight: 750; margin-top: 5px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.alloc-row { display: flex; align-items: center; gap: 12px; margin: 9px 0; }
.alloc-row .label { width: 110px; color: var(--muted); font-size: 13px; }
.alloc-bar { flex: 1; background: var(--surface-3); border-radius: 7px; height: 16px; overflow: hidden; }
.alloc-bar > span { display: block; height: 100%; background: var(--grad-hero); }

/* ---------- detail drawer ---------- */
.drawer { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); display: flex; justify-content: flex-end; z-index: 50; animation: fade 0.18s ease; }
.drawer-inner {
  width: min(680px, 95vw); background: var(--surface); height: 100%; overflow-y: auto;
  padding: 30px 32px; border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: slideIn 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes slideIn { from { transform: translateX(28px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.close { position: absolute; top: 18px; right: 22px; background: transparent; color: var(--muted); font-size: 26px; padding: 0 8px; box-shadow: none; line-height: 1; }
.close:hover { color: var(--text); filter: none; box-shadow: none; }
.factor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; margin: 14px 0; }
.factor { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.factor b { font-variant-numeric: tabular-nums; }
.risk { color: var(--muted); margin: 4px 0; }
.view-box { background: var(--surface-2); border-radius: var(--r-sm); padding: 14px 16px; margin: 10px 0; border: 1px solid var(--line); }
.view-box h4 { margin: 0 0 6px; font-size: 10.5px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- auth ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 38px; width: min(404px, 92vw); box-shadow: var(--shadow-lg); }
.auth-card h1 { margin-bottom: 6px; font-size: 21px; }
.auth-tabs { display: flex; gap: 7px; margin: 22px 0 18px; }
.auth-tab { background: var(--surface-2); color: var(--muted); flex: 1; box-shadow: none; font-weight: 600; }
.auth-tab:hover { color: var(--text); filter: none; box-shadow: none; }
.auth-tab.active { background: var(--grad-btn); color: #fff; box-shadow: 0 4px 14px rgba(138, 108, 255, 0.30); }
.auth-form { display: none; flex-direction: column; gap: 12px; }
.auth-form.active { display: flex; }
.auth-form input { width: 100%; }
.auth-error { background: var(--sell-soft); color: var(--sell); padding: 11px 14px; border-radius: var(--r-sm); font-size: 13px; box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.25); }

/* ---------- markdown blocks ---------- */
.markdown { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 22px 26px; line-height: 1.72; box-shadow: var(--shadow-sm); }
.markdown.empty { color: var(--muted); border-style: dashed; box-shadow: none; }
.markdown h1, .markdown h2, .markdown h3 { margin: 20px 0 9px; color: var(--text); text-transform: none; letter-spacing: -0.01em; }
.markdown h3 { font-size: 15px; }
.markdown ul { padding-left: 22px; }
.markdown li { margin: 4px 0; }
.markdown code { background: var(--surface-2); }
.markdown table { margin: 14px 0; box-shadow: none; }
.markdown a { color: var(--accent); }

/* ---------- chat widget ---------- */
#chat-fab { position: fixed; bottom: 26px; right: 26px; z-index: 60; border-radius: 999px; padding: 13px 22px; box-shadow: 0 8px 26px var(--accent-glow); font-weight: 650; background: var(--grad-hero); }
#chat-panel { position: fixed; bottom: 86px; right: 26px; width: min(394px, 92vw); height: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; z-index: 60; overflow: hidden; box-shadow: var(--shadow-lg); }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 17px; border-bottom: 1px solid var(--line); font-weight: 650; }
.chat-head .close { position: static; }
.chat-log { flex: 1; overflow-y: auto; padding: 17px; display: flex; flex-direction: column; gap: 11px; }
.chat-msg { padding: 11px 14px; border-radius: 13px; max-width: 86%; font-size: 13px; line-height: 1.58; }
.chat-msg.user { background: var(--grad-btn); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-msg.bot { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid var(--line); }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; min-width: 0; }

/* ---------- advisor / multi-agent panel ---------- */
.advisor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.advisor-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
#advisor-btn { background: var(--grad-hero); }
.review-banner { border-radius: var(--r-md); padding: 14px 18px; margin-bottom: 18px; font-size: 13px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.review-banner.ok { background: var(--buy-soft); border-color: rgba(65, 224, 138, 0.36); }
.review-banner.warn { background: var(--hold-soft); border-color: rgba(245, 196, 81, 0.36); }
.review-banner ul { margin: 6px 0 0; padding-left: 18px; }
.agent-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 10px; }
@media (max-width: 1000px) { .agent-grid { grid-template-columns: 1fr; } }
.agent-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; box-shadow: var(--shadow-sm); transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease; }
.agent-card:hover { border-color: var(--accent-line); transform: translateY(-3px); box-shadow: var(--shadow); }
.agent-name { font-weight: 700; font-size: 14px; padding-bottom: 11px; margin-bottom: 7px; border-bottom: 1px solid var(--line); color: var(--accent); }
.agent-skill { font-size: 11px; color: var(--faint); margin: 0 0 8px; }
.agent-sec { margin-top: 13px; }
.agent-sec h4 { margin: 0 0 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.agent-card .markdown { background: transparent; border: none; padding: 0; font-size: 13px; line-height: 1.62; box-shadow: none; }

/* ---------- skills ---------- */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 15px; margin-top: 15px; }
.skill-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 19px; box-shadow: var(--shadow-sm); transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease; }
.skill-card:hover { border-color: var(--accent-line); transform: translateY(-3px); box-shadow: var(--shadow); }
.skill-name { font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.skill-desc { font-size: 13px; line-height: 1.58; margin-bottom: 12px; }
.skill-used { font-size: 12px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 10px; }

/* ---------- feeds ---------- */
.feed-src { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 7px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.feed-src.reddit { background: rgba(255, 69, 0, 0.14); color: #ff8a5c; }
.feed-src.news { background: var(--accent-soft); color: var(--accent); }
.feed-row { padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; line-height: 1.55; }
.feed-row a, #feeds-table a { color: var(--text); text-decoration: none; }
.feed-row a:hover, #feeds-table a:hover { color: var(--accent); text-decoration: none; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #2c3850; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a4a68; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- stats / overview ---------- */
.stats-charts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 6px 0 26px; }
@media (max-width: 900px) { .stats-charts { grid-template-columns: 1fr; } }
.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--shadow-sm); transition: border-color 0.16s ease; }
.chart-box:hover { border-color: var(--accent-line); }
.chart-box h3 { margin: 0 0 14px; }
.chart-box h3 .muted { font-weight: 500; font-size: 11px; letter-spacing: 0.02em; text-transform: none; }
#tab-stats .two-col table { margin-top: 4px; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lb-head h3 { margin: 0; }
.factor-pick { width: auto; padding: 7px 11px; font-size: 13px; }
.po-flag { color: var(--hold); font-weight: 700; cursor: help; }
.price-only-note { color: var(--hold); font-size: 12px; margin: 6px 0 2px; line-height: 1.5; }

/* ---------- invest (simulated auto-portfolios) ---------- */
.invest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .invest-grid { grid-template-columns: 1fr; } }
.invest-card .lb-head { margin-bottom: 4px; }
.invest-card .lb-head h3 .src { font-weight: 500; text-transform: none; letter-spacing: 0; }
.invest-stats { font-size: 12.5px; color: var(--muted); margin: 8px 0 12px; line-height: 1.6; }
.invest-card table { box-shadow: none; margin-top: 12px; }
.invest-card canvas { margin: 6px 0 4px; }
/* sleeve exposure */
.expo { margin: 4px 0 12px; }
.expo-bar { display: flex; height: 9px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.expo-seg { height: 100%; }
.expo-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 7px; }
.expo-leg { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.expo-leg i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.expo-sectors { font-size: 12px; color: var(--muted); margin-top: 7px; line-height: 1.6; }
.expo-flag { font-size: 12px; color: var(--hold); margin-top: 5px; }

/* ---------- india press links ---------- */
.press-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.press-link {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 13px; font-size: 12.5px; font-weight: 550; color: var(--text); text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.press-link::before { content: "📰"; font-size: 11px; }
.press-link:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); text-decoration: none; }

/* ---------- light theme ---------- */
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-grad:
    radial-gradient(1100px 520px at 88% -12%, rgba(138, 108, 255, 0.10) 0%, transparent 58%),
    radial-gradient(900px 500px at 4% 4%, rgba(91, 140, 255, 0.07) 0%, transparent 60%);
  --surface: #ffffff;
  --surface-2: #f1f4fa;
  --surface-3: #e4e9f3;
  --line: #e2e7f1;
  --line-soft: #eef1f8;
  --text: #131826;
  --muted: #56607a;
  --faint: #8b93a8;
  --accent-soft: rgba(138, 108, 255, 0.12);
  --ring: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, 0.06), var(--ring);
  --shadow: 0 10px 34px rgba(20, 30, 60, 0.12), var(--ring);
  --shadow-lg: 0 24px 60px rgba(20, 30, 60, 0.16), var(--ring);
}
:root[data-theme="light"] header { background: rgba(244, 246, 251, 0.82); }
:root[data-theme="light"] .tabs { background: rgba(241, 244, 250, 0.65); }
:root[data-theme="light"] tbody tr:hover { background: var(--surface-2); }
:root[data-theme="light"] thead th { color: #5b6478; }  /* lift header contrast on light bg */
:root[data-theme="light"] .feed-src.news { color: var(--accent-700); }
#theme-btn, #pw-btn { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); box-shadow: none; padding: 7px 12px; }
#theme-btn:hover, #pw-btn:hover { color: var(--text); filter: none; box-shadow: none; background: var(--surface-3); }

/* ---------- modal (change password) ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 70; animation: fade 0.15s ease; }
.modal-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 30px; width: min(384px, 92vw); box-shadow: var(--shadow-lg); }
.modal-card h2 { margin: 0; }
.modal-card .close { top: 12px; right: 16px; }
.modal-card .auth-form input { width: 100%; }

/* ---------- responsive / mobile (family on phones) ---------- */
@media (max-width: 680px) {
  header { padding: 12px 15px; }
  h1 { font-size: 16px; }
  .bar { gap: 8px; }
  .status { gap: 7px; }
  .status #refresh-info, header .disclaimer { display: none; }  /* declutter; footer keeps disclaimer */
  .tabs { top: 49px; padding: 0 10px; }
  .tab { padding: 13px 12px; font-size: 12px; }
  main { padding: 18px 13px 64px; }
  .asset-table { max-height: none; overflow-x: auto; }
  table { font-size: 12px; }
  thead th, td { padding: 10px 10px; }
  table tr td:first-child, table tr th:first-child { padding-left: 13px; }
  .summary > div { min-width: 44%; padding: 13px 15px; }
  .summary .v { font-size: 20px; }
  .stats-charts { gap: 13px; }
  #chat-panel { width: 100vw; right: 0; left: 0; bottom: 0; height: 76vh; border-radius: 18px 18px 0 0; }
  #chat-fab { bottom: 16px; right: 16px; }
  .drawer-inner { width: 100vw; padding: 22px 17px; }
  .agent-grid, .skill-grid { gap: 13px; }
}
@media (max-width: 420px) {
  .summary > div { min-width: 100%; }
}
