:root{
  --bg:
    radial-gradient(1200px 700px at 10% 0%, rgba(96,195,212,.18), transparent 55%),
    radial-gradient(900px 700px at 85% 5%, rgba(236,130,44,.14), transparent 55%),
    radial-gradient(800px 700px at 60% 90%, rgba(178,42,46,.10), transparent 55%),
    #f6f7f8;
  --paper: rgba(255,255,255,.86);
  --paper-solid:#ffffff;
  --ink: #132024;
  --muted: #51626a;
  --line: rgba(19,32,36,.10);

  --brand-red: #b22a2e;
  --brand-teal: #68c0d2;
  --brand-orange: #d48037;
  --brand-green: #1b4d2b;
  --brand-sand: #d9ccb1;

  --e1: #47555a;
  --e2: #3c85af;
  --e3: #60c3d4;
  --e4: #ec822c;
  --e5: #d5ba46;
  --e6: #7ca56c;

  --shadow: 0 12px 32px rgba(19,32,36,.10);
  --shadow-soft: 0 10px 22px rgba(19,32,36,.08);
  --radius: 18px;

  --good:#1b4d2b;
  --warn:#d48037;
  --bad:#b22a2e;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{height:100%}
html,body{overflow-x:hidden}
body{
  margin:0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}
img{max-width:100%; height:auto}
a{color:inherit; text-decoration:none}
code{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace}

.topbar{
  position:sticky; top:0; z-index:20;
  backdrop-filter: blur(14px);
  background: rgba(246,247,248,.78);
  border-bottom: 1px solid var(--line);
}
.topbar__inner{
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.brand{display:flex; gap:12px; align-items:center}
.brand__mark{
  width:12px; height:36px; border-radius: 10px;
  background: linear-gradient(180deg, var(--brand-red), #7d1c20);
  box-shadow: 0 10px 18px rgba(178,42,46,.25);
}
.brand__title{font-weight: 800; letter-spacing:.2px; font-size: 18px}
.brand__subtitle{font-size: 12px; color: var(--muted)}
.topbar__actions{display:flex; gap:10px; align-items:center}

.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(19,32,36,.14);
  background: rgba(255,255,255,.70);
  box-shadow: 0 10px 18px rgba(19,32,36,.05);
  font-size: 13px;
  font-weight: 650;
}
.chip:hover{transform: translateY(-1px)}

.wrap{
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px;
  width: 100%;
}
@media (max-width:720px){
  .wrap{padding: 14px}
  .topbar__inner{padding: 12px 14px}
}

.hero{
  position:relative;
  border-radius: var(--radius);
  overflow:hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--paper-solid);
}
.hero__bg{
  position:absolute; inset:0;
  background: url("./assets/cover_bg.png") center/cover no-repeat;
  filter: saturate(1.05) contrast(1.02);
  transform: scale(1.03);
}
.hero__overlay{
  position:absolute; inset:0;
  background:
    linear-gradient(180deg, rgba(19,32,36,.18), rgba(19,32,36,.78));
}
.hero__content{
  position:relative;
  display:grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 18px;
  padding: 22px;
  color: #fff;
}
@media (max-width:980px){
  .hero__content{grid-template-columns:1fr; padding: 18px}
}
.hero__copy{
  border-radius: 20px;
  background: rgba(19,32,36,.26);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.14);
  padding: 16px 16px 12px;
  box-shadow: 0 14px 32px rgba(0,0,0,.12);
}
.hero h1{
  margin:0;
  font-size: 28px;
  line-height:1.1;
  letter-spacing:.2px;
}
.hero p{margin: 10px 0 0; color: rgba(255,255,255,.92); max-width: 70ch}
.hero__mini{display:flex; gap:10px; margin-top: 14px; flex-wrap:wrap}
.miniCard{
  flex: 1 1 120px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
}
.miniCard__kpi{
  font-weight: 850;
  font-size: 22px;
  letter-spacing:.2px;
}
.miniCard__label{font-size: 12px; opacity:.9}
.hero__figure{
  border-radius: 18px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.08);
  align-self:end;
}
.hero__figure img{display:block}


/* --- Mobile filter dock + drawer --- */
.filterDock{
  position: fixed;
  right: 10px;
  top: 132px;
  z-index: 60;
  display:flex;
  align-items:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(19,32,36,.76);
  color: #fff;
  box-shadow: 0 16px 26px rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
}
.filterDock__icon{font-size:16px; line-height:1}
.filterDock__txt{font-weight:800; font-size:13px; letter-spacing:.2px}

.filterDock__badge{
  display:inline-grid;
  place-items:center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  background: rgba(255,255,255,.92);
  color: rgba(19,32,36,.92);
  border: 1px solid rgba(255,255,255,.22);
}
.filterDock__badge.is-zero{opacity:.45}

.filterBackdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 58;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.filterDrawer{
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(340px, 86vw);
  z-index: 59;
  transform: translateX(102%);
  transition: transform .20s ease;
  padding: 10px 10px 14px;
  background: rgba(255,255,255,.82);
  border-left: 1px solid rgba(19,32,36,.10);
  backdrop-filter: blur(16px);
  box-shadow: -24px 0 44px rgba(0,0,0,.14);
  overflow: auto;
}
.filterDrawer__head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 10px 6px 8px;
}
.filterDrawer__title{
  font-weight: 900;
  letter-spacing: .2px;
}
.filterDrawer__close{
  border: 1px solid rgba(19,32,36,.14);
  background: rgba(255,255,255,.85);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  font-weight: 900;
}
body.filters-open .filterBackdrop{
  opacity: 1;
  pointer-events: auto;
}
body.filters-open .filterDrawer{
  transform: translateX(0);
}

/* Desktop: inline filters (no drawer) */
@media (min-width: 981px){
  .filterDock, .filterBackdrop{display:none;}
  .filterDrawer{
    position: static;
    height: auto;
    width: auto;
    transform: none;
    transition: none;
    padding: 0;
    background: transparent;
    border-left: none;
    box-shadow: none;
    overflow: visible;
  }
  .filterDrawer__head{display:none;}
}
@media (max-width: 980px){
  /* keep space so dock doesn't overlap hero */
  #controls{ margin-top: 0; }
}

.controls{
  margin-top: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.70);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 64px;
  z-index: 15;
}
.controls__inner{
  padding: 12px 12px 10px;
  display:grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
  gap: 10px;
}
@media (max-width:980px){
  .controls{top: 56px}
  .controls__inner{grid-template-columns:1fr 1fr}
}
@media (max-width:560px){
  .controls__inner{grid-template-columns:1fr}
}
.control label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 6px;
}
.control select{
  width:100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(19,32,36,.14);
  background: rgba(255,255,255,.9);
  outline:none;
}
.controls__note{
  padding: 0 12px 12px;
  font-size: 12px;
  color: var(--muted);
}

.seg{
  display:flex;
  gap:6px;
  padding: 4px;
  border-radius: 16px;
  border: 1px solid rgba(19,32,36,.12);
  background: rgba(255,255,255,.65);
}
.seg__btn{
  flex: 1 1 auto;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor:pointer;
  font-weight: 700;
  font-size: 13px;
  color: rgba(19,32,36,.78);
}
.seg__btn.is-on{
  background: linear-gradient(180deg, var(--brand-red), #8f1f23);
  color:#fff;
  box-shadow: 0 10px 18px rgba(178,42,46,.18);
}

.grid{
  margin-top: 16px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
/* Prevent CSS grid/flex min-content overflow on mobile */
.grid > *{min-width:0}
.card{min-width:0}
.controls__inner > *{min-width:0}
.hero__content > *{min-width:0}
@media (max-width:980px){ .grid{grid-template-columns:1fr} }
.card{
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}
.card.full{grid-column:1/-1}
.card__head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}
.card h2{margin:0; font-size: 18px; letter-spacing:.2px}
.card h3{margin: 12px 0 6px; font-size: 14px; letter-spacing:.06em; text-transform:uppercase; color: var(--muted)}
.muted{color: var(--muted)}
.small{font-size:12px; color: var(--muted)}
.divider{height:1px; background: var(--line); margin: 14px 0}
.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(19,32,36,.12);
  background: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 750;
  color: rgba(19,32,36,.72);
}

.viz{
  margin-top: 12px;
  border-radius: 16px;
  border: 1px solid rgba(19,32,36,.10);
  background: rgba(255,255,255,.55);
  overflow:hidden;
}
.viz svg{display:block; width:100%; height:auto}

.bars{margin-top: 12px; display:flex; flex-direction:column; gap: 10px}
.barRow{
  display:grid;
  grid-template-columns: 1fr 3fr auto;
  gap: 10px;
  align-items:center;
}
@media (max-width:520px){
  .barRow{grid-template-columns: 1fr 2.3fr auto}
}
.barLabel{font-weight: 700; font-size: 13px}
.barTrack{
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(19,32,36,.10);
  background: rgba(19,32,36,.06);
  overflow:hidden;
}
.barFill{height:100%; width: 0%; border-radius:999px}
.barVal{font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13px}

.heatwrap{margin-top: 12px; overflow:auto}
.heat{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 0; table-layout: fixed;
  border-radius: 16px;
  overflow:hidden;
  border: 1px solid rgba(19,32,36,.10);
}
.heat th, .heat td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(19,32,36,.08);
  border-right: 1px solid rgba(19,32,36,.06);
  text-align: left;
  font-size: 12px;
}
.heat th{
  background: rgba(255,255,255,.75);
  position: sticky;
  top: 0;
  z-index: 2;
}
.heat td.num{text-align:center; font-variant-numeric: tabular-nums; font-weight: 750}
.heat tr:last-child td{border-bottom:0}
.heat td:last-child, .heat th:last-child{border-right:0}

.stacked{margin-top: 12px; display:flex; flex-direction:column; gap: 10px}
.stackRow{
  display:grid;
  grid-template-columns: 1fr 3fr;
  gap: 10px;
  align-items:center;
}
.stackBar{
  height: 14px;
  border-radius: 999px;
  overflow:hidden;
  border: 1px solid rgba(19,32,36,.10);
  background: rgba(19,32,36,.06);
  display:flex;
}
.segPart{height:100%}
.segPart.high{background: rgba(178,42,46,.85)}
.segPart.med{background: rgba(212,128,55,.85)}
.segPart.low{background: rgba(27,77,43,.75)}
.stackLegend{margin-top: 10px; display:flex; gap: 12px; flex-wrap:wrap; font-size: 12px; color: var(--muted)}
.key{display:inline-flex; align-items:center; gap:8px}
.swatch{width:10px; height:10px; border-radius: 3px}
.swatch.high{background: rgba(178,42,46,.85)}
.swatch.med{background: rgba(212,128,55,.85)}
.swatch.low{background: rgba(27,77,43,.75)}

.diverge{margin-top: 12px; display:flex; flex-direction:column; gap: 10px}
.gapRow{
  display:grid;
  grid-template-columns: 1fr 3fr auto;
  gap: 10px;
  align-items:center;
}
.gapTrack{
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(19,32,36,.10);
  background: rgba(19,32,36,.06);
  overflow:hidden;
  position:relative;
}
.gapZero{
  position:absolute; left:50%; top:0; bottom:0;
  width: 1px; background: rgba(19,32,36,.22);
}
.gapFill{
  position:absolute; top:0; bottom:0;
  width: 0%;
  background: rgba(178,42,46,.82);
}
.gapVal{font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13px}

.row{display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end}
.control.inline{min-width: 220px}
.legend{margin-top: 10px; display:flex; gap: 12px; flex-wrap:wrap; font-size: 12px; color: var(--muted)}
.dot{display:inline-block; width:10px; height:10px; border-radius: 99px; margin-right:6px}
.dot--low{background: rgba(27,77,43,.75)}
.dot--med{background: rgba(212,128,55,.85)}
.dot--high{background: rgba(178,42,46,.85)}

.line{display:inline-block; width:18px; height:0; border-top:2px solid rgba(178,42,46,.95); margin-right:6px; transform: translateY(-2px)}
.line--dash{border-top-style: dashed; border-top-color: rgba(19,32,36,.45)}

.donut{position:relative; margin-top: 12px; height: 220px; display:grid; place-items:center}
.donut__ring{
  width: 210px; height: 210px;
  border-radius: 999px;
  border: 1px solid rgba(19,32,36,.10);
  background: conic-gradient(from 0deg, rgba(178,42,46,.85) 0 20%, rgba(212,128,55,.85) 20% 40%, rgba(96,195,212,.75) 40% 60%, rgba(124,165,108,.75) 60% 80%, rgba(71,85,90,.65) 80% 100%);
  box-shadow: 0 14px 30px rgba(19,32,36,.12);
}
.donut__ring::after{
  content:"";
  position:absolute;
  width: 130px; height: 130px;
  border-radius: 999px;
  background: rgba(246,247,248,.95);
  border: 1px solid rgba(19,32,36,.10);
}
.donut__center{
  position:absolute;
  text-align:center;
  z-index: 2;
}
.donut__kpi{font-weight: 900; font-size: 26px}
.donut__label{font-size: 12px; color: var(--muted)}
.legendCol{margin-top: 10px; display:flex; flex-direction:column; gap: 8px}
.legendItem{display:flex; align-items:center; justify-content:space-between; gap:10px; font-size: 12px; color: var(--muted)}
.legendItem b{color: var(--ink); font-weight: 750}
.legendSw{width:10px; height:10px; border-radius: 3px; flex: 0 0 auto}

.actionsGrid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width:980px){ .actionsGrid{grid-template-columns:1fr} }
.actionCard{
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(19,32,36,.10);
  background: rgba(255,255,255,.65);
}
.actionCard__kpi{font-size: 22px; font-weight: 900}
.actionCard__tag{font-weight: 800; margin-top: 6px}
.actionCard__hint{font-size: 12px; color: var(--muted); margin-top: 6px}

.twocol{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width:980px){ .twocol{grid-template-columns:1fr} }
.pairs{margin: 10px 0 0 18px}
.pairs li{margin: 8px 0; color: var(--ink)}
.cta{display:flex; gap:10px; flex-wrap:wrap; margin-top: 12px}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(19,32,36,.14);
  background: rgba(255,255,255,.78);
  box-shadow: 0 12px 22px rgba(19,32,36,.06);
  font-weight: 750;
  font-size: 13px;
}
.btn:hover{transform: translateY(-1px)}
.btn.primary{
  border-color: rgba(178,42,46,.25);
  background: linear-gradient(180deg, var(--brand-red), #8f1f23);
  color: #fff;
}

.footer{
  margin: 18px 0 28px;
  padding: 12px 4px;
}


.bullets{margin:10px 0 0 18px; padding:0}
.bullets li{margin:8px 0; color:rgba(19,32,36,.82)}
.note{
  margin-top:14px;
  padding:14px 14px;
  border-radius:14px;
  border:1px solid rgba(19,32,36,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(255,255,255,.58));
  box-shadow: 0 14px 34px rgba(19,32,36,.08);
  color: rgba(19,32,36,.82);
}


/* --- Insight navigator (scrollspy) --- */
html{ scroll-behavior:smooth; }
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior:auto; }
}

.insightNav{
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(246,247,248,.70);
  backdrop-filter: blur(14px);
}
.insightNav__inner{
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 14px;
  display:flex;
  gap: 8px;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.insightNav__inner::-webkit-scrollbar{ display:none; }

.insightNav__item{
  flex: 0 0 auto;
  font-size: 12px;
  letter-spacing: .02em;
  text-decoration:none;
  color: rgba(19,32,36,.72);
  border: 1px solid rgba(19,32,36,.10);
  background: rgba(255,255,255,.64);
  padding: 8px 10px;
  border-radius: 999px;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}
.insightNav__item:hover{
  transform: translateY(-1px);
  border-color: rgba(19,32,36,.18);
  color: rgba(19,32,36,.92);
}
.insightNav__item.is-active{
  background: rgba(178,42,46,.12);
  border-color: rgba(178,42,46,.24);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(19,32,36,.10);
}

/* anchor offset for sticky header */
.card{ scroll-margin-top: 110px; }
#top{ scroll-margin-top: 110px; }

/* full-width cards inside grid */
.card--full{ grid-column: 1 / -1; }

/* --- Viz transitions on filter/toggle updates --- */
.viz, .kpiRow{
  transition: opacity .22s ease, transform .22s ease, filter .22s ease;
  will-change: opacity, transform;
}
.is-updating{
  opacity: .15;
  transform: translateY(3px) scale(.995);
  filter: blur(0.3px);
}
@media (prefers-reduced-motion: reduce){
  .viz, .kpiRow{ transition:none; }
  .is-updating{ opacity:1; transform:none; filter:none; }
}

/* Drawer override */
@media (max-width: 980px){
  .controls{ position: static; top:auto; }
}


/* --- Fix6: mobile chart width + alignment --- */
.heatwrap{max-width:100%;}
.heat{max-width:100%;}
.heat th, .heat td{word-break: break-word;}
@media (max-width:520px){
  .heat th, .heat td{padding:8px 6px; font-size:11px;}
}
/* Align bar-style rows regardless of label length */
.barRow, .gapRow{
  grid-template-columns: 150px 1fr 60px;
}
@media (max-width:520px){
  .barRow, .gapRow{grid-template-columns: 110px 1fr 54px;}
}
.barLabel{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Donut centering fix */
.donut__ring{position:relative;}
.donut__ring::after{
  top:50%;
  left:50%;
  transform: translate(-50%,-50%);
}
