/* ===== tokens ===== */
:root {
  --blue: #4C68FF;
  --pink: #FFA8BA;
  --navy: #16204A;
  --r-lg: 22px;
  --r-md: 14px;
  --me-w: 340px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] {
  --bg: #0B1026;
  --glass: rgba(17, 24, 56, .74);
  --glass-solid: #121A3D;
  --stroke: rgba(255, 255, 255, .09);
  --ink: #F2F4FF;
  --ink-2: #B4BBDA;
  --ink-3: #8089AE;
  --fill: rgba(255, 255, 255, .06);
  --fill-2: rgba(255, 255, 255, .11);
  --accent-text: #9FB0FF;
  --chip-on: #F2F4FF;
  --chip-on-ink: #0B1026;
  --none: #3B4470;
  --shadow: 0 20px 50px rgba(0, 0, 0, .45), 0 0 0 1px var(--stroke);
}
:root[data-theme="light"] {
  --bg: #EEF0F6;
  --glass: rgba(255, 255, 255, .8);
  --glass-solid: #FFFFFF;
  --stroke: rgba(22, 32, 74, .08);
  --ink: #16204A;
  --ink-2: #4A5275;
  --ink-3: #737A94;
  --fill: rgba(22, 32, 74, .05);
  --fill-2: rgba(22, 32, 74, .09);
  --accent-text: #3A56E8;
  --chip-on: #16204A;
  --chip-on-ink: #FFFFFF;
  --none: #C3C7D6;
  --shadow: 0 18px 44px rgba(22, 32, 74, .16), 0 0 0 1px var(--stroke);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: Heebo, Arial, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#map { position: fixed; inset: 0; background: var(--bg); }
.glass { background: var(--glass); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4); }

/* ===== top bar ===== */
.topbar { position: fixed; top: 16px; left: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.row { display: flex; gap: 8px; align-items: center; width: 100%; pointer-events: none; }
.row > * { pointer-events: auto; }
.search { position: relative; display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 0 14px; height: 44px; width: var(--me-w); }
.search svg { color: var(--ink-3); }
.search input { border: 0; background: transparent; outline: none; width: 100%; font-size: 15px; height: 100%; }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search-list { position: absolute; top: 50px; right: 0; left: 0; list-style: none; margin: 0; padding: 6px; border-radius: var(--r-md); max-height: 320px; overflow-y: auto; background: var(--glass-solid); box-shadow: var(--shadow); z-index: 5; }
.search-list li { padding: 10px; border-radius: 10px; display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; cursor: pointer; }
.search-list li[aria-selected="true"], .search-list li:hover { background: var(--fill-2); }
.search-list small { color: var(--ink-3); white-space: nowrap; }
.actions { display: flex; gap: 8px; margin-right: auto; }
.act { display: flex; align-items: center; gap: 7px; height: 44px; padding: 0 16px; border: 0; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--ink); }
.act:hover { background: var(--glass-solid); }
.act.icon-only { width: 44px; padding: 0; justify-content: center; }
.act.share-btn { background: var(--blue); color: #fff; box-shadow: 0 8px 22px rgba(76,104,255,.35); }
.act.share-btn:hover { background: #5C76FF; }

.filters { display: flex; align-items: center; gap: 6px; border-radius: 26px; padding: 5px 6px; flex-wrap: wrap; margin-right: calc(var(--me-w) + 8px); max-width: calc(100% - var(--me-w) - 8px); }
.chips { display: flex; gap: 3px; }
.chip { border: 0; background: transparent; color: var(--ink-2); font-size: 13.5px; font-weight: 500; padding: 7px 12px; border-radius: 999px; white-space: nowrap; transition: background .15s, color .15s; }
.chip:hover { background: var(--fill); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); font-weight: 600; }
.chips.multi .chip[aria-pressed="true"] { background: var(--blue); color: #fff; }
.sep { width: 1px; height: 22px; background: var(--stroke); margin: 0 2px; flex: 0 0 auto; }
select.pick {
  border: 0; background-color: var(--fill); border-radius: 999px; padding: 7px 28px 7px 12px; font-size: 13.5px; appearance: none; color: var(--ink); flex: 0 0 auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238891B5' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 11px 50%; background-size: 10px 6px;
}
select.pick:not([data-empty]) { background-color: var(--blue); color: #fff; font-weight: 600; }
select option { background: var(--glass-solid); color: var(--ink); }
.reset { border: 0; background: transparent; color: var(--accent-text); font-size: 13px; font-weight: 600; padding: 6px 10px; flex: 0 0 auto; }
.reset { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; }
.reset[hidden] { display: none; }
.reset svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.reset:hover { background: var(--fill); }
.count { font-size: 12.5px; color: var(--ink-3); padding: 0 8px 0 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ===== my result ===== */
.me { position: fixed; top: 76px; right: 16px; width: var(--me-w); z-index: 1001; border-radius: var(--r-lg); padding: 16px; }
.me-head { display: flex; align-items: center; gap: 10px; }
.logo { display: block; line-height: 0; opacity: .92; }
.logo img { height: 19px; width: auto; }
.logo-light { display: none; }
:root[data-theme="light"] .logo-dark { display: none; }
:root[data-theme="light"] .logo-light { display: block; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--accent-text); }
.lead .l-short { display: none; }
.lead { margin: -4px 0 12px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.hero-cap { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,.85); margin-bottom: -4px; }
select.pick.quiet[data-empty] { background-color: transparent; color: var(--ink-3); font-weight: 500; }
.info { display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; margin: 0 3px; border: 0; border-radius: 50%; background: var(--fill-2); color: var(--ink-2); font: italic 700 11px/1 Georgia, serif; cursor: help; vertical-align: 1px; }
.info:hover, .info:focus-visible { background: var(--blue); color: #fff; }
.itip { position: fixed; z-index: 5000; padding: 10px 12px; border-radius: 12px; background: #16204A; color: #fff; font-size: 12.5px; line-height: 1.55; font-weight: 400; white-space: normal; text-align: right; box-shadow: 0 10px 30px rgba(0,0,0,.35); pointer-events: none; }
h1 { margin: 8px 0 12px; font-size: 22px; line-height: 1.15; font-weight: 900; letter-spacing: -.5px; }
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; border-radius: 16px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #2B3F9E 0%, #16204A 55%, #0E1534 100%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.hero-label { font-size: 12px; color: rgba(255,255,255,.66); }
.hero-num { font-size: 28px; font-weight: 900; letter-spacing: -.8px; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-num.accent { color: var(--pink); }
.hero-side { border-right: 1px solid rgba(255,255,255,.12); padding-right: 12px; min-width: 0; }
#maxName { color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin-top: 10px; padding: 10px 12px; border: 0; border-radius: 14px; background: var(--fill); text-align: right; }
.profile-line:hover { background: var(--fill-2); }
.profile-line.invite { background: color-mix(in srgb, var(--blue) 16%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--blue) 70%, transparent); }
.profile-line.invite .pl-k { color: var(--accent-text); font-weight: 700; font-size: 12.5px; }
.profile-line.invite #profileSummary { font-size: 13px; white-space: normal; }
.profile-line.invite .pl-edit { background: var(--blue); color: #fff; padding: 8px 14px; box-shadow: 0 6px 18px rgba(76,104,255,.4); animation: invite 2.4s ease-in-out 3; }
@keyframes invite { 50% { transform: scale(1.06); } }
.pl-text { display: flex; flex-direction: column; min-width: 0; }
.pl-k { font-size: 11.5px; color: var(--ink-3); }
#profileSummary { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-edit { flex: 0 0 auto; background: var(--blue); color: #fff; font-size: 13px; font-weight: 700; border-radius: 999px; padding: 6px 14px; }
.mode { margin-top: 10px; }

.seg { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--ink-2); transition: background .15s; }
.seg button[aria-checked="true"] { background: var(--glass-solid); color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.salary { margin-top: 10px; }
.salary[hidden] { display: none; }
.salary-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 2px; }
.salary-top output { font-weight: 800; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--blue); direction: ltr; height: 28px; }

/* ===== dialogs (sheets) ===== */
dialog.sheet { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: 540px; width: calc(100% - 32px); max-height: min(88vh, 860px); overflow: visible; }
dialog.sheet.wide { max-width: 820px; }
dialog.sheet::backdrop { background: rgba(5, 8, 22, .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.sheet[open] { animation: rise .28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.sheet-in { display: flex; flex-direction: column; max-height: min(88vh, 860px); background: var(--glass-solid); border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.sheet-head h2 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: -.3px; }
.sheet-body { overflow-y: auto; padding: 6px 20px 20px; overscroll-behavior: contain; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--stroke); }
.sf-res { display: flex; flex-direction: column; font-size: 12.5px; color: var(--ink-2); }
.sf-res b { font-size: 20px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.icon-btn { border: 0; background: var(--fill); width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--fill-2); color: var(--ink); }
.primary { border: 0; background: var(--blue); color: #fff; font-weight: 700; font-size: 15px; border-radius: 999px; padding: 12px 22px; }
.primary:hover { filter: brightness(1.08); }
.secondary { border: 1px solid var(--stroke); background: var(--fill); color: var(--ink); font-weight: 600; font-size: 15px; border-radius: 999px; padding: 11px 20px; }

.presets { display: flex; gap: 6px; overflow-x: auto; margin: 0 -20px 16px; padding: 2px 20px 4px; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.presets button { flex: 0 0 auto; border: 1px solid var(--stroke); background: var(--fill); border-radius: 999px; padding: 8px 14px; font-size: 13.5px; color: var(--ink-2); }
.presets button:hover { color: var(--ink); background: var(--fill-2); }
.field { margin-bottom: 16px; }
.field.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field.row .label { margin: 0; }
.label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.label small { font-weight: 400; color: var(--ink-3); }
.hint { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.hint:empty { display: none; }
.sheet select, .sheet input[type="number"], .sheet input[type="search"], textarea {
  width: 100%; border: 1px solid var(--stroke); background-color: var(--fill); border-radius: 12px; padding: 11px 12px; font-size: 16px; color: var(--ink);
}
.sheet select { appearance: none; padding-left: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238891B5' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 13px 50%; background-size: 10px 6px; }
textarea { resize: vertical; line-height: 1.5; font-size: 14.5px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; margin-top: 10px; cursor: pointer; }
.check[hidden] { display: none; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.kids { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kid { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 8px 7px 7px; border-radius: 12px; background: var(--fill); }
.kid span { font-size: 13.5px; color: var(--ink-2); }
.kid.on { background: color-mix(in srgb, var(--blue) 20%, transparent); }
.kid.on span { color: var(--ink); }
.stepper { display: inline-flex; align-items: center; gap: 2px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--fill-2); font-size: 18px; line-height: 1; display: grid; place-items: center; }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { min-width: 20px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.more { border-top: 1px solid var(--stroke); padding-top: 14px; }
.more summary { cursor: pointer; font-size: 14.5px; font-weight: 600; color: var(--accent-text); list-style: none; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(-45deg); margin-top: -3px; transition: transform .2s; }
.more[open] summary::after { transform: rotate(135deg); margin-top: 3px; }
.badge { background: var(--blue); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }

/* stats */
.tabs { display: flex; gap: 18px; padding: 0 20px; border-bottom: 1px solid var(--stroke); overflow-x: auto; scrollbar-width: none; flex: 0 0 auto; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 8px 0 11px; font-size: 14.5px; font-weight: 600; color: var(--ink-3); position: relative; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--blue); }
.tabpane { padding-top: 14px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.kpi { background: var(--fill); border-radius: 14px; padding: 12px; }
.kpi .k { font-size: 12px; color: var(--ink-3); }
.kpi .v { font-size: 22px; font-weight: 900; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--ink-2); }
.tbl-wrap { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; font-weight: 600; color: var(--ink-3); font-size: 12px; padding: 8px 6px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
.tbl td.n, .tbl th.n { text-align: left; }
.tbl tr.sum td { font-weight: 800; border-bottom: 0; }
.tbl .rate { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.tbl .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tbl .pb { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.tbl .pb i { display: block; height: 6px; border-radius: 3px; background: var(--blue); min-width: 2px; }
.tbl .muted { color: var(--ink-3); font-weight: 400; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--fill); }
.sub-h { font-size: 15px; font-weight: 800; margin: 20px 0 8px; }
.note-s { font-size: 12px; color: var(--ink-3); margin-top: 10px; line-height: 1.5; }
.about p, .about li { font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.about b { color: var(--ink); }
.about a { color: var(--accent-text); }
.rank { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.rank li { counter-increment: r; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; padding: 9px 6px; border-radius: 12px; cursor: pointer; }
.rank li:hover { background: var(--fill); }
.rank li::before { content: counter(r); color: var(--ink-3); font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.rank .nm { font-size: 14px; font-weight: 600; }
.rank .nm i { font-style: normal; font-weight: 500; color: var(--ink-3); font-size: 12px; margin-right: 6px; }
.rank .bar { height: 4px; border-radius: 2px; margin-top: 5px; background: var(--fill-2); overflow: hidden; direction: ltr; }
.rank .bar b { display: block; height: 100%; border-radius: 2px; }
.rank .v { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.new-b { display: inline-block; font-size: 10.5px; font-weight: 700; color: var(--navy); background: var(--pink); border-radius: 999px; padding: 0 6px; margin-right: 6px; vertical-align: 1px; }

/* advanced */
.adv-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text); font-weight: 600; }
.adv-btn svg { width: 16px; height: 16px; }
.adv-btn.on { background: var(--pink); color: var(--navy); }
.adv-btn .badge { background: var(--navy); }
.adv-sec { margin-bottom: 18px; }
.adv-select { width: 100%; }
.ranges { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.rg { background: var(--fill); border-radius: 12px; padding: 9px 10px; }
.rg.on { box-shadow: inset 0 0 0 1.5px var(--blue); }
.rg .rl { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.rg .rl small { font-weight: 400; color: var(--ink-3); white-space: nowrap; }
.rg .ri { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.rg .ri input { width: 100%; min-width: 0; padding: 7px 8px; font-size: 14px; border-radius: 9px; }
.rg .ri span { color: var(--ink-3); }
.rg.na { opacity: .5; }
.chips.wrap { flex-wrap: wrap; gap: 6px; }
.chips.wrap .chip { background: var(--fill); }
.chips.wrap .chip[aria-pressed="true"] { background: var(--blue); color: #fff; }
.scatter-wrap { margin-top: 10px; background: var(--fill); border-radius: 14px; padding: 6px; }
#scatter { display: block; width: 100%; height: auto; direction: ltr; }
#scatter text { font-family: Heebo, Arial, sans-serif; fill: var(--ink-3); font-size: 12px; }
#scatter .ax { stroke: var(--stroke); }
#scatter circle { cursor: pointer; }
#scatter circle:hover { stroke: var(--pink); stroke-width: 2; }
.adv-count { font-size: 13px; color: var(--ink-2); margin-left: auto; }
.muted { color: var(--ink-3); }

/* coloring toggles */
.tg-group { margin-bottom: 16px; }
.tg-title { font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin: 0 2px 6px; }
.tg { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border: 0; background: var(--fill); color: var(--ink);
  border-radius: 14px; padding: 11px 14px; margin-bottom: 6px; text-align: right; min-height: 52px; }
.tg:hover { background: var(--fill-2); }
.tg-l { display: flex; flex-direction: column; font-size: 14.5px; font-weight: 600; }
.tg-l small { font-size: 11.5px; font-weight: 400; color: var(--ink-3); margin-top: 1px; }
.switch { flex: 0 0 auto; width: 44px; height: 26px; border-radius: 13px; background: var(--fill-2); position: relative; transition: background .2s; }
.switch i { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: right .2s var(--ease); }
.tg[aria-checked="true"] { box-shadow: inset 0 0 0 1.5px var(--blue); }
.tg[aria-checked="true"] .switch { background: var(--blue); }
.tg[aria-checked="true"] .switch i { right: 21px; }

/* share */
.post-wrap { border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 1px var(--stroke); }
.post-wrap canvas { display: block; width: 100%; height: auto; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 10px; }
.sh { display: flex; align-items: center; justify-content: center; height: 44px; border-radius: 12px; border: 0; background: var(--fill); color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; }
.sh:hover { background: var(--fill-2); }
.sh.wa { background: #25D366; color: #06240F; }
.sh.fb { background: #1877F2; color: #fff; }
.sh.x { background: #000; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.sh.tg { background: #229ED9; color: #fff; }
.sh.li { background: #0A66C2; color: #fff; }
.share-main { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.share-main > * { flex: 1 1 180px; }

/* ===== legend ===== */
.legend { position: fixed; left: 16px; bottom: 22px; z-index: 1000; width: 320px; border-radius: 18px; padding: 12px 14px 10px; }
.legend-title { font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }
.hist { display: flex; align-items: flex-end; gap: 2px; height: 58px; direction: ltr; }
.hist button { flex: 1; border: 0; padding: 0; border-radius: 3px 3px 1px 1px; min-height: 2px; transition: opacity .15s, height .35s var(--ease); }
.hist button[data-off] { opacity: .22; }
.hist-axis { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); direction: ltr; font-variant-numeric: tabular-nums; }
.legend-none { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.legend-none .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--none); flex: 0 0 auto; }

/* ===== locality card ===== */
.card { position: fixed; left: 16px; top: 152px; width: 330px; z-index: 1002; border-radius: var(--r-lg); padding: 18px 18px 16px; max-height: calc(100vh - 152px - 220px); overflow-y: auto; scrollbar-width: thin; animation: pop .25s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.card[hidden] { display: none; }
.card .close { position: absolute; left: 12px; top: 12px; width: 32px; height: 32px; }
.card h3 { margin: 0 0 2px; font-size: 22px; font-weight: 900; letter-spacing: -.4px; padding-left: 40px; }
.card .sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }
.card .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.card .tag { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; background: var(--fill-2); color: var(--ink-2); }
.card .tag.pink { background: var(--pink); color: var(--navy); }
.card .tag.blue { background: var(--blue); color: #fff; }
.card .big-l { font-size: 12.5px; color: var(--ink-2); }
.card .big { font-size: 36px; font-weight: 900; letter-spacing: -1.2px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.card .compare { margin: 12px 0 4px; }
.card .cmp-row { display: grid; grid-template-columns: 82px 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; }
.card .cmp-row .b { height: 8px; border-radius: 4px; background: var(--fill-2); overflow: hidden; direction: ltr; }
.card .cmp-row .b span { display: block; height: 100%; border-radius: 4px; }
.card .cmp-row b { font-variant-numeric: tabular-nums; color: var(--ink); }
.card dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 10px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--stroke); font-size: 13.5px; }
.card dt { color: var(--ink-2); }
.card dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: left; }
.card .more-data { margin-top: 10px; border-top: 1px solid var(--stroke); padding-top: 10px; }
.card .more-data summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.card .more-data dl { border-top: 0; padding-top: 4px; margin-top: 6px; }
.card .note { margin-top: 10px; font-size: 12px; color: var(--ink-3); line-height: 1.45; }

/* ===== toast ===== */
.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 12px); z-index: 3000; opacity: 0; pointer-events: none;
  background: var(--navy); color: #fff; border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.35); transition: opacity .25s, transform .25s var(--ease); white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--pink); }

/* ===== leaflet ===== */
.leaflet-container { font-family: Heebo, Arial, sans-serif; background: var(--bg); }
.leaflet-tooltip.tip { border: 0; border-radius: 12px; padding: 8px 11px; font-size: 13px; color: var(--ink); direction: rtl; text-align: right; background: var(--glass-solid); box-shadow: var(--shadow); }
.leaflet-tooltip.tip b { font-weight: 800; }
.leaflet-tooltip.tip .t2 { color: var(--ink-2); }
.leaflet-tooltip.tip::before { display: none; }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 14px !important; overflow: hidden; }
.leaflet-control-zoom a { background: var(--glass-solid) !important; color: var(--ink) !important; border-color: var(--stroke) !important; }
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin-right: 16px !important; margin-bottom: 28px !important; }
.leaflet-control-attribution { font-size: 10px; background: var(--glass) !important; color: var(--ink-3) !important; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(1.25) contrast(1.1) sepia(.5) hue-rotate(190deg) saturate(2.2); }

/* ===== OG capture mode (?og=1) ===== */
.og .topbar, .og .me, .og .legend, .og .card, .og .leaflet-control-container { display: none !important; }
.og-cover { position: fixed; inset: 0; z-index: 4000; pointer-events: none; display: flex; flex-direction: column; justify-content: center; padding: 0 64px; gap: 14px;
  background: linear-gradient(90deg, rgba(11,16,38,0) 34%, rgba(11,16,38,.92) 56%, #0B1026 70%); color: #fff; align-items: flex-start; }
.og-cover .ogt { font-size: 58px; font-weight: 900; line-height: 1.04; letter-spacing: -1.5px; max-width: 600px; }
.og-cover .ogs { font-size: 26px; color: #B4BBDA; max-width: 560px; line-height: 1.35; }
.og-cover .ogn { display: flex; gap: 26px; margin-top: 8px; }
.og-cover .ogn div { font-size: 18px; color: #B4BBDA; }
.og-cover .ogn b { display: block; font-size: 50px; font-weight: 900; color: #fff; letter-spacing: -1px; }
.og-cover .ogn .pk b { color: #FFA8BA; }
.og-cover img { height: 34px; margin-top: 14px; }


/* ===== cross tables ===== */
.tbl.cross td:first-child { white-space: normal; min-width: 140px; }
.tbl.cross td.b { font-weight: 700; }
.tbl.cross tr.muted-row td { color: var(--ink-3); font-size: 12px; }

/* ===== insights ===== */
.disclaimer { background: color-mix(in srgb, #FFC156 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, #FFC156 45%, transparent); border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.6; color: var(--ink-2); margin-bottom: 14px; }
.disclaimer b { color: var(--ink); }
.ins-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.kpi .v.sm { font-size: 15px; line-height: 1.3; letter-spacing: 0; }
.tbl.corr td:first-child { white-space: normal; min-width: 150px; }
.cbar { display: inline-flex; align-items: center; direction: ltr; vertical-align: middle; margin-left: 6px; }
.cbar .cneg, .cbar .cpos { display: flex; width: 50px; height: 10px; }
.cbar .cneg { justify-content: flex-end; border-right: 1px solid var(--ink-3); }
.cbar i { display: block; height: 10px; border-radius: 2px; }
.cbar .cneg i { background: var(--pink); }
.cbar .cpos i { background: var(--blue); }
.cval { font-variant-numeric: tabular-nums; display: inline-block; min-width: 40px; text-align: left; }
.cl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cl-chart { background: var(--fill); border-radius: 14px; padding: 12px; }
.cl-t { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.cl-row { display: grid; grid-template-columns: 20px 1fr 52px; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12.5px; }
.cl-k { color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.cl-b { height: 10px; background: var(--fill-2); border-radius: 5px; overflow: hidden; direction: ltr; }
.cl-b i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--pink)); border-radius: 5px; }
.cl-v { text-align: left; font-variant-numeric: tabular-nums; font-weight: 600; }
.cl-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.tbl.fit td { white-space: normal; line-height: 1.4; }
.og-cover .ogp { line-height: 1.4; font-size: 21px; color: #B4BBDA; margin-top: 6px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.14); }
.og-cover .ogp b { color: #fff; font-weight: 800; }

/* ===== loading state ===== */
body.loading .hero-num { color: transparent !important; background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.18), rgba(255,255,255,.08)); background-size: 200% 100%; border-radius: 8px; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== motion & touch ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (pointer: coarse) {
  .chip { min-height: 38px; }
  select.pick { min-height: 38px; }
  .seg button { min-height: 40px; }
}

/* ===== tablet ===== */
@media (max-width: 1100px) {
  .act:not(.share-btn):not(.labelled) span { display: none; }
  .act:not(.share-btn):not(.labelled) { width: 44px; padding: 0; justify-content: center; }
}

/* ===== phone ===== */
@media (max-width: 760px) {
  .topbar { top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; gap: 6px; align-items: stretch; }
  .search { width: auto; flex: 1; min-width: 0; height: 44px; }
  .actions { gap: 6px; }
  .act.share-btn, .act.labelled { flex-direction: column; gap: 1px; width: auto; min-width: 48px; padding: 4px 8px; height: 44px; justify-content: center; border-radius: 14px; }
  .act.share-btn span, .act.labelled span { display: block; font-size: 10.5px; line-height: 1; font-weight: 600; }
  .act.share-btn svg, .act.labelled svg { width: 16px; height: 16px; }
  .filters { max-width: none; margin-right: 0; flex-wrap: nowrap; overflow-x: auto; border-radius: 999px; scrollbar-width: none; padding: 4px; }
  .filters::-webkit-scrollbar { display: none; }
  .chip { padding: 8px 12px; }
  .count { display: none; }
  /* phone: the reset pill floats just under the filter strip (which scrolls sideways), so it is always one tap away */
  .reset { position: fixed; top: calc(110px + env(safe-area-inset-top)); right: 8px; z-index: 1002; background: #FF5C7A; color: #fff; font-size: 13.5px; font-weight: 700; padding: 0 14px; min-height: 38px; box-shadow: 0 6px 18px rgba(255,92,122,.45); }
  .reset:hover { background: #FF4A6B; }
  .filters.has-active { box-shadow: inset 0 0 0 1.5px rgba(255,92,122,.55); }

  .me { top: auto; right: 0; left: 0; bottom: 0; width: auto; border-radius: 22px 22px 0 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .me h1 { display: none; }
  .lead { font-size: 12.5px; margin: 0 0 8px; line-height: 1.45; }
  .lead .l-long { display: none; } .lead .l-short { display: inline; }
  .hero-cap { font-size: 11.5px; }
  .me-head { margin-bottom: 8px; }
  .hero { padding: 10px 12px; gap: 10px; }
  .hero-num { font-size: 24px; }
  .profile-row { margin-top: 8px; }
  .profile-line { padding: 9px 12px; }
  .pl-reset { padding: 0 10px; }
  .mode { margin-top: 8px; }
  .card-open .me { display: none; }

  .legend { left: 8px; right: auto; bottom: auto; top: calc(108px + env(safe-area-inset-top)); width: 176px; padding: 8px 10px 7px; border-radius: 14px; }
  .legend-title { font-size: 11px; margin-bottom: 6px; line-height: 1.3; }
  .hist { height: 30px; }
  .hist-axis { font-size: 10.5px; }
  .legend-none { display: none; }
  .card-open .legend { display: none; }


  .card { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 62vh; border-radius: 22px 22px 0 0; background: var(--glass-solid); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .card .big { font-size: 30px; }
  .leaflet-control-zoom { display: none; }

  dialog.sheet, dialog.sheet.wide { width: 100%; max-width: none; margin: auto 0 0; max-height: 92vh; }
  .sheet-in { max-height: 92vh; border-radius: 24px 24px 0 0; }
  dialog.sheet[open] { animation: up .3s var(--ease); }
  @keyframes up { from { transform: translateY(40px); opacity: .4; } }
  .kpis { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .kpi { padding: 10px; }
  .kpi .v { font-size: 18px; }
  .share-grid { grid-template-columns: repeat(3, 1fr); }
  .tbl .hp, .tbl .pb i { display: none; }
  .cl-grid, .ins-kpis { grid-template-columns: 1fr; }
  .tbl.corr .cbar { display: none; }
  .tbl.corr .cval.neg { color: var(--pink); }
  .tbl.corr .cval.pos { color: var(--accent-text); }
  .tbl.corr td:first-child { min-width: 0; }
  .ranges { grid-template-columns: 1fr; }
  .tbl { font-size: 13px; }
  .tbl th, .tbl td { padding-left: 4px; padding-right: 4px; }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* the user's own locality: field in the profile + row in the hero */
.home-pick { position: relative; }
.home-pick input { padding-left: 40px !important; }
.home-pick input::-webkit-search-cancel-button { display: none; }
.home-pick .search-list { top: 48px; max-height: 240px; }
.home-clear { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--ink-3); display: grid; place-items: center; }
.home-clear[hidden] { display: none; }
.home-clear svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.home-clear:hover { background: var(--fill-2); color: var(--ink); }
.hero-home { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; margin-top: 2px; padding: 10px 0 0; border: 0; border-top: 1px solid rgba(255,255,255,.14); background: transparent; color: #fff; text-align: right; cursor: pointer; }
.hero-home[hidden] { display: none; }
.hero-home .hh-l { font-size: 12.5px; color: rgba(255,255,255,.75); min-width: 0; }
.hero-home .hh-l b { color: #fff; font-weight: 700; }
.hero-home .hh-n { font-size: 22px; font-weight: 900; letter-spacing: -.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-home .hh-d { flex-basis: 100%; font-size: 12px; color: rgba(255,255,255,.66); }
.hero-home:hover .hh-l b { text-decoration: underline; text-underline-offset: 3px; }

/* cost of the credits: line on the opening screen + tab */
.cost-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: 8px; padding: 8px 12px; border: 0; border-radius: 12px; background: transparent; box-shadow: inset 0 0 0 1px var(--stroke); color: var(--ink-2); font-size: 13px; text-align: right; line-height: 1.45; }
.cost-line b { color: var(--ink); font-weight: 800; white-space: nowrap; }
.cost-line .cl-more { color: var(--accent-text); }
.cost-line svg { width: 14px; height: 14px; flex: 0 0 auto; fill: none; stroke: var(--ink-3); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.cost-line:hover { background: var(--fill); }
.lead-s { font-size: 14px; line-height: 1.65; color: var(--ink-2); margin: 2px 0 14px; }
.lead-s b { color: var(--ink); }
.cost-bars { margin: 4px 0 6px; }
.cost-row { display: grid; grid-template-columns: 40px 1fr 92px; align-items: center; gap: 8px; margin-bottom: 5px; font-size: 13px; }
.cost-row .ck { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cost-row .cb { height: 14px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.cost-row .cb i { display: block; height: 100%; border-radius: 4px; background: color-mix(in srgb, var(--blue) 55%, transparent); }
.cost-row.hl .cb i { background: var(--pink); }
.cost-row .cv { font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.cost-row.hl .cv { color: var(--ink); font-weight: 700; }
.cost-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin: -2px 100px 8px 48px; }
.cost-list { margin: 6px 0 8px; padding-right: 18px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.cost-list li { margin-bottom: 6px; }
.cost-list b { color: var(--ink); }
@media (max-width: 760px) {
  .cost-line { font-size: 12.5px; padding: 7px 10px; margin-top: 6px; }
  .cost-axis { margin: -2px 0 8px; }
}

/* home cost line: headline + who gains most */
.cost-line .cl-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cost-line .cl-sub { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.cost-line .cl-sub b { color: var(--accent-text); font-weight: 800; white-space: normal; }
@media (max-width: 640px) { .cost-line .cl-sub { font-size: 11.5px; } }
.about .credit { margin-top: 18px; font-size: 12px; color: var(--ink-3); }

/* profile line + one-tap reset */
.profile-row { display: flex; align-items: stretch; gap: 6px; margin-top: 10px; }
.profile-row .profile-line { margin-top: 0; flex: 1 1 auto; min-width: 0; }
.pl-reset { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0 12px; border: 0; border-radius: 14px; background: var(--fill); color: var(--ink-2); font-size: 11px; font-weight: 600; }
.pl-reset[hidden], .sf-reset[hidden] { display: none; }
.pl-reset:hover { background: var(--fill-2); color: var(--ink); }
.pl-reset svg, .sf-reset svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sf-reset { display: inline-flex; align-items: center; gap: 5px; margin-inline-start: auto; border: 0; background: transparent; color: var(--ink-2); font-size: 13.5px; font-weight: 600; padding: 8px 10px; border-radius: 999px; }
.sf-reset:hover { background: var(--fill); color: var(--ink); }
.sf-reset svg { width: 14px; height: 14px; }

/* search results must sit above the filter strip and the bottom panel (Android showed them cut off behind both) */
.search { z-index: 3; }
.topbar:has(.search-list:not([hidden])), body.searching .topbar { z-index: 1010; }
.search-list li.empty { display: block; cursor: default; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.search-list li.empty:hover { background: transparent; }
.search-list em { font-style: normal; color: var(--ink-3); font-size: 13px; }
@media (max-width: 760px) {
  body.searching .me, body.searching .legend, body.searching .card, body.searching .reset { visibility: hidden; }
  .row .search-list { left: auto; width: calc(100vw - 16px); }
}
