/* ── ROOT TOKENS ─────────────────────────────────────── */
:root {
  --font-body: 'Inter', sans-serif;
  --color-bg: #f8f9fb;
  --color-surface: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-text-faint: #9ca3af;
  --color-primary: #0f766e;
  --color-primary-hover: #0d6460;
  --color-primary-light: #f0faf9;
  --color-accent: #14b8a6;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-info: #2563eb;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* ── NAVBAR ──────────────────────────────────────────── */
#mainNav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 0;
  z-index: 1000;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 1rem;
}
.brand-icon-sm {
  width: 26px; height: 26px;
  font-size: 0.75rem;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.1;
  display: block;
}
.brand-sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-weight: 400;
  display: block;
  letter-spacing: 0.03em;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted) !important;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem !important;
  transition: all 0.18s ease;
}
.nav-link:hover {
  color: var(--color-primary) !important;
  background: var(--color-primary-light);
}
.nav-link.active {
  color: var(--color-primary) !important;
  background: var(--color-primary-light);
  font-weight: 600;
}

/* Search */
.nav-search { margin-left: 1rem; }
.search-wrapper {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  font-size: 0.85rem;
  pointer-events: none;
}
.search-input {
  padding-left: 2rem;
  border-radius: var(--radius-xl) !important;
  border: 1px solid var(--color-border) !important;
  background: var(--color-bg) !important;
  font-size: 0.85rem;
  width: 220px;
  transition: all 0.2s ease;
  box-shadow: none !important;
}
.search-input:focus {
  width: 280px;
  border-color: var(--color-accent) !important;
  background: white !important;
}

/* ── CARDS ───────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

/* ── KPI CARDS ───────────────────────────────────────── */
.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.kpi-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}
.kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.1;
}
.kpi-sub {
  font-size: 0.78rem;
  color: var(--color-text-faint);
  margin-top: 0.3rem;
}
.kpi-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.kpi-icon-teal  { background: #f0faf9; color: var(--color-primary); }
.kpi-icon-green { background: #f0fdf4; color: var(--color-success); }
.kpi-icon-amber { background: #fffbeb; color: var(--color-warning); }
.kpi-icon-red   { background: #fef2f2; color: var(--color-danger); }
.kpi-icon-blue  { background: #eff6ff; color: var(--color-info); }

/* ── BADGES ──────────────────────────────────────────── */
.badge-excellent { background:#dcfce7; color:#16a34a; }
.badge-good      { background:#dbeafe; color:#1d4ed8; }
.badge-average   { background:#fef9c3; color:#854d0e; }
.badge-weak      { background:#ffedd5; color:#c2410c; }
.badge-poor      { background:#fee2e2; color:#dc2626; }

.health-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-xl);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── PAGE HEADER ─────────────────────────────────────── */
.page-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 2rem 0 1.5rem;
  margin-bottom: 2rem;
}
.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}
.page-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* ── SECTION TITLE ───────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
  margin-left: 0.5rem;
}

/* ── TABLE ───────────────────────────────────────────── */
.table-clean th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  background: var(--color-bg);
}
.table-clean td {
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}
.table-clean tbody tr:hover {
  background: var(--color-primary-light);
}
.table-clean tbody tr:last-child td { border-bottom: none; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn-primary-custom {
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease;
}
.btn-primary-custom:hover { background: var(--color-primary-hover); }

.btn-outline-custom {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn-outline-custom:hover {
  background: var(--color-primary);
  color: white;
}

/* ── FOOTER ──────────────────────────────────────────── */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}
.footer-brand {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary);
}
.footer-sub {
  font-size: 0.78rem;
  color: var(--color-text-faint);
}
.footer-links a {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--color-primary); }
.footer-divider {
  border-color: var(--color-border);
  margin: 1rem 0 0.75rem;
}
.footer-copy {
  font-size: 0.78rem;
  color: var(--color-text-faint);
}

/* ── CHART CONTAINERS ────────────────────────────────── */
.chart-box {
  position: relative;
  width: 100%;
}
.chart-box canvas { width: 100% !important; }

/* ── UTILITIES ───────────────────────────────────────── */
.text-primary-custom { color: var(--color-primary) !important; }
.text-success-custom { color: var(--color-success) !important; }
.text-danger-custom  { color: var(--color-danger) !important; }
.text-warning-custom { color: var(--color-warning) !important; }
.text-muted-custom   { color: var(--color-text-muted) !important; }

.positive { color: var(--color-success); font-weight: 600; }
.negative { color: var(--color-danger); font-weight: 600; }

.divider { border-top: 1px solid var(--color-border); margin: 1.5rem 0; }


/* ── HOME PAGE ───────────────────────────────────────── */
.hero-section {
  background: linear-gradient(135deg, #f0faf9 0%, #f8f9fb 55%, #eff6ff 100%);
  border-bottom: 1px solid var(--color-border);
  padding: 2.5rem 0 2rem;
}
.hero-tag {
  font-size: 0.78rem; font-weight: 500;
  color: var(--color-text-muted); letter-spacing: 0.04em;
}
.hero-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800; line-height: 1.2; color: var(--color-text);
}
.hero-accent { color: var(--color-primary); }
.hero-desc {
  font-size: 0.95rem; color: var(--color-text-muted);
  max-width: 500px; line-height: 1.7;
}
.btn-hero-primary {
  display: inline-flex; align-items: center;
  background: var(--color-primary); color: white;
  padding: 0.6rem 1.4rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; text-decoration: none;
  transition: background 0.18s;
}
.btn-hero-primary:hover { background: var(--color-primary-hover); color: white; }
.btn-hero-outline {
  display: inline-flex; align-items: center;
  background: white; color: var(--color-primary);
  border: 1px solid var(--color-primary);
  padding: 0.6rem 1.4rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; text-decoration: none;
  transition: all 0.18s;
}
.btn-hero-outline:hover { background: var(--color-primary); color: white; }

/* Hero stat cards */
.hero-stats-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.hero-stat-card {
  background: white; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.hero-stat-card.accent { background: var(--color-primary); border-color: var(--color-primary); }
.hero-stat-card.accent .hero-stat-val,
.hero-stat-card.accent .hero-stat-lbl { color: white; }
.hero-stat-val { font-size: 1.5rem; font-weight: 700; color: var(--color-text); line-height: 1.1; }
.hero-stat-lbl { font-size: 0.75rem; color: var(--color-text-muted); margin-top: 0.2rem; }

/* Sector legend */
.sector-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; }
.legend-item { display: flex; align-items: center; gap: 0.35rem; font-size: 0.76rem; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-name { color: var(--color-text-muted); }
.legend-count { color: var(--color-text); font-weight: 600; margin-left: 0.1rem; }

/* Company list */
.company-list-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem; border-bottom: 1px solid var(--color-border);
  text-decoration: none; color: var(--color-text); transition: background 0.15s;
}
.company-list-item:last-child { border-bottom: none; }
.company-list-item:hover { background: var(--color-primary-light); }
.company-rank { font-size: 0.72rem; font-weight: 700; color: var(--color-text-faint); width: 16px; }
.company-symbol { font-size: 0.85rem; font-weight: 600; }
.company-sector { font-size: 0.72rem; color: var(--color-text-muted); }
.health-score-val { font-size: 0.85rem; font-weight: 700; }

/* Score bar */
.score-bar-bg { background:#e5e7eb; border-radius:99px; height:5px; width:70px; overflow:hidden; }
.score-bar-fill { background:var(--color-primary); height:100%; border-radius:99px; }
.score-text { font-size:0.78rem; font-weight:600; min-width:22px; }

/* Quick links */
.quick-links { display: flex; flex-direction: column; gap: 0.5rem; }
.quick-link-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.8rem 1rem; border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  text-decoration: none; color: var(--color-text); transition: all 0.18s;
}
.quick-link-item:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm); transform: translateX(3px);
}
.quick-link-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.quick-link-title { font-size: 0.85rem; font-weight: 600; }
.quick-link-sub { font-size: 0.73rem; color: var(--color-text-muted); }

.view-all-link {
  font-size: 0.78rem; color: var(--color-primary);
  text-decoration: none; font-weight: 500;
}
.view-all-link:hover { text-decoration: underline; }

@media (max-width: 576px) {
  .hero-title { font-size: 1.4rem; }
  .hero-desc { font-size: 0.875rem; }
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 991px) {
  .nav-search { margin: 0.75rem 0 0.5rem; }
  .search-input { width: 100% !important; }
  .search-input:focus { width: 100% !important; }
}
@media (max-width: 576px) {
  .kpi-value { font-size: 1.5rem; }
  .page-title { font-size: 1.3rem; }
}

/* ── COMPANIES PAGE ──────────────────────────────────── */
.page-header {
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.page-title {
  font-size: clamp(1.3rem, 2.5vw, 1.75rem);
  font-weight: 700;
}
.page-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Search */
.search-box {
  position: relative; display: flex; align-items: center;
}
.search-icon {
  position: absolute; left: 0.7rem;
  color: var(--color-text-muted); font-size: 0.85rem; pointer-events: none;
}
.search-input {
  padding: 0.5rem 0.9rem 0.5rem 2.2rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 0.875rem;
  width: 240px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.12);
}

/* View toggle */
.view-toggle {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.view-btn {
  padding: 0.5rem 0.75rem;
  background: white; border: none;
  color: var(--color-text-muted);
  font-size: 0.875rem; cursor: pointer;
  transition: all 0.15s;
}
.view-btn.active {
  background: var(--color-primary); color: white;
}
.view-btn:hover:not(.active) { background: var(--color-surface-offset); }

/* Filter bar */
.filter-bar {
  padding: 0.75rem 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.filter-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.filter-chip {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: white;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-chip.active, .filter-chip:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.filter-select {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 0.8rem;
  color: var(--color-text);
  cursor: pointer;
}
.filter-select:focus { outline: 2px solid var(--color-primary); }

/* Results count */
.results-count {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.clear-filters-btn {
  font-size: 0.78rem;
  color: var(--color-notification);
  background: none; border: none; cursor: pointer; padding: 0;
  display: flex; align-items: center;
}
.clear-filters-btn:hover { text-decoration: underline; }

/* Company grid */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  padding-top: 0.75rem;
}
.company-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  color: var(--color-text) !important;
  display: flex; flex-direction: column;
}
.company-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: color-mix(in oklch, var(--color-primary) 30%, var(--color-border));
}
.company-card-header {
  display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem;
}
.company-avatar {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.flex-1 { flex: 1; }
.overflow-hidden { overflow: hidden; }
.company-card-symbol {
  font-size: 0.78rem; font-weight: 700;
  color: var(--color-primary); letter-spacing: 0.03em;
}
.company-card-sector {
  font-size: 0.68rem; color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.company-card-name {
  font-size: 0.875rem; font-weight: 600; line-height: 1.3;
  color: var(--color-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.health-badge {
  font-size: 0.65rem; font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid;
  white-space: nowrap; letter-spacing: 0.04em;
}
.score-val { font-size: 1.1rem; font-weight: 700; }
.score-unit { font-size: 0.72rem; color: var(--color-text-muted); }
.rank-badge {
  font-size: 0.7rem; font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface-offset);
  padding: 0.15rem 0.5rem; border-radius: var(--radius-full);
}
.sector-tag {
  font-size: 0.72rem; font-weight: 500;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

/* Skeleton card */
.skeleton-card {
  background: white; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 1rem;
}
.sk-line { border-radius: var(--radius-sm); }

@media (max-width: 576px) {
  .search-input { width: 100%; }
  .company-grid { grid-template-columns: 1fr 1fr; }
  .filter-bar .ms-auto { margin-top: 0.5rem; }
}
@media (max-width: 400px) {
  .company-grid { grid-template-columns: 1fr; }
}

/* ── COMPANY DETAIL ──────────────────────────────────── */
.company-hero-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.5rem 0;
  margin-top: 0.5rem;
}
.co-avatar {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  font-size: 1.2rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.co-name        { font-size: clamp(1.1rem,2vw,1.5rem); font-weight:700; }
.co-symbol-badge{
  font-size:.72rem; font-weight:700; letter-spacing:.06em;
  background:var(--color-primary); color:white;
  padding:.15rem .5rem; border-radius:var(--radius-full);
}
.co-meta        { font-size:.8rem; color:var(--color-text-muted); }
.co-link        { color:var(--color-primary); font-size:.8rem; }
.co-rank-txt    { font-size:.72rem; color:var(--color-text-muted); }

/* Score ring */
.co-score-ring  { position:relative; width:56px; height:56px; margin-left:auto; }
.score-svg      { width:56px; height:56px; }
.score-ring-val {
  position:absolute; inset:0; display:flex; align-items:center;
  justify-content:center; font-size:.85rem; font-weight:800;
  color:var(--color-text);
}

/* Tabs */
.co-tabs        { display:flex; gap:0; border-top:1px solid var(--color-border); margin:0 -1.5rem; }
.co-tab         {
  padding:.7rem 1.25rem; font-size:.83rem; font-weight:500;
  color:var(--color-text-muted); border:none; background:none;
  border-bottom:2px solid transparent; cursor:pointer;
  transition:color .18s, border-color .18s;
}
.co-tab:hover   { color:var(--color-text); }
.co-tab.active  { color:var(--color-primary); border-bottom-color:var(--color-primary); }

/* Tab panels */
.tab-panel      { display:none; }
.tab-panel.active{ display:block; }

/* Financial tables */
.table-fin      { font-size:.82rem; }
.table-fin th   {
  font-size:.72rem; font-weight:600; text-transform:uppercase;
  letter-spacing:.05em; color:var(--color-text-muted);
  background:var(--color-surface-offset); padding:.6rem 1rem;
}
.table-fin td   { padding:.55rem 1rem; border-bottom:1px solid var(--color-border); }
.fin-row-label  { font-weight:500; color:var(--color-text); white-space:nowrap; }
.tabnum         { font-variant-numeric:tabular-nums; }
.fw-600         { font-weight:600; }

/* Score detail tiles */
.score-total-banner {
  border: 1px solid; border-radius:var(--radius-md);
  padding:.85rem 1rem; display:flex;
  justify-content:space-between; align-items:center;
}
.score-tiles-grid   { display:flex; flex-direction:column; gap:.75rem; }
.score-tile         {}
.score-tile-label   { font-size:.78rem; color:var(--color-text-muted); }
.score-tile-val     { font-size:.85rem; font-weight:700; }

/* Chart legend */
.chart-legend-dot { width:10px; height:10px; border-radius:50%; display:inline-block; }
.chart-legend-lbl { font-size:.75rem; color:var(--color-text-muted); }

/* Breadcrumb */
.breadcrumb-nav   { display:flex; align-items:center; gap:.35rem; font-size:.78rem; }
.breadcrumb-nav a { color:var(--color-text-muted); text-decoration:none; }
.breadcrumb-nav a:hover { color:var(--color-primary); }
.bc-sep           { color:var(--color-text-faint); }
.bc-current       { color:var(--color-text); font-weight:500; }

/* ── HEALTH SCORES PAGE ──────────────────────────────── */

/* Health label chips */
.hl-chip {
  display: inline-flex; align-items: center;
  padding: .3rem .85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: white; font-size: .78rem; font-weight: 500;
  color: var(--color-text-muted); cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.hl-chip .hl-count {
  margin-left: .35rem; font-size: .7rem;
  background: var(--color-bg);
  padding: .05rem .35rem; border-radius: 99px;
}
.hl-chip.active,
.hl-chip:hover          { background:var(--color-primary); color:white; border-color:var(--color-primary); }
.hl-chip.active .hl-count,
.hl-chip:hover .hl-count{ background:rgba(255,255,255,.25); }

.hl-chip.excellent.active { background:#16a34a; border-color:#16a34a; }
.hl-chip.good.active      { background:#2563eb; border-color:#2563eb; }
.hl-chip.average.active   { background:#d97706; border-color:#d97706; }
.hl-chip.weak.active      { background:#ea580c; border-color:#ea580c; }
.hl-chip.poor.active      { background:#dc2626; border-color:#dc2626; }

/* Top 3 spotlight cards */
.top3-card {
  display: block;
  background: white; border: 2px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  text-align: center; color: var(--color-text);
  transition: box-shadow .2s, transform .2s;
  overflow: hidden;    /* ← add this line */
}
.top3-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.top3-medal  { font-size: 2rem; line-height: 1; margin-bottom: .4rem; }
.top3-symbol { font-size: .8rem; font-weight: 700; color: var(--color-primary); letter-spacing: .05em; }
.top3-name   { font-size: .85rem; font-weight: 600; margin: .25rem 0 .1rem; line-height: 1.3;
               display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden; }
.top3-sector { font-size: .72rem; color: var(--color-text-muted); margin-bottom: .6rem; }
.top3-score  { font-size: 2.5rem; font-weight: 800; line-height: 1; }
.top3-score-lbl { font-size: .78rem; color: var(--color-text-muted); }

/* Component mini bars in top 3 */
/* ✅ NEW */
.mini-components {
  display: flex;
  gap: .3rem;
  overflow: hidden;       /* prevents overflow */
  width: 100%;
}
.mini-comp {
  flex: 1;
  min-width: 0;           /* allows flex children to shrink below content size */
  overflow: hidden;
}
.mini-comp-label {
  font-size: .58rem;
  color: var(--color-text-muted);
  margin-bottom: .2rem;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-comp-val {
  font-size: .62rem;
  font-weight: 600;
  text-align: center;
  margin-top: .2rem;
}
/* Rank cell */
.rank-cell  { display: flex; align-items: center; }
.rank-num   { font-size: .82rem; font-weight: 600; color: var(--color-text-muted); }
.rank-top   { color: var(--color-primary); font-weight: 800; font-size: .9rem; }

/* Score component list */
.component-list   { display: flex; flex-direction: column; }
.component-item   {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem 1rem; border-bottom: 1px solid var(--color-border);
}
.component-item:last-child { border-bottom: none; }
.component-dot    { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.component-name   { font-size: .8rem; font-weight: 600; }
.component-desc   { font-size: .7rem; color: var(--color-text-muted); }
.component-max    { margin-left: auto; font-size: .75rem; font-weight: 600;
                    color: var(--color-text-muted); white-space: nowrap; }

/* Positive / negative colors in table */
.positive { color: #16a34a; font-weight: 600; }
.negative { color: #dc2626; font-weight: 600; }

/* ── SECTORS PAGE ────────────────────────────────────── */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.sector-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  color: var(--color-text);
  display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .2s;
}
.sector-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.sector-card-top {
  display: flex; align-items: center; gap: .75rem;
  padding-left: .75rem;
}
.sector-icon-wrap {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.sector-card-name  { font-size: .9rem; font-weight: 700; line-height: 1.2; }
.sector-card-count { font-size: .72rem; color: var(--color-text-muted); }

.sector-metrics {
  display: flex; align-items: center;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: .6rem .75rem;
}
.sector-metric        { flex: 1; text-align: center; }
.sector-metric-val    { font-size: 1.05rem; font-weight: 700; line-height: 1.1; }
.sector-metric-lbl    { font-size: .68rem; color: var(--color-text-muted); margin-top: .15rem; }
.sector-metric-divider{
  width: 1px; height: 32px;
  background: var(--color-border); flex-shrink: 0; margin: 0 .5rem;
}

/* Empty state */
.empty-state {
  text-align: center; padding: 4rem 1rem;
  color: var(--color-text);
}

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

/* ── SECTOR DETAIL ─────────────────────────────────────── */
.sector-detail-dot {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 50%; flex-shrink: 0;
}

/* Grid wrapper */
.sd-grid-wrapper {
  padding: 1rem 1.5rem 4rem;
  width: 100%;
  box-sizing: border-box;
}

/* Grid */
.sd-company-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  width: 100%;
  box-sizing: border-box;
}
@media (max-width: 1200px) {
  .sd-company-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .sd-company-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .sd-company-grid { grid-template-columns: 1fr; }
}

/* Card */
.sd-company-card {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: var(--color-text);
  text-decoration: none;
  min-width: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .18s, transform .18s;
}
.sd-company-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--color-text);
}
.sd-company-card:visited { color: var(--color-text); }

/* Card header */
.sd-card-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  overflow: hidden;
}
.sd-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700;
  flex-shrink: 0;
}
.sd-card-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.sd-card-symbol {
  display: block;
  font-size: .68rem; font-weight: 700;
  color: var(--color-primary);
  letter-spacing: .06em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-card-name {
  display: block;
  font-size: .78rem; font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-rank-badge {
  font-size: .65rem; font-weight: 700;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: .1rem .4rem;
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}

/* Score row */
.sd-score-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}
.sd-score-lbl {
  font-size: .65rem;
  color: var(--color-text-muted);
  width: 34px;
  flex-shrink: 0;
}
.sd-score-num {
  font-size: .82rem; font-weight: 700;
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* Score bar */
.score-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 0;
}
.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width .4s ease;
}

/* Metrics */
.sd-metrics {
  display: flex;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: .4rem .2rem;
  gap: .1rem;
  min-width: 0;
}
.sd-metric {
  flex: 1;
  text-align: center;
  min-width: 0;
  overflow: hidden;
}
.sd-metric-val {
  display: block;
  font-size: .75rem; font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-metric-lbl {
  display: block;
  font-size: .57rem;
  color: var(--color-text-muted);
  margin-top: .1rem;
}
.sd-metric-val.positive { color: var(--color-success, #16a34a); }
.sd-metric-val.negative { color: var(--color-error,   #dc2626); }

/* ── Footer — THE KEY FIX ─────────────────────────────── */
.sd-card-footer {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding-top: .5rem;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
  min-width: 0;
  overflow: hidden;
  flex-wrap: nowrap;      /* ← NEVER wrap to second line */
}

/* Health badge — constrained width with ellipsis if needed */
.health-badge {
  display: inline-flex;
  align-items: center;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .15rem .4rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
  flex-shrink: 1;          /* ← allowed to shrink if space is tight */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 5.5rem;       /* ← cap badge width so it never dominates */
}

/* Website link — hide on narrow cards to protect layout */
.sd-website-link {
  font-size: .65rem;
  color: var(--color-text-muted);
  text-decoration: none;
  display: flex; align-items: center; gap: .15rem;
  white-space: nowrap;
  flex-shrink: 0;
  overflow: hidden;
}
.sd-website-link:hover { color: var(--color-primary); }

/* View details — always pinned right */
.sd-view-link {
  font-size: .65rem; font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}