:root {
  color-scheme: dark;
  --bg: #070b12;
  --bg-soft: #0b111c;
  --sidebar: #08140f;
  --surface: #101824;
  --surface-2: #151f2e;
  --surface-3: #1b2738;
  --ink: #eef6ff;
  --muted: #91a1b5;
  --line: #263449;
  --green: #28d17c;
  --green-strong: #7df3b2;
  --red: #ff5f6d;
  --amber: #f4b860;
  --blue: #62a8ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

/* Stock analyzer table intelligence */
.table-analysis {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.08), transparent 42%),
    rgba(11, 18, 32, 0.72);
}

.table-analysis-copy {
  display: grid;
  gap: 7px;
}

.table-analysis-copy span,
.table-kpi-grid span {
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-analysis-copy h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
}

.table-analysis-copy p,
.table-kpi-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.table-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.table-kpi-grid article {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.88);
}

.table-kpi-grid article.good {
  border-color: rgba(16, 185, 129, 0.34);
}

.table-kpi-grid article.warn {
  border-color: rgba(245, 158, 11, 0.38);
}

.table-kpi-grid strong {
  color: var(--text);
  font-size: 1.1rem;
}

.table-visual {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  gap: 9px;
  min-height: 150px;
  padding: 14px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.46);
}

.table-visual div {
  display: grid;
  align-items: end;
  gap: 8px;
  height: 120px;
  min-width: 0;
}

.table-visual span {
  display: block;
  min-height: 8px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #10b981, #3b82f6);
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.16);
}

.table-visual small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 820px) {
  .table-kpi-grid {
    grid-template-columns: 1fr;
  }

  .table-visual {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* DhanLeaf Score product page */
.score-identity {
  gap: 18px;
  padding: 18px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.1), transparent 38%),
    #111827;
}

.score-identity-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
  align-items: stretch;
}

.score-identity-hero > div:first-child,
.score-gauge,
.score-method-card,
.score-band-grid article {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(11, 18, 32, 0.84);
}

.score-identity-hero > div:first-child {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 22px;
}

.score-identity-hero h2 {
  max-width: 860px;
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 1;
}

.score-identity-hero p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.score-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.score-actions button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #03110b;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.score-actions .ghost-btn {
  border: 1px solid rgba(59, 130, 246, 0.34);
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
}

.score-gauge {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 22px;
}

.score-gauge span,
.score-band-grid span,
.score-method-card .eyebrow,
.score-weight-list span,
.score-rule-list span {
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-gauge strong {
  color: var(--text);
  font-size: clamp(3.5rem, 7vw, 6rem);
  line-height: 0.9;
}

.score-gauge-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.8), rgba(245, 158, 11, 0.85), rgba(16, 185, 129, 0.9));
}

.score-gauge-track i {
  display: block;
  height: 100%;
  border-right: 3px solid #f9fafb;
}

.score-band-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.score-band-grid article {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.score-band-grid strong {
  color: var(--text);
  font-size: 1.05rem;
}

.score-band-grid p,
.score-rule-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.score-band-grid article.good {
  border-color: rgba(16, 185, 129, 0.34);
}

.score-band-grid article.warn {
  border-color: rgba(245, 158, 11, 0.4);
}

.score-band-grid article.bad {
  border-color: rgba(248, 113, 113, 0.42);
}

.score-method-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 12px;
}

.score-method-card {
  padding: 16px;
}

.score-method-card h3 {
  margin: 6px 0 14px;
  color: var(--text);
  font-size: 1.35rem;
}

.score-weight-list,
.score-rule-list {
  display: grid;
  gap: 10px;
}

.score-weight-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  gap: 9px;
}

.score-weight-list meter {
  grid-column: 1 / -1;
  width: 100%;
  height: 9px;
}

.score-weight-list strong {
  justify-self: end;
  color: var(--text);
}

.score-rule-list article {
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.78);
}

@media (max-width: 1080px) {
  .score-identity-hero,
  .score-method-layout {
    grid-template-columns: 1fr;
  }

  .score-band-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .score-identity {
    padding: 12px;
  }

  .score-identity-hero > div:first-child,
  .score-gauge,
  .score-method-card {
    padding: 14px;
  }

  .score-band-grid {
    grid-template-columns: 1fr;
  }
}

/* Dhanleaf 2.0 product shell */
:root {
  color-scheme: dark;
  --bg: #080c11;
  --bg-soft: #0d131b;
  --sidebar: #0a1117;
  --surface: #101821;
  --surface-2: #141e29;
  --surface-3: #1d2936;
  --ink: #f5f8fb;
  --muted: #9ba9b8;
  --line: #273544;
  --green: #22c55e;
  --green-strong: #86efac;
  --red: #fb7185;
  --amber: #fbbf24;
  --blue: #38bdf8;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.28);
}

body {
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.08), transparent 28%),
    linear-gradient(180deg, #091018 0%, #080c11 48%, #0b1017 100%);
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 20px 16px;
  background: rgba(8, 13, 19, 0.98);
  border-right-color: rgba(255, 255, 255, 0.08);
  gap: 24px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  background: #d9f99d;
  color: #0a140f;
  box-shadow: none;
}

.brand strong {
  font-size: 1.12rem;
}

.brand small {
  color: var(--muted);
}

.nav-list {
  gap: 6px;
}

.nav-list button {
  position: relative;
  min-height: 42px;
  padding: 0 12px 0 16px;
  border-radius: 8px;
  color: #aeb9c6;
  font-size: 0.92rem;
}

.nav-list button::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  border-radius: 999px;
  background: transparent;
}

.nav-list button.active {
  background: #172231;
  color: #ffffff;
}

.nav-list button.active::before {
  background: var(--green-strong);
}

.sidebar-note {
  padding: 14px;
  background: #101820;
  border-color: rgba(255, 255, 255, 0.08);
}

main {
  width: 100%;
  max-width: 1520px;
  padding: 22px;
}

.workspace-header {
  display: grid;
  grid-template-columns: minmax(170px, 0.42fr) minmax(320px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 24, 33, 0.92);
  box-shadow: var(--shadow);
}

.workspace-header h1 {
  font-size: 1.9rem;
  line-height: 1;
}

.global-command {
  display: grid;
  gap: 7px;
}

.global-command label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.global-command div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 8px;
}

.global-command input,
.global-command button {
  min-height: 46px;
}

.global-command button {
  border: 0;
  border-radius: 8px;
  background: #d9f99d;
  color: #0a140f;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.topbar {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(20, 30, 41, 0.96), rgba(12, 19, 27, 0.96));
}

.topbar h2 {
  max-width: 860px;
  font-size: clamp(1.45rem, 2.5vw, 2.55rem);
  line-height: 1.08;
}

.home-grid {
  grid-template-columns: 1.2fr repeat(2, minmax(0, 0.72fr));
  gap: 12px;
}

.home-card {
  min-height: 0;
  padding: 18px;
  background: #121b25;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.home-card-primary {
  grid-row: span 2;
  align-content: end;
  min-height: 390px;
  background:
    linear-gradient(160deg, rgba(217, 249, 157, 0.14), transparent 42%),
    #111a22;
}

.home-card h2 {
  font-size: clamp(1.2rem, 2vw, 2rem);
}

.home-card-primary h2 {
  font-size: clamp(2.2rem, 4vw, 4.7rem);
  line-height: 0.95;
}

.home-action,
.refresh-btn,
.quote-form button,
.quick-quote,
.ai-chat-form button {
  background: #d9f99d;
  color: #0a140f;
  box-shadow: none;
}

.dashboard-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.dashboard-strip article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101821;
}

.dashboard-strip span {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.dashboard-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
}

.dashboard-strip p {
  margin: 6px 0 0;
  color: var(--muted);
}

.quote-search-panel,
.ai-chat-panel,
.feed-panel,
.insight-block,
.financials-panel,
.analyst-panel,
.cfa-workbench,
.ipo-desk,
.score-identity,
.workbench-card,
.sources-view {
  background: rgba(16, 24, 33, 0.94);
  box-shadow: var(--shadow);
}

.quote-card,
.related-card,
.headline-card,
.topic-row,
.source-row,
.score-card,
.score-example,
.score-method-grid article,
.score-breakdown-item,
.ipo-card,
.market-strip article {
  background: #121b25;
  border-color: rgba(255, 255, 255, 0.08);
}

.price-row strong {
  font-size: clamp(1.7rem, 3vw, 2.8rem);
}

.quote-chart {
  background: #080d12;
}

body.ai-chat-mode .workspace-header {
  display: none;
}

@media (max-width: 1080px) {
  .workspace-header {
    grid-template-columns: 1fr;
  }

  .home-grid {
    grid-template-columns: 1fr 1fr;
  }

  .home-card-primary {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 280px;
  }
}

@media (max-width: 700px) {
  .workspace-header,
  .topbar {
    padding: 14px;
  }

  .global-command div,
  .home-grid,
  .dashboard-strip {
    grid-template-columns: 1fr;
  }

  .home-card-primary {
    min-height: 260px;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(40, 209, 124, 0.12), transparent 34rem),
    radial-gradient(circle at top right, rgba(98, 168, 255, 0.12), transparent 32rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px;
  background: linear-gradient(180deg, rgba(8, 20, 15, 0.98), rgba(7, 11, 18, 0.98));
  border-right: 1px solid rgba(125, 243, 178, 0.12);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), #0aa66a);
  color: #03130b;
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(40, 209, 124, 0.24);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.35rem;
}

.brand small {
  margin-top: 2px;
  color: var(--green-strong);
}

.nav-list {
  display: grid;
  gap: 9px;
}

.nav-list button {
  border: 1px solid transparent;
  padding: 12px 13px;
  border-radius: 8px;
  background: transparent;
  color: #cdd8e6;
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.nav-list button.active,
.nav-list button:hover {
  border-color: rgba(125, 243, 178, 0.16);
  background: rgba(125, 243, 178, 0.1);
  color: #ffffff;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(125, 243, 178, 0.18);
  border-radius: 8px;
  background: rgba(125, 243, 178, 0.06);
}

.sidebar-note span,
.sidebar-note strong {
  display: block;
}

.sidebar-note span {
  color: var(--muted);
  font-size: 0.86rem;
}

.sidebar-note strong {
  margin-top: 8px;
  font-size: 1rem;
}

main {
  width: min(1500px, 100%);
  padding: 30px;
}

body.ai-chat-mode main {
  width: 100%;
  padding: 0;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: grid;
}

.topbar.view-panel.active {
  display: flex;
}

.home-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.home-card {
  min-height: 230px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(21, 31, 46, 0.94), rgba(10, 17, 28, 0.94));
  box-shadow: var(--shadow);
}

.home-card h2 {
  font-size: 1.55rem;
  line-height: 1.15;
}

.home-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.home-action {
  min-height: 40px;
  margin-top: 14px;
  padding: 0 14px;
  border: 1px solid rgba(125, 243, 178, 0.2);
  border-radius: 8px;
  background: rgba(40, 209, 124, 0.12);
  color: var(--green-strong);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.score-identity {
  gap: 16px;
  padding: 20px;
}

.score-identity-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: stretch;
}

.score-identity-hero h2 {
  font-size: clamp(2.4rem, 5vw, 5.3rem);
  line-height: 0.95;
}

.score-identity-hero p,
.score-method-grid p,
.score-summary {
  color: var(--muted);
  line-height: 1.45;
}

.score-meter {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
}

.score-meter span,
.score-meter strong,
.score-example span,
.score-example strong,
.score-method-grid span,
.score-method-grid strong {
  display: block;
}

.score-meter span,
.score-method-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-meter strong {
  font-size: 3rem;
  line-height: 1;
}

.score-meter p,
.score-method-grid p,
.score-summary {
  margin: 8px 0 0;
}

.score-meter.good,
.dhanleaf-score-panel.good {
  border-color: rgba(40, 209, 124, 0.38);
}

.score-meter.good strong,
.dhanleaf-score-panel.good h2,
.score-example.good strong,
.score-method-grid strong {
  color: var(--green-strong);
}

.score-meter.warn,
.dhanleaf-score-panel.warn {
  border-color: rgba(244, 184, 96, 0.42);
}

.score-meter.warn strong,
.dhanleaf-score-panel.warn h2,
.score-example.warn strong {
  color: var(--amber);
}

.score-meter.bad,
.dhanleaf-score-panel.bad {
  border-color: rgba(255, 95, 109, 0.42);
}

.score-meter.bad strong,
.dhanleaf-score-panel.bad h2 {
  color: var(--red);
}

.score-showcase,
.score-method-grid,
.score-breakdown {
  display: grid;
  gap: 10px;
}

.score-showcase {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score-method-grid,
.score-breakdown {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.score-example,
.score-method-grid article,
.score-breakdown-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
}

.score-example span {
  color: var(--muted);
  font-weight: 900;
}

.score-example strong {
  margin-top: 9px;
  font-size: 2rem;
}

.score-breakdown-item {
  display: grid;
  gap: 9px;
}

.score-breakdown-item div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.score-breakdown-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.score-breakdown-item strong {
  font-size: 0.9rem;
}

.score-breakdown-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.score-breakdown-item meter {
  width: 100%;
  height: 8px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--green-strong);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 920px;
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: 1;
}

h2 {
  font-size: 1.24rem;
}

.refresh-btn,
.quote-form button,
.quick-quote {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), #0da76d);
  color: #04130c;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
}

.refresh-btn:disabled {
  cursor: wait;
  opacity: 0.66;
}

.quote-search-panel,
.ai-chat-panel,
.feed-panel,
.insight-block,
.financials-panel,
.analyst-panel,
.cfa-workbench,
.ipo-desk,
.score-identity,
.workbench-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 24, 36, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.quote-search-panel {
  margin-bottom: 18px;
  padding: 20px;
}

.ai-chat-panel {
  gap: 14px;
  min-height: calc(100vh - 60px);
  padding: 0;
  overflow: hidden;
}

body.ai-chat-mode .ai-chat-panel {
  min-height: 100vh;
  border: 0;
  border-radius: 0;
  background: #0b111c;
  box-shadow: none;
  backdrop-filter: none;
}

.ai-chat-panel > .section-heading {
  min-height: 68px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.96);
}

.ai-chat-panel > .section-heading .eyebrow {
  margin-bottom: 4px;
}

.ai-chat-panel > .section-heading h2 {
  font-size: 1.05rem;
}

.ai-chat-layout {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  min-height: calc(100vh - 68px);
}

.ai-chat-form {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 0.55fr) minmax(110px, 0.45fr) 120px;
  gap: 10px;
  align-items: end;
  padding: 14px max(18px, calc((100% - 920px) / 2));
  border-top: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.96);
  backdrop-filter: blur(14px);
}

.ai-chat-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.ai-chat-form button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), #0da76d);
  color: #04130c;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.ai-chat-window {
  display: grid;
  align-content: start;
  gap: 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(10, 16, 25, 0.98), rgba(7, 11, 18, 0.98));
}

.chat-message {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 22px max(24px, calc((100% - 920px) / 2));
  border: 0;
  border-bottom: 1px solid rgba(38, 52, 73, 0.72);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-message.user {
  justify-self: stretch;
  width: 100%;
  background: rgba(21, 31, 46, 0.62);
}

.chat-message.assistant {
  justify-self: stretch;
  background: rgba(10, 17, 28, 0.72);
}

.chat-message span {
  display: block;
  margin-bottom: 0;
  color: var(--green-strong);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.chat-message p {
  margin: 0;
  color: #d8e2ef;
  line-height: 1.6;
}

.ai-answer {
  display: grid;
  gap: 16px;
}

.ai-answer-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.ai-answer-top span,
.ai-position-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.ai-answer-top strong {
  display: block;
  margin-top: 5px;
  font-size: 1.2rem;
}

.ai-answer-top b {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(98, 168, 255, 0.14);
  color: #a9ccff;
  font-size: 0.86rem;
  white-space: nowrap;
}

.ai-answer-top b.good {
  background: rgba(40, 209, 124, 0.14);
  color: var(--green-strong);
}

.ai-answer-top b.warn {
  background: rgba(244, 184, 96, 0.14);
  color: var(--amber);
}

.ai-answer-top b.bad {
  background: rgba(255, 95, 109, 0.14);
  color: var(--red);
}

.ai-position-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.ai-position-grid div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 28, 0.82);
}

.ai-position-grid strong {
  display: block;
  margin-top: 5px;
}

.ai-action-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 28, 0.92);
}

.ai-action-box span,
.ai-action-box strong {
  display: block;
}

.ai-action-box span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-action-box strong {
  margin-top: 6px;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 1.1;
}

.ai-action-box p {
  margin-top: 9px;
}

.ai-action-box.good {
  border-color: rgba(40, 209, 124, 0.38);
}

.ai-action-box.good strong {
  color: var(--green-strong);
}

.ai-action-box.warn {
  border-color: rgba(244, 184, 96, 0.4);
}

.ai-action-box.warn strong {
  color: var(--amber);
}

.ai-action-box.bad {
  border-color: rgba(255, 95, 109, 0.42);
}

.ai-action-box.bad strong {
  color: var(--red);
}

.ai-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.ai-plan-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11, 17, 28, 0.82);
}

.ai-answer h3 {
  margin: 0;
  font-size: 1rem;
}

.ai-answer ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.ai-disclaimer {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
}

.quote-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: end;
}

.suggestion-wrap,
.search-field {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.suggestion-wrap label,
.search-field span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
  color: var(--ink);
  font: inherit;
  outline: none;
}

input,
select {
  min-height: 44px;
}

input {
  padding: 0 13px;
}

textarea {
  padding: 12px 13px;
  resize: vertical;
}

select {
  align-self: end;
  padding: 0 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(125, 243, 178, 0.62);
  box-shadow: 0 0 0 3px rgba(40, 209, 124, 0.13);
}

.quote-form input,
.quote-form button {
  min-height: 56px;
  font-size: 1rem;
}

.suggestion-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  max-height: 360px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1320;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}

.suggestion-list.show {
  display: grid;
  gap: 6px;
}

.suggestion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item:focus {
  outline: none;
  background: var(--surface-2);
}

.suggestion-item span {
  min-width: 0;
}

.suggestion-item strong,
.suggestion-item small {
  display: block;
}

.suggestion-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
}

.suggestion-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.suggestion-item b,
.quote-symbol,
.tag {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(40, 209, 124, 0.12);
  color: var(--green-strong);
  font-size: 0.76rem;
  font-weight: 900;
}

.suggestion-empty,
.quote-status,
.status,
#lastUpdated,
#financialStatus {
  color: var(--muted);
}

.suggestion-empty {
  padding: 12px;
}

.quote-status {
  margin: 14px 0 12px;
}

.quote-results {
  display: grid;
  gap: 12px;
}

.quote-card,
.related-card,
.headline-card,
.topic-row,
.source-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.quote-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.quote-card-top,
.price-row,
.mini-heading,
.section-heading,
.source-top,
.topic-top,
.related-price {
  display: flex;
  gap: 14px;
}

.quote-card-top,
.section-heading,
.source-top,
.topic-top,
.related-price {
  justify-content: space-between;
}

.quote-card-top,
.mini-heading,
.section-heading {
  align-items: flex-start;
}

.quote-card h2 {
  font-size: 1.1rem;
  line-height: 1.3;
}

.quote-card p,
.related-card p,
.headline-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.quote-badge {
  align-self: flex-start;
  padding: 8px 10px;
  border: 1px solid rgba(125, 243, 178, 0.2);
  border-radius: 8px;
  color: var(--green-strong);
  font-size: 0.82rem;
  font-weight: 900;
}

.price-row {
  flex-wrap: wrap;
  align-items: baseline;
}

.quote-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quote-action-row button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--green-strong);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 900;
  cursor: pointer;
}

.quote-action-row button:hover {
  border-color: rgba(217, 249, 157, 0.48);
  background: rgba(217, 249, 157, 0.16);
}

.price-row strong {
  font-size: 2.2rem;
  line-height: 1;
}

.price-row span {
  font-weight: 900;
}

.price-up {
  color: var(--green-strong);
}

.price-down {
  color: var(--red);
}

.quote-chart {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080d15;
  overflow: hidden;
}

.quote-chart svg {
  display: block;
  width: 100%;
  height: 280px;
}

.chart-area {
  fill: var(--chart-color);
  opacity: 0.14;
}

.chart-line {
  fill: none;
  stroke: var(--chart-color);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.volume-bars rect {
  fill: #6d7e91;
  opacity: 0.46;
}

.chart-labels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.chart-labels span:last-child {
  text-align: right;
}

.chart-empty {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080d15;
  color: var(--muted);
}

.quote-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.quote-stats div,
.fundamental-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
}

.quote-stats dt,
.fundamental-grid span,
.financial-table thead th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.quote-stats dd,
.fundamental-grid strong {
  margin: 5px 0 0;
  font-weight: 900;
}

.quote-loading .loading-line,
.quote-loading .loading-grid span {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, #101824, #263449, #101824);
}

.loading-line.wide {
  width: 72%;
  height: 18px;
}

.loading-line.price {
  width: 46%;
  height: 34px;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.loading-grid span {
  height: 48px;
}

.market-strip,
.related-grid,
.fundamental-grid {
  display: grid;
  gap: 12px;
}

.market-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.market-strip.active {
  display: grid;
}

.full-row {
  grid-column: 1 / -1;
}

.market-strip article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface-2), #0d1420);
}

.market-strip small,
.market-strip span {
  display: block;
  color: var(--muted);
}

.market-strip strong {
  display: block;
  margin: 8px 0;
  font-size: 1.25rem;
}

.quick-quote {
  width: 100%;
  min-height: 34px;
  margin-top: 12px;
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.content-grid.active {
  display: grid;
}

.feed-panel,
.insight-block,
.financials-panel {
  padding: 20px;
}

.analyst-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.cfa-workbench {
  gap: 16px;
  padding: 20px;
}

.ipo-desk {
  gap: 16px;
  padding: 20px;
}

.ipo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.ipo-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.ipo-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.ipo-card-top span,
.ipo-card > span {
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(40, 209, 124, 0.12);
  color: var(--green-strong);
  font-size: 0.76rem;
  font-weight: 900;
}

.ipo-card-top small {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.ipo-card h3 {
  margin: 0;
  line-height: 1.3;
}

.ipo-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.ipo-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.ipo-facts div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
}

.ipo-facts dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.ipo-facts dd {
  margin: 5px 0 0;
  font-weight: 900;
}

.workbench-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
}

.workbench-card {
  display: grid;
  gap: 13px;
  padding: 18px;
  background: var(--surface-2);
}

.workbench-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.calc-grid,
.risk-grid,
.valuation-output {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.valuation-output div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
}

.valuation-output span,
.valuation-output strong {
  display: block;
}

.valuation-output span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.valuation-output strong {
  margin-top: 5px;
  color: var(--green-strong);
  font-size: 1.15rem;
}

.checklist {
  display: grid;
  gap: 9px;
}

.checklist label {
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
  color: var(--ink);
}

.checklist input {
  width: 18px;
  min-height: 18px;
}

.risk-output {
  display: grid;
}

.cfa-search-form {
  margin-bottom: 2px;
}

.cfa-auto-report {
  display: grid;
  gap: 14px;
}

.cfa-hero-report {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px 320px;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(21, 31, 46, 0.94), rgba(10, 17, 28, 0.94));
  box-shadow: var(--shadow);
}

.cfa-hero-report h2 {
  margin-top: 8px;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
}

.cfa-hero-report p {
  color: var(--muted);
}

.cfa-verdict {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
}

.cfa-verdict span,
.cfa-verdict strong {
  display: block;
}

.cfa-verdict span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.cfa-verdict strong {
  margin-top: 7px;
  font-size: 1.2rem;
}

.cfa-verdict p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.cfa-verdict.good {
  border-color: rgba(40, 209, 124, 0.34);
}

.cfa-verdict.good strong {
  color: var(--green-strong);
}

.cfa-verdict.bad {
  border-color: rgba(255, 95, 109, 0.34);
}

.cfa-verdict.bad strong {
  color: var(--red);
}

.cfa-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.analyst-panel .mini-heading > span {
  align-self: start;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(98, 168, 255, 0.14);
  color: #a9ccff;
  font-size: 0.82rem;
  font-weight: 900;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.score-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.score-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b111c;
}

.score-card span,
.score-card strong {
  display: block;
}

.score-card span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.score-card strong {
  margin-top: 6px;
  font-size: 1.12rem;
}

.score-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.score-card.good {
  border-color: rgba(40, 209, 124, 0.34);
}

.score-card.good strong {
  color: var(--green-strong);
}

.score-card.bad {
  border-color: rgba(255, 95, 109, 0.34);
}

.score-card.bad strong {
  color: var(--red);
}

.score-card.warn {
  border-color: rgba(244, 184, 96, 0.34);
}

.score-card.warn strong {
  color: var(--amber);
}

.sources-view {
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 24, 36, 0.88);
  box-shadow: var(--shadow);
}

.source-list.large {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 10px;
  margin-bottom: 14px;
}

.headline-list,
.topic-list,
.source-list,
.insights-panel,
.financial-content,
.related-quotes {
  display: grid;
  gap: 10px;
}

.headline-card,
.topic-row,
.source-row,
.related-card {
  padding: 14px;
}

.headline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.headline-card h3,
.related-card h3 {
  margin: 0;
  line-height: 1.35;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #263449;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.source-row small {
  color: var(--muted);
}

.source-ok {
  color: var(--green-strong);
}

.source-warn {
  color: var(--amber);
}

.financial-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.financial-table-wrap summary {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.financial-table-wrap summary::-webkit-details-marker {
  display: none;
}

.financial-table-wrap summary::after {
  content: "Hide";
  flex: 0 0 auto;
  color: var(--green-strong);
  font-size: 0.8rem;
}

.financial-table-wrap:not([open]) summary::after {
  content: "Show";
}

.financial-table-wrap summary small {
  color: var(--muted);
  font-weight: 700;
}

.table-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.financial-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.financial-table th,
.financial-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.financial-table th:first-child,
.financial-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--ink);
  text-align: left;
  font-weight: 900;
}

.financial-table thead th {
  background: var(--surface-3);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .content-grid,
  .home-grid,
  .workbench-grid,
  .score-identity-hero,
  .cfa-hero-report,
  .market-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  main {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .mini-heading {
    display: grid;
  }

  .market-strip,
  .home-grid,
  .workbench-grid,
  .content-grid,
  .score-identity-hero,
  .quote-form,
  .toolbar,
  .quote-stats,
  .ai-position-grid,
  .ai-plan-grid,
  .calc-grid,
  .risk-grid,
  .valuation-output,
  .cfa-hero-report {
    grid-template-columns: 1fr;
  }

  .ipo-facts {
    grid-template-columns: 1fr;
  }

  .chart-labels {
    grid-template-columns: 1fr 1fr;
  }

  .chart-labels span:last-child {
    text-align: left;
  }

  h1 {
    font-size: 2.25rem;
  }

  .ai-chat-form {
    grid-template-columns: 1fr;
  }

  .ai-answer-top {
    display: grid;
  }

  .chat-message {
    padding: 18px;
  }

  .ai-chat-layout {
    min-height: 660px;
  }
}

/* Final Dhanleaf 2.0 cascade overrides */
body {
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.08), transparent 28%),
    linear-gradient(180deg, #091018 0%, #080c11 48%, #0b1017 100%);
}

.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  padding: 20px 16px;
  background: rgba(8, 13, 19, 0.98);
  border-right-color: rgba(255, 255, 255, 0.08);
  gap: 24px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  background: #d9f99d;
  color: #0a140f;
  box-shadow: none;
}

.brand strong {
  font-size: 1.12rem;
}

.brand small,
.home-card p:not(.eyebrow),
.dashboard-strip p {
  color: var(--muted);
}

.nav-list {
  gap: 6px;
}

.nav-list button {
  position: relative;
  min-height: 42px;
  padding: 0 12px 0 16px;
  border-radius: 8px;
  color: #aeb9c6;
  font-size: 0.92rem;
}

.nav-list button::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  border-radius: 999px;
  background: transparent;
}

.nav-list button.active,
.nav-list button:hover {
  background: #172231;
  color: #ffffff;
}

.nav-list button.active::before {
  background: var(--green-strong);
}

.sidebar-note {
  padding: 14px;
  background: #101820;
  border-color: rgba(255, 255, 255, 0.08);
}

main {
  width: 100%;
  max-width: 1520px;
  padding: 22px;
}

.workspace-header {
  display: grid;
  grid-template-columns: minmax(170px, 0.42fr) minmax(320px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 24, 33, 0.92);
  box-shadow: var(--shadow);
}

.workspace-header h1 {
  font-size: 1.9rem;
  line-height: 1;
}

.global-command {
  display: grid;
  gap: 7px;
}

.global-command label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.global-command div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 8px;
}

.global-command input,
.global-command button {
  min-height: 46px;
}

.global-command button,
.home-action,
.refresh-btn,
.quote-form button,
.quick-quote,
.ai-chat-form button {
  border: 0;
  background: #d9f99d;
  color: #0a140f;
  box-shadow: none;
}

.topbar {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(20, 30, 41, 0.96), rgba(12, 19, 27, 0.96));
}

.topbar h2 {
  max-width: 860px;
  font-size: clamp(1.45rem, 2.5vw, 2.55rem);
  line-height: 1.08;
}

.home-grid {
  grid-template-columns: 1.2fr repeat(2, minmax(0, 0.72fr));
  gap: 12px;
}

.home-card {
  min-height: 0;
  padding: 18px;
  border-color: rgba(255, 255, 255, 0.08);
  background: #121b25;
  box-shadow: none;
}

.home-card-primary {
  grid-row: span 2;
  align-content: end;
  min-height: 390px;
  background:
    linear-gradient(160deg, rgba(217, 249, 157, 0.14), transparent 42%),
    #111a22;
}

.home-card h2 {
  font-size: clamp(1.2rem, 2vw, 2rem);
}

.home-card-primary h2 {
  font-size: clamp(2.2rem, 4vw, 4.7rem);
  line-height: 0.95;
}

.dashboard-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.dashboard-strip article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101821;
}

.dashboard-strip span {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.dashboard-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 1.2rem;
}

.quote-search-panel,
.ai-chat-panel,
.feed-panel,
.insight-block,
.financials-panel,
.analyst-panel,
.cfa-workbench,
.ipo-desk,
.score-identity,
.workbench-card,
.sources-view {
  background: rgba(16, 24, 33, 0.94);
  box-shadow: var(--shadow);
}

.quote-card,
.related-card,
.headline-card,
.topic-row,
.source-row,
.score-card,
.score-example,
.score-method-grid article,
.score-breakdown-item,
.ipo-card,
.market-strip article {
  background: #121b25;
  border-color: rgba(255, 255, 255, 0.08);
}

.price-row strong {
  font-size: clamp(1.7rem, 3vw, 2.8rem);
}

.quote-chart {
  background: #080d12;
}

body.ai-chat-mode .workspace-header {
  display: none;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace-header {
    grid-template-columns: 1fr;
  }

  .home-grid {
    grid-template-columns: 1fr 1fr;
  }

  .home-card-primary {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 280px;
  }
}

@media (max-width: 700px) {
  main {
    padding: 14px;
  }

  .workspace-header,
  .topbar {
    padding: 14px;
  }

  .global-command div,
  .home-grid,
  .dashboard-strip {
    grid-template-columns: 1fr;
  }

  .home-card-primary {
    min-height: 260px;
  }
}

/* Dhanleaf top-bar dark theme */
:root {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-soft: #0f172a;
  --sidebar: #0b1220;
  --surface: #111827;
  --surface-2: #111827;
  --surface-3: #1f2937;
  --ink: #f9fafb;
  --muted: #94a3b8;
  --line: #1f2937;
  --green: #10b981;
  --green-strong: #34d399;
  --red: #fb7185;
  --amber: #f59e0b;
  --blue: #3b82f6;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.3);
}

.view-panel:not(.active) {
  display: none !important;
}

body {
  background:
    linear-gradient(180deg, rgba(59, 130, 246, 0.08), transparent 22rem),
    #0b1220;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.top-navigation {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(18px);
}

.top-navigation .brand {
  min-width: 190px;
}

.top-navigation .brand-mark {
  width: 40px;
  height: 40px;
  background: var(--green);
  color: #04130d;
}

.top-navigation .brand strong {
  font-size: 1.05rem;
}

.top-navigation .brand small {
  color: var(--muted);
}

.top-navigation .nav-list {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
}

.top-navigation .nav-list button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #b7c2cf;
  font-size: 0.88rem;
  text-align: center;
}

.top-navigation .nav-list button::before {
  display: none;
}

.top-navigation .nav-list button.active,
.top-navigation .nav-list button:hover {
  border-color: rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.12);
  color: #ffffff;
}

.top-navigation .sidebar-note {
  min-width: 190px;
  margin: 0;
  padding: 10px 12px;
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.08);
}

.top-navigation .sidebar-note span {
  font-size: 0.72rem;
}

.top-navigation .sidebar-note strong {
  margin-top: 3px;
  font-size: 0.86rem;
  color: #bfdbfe;
}

main {
  max-width: 1500px;
  margin: 0 auto;
  padding: 22px;
}

.workspace-header,
.topbar,
.quote-search-panel,
.ai-chat-panel,
.feed-panel,
.insight-block,
.financials-panel,
.analyst-panel,
.cfa-workbench,
.ipo-desk,
.score-identity,
.workbench-card,
.sources-view {
  border-color: var(--line);
  background: rgba(17, 24, 39, 0.94);
}

.workspace-header {
  grid-template-columns: minmax(150px, 0.35fr) minmax(320px, 1fr) auto;
}

.global-command button,
.home-action,
.refresh-btn,
.quote-form button,
.quick-quote,
.ai-chat-form button {
  background: var(--green);
  color: #04130d;
}

.home-card-primary {
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.14), transparent 44%),
    #111827;
  border-color: rgba(16, 185, 129, 0.28);
}

.eyebrow,
.price-up,
.source-ok,
.home-action,
.score-method-grid strong,
.score-meter.good strong,
.dhanleaf-score-panel.good h2,
.score-example.good strong {
  color: var(--green-strong);
}

.quote-symbol,
.tag,
.suggestion-item b,
.ipo-card-top span,
.ipo-card > span {
  background: rgba(16, 185, 129, 0.12);
  color: var(--green-strong);
}

.workspace-header {
  box-shadow: none;
}

.workspace-header h1 {
  color: var(--ink);
}

.home-card:not(.home-card-primary),
.dashboard-strip article,
.quote-card,
.related-card,
.headline-card,
.topic-row,
.source-row,
.score-card,
.score-example,
.score-method-grid article,
.score-breakdown-item,
.ipo-card,
.market-strip article {
  background: #111827;
  border-color: #1f2937;
  box-shadow: none;
}

.home-card-primary .home-action {
  background: var(--green);
}

.home-card:not(.home-card-primary) .home-action {
  border: 1px solid rgba(59, 130, 246, 0.28);
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
}

.dashboard-strip span {
  color: var(--amber);
}

.score-card.warn strong,
.score-meter.warn strong,
.dhanleaf-score-panel.warn h2,
.score-example.warn strong,
.source-warn {
  color: var(--amber);
}

.analyst-panel .mini-heading > span,
.ai-answer-top b {
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
}

body.ai-chat-mode .top-navigation {
  display: grid;
}

body.ai-chat-mode main {
  padding-top: 0;
}

body.ai-chat-mode .topbar,
body.ai-chat-mode .home-grid,
body.ai-chat-mode .dashboard-strip,
body.ai-chat-mode .market-strip {
  display: none !important;
}

body.ai-chat-mode .ai-chat-panel.active {
  display: grid !important;
}

body.ai-chat-mode .ai-chat-panel > .section-heading {
  display: none !important;
}

body.ai-chat-mode .ai-chat-panel {
  min-height: calc(100vh - 66px);
}

body.ai-chat-mode .ai-chat-layout {
  min-height: calc(100vh - 66px);
  padding-bottom: 78px;
}

body.ai-chat-mode .ai-chat-form {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  box-shadow: 0 -18px 38px rgba(0, 0, 0, 0.34);
}

body.ai-chat-mode .ai-chat-form .suggestion-list {
  top: auto;
  bottom: calc(100% + 8px);
  z-index: 80;
}

/* Search suggestion readability */
.suggestion-list {
  padding: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.46);
}

.suggestion-item {
  min-height: 58px;
  border: 1px solid transparent;
  background: #111827;
  color: var(--ink);
}

.suggestion-item:hover,
.suggestion-item:focus {
  border-color: rgba(16, 185, 129, 0.35);
  background: #172033;
}

.suggestion-item strong {
  color: #f9fafb;
  font-weight: 800;
}

.suggestion-item small {
  color: #94a3b8;
}

.suggestion-item b {
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
}

.suggestion-empty {
  color: #cbd5e1;
  background: #111827;
  border-radius: 8px;
}

/* Sector dashboard */
.sector-board {
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: var(--shadow);
}

.range-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.range-toolbar button,
.watchlist-action {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.1);
  color: #d1fae5;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.range-toolbar button.active,
.range-toolbar button:hover,
.watchlist-action:hover {
  background: rgba(16, 185, 129, 0.22);
  color: #ffffff;
}

.range-toolbar.compact {
  justify-content: center;
}

.decision-horizon {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.decision-horizon article,
.watchlist-item,
.watchlist-empty {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.decision-horizon span,
.watchlist-item small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.decision-horizon strong,
.watchlist-item strong {
  display: block;
  margin-top: 6px;
  color: #f8fafc;
}

.watchlist-panel,
.watchlist-grid {
  display: grid;
  gap: 12px;
}

.watchlist-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.watchlist-item > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.watchlist-item button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.sector-mover-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.sector-mover-column {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.sector-mover-column > .mini-heading {
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--line);
}

.sector-mover-column > .mini-heading h2 {
  font-size: 1.1rem;
}

.sector-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.sector-card {
  display: grid;
  gap: 14px;
  min-height: 310px;
  padding: 16px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #111827;
}

.sector-card.good {
  border-color: rgba(16, 185, 129, 0.24);
}

.sector-card.bad {
  border-color: rgba(251, 113, 133, 0.24);
}

.sector-card-head,
.sector-breadth,
.sector-movers {
  display: grid;
  gap: 10px;
}

.sector-card-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.sector-card-head div {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.sector-card-head span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.12);
  font-size: 1.25rem;
}

.sector-card-head h3 {
  margin: 0;
  font-size: 1.25rem;
}

.sector-card-head strong {
  font-size: 1.45rem;
}

.sector-breadth {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sector-breadth div {
  padding: 10px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #0f172a;
}

.sector-breadth span,
.sector-movers > div > span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sector-breadth strong {
  display: block;
  margin-top: 5px;
}

.sector-movers {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sector-movers > div {
  display: grid;
  gap: 7px;
}

.sector-movers button,
.sector-company-list button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #0f172a;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.sector-movers button:hover,
.sector-company-list button:hover {
  border-color: rgba(59, 130, 246, 0.35);
  background: #172033;
}

.sector-movers button span,
.sector-company-list button span {
  overflow: hidden;
  color: #f9fafb;
  font-size: 0.82rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-movers button b,
.sector-company-list button b {
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.sector-company-list {
  border-top: 1px solid #1f2937;
  padding-top: 2px;
}

.sector-company-list summary {
  cursor: pointer;
  color: #bfdbfe;
  font-size: 0.86rem;
  font-weight: 900;
  list-style: none;
}

.sector-company-list summary::-webkit-details-marker {
  display: none;
}

.sector-company-list div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}

.sector-detail {
  gap: 14px;
}

.sector-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.94);
}

.sector-detail-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
}

.sector-detail-head > span {
  color: #bfdbfe;
  font-weight: 900;
}

.ghost-btn {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.12);
  color: #bfdbfe;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.sector-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sector-table-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.94);
}

.sector-table-list {
  display: grid;
  gap: 7px;
}

.sector-row {
  display: grid;
  grid-template-columns: 34px minmax(90px, 0.45fr) minmax(0, 1fr) 86px;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #0f172a;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.sector-row:hover {
  border-color: rgba(59, 130, 246, 0.35);
  background: #172033;
}

.sector-row span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.sector-row strong {
  font-size: 0.92rem;
}

.sector-row small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-row b {
  text-align: right;
}

.sector-row.empty {
  display: block;
  color: var(--muted);
  cursor: default;
}

@media (max-width: 1180px) {
  .top-navigation {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .top-navigation .brand,
  .top-navigation .sidebar-note {
    min-width: 0;
  }

  .sector-mover-board,
  .sector-grid {
    grid-template-columns: 1fr;
  }

  .sector-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .top-navigation {
    padding: 12px 14px;
  }

  .top-navigation .nav-list {
    margin: 0 -2px;
  }

  main {
    padding: 14px;
  }

  .sector-grid,
    .sector-mover-board,
    .sector-movers,
    .sector-company-list div {
      grid-template-columns: 1fr;
    }

  .sector-breadth {
    grid-template-columns: 1fr 1fr;
  }

  .sector-detail-head,
  .sector-row {
    grid-template-columns: 1fr;
  }

  .sector-row b {
    text-align: left;
  }
}

/* Polished sector detail page */
.sector-detail.active {
  display: grid !important;
  gap: 12px;
}

.sector-detail-head {
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 14px 16px;
  min-height: 96px;
}

.sector-detail-head .ghost-btn {
  align-self: center;
}

.sector-detail-head h2 {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: clamp(1.8rem, 3vw, 3.4rem);
  line-height: 1;
}

.sector-detail-head > span {
  justify-self: end;
  padding: 8px 11px;
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
}

.sector-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sector-detail-summary article {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.sector-detail-summary span,
.sector-detail-summary strong {
  display: block;
}

.sector-detail-summary span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sector-detail-summary strong {
  margin-top: 6px;
  font-size: 1.2rem;
}

.sector-detail-grid {
  align-items: start;
}

.sector-table-panel {
  align-content: start;
  gap: 12px;
  min-height: 0;
  padding: 14px;
}

.sector-table-panel .mini-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sector-table-panel .mini-heading h2 {
  font-size: 1.25rem;
}

.sector-table-list {
  align-content: start;
  align-items: start;
  grid-auto-rows: max-content;
  max-height: 640px;
  overflow: auto;
  padding-right: 2px;
}

.sector-row {
  grid-template-columns: 36px minmax(98px, 0.42fr) minmax(0, 1fr) 90px;
  min-height: 42px;
  padding: 7px 10px;
  border-radius: 7px;
}

.sector-row-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 34px;
  background: #111827;
  border-color: #263244;
  cursor: default;
}

.sector-row-head:hover {
  background: #111827;
  border-color: #263244;
}

.sector-row-head span,
.sector-row-head strong,
.sector-row-head small,
.sector-row-head b {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sector-row.gainers {
  border-left: 3px solid rgba(16, 185, 129, 0.55);
}

.sector-row.losers {
  border-left: 3px solid rgba(251, 113, 133, 0.55);
}

@media (max-width: 900px) {
  .sector-detail-summary,
  .sector-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .sector-detail-head {
    grid-template-columns: 1fr;
  }

  .sector-detail-head > span {
    justify-self: stretch;
  }

  .sector-row {
    grid-template-columns: 32px minmax(80px, 1fr) 78px;
  }

  .sector-row small {
    display: none;
  }
}

/* Dashboard market pulse and sector rate polish */
.market-dashboard {
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: var(--shadow);
}

.market-pulse-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.market-pulse-card,
.breadth-card {
  display: grid;
  gap: 9px;
  min-height: 128px;
  padding: 14px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #111827;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.market-pulse-card:hover,
.breadth-card:hover {
  border-color: rgba(16, 185, 129, 0.48);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.market-pulse-card.good {
  border-color: rgba(16, 185, 129, 0.22);
}

.market-pulse-card.bad {
  border-color: rgba(251, 113, 133, 0.22);
}

.market-pulse-card div {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.market-pulse-card span {
  font-size: 1.15rem;
}

.market-pulse-card h3 {
  margin: 0;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-pulse-card strong,
.breadth-card strong {
  font-size: 1.35rem;
}

.market-pulse-card p,
.breadth-card p {
  margin: 0;
}

.market-breadth-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.breadth-card {
  min-height: 118px;
}

.breadth-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.breadth-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.sector-row {
  grid-template-columns: 36px minmax(98px, 0.36fr) minmax(0, 1fr) 96px 90px;
}

.sector-row-head em,
.sector-row em {
  font-style: normal;
}

.sector-row-head em {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.sector-row em {
  color: #dbeafe;
  font-weight: 900;
  text-align: right;
}

@media (max-width: 1180px) {
  .market-pulse-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .market-breadth-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .market-pulse-grid,
  .market-breadth-grid {
    grid-template-columns: 1fr;
  }

  .sector-row {
    grid-template-columns: 32px minmax(80px, 1fr) 82px 78px;
  }

  .sector-row em {
    text-align: left;
  }
}

/* Company Umbrella Map */
.umbrella-panel {
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.94);
  box-shadow: var(--shadow);
}

.umbrella-workspace {
  display: grid;
  gap: 14px;
}

.umbrella-empty,
.umbrella-loading,
.umbrella-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
}

.umbrella-empty h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.8rem);
  line-height: 1.05;
}

.umbrella-empty p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

.umbrella-loading {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.umbrella-orbit-skeleton {
  aspect-ratio: 1;
  border: 1px solid rgba(16, 185, 129, 0.26);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(217, 249, 157, 0.22) 0 18%, transparent 19%),
    repeating-conic-gradient(from 0deg, rgba(59, 130, 246, 0.16) 0deg 18deg, rgba(16, 185, 129, 0.12) 18deg 36deg);
}

.umbrella-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.5fr);
  gap: 14px;
  align-items: stretch;
}

.umbrella-map {
  position: relative;
  min-height: 720px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(217, 249, 157, 0.2), transparent 136px),
    radial-gradient(circle at 20% 18%, rgba(59, 130, 246, 0.18), transparent 240px),
    radial-gradient(circle at 84% 74%, rgba(251, 191, 36, 0.14), transparent 230px),
    linear-gradient(145deg, rgba(15, 23, 42, 0.2), rgba(2, 6, 23, 0.72)),
    #0b1220;
  overflow: auto;
  isolation: isolate;
}

.umbrella-map::before {
  content: "";
  position: absolute;
  inset: 44px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 118px rgba(15, 23, 42, 0.14),
    inset 0 0 0 119px rgba(148, 163, 184, 0.09),
    inset 0 0 0 244px rgba(15, 23, 42, 0.1),
    inset 0 0 0 245px rgba(16, 185, 129, 0.08);
  pointer-events: none;
}

.umbrella-map::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(circle at center, black 0 64%, transparent 84%);
  opacity: 0.52;
  pointer-events: none;
}

.umbrella-glow {
  position: absolute;
  z-index: 0;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0.34;
  pointer-events: none;
}

.umbrella-glow.one {
  top: 9%;
  left: 12%;
  background: rgba(16, 185, 129, 0.42);
}

.umbrella-glow.two {
  right: 8%;
  bottom: 10%;
  background: rgba(59, 130, 246, 0.44);
}

.umbrella-center {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 220px;
  aspect-ratio: 1;
  padding: 18px;
  border: 1px solid rgba(217, 249, 157, 0.45);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 18%, rgba(217, 249, 157, 0.22), transparent 40%),
    rgba(15, 23, 42, 0.94);
  box-shadow:
    0 0 0 13px rgba(217, 249, 157, 0.05),
    0 0 0 26px rgba(16, 185, 129, 0.04),
    0 24px 80px rgba(0, 0, 0, 0.48);
  text-align: center;
  transform: translate(-50%, -50%);
}

.umbrella-center span,
.umbrella-center small,
.umbrella-segment-head span,
.umbrella-entity span,
.umbrella-entity small,
.umbrella-metrics span,
.umbrella-read-list span,
.umbrella-source span,
.umbrella-source small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.umbrella-center strong {
  font-size: 1.3rem;
  line-height: 1.05;
}

.umbrella-segment {
  position: absolute;
  z-index: 3;
  top: var(--y);
  left: var(--x);
  display: grid;
  align-content: start;
  gap: 9px;
  width: min(230px, 24vw);
  min-height: 136px;
  padding: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(17, 24, 39, 0.96), rgba(8, 13, 24, 0.9)),
    rgba(15, 23, 42, 0.92);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
  transform: translate(-50%, -50%);
  animation: umbrellaIn 420ms ease both;
  animation-delay: var(--delay);
}

@keyframes umbrellaIn {
  from {
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.umbrella-segment-head {
  display: grid;
  gap: 4px;
}

.umbrella-segment-head strong {
  font-size: 1rem;
}

.umbrella-node-preview {
  display: grid;
  gap: 6px;
}

.umbrella-node-preview b,
.umbrella-node-preview em {
  display: block;
  overflow: hidden;
  padding: 7px 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 7px;
  background: rgba(2, 6, 23, 0.42);
  color: #e5edf8;
  font-size: 0.78rem;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.umbrella-node-preview em {
  color: var(--green-strong);
  font-weight: 900;
}

.umbrella-segment-browser {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.umbrella-detail-segment {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: #0b1220;
}

.umbrella-detail-head {
  display: grid;
  gap: 5px;
}

.umbrella-detail-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.umbrella-entity-list {
  display: grid;
  gap: 7px;
}

.umbrella-entity {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 9px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: #0b1220;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: help;
}

.umbrella-entity:hover {
  border-color: rgba(217, 249, 157, 0.42);
  background: #111827;
}

.umbrella-entity strong {
  font-size: 0.9rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.umbrella-entity.listed {
  border-left: 3px solid rgba(16, 185, 129, 0.7);
}

.umbrella-entity.private {
  border-left: 3px solid rgba(59, 130, 246, 0.7);
}

.umbrella-entity.foreign {
  border-left: 3px solid rgba(251, 191, 36, 0.75);
}

.umbrella-entity.pending {
  border-left: 3px solid rgba(148, 163, 184, 0.7);
}

.umbrella-side,
.umbrella-card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.umbrella-side {
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: #111827;
}

.umbrella-side h2,
.umbrella-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.umbrella-side p,
.umbrella-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.umbrella-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.umbrella-match {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(16, 185, 129, 0.24);
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.08);
}

.umbrella-match span {
  color: var(--green-strong);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.umbrella-match strong {
  font-size: 1rem;
}

.umbrella-match p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.umbrella-metrics article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1220;
}

.umbrella-metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 1.6rem;
}

.umbrella-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.umbrella-read-list,
.umbrella-risk-list,
.umbrella-source-grid {
  display: grid;
  gap: 9px;
}

.umbrella-read-list div,
.umbrella-risk-list div,
.umbrella-source {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1220;
}

.umbrella-risk-list .warn {
  border-color: rgba(251, 191, 36, 0.38);
}

.umbrella-risk-list .bad {
  border-color: rgba(251, 113, 133, 0.42);
}

.umbrella-risk-list .neutral {
  border-color: rgba(59, 130, 246, 0.3);
}

.umbrella-source-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.umbrella-source {
  color: inherit;
  text-decoration: none;
}

.umbrella-source strong {
  display: block;
  margin: 6px 0;
}

.umbrella-document-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.umbrella-document-group {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: #0b1220;
}

.umbrella-document-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.umbrella-document-group-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.umbrella-document-group-head strong {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--green-strong);
}

.umbrella-document-list {
  display: grid;
  gap: 7px;
}

.umbrella-document-list button,
.umbrella-document-empty {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.42);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

.umbrella-document-list button {
  cursor: pointer;
}

.umbrella-document-list button:hover {
  border-color: rgba(217, 249, 157, 0.42);
  background: rgba(16, 185, 129, 0.08);
}

.umbrella-document-list button strong {
  font-size: 0.84rem;
  line-height: 1.25;
}

.umbrella-document-list button span,
.umbrella-document-list p,
.umbrella-document-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.document-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  padding: 18px;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(16px);
}

.document-modal.show {
  display: grid;
  place-items: center;
}

.document-modal-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 100%);
  height: min(860px, 94vh);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  background: #07111d;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.document-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #0b1220;
}

.document-modal-head h2 {
  font-size: 1rem;
  line-height: 1.25;
}

.document-modal-head button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(251, 113, 133, 0.28);
  border-radius: 8px;
  background: rgba(251, 113, 133, 0.1);
  color: #fecdd3;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.document-modal iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #111827;
}

body.document-viewer-open {
  overflow: hidden;
}

@media (max-width: 1180px) {
  .umbrella-hero,
  .umbrella-grid,
  .umbrella-segment-browser,
  .umbrella-source-grid,
  .umbrella-document-grid {
    grid-template-columns: 1fr;
  }

  .umbrella-map {
    display: grid;
    min-height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 16px;
  }

  .umbrella-center {
    position: relative;
    top: auto;
    left: auto;
    grid-column: 1 / -1;
    margin-bottom: 4px;
    justify-self: center;
    transform: none;
  }

  .umbrella-segment {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    transform: none;
  }

  @keyframes umbrellaIn {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* Mobile app experience */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
  }

  body {
    min-height: 100svh;
    background:
      linear-gradient(180deg, rgba(16, 185, 129, 0.08), transparent 240px),
      #07111d;
    -webkit-tap-highlight-color: transparent;
  }

  .app-shell {
    min-height: 100svh;
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .top-navigation {
    position: fixed;
    inset: auto 0 0;
    z-index: 80;
    display: block;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    border-bottom: 0;
    background: rgba(7, 17, 29, 0.96);
    box-shadow: 0 -18px 38px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(18px);
  }

  .top-navigation .brand {
    display: none;
  }

  .top-navigation .nav-list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(72px, 1fr);
    gap: 6px;
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .top-navigation .nav-list::-webkit-scrollbar {
    display: none;
  }

  .top-navigation .nav-list button {
    display: grid;
    place-items: center;
    min-height: 58px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 900;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
    scroll-snap-align: center;
  }

  .top-navigation .nav-list button::before {
    display: block;
    position: static;
    width: auto;
    height: auto;
    margin-bottom: 4px;
    border-radius: 0;
    background: transparent;
    color: currentColor;
    font-size: 1rem;
    line-height: 1;
  }

  .top-navigation .nav-list button[data-view="overview"]::before { content: "D"; }
  .top-navigation .nav-list button[data-view="sectors"]::before { content: "27"; }
  .top-navigation .nav-list button[data-view="umbrella"]::before { content: "U"; }
  .top-navigation .nav-list button[data-view="score"]::before { content: "S"; }
  .top-navigation .nav-list button[data-view="search"]::before { content: "Q"; }
  .top-navigation .nav-list button[data-view="cfa"]::before { content: "C"; }
  .top-navigation .nav-list button[data-view="ai-chat"]::before { content: "AI"; }
  .top-navigation .nav-list button[data-view="watchlist"]::before { content: "W"; }
  .top-navigation .nav-list button[data-view="headlines"]::before { content: "N"; }

  .top-navigation .nav-list button.active {
    border-color: rgba(16, 185, 129, 0.32);
    background: rgba(16, 185, 129, 0.14);
    color: #f8fafc;
  }

  main {
    width: 100%;
    max-width: none;
    padding: 12px 10px 18px;
  }

  .workspace-header {
    position: sticky;
    top: 0;
    z-index: 35;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: -12px -10px 12px;
    padding: calc(10px + env(safe-area-inset-top)) 10px 12px;
    border-width: 0 0 1px;
    border-radius: 0;
    background: rgba(7, 17, 29, 0.96);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(18px);
  }

  .workspace-header .eyebrow {
    margin-bottom: 4px;
    font-size: 0.68rem;
  }

  .workspace-header h1 {
    font-size: 1.35rem;
  }

  .global-command {
    gap: 6px;
  }

  .global-command label {
    display: none;
  }

  .global-command div {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 7px;
  }

  .global-command input,
  .global-command button,
  .refresh-btn,
  .quote-form input,
  .quote-form button,
  .ai-chat-form input,
  .ai-chat-form button,
  input,
  select,
  textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .refresh-btn {
    width: 100%;
    justify-content: center;
  }

  .topbar,
  .market-dashboard,
  .sector-board,
  .umbrella-panel,
  .quote-search-panel,
  .feed-panel,
  .insight-block,
  .cfa-workbench,
  .score-identity,
  .workbench-card,
  .financials-panel,
  .analyst-panel {
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 8px;
    box-shadow: none;
  }

  .topbar h2,
  .section-heading h2,
  .mini-heading h2,
  .score-identity-hero h2,
  .cfa-hero-report h2 {
    font-size: 1.14rem;
    line-height: 1.2;
  }

  .section-heading,
  .mini-heading,
  .quote-card-top,
  .source-top,
  .topic-top,
  .related-price {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .section-heading > span,
  .mini-heading > span,
  #lastUpdated,
  #sectorStatus,
  #marketPulseStatus,
  #cfaAutoStatus,
  #aiChatStatus {
    justify-self: start;
    max-width: 100%;
    font-size: 0.78rem;
  }

  .home-grid,
  .dashboard-strip,
  .market-pulse-grid,
  .market-breadth-grid,
  .sector-mover-board,
  .umbrella-hero,
  .umbrella-grid,
  .umbrella-source-grid,
  .sector-grid,
  .sector-movers,
  .sector-company-list div,
  .sector-detail-summary,
  .sector-detail-grid,
  .content-grid,
  .toolbar,
  .workbench-grid,
  .score-identity-hero,
  .score-band-grid,
  .score-method-layout,
  .score-showcase,
  .score-method-grid,
  .score-breakdown,
  .score-grid,
  .score-grid.compact,
  .quote-form,
  .quote-stats,
  .fundamental-grid,
  .market-strip,
  .cfa-hero-report,
  .ai-position-grid,
  .ai-plan-grid,
  .decision-horizon,
  .watchlist-item,
  .table-kpi-grid,
  .calc-grid,
  .risk-grid,
  .valuation-output {
    grid-template-columns: 1fr !important;
  }

  .home-card,
  .home-card-primary,
  .market-pulse-card,
  .breadth-card,
  .sector-card,
  .umbrella-card,
  .umbrella-empty,
  .quote-card,
  .headline-card,
  .topic-row,
  .source-row,
  .score-card,
  .score-band-grid article,
  .score-method-card,
  .score-example,
  .score-method-grid article,
  .score-breakdown-item {
    min-height: auto;
    padding: 12px;
    border-radius: 8px;
  }

  .home-card-primary {
    min-height: auto;
  }

  .score-identity-hero > div:first-child,
  .score-gauge,
  .score-method-card {
    padding: 14px;
  }

  .quote-card,
  .quote-results,
  .cfa-auto-report,
  .sector-table-list,
  .headline-list,
  .topic-list {
    gap: 8px;
  }

  .price-row strong {
    font-size: 1.75rem;
  }

  .quote-chart svg {
    height: 190px;
  }

  .chart-labels {
    grid-template-columns: 1fr 1fr;
    font-size: 0.72rem;
  }

  .quote-stats div,
  .fundamental-grid div,
  .sector-breadth div {
    padding: 10px;
  }

  .sector-card-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .sector-card-head div {
    align-items: flex-start;
  }

  .sector-card-head h3 {
    font-size: 1rem;
    line-height: 1.25;
  }

  .sector-card-head strong {
    font-size: 1.25rem;
  }

  .sector-breadth {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px;
  }

  .sector-detail-head {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding: 12px;
  }

  .sector-detail-head h2 {
    font-size: 1.55rem;
    line-height: 1.1;
  }

  .sector-detail-head > span {
    justify-self: stretch;
    text-align: center;
  }

  .sector-table-panel {
    padding: 10px;
  }

  .sector-table-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .sector-row {
    grid-template-columns: 30px minmax(70px, 0.8fr) 76px 64px !important;
    gap: 7px;
    min-height: 46px;
    padding: 8px;
    font-size: 0.82rem;
  }

  .sector-row small {
    display: none;
  }

  .sector-row em,
  .sector-row b {
    text-align: right;
  }

  .table-visual {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 120px;
    padding: 10px;
  }

  .financial-table-wrap,
  .table-wrap,
  .quote-chart,
  .sector-table-list {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .financial-table {
    min-width: 720px;
  }

  .umbrella-map {
    grid-template-columns: 1fr !important;
    min-height: auto;
    padding: 10px;
  }

  .umbrella-map::before {
    inset: 12px;
    border-radius: 8px;
  }

  .umbrella-center {
    position: relative;
    top: auto;
    grid-column: 1;
    grid-row: 1;
    width: 132px;
    padding: 12px;
  }

  .umbrella-center strong {
    font-size: 0.95rem;
  }

  .umbrella-segment {
    min-height: auto;
  }

  .umbrella-loading {
    grid-template-columns: 1fr;
  }

  .umbrella-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-chat-panel {
    min-height: calc(100svh - 82px);
    border-radius: 0;
  }

  body.ai-chat-mode main {
    padding: 0 0 calc(82px + env(safe-area-inset-bottom));
  }

  body.ai-chat-mode .top-navigation {
    display: block;
  }

  body.ai-chat-mode .ai-chat-panel {
    min-height: calc(100svh - 82px - env(safe-area-inset-bottom));
  }

  body.ai-chat-mode .ai-chat-layout,
  .ai-chat-layout {
    min-height: calc(100svh - 82px - env(safe-area-inset-bottom));
  }

  .ai-chat-panel > .section-heading {
    min-height: 0;
    padding: 12px;
  }

  .ai-chat-window {
    min-height: 46svh;
    max-height: none;
  }

  .chat-message {
    padding: 14px 12px;
  }

  .ai-chat-form {
    position: sticky;
    bottom: calc(75px + env(safe-area-inset-bottom));
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 8px 8px 0 0;
    background: rgba(7, 17, 29, 0.97);
  }

  .ai-chat-form label {
    gap: 5px;
    font-size: 0.74rem;
  }

  .suggestion-list {
    max-height: 260px;
  }
}

@media (max-width: 390px) {
  .top-navigation .nav-list {
    grid-auto-columns: minmax(64px, 1fr);
  }

  .top-navigation .nav-list button {
    min-height: 54px;
    padding-inline: 5px;
    font-size: 0.62rem;
  }

  .global-command div {
    grid-template-columns: 1fr;
  }

  .sector-breadth {
    grid-template-columns: 1fr !important;
  }

  .sector-row {
    grid-template-columns: 28px minmax(68px, 1fr) 70px !important;
  }

  .sector-row em {
    display: none;
  }
}
