:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8faff;
  --line: #dde4ef;
  --line-strong: #cfd7e5;
  --text: #1f2937;
  --muted: #6b7a90;
  --accent: #5d5fef;
  --accent-soft: #eef0ff;
  --green: #12b76a;
  --red: #ef5b6c;
  --navy: #172554;
  --shadow: 0 18px 44px rgba(17, 24, 39, 0.08);
}

* { box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Public Sans", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(180deg, #eef3f9 0%, #f5f7fb 100%);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
svg { display: block; }
h1, h2, h3, h4, p { margin: 0; }

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  background: rgba(255,255,255,0.94);
  border-bottom: 1px solid rgba(221, 228, 239, 0.9);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.04);
  backdrop-filter: blur(18px);
}

.header-inner,
.company-subnav-inner,
.detail-shell,
.news-shell,
.home-stage {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand,
.hero-wordmark {
  display: inline-flex;
  align-items: flex-end;
  gap: 8px;
}

.brand-word {
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.05em;
  color: #2f3138;
}

.brand-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  padding-bottom: 8px;
}

.brand-bars i {
  display: block;
  width: 7px;
  border-radius: 999px;
  background: #7ad60f;
}
.brand-bars i:nth-child(1) { height: 22px; }
.brand-bars i:nth-child(2) { height: 32px; }
.brand-bars i:nth-child(3) { height: 42px; }
.brand-bars i:nth-child(4) { height: 56px; }

.site-header .brand-word { font-size: 3.3rem; }
.site-header .brand-bars { padding-bottom: 5px; }
.site-header .brand-bars i { width: 5px; }
.site-header .brand-bars i:nth-child(1) { height: 16px; }
.site-header .brand-bars i:nth-child(2) { height: 22px; }
.site-header .brand-bars i:nth-child(3) { height: 30px; }
.site-header .brand-bars i:nth-child(4) { height: 42px; }

.primary-nav,
.header-tools,
.chart-summary-grid,
.document-actions,
.news-item-actions,
.news-item-meta,
.filter-bar,
.company-link-row,
.company-price-row,
.company-metric-grid,
.pros-cons-grid,
.score-grid,
.ratio-grid,
.mi-stat-grid,
.mi-metric-grid,
.mi-links,
.stats-strip,
.document-meta {
  display: flex;
  gap: 12px;
}

.primary-nav { margin-right: auto; }
.primary-nav a,
.nav-button {
  border: 0;
  background: transparent;
  padding: 10px 12px;
  color: #607086;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.primary-nav a:hover,
.primary-nav a.active,
.nav-button:hover { color: var(--navy); }

.header-tools { margin-left: auto; align-items: center; }
.header-search,
.inline-search,
.select-shell,
.ghost-btn,
.outline-btn,
.range-pill,
.doc-link,
.table-tag,
.change-pill,
.chip,
.tab-button,
.notebook-pill,
.ai-pill {
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.96);
  border-radius: 14px;
}

.header-search,
.inline-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
}
.header-search { width: 300px; }
.inline-search { min-width: 280px; }
.search-icon { color: #6b7a90; display: inline-flex; }
.search-icon svg { width: 24px; height: 24px; fill: currentColor; }
.header-search input,
.inline-search input,
.select-shell select {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: #425164;
}
.select-shell {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: #56657c;
}
.select-shell span {
  font-size: 0.83rem;
  font-weight: 700;
  color: #66768c;
}

.ghost-btn,
.outline-btn {
  min-height: 48px;
  padding: 0 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.outline-btn { color: var(--accent); border-color: var(--accent); }

.search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.search-results:empty { display: none; }
.search-result-item {
  width: 100%;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 14px;
  text-align: left;
  padding: 14px 16px;
}
.search-result-item:hover,
.search-result-item.is-active {
  border-color: #cfd7ff;
  background: #f5f7ff;
}
.search-result-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.search-result-name { font-weight: 700; color: #111827; }
.search-result-meta { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.search-result-symbol { color: var(--accent); font-weight: 700; }

.company-subnav {
  border-top: 1px solid rgba(229, 234, 243, 0.9);
}
body.home-mode .company-subnav,
body.news-mode .company-subnav { display: none; }
.company-subnav-inner {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.company-tabs {
  display: flex;
  gap: 24px;
  overflow-x: auto;
}
.company-tabs a {
  padding: 14px 0 12px;
  border-bottom: 2px solid transparent;
  color: #6f8095;
  white-space: nowrap;
}
.company-tabs a.active,
.company-tabs a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.subnav-actions { display: none; }

.page-shell { min-height: 100vh; padding-top: 110px; }
.home-view,
.news-view,
.detail-view { padding: 24px 0 48px; }
.card {
  background: var(--panel);
  border: 1px solid rgba(221, 228, 239, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.section-kicker {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6e7d93;
  margin-bottom: 8px;
}
.section-head h2,
.overview-card h2,
.mi-card h3,
.content-card h3,
.document-item h3,
.news-item-title,
.digest-item h3 {
  font-size: 1.9rem;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: #172554;
}

.home-stage { display: grid; gap: 24px; }
.home-copy {
  padding: 20px 0 6px;
  text-align: center;
}
.home-copy--compact .brand-word { font-size: clamp(4rem, 10vw, 6rem); }
.hero-tagline { margin-top: 14px; font-size: 1.25rem; color: #23324c; }
.hero-domain {
  margin-top: 18px;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #6b83a5;
}
.hero-subcopy {
  width: min(760px, 100%);
  margin: 16px auto 0;
  color: #617084;
  font-size: 1rem;
}
.home-screener-card { padding: 24px; }
.stats-strip { flex-wrap: wrap; margin-bottom: 18px; }
.stat-card {
  flex: 1 1 180px;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 18px;
  padding: 14px 16px;
}
.stat-card-label { font-size: 0.76rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #718196; }
.stat-card-value { margin-top: 8px; font-size: 1.35rem; font-weight: 800; color: #172554; }
.table-wrap { overflow-x: auto; }
.screener-table,
.mini-table,
#annualTable,
#quarterlyTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.screener-table th,
.screener-table td,
.mini-table th,
.mini-table td,
#annualTable th,
#annualTable td,
#quarterlyTable th,
#quarterlyTable td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.screener-table th,
.mini-table th,
#annualTable th,
#quarterlyTable th {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #718196;
  background: #fbfcff;
}
.screener-table tbody tr:hover { background: #fafbff; }
.stock-row-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
}
.stock-row-name { display: block; font-weight: 700; color: #172554; }
.stock-row-meta { display: block; margin-top: 4px; color: var(--muted); font-size: 0.88rem; }
.table-tag,
.change-pill,
.chip,
.doc-link,
.range-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #526277;
}
.change-pill.positive,
.positive-text { color: var(--green); }
.change-pill.negative,
.negative-text { color: var(--red); }
.doc-link.primary { color: var(--accent); border-color: #c9c8ff; background: var(--accent-soft); }

.news-shell { display: grid; gap: 20px; }
.news-hero-card,
.news-feed-card,
.news-digest-card { padding: 24px; }
.news-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.news-summary-item {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 18px;
  padding: 16px;
}
.news-summary-label { font-size: 0.76rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #718196; }
.news-summary-value { margin-top: 8px; font-size: 1.4rem; font-weight: 800; color: #172554; }
.news-feed-list,
.news-digest-scroll,
.document-list,
.mi-action-list,
.keypoint-list,
.digest-list,
.bullet-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.news-digest-scroll { max-height: 520px; overflow-y: auto; padding-right: 6px; }
.news-item,
.document-item,
.digest-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-soft);
}
.news-item-copy,
.document-copy { flex: 1 1 auto; min-width: 0; }
.news-item-stock,
.digest-stock { font-size: 0.82rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.news-item-title { font-size: 1.2rem; margin-top: 8px; }
.news-item-actions,
.document-actions { flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; }

.detail-shell { display: grid; gap: 20px; }
.company-hero-card,
.overview-card,
.table-card,
.market-intel-card,
.document-card,
.chart-card { padding: 24px; }
.company-header-top { display: flex; justify-content: space-between; gap: 24px; }
.company-title-block h1 {
  font-size: clamp(2.4rem, 5vw, 4.3rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  color: #1f2937;
}
.company-price-row { margin-top: 16px; align-items: center; flex-wrap: wrap; }
.company-price { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 800; color: #172554; }
.company-change { font-size: 1.05rem; font-weight: 800; }
.company-asof { color: var(--muted); }
.company-link-row {
  margin-top: 14px;
  flex-wrap: wrap;
  color: #5c6c82;
  font-weight: 600;
}
.company-link-row a { color: var(--accent); font-weight: 700; }
.company-metric-grid { margin-top: 24px; flex-wrap: wrap; }
.company-metric-card {
  flex: 1 1 220px;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 18px;
  padding: 16px;
}
.company-metric-label { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: #718196; }
.company-metric-value { margin-top: 8px; font-size: 1.18rem; font-weight: 800; color: #172554; }

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.95fr);
  gap: 20px;
}
.overview-main-column,
.overview-side-column { display: grid; gap: 18px; align-content: start; }
.content-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-soft);
  padding: 18px;
}
.content-card h3 { font-size: 1.2rem; margin-bottom: 14px; }
.overview-description { color: #4e5d72; font-size: 1rem; }
.keypoint-item { border-top: 1px solid rgba(221, 228, 239, 0.85); padding-top: 14px; }
.keypoint-item:first-child { border-top: 0; padding-top: 0; }
.keypoint-item h4 { font-size: 1rem; color: #172554; margin-bottom: 6px; }
.keypoint-item p,
.bullet-list li,
.digest-list li,
.mi-summary,
.mi-category-empty { color: #55657b; }
.pros-cons-grid { align-items: stretch; }
.pros-cons-grid > * { flex: 1 1 0; }
.bullet-list { margin: 0; padding-left: 20px; }
.score-grid,
.ratio-grid,
.mi-stat-grid,
.mi-metric-grid { flex-wrap: wrap; }
.score-card,
.ratio-card,
.mi-stat,
.mi-metric {
  flex: 1 1 160px;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 14px;
}
.score-card-label,
.ratio-card-label,
.mi-stat span,
.mi-metric span,
.chart-summary-card span {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #718196;
}
.score-card-value,
.ratio-card-value,
.mi-stat strong,
.mi-metric strong,
.chart-summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #172554;
}
.metric-stub { min-width: 170px; position: sticky; left: 0; background: #fbfcff; }
.metric-label-cell { font-weight: 700; color: #172554; }
.metric-value-cell { color: #314156; text-align: center; }
.market-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.mi-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-soft);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mi-card h3 { font-size: 1.2rem; }
.mi-category-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mi-category-card,
.mi-action,
.chart-summary-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
}
.mi-category-card h4,
.mi-action h4 { margin: 0 0 10px; font-size: 1rem; color: #172554; }
.mi-mini-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.mi-mini-list li,
.mi-action-top { display: flex; justify-content: space-between; gap: 12px; color: #55657b; }
.mi-action-top { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #718196; margin-bottom: 8px; }
.mi-links { flex-wrap: wrap; }

.document-list { gap: 16px; }

.chart-summary-grid { flex-wrap: wrap; margin-bottom: 18px; }
.chart-summary-card { flex: 1 1 180px; }
.simple-chart-wrap {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, #fcfdff 0%, #f7f9ff 100%);
  padding: 12px;
}
.simple-chart { width: 100%; height: auto; display: block; }
.chart-grid-line { stroke: #e6ebf5; stroke-width: 1; }
.chart-axis-label { font-size: 12px; fill: #7a8798; font-family: "Public Sans", sans-serif; }
.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.range-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.range-pill.active { color: var(--accent); border-color: #c9c8ff; background: var(--accent-soft); }

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: var(--panel-soft);
  padding: 18px;
  color: #617084;
}
.empty-state strong { display: block; color: #172554; margin-bottom: 6px; }
.empty-state.compact { padding: 14px; }

@media (max-width: 1100px) {
  .header-inner { flex-wrap: wrap; padding: 14px 0; }
  .primary-nav { order: 3; width: 100%; margin-right: 0; }
  .header-tools { width: 100%; margin-left: 0; }
  .header-search { width: 100%; }
  .overview-layout,
  .market-info-grid,
  .mi-category-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .page-shell { padding-top: 132px; }
  .news-summary-grid,
  .stats-strip,
  .company-metric-grid,
  .score-grid,
  .ratio-grid,
  .chart-summary-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-bar,
  .pros-cons-grid,
  .news-item,
  .document-item,
  .header-tools { flex-direction: column; align-items: stretch; }
  .inline-search,
  .select-shell,
  .header-search { width: 100%; min-width: 0; }
  .company-title-block h1 { font-size: 2.6rem; }
}

@media (max-width: 640px) {
  .header-inner,
  .company-subnav-inner,
  .detail-shell,
  .news-shell,
  .home-stage { width: min(1280px, calc(100% - 24px)); }
  .site-header .brand-word { font-size: 2.6rem; }
  .home-copy--compact .brand-word { font-size: 3.3rem; }
  .news-summary-grid,
  .stats-strip,
  .company-metric-grid,
  .score-grid,
  .ratio-grid,
  .chart-summary-grid { grid-template-columns: 1fr; }
  .primary-nav { gap: 2px; flex-wrap: wrap; }
  .primary-nav a,
  .nav-button { padding: 8px 10px; }
  .company-tabs { gap: 18px; }
  .card,
  .company-hero-card,
  .overview-card,
  .table-card,
  .market-intel-card,
  .document-card,
  .chart-card,
  .news-hero-card,
  .news-feed-card,
  .news-digest-card,
  .home-screener-card { padding: 18px; }
}

.detail-mode .page-shell { padding-top: 152px; }
.home-mode .page-shell,
.news-mode .page-shell { padding-top: 110px; }
.news-hero-copy { color: var(--muted); font-size: 1rem; margin-bottom: 18px; }
.digest-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
