:root {
  --navy-950: #061a2c;
  --navy-900: #08233b;
  --navy-800: #0d3151;
  --blue: #2f78ff;
  --blue-soft: #e7f1ff;
  --coral: #ff5d67;
  --coral-soft: #ffebed;
  --gold: #f3b822;
  --gold-soft: #fff4cf;
  --violet: #7357e8;
  --violet-soft: #eeeaff;
  --cyan: #13bdd0;
  --ink: #10283e;
  --muted: #677b8e;
  --line: #dce7ef;
  --surface: #ffffff;
  --background: #f3f7fb;
  --shadow: 0 18px 50px rgba(8, 35, 59, 0.09);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, select { font: inherit; }

button, a, select { -webkit-tap-highlight-color: transparent; }

.icon-library {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-shell { min-height: 100vh; }

.topbar {
  height: 74px;
  padding: 0 clamp(22px, 5vw, 76px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  color: #fff;
  background: var(--navy-950);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--blue), #1dbdd0);
  box-shadow: 0 8px 24px rgba(47, 120, 255, 0.35);
}

.brand-mark svg { width: 19px; height: 19px; stroke-width: 0; fill: white; }
.brand strong { font-size: 1.03rem; }
.brand b { color: #60c8ff; font-size: 1.03rem; }
.topbar-logo { display: block; width: 150px; height: auto; }

.topbar-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-pill {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-pill.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-pill.muted { color: #8ea6ba; border: 1px solid rgba(255,255,255,.1); }

.method-button {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  color: #dcecff;
  background: rgba(255,255,255,.06);
  cursor: pointer;
  font-weight: 650;
  transition: .2s ease;
}

.method-button:hover { background: rgba(255,255,255,.12); transform: translateY(-1px); }

main { overflow: hidden; }

.hero {
  position: relative;
  min-height: 360px;
  padding: 58px max(6vw, 28px) 112px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr);
  align-items: center;
  gap: 56px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 86% 15%, rgba(49, 169, 255, .19) 0 2px, transparent 3px) 0 0 / 28px 28px,
    linear-gradient(118deg, var(--navy-950) 0%, #0b2d4b 58%, #104563 100%);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 74px;
  background: var(--background);
  clip-path: polygon(0 65%, 100% 0, 100% 100%, 0 100%);
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
  pointer-events: none;
}

.orb-one { width: 270px; height: 270px; right: 5%; top: -115px; border: 52px solid rgba(255,93,103,.12); }
.orb-two { width: 115px; height: 115px; right: 31%; bottom: 40px; background: rgba(243,184,34,.1); }

.hero-copy, .hero-stat { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: #89d8ff;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.eyebrow i {
  width: 22px;
  height: 3px;
  border-radius: 99px;
  background: var(--coral);
}

.hero h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: .99;
  letter-spacing: -.055em;
}

.hero h1 em { color: #65cfff; font-style: normal; }

.hero-copy p {
  max-width: 660px;
  margin: 22px 0 0;
  color: #bfd3e3;
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  line-height: 1.65;
}

.hero-stat {
  justify-self: end;
  width: min(100%, 330px);
  padding: 28px 30px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 24px;
  background: rgba(255,255,255,.08);
  box-shadow: 0 24px 60px rgba(0,0,0,.13);
  backdrop-filter: blur(12px);
}

.hero-stat > span { color: #9bd8f4; font-size: .74rem; letter-spacing: .13em; font-weight: 800; }
.hero-stat > strong { display: block; margin-top: 4px; font-size: 4.15rem; line-height: 1; letter-spacing: -.06em; }
.hero-stat > p { margin: 6px 0 20px; color: #bad0df; }
.hero-stat-line { display: flex; gap: 9px; align-items: center; padding-top: 15px; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; }
.hero-stat-line i { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 5px rgba(243,184,34,.13); }

.filter-card {
  position: relative;
  z-index: 3;
  width: min(1380px, calc(100% - 40px));
  min-height: 116px;
  margin: -94px auto 0;
  padding: 21px 22px;
  display: grid;
  grid-template-columns: minmax(230px, 1.2fr) repeat(3, minmax(170px, 1fr)) 50px;
  align-items: end;
  gap: 14px;
  border: 1px solid rgba(220,231,239,.85);
  border-radius: 22px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 22px 60px rgba(8, 35, 59, .14);
}

.filter-title { align-self: center; display: flex; gap: 13px; align-items: center; padding-right: 16px; }
.filter-icon { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; color: var(--blue); background: var(--blue-soft); }
.filter-title span:not(.filter-icon) { color: var(--blue); font-size: .7rem; font-weight: 850; letter-spacing: .12em; }
.filter-title h2 { margin: 3px 0 0; font-size: 1.14rem; line-height: 1.2; }

.select-field { display: grid; gap: 6px; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .02em; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-label-row button { padding: 0; border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: .65rem; font-weight: 850; }
.field-label-row button:hover { text-decoration: underline; }
.select-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 40px 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #f9fbfd;
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
  outline: none;
}
.select-field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,120,255,.12); }
.select-field select:disabled { color: #9eacb8; cursor: not-allowed; }

.reset-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: var(--navy-900);
  cursor: pointer;
  transition: .2s ease;
}
.reset-button:hover { transform: rotate(-12deg); background: var(--blue); }

.dashboard { width: min(1380px, calc(100% - 40px)); margin: 42px auto 56px; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.section-kicker, .panel-heading span:first-child { color: var(--blue); font-size: .72rem; font-weight: 850; letter-spacing: .13em; }
.section-heading h2 { margin: 4px 0 0; font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: -.035em; }
.source-chip { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: .82rem; font-weight: 650; }
.source-chip i { width: 8px; height: 8px; border-radius: 50%; background: #1eae69; box-shadow: 0 0 0 5px rgba(30,174,105,.12); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 17px; }
.kpi-card {
  position: relative;
  min-height: 150px;
  padding: 24px;
  display: flex;
  gap: 17px;
  align-items: flex-start;
  overflow: hidden;
  border: 1px solid rgba(220,231,239,.9);
  border-radius: 21px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(8,35,59,.055);
  transition: transform .2s ease, box-shadow .2s ease;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.kpi-icon { position: relative; z-index: 1; width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 15px; }
.kpi-card > div { position: relative; z-index: 1; min-width: 0; }
.kpi-card div > span { display: block; color: var(--muted); font-size: .78rem; font-weight: 700; }
.kpi-card strong { display: block; margin-top: 7px; color: var(--ink); font-size: clamp(1.7rem, 2.3vw, 2.25rem); line-height: 1; letter-spacing: -.045em; white-space: nowrap; }
.kpi-card small { display: block; margin-top: 8px; color: var(--muted); font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-decoration { position: absolute; width: 86px; height: 86px; right: -37px; bottom: -37px; border-radius: 28px; transform: rotate(22deg); opacity: .62; }
.kpi-blue .kpi-icon, .kpi-blue .kpi-decoration { color: var(--blue); background: var(--blue-soft); }
.kpi-coral .kpi-icon, .kpi-coral .kpi-decoration { color: var(--coral); background: var(--coral-soft); }
.kpi-gold .kpi-icon, .kpi-gold .kpi-decoration { color: #b57800; background: var(--gold-soft); }
.kpi-violet .kpi-icon, .kpi-violet .kpi-decoration { color: var(--violet); background: var(--violet-soft); }

.geo-panel { margin-top: 19px; padding: 25px; }
.geo-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.geo-heading h3 { margin: 4px 0 0; font-size: 1.3rem; letter-spacing: -.025em; }
.geo-heading p { margin: 4px 0 0; color: var(--muted); font-size: .8rem; }
.geo-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.map-nav-button { min-height: 39px; padding: 8px 11px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #c7d9e8; border-radius: 11px; color: var(--navy-900); background: #fff; cursor: pointer; font-size: .72rem; font-weight: 800; white-space: nowrap; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.map-nav-button:hover { border-color: var(--blue); transform: translateY(-1px); box-shadow: 0 7px 15px rgba(47,120,255,.1); }
.map-nav-button:focus-visible { outline: 3px solid rgba(47,120,255,.2); outline-offset: 2px; }
.map-nav-button.primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.map-nav-button svg { width: 15px; height: 15px; }
.map-nav-button:not(.primary) svg { transform: rotate(180deg); }
.map-nav-button[hidden] { display: none; }
.map-howto { margin-top: 16px; padding: 13px 15px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid #c9ddf2; border-radius: 14px; color: #365269; background: linear-gradient(100deg, #edf6ff, #f8fbff); }
.map-howto-icon { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--blue); box-shadow: 0 6px 14px rgba(47,120,255,.2); }
.map-howto-icon svg { width: 16px; height: 16px; }
.map-howto strong { display: block; color: var(--navy-900); font-size: .78rem; }
.map-howto p { margin: 4px 0 0; font-size: .72rem; line-height: 1.6; }
.map-howto p b { color: var(--blue); }
.geo-layout { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) 315px; gap: 18px; }
.map-wrap { position: relative; min-height: 390px; display: grid; place-items: center; overflow: hidden; border: 1px solid #d8e5ef; border-radius: 18px; background: radial-gradient(circle at 50% 35%, #fff 0, #f4f9fd 72%); }
.map-wrap::before { content: ""; position: absolute; inset: 0; opacity: .42; background-image: radial-gradient(#c8d9e7 1px, transparent 1px); background-size: 18px 18px; pointer-events: none; }
#territoryMap { position: relative; z-index: 1; width: calc(100% - 34px); height: 330px; overflow: visible; }
#territoryMap path { stroke: #fff; stroke-width: 1px; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .18s ease, opacity .18s ease, stroke .18s ease; }
#territoryMap path:hover, #territoryMap path:focus-visible { stroke: var(--navy-950); stroke-width: 1.6px; outline: none; }
#territoryMap path.map-selected { stroke: var(--navy-950); stroke-width: 2.2px; filter: drop-shadow(0 2px 2px rgba(8,35,59,.28)); }
.map-tooltip { position: absolute; z-index: 5; min-width: 190px; max-width: 245px; padding: 12px 14px; border-radius: 12px; color: #fff; background: rgba(6,26,44,.96); box-shadow: 0 12px 30px rgba(6,26,44,.25); pointer-events: none; transform: translate(12px, -50%); }
.map-tooltip strong { display: block; font-size: .82rem; }
.map-tooltip span { display: block; margin-top: 5px; color: #b9d3e5; font-size: .7rem; }
.map-tooltip b { color: #77d3ff; }
.map-loading { position: absolute; z-index: 6; inset: 0; display: none; place-content: center; gap: 10px; color: var(--muted); background: rgba(248,251,253,.78); font-size: .78rem; font-weight: 700; }
.map-wrap.loading .map-loading { display: grid; }
.map-loading span { width: 25px; height: 25px; margin: 0 auto; border: 3px solid #cfdfeb; border-top-color: var(--blue); border-radius: 50%; animation: map-spin .8s linear infinite; }
@keyframes map-spin { to { transform: rotate(360deg); } }
.map-legend { position: absolute; z-index: 2; left: 18px; bottom: 15px; display: flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid rgba(210,225,236,.9); border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.9); font-size: .63rem; font-weight: 700; }
.map-color-scale { width: 88px; height: 9px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; }
.map-color-scale b { display: block; border-radius: 2px; }
.map-color-scale b:nth-child(1) { background: #d9ecff; }
.map-color-scale b:nth-child(2) { background: #63c7da; }
.map-color-scale b:nth-child(3) { background: #32a27f; }
.map-color-scale b:nth-child(4) { background: #f2b84b; }
.map-color-scale b:nth-child(5) { background: #ec6b5f; }
.map-ranking { padding: 20px; border-radius: 18px; color: #fff; background: linear-gradient(150deg, var(--navy-950), #103c5d); }
.map-ranking-heading span { display: block; color: #81d5ff; font-size: .67rem; font-weight: 850; letter-spacing: .11em; }
.map-ranking-heading strong { display: block; margin-top: 5px; font-size: 1.08rem; }
.map-ranking-list { margin-top: 17px; display: grid; gap: 9px; }
.map-rank-row { padding: 10px 11px; display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 9px; border: 1px solid rgba(255,255,255,.09); border-radius: 11px; background: rgba(255,255,255,.055); }
.map-rank-row.selected { border-color: rgba(117,208,255,.7); background: rgba(47,120,255,.2); }
.map-rank-row > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; color: #9ddfff; background: rgba(255,255,255,.09); font-size: .66rem; font-weight: 850; }
.map-rank-row div { min-width: 0; }
.map-rank-row strong { display: block; overflow: hidden; color: #fff; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.map-rank-row small { display: block; margin-top: 2px; color: #a9c2d4; font-size: .64rem; }
.map-rank-row b { color: #8edaff; font-size: .8rem; }
.map-ranking > p { margin: 16px 0 0; padding-top: 14px; display: flex; gap: 7px; border-top: 1px solid rgba(255,255,255,.1); color: #b8cedd; font-size: .68rem; line-height: 1.5; }
.map-ranking > p svg { width: 15px; height: 15px; flex: 0 0 auto; color: #81d5ff; }
.map-source { margin: 13px 0 0; color: var(--muted); font-size: .68rem; }
.map-source a { color: var(--blue); font-weight: 700; text-underline-offset: 2px; }
.map-error { margin: 0; padding: 18px; color: #ffd5d9; font-size: .76rem; }

.main-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: 19px; margin-top: 19px; }
.secondary-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 19px; margin-top: 19px; }
.panel {
  min-width: 0;
  padding: 25px;
  border: 1px solid rgba(220,231,239,.9);
  border-radius: 23px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(8,35,59,.055);
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.panel-heading h3 { margin: 4px 0 0; font-size: 1.23rem; letter-spacing: -.025em; }
.panel-badge { padding: 7px 10px; border-radius: 9px; color: var(--muted); background: #f2f6f9; font-size: .72rem; font-weight: 700; }
.panel-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; }
.panel-icon.wallet { color: #ae7100; background: var(--gold-soft); }

.sex-layout { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 22px; min-height: 230px; }
.donut-wrap { display: grid; place-items: center; }
.donut {
  width: 170px;
  aspect-ratio: 1;
  padding: 17px;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 50%, var(--coral) 50% 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.02), 0 16px 35px rgba(47,120,255,.12);
  transition: background .35s ease;
}
.donut > div { width: 100%; height: 100%; display: grid; place-content: center; text-align: center; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1px #edf3f7; }
.donut strong { display: block; font-size: 1.35rem; letter-spacing: -.04em; }
.donut span { color: var(--muted); font-size: .72rem; }
.sex-legend { display: grid; gap: 11px; }
.legend-item { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: #f8fafc; }
.legend-item > i { width: 10px; height: 10px; border-radius: 50%; }
.legend-item.male > i { background: var(--blue); }
.legend-item.female > i { background: var(--coral); }
.legend-item span { font-size: .78rem; font-weight: 750; }
.legend-item small { display: block; margin-top: 1px; color: var(--muted); font-size: .69rem; font-weight: 500; }
.legend-item strong { font-size: 1.05rem; }
.sex-legend > p { margin: 3px 2px 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }

.bar-chart { min-height: 230px; display: flex; align-items: end; gap: clamp(8px, 1.2vw, 17px); padding-top: 12px; }
.age-column { min-width: 0; flex: 1; display: grid; grid-template-rows: 22px 155px auto; align-items: end; gap: 6px; text-align: center; }
.age-column strong { color: var(--muted); font-size: .67rem; font-weight: 750; }
.age-track { width: 100%; height: 155px; display: flex; align-items: end; border-radius: 8px; background: linear-gradient(to top, #f1f5f8 1px, transparent 1px) 0 0 / 100% 31px; }
.age-bar { width: 100%; min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #50b9ff, var(--blue)); transition: height .35s ease; box-shadow: 0 8px 20px rgba(47,120,255,.15); }
.age-column.peak .age-bar { background: linear-gradient(180deg, #ff8a91, var(--coral)); box-shadow: 0 8px 20px rgba(255,93,103,.2); }
.age-column span { min-height: 28px; color: var(--muted); font-size: .67rem; line-height: 1.2; }

.horizontal-bars { display: grid; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: minmax(135px, 190px) 1fr 62px; align-items: center; gap: 12px; }
.hbar-row > span { color: #40566a; font-size: .78rem; font-weight: 650; }
.hbar-track { height: 11px; overflow: hidden; border-radius: 99px; background: #edf2f6; }
.hbar-fill { height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--gold), #ffda68); transition: width .35s ease; }
.hbar-row:nth-child(2n) .hbar-fill { background: linear-gradient(90deg, var(--cyan), #5cd6e3); }
.hbar-row > strong { color: var(--ink); font-size: .8rem; text-align: right; }
.data-note { margin: 19px 0 0; padding-top: 14px; display: flex; gap: 8px; align-items: flex-start; border-top: 1px solid var(--line); color: var(--muted); font-size: .73rem; }
.data-note svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--blue); }

.profile-section { margin-top: 40px; }
.profile-heading { align-items: flex-start; margin-bottom: 18px; }
.profile-heading p { margin: 5px 0 0; color: var(--muted); font-size: .88rem; }
.profile-grid { display: grid; grid-template-columns: 1.12fr .88fr; gap: 19px; }
.panel-icon.coral { color: var(--coral); background: var(--coral-soft); }
.panel-icon.violet { color: var(--violet); background: var(--violet-soft); }
.panel-icon.blue { color: var(--blue); background: var(--blue-soft); }

.civil-bars { display: grid; gap: 12px; }
.civil-row { display: grid; gap: 6px; }
.civil-row > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.civil-row span { color: #40566a; font-size: .8rem; font-weight: 650; }
.civil-row strong { color: var(--ink); font-size: .78rem; }
.civil-track { height: 9px; overflow: hidden; border-radius: 99px; background: #edf2f6; }
.civil-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--coral), #ff9399); }
.civil-row:nth-child(2n) .civil-track i { background: linear-gradient(90deg, var(--blue), #65bbff); }
.profile-note { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; line-height: 1.55; }
.profile-note strong { color: var(--ink); }

.disability-feature { margin-bottom: 24px; padding: 18px; display: flex; align-items: center; gap: 15px; border: 1px solid #dcd5ff; border-radius: 16px; background: linear-gradient(110deg, #f5f2ff, #eef6ff); }
.disability-icon { width: 47px; height: 47px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; color: var(--violet); background: #fff; box-shadow: 0 7px 18px rgba(115,87,232,.12); }
.disability-feature small { display: block; color: var(--muted); font-size: .72rem; font-weight: 750; }
.disability-feature strong { display: block; margin-top: 3px; color: var(--ink); font-size: 2rem; line-height: 1; letter-spacing: -.045em; }
.disability-feature p { margin: 5px 0 0; color: var(--violet); font-size: .74rem; font-weight: 750; }
.life-stage-chart { display: grid; gap: 17px; }
.life-stage-track { height: 17px; display: flex; overflow: hidden; border-radius: 99px; background: #edf2f6; box-shadow: inset 0 0 0 1px rgba(8,35,59,.04); }
.life-stage-track i { display: block; height: 100%; }
.stage-1 { background: var(--gold); }
.stage-2 { background: var(--blue); }
.stage-3 { background: var(--coral); }
.stage-4 { background: var(--violet); }
.life-stage-legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.life-stage-item { padding: 10px 11px; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 9px; border-radius: 12px; background: #f8fafc; }
.life-stage-item > i { width: 10px; height: 10px; border-radius: 50%; }
.life-stage-item span strong { display: block; color: var(--ink); font-size: .78rem; }
.life-stage-item span small { display: block; color: var(--muted); font-size: .66rem; }
.life-stage-item > b { color: var(--ink); font-size: .8rem; }

.benchmark-panel { margin-top: 19px; padding: 25px; }
.benchmark-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.benchmark-heading h3 { margin: 4px 0 0; font-size: 1.24rem; letter-spacing: -.025em; }
.benchmark-heading p { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.benchmark-grid { margin-top: 20px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.benchmark-card { position: relative; min-height: 144px; padding: 17px; overflow: hidden; border: 1px solid #dfe8ef; border-radius: 16px; background: #fbfdff; }
.benchmark-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue); }
.benchmark-card.above::before { background: var(--coral); }
.benchmark-card.below::before { background: var(--violet); }
.benchmark-card > span { display: block; min-height: 39px; color: #4d6478; font-size: .77rem; font-weight: 750; line-height: 1.35; }
.benchmark-card > strong { display: block; margin-top: 5px; color: var(--ink); font-size: 1.75rem; line-height: 1; letter-spacing: -.04em; }
.benchmark-card > div { margin-top: 13px; display: grid; gap: 2px; }
.benchmark-card b { color: var(--blue); font-size: .7rem; }
.benchmark-card.above b { color: #d83b48; }
.benchmark-card.below b { color: #6246d2; }
.benchmark-card small { color: var(--muted); font-size: .64rem; }

.insight-panel {
  position: relative;
  padding: 28px;
  overflow: hidden;
  border-radius: 23px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(49,169,255,.25), transparent 38%),
    linear-gradient(145deg, var(--navy-950), #103c5d);
  box-shadow: 0 18px 40px rgba(8,35,59,.18);
}
.insight-panel::after { content: ""; position: absolute; width: 140px; height: 140px; right: -68px; bottom: -72px; border: 26px solid rgba(255,93,103,.13); border-radius: 50%; }
.insight-top { display: flex; align-items: center; gap: 10px; color: #8edaff; font-size: .71rem; font-weight: 850; letter-spacing: .12em; }
.insight-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: rgba(255,255,255,.1); }
.insight-panel h3 { max-width: 320px; margin: 20px 0 22px; font-size: 1.45rem; line-height: 1.15; letter-spacing: -.03em; }
.insight-list { position: relative; z-index: 1; display: grid; gap: 13px; }
.insight-list > div { display: grid; grid-template-columns: 28px 1fr; gap: 11px; align-items: start; }
.insight-list span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: #9ddfff; background: rgba(255,255,255,.09); font-size: .68rem; font-weight: 800; }
.insight-list p { margin: 2px 0 0; color: #d4e2ec; font-size: .79rem; line-height: 1.5; }
.insight-footer { position: absolute; z-index: 1; right: 24px; bottom: 22px; display: flex; align-items: center; gap: 5px; color: #8edaff; font-size: .7rem; font-weight: 700; }
.insight-footer svg { width: 14px; height: 14px; }

.footer-note { margin-top: 19px; padding: 19px 22px; display: flex; justify-content: space-between; gap: 30px; align-items: center; border: 1px solid var(--line); border-radius: 17px; color: var(--muted); background: rgba(255,255,255,.7); }
.footer-note div { display: grid; }
.footer-note strong { color: var(--ink); font-size: .8rem; }
.footer-note span, .footer-note p { font-size: .72rem; }
.footer-note p { max-width: 600px; margin: 0; text-align: right; }

.census-base-note {
  margin-top: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid #bedaf4;
  border-radius: 16px;
  color: #244d70;
  background: #eaf5ff;
}
.census-base-note svg { width: 19px; height: 19px; flex: 0 0 auto; margin-top: 2px; color: var(--blue); }
.census-base-note p { margin: 0; font-size: .78rem; line-height: 1.55; }

.creator-footer {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 78% 20%, rgba(47,120,255,.2), transparent 30%),
    linear-gradient(120deg, var(--navy-950), #0d3151);
}
.creator-footer::after { content: ""; position: absolute; width: 210px; height: 210px; right: -110px; bottom: -135px; border: 34px solid rgba(255,93,103,.1); border-radius: 50%; }
.creator-footer-inner { position: relative; z-index: 1; width: min(1380px, calc(100% - 40px)); min-height: 150px; margin: 0 auto; padding: 30px 4px; display: flex; align-items: center; justify-content: space-between; gap: 48px; }
.creator-logo { flex: 0 0 auto; display: inline-flex; align-items: center; border-radius: 12px; transition: opacity .2s ease, transform .2s ease; }
.creator-logo:hover { opacity: .88; transform: translateY(-2px); }
.creator-logo img { display: block; width: min(250px, 38vw); height: auto; }
.creator-contact { display: flex; align-items: center; justify-content: flex-end; gap: 34px; }
.creator-contact-copy { display: grid; gap: 4px; }
.creator-contact-copy span { color: #7fd4ff; font-size: .69rem; font-weight: 850; letter-spacing: .13em; }
.creator-contact-copy strong { max-width: 340px; color: #fff; font-size: 1.05rem; line-height: 1.35; }
.creator-contact-links { display: flex; align-items: center; gap: 9px; }
.creator-contact-links a { min-height: 43px; padding: 10px 13px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,.17); border-radius: 12px; color: #e7f3fb; background: rgba(255,255,255,.07); text-decoration: none; font-size: .78rem; font-weight: 720; transition: background .2s ease, border-color .2s ease, transform .2s ease; }
.creator-contact-links a:hover { border-color: rgba(255,255,255,.34); background: rgba(255,255,255,.13); transform: translateY(-2px); }
.creator-contact-links svg { width: 18px; height: 18px; color: #75d0ff; }

dialog {
  width: min(560px, calc(100% - 32px));
  padding: 32px;
  border: 0;
  border-radius: 24px;
  color: var(--ink);
  box-shadow: 0 30px 100px rgba(0,0,0,.28);
}
dialog::backdrop { background: rgba(6,26,44,.72); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 18px; top: 15px; width: 37px; height: 37px; border: 0; border-radius: 50%; color: var(--muted); background: #edf3f7; cursor: pointer; font-size: 1.35rem; }
.dialog-label { color: var(--blue); font-size: .72rem; font-weight: 850; letter-spacing: .13em; }
dialog h2 { margin: 7px 0 14px; font-size: 1.7rem; }
dialog p, dialog li { color: var(--muted); }
dialog li + li { margin-top: 8px; }
dialog small { display: block; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); }

/* Calculadora de muestra */
.sample-hero {
  position: relative;
  min-height: 315px;
  padding: 48px max(6vw, 28px) 94px;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  align-items: center;
  gap: 50px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 74% 30%, rgba(115,87,232,.18) 0 2px, transparent 3px) 0 0 / 26px 26px,
    linear-gradient(120deg, var(--navy-950) 0%, #0d3454 62%, #173f68 100%);
}
.sample-hero::after { content: ""; position: absolute; right: -70px; bottom: -170px; width: 360px; height: 360px; border: 60px solid rgba(255,93,103,.11); border-radius: 50%; }
.sample-hero-copy, .formula-card { position: relative; z-index: 1; }
.sample-hero h1 { margin: 0; font-size: clamp(2.45rem, 4.6vw, 4.65rem); line-height: .98; letter-spacing: -.055em; }
.sample-hero h1 em { color: #8dceff; font-style: normal; }
.sample-hero-copy p { max-width: 650px; margin: 19px 0 0; color: #bfd3e3; font-size: 1.05rem; }
.formula-card { justify-self: end; width: min(100%, 330px); padding: 24px 27px; border: 1px solid rgba(255,255,255,.16); border-radius: 22px; background: rgba(255,255,255,.08); backdrop-filter: blur(10px); }
.formula-card > span { color: #9bd8f4; font-size: .71rem; letter-spacing: .12em; font-weight: 850; }
.formula { margin: 15px 0 12px; display: flex; align-items: center; gap: 12px; }
.formula b { min-width: 47px; min-height: 47px; padding: 9px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: rgba(255,255,255,.11); font-size: 1.2rem; }
.formula i { color: #63ccff; font-style: normal; font-weight: 900; }
.formula-card p { margin: 0; color: #bed1df; font-size: .76rem; }

.sample-controls {
  position: relative;
  z-index: 2;
  width: min(1380px, calc(100% - 40px));
  min-height: 120px;
  margin: -64px auto 0;
  padding: 20px 21px;
  display: grid;
  grid-template-columns: minmax(245px, 1.25fr) minmax(155px, .68fr) repeat(3, minmax(165px, 1fr)) 50px;
  align-items: end;
  gap: 13px;
  border: 1px solid rgba(220,231,239,.9);
  border-radius: 22px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 22px 60px rgba(8,35,59,.14);
}
.sample-control-title { align-self: center; display: flex; gap: 13px; align-items: center; }
.sample-control-title > div > span { color: var(--blue); font-size: .7rem; font-weight: 850; letter-spacing: .11em; }
.sample-control-title h2 { margin: 3px 0 0; font-size: 1.1rem; line-height: 1.2; }
.sample-size-field { display: grid; gap: 6px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.sample-size-field > div { height: 48px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfd; overflow: hidden; }
.sample-size-field input { width: 100%; height: 100%; min-width: 70px; padding: 0 8px 0 13px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1.08rem; font-weight: 800; }
.sample-size-field small { padding-right: 12px; color: var(--muted); font-size: .68rem; }
.multi-select-field { display: grid; gap: 6px; color: var(--muted); font-size: .72rem; font-weight: 750; }
.multi-select-field > button { position: relative; width: 100%; height: 48px; padding: 7px 34px 7px 12px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #f9fbfd; cursor: pointer; text-align: left; }
.multi-select-field > button:hover { border-color: #8dbaff; background: var(--blue-soft); }
.multi-select-field strong { width: 100%; overflow: hidden; color: var(--ink); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.multi-select-field small { margin-top: 2px; color: var(--blue); font-size: .63rem; font-weight: 750; }
.multi-select-field svg { position: absolute; right: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%) rotate(90deg); color: var(--blue); }

.universe-builder { width: min(1380px, calc(100% - 40px)); margin: 18px auto 0; padding: 22px; border-color: #c9dff3; box-shadow: 0 12px 32px rgba(8,35,59,.07); }
.universe-builder-heading { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 22px; }
.universe-builder-heading h2 { margin: 4px 0 0; font-size: 1.35rem; letter-spacing: -.025em; }
.universe-builder-heading p { margin: 5px 0 0; color: var(--muted); font-size: .88rem; }
.demographic-selector-grid { margin-top: 20px; padding-top: 17px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--line); }
.dimension-selector { --dimension-accent: var(--blue); padding: 15px; border: 1px solid #dce7ef; border-top: 4px solid var(--dimension-accent); border-radius: 15px; background: #fbfdff; }
.dimension-selector:nth-child(2) { --dimension-accent: var(--coral); }
.dimension-selector:nth-child(3) { --dimension-accent: var(--violet); }
.dimension-selector-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.dimension-selector-heading span { display: block; color: var(--dimension-accent); font-size: .7rem; font-weight: 900; letter-spacing: .1em; }
.dimension-selector-heading strong { display: block; margin-top: 2px; color: var(--ink); font-size: .82rem; }
.select-all-dimension { padding: 7px 9px; border: 1px solid #cbdce9; border-radius: 9px; color: var(--dimension-accent); background: #fff; cursor: pointer; font-size: .72rem; font-weight: 850; }
.select-all-dimension:hover { border-color: var(--dimension-accent); }
.select-all-dimension:disabled { opacity: .45; cursor: default; }
.dimension-ranges { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 7px; }
.range-option { min-height: 58px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid #dbe6ee; border-radius: 12px; color: #536b80; background: #fbfdff; cursor: pointer; transition: .18s ease; }
.range-option:hover { border-color: #91bdf2; }
.dimension-selector .range-option.selected { border-color: color-mix(in srgb, var(--dimension-accent) 60%, #fff); color: var(--navy-900); background: color-mix(in srgb, var(--dimension-accent) 8%, #fff); box-shadow: 0 5px 12px rgba(8,35,59,.05); }
.range-option.locked { opacity: .55; cursor: not-allowed; }
.range-choice { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; accent-color: var(--dimension-accent); }
.range-option span { min-width: 0; }
.range-option strong { display: block; font-size: .83rem; line-height: 1.2; }
.range-option small { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; }
.range-picker-note { margin: 13px 0 0; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .76rem; }
.range-picker-note svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--blue); }

.sample-dashboard { width: min(1380px, calc(100% - 40px)); margin: 40px auto 56px; }
.sample-breadcrumb-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.sample-breadcrumb-row h2 { margin: 3px 0 0; font-size: clamp(1.65rem, 3vw, 2.3rem); letter-spacing: -.04em; }
.sample-breadcrumb-row p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.back-level { display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; cursor: pointer; font-size: .79rem; font-weight: 700; }
.back-level:hover { border-color: var(--blue); color: var(--blue); }
.back-level svg { width: 16px; height: 16px; }

.universe-strip { margin-bottom: 16px; padding: 14px 17px; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; border: 1px solid #bddcff; border-radius: 15px; color: #244d70; background: linear-gradient(90deg, #eaf5ff, #f6f1ff); }
.universe-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: var(--blue); background: #fff; box-shadow: 0 6px 15px rgba(47,120,255,.1); }
.universe-strip small { display: block; color: var(--blue); font-size: .65rem; font-weight: 850; letter-spacing: .1em; }
.universe-strip strong { display: block; margin-top: 2px; color: var(--navy-900); font-size: .88rem; }
.universe-strip p { margin: 0; color: #59758e; font-size: .72rem; }

.sample-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.sample-kpis article { min-height: 130px; padding: 21px; display: flex; align-items: flex-start; gap: 14px; border: 1px solid var(--line); border-radius: 19px; background: #fff; box-shadow: 0 10px 28px rgba(8,35,59,.05); }
.sample-kpi-icon { width: 43px; height: 43px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 13px; }
.sample-kpi-icon.blue { color: var(--blue); background: var(--blue-soft); }
.sample-kpi-icon.coral { color: var(--coral); background: var(--coral-soft); }
.sample-kpi-icon.teal { color: #168572; background: #e3f7f2; }
.sample-kpi-icon.gold { color: #aa7200; background: var(--gold-soft); }
.sample-kpi-icon.violet { color: var(--violet); background: var(--violet-soft); }
.sample-kpis small { display: block; color: var(--muted); font-size: .73rem; font-weight: 700; }
.sample-kpis strong { display: block; margin-top: 6px; font-size: clamp(1.45rem, 2vw, 2rem); line-height: 1; letter-spacing: -.035em; }
.sample-kpis p { margin: 7px 0 0; color: var(--muted); font-size: .7rem; }
.margin-error-kpi { border-color: #bfe6dd !important; background: linear-gradient(145deg, #fff, #f2fbf9) !important; }
.margin-error-kpi strong { color: #087763; }
.margin-error-note { margin: 11px 2px 0; display: flex; align-items: flex-start; gap: 7px; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.margin-error-note svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; color: #168572; }

.allocation-layout { display: grid; grid-template-columns: 1fr 330px; gap: 18px; margin-top: 18px; }
.allocation-heading { margin-bottom: 14px; }
.allocation-total { padding: 9px 13px; border-radius: 11px; text-align: right; background: var(--blue-soft); }
.allocation-total span { display: block; color: var(--blue); font-size: .65rem; font-weight: 750; }
.allocation-total strong { display: block; color: var(--navy-900); font-size: 1.2rem; }
.table-scroll { width: 100%; overflow-x: auto; }
.allocation-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.allocation-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); background: #f7fafc; font-size: .7rem; font-weight: 800; text-align: left; }
.allocation-table th:nth-child(n+2):not(:last-child), .allocation-table td:nth-child(n+2):not(:last-child) { text-align: right; }
.allocation-table td { padding: 11px 12px; border-bottom: 1px solid #e9f0f5; color: #3f566a; font-size: .78rem; }
.allocation-table tr:last-child td { border-bottom: 0; }
.allocation-table tbody tr:hover { background: #fbfdff; }
.territory-cell { display: flex; align-items: center; gap: 10px; }
.territory-cell > span { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-size: .72rem; font-weight: 850; }
.territory-cell strong { color: var(--ink); }
.weight-cell { min-width: 125px; display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.weight-cell > span { width: 60px; height: 6px; overflow: hidden; border-radius: 99px; background: #e7eef4; }
.weight-cell i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #58b8ff); }
.sample-badge { display: inline-grid; min-width: 44px; padding: 5px 9px; place-items: center; border-radius: 9px; color: #9b5200; background: var(--gold-soft); font-size: .9rem; }
.explore-button { display: inline-flex; align-items: center; gap: 3px; padding: 7px 9px; border: 0; border-radius: 9px; color: var(--blue); background: var(--blue-soft); cursor: pointer; font-size: .71rem; font-weight: 800; }
.explore-button:hover { color: #fff; background: var(--blue); }
.explore-button svg { width: 13px; height: 13px; }

.allocation-explainer { position: relative; min-height: 360px; padding: 27px; overflow: hidden; border-radius: 23px; color: #fff; background: linear-gradient(150deg, #5b43cc, #2f78ff); box-shadow: 0 18px 42px rgba(66,76,204,.22); }
.allocation-explainer::after { content: ""; position: absolute; width: 150px; height: 150px; right: -72px; bottom: -68px; border: 27px solid rgba(255,255,255,.1); border-radius: 50%; }
.explainer-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: rgba(255,255,255,.14); }
.explainer-label { display: block; margin-top: 20px; color: #c7ddff; font-size: .7rem; font-weight: 850; letter-spacing: .12em; }
.allocation-explainer h3 { margin: 9px 0 12px; font-size: 1.45rem; line-height: 1.2; letter-spacing: -.03em; }
.allocation-explainer > p { color: #dce8ff; font-size: .81rem; }
.equation-mini { position: absolute; z-index: 1; left: 27px; right: 27px; bottom: 26px; padding: 14px; border-radius: 13px; background: rgba(255,255,255,.12); }
.equation-mini span { display: block; color: #c7ddff; font-size: .66rem; }
.equation-mini strong { display: block; margin-top: 3px; font-size: .87rem; }

.marginal-panel { margin-top: 18px; }
.marginal-header { margin-bottom: 20px; }
.marginal-header h3 { margin: 4px 0 0; font-size: 1.25rem; }
.marginal-header p { margin: 3px 0 0; color: var(--muted); font-size: .76rem; }
.variable-tabs { padding: 4px; display: flex; gap: 3px; border-radius: 12px; background: #edf3f7; }
.variable-tab { padding: 8px 12px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: .76rem; font-weight: 750; }
.variable-tab.active { color: #fff; background: var(--navy-900); box-shadow: 0 5px 14px rgba(8,35,59,.18); }
.exclude-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; font-size: .73rem; font-weight: 700; }
.exclude-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.exclude-toggle > span { position: relative; width: 36px; height: 21px; border-radius: 99px; background: #cbd7e0; transition: .2s; }
.exclude-toggle > span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.15); transition: .2s; }
.exclude-toggle input:checked + span { background: var(--blue); }
.exclude-toggle input:checked + span::after { transform: translateX(15px); }
.marginal-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 12px; }
.marginal-dimension { --dimension-accent: var(--blue); padding: 14px; border: 1px solid #dce7ef; border-radius: 15px; background: #fbfdff; }
.marginal-dimension:nth-child(2) { --dimension-accent: var(--coral); }
.marginal-dimension:nth-child(3) { --dimension-accent: var(--violet); }
.marginal-dimension-heading { min-height: 45px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.marginal-dimension-heading span { display: block; color: var(--dimension-accent); font-size: .7rem; font-weight: 900; letter-spacing: .1em; }
.marginal-dimension-heading strong { display: block; margin-top: 2px; color: var(--muted); font-size: .7rem; font-weight: 650; }
.marginal-dimension-heading > b { padding: 6px 8px; border-radius: 8px; color: var(--dimension-accent); background: color-mix(in srgb, var(--dimension-accent) 8%, #fff); font-size: .72rem; white-space: nowrap; }
.marginal-dimension .marginal-grid { grid-template-columns: 1fr; }
.marginal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.marginal-item { padding: 12px 13px; display: grid; grid-template-columns: 31px 1fr 68px 68px; align-items: center; gap: 11px; border: 1px solid #e5edf3; border-radius: 13px; background: #fbfdff; }
.marginal-item.selected { border-color: #c5dcf1; }
.marginal-order { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--blue); background: var(--blue-soft); font-size: .66rem; font-weight: 850; }
.marginal-content > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.marginal-content strong { color: var(--ink); font-size: .76rem; }
.marginal-content span { color: var(--muted); font-size: .66rem; }
.marginal-track { height: 5px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #e8eff4; }
.marginal-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--dimension-accent, var(--coral)), color-mix(in srgb, var(--dimension-accent, var(--coral)) 55%, #fff)); }
.marginal-weight, .marginal-quota { text-align: right; }
.marginal-weight strong, .marginal-quota strong { display: block; color: var(--ink); font-size: .84rem; }
.marginal-weight span, .marginal-quota span { display: block; color: var(--muted); font-size: .61rem; }
.marginal-quota { padding: 7px; border-radius: 9px; background: var(--gold-soft); }
.marginal-summary { margin-top: 14px; padding-top: 14px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.marginal-summary > span { display: flex; align-items: flex-start; gap: 7px; }
.marginal-summary svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--blue); }
.marginal-summary strong { color: var(--ink); }
.export-panel { margin-top: 18px; }
.export-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.export-heading h3 { margin: 4px 0 0; font-size: 1.25rem; }
.export-heading p { margin: 3px 0 0; color: var(--muted); font-size: .78rem; }
.export-actions { display: flex; gap: 8px; }
.export-actions button { padding: 10px 13px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #b9d4ec; border-radius: 10px; color: var(--blue); background: var(--blue-soft); cursor: pointer; font-size: .77rem; font-weight: 850; }
.export-actions button:last-child { border-color: var(--blue); color: #fff; background: var(--blue); }
.export-actions button:hover { transform: translateY(-1px); box-shadow: 0 7px 15px rgba(47,120,255,.14); }
.export-actions svg { width: 16px; height: 16px; }
.copy-status { min-height: 18px; margin: 9px 0 0; color: #1d7a57; font-size: .75rem; font-weight: 700; }
.copy-status.error { color: #a42a3a; }
.result-table-scroll { margin-top: 7px; border: 1px solid var(--line); border-radius: 13px; }
.result-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.result-table th { padding: 10px 12px; color: var(--muted); background: #f5f8fb; font-size: .7rem; text-align: left; }
.result-table td { padding: 10px 12px; border-top: 1px solid #e7eef4; color: #496075; font-size: .77rem; }
.result-table th:nth-child(n+3), .result-table td:nth-child(n+3) { text-align: right; }
.result-table td:first-child { color: var(--blue); font-weight: 750; }
.result-table td strong { color: var(--ink); }
.result-table td b { display: inline-grid; min-width: 38px; padding: 4px 7px; place-items: center; border-radius: 7px; color: #9b5200; background: var(--gold-soft); }
.sample-note { margin-top: 18px; }
.dialog-formula { padding: 15px; border-radius: 12px; color: var(--navy-900); background: var(--blue-soft); font-size: 1.15rem; font-weight: 800; text-align: center; }
.territory-dialog { width: min(780px, calc(100% - 32px)); max-height: min(84vh, 780px); }
.territory-search { height: 44px; margin-top: 17px; padding: 0 12px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 11px; background: #f8fbfd; }
.territory-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,120,255,.1); }
.territory-search svg { width: 17px; height: 17px; color: var(--blue); }
.territory-search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: .84rem; }
.territory-check-grid { max-height: 410px; margin-top: 12px; padding-right: 5px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; overflow-y: auto; }
.territory-check { padding: 10px 11px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; color: #40566a; background: #fbfdff; cursor: pointer; font-size: .78rem; font-weight: 650; }
.territory-check:has(input:checked) { border-color: #8dbaff; color: var(--navy-900); background: var(--blue-soft); }
.territory-check input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--blue); }
.territory-check strong, .territory-check small { display: block; }
.territory-check strong { font-size: .79rem; }
.territory-check small { margin-top: 2px; color: var(--muted); font-size: .65rem; }
.picker-empty { grid-column: 1 / -1; padding: 24px; color: var(--muted); text-align: center; }
.province-dialog-actions { margin-top: 20px; padding-top: 16px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); }
.province-dialog-actions button { padding: 10px 15px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; cursor: pointer; font-size: .78rem; font-weight: 800; }
.province-dialog-actions button:last-child { border-color: var(--blue); color: #fff; background: var(--blue); }

.loading .dashboard { opacity: .55; pointer-events: none; }
.error-message { width: min(900px, calc(100% - 40px)); margin: 36px auto; padding: 22px; border-radius: 16px; color: #8b1d2c; background: #ffebed; }

@media (max-width: 1100px) {
  .filter-card { grid-template-columns: 1fr 1fr 1fr; }
  .filter-title { grid-column: 1 / -1; }
  .reset-button { align-self: end; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .geo-layout { grid-template-columns: 1fr; }
  .map-ranking-list { grid-template-columns: repeat(2, 1fr); }
  .main-grid, .secondary-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .benchmark-grid { grid-template-columns: repeat(2, 1fr); }
  .insight-panel { min-height: 390px; }
  .sample-controls { grid-template-columns: repeat(3, 1fr); }
  .sample-control-title { grid-column: 1 / -1; }
  .universe-builder-heading { grid-template-columns: 1fr auto; }
  .universe-builder-heading > div:first-child { grid-column: 1 / -1; }
  .demographic-selector-grid, .marginal-sections { grid-template-columns: 1fr; }
  .dimension-ranges { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .sample-kpis { grid-template-columns: repeat(2, 1fr); }
  .allocation-layout { grid-template-columns: 1fr; }
  .allocation-explainer { min-height: 320px; }
  .creator-footer-inner { align-items: flex-start; }
  .creator-contact { align-items: flex-start; flex-direction: column; gap: 15px; }
  .creator-contact-links { flex-wrap: wrap; }
}

@media (max-width: 760px) {
  .topbar { height: 66px; grid-template-columns: 1fr auto; padding: 0 18px; }
  .topbar-logo { width: 124px; }
  .topbar-center { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: center; padding: 6px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(6,26,44,.96); box-shadow: 0 14px 38px rgba(6,26,44,.28); backdrop-filter: blur(12px); }
  .topbar-center .nav-pill { flex: 1; padding: 9px 7px; text-align: center; font-size: .7rem; }
  .method-button { padding: 9px; }
  .method-button svg { width: 18px; height: 18px; }
  .method-button { font-size: 0; }
  .hero { min-height: 470px; padding: 44px 22px 116px; grid-template-columns: 1fr; gap: 28px; }
  .hero h1 { font-size: clamp(2.65rem, 13vw, 4.2rem); }
  .hero-stat { justify-self: stretch; width: 100%; display: grid; grid-template-columns: auto 1fr; column-gap: 15px; align-items: end; padding: 18px 20px; }
  .hero-stat > span { grid-column: 1 / -1; }
  .hero-stat > strong { font-size: 3.1rem; }
  .hero-stat > p { margin: 0 0 6px; }
  .hero-stat-line { grid-column: 1 / -1; margin-top: 12px; }
  .filter-card { width: calc(100% - 24px); margin-top: -91px; grid-template-columns: 1fr; padding: 18px; }
  .filter-title { grid-column: auto; }
  .reset-button { width: 100%; }
  .dashboard { width: calc(100% - 24px); margin-top: 34px; }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .geo-panel { padding: 20px 17px; }
  .geo-heading { align-items: flex-start; flex-direction: column; }
  .geo-heading-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .geo-heading-actions .panel-icon { margin-left: auto; }
  .map-howto { padding: 12px; }
  .map-howto p { font-size: .7rem; }
  .map-wrap { min-height: 315px; }
  #territoryMap { width: calc(100% - 18px); height: 260px; }
  .map-ranking-list { grid-template-columns: 1fr; }
  .map-tooltip { min-width: 170px; max-width: 210px; }
  .kpi-card { min-height: 135px; }
  .panel { padding: 20px 17px; }
  .sex-layout { grid-template-columns: 1fr; }
  .bar-chart { gap: 5px; overflow-x: auto; }
  .age-column { min-width: 37px; }
  .age-column strong, .age-column span { font-size: .62rem; }
  .hbar-row { grid-template-columns: 110px 1fr 48px; gap: 7px; }
  .hbar-row > span, .hbar-row > strong { font-size: .69rem; }
  .profile-section { margin-top: 32px; }
  .life-stage-legend { grid-template-columns: 1fr; }
  .benchmark-heading { align-items: flex-start; }
  .benchmark-grid { grid-template-columns: 1fr; }
  .benchmark-card { min-height: 132px; }
  .footer-note { align-items: flex-start; flex-direction: column; gap: 10px; }
  .footer-note p { text-align: left; }
  .census-base-note p { font-size: .73rem; }
  .sample-hero { min-height: 460px; padding: 42px 22px 95px; grid-template-columns: 1fr; gap: 26px; }
  .sample-hero h1 { font-size: clamp(2.7rem, 14vw, 4rem); }
  .formula-card { justify-self: stretch; width: 100%; }
  .sample-controls { width: calc(100% - 24px); margin-top: -58px; grid-template-columns: 1fr; padding: 18px; }
  .sample-control-title { grid-column: auto; }
  .sample-controls .reset-button { width: 100%; }
  .universe-builder { width: calc(100% - 24px); padding: 18px; }
  .universe-builder-heading { grid-template-columns: 1fr; align-items: start; }
  .universe-builder-heading > div:first-child { grid-column: auto; }
  .dimension-ranges { grid-template-columns: 1fr; }
  .sample-dashboard { width: calc(100% - 24px); margin-top: 32px; }
  .sample-breadcrumb-row { align-items: flex-start; flex-direction: column; }
  .universe-strip { grid-template-columns: 40px 1fr; }
  .universe-strip p { grid-column: 1 / -1; }
  .sample-kpis { grid-template-columns: 1fr; }
  .allocation-panel { padding: 18px 0; }
  .allocation-heading { padding: 0 17px; }
  .allocation-table th:first-child, .allocation-table td:first-child { padding-left: 17px; }
  .marginal-grid { grid-template-columns: 1fr; }
  .marginal-item { grid-template-columns: 29px 1fr 53px 60px; gap: 7px; padding: 11px 9px; }
  .marginal-content > div:first-child { align-items: flex-start; flex-direction: column; gap: 0; }
  .marginal-summary { align-items: flex-start; flex-direction: column; }
  .territory-check-grid { grid-template-columns: 1fr; }
  .export-heading { align-items: flex-start; flex-direction: column; }
  .export-actions { width: 100%; flex-direction: column; }
  .export-actions button { width: 100%; justify-content: center; }
  .creator-footer-inner { width: calc(100% - 36px); padding: 28px 0 104px; align-items: flex-start; flex-direction: column; gap: 25px; }
  .creator-logo img { width: min(240px, 76vw); }
  .creator-contact { width: 100%; }
  .creator-contact-links { width: 100%; align-items: stretch; flex-direction: column; }
  .creator-contact-links a { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
