:root{
  --ink:#0B1B33; --muted:#5B6B85; --line:#E3E8F0; --bg:#F5F7FB; --card:#fff;
  --brand:#0B57D0; --brand-soft:#E8F0FE; --teal:#0E9F8A; --amber:#B26A00;
  --rose:#B42318; --radius:16px; --shadow:0 1px 2px rgba(16,24,40,.04),0 8px 24px rgba(16,24,40,.06);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font:15px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{margin:0; letter-spacing:-.02em; line-height:1.15}
p{margin:0}
.wrap{max-width:1240px; margin:0 auto; padding:0 24px}
.is-hidden{display:none!important}

/* top bar */
.top{position:sticky; top:0; z-index:50; background:rgba(255,255,255,.86); backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line)}
.top-in{display:flex; align-items:center; gap:20px; min-height:66px; flex-wrap:wrap; padding:8px 0}
.brand{display:flex; align-items:center; gap:10px; min-width:210px}
.mark{width:34px; height:34px; border-radius:10px; background:var(--brand); color:#fff; font-weight:700;
  display:grid; place-items:center; letter-spacing:-.02em}
.brand strong{display:block; font-size:14px}
.brand .sub{display:block; font-size:11.5px; color:var(--muted)}
.tabs{display:flex; gap:4px; flex:1 1 auto; min-width:0; overflow-x:auto; scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tab{border:0; background:transparent; color:var(--muted); font:inherit; font-weight:600; font-size:13.5px;
  padding:8px 12px; border-radius:9px; cursor:pointer}
.tab:hover{background:#EEF2F9; color:var(--ink)}
.tab.is-on{background:var(--brand-soft); color:var(--brand)}
.meta{display:flex; gap:8px; align-items:center}
.pill{font-size:11.5px; font-weight:600; color:#0B3B8C; background:#E8F0FE; border-radius:999px; padding:5px 10px}
.pill-ghost{background:#F2F4F8; color:var(--muted)}

main{padding:28px 0 40px}
.page-head{display:flex; justify-content:space-between; align-items:flex-end; gap:24px; margin:6px 0 22px}
.eyebrow{font-size:11.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--brand); margin-bottom:6px}
h1{font-size:30px; font-weight:650}
.lede{color:var(--muted); max-width:720px; margin-top:8px; font-size:14.5px}

/* cards & grids */
.grid{display:grid; gap:16px; margin-top:16px}
.grid.two{grid-template-columns:1.35fr 1fr}
.grid.three{grid-template-columns:repeat(3,1fr)}
.card{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px;
  box-shadow:var(--shadow)}
.card-head{display:flex; justify-content:space-between; align-items:baseline; gap:12px; margin-bottom:14px}
.card-head h2{font-size:15.5px; font-weight:650}
.hint{font-size:11.5px; color:var(--muted)}
.note{font-size:12px; color:var(--muted); margin-top:10px}
.legend{display:flex; gap:16px; margin-top:10px; font-size:12px; color:var(--muted)}
.dot{display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:6px}
.dot-a{background:var(--teal)} .dot-b{background:#D69E2E} .dot-c{background:var(--rose)}

/* KPI */
.kpis{display:grid; grid-template-columns:repeat(4,1fr); gap:16px}
.kpi{background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px; box-shadow:var(--shadow)}
.kpi label{display:block; font-size:11.5px; font-weight:600; letter-spacing:.05em; text-transform:uppercase; color:var(--muted)}
.kpi .value{font-size:28px; font-weight:650; letter-spacing:-.03em; margin-top:6px}
.kpi small{display:block; color:var(--muted); font-size:12px; margin-top:2px}
.kpi .spark{height:6px; border-radius:6px; background:#EEF2F9; margin-top:12px; overflow:hidden}
.kpi .spark i{display:block; height:100%; background:var(--brand); border-radius:6px}

/* bars */
.bars{display:grid; gap:10px}
.bar{display:grid; grid-template-columns:124px minmax(60px,1fr) 124px; align-items:center; gap:10px; font-size:13px}
.bar .lab{color:var(--ink); font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.bar .track{display:block; height:10px; background:#EEF2F9; border-radius:6px; overflow:hidden}
.bar .fill{display:block; height:100%; background:var(--brand); border-radius:6px}
.bar .val{text-align:right; color:var(--muted); font-variant-numeric:tabular-nums; font-size:12px; white-space:nowrap}
.bar.is-strong .fill{background:var(--teal)}
.bar.is-weak .fill{background:#D69E2E}

/* stage line */
.stageline{display:grid; grid-template-columns:repeat(5,1fr); gap:10px; align-items:end; min-height:120px}
.stage{display:grid; gap:6px; justify-items:center; text-align:center}
.stage b{font-size:20px}
.stage span{font-size:11px; color:var(--muted); line-height:1.25}
.stage .bar{width:100%; height:8px; border-radius:6px; background:#EEF2F9; grid-template-columns:1fr}
.stage.on .bar{background:var(--brand)}
.stage.on b{color:var(--brand)}

/* map */
.map{height:380px; border-radius:12px; overflow:hidden; border:1px solid var(--line)}
.leaflet-container{font:inherit}
.pin{display:grid; place-items:center; width:26px; height:26px; border-radius:50%; background:#fff;
  border:2px solid var(--brand); font-size:11px; font-weight:700; color:var(--brand); box-shadow:0 2px 6px rgba(0,0,0,.15)}
.pin.a{border-color:var(--teal); color:var(--teal)}
.pin.c{border-color:var(--rose); color:var(--rose)}

/* pipeline */
.pipeline{display:grid; grid-template-columns:repeat(5,1fr); gap:12px; margin-top:6px}
.pstage{background:#fff; border:1px solid var(--line); border-radius:14px; padding:14px 16px; box-shadow:var(--shadow)}
.pstage .n{font-size:26px; font-weight:650; letter-spacing:-.03em}
.pstage .l{font-size:12px; color:var(--muted)}
.pstage.active{border-color:#BFD3F4; background:linear-gradient(180deg,#F7FAFF,#fff)}
.pstage.active .n{color:var(--brand)}
.pstage .pbar{height:6px; border-radius:6px; background:#EEF2F9; margin-top:10px; overflow:hidden}
.pstage .pbar i{display:block; height:100%; background:var(--brand)}

.progress-ring{width:132px; height:132px; position:relative; flex:0 0 auto}
.progress-ring svg{transform:rotate(-90deg)}
.progress-ring .mid{position:absolute; inset:0; display:grid; place-content:center; text-align:center}
.progress-ring b{font-size:22px; letter-spacing:-.02em}
.progress-ring span{font-size:11px; color:var(--muted); display:block}

/* filters + tables */
.filters{display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px}
.filters label{display:grid; gap:4px; font-size:11.5px; font-weight:600; color:var(--muted); min-width:150px}
.filters label.grow{flex:1 1 220px}
.filters select,.filters input{font:inherit; font-size:13px; color:var(--ink); background:#fff;
  border:1px solid #D5DCE8; border-radius:9px; padding:8px 10px; min-height:38px}
.filters input{width:100%}
.tablewrap{overflow:auto; border:1px solid var(--line); border-radius:12px}
.tbl{width:100%; border-collapse:collapse; font-size:13px}
.tbl th{position:sticky; top:0; background:#F8FAFD; text-align:left; font-size:11px; letter-spacing:.05em;
  text-transform:uppercase; color:var(--muted); padding:10px 12px; border-bottom:1px solid var(--line); white-space:nowrap}
.tbl td{padding:10px 12px; border-bottom:1px solid #EFF2F7; vertical-align:top}
.tbl tr:last-child td{border-bottom:0}
.tbl tbody tr:hover{background:#FAFCFF; cursor:pointer}
.tbl .num{text-align:right; font-variant-numeric:tabular-nums}
.tbl.compact td,.tbl.compact th{padding:8px 10px}
.chip{display:inline-block; font-size:11px; font-weight:600; padding:3px 8px; border-radius:999px;
  background:#E8F0FE; color:#0B3B8C; white-space:nowrap}
.chip.muted{background:#F2F4F8; color:var(--muted)}
.site-name{font-weight:600}
.site-sub{color:var(--muted); font-size:11.5px; margin-top:2px}

/* competitor */
.cat-tabs{display:flex; gap:8px; margin:4px 0 4px}
.cat{border:1px solid var(--line); background:#fff; border-radius:999px; padding:8px 14px; font:inherit;
  font-size:13px; font-weight:600; color:var(--muted); cursor:pointer}
.cat.is-on{background:var(--ink); color:#fff; border-color:var(--ink)}
.stack{display:grid; gap:10px}
.stack .row{display:flex; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid var(--line);
  border-radius:10px; font-size:13px; background:#FBFCFE}
.stack .row b{font-variant-numeric:tabular-nums}
.brandcards{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.brandcard{border:1px solid var(--line); border-radius:12px; padding:10px 12px; background:#FBFCFE}
.brandcard .b{display:flex; justify-content:space-between; gap:8px; font-size:13px; font-weight:650}
.brandcard .t{font-size:11px; color:var(--muted); margin-top:2px}
.brandcard .m{display:flex; gap:12px; margin-top:8px; font-size:11.5px; color:var(--muted)}
.brandcard .m b{color:var(--ink); font-variant-numeric:tabular-nums}
.brandcard.subject{border-color:#BFD3F4; background:#F5F9FF}
.findings{margin:0; padding-left:18px; display:grid; gap:8px; font-size:13px; color:#22324B}
.comp-funnel{display:flex; gap:10px; align-items:center; font-size:12px; color:var(--muted)}
.comp-funnel b{color:var(--ink); font-size:15px}

/* scoring */
.weight{background:#fff; border:1px solid var(--line); border-radius:14px; padding:16px 18px; box-shadow:var(--shadow)}
.weight .pct{font-size:30px; font-weight:650; letter-spacing:-.03em; color:var(--brand)}
.weight .f{font-weight:650; margin-top:2px}
.weight p{font-size:12.5px; color:var(--muted); margin-top:6px}
.scatter{position:relative}
.scatter svg{width:100%; height:320px; display:block}
.scatter .axis{stroke:#DCE3EE; stroke-width:1}
.scatter .gridline{stroke:#EDF1F7; stroke-width:1}
.scatter text{font-size:10px; fill:#7A879C}
.scatter .pt{cursor:pointer}
.scatter .pt circle{stroke:#fff; stroke-width:1.5}
.tip{position:absolute; pointer-events:none; background:var(--ink); color:#fff; font-size:11.5px;
  padding:6px 9px; border-radius:8px; transform:translate(-50%,-120%); white-space:nowrap; opacity:0; transition:opacity .12s}
.tip.on{opacity:1}
.checklist{margin:0; padding-left:18px; display:grid; gap:8px; font-size:13px; color:#22324B}

.foot{border-top:1px solid var(--line); background:#fff; padding:16px 0; margin-top:20px}
.foot .wrap{display:flex; justify-content:space-between; gap:12px; font-size:12px; color:var(--muted)}

@media (max-width:1200px){ .pill-ghost{display:none} }

/* responsive */
@media (max-width:1080px){
  .grid.two,.grid.three{grid-template-columns:1fr}
  .kpis{grid-template-columns:repeat(2,1fr)}
  .pipeline{grid-template-columns:repeat(2,1fr)}
  .top-in{height:auto; padding:10px 0; flex-wrap:wrap; gap:10px}
  .tabs{order:3; width:100%; overflow-x:auto}
}
@media (max-width:640px){
  .wrap{padding:0 14px}
  h1{font-size:23px}
  .kpis{grid-template-columns:1fr 1fr}
  .kpi .value{font-size:23px}
  .bar{grid-template-columns:1fr auto; row-gap:4px; grid-template-areas:"lab val" "track track"}
  .bar .lab{grid-area:lab}
  .bar .val{grid-area:val; white-space:normal; text-align:right}
  .bar .track{grid-area:track}
  #pos-bars .site-sub{margin-left:0!important}
  .brandcards{grid-template-columns:1fr}
  .meta{display:none}
  .map{height:300px}
  .pipeline{grid-template-columns:1fr 1fr}
  .page-head{flex-direction:column; align-items:flex-start}
  .progress-ring{width:104px; height:104px}
}
