:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef2ff;
  --accent-line: #c7d2fe;
  --thead: #f8fafc;
  --row-hover: #f8faff;
  --tabbar: #e9edf5;
  --header-bg: rgba(255, 255, 255, .82);
  --glow-1: rgba(124, 58, 237, .07);
  --glow-2: rgba(79, 70, 229, .08);
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 28px -8px rgba(15, 23, 42, .14);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --card: #131c31;
  --ink: #e2e8f0;
  --muted: #8b98ad;
  --line: #22304a;
  --accent: #818cf8;
  --accent-2: #a78bfa;
  --accent-soft: rgba(129, 140, 248, .12);
  --accent-line: rgba(129, 140, 248, .32);
  --thead: #182239;
  --row-hover: #182238;
  --tabbar: #182238;
  --header-bg: rgba(11, 17, 32, .82);
  --glow-1: rgba(124, 58, 237, .16);
  --glow-2: rgba(79, 70, 229, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, .45), 0 2px 4px -2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 28px -8px rgba(0, 0, 0, .55);
}
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; padding: 9px 12px; line-height: 0; }
.theme-toggle svg { width: 17px; height: 17px; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: inline; }
[data-theme="dark"] .icon-moon { display: none; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.6;
  background:
    radial-gradient(1200px 480px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(1000px 420px at 5% -8%, var(--glow-2), transparent 60%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}
main { flex: 1 0 auto; width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 20px; }
h1 {
  font-size: clamp(1.15rem, 1rem + 1vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.25;
  margin: 0;
}
h2 { font-size: 1.12rem; font-weight: 700; letter-spacing: -.015em; }
#metaLine { margin: 4px 0 0; font-size: .85rem; font-weight: 500; }
.muted { color: var(--muted); }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 52px 0 10px; }
.hero > * { animation: hero-rise .6s cubic-bezier(.2, .7, .3, 1) both; }
.hero > *:nth-child(2) { animation-delay: .08s; }
.hero > *:nth-child(3) { animation-delay: .16s; }
@keyframes hero-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hero > * { animation: none; }
}
.hero-eyebrow {
  display: inline-block;
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hero-title {
  font-size: clamp(2.1rem, 1.3rem + 4.5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.08;
  margin: 18px auto 14px;
  max-width: 20ch;
}
.hero-title .grad {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  color: var(--muted);
  max-width: 58ch;
  margin: 0 auto;
  font-size: clamp(.95rem, .88rem + .4vw, 1.08rem);
}

/* ---------- SEO links ---------- */
.seo-links { margin: 22px 0 0; }
.seo-links h2 { font-size: 1rem; margin: 0 0 10px; }
.seo-links ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.seo-links a {
  display: inline-block;
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--accent);
  text-decoration: none;
  font-size: .84rem;
  font-weight: 500;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.seo-links a:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }

/* ---------- Buttons ---------- */
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: 0 2px 8px -2px rgba(79, 70, 229, .45);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px -2px rgba(79, 70, 229, .5); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-ghost {
  background: var(--card);
  color: var(--accent);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Stat cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0; }
.cards.two { grid-template-columns: repeat(4, 1fr); max-width: 900px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-label {
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.card-value {
  font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.card-sub { font-size: .8rem; color: var(--muted); }

/* ---------- Charts ---------- */
.charts { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.chart-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.chart-box h2 { font-size: .92rem; margin: 0 0 10px; color: var(--ink); }

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex;
  gap: 4px;
  margin: 10px 0 16px;
  padding: 4px;
  background: var(--tabbar);
  border-radius: 999px;
  max-width: 100%;
}
.tab {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.toolbar input, .toolbar select {
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.toolbar input:focus, .toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.toolbar input { flex: 1; min-width: 200px; }

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: .9rem; table-layout: fixed; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: break-word; }
thead th:nth-child(1), tbody td:nth-child(1) { width: 38%; }
thead th:nth-child(2), tbody td:nth-child(2) { width: 27%; }
thead th:nth-child(3), tbody td:nth-child(3) { width: 13%; white-space: nowrap; }
thead th:nth-child(4), tbody td:nth-child(4) { width: 22%; }
thead th {
  background: var(--thead);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
.tier {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 14px 0 24px; }
.pagination button {
  font: inherit;
  font-size: .86rem;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 9px;
  padding: 7px 11px;
  cursor: pointer;
  min-width: 38px;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.pagination button:hover:not(:disabled):not(.active) { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.pagination button:disabled { opacity: .4; cursor: default; }
.pagination .page-info { margin-left: auto; color: var(--muted); font-size: .84rem; }

/* ---------- Companies grid ---------- */
.co-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.co-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.co-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.co-card h3 { margin: 0 0 4px; font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.co-card .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: .85rem;
  color: var(--muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.co-card .row strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.co-card .row:first-of-type { border-top: 0; }
.co-card button { margin-top: 12px; }

/* ---------- Footer / misc ---------- */
.backlink { margin: 14px 0 24px; }
.backlink a { color: var(--accent); text-decoration: none; font-weight: 500; }
.backlink a:hover { text-decoration: underline; }
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 22px 0 30px;
  margin-top: 32px;
  flex-shrink: 0;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
}
.footer { padding-bottom: 28px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cards.two { grid-template-columns: repeat(2, 1fr); max-width: none; }
  .charts { grid-template-columns: 1fr; }
  .co-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { padding: 0 14px; }
  .header-inner { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .header-actions { width: 100%; }
  .header-actions #refreshData { flex: 1; }
  .hero { padding: 32px 0 6px; }
  .hero-title { max-width: 16ch; }
  .cards { gap: 10px; margin: 14px 0; }
  .card { padding: 14px 16px; border-radius: 14px; }
  .charts { gap: 10px; margin-bottom: 14px; }
  .chart-box { padding: 14px; border-radius: 14px; }
  .tabs { display: flex; width: 100%; }
  .tab { flex: 1; text-align: center; padding: 9px 12px; }
  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { flex: 1 1 100%; min-width: 0; width: 100%; }
  table { font-size: .85rem; }
  th, td { padding: 10px 12px; }
  .co-grid { grid-template-columns: 1fr; gap: 10px; }
  .pagination { gap: 5px; margin: 12px 0 20px; }
  .pagination button { min-width: 36px; padding: 7px 10px; }
  .pagination .page-info { flex-basis: 100%; margin-left: 0; margin-top: 6px; text-align: center; }
  .site-footer { padding: 18px 0 26px; margin-top: 24px; }
}
@media (max-width: 380px) {
  .cards, .cards.two { grid-template-columns: 1fr; }
}
