/* Network proximity lookup. Tokens follow the validated reference palette (dataviz skill). */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ef;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --neutral-fill: #d7d6cf;
  --band-outer: #e8e7e2;
  --band-inner: #c9c8c0;
  --heat-0: transparent;
  /* closer = redder: one-hue red ramp on the blue ramp's lightness steps (100/200/300/450/600) */
  --heat-1: #fed4d0;
  --heat-2: #f8aaa3;
  --heat-3: #ee7e77;
  --heat-4: #d2383a;
  --heat-5: #911e22;
  --heat-ink-dark: #0b0b0b;
  --heat-ink-light: #ffffff;
  --focus: #2a78d6;
  --notice-bg: #f3f2ef;
  --warn: #fab219;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.04);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232322; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --neutral-fill: #4a4a47;
    --band-outer: #2e2e2c; --band-inner: #55554f;
    --heat-1: #681014; --heat-2: #911e22; --heat-3: #bb3032; --heat-4: #e76762; --heat-5: #f8aaa3;
    --heat-ink-dark: #f0efec; --heat-ink-light: #0b0b0b; --notice-bg: #232322;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232322; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --ring: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --neutral-fill: #4a4a47;
  --band-outer: #2e2e2c; --band-inner: #55554f;
  --heat-1: #681014; --heat-2: #911e22; --heat-3: #bb3032; --heat-4: #e76762; --heat-5: #f8aaa3;
  --heat-ink-dark: #f0efec; --heat-ink-light: #0b0b0b; --notice-bg: #232322;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--series-1); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--grid); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px 24px; display: flex; gap: 20px; align-items: center; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; }
.search { position: relative; flex: 1; max-width: 560px; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--grid);
  background: var(--surface); color: var(--ink); font: inherit; }
.search input::placeholder { color: var(--muted); }
.search .icon { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--muted); }
.results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--grid);
  border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; display: none; z-index: 30; }
.results-list { max-height: min(60vh, 520px); overflow-y: auto; }
.results-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px; background: var(--surface-2); border-top: 1px solid var(--grid); font-size: 12.5px; color: var(--ink-2); }
.results.open { display: block; }
.result { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; padding: 10px 14px 10px 8px; cursor: pointer; border-top: 1px solid var(--grid); }
.result .r-check { grid-row: 1 / span 2; align-self: center; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; }
.result .r-check:hover { background: var(--grid); }
.result .r-check input { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--ink); }
.result:first-child { border-top: 0; }
.result:hover, .result[aria-selected="true"] { background: var(--surface-2); }
.result .r-name { font-weight: 600; }
.result .r-meta { color: var(--ink-2); font-size: 13px; grid-column: 2 / -1; }
.result .r-id { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.top-meta { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--grid); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }

main { max-width: 1200px; margin: 0 auto; padding: 20px 24px 80px; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--notice-bg); color: var(--ink-2);
  border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.notice svg { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--muted); }

/* person header */
.person { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; margin: 28px 0 18px; }
.person h1 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 6px; }
.person .where { color: var(--ink-2); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--grid);
  background: var(--surface); color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.chip b { color: var(--ink); font-weight: 600; }
.chip.flag { border-color: transparent; background: var(--surface-2); }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .t-label { color: var(--ink-2); font-size: 13px; }
.tile .t-value { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin-top: 2px; }
.tile .t-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.tile.hero .t-value { font-size: 48px; line-height: 1.05; }
.tile.hero .t-value small { font-size: 18px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.tile .t-read { font-size: 14px; font-weight: 600; color: var(--ink); margin-top: 4px; }
.steps { display: flex; gap: 6px; margin-top: 8px; }
.step { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }
.step .pip { height: 6px; border-radius: 3px; background: var(--grid); margin-bottom: 4px; }
.step.d0 .pip { background: var(--ink); } .step.d1 .pip { background: var(--series-2); } .step.d2 .pip { background: var(--axis); } .step.d3 .pip { background: var(--grid); }

.periods { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.periods button { white-space: nowrap; border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.periods button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-top: 16px; }
.card h2 { font-size: 17px; letter-spacing: -0.01em; margin: 0; }
.card .lede { color: var(--ink-2); margin: 4px 0 14px; max-width: 760px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-top: 16px; }

.summary { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.summary li { display: grid; grid-template-columns: 8px 1fr; gap: 10px; color: var(--ink); }
.summary li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--axis); margin-top: 8px; }

/* percentile matrix */
.matrix-wrap { overflow-x: auto; margin: 0 -4px; }
table.matrix { border-collapse: separate; border-spacing: 3px; width: 100%; min-width: 900px; table-layout: fixed; }
.matrix th { font-weight: 500; color: var(--ink-2); font-size: 12px; text-align: center; vertical-align: bottom; padding: 4px 4px 6px; }
.matrix th .g-sub { display: block; color: var(--muted); font-weight: 400; font-size: 11px; line-height: 1.25; margin-top: 2px; }
.matrix th.rowh { text-align: left; }
.matrix td { text-align: center; font-variant-numeric: tabular-nums; border-radius: 6px; height: 36px; font-weight: 600; font-size: 13px; cursor: pointer; }
.matrix td.mlabel { text-align: left; font-weight: 500; color: var(--ink); cursor: pointer; padding: 0 10px; border-radius: 8px; white-space: nowrap; }
.matrix td.mval { color: var(--ink-2); font-weight: 500; text-align: right; padding-right: 10px; cursor: default; }
.matrix tr.sel td.mlabel { background: var(--surface-2); }
.matrix tr.sel td.mlabel::before { content: ""; display: inline-block; width: 3px; height: 14px; border-radius: 2px; background: var(--ink); margin-right: 8px; vertical-align: -2px; }
.legend-heat { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend-heat i { display: inline-block; width: 22px; height: 12px; border-radius: 3px; border: 1px solid var(--ring); }
.legend-heat .dir b { color: var(--ink); font-weight: 600; }
.legend-heat .nc-key { display: inline-flex; gap: 5px; align-items: center; margin-left: 14px; }
.legend-heat .nc-key em { font-style: italic; font-weight: 400; color: var(--ink-2); }
.matrix td.nc { font-style: italic; font-weight: 400; }
.howto { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; }
.howto h3 { font-size: 13px; margin: 0 0 3px; color: var(--ink); }
.howto p { font-size: 12.5px; line-height: 1.45; margin: 0; color: var(--ink-2); }

/* detail dot plot */
.detail { margin-top: 18px; border-top: 1px solid var(--grid); padding-top: 16px; }
.detail h3 { font-size: 15px; margin: 0 0 2px; }
.detail .d-sub { color: var(--ink-2); font-size: 13px; margin-bottom: 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); align-items: center; }
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .ln { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px var(--surface); }
svg text { font-family: var(--font); }
.chart { width: 100%; display: block; }
.axis text, .tick text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.g-label { fill: var(--ink); font-size: 12.5px; }
.g-sub { fill: var(--muted); font-size: 11px; }
.pct-label { fill: var(--ink); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.data td { padding: 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); margin: 1px 4px 1px 0; white-space: nowrap; }
.phase { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.phase i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.muted { color: var(--muted); }
.stat-line { display: flex; gap: 18px; flex-wrap: wrap; color: var(--ink-2); font-size: 13px; margin-bottom: 8px; }
.stat-line b { color: var(--ink); font-weight: 600; }

details.table-view { margin-top: 8px; }
details.table-view summary { cursor: pointer; color: var(--ink-2); font-size: 12px; }
details.notes summary { cursor: pointer; font-weight: 600; }
details.notes ul { color: var(--ink-2); padding-left: 18px; }

.multiples { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.multiple h4 { margin: 0 0 4px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }

/* tooltip */
.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--ring);
  border-radius: 10px; box-shadow: 0 6px 24px rgba(11, 11, 11, 0.14); padding: 8px 10px; font-size: 12px; min-width: 140px; opacity: 0; transition: opacity .08s; }
.tooltip.show { opacity: 1; }
.tooltip .tt-title { color: var(--ink-2); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; }
.tooltip .tt-key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tooltip .tt-key i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }

.empty { text-align: center; color: var(--ink-2); padding: 80px 0; }
.loading { opacity: .55; transition: opacity .2s; }

/* combining profiles */
.btn { border: 1px solid var(--grid); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); font-weight: 600; }
.btn:disabled { opacity: .45; cursor: default; }
.tray { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border: 1px dashed var(--axis); border-radius: 10px; font-size: 13px; background: var(--surface); }
.tray[hidden] { display: none; }
.tray .t-label { color: var(--ink-2); font-weight: 600; }
.tray .t-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 3px 3px 10px; border-radius: 999px; background: var(--surface-2); max-width: 100%; }
.tray .t-chip button { border: 0; background: transparent; cursor: pointer; color: var(--ink-2); font-size: 15px; line-height: 1; padding: 3px 7px; border-radius: 999px; }
.tray .t-chip button:hover { background: var(--grid); }
.tray .t-actions { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.combined { margin-top: 12px; font-size: 13.5px; }
.combined .c-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 3px; }
.combined .linkish { border: 0; background: none; color: var(--series-1); cursor: pointer; font: inherit; font-size: 12.5px; margin-left: 8px; padding: 0; text-decoration: underline; }
.notice.warn { margin-top: 10px; color: var(--ink); background: color-mix(in srgb, var(--warn) 12%, var(--notice-bg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 45%, transparent); }
.notice.warn .w-icon { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--warn); color: #0b0b0b; font-weight: 700; font-size: 12px; display: grid; place-items: center; margin-top: 1px; }

/* determination */
.verdict { padding-top: 18px; }
.verdict .v-kicker { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.verdict .v-head { font-size: 30px; line-height: 1.15; margin: 4px 0 6px; letter-spacing: -0.01em; }
.verdict .v-why { color: var(--ink-2); max-width: 820px; margin: 0 0 14px; font-size: 15px; line-height: 1.5; }
.ladder { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 0; margin: 0 0 16px; }
.ladder .bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ring); }
.ladder li.past .bar { background: var(--axis); box-shadow: none; }
.ladder li.on .bar { background: var(--ink); box-shadow: none; }
.ladder .lbl { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.3; }
.ladder li.on .lbl { color: var(--ink); font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.facts .tile { box-shadow: none; }
.facts .tile .t-value { font-size: 20px; }
.section-head { margin: 36px 0 2px; padding-top: 16px; border-top: 2px solid var(--ink); }
.section-head h2 { font-size: 20px; margin: 0; }
.section-head .lede { color: var(--ink-2); margin: 4px 0 0; max-width: 820px; }
/* context: overall index per group */
.ctx-verdict { margin: 2px 0 12px; }
.ctx-verdict .cv-read { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.ctx-verdict .cv-sub { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.grows { margin: 6px 0 14px; }
.grow { display: grid; grid-template-columns: minmax(200px, 1.3fr) minmax(160px, 2fr) 190px; gap: 18px; align-items: center; padding: 9px 0; border-top: 1px solid var(--grid); }
.grow.ghead { border-top: 0; padding: 0 0 4px; font-size: 12px; color: var(--muted); }
.grow:not(.ghead):hover, .grow:focus-visible { background: var(--surface-2); }
.grow .g-name b { display: block; font-weight: 600; font-size: 14px; }
.grow .g-name span, .grow .g-pct span { display: block; color: var(--muted); font-size: 12px; }
.grow .g-pct b { font-variant-numeric: tabular-nums; font-size: 15px; }
.scale-lbl { position: relative; display: flex; justify-content: space-between; }
.scale-lbl .mid { position: absolute; transform: translateX(-50%); }
.strip { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--ring); }
.strip .tk { position: absolute; top: -3px; width: 1px; height: 14px; background: var(--axis); }
.strip .mk { position: absolute; top: 50%; width: 15px; height: 15px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid var(--ink); box-shadow: 0 0 0 2px var(--surface); box-sizing: border-box; }
.strip .mk.hollow { background: var(--surface); }
details.measures { margin-top: 6px; border-top: 1px solid var(--grid); padding-top: 12px; }
details.measures > summary { cursor: pointer; font-weight: 600; font-size: 15px; }
details.measures .lede { margin-top: 6px; }
.matrix th.cmp { text-align: center; font-size: 12px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--grid); padding-bottom: 4px; }

@media (max-width: 900px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grow { grid-template-columns: 1fr 150px; gap: 6px 14px; }
  .grow .strip { grid-column: 1 / -1; grid-row: 2; }
  .grow.ghead .scale-lbl { display: none; }
  .howto { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .person { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .multiples { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-meta .snap { display: none; }
}
@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; }
  .verdict .v-head { font-size: 24px; }
  .ladder .lbl { font-size: 10.5px; }
  .periods { width: 100%; overflow-x: auto; }
  .periods button { padding: 6px 9px; }
  .stat-line { gap: 4px 14px; }
  .topbar-inner, main { padding-left: 16px; padding-right: 16px; }
  .brand span { display: none; }
  .person h1 { font-size: 24px; }
  .tile.hero .t-value { font-size: 40px; }
}
