:root {
  --bg: #f4f5ff;
  --surface: #ffffff;
  --ink: #14163a;
  --ink-2: #464b73;
  --muted: #6b7196;
  --grid: #e9ebf8;
  --axis: #cdd1ea;
  --hairline: rgba(20, 22, 58, 0.08);
  --wash: #eef0fb;

  --c-indigo: #4f46e5;
  --c-pink: #ec4899;
  --c-orange: #ff7a1a;
  --c-teal: #0aa88c;
  --c-gray: #b9bfd8;

  --up-bg: #e1f7ee;
  --up-ink: #006300;
  --down-bg: #ffe8e5;
  --down-ink: #a11a12;

  --brand: linear-gradient(115deg, #4338ca 0%, #6d28d9 38%, #db2777 78%, #f97316 118%);
  --brand-soft: linear-gradient(135deg, #4f46e5, #7c3aed);
  --radius: 22px;
  --shadow: 0 1px 2px rgba(20, 22, 58, 0.04), 0 10px 30px rgba(79, 70, 229, 0.07);
  --font: "Plus Jakarta Sans", "Segoe UI Variable Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(124, 58, 237, 0.13), transparent 70%),
    radial-gradient(760px 400px at 98% 2%, rgba(255, 122, 26, 0.12), transparent 70%),
    radial-gradient(700px 500px at 60% 40%, rgba(10, 168, 140, 0.05), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.45); outline-offset: 2px; border-radius: 8px; }

.wrap { width: 100%; max-width: 1260px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 32px); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--hairline);
}
.topbar .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; background: var(--brand);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: 0 6px 16px rgba(219, 39, 119, 0.35);
}
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; line-height: 1.1; }
.brand-name small { display: block; font-weight: 600; font-size: 11px; color: var(--muted); letter-spacing: 0; }
.nav { margin-left: auto; display: flex; gap: 4px; }
.nav a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 13.5px;
  color: var(--ink-2); transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--wash); }
.nav a.active { background: var(--brand-soft); color: #fff; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; margin-top: 24px; border-radius: 30px; color: #fff;
  background: var(--brand); padding: clamp(24px, 5vw, 56px);
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center;
  box-shadow: 0 24px 60px rgba(109, 40, 217, 0.28);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.hero::before { width: 420px; height: 420px; right: -120px; top: -160px; background: rgba(255, 255, 255, 0.12); }
.hero::after { width: 260px; height: 260px; left: 38%; bottom: -150px; background: rgba(255, 255, 255, 0.10); }
.hero > * { position: relative; z-index: 1; }
.eyebrow-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 700; font-size: 12.5px; letter-spacing: 0.02em;
}
.eyebrow-chip { flex-wrap: wrap; line-height: 1.3; }
.eyebrow-chip span { white-space: nowrap; }
.eyebrow-chip #heroSpan { opacity: 0.85; }
.eyebrow-chip i { width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.28); }
.hero h1 { margin-top: 18px; font-size: clamp(30px, 4.4vw, 52px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 800; }
.hero p.lead { margin-top: 16px; font-size: clamp(14.5px, 1.6vw, 17px); line-height: 1.6; max-width: 56ch; color: rgba(255, 255, 255, 0.94); }
.hero-actions { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 14px; border: 0;
  font-weight: 700; font-size: 14px; text-decoration: none; transition: transform 0.15s, box-shadow 0.15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-light { background: #fff; color: #4338ca; box-shadow: 0 8px 20px rgba(20, 22, 58, 0.2); }
.btn-ghost { background: rgba(255, 255, 255, 0.16); color: #fff; border: 1px solid rgba(255, 255, 255, 0.4); }
.hero-stats { display: grid; gap: 12px; }
.hero-stat {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: 20px;
  background: rgba(24, 12, 80, 0.32); border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hero-stat .ico { width: 44px; height: 44px; border-radius: 14px; background: rgba(255, 255, 255, 0.2); display: grid; place-items: center; flex: none; }
.hero-stat .ico svg { width: 22px; height: 22px; }
.hero-stat b { display: block; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -0.02em; line-height: 1.1; font-weight: 800; }
.hero-stat span { font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.9); }

/* ---------- filters ---------- */
.filters-wrap { position: sticky; top: 64px; z-index: 20; padding-top: 16px; }
.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 12px 16px;
  background: rgba(255, 255, 255, 0.9); border: 1px solid var(--hairline); border-radius: 20px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow);
}
.f-group { display: flex; align-items: center; gap: 10px; }
.f-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--hairline); background: var(--surface); border-radius: 999px; padding: 6px 13px;
  font-weight: 600; font-size: 13px; color: var(--ink-2); transition: all 0.15s;
}
.chip:hover { background: var(--wash); }
.chip[aria-pressed="true"] { background: var(--brand-soft); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35); }
.select-pair { display: flex; align-items: center; gap: 6px; color: var(--muted); }
select {
  appearance: none; -webkit-appearance: none; border: 1px solid var(--hairline); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7196' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border-radius: 12px; padding: 7px 30px 7px 12px; font-weight: 600; font-size: 13px; min-width: 112px;
}
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 13px; background: var(--wash); }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 6px 13px; font-weight: 700; font-size: 13px; color: var(--ink-2); transition: all 0.15s; }
.seg button[aria-pressed="true"] { background: var(--brand-soft); color: #fff; box-shadow: 0 3px 10px rgba(79, 70, 229, 0.35); }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.range-summary { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.range-summary b { color: var(--ink); }

/* ---------- sections ---------- */
main { padding-bottom: 24px; }
section.block { padding-top: 40px; scroll-margin-top: 150px; }
.sec-head { margin-bottom: 18px; }
.sec-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.sec-eyebrow::before { content: ""; width: 26px; height: 5px; border-radius: 3px; background: var(--brand); }
.sec-head h2 { margin-top: 8px; font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -0.03em; font-weight: 800; }
.sec-head p { margin-top: 6px; color: var(--ink-2); max-width: 72ch; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s12 { grid-column: span 12; }

.card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font-size: 16.5px; font-weight: 800; letter-spacing: -0.02em; }
.card-head p { margin-top: 2px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.chart-box { position: relative; height: 340px; }
.chart-box.tall { height: 380px; }
.chart-box.short { height: 230px; }
.empty-note {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
  color: var(--muted); font-weight: 600; background: rgba(255, 255, 255, 0.85); border-radius: 14px;
}
.caption { margin-top: 10px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.caption .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--c-indigo); background: var(--c-indigo); vertical-align: -2px; margin-right: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); gap: 16px; padding-top: 22px; }
.kpi {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--hairline); border-radius: 22px;
  padding: 18px 18px 16px; box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s;
  animation: rise 0.5s ease both;
}
.kpi:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(79, 70, 229, 0.14); }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-ico { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.kpi-ico svg { width: 19px; height: 19px; }
.kpi-label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); line-height: 1.25; }
.kpi-value { margin-top: 14px; font-size: 27px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.kpi-sub { margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-foot { margin-top: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.kpi-foot svg { flex: none; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pill svg { width: 12px; height: 12px; }
.pill.up { background: var(--up-bg); color: var(--up-ink); }
.pill.down { background: var(--down-bg); color: var(--down-ink); }
.pill.flat { background: var(--wash); color: var(--ink-2); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- insights ---------- */
.insights { display: grid; gap: 4px; }
.insight { display: grid; grid-template-columns: 46px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--hairline); }
.insight:first-child { border-top: 0; padding-top: 0; }
.insight-badge { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; }
.insight b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.015em; }
.insight span { display: block; margin-top: 2px; color: var(--ink-2); font-size: 12.8px; line-height: 1.5; }

/* ---------- heatmap ---------- */
.heat-scroll { overflow-x: auto; padding-bottom: 6px; }
.heat { min-width: 680px; display: grid; gap: 4px; }
.heat-row { display: grid; grid-template-columns: 52px repeat(12, minmax(0, 1fr)); gap: 4px; align-items: stretch; }
.heat-col, .heat-fy { font-size: 11.5px; font-weight: 700; color: var(--muted); display: flex; align-items: center; }
.heat-col { justify-content: center; padding-bottom: 4px; }
.heat-cell {
  height: 38px; border-radius: 9px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
  transition: transform 0.12s, box-shadow 0.12s; cursor: default;
}
.heat-cell:hover { transform: scale(1.09); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink-2); position: relative; z-index: 2; }
.heat-cell.empty { background: transparent; box-shadow: inset 0 0 0 1px var(--grid); }
.heat-cell.empty:hover { transform: none; box-shadow: inset 0 0 0 1px var(--grid); }
.heat-legend { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 12px; color: var(--muted); font-weight: 600; flex-wrap: wrap; }
.heat-bar { width: 220px; max-width: 100%; height: 10px; border-radius: 6px; }

/* ---------- milestones ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 16px; max-height: 330px; overflow: auto; padding-right: 6px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--grid); }
.timeline li { position: relative; padding-left: 30px; }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--brand-soft); box-shadow: 0 0 0 4px var(--surface), 0 0 0 5.5px var(--grid);
}
.timeline b { display: block; font-size: 12.5px; font-weight: 800; color: var(--c-indigo); }
.timeline span { color: var(--ink); font-size: 13.2px; font-weight: 500; }
.timeline .none { color: var(--muted); font-weight: 600; }

/* ---------- table ---------- */
.table-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search input {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: 14px; border: 1px solid var(--hairline); background: var(--wash); font-weight: 500;
}
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.table-count { color: var(--muted); font-weight: 600; font-size: 12.5px; margin-left: auto; }
.btn-brand { background: var(--brand-soft); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); padding: 10px 16px; }
.table-wrap { overflow: auto; max-height: 470px; border: 1px solid var(--hairline); border-radius: 16px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th, td { padding: 10px 14px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th {
  position: sticky; top: 0; z-index: 1; background: #f7f8ff; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); font-weight: 800; cursor: pointer; user-select: none;
}
th:hover { color: var(--ink); }
th .arrow { display: inline-block; width: 12px; margin-left: 4px; color: var(--c-indigo); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ev { white-space: normal; min-width: 260px; color: var(--ink-2); font-size: 12.5px; }
tbody tr:hover td { background: #f7f8ff; }
td.pos { color: var(--up-ink); font-weight: 600; }
td.neg { color: var(--down-ink); font-weight: 600; }

/* ---------- footer & tooltip ---------- */
.note {
  margin-top: 40px; padding: 20px 22px; border-radius: 20px; background: #fff8ec; border: 1px solid #ffe1b5; color: #5a3a06; font-size: 13px; line-height: 1.6;
}
.note b { color: #3d2600; }
footer { padding: 28px 0 44px; color: var(--muted); font-size: 12.5px; text-align: center; }
#tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--surface); border: 1px solid var(--axis); border-radius: 12px;
  padding: 9px 12px; box-shadow: 0 10px 28px rgba(20, 22, 58, 0.16); font-size: 12.5px; opacity: 0; transition: opacity 0.1s; max-width: 260px;
}
#tip.on { opacity: 1; }
#tip b { display: block; font-weight: 800; font-size: 13px; }
#tip span { display: block; color: var(--ink-2); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1040px) {
  .hero { grid-template-columns: 1fr; }
  .s4, .s5, .s6, .s7, .s8 { grid-column: span 12; }
  .filters-wrap { position: static; }
  section.block { scroll-margin-top: 80px; }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .f-group { flex-wrap: wrap; }
  .range-summary { margin-left: 0; width: 100%; }
  .chart-box, .chart-box.tall { height: 300px; }
  .card { padding: 18px; }
  .kpi-value { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
