/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f0e8;
  --surface: #fffef9;
  --border: #ddd5c0;
  --text: #1a1a0e;
  --muted: #6b6350;
  --indigo: #3a6b2a;
  --indigo-dark: #1e4d14;
  --indigo-light: #e4f0de;
  --green: #22a064;
  --green-light: #d0f0e0;
  --red: #e03a3a;
  --red-light: #fde8e8;
  --amber-light: #fef3c7;
  --amber-dark: #92400e;
  --gold: #c8960a;
  --gold-light: #fef7e0;
  --forest: #1a3a0f;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

ul { padding-left: 1.2rem; }
li { margin-bottom: .3rem; }

/* ── Sticky top wrapper ── */
.sticky-top {
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── Site header (gradient green) ── */
.site-header {
  background: linear-gradient(135deg, #2d5016 0%, #4a7c25 100%);
  color: white;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header-left { display: flex; flex-direction: column; gap: 2px; }

.site-title {
  font-size: 20px;
  font-weight: 700;
  color: white;
  letter-spacing: -.2px;
}

.site-subtitle {
  font-size: 12px;
  opacity: .8;
}

.site-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.header-date {
  font-size: 14px;
  font-weight: 700;
}

.header-time {
  font-size: 11px;
  opacity: .75;
}

/* ── Tab nav ── */
.tab-nav {
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 32px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-link {
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  user-select: none;
}

.tab-link:hover:not(.active) { color: var(--text); }

.tab-link.active {
  color: #2d5016;
  border-bottom-color: #4a7c25;
  font-weight: 600;
}

/* ── Server status indicator ── */
.server-status {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-left: auto;
  cursor: default;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
}

.status-offline .status-dot {
  background: var(--red);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .45; }
}

.status-label {
  font-size: .7rem;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
}

.server-status {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: 2px;
}

/* ── Main layout ── */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
.main-content--expanded { max-width: 100% !important; padding-left: 1.5rem; padding-right: 1.5rem; }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 3rem 1rem 1rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

.hero-sub {
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-tagline {
  display: inline-block;
  margin-top: .5rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--indigo-dark);
  background: var(--indigo-light);
  border: 1px solid #b8d4a8;
  border-radius: 99px;
  padding: .25rem 1rem;
  letter-spacing: .02em;
}

/* ── Dashboard grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card-link {
  display: block;
  transition: box-shadow .15s, border-color .15s, transform .1s;
}

.card-link:hover {
  border-color: var(--indigo);
  box-shadow: 0 4px 12px rgba(58,107,42,.15);
  transform: translateY(-1px);
}

.card-icon {
  font-size: 1.75rem;
  margin-bottom: .75rem;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: .4rem;
}

.card p {
  color: var(--muted);
  font-size: .9rem;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: .4rem;
}

.page-header p {
  color: var(--muted);
}

.back-link {
  display: inline-block;
  color: var(--indigo-dark);
  font-size: .875rem;
  margin-bottom: .75rem;
}

.back-link:hover { text-decoration: underline; }

/* ── Company grid ── */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.company-card { display: flex; flex-direction: column; gap: .5rem; }
.company-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.card-top-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; flex-shrink: 0;
}
.card-live-price {
  font-size: 1rem; font-weight: 700; color: var(--forest); white-space: nowrap;
}
.card-score-badge {
  display: flex; flex-direction: column; align-items: center;
  padding: .3rem .55rem; border-radius: 8px; flex-shrink: 0;
}
.card-score-label { font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .75; }
.card-score-value { font-size: 1rem; font-weight: 800; line-height: 1.1; }
.card-score-badge.score-strong  { background: rgba(34,197,94,.15);  color: #16a34a;  border: 1px solid rgba(34,197,94,.35);  }
.card-score-badge.score-watch   { background: rgba(234,179,8,.15);  color: #a16207;  border: 1px solid rgba(234,179,8,.35);  }
.card-score-badge.score-caution { background: rgba(249,115,22,.15); color: #c2410c;  border: 1px solid rgba(249,115,22,.35); }
.card-score-badge.score-avoid   { background: rgba(239,68,68,.15);  color: #b91c1c;  border: 1px solid rgba(239,68,68,.35);  }

.company-ticker {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--indigo-dark);
}

.company-name { font-weight: 600; }

.company-desc {
  color: var(--muted);
  font-size: .875rem;
  margin-top: .25rem;
}

.company-title-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: .5rem;
}

.company-ticker-lg {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--indigo-dark);
}

/* ── Badge ── */
.badge {
  display: inline-block;
  background: var(--indigo-light);
  color: var(--indigo-dark);
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 99px;
}

/* ── 5+2 Framework ── */
.framework-section { display: flex; flex-direction: column; gap: .75rem; }

/* ── Fundamental Score ─────────────────────────────────────────────────── */
.score-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.score-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.score-title { font-size: 1.25rem; font-weight: 700; margin: 0 0 .25rem; }
.score-subtitle { font-size: .8rem; color: var(--muted); margin: 0; }
.score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 80px;
  padding: .75rem 1.25rem;
  border-radius: 10px;
  flex-shrink: 0;
}
.score-badge.score-strong  { background: rgba(34,197,94,.15);  border: 1px solid rgba(34,197,94,.4);  }
.score-badge.score-watch   { background: rgba(234,179,8,.15);  border: 1px solid rgba(234,179,8,.4);  }
.score-badge.score-caution { background: rgba(249,115,22,.15); border: 1px solid rgba(249,115,22,.4); }
.score-badge.score-avoid   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.4);  }
.score-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}
.score-badge.score-strong  .score-number { color: #22c55e; }
.score-badge.score-watch   .score-number { color: #eab308; }
.score-badge.score-caution .score-number { color: #f97316; }
.score-badge.score-avoid   .score-number { color: #ef4444; }
.score-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: .2rem; }

.score-body {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.score-dimensions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  min-width: 0;
}
.dim-row { display: flex; flex-direction: column; gap: .25rem; }
.dim-top {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.dim-label { font-size: .85rem; font-weight: 600; color: var(--text); flex: 1; }
.dim-weight { font-size: .72rem; color: var(--muted); }
.dim-score {
  font-size: .85rem;
  font-weight: 700;
  min-width: 2.2rem;
  text-align: right;
}
.dim-score.score-strong  { color: #22c55e; }
.dim-score.score-watch   { color: #eab308; }
.dim-score.score-caution { color: #f97316; }
.dim-score.score-avoid   { color: #ef4444; }
.dim-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.dim-bar { height: 100%; border-radius: 2px; }
.dim-bar.bar-strong  { background: #22c55e; }
.dim-bar.bar-watch   { background: #eab308; }
.dim-bar.bar-caution { background: #f97316; }
.dim-bar.bar-avoid   { background: #ef4444; }
.dim-rationale { font-size: .75rem; color: var(--text); opacity: .8; line-height: 1.4; margin: 0 0 .4rem; }

.sub-scores {
  border-top: 1px solid var(--border);
  padding-top: .5rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.sub-score-row {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.sub-score-name  { font-size: .72rem; font-weight: 600; color: var(--text); min-width: 7rem; }
.sub-score-weight { font-size: .68rem; color: var(--muted); min-width: 2.2rem; }
.sub-bar-track   { flex: 1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.sub-bar         { height: 100%; border-radius: 2px; }
.sub-score-val   { font-size: .72rem; font-weight: 700; min-width: 1.8rem; text-align: right; }
.sub-score-note  { font-size: .68rem; color: var(--muted); line-height: 1.35; margin: .1rem 0 .4rem 7.6rem; }

@media (max-width: 700px) {
  .score-body { flex-direction: column; }
  #radarChart { max-width: 100% !important; height: 300px !important; }
}

.section-band {
  padding: .5rem 1rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  margin-top: .5rem;
}

.section-band.objective { background: var(--indigo-light); color: var(--indigo-dark); }
.section-band.subjective { background: var(--amber-light); color: var(--amber-dark); }

.step-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--surface);
  border: 1.5px solid #b8d4a8;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  padding-left: 1rem;
}

.step-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--indigo);
}

.step-card.bull { border-color: var(--green-light); }
.step-card.bull::before { background: var(--green); }

.step-card.bear { border-color: var(--red-light); }
.step-card.bear::before { background: var(--red); }

.step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--indigo);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.step-num.bull { background: var(--green); }
.step-num.bear { background: var(--red); }

.step-body { flex: 1; }
.step-body h3 { font-size: 1rem; font-weight: 600; margin-bottom: .4rem; }
.step-body p { font-size: .9rem; color: var(--muted); margin-bottom: .25rem; }
.step-body ul { font-size: .9rem; color: var(--muted); }

.step-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

/* ── Metrics ── */
.metrics-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: .5rem;
}

.metric {
  display: flex;
  flex-direction: column;
  min-width: 90px;
}

.metric-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.metric-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

/* ── Knowledge Base ── */
.kb-nav {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.kb-nav-item {
  padding: .35rem .85rem;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}

.kb-nav-item:hover {
  background: var(--indigo-light);
  border-color: var(--indigo);
  color: var(--forest);
}

.kb-section { margin-bottom: 3rem; }
.kb-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); }

.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.concept-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.concept-header {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .5rem;
}

.concept-term { font-weight: 700; font-size: 1rem; }

.concept-symbol {
  font-size: 1.1rem;
  color: var(--indigo-dark);
  font-weight: 600;
}

.concept-def {
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: .5rem;
}

.concept-example {
  font-size: .825rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 4px;
  padding: .5rem .6rem;
}

/* ── Moneyness overview ── */
.moneyness-overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem 1rem;
  margin-bottom: .25rem;
}

.moneyness-overview-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .75rem;
}

.moneyness-overview-svg {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ITM/ATM/OTM symbol circle color overrides */
.moneyness-symbol-1 { background: rgba(99,102,241,.15); border-color: #6366f1; color: #6366f1; font-size: 1rem !important; }
.moneyness-symbol-2 { background: rgba(245,158,11,.15); border-color: #f59e0b; color: #b45309; font-size: 1rem !important; }
.moneyness-symbol-3 { background: rgba(244,63,94,.12); border-color: #f43f5e; color: #e11d48; font-size: 1rem !important; }

/* ── Greeks rich layout ── */
.greeks-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.greek-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  overflow: hidden;
}

.greek-left {
  padding: 1.5rem 1.6rem;
  border-right: 1px solid var(--border);
}

.greek-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.greek-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--indigo-light);
  border: 1px solid var(--indigo);
  color: var(--indigo-dark);
  font-size: 1.4rem;
  font-weight: 700;
  flex-shrink: 0;
}

.greek-term {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--forest);
}

.greek-def {
  font-size: .9rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: .75rem;
}

.greek-detail {
  font-size: .85rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: .85rem;
}

.greek-tip {
  font-size: .83rem;
  line-height: 1.55;
  background: rgba(99,102,241,.07);
  border-left: 3px solid var(--indigo);
  border-radius: 0 4px 4px 0;
  padding: .6rem .85rem;
  margin-bottom: .75rem;
  color: var(--text);
}

.tip-label {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--indigo-dark);
  margin-right: .4rem;
}

.greek-example {
  font-size: .82rem;
  line-height: 1.55;
  background: var(--bg);
  border-radius: 4px;
  padding: .55rem .75rem;
  color: var(--muted);
}

.example-label {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-right: .4rem;
}

.greek-right {
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.greek-svg {
  width: 100%;
  max-width: 290px;
  height: auto;
}

.svg-caption {
  font-size: .75rem;
  color: var(--muted);
  text-align: center;
  margin-top: .4rem;
  line-height: 1.4;
}

@media (max-width: 800px) {
  .greek-card {
    grid-template-columns: 1fr;
  }
  .greek-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ── Company meta row ── */
.company-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: .75rem;
}

.meta-item {
  font-size: .875rem;
  color: var(--text);
}

.meta-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-right: .25rem;
}

.badge-muted {
  background: #f1f5f9;
  color: var(--muted);
}

/* ── Valuation note ── */
.radar-dim-tag {
  font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  background: rgba(99,102,241,.12); color: #6366f1; border: 1px solid rgba(99,102,241,.3);
  border-radius: 4px; padding: .15rem .4rem; vertical-align: middle;
}

/* ── Step score integration row ── */
.step-dim-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .6rem;
}
.step-dim-weight { font-size: .72rem; color: var(--muted); }
.step-dim-score  { font-size: .85rem; font-weight: 700; padding: .1rem .45rem; border-radius: 4px; }

/* ── Collapsible sub-scores ── */
.sub-scores-detail {
  margin: 0 0 .75rem;
}
.sub-scores-detail summary {
  cursor: pointer;
  font-size: .78rem;
  font-weight: 600;
  color: var(--indigo);
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem 0;
}
.sub-scores-detail summary::-webkit-details-marker { display: none; }
.sub-scores-detail summary::before {
  content: '▶';
  font-size: .6rem;
  transition: transform .15s;
  display: inline-block;
}
.sub-scores-detail[open] summary::before { transform: rotate(90deg); }
.sub-scores-detail .sub-scores { margin-top: .5rem; }

.valuation-note {
  font-size: .875rem;
  color: var(--muted);
  background: var(--bg);
  border-left: 3px solid var(--indigo);
  padding: .5rem .75rem;
  border-radius: 0 4px 4px 0;
  margin-top: .5rem;
  border-color: var(--gold);
}

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

/* ── Framework reference page ── */
.fw-dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .6rem;
  margin-bottom: .5rem;
}
.fw-dim-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .8rem;
  box-shadow: var(--shadow);
}
.fw-dim-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .2rem; }
.fw-dim-name { font-size: .82rem; font-weight: 700; color: var(--text); }
.fw-dim-weight { font-size: .75rem; font-weight: 700; color: var(--indigo); background: var(--indigo-light); padding: .1rem .35rem; border-radius: 3px; }
.fw-dim-subs { font-size: .7rem; color: var(--muted); line-height: 1.4; margin: 0; }

.fw-step-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; margin-bottom: .4rem; }
.fw-step-tag { font-size: .68rem; font-weight: 600; color: var(--indigo-dark); background: var(--indigo-light); border-radius: 4px; padding: .15rem .45rem; }

.fw-rubric-table { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.fw-rubric-row { display: grid; grid-template-columns: 9.5rem 2.5rem 1fr; gap: .5rem; align-items: baseline; }
.fw-rubric-name { font-size: .72rem; font-weight: 700; color: var(--text); }
.fw-rubric-weight { font-size: .68rem; color: var(--muted); }
.fw-rubric-desc { font-size: .68rem; color: var(--muted); line-height: 1.4; }

.fw-formula-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--indigo);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.fw-formula-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--indigo-dark); }
.fw-formula { font-size: .82rem; font-weight: 600; color: var(--text); font-family: monospace; }
.fw-formula-note { font-size: .7rem; color: var(--muted); }

/* ── Scorecard Comparison Table ── */
.comp-section { margin-top: 2.5rem; }
.comp-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
.comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  background: var(--card);
}
.comp-table thead th {
  background: var(--surface);
  padding: .55rem .7rem;
  text-align: center;
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--indigo-dark);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.comp-table thead th.comp-metric-col { text-align: left; min-width: 150px; }
.comp-table thead th.comp-wt-col { min-width: 36px; color: var(--muted); font-weight: 600; }
.comp-table thead th.comp-co-col { min-width: 72px; }
.comp-table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.comp-table tbody tr:hover { background: rgba(99,102,241,.04); }
.comp-meta-row { background: rgba(0,0,0,.015); }
.comp-meta-row td { padding: .4rem .7rem; }
.comp-meta-val { text-align: center; color: var(--muted); font-size: .78rem; }
.comp-fscore-row td { padding: .55rem .7rem; background: rgba(99,102,241,.06); }
.comp-dim-row td { padding: .42rem .7rem; }
.comp-metric-name { text-align: left; font-weight: 600; color: var(--text); white-space: nowrap; }
.comp-fscore-label { font-weight: 800; font-size: .84rem; color: var(--indigo-dark); }
.comp-dim-label { display: block; }
.comp-dim-weight { font-size: .68rem; color: var(--muted); font-weight: 500; }
.comp-sub-name { font-weight: 500; font-size: .78rem; color: var(--text); white-space: nowrap; }
.comp-wt-val { text-align: center; color: var(--muted); font-size: .72rem; padding: .38rem .5rem; }
.comp-score-cell {
  text-align: center;
  font-weight: 700;
  font-size: .82rem;
  padding: .42rem .5rem;
  border-left: 1px solid var(--border);
}
.comp-score-cell.score-strong  { background: rgba(34,197,94,.12);  color: #15803d; }
.comp-score-cell.score-watch   { background: rgba(234,179,8,.12);  color: #92400e; }
.comp-score-cell.score-caution { background: rgba(249,115,22,.12); color: #9a3412; }
.comp-score-cell.score-avoid   { background: rgba(239,68,68,.12);  color: #991b1b; }
.comp-score-cell.red-flag   { background: rgba(220,38,38,.18);  color: #7f1d1d; border: 1.5px solid rgba(220,38,38,.5); font-weight: 800; }
.comp-score-cell.comp-fscore-cell { font-size: .92rem; font-weight: 800; }
.comp-co-name { font-weight: 800; font-size: .82rem; color: var(--indigo-dark); }
.comp-co-date { font-size: .66rem; color: var(--muted); margin-top: .15rem; white-space: nowrap; }
.comp-sub-table { font-size: .78rem; }
.comp-sub-table .comp-score-cell { font-size: .78rem; font-weight: 600; }
.comp-dim-header-row td { background: var(--surface); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--indigo-dark); padding: .4rem .7rem; }
.comp-legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .6rem; font-size: .72rem; color: var(--muted); align-items: center; }
.comp-legend-item { display: flex; align-items: center; gap: .3rem; }
.comp-legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.comp-flags-row td { padding: .45rem .7rem; background: rgba(220,38,38,.05); border-bottom: 2px solid rgba(220,38,38,.2); }
.comp-flags-label { font-weight: 700; font-size: .8rem; color: #b91c1c; }
.comp-flags-cell { text-align: center; font-weight: 700; font-size: .8rem; border-left: 1px solid var(--border); }
.comp-flags-cell.has-flags { color: #b91c1c; background: rgba(220,38,38,.1); }
.comp-flags-cell:not(.has-flags) { color: #15803d; }
.comp-hardmetric-header td { background: var(--surface); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .35rem .7rem; border-top: 2px solid var(--border); }
.comp-hardmetric-row td { padding: .38rem .7rem; }
.comp-threshold { font-size: .65rem; color: var(--muted); font-weight: 400; margin-left: .3rem; }
.comp-flag-ticker { padding: .38rem .7rem; font-weight: 800; font-size: .8rem; color: var(--indigo-dark); white-space: nowrap; }
.comp-flag-dim { padding: .38rem .7rem; font-size: .75rem; color: var(--muted); white-space: nowrap; }
.comp-flag-name { padding: .38rem .7rem; font-size: .78rem; font-weight: 500; color: var(--text); }

/* ── Detail page red flags ── */
.rf-callout { background: rgba(220,38,38,.06); border: 1.5px solid rgba(220,38,38,.3); border-radius: 8px; padding: .75rem 1rem; margin-top: 1rem; }
.rf-callout-title { font-size: .78rem; font-weight: 800; color: #b91c1c; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .5rem; }
.rf-callout-items { display: flex; flex-direction: column; gap: .3rem; }
.rf-callout-item { display: flex; align-items: baseline; gap: .5rem; font-size: .78rem; }
.rf-item-dim { color: var(--muted); font-size: .72rem; min-width: 100px; }
.rf-item-name { color: var(--text); font-weight: 600; flex: 1; }
.rf-item-val { font-weight: 800; color: #b91c1c; font-size: .82rem; }
.rf-dim-badge { font-size: .65rem; font-weight: 700; color: #b91c1c; background: rgba(220,38,38,.12); border: 1px solid rgba(220,38,38,.3); border-radius: 4px; padding: .1rem .4rem; margin-left: .4rem; }
.sub-score-row.rf-row { background: rgba(220,38,38,.04); border-radius: 4px; }
.sub-score-val.red-flag { color: #b91c1c; font-weight: 800; }
.rf-metric-val { color: #b91c1c !important; font-weight: 800 !important; }
.rf-metric-val::before { content: "⚠ "; }

/* ── Refresh Financials ── */
.refresh-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .75rem; border-radius: 6px; border: 1.5px solid var(--indigo);
  background: var(--card); color: var(--indigo-dark); font-size: .75rem;
  font-weight: 700; cursor: pointer; transition: background .15s, color .15s;
  margin-left: .5rem;
}
.refresh-btn:hover:not(:disabled) { background: var(--indigo); color: #fff; }
.refresh-btn:disabled { opacity: .55; cursor: not-allowed; }
.refresh-fresh  { font-size: .72rem; color: #15803d; font-weight: 600; }
.refresh-stale  { font-size: .72rem; color: #92400e; font-weight: 600; }
.refresh-never  { font-size: .72rem; color: #9ca3af; font-style: italic; }
.refresh-chip   { font-size: .67rem; font-weight: 600; padding: .1rem .4rem; border-radius: 4px; white-space: nowrap; }
.refresh-chip.refresh-fresh { background: rgba(34,197,94,.1); color: #15803d; border: 1px solid rgba(34,197,94,.3); }
.refresh-chip.refresh-never { background: rgba(156,163,175,.1); color: #6b7280; border: 1px solid rgba(156,163,175,.3); }
.company-card-bottom { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .35rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { display: inline-block; animation: spin .8s linear infinite; }

/* ── Tools ── */
.tools-list { display: flex; flex-direction: column; gap: 1.5rem; }

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tool-header h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .25rem; }
.tool-desc { color: var(--muted); font-size: .875rem; }

.tool-form { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }

.tool-params { display: flex; gap: 1rem; flex-wrap: wrap; }

.param-group { display: flex; flex-direction: column; gap: .3rem; }

.param-group label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.param-group input {
  padding: .45rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  width: 160px;
  transition: border-color .15s;
}

.param-group input:focus {
  outline: none;
  border-color: var(--indigo);
}

.btn {
  padding: .45rem 1.1rem;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
}

.btn:hover { opacity: .85; }

.btn-primary {
  background: var(--indigo);
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--indigo-dark);
  border: 1.5px solid var(--indigo);
}

.tool-result {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.result-loading { color: var(--muted); font-style: italic; }

/* ── Progress log (SSE streaming) ── */
.progress-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .6rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
}

.progress-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--indigo-light);
  border-top-color: var(--indigo-dark);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

.progress-log {
  background: #1e1e2e;
  color: #cdd6f4;
  font-family: "Consolas", "Cascadia Code", monospace;
  font-size: .78rem;
  line-height: 1.55;
  border-radius: 6px;
  padding: .75rem 1rem;
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: .75rem;
}

.progress-line { padding: .05rem 0; }

.progress-line:last-child { color: #a6e3a1; } /* highlight latest line */

.progress-result { margin-top: .5rem; }

.result-error {
  color: var(--red);
  background: var(--red-light);
  border-radius: 6px;
  padding: .75rem 1rem;
  font-size: .875rem;
}

.result-error pre { margin-top: .5rem; white-space: pre-wrap; font-size: .8rem; }

.result-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}

.result-metric { display: flex; flex-direction: column; }

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.result-table th {
  text-align: left;
  padding: .5rem .75rem;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.result-table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--bg);
}

.result-table tr:last-child td { border-bottom: none; }
.result-table tr:hover td { background: var(--bg); }

/* ── Plotly chart container ── */
.plotly-chart {
  width: 100%;
  min-height: 420px;
  margin-top: .75rem;
}

/* ── KPI ── */
.kpi-header { display:flex; align-items:baseline; gap:1rem; margin-bottom:.75rem; }
.kpi-symbol { font-size:1.6rem; font-weight:800; color:var(--indigo-dark); }
.kpi-meta   { font-size:.8rem; color:var(--muted); }

.kpi-change-alert {
  background:var(--amber-light); color:var(--amber-dark);
  border-left:4px solid #f59e0b;
  padding:.5rem .85rem; border-radius:0 6px 6px 0;
  font-size:.875rem; font-weight:600; margin-bottom:.85rem;
}
.kpi-change-alert ul { margin:.2rem 0 0 1rem; font-weight:400; }
.kpi-no-change {
  background:var(--green-light); color:#065f46;
  border-left:4px solid var(--green);
  padding:.4rem .85rem; border-radius:0 6px 6px 0;
  font-size:.875rem; margin-bottom:.85rem;
}

.kpi-zones {
  display:flex; gap:1.5rem; flex-wrap:wrap;
  margin-bottom:1.1rem;
}
.kpi-zone-block { display:flex; flex-direction:column; gap:.3rem; }
.kpi-zone-label { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); }
.kpi-zone-prev  { font-size:.75rem; color:var(--muted); }

/* Trend badges */
.kpi-trend-badge {
  display:inline-block; padding:.2rem .65rem;
  border-radius:99px; font-size:.82rem; font-weight:700;
}
.kpi-trend-green  { background:#d1fae5; color:#065f46; }
.kpi-trend-red    { background:var(--red-light); color:#991b1b; }
.kpi-trend-yellow { background:var(--amber-light); color:var(--amber-dark); }
.kpi-trend-bright { background:#f8fafc; color:#111827; border:1px solid #e2e8f0; }
.kpi-trend-dark   { background:#111827; color:#f9fafb; }
.kpi-trend-grey   { background:#6b7280; color:#d1d5db; }

.kpi-grid {
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap:1rem;
}
.kpi-section h4 {
  font-size:.8rem; font-weight:700; text-transform:uppercase;
  letter-spacing:.04em; color:var(--muted);
  margin-bottom:.4rem; padding-bottom:.3rem;
  border-bottom:1px solid var(--border);
}

/* ── Gap badges ── */
.gap-badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.gap-up   { background: var(--green-light); color: #065f46; }
.gap-down { background: var(--red-light);   color: #991b1b; }
.gap-none { color: var(--muted); }
.gap-na   { color: var(--muted); font-style: italic; }

/* ── Watchlist table ── */
.watchlist-table td, .watchlist-table th { padding: .35rem .6rem; white-space: nowrap; }
.watchlist-table .kpi-trend-badge { font-size: .75rem; padding: .15rem .5rem; }

/* Sort button in watchlist headers */
.wl-sort-btn {
  background: none; border: none; cursor: pointer;
  font-size: .7rem; opacity: .35; padding: 0 .1rem;
  color: inherit; vertical-align: middle; line-height: 1;
  transition: opacity .15s;
}
.wl-sort-btn:hover { opacity: 1; }

/* ── 52-week range bar ── */
.range-bar-wrap {
  display: flex; align-items: center; gap: .4rem; min-width: 160px;
}
.range-label {
  font-size: .72rem; color: var(--muted); white-space: nowrap; min-width: 2.8rem;
}
.range-label:last-child { text-align: right; }
.range-track {
  position: relative; flex: 1; height: 5px;
  background: var(--border); border-radius: 99px; overflow: visible;
}
.range-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--indigo); border-radius: 99px;
  pointer-events: none;
}
.range-dot {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 11px; height: 11px; border-radius: 50%;
  background: #fff; border: 2px solid var(--indigo);
  box-shadow: 0 0 0 1px rgba(58,107,42,.3);
}

/* ── Annualized ROC calculator ── */
.roc-calc { display: flex; flex-direction: column; gap: .3rem; min-width: 160px; }
.roc-inputs { display: flex; gap: .3rem; }
.roc-input {
  width: 68px; padding: .2rem .35rem; font-size: .75rem;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text);
  -moz-appearance: textfield;
}
.roc-input::-webkit-outer-spin-button,
.roc-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.roc-input:focus { outline: none; border-color: var(--indigo-dark); }
.roc-result { font-size: .85rem; padding-left: .1rem; min-height: 1.1rem; }

/* ── Valuation bar ── */
.val-bar-wrap { flex-direction: column; gap: .15rem; min-width: 200px; }
.val-labels {
  position: relative; width: 100%; height: 1rem;
  font-size: .68rem; color: var(--muted);
}
.val-label-bear { position: absolute; left: 0; }
.val-label-bull { position: absolute; right: 0; }
.val-label-base {
  position: absolute; transform: translateX(-50%);
  color: #92400e; font-weight: 600; white-space: nowrap;
}
.val-bar-wrap .range-track { margin-top: .1rem; }
.val-base-tick {
  position: absolute; top: -3px; bottom: -3px;
  width: 2px; background: #f59e0b;
  transform: translateX(-50%);
  border-radius: 2px;
}

.result-json {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  font-size: .8rem;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* ── Utilities ── */
.muted { color: var(--muted); }
.empty-state { color: var(--muted); font-style: italic; }

code {
  font-family: monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: .1rem .35rem;
  border-radius: 4px;
  font-size: .85rem;
}

@media (max-width: 600px) {
  .step-row { grid-template-columns: 1fr; }
  .company-title-row { flex-direction: column; align-items: flex-start; }
}

/* ── Fear & Greed Index ── */
.fng-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.fng-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 320px;
}

.fng-badge {
  margin-top: .4rem;
  padding: .3rem 1.1rem;
  border-radius: 999px;
  border: 2px solid #6b7280;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .03em;
  transition: color .3s, border-color .3s, background .3s;
}

.fng-ts {
  margin-top: .35rem;
  font-size: .78rem;
  color: var(--muted);
}

.fng-spark-wrap {
  flex: 1;
  min-width: 260px;
}

.fng-spark-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: .3rem;
}

.fng-error {
  color: var(--red);
  font-size: .875rem;
  margin-top: .5rem;
}

/* ── AI Value Chain infographic ── */
.ai-chain-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow);
}

.ai-chain-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .25rem;
}

.ai-chain-subtitle {
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.ai-chain-wrap {
  display: flex;
  justify-content: center;
  overflow-x: auto;        /* scrollable on small screens */
}

.ai-chain-img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* ── Stock Info page ── */
.si-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.si-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .3rem;
}

.si-section-desc {
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.si-widget-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.si-ticker-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}

.si-ticker-input {
  flex: 1;
  max-width: 240px;
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .9rem;
  outline: none;
  transition: border-color .15s;
}

.si-ticker-input:focus { border-color: var(--indigo-dark); }

.si-ticker-btn {
  padding: .45rem 1.1rem;
  background: var(--indigo);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}

.si-ticker-btn:hover { background: var(--indigo-dark); }

/* ── Company toolbar (filter chips + add button) ─────────────────────────── */
.company-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.sector-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.sector-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.sector-chip:hover  { border-color: var(--indigo); color: var(--indigo); }
.sector-chip.active { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.chip-count {
  background: rgba(0,0,0,.12);
  border-radius: 999px;
  padding: .05rem .42rem;
  font-size: .72rem;
  font-weight: 700;
}
.sector-chip.active .chip-count { background: rgba(255,255,255,.25); }

.btn-add-company {
  flex-shrink: 0;
  padding: .4rem 1rem;
  background: var(--forest);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.btn-add-company:hover { background: #1a5c37; }

/* ── Add Company modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  width: min(560px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.6rem 1.8rem;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--muted);
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 6px;
  transition: background .15s;
}
.modal-close:hover { background: var(--bg); color: var(--dark); }

.modal-field { display: flex; flex-direction: column; gap: .4rem; }
.modal-field span { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.modal-field input {
  padding: .6rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  transition: border-color .15s;
  background: var(--bg);
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  letter-spacing: .08em;
}
.modal-field input:focus { outline: none; border-color: var(--indigo); background: #fff; }
.req { color: #ef4444; }

.modal-error {
  margin-top: .75rem;
  padding: .55rem .8rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  font-size: .85rem;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.2rem;
}
.btn-modal-cancel {
  padding: .5rem 1.1rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.btn-modal-cancel:hover { border-color: var(--dark); color: var(--dark); }
.btn-modal-submit {
  padding: .5rem 1.3rem;
  background: var(--indigo);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.btn-modal-submit:hover    { background: var(--indigo-dark); }
.btn-modal-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ── Scoring Reference Table ──────────────────────────────── */
.scoring-dim-block { }
.scoring-dim-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: .6rem .6rem 0 0;
  margin-bottom: 0;
}
.scoring-dim-name  { font-weight: 700; font-size: .95rem; color: var(--text); }
.scoring-dim-weight {
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 99px;
}
.table-wrapper { overflow-x: auto; }
.scoring-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 .6rem .6rem;
  overflow: hidden;
}
.scoring-table thead th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.scoring-table tbody tr { border-bottom: 1px solid var(--border); }
.scoring-table tbody tr:last-child { border-bottom: none; }
.scoring-table tbody tr:hover { background: var(--bg-secondary); }
.scoring-table td { padding: .55rem .75rem; color: var(--text); vertical-align: top; }
.scoring-table .text-center { text-align: center; font-weight: 700; color: var(--text-muted); }
.scoring-table .source-cell  { color: var(--text-muted); font-size: .78rem; }
.scoring-table .rubric-cell  { color: var(--text); line-height: 1.5; }

/* ── Source-type badges ───────────────────────────────────── */
.src-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .15rem .45rem;
  border-radius: 99px;
  white-space: nowrap;
}
.src-auto   { background: #d1fae5; color: #065f46; }
.src-manual { background: #fef3c7; color: #92400e; }
.src-mixed  { background: #ede9fe; color: #5b21b6; }

/* ── Admin nav tab ────────────────────────────────────────── */
.tab-nav-spacer { flex: 1; }
.admin-tab { opacity: .55; font-size: .8rem !important; padding: .4rem .65rem !important; }
.admin-tab:hover { opacity: 1; }

/* ── Analyst Price Target Gauge ───────────────────────────────────── */
.price-gauge-wrap {
  margin: 1.25rem 0 .5rem;
}
.price-gauge-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--indigo-dark);
  margin-bottom: .65rem;
}
.price-gauge-track-wrap {
  padding: 0 4px;
}
.price-gauge-track {
  position: relative;
  height: 10px;
  background: #e5e7eb;
  border-radius: 6px;
  margin-bottom: 34px; /* space for tick labels */
}
/* coloured zones */
.gauge-zone {
  position: absolute;
  top: 0; height: 100%;
  border-radius: 3px;
  opacity: .75;
}
.gauge-zone-bear { background: linear-gradient(90deg, #ef4444, #f59e0b); }
.gauge-zone-bull { background: linear-gradient(90deg, #f59e0b, #22c55e); }

/* price markers (bear/base/bull) */
.gauge-marker {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
}
.gauge-marker-tick {
  width: 2px;
  height: 18px;
  background: #6b7280;
  margin: 0 auto;
}
.gauge-marker-label {
  font-size: .65rem;
  text-align: center;
  white-space: nowrap;
  line-height: 1.25;
  margin-top: 2px;
  color: #374151;
  font-weight: 600;
}
.gauge-label-bear { color: #ef4444; }
.gauge-label-base { color: #6366f1; }
.gauge-label-bull { color: #16a34a; }

/* current price needle */
.gauge-needle {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}
.gauge-needle-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  margin-top: -1px;
}
.gauge-needle-line {
  display: none; /* dot only, no line needed */
}
.gauge-needle-label {
  position: absolute;
  top: -22px;
  font-size: .68rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 1px 5px;
  border-radius: 4px;
  color: white;
}
.gauge-needle-bear  .gauge-needle-dot   { background: #ef4444; }
.gauge-needle-bear  .gauge-needle-label { background: #ef4444; }
.gauge-needle-mid   .gauge-needle-dot   { background: #f59e0b; }
.gauge-needle-mid   .gauge-needle-label { background: #f59e0b; }
.gauge-needle-bull  .gauge-needle-dot   { background: #16a34a; }
.gauge-needle-bull  .gauge-needle-label { background: #16a34a; }

.gauge-caption {
  font-size: .78rem;
  color: #4b5563;
  margin-top: .3rem;
}
