/* SalonScope — refined editorial rose & porcelain design system, light + dark native themes. */

:root {
  color-scheme: light;
  --page: #f8f5f7;
  --page-grad: radial-gradient(920px 420px at 14% -8%, rgba(214, 46, 110, 0.065), transparent 65%);
  --surface: #ffffff;
  --surface-2: #f7f1f4;
  --surface-3: #eee4e9;
  --surface-glass: rgba(255, 255, 255, 0.88);
  --border: rgba(34, 18, 28, 0.085);
  --border-strong: rgba(34, 18, 28, 0.16);
  --text: #181316;
  --text-2: #594f56;
  --muted: #8b8088;

  --brand: #d62e6e;
  --brand-strong: #ad1c55;
  --brand-soft: #fce8f0;
  --brand-soft-2: #f7d2e1;
  --brand-ink: #ffffff;
  --focus: #2563eb;

  /* Data roles */
  --home: #d62e6e;
  --rival: #2563eb;
  --rival-soft: rgba(37, 99, 235, 0.11);
  --threat: #ea580c;
  --deemph: #b9aeb5;
  --grid: rgba(34, 18, 28, 0.075);
  --axis: rgba(34, 18, 28, 0.22);

  --good: #16a34a;
  --good-text: #15803d;
  --good-soft: rgba(22, 163, 74, 0.12);
  --warning: #f59e0b;
  --warn-text: #a16207;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --serious: #f97316;
  --critical: #dc2626;
  --bad-text: #c81e1e;
  --bad-soft: rgba(220, 38, 38, 0.11);

  /* Diverging rating scale */
  --div-pos: #2563eb;
  --div-pos-2: #7db0f5;
  --div-mid: #d7cfd4;
  --div-neg-2: #f29b9b;
  --div-neg: #dc2626;

  /* Sequential scales */
  --seq-1: #dbeafe; --seq-2: #b3d4fc; --seq-3: #83b7f9; --seq-4: #4d93f0; --seq-5: #256ee0; --seq-6: #184fb5; --seq-7: #0f3580;
  --hot-1: #fde4cf; --hot-2: #fdbb8a; --hot-3: #fa8c4d; --hot-4: #ef5a24; --hot-5: #cc3714; --hot-6: #991b1b;

  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-xs: 0 1px 2px rgba(28, 14, 22, 0.045);
  --shadow: 0 1px 2px rgba(28, 14, 22, 0.04), 0 8px 24px -4px rgba(28, 14, 22, 0.065);
  --shadow-lg: 0 18px 50px -8px rgba(24, 12, 18, 0.22), 0 4px 12px rgba(24, 12, 18, 0.08);

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0e0c0f;
    --page-grad: radial-gradient(920px 420px at 14% -8%, rgba(242, 82, 144, 0.09), transparent 65%);
    --surface: #171419;
    --surface-2: #201c23;
    --surface-3: #2a242e;
    --surface-glass: rgba(23, 20, 25, 0.88);
    --border: rgba(255, 245, 250, 0.09);
    --border-strong: rgba(255, 245, 250, 0.17);
    --text: #f7f2f5;
    --text-2: #c2b7be;
    --muted: #8a7f87;

    --brand: #f25290;
    --brand-strong: #ff82b2;
    --brand-soft: rgba(242, 82, 144, 0.16);
    --brand-soft-2: rgba(242, 82, 144, 0.26);
    --brand-ink: #ffffff;
    --focus: #60a5fa;

    --home: #f25290;
    --rival: #60a5fa;
    --rival-soft: rgba(96, 165, 250, 0.16);
    --threat: #fb713c;
    --deemph: #665d63;
    --grid: rgba(255, 245, 250, 0.075);
    --axis: rgba(255, 245, 250, 0.22);

    --good-text: #4ade80;
    --good-soft: rgba(74, 222, 128, 0.14);
    --warn-text: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.16);
    --bad-text: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.15);

    --div-pos: #60a5fa;
    --div-pos-2: #2f69b8;
    --div-mid: #4a4348;
    --div-neg-2: #a84242;
    --div-neg: #f87171;

    --seq-1: #162645; --seq-2: #1d3969; --seq-3: #255394; --seq-4: #3072c6; --seq-5: #4f94eb; --seq-6: #7cb6f7; --seq-7: #bad8fc;
    --hot-1: #5c2814; --hot-2: #8a3a18; --hot-3: #b84d1b; --hot-4: #e06224; --hot-5: #f58642; --hot-6: #fdb87d;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 28px -6px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.65);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e0c0f;
  --page-grad: radial-gradient(920px 420px at 14% -8%, rgba(242, 82, 144, 0.09), transparent 65%);
  --surface: #171419;
  --surface-2: #201c23;
  --surface-3: #2a242e;
  --surface-glass: rgba(23, 20, 25, 0.88);
  --border: rgba(255, 245, 250, 0.09);
  --border-strong: rgba(255, 245, 250, 0.17);
  --text: #f7f2f5;
  --text-2: #c2b7be;
  --muted: #8a7f87;

  --brand: #f25290;
  --brand-strong: #ff82b2;
  --brand-soft: rgba(242, 82, 144, 0.16);
  --brand-soft-2: rgba(242, 82, 144, 0.26);
  --brand-ink: #ffffff;
  --focus: #60a5fa;

  --home: #f25290;
  --rival: #60a5fa;
  --rival-soft: rgba(96, 165, 250, 0.16);
  --threat: #fb713c;
  --deemph: #665d63;
  --grid: rgba(255, 245, 250, 0.075);
  --axis: rgba(255, 245, 250, 0.22);

  --good-text: #4ade80;
  --good-soft: rgba(74, 222, 128, 0.14);
  --warn-text: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.16);
  --bad-text: #f87171;
  --bad-soft: rgba(248, 113, 113, 0.15);

  --div-pos: #60a5fa;
  --div-pos-2: #2f69b8;
  --div-mid: #4a4348;
  --div-neg-2: #a84242;
  --div-neg: #f87171;

  --seq-1: #162645; --seq-2: #1d3969; --seq-3: #255394; --seq-4: #3072c6; --seq-5: #4f94eb; --seq-6: #7cb6f7; --seq-7: #bad8fc;
  --hot-1: #5c2814; --hot-2: #8a3a18; --hot-3: #b84d1b; --hot-4: #e06224; --hot-5: #f58642; --hot-6: #fdb87d;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 28px -6px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.65);
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--page-grad), var(--page);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-strong); transition: color .15s; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 7px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sec { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 11px;
  min-height: 62px; padding: 8px 16px;
  background: var(--surface-glass);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); flex: none; }
.brand-badge {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}
.brand-mark { width: 22px; height: 22px; }
.brand-mark .cap { fill: var(--brand-strong); }
.brand-mark .bottle { fill: var(--brand); }
.brand-mark .shine { fill: #fff; opacity: .62; }
.brand-text { display: flex; align-items: center; gap: 7px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.025em; }
.brand-city {
  font-size: 11px; color: var(--brand-strong); background: var(--brand-soft);
  padding: 2px 7px; border-radius: 99px; font-weight: 700; letter-spacing: 0.01em;
}

.tabs {
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
  flex: 1; min-width: 0; padding: 3px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  max-width: max-content;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 9px; border-radius: 9px; text-decoration: none;
  color: var(--text-2); font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.tabs a .tab-ic { width: 14px; height: 14px; opacity: .72; flex: none; }
.tabs a:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.tabs a.active {
  background: var(--surface); color: var(--brand-strong);
  box-shadow: var(--shadow-xs);
}
.tabs a.active .tab-ic { opacity: 1; color: var(--brand); }

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.home-picker {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 4px 0 10px; height: 36px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  font-size: 12px; color: var(--muted); box-shadow: var(--shadow-xs);
}
.home-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--home); flex: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.home-picker-lbl { font-weight: 600; white-space: nowrap; }
@media (max-width: 1520px) { .home-picker-lbl { display: none; } }
@media (max-width: 1340px) { .brand-city { display: none; } }
.home-picker select {
  border: 0; background: transparent; min-height: 32px; padding: 2px 6px 2px 2px;
  font-size: 13px; font-weight: 650; color: var(--text); max-width: 175px;
  box-shadow: none;
}
.home-picker select:focus-visible { outline: none; }
.home-picker:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong); cursor: pointer;
  color: var(--text-2); box-shadow: var(--shadow-xs);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
/* Show moon in light mode, sun in dark mode */
.icon-btn .ic-sun { display: none; }
.icon-btn .ic-moon { display: block; }
:root[data-theme="dark"] .icon-btn .ic-sun { display: block; }
:root[data-theme="dark"] .icon-btn .ic-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .ic-sun { display: block; }
  :root:not([data-theme="light"]) .icon-btn .ic-moon { display: none; }
}

/* ---------------------------------------------------------------- layout */
#app { max-width: 1520px; margin: 0 auto; padding: 22px 22px 72px; }
.view { display: flex; flex-direction: column; gap: 20px; animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view, .drawer, .map-inspector { animation: none !important; transition: none !important; } }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-bottom: 2px;
}
.view-head h1 {
  font-size: clamp(22px, 2.2vw, 27px); font-weight: 800; margin: 0;
  letter-spacing: -0.028em; line-height: 1.18;
}
.view-head p { margin: 5px 0 0; color: var(--text-2); max-width: 780px; font-size: 14px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-side { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }

@media (max-width: 1220px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-side { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  #app { padding: 14px 14px 56px; }
  .topbar { gap: 8px 10px; padding: 8px 12px; min-height: auto; flex-wrap: wrap; }
  .tabs { order: 3; flex-basis: 100%; max-width: none; }
  .tabs a { padding: 6px 10px; font-size: 13px; }
  .brand-name, .home-picker-lbl { display: none; }
  .home-picker { padding-left: 8px; }
  .home-picker select { max-width: 155px; }
  #app .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #app .tile { padding: 13px 14px; }
  #app .tile .value { font-size: 24px; }
  #app .map { height: 440px; }
  .drawer .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15.5px; font-weight: 750; letter-spacing: -0.015em; }
.card-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.card-foot {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}

/* ---------------------------------------------------------------- controls */
select, input[type="text"], input[type="search"], input[type="number"], textarea {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 7px 11px; min-height: 36px; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
select { cursor: pointer; }
select:hover, input[type="text"]:hover, input[type="search"]:hover, input[type="number"]:hover, textarea:hover {
  border-color: color-mix(in srgb, var(--text) 28%, transparent);
}
textarea { width: 100%; min-height: 88px; resize: vertical; line-height: 1.45; }

/* Custom sliders */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 99px; background: var(--surface-3); outline: none; cursor: pointer;
  margin: 6px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand); border: 2.5px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28), 0 0 0 1px color-mix(in srgb, var(--brand) 40%, transparent);
  transition: transform .12s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand); border: 2.5px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
input[type="checkbox"] { accent-color: var(--brand); width: 16px; height: 16px; cursor: pointer; }

.search-wrap { position: relative; display: flex; align-items: center; width: 100%; }
.search-wrap svg {
  position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.search-wrap input { padding-left: 32px; width: 100%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; min-height: 36px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface);
  cursor: pointer; font-weight: 650; font-size: 13px; text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: background .14s, border-color .14s, transform .1s, color .14s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: color-mix(in srgb, var(--text) 24%, transparent); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 2px 10px color-mix(in srgb, var(--brand) 32%, transparent); }
.btn.primary:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.soft { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); color: var(--brand-strong); box-shadow: none; }
.btn.soft:hover:not(:disabled) { background: var(--brand-soft-2); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { min-height: 26px; padding: 2px 8px; font-size: 12px; border-radius: 7px; }
.btn svg { width: 14px; height: 14px; flex: none; }

.seg {
  display: inline-flex; align-items: center; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: nowrap;
}
.seg button {
  border: 0; background: transparent; padding: 5px 10px; border-radius: 7px;
  cursor: pointer; font-size: 12.5px; color: var(--text-2); font-weight: 600; white-space: nowrap;
  transition: background .14s, color .14s, box-shadow .14s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 12.5px; font-weight: 550; cursor: pointer; color: var(--text-2);
  transition: background .14s, border-color .14s, color .14s;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.on {
  background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 42%, transparent);
  color: var(--brand-strong); font-weight: 650;
}
.chip .chip-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650;
  padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.tag.home { background: var(--brand-soft); color: var(--brand-strong); }
.tag.rival { background: var(--rival-soft); color: var(--rival); }
.tag.warn { background: var(--warn-soft); color: var(--warn-text); }
.tag.bad { background: var(--bad-soft); color: var(--bad-text); }
.tag.good { background: var(--good-soft); color: var(--good-text); }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.field > span { font-weight: 650; }
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filters .field select, .filters .field input { min-width: 0; }

/* ---------------------------------------------------------------- stat tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 12px; }
.tile {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
  transition: border-color .15s, transform .15s;
}
.tile.accent {
  background: linear-gradient(155deg, var(--brand-soft), var(--surface) 68%);
  border-color: color-mix(in srgb, var(--brand) 28%, var(--border));
}
.tile.accent::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 45%, #fb7185));
}
.tile .label { font-size: 12px; color: var(--text-2); font-weight: 650; letter-spacing: 0.005em; }
.tile .value {
  font-size: 29px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.12;
  display: flex; align-items: baseline; gap: 3px; flex-wrap: wrap;
}
.tile .value small { font-size: 14px; font-weight: 650; color: var(--text-2); }
.tile .sub { font-size: 12px; color: var(--text-2); line-height: 1.4; }

.delta-up { color: var(--good-text); font-weight: 700; }
.delta-down { color: var(--bad-text); font-weight: 700; }
.pill-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 99px; font-size: 11.5px; font-weight: 700;
}
.pill-badge.up { background: var(--good-soft); color: var(--good-text); }
.pill-badge.down { background: var(--bad-soft); color: var(--bad-text); }
.pill-badge.neutral { background: var(--surface-3); color: var(--text-2); }

/* ---------------------------------------------------------------- MAP OVERHAUL */
.map-card {
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
  transition: box-shadow .2s;
}
.map-card.is-expanded {
  position: fixed; inset: 14px; z-index: 2500;
  border-radius: 18px; box-shadow: var(--shadow-lg), 0 0 0 9999px rgba(10, 8, 12, 0.56);
}
.map-card.is-expanded .map-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.map-card.is-expanded .map { height: 100% !important; flex: 1; }

.map-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px 11px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.map-title-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.map-title-group h3 { margin: 0; font-size: 15.5px; font-weight: 750; letter-spacing: -0.015em; }
.map-count-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}

.map-toolbar {
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}
.map-ctrl-group { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.map-ctrl-lbl {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.055em;
  color: var(--muted); white-space: nowrap;
}
.map-ctrl-sep { width: 1px; height: 22px; background: var(--border-strong); flex: none; }
@media (max-width: 760px) { .map-ctrl-sep { display: none; } }

.map-stage { position: relative; background: var(--surface-2); }
.map { height: 590px; width: 100%; background: var(--surface-2); z-index: 0; }
.map.short { height: 500px; }
.map.sim-h { height: 390px; }

/* Custom floating map navigation controls (top-right) */
.map-nav-hud {
  position: absolute; top: 12px; right: 12px; z-index: 600;
  display: flex; flex-direction: column; gap: 6px;
}
.map-nav-stack {
  display: flex; flex-direction: column;
  background: var(--surface-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); border-radius: 11px;
  box-shadow: var(--shadow); overflow: hidden;
}
.map-nav-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--text); cursor: pointer;
  font-size: 16px; font-weight: 600; padding: 0;
  transition: background .12s, color .12s;
}
.map-nav-btn + .map-nav-btn { border-top: 1px solid var(--border); }
.map-nav-btn:hover { background: var(--surface-2); color: var(--brand-strong); }
.map-nav-btn.on { background: var(--brand-soft); color: var(--brand-strong); }
.map-nav-btn svg { width: 16px; height: 16px; }

/* Floating tract hover readout (top-left, non-blocking!) */
.map-tract-hud {
  position: absolute; top: 12px; left: 12px; z-index: 600;
  background: var(--surface-glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 9px 12px; box-shadow: var(--shadow); max-width: 270px;
  pointer-events: none; font-size: 12px; color: var(--text);
}
.map-tract-hud .th-title { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.map-tract-hud .th-grid { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; }
.map-tract-hud .th-k { color: var(--text-2); }
.map-tract-hud .th-v { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* Floating subtle map hint pill (top-left or bottom-center) */
.map-mode-banner {
  position: absolute; top: 12px; left: 12px; z-index: 590;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 99px;
  background: var(--surface-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: 12px; font-weight: 600; color: var(--text); pointer-events: none;
}
.map-mode-banner .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--rival);
  box-shadow: 0 0 0 3px var(--rival-soft);
}

/* Floating selected salon / candidate quick-inspector card */
.map-inspector {
  position: absolute; left: 12px; bottom: 12px; z-index: 650;
  width: min(350px, calc(100% - 24px));
  background: var(--surface-glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 13px 15px;
  animation: popIn .18s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.map-inspector .mi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.map-inspector .mi-title { font-weight: 750; font-size: 14.5px; line-height: 1.25; }
.map-inspector .mi-addr { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.map-inspector .mi-close {
  width: 26px; height: 26px; border-radius: 7px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none;
}
.map-inspector .mi-close:hover { background: var(--surface-2); color: var(--text); }
.map-inspector .mi-metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.map-inspector .mi-stat { background: var(--surface-2); border-radius: 9px; padding: 6px 8px; }
.map-inspector .mi-stat .k { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.map-inspector .mi-stat .v { font-size: 14px; font-weight: 750; margin-top: 1px; font-variant-numeric: tabular-nums; }
.map-inspector .mi-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* Map footer legend bar — ZERO map occlusion! */
.map-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 14px 22px; flex-wrap: wrap;
  padding: 11px 18px; border-top: 1px solid var(--border);
  background: var(--surface); font-size: 12px; color: var(--text-2);
}
.legend-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.legend-title { font-weight: 700; color: var(--text); font-size: 11.5px; white-space: nowrap; }
.legend-ramp-wrap { display: inline-flex; align-items: center; gap: 6px; }
.legend-ramp {
  display: flex; width: 104px; height: 8px; border-radius: 99px; overflow: hidden;
  border: 1px solid var(--border);
}
.legend-ramp span { flex: 1; }
.legend-end { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.legend-keys { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.legend-key { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.hollow { background: transparent; border: 1.8px solid var(--muted); }
.dot.ta-sw { width: 12px; height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--home) 18%, transparent); border: 1.5px solid var(--home); }

/* Leaflet theme + marker refinements */
.leaflet-container { font-family: var(--font); background: var(--surface-2); }
.map-fallback-osm .leaflet-tile-pane { filter: grayscale(0.82) contrast(0.94) brightness(1.03); }
:root[data-theme="dark"] .map-fallback-osm .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(0.85) brightness(0.92) contrast(0.92); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .map-fallback-osm .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) grayscale(0.85) brightness(0.92) contrast(0.92); }
}

/* Attribution cleanly styled for both light & dark modes */
.leaflet-control-attribution {
  font-size: 10px !important;
  background: var(--surface-glass) !important;
  color: var(--muted) !important;
  backdrop-filter: blur(6px);
  padding: 2px 7px !important;
  border-top-left-radius: 7px;
}
.leaflet-control-attribution a { color: var(--text-2) !important; text-decoration: none; }
.leaflet-control-attribution a:hover { text-decoration: underline; }
.leaflet-control-attribution svg.leaflet-attribution-flag { display: none !important; }

/* Tooltips (BOTH SVG chart #tooltip AND Leaflet .salon-tip share exact clean styling!) */
.tooltip,
.leaflet-tooltip.salon-tip {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 11px !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 9px 12px !important;
  font-size: 12.5px !important;
  line-height: 1.4 !important;
  min-width: 195px;
  max-width: 290px;
  white-space: normal !important;
}
.leaflet-tooltip.salon-tip::before { display: none !important; }
.tooltip { position: fixed; z-index: 3000; pointer-events: none; }
.tooltip .tv,
.leaflet-tooltip.salon-tip .tv {
  font-weight: 750; font-size: 13.5px; color: var(--text);
  margin-bottom: 5px; line-height: 1.25;
}
.tooltip .tl,
.leaflet-tooltip.salon-tip .tl { color: var(--text-2); }
.tooltip .row-k,
.leaflet-tooltip.salon-tip .row-k {
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
  padding: 1.5px 0;
}
.tooltip .row-k b,
.leaflet-tooltip.salon-tip .row-k b {
  font-weight: 700; color: var(--text); white-space: nowrap;
}
.tooltip .key-line,
.leaflet-tooltip.salon-tip .key-line {
  width: 10px; height: 3px; display: inline-block; margin-right: 6px;
  vertical-align: middle; border-radius: 2px;
}

/* Ring labels as crisp pills */
.leaflet-tooltip.ring-label {
  background: var(--surface-glass) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: 99px !important;
  box-shadow: var(--shadow-xs) !important;
  color: var(--text-2) !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  padding: 1px 7px !important;
  backdrop-filter: blur(4px);
}
.leaflet-tooltip.ring-label::before { display: none !important; }

/* Home pin with gentle halo */
.home-pin { display: grid; place-items: center; position: relative; }
.home-pin .hp-halo {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  background: color-mix(in srgb, var(--home) 22%, transparent);
  animation: homePulse 2.6s ease-out infinite;
  pointer-events: none;
}
@keyframes homePulse {
  0% { transform: scale(0.75); opacity: 0.75; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}
.home-pin svg { width: 34px; height: 34px; position: relative; z-index: 2; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .32)); }

/* Smart salon map labels */
.map-label-icon { background: transparent; border: 0; pointer-events: none; }
.map-lbl {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 7px;
  background: var(--surface-glass); backdrop-filter: blur(6px);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-xs);
  color: var(--text); font-size: 11px; font-weight: 650;
  white-space: nowrap; transform: translate(11px, -50%);
  pointer-events: auto; cursor: pointer;
  transition: transform .12s, border-color .12s, background .12s;
}
.map-lbl:hover { border-color: var(--brand); background: var(--surface); }
.map-lbl.is-home {
  background: var(--home); color: #fff; border-color: rgba(255, 255, 255, 0.7);
  transform: translate(19px, -50%); font-weight: 750;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--home) 40%, transparent);
}
.map-lbl.is-sel {
  background: var(--rival); color: #fff; border-color: rgba(255, 255, 255, 0.75);
}
.map-lbl .ml-rate { opacity: 0.82; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Candidate pins (white space) */
.cand-pin {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--rival); color: #fff; font-weight: 800; font-size: 12.5px;
  border: 2.5px solid var(--surface);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.34);
  transition: transform .15s var(--ease);
}
.cand-pin:hover, .cand-pin.sel {
  transform: scale(1.18); background: var(--brand);
  box-shadow: 0 0 0 5px var(--brand-soft-2), 0 4px 14px rgba(0, 0, 0, 0.36);
}

/* Hypothetical entrant pin */
.entrant-pin {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--rival); color: #fff; font-weight: 800; font-size: 14px;
  border: 2.5px solid var(--surface);
  box-shadow: 0 0 0 6px var(--rival-soft), 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow: auto; max-height: 550px; border-top: 1px solid var(--border); }
.table-wrap.tall { max-height: 640px; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th {
  position: sticky; top: 0; z-index: 2;
  background: color-mix(in srgb, var(--surface-2) 65%, var(--surface));
  text-align: left; font-weight: 700; color: var(--text-2); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 10px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--text); }
table.data th .arrow { color: var(--brand); margin-left: 3px; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data td.r, table.data th.r { text-align: right; white-space: nowrap; }
table.data td.num { white-space: nowrap; }
table.data tbody tr { cursor: pointer; transition: background .1s; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tbody tr.sel td { background: color-mix(in srgb, var(--rival) 10%, var(--surface)); }
table.data tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--rival); }
table.data tbody tr.is-home td { background: color-mix(in srgb, var(--brand) 6.5%, var(--surface)); }
table.data tbody tr.is-home td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.name-cell { display: flex; flex-direction: column; gap: 3px; min-width: 155px; }
.name-cell .name-line { display: flex; align-items: center; gap: 6px; }
.name-cell b { font-weight: 680; }
.name-cell .tags { display: flex; gap: 4px; flex-wrap: wrap; }

.star-btn, .loc-btn {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  width: 26px; height: 26px; border-radius: 7px; display: inline-grid; place-items: center;
  padding: 0; line-height: 1; transition: background .12s, color .12s;
}
.star-btn { font-size: 15px; }
.star-btn:hover, .loc-btn:hover { background: var(--surface-3); color: var(--text); }
.star-btn.on { color: var(--brand); }
.loc-btn svg { width: 14px; height: 14px; }

.meter { position: relative; height: 6px; border-radius: 99px; background: var(--surface-3); width: 60px; overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--hot-3), var(--hot-5)); border-radius: 99px; }
.mix { display: flex; height: 6px; width: 72px; gap: 1px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.mix i { display: block; height: 100%; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- Market sidebar & layer pills */
.layer-list { display: flex; flex-direction: column; gap: 6px; }
.layer-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  text-align: left; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--text-2); font-size: 13.5px; font-weight: 600;
  transition: background .14s, border-color .14s, color .14s;
}
.layer-btn:hover { background: var(--surface-2); color: var(--text); }
.layer-btn.on {
  background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 38%, transparent);
  color: var(--brand-strong); font-weight: 700;
}
.layer-btn .lb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none; }
.layer-btn.on .lb-dot { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }

@media (max-width: 1220px) {
  .layer-list { flex-direction: row; flex-wrap: wrap; }
  .layer-btn { width: auto; padding: 7px 12px; font-size: 12.5px; border-radius: 99px; }
}

.cand-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; text-align: left; width: 100%;
  transition: background .14s, border-color .14s;
}
.cand-item:hover { background: var(--surface-2); border-color: var(--border-strong); }
.cand-item.sel { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 42%, transparent); }
.cand-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--rival); color: #fff;
  display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 800; flex: none;
}
.cand-item.sel .cand-num { background: var(--brand); }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; max-width: 820px; height: auto; overflow: visible; margin: 0 auto; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .lbl { fill: var(--text-2); font-size: 11.5px; }
.chart .lbl-strong { fill: var(--text); font-size: 12px; font-weight: 700; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis line, .chart .axis path { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .mark { transition: opacity .14s; }
.chart .dim { opacity: .28; }
.legend { display: flex; gap: 12px 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 10px; align-items: center; }
.legend .k { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.legend .ln { width: 14px; height: 3px; display: inline-block; border-radius: 2px; }
.table-toggle { font-size: 12px; }
.chart-table { margin-top: 12px; }
.chart-table table.data { font-size: 12.5px; }

/* Ranked horizontal bars */
.rank-row {
  display: grid; grid-template-columns: minmax(115px, 38%) 1fr 56px;
  gap: 10px; align-items: center; font-size: 13px;
  padding: 5px 6px; border-radius: 8px; transition: background .12s;
}
.rank-row.clickable { cursor: pointer; }
.rank-row.clickable:hover { background: var(--surface-2); }
.rank-row.is-other { border-top: 1px dashed var(--border-strong); margin-top: 4px; padding-top: 8px; color: var(--muted); }
.rank-track {
  position: relative; height: 12px; border-radius: 99px;
  background: var(--surface-2); overflow: hidden;
}
.rank-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; transition: width .25s var(--ease); }

/* Hours heatmap */
.heat { display: grid; gap: 3px; font-size: 11px; color: var(--muted); }
.heat .cell {
  height: 24px; border-radius: 5px; position: relative; cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
.heat .cell:hover { transform: scale(1.12); z-index: 2; box-shadow: 0 0 0 1.5px var(--text); }
.heat .cell.home::after {
  content: ""; position: absolute; left: 3px; right: 3px; bottom: 3px; height: 3px;
  border-radius: 99px; background: var(--home);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--surface) 60%, transparent);
}
.heat .dlabel { display: flex; align-items: center; color: var(--text-2); font-weight: 700; padding-right: 6px; font-size: 11.5px; }
.heat .hlabel { text-align: left; white-space: nowrap; font-size: 10.5px; font-weight: 600; padding-bottom: 2px; }

.week-strip { display: grid; grid-template-columns: 44px repeat(7, 1fr); gap: 5px; font-size: 11.5px; align-items: center; }
.week-strip .d { color: var(--muted); text-align: center; font-weight: 650; }
.week-strip .slot {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 3px; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 550;
}
.week-strip .slot.closed { opacity: .48; background: var(--surface-3); color: var(--muted); }
.week-strip .slot.edge-you { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 32%, transparent); color: var(--brand-strong); font-weight: 700; }
.week-strip .slot.edge-them { background: var(--rival-soft); border-color: color-mix(in srgb, var(--rival) 32%, transparent); color: var(--rival); font-weight: 700; }

/* ---------------------------------------------------------------- drawer */
.drawer-scrim {
  position: fixed; inset: 0; background: rgba(14, 10, 14, 0.42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 1900;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(490px, 100vw); z-index: 2000;
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  animation: slide .22s var(--ease);
}
@keyframes slide { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  position: sticky; top: 0; z-index: 5;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-glass); backdrop-filter: blur(12px);
}
.drawer-head h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.025em; padding-right: 76px; line-height: 1.2; }
.drawer-head .close { position: absolute; top: 16px; right: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 26px; }
.drawer-foot {
  padding: 11px 16px; border-top: 1px solid var(--border);
  background: var(--surface-glass); backdrop-filter: blur(10px);
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.drawer-foot .btn.sm { padding: 4px 9px; font-size: 12px; }
.drawer section { margin-top: 20px; }
.drawer section:first-child { margin-top: 0; }
.drawer h4 {
  margin: 0 0 9px; font-size: 11px; font-weight: 750; text-transform: uppercase;
  letter-spacing: 0.065em; color: var(--muted);
}
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 11px; padding: 10px 11px;
}
.stat .k { font-size: 11px; color: var(--text-2); font-weight: 600; }
.stat .v { font-size: 18px; font-weight: 750; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .s { font-size: 11px; color: var(--muted); margin-top: 1px; }

.bullets { margin: 0; padding-left: 18px; }
.bullets li { margin: 5px 0; line-height: 1.48; }

.versus {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 7px 12px;
  align-items: center; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.versus .mid { color: var(--muted); font-size: 11.5px; text-align: center; font-weight: 600; }
.versus .win-you { font-weight: 750; color: var(--brand-strong); }
.versus .win-them { font-weight: 750; color: var(--rival); }

/* ---------------------------------------------------------------- playbook & intel */
.recs { display: grid; gap: 14px; }
.rec {
  display: grid; grid-template-columns: 5px 1fr; gap: 0 18px;
  padding: 18px 20px 18px 0; overflow: hidden;
}
.rec .bar { border-radius: 0 4px 4px 0; background: var(--deemph); }
.rec.p1 .bar { background: linear-gradient(180deg, var(--brand), #f43f5e); }
.rec.p2 .bar { background: linear-gradient(180deg, var(--threat), #f59e0b); }
.rec .rec-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.rec h3 { margin: 7px 0 6px; font-size: 17px; font-weight: 750; letter-spacing: -0.015em; }
.rec .why { color: var(--text-2); margin: 0 0 10px; line-height: 1.5; }
.rec .impact {
  display: inline-flex; gap: 7px; align-items: baseline;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px 11px; font-size: 12.5px;
}
.rec .impact b { font-size: 15.5px; font-weight: 800; color: var(--text); }
.rec.p1 .impact { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.rec.p1 .impact b { color: var(--brand-strong); }
.rec ul { margin: 8px 0 0; padding-left: 18px; }
.rec li { margin: 4px 0; line-height: 1.48; }

.feed { display: flex; flex-direction: column; }
.feed-item {
  display: grid; grid-template-columns: 92px 1fr; gap: 12px;
  padding: 11px 8px; border-bottom: 1px solid var(--border); border-radius: 8px;
  transition: background .12s;
}
.feed-item:hover { background: var(--surface-2); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; font-weight: 550; }
.feed-item a { color: var(--text); text-decoration: none; font-weight: 620; line-height: 1.38; }
.feed-item a:hover { text-decoration: underline; color: var(--brand-strong); }
.feed-item .src { font-size: 12px; color: var(--text-2); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.move { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.move:last-child { border-bottom: 0; }
.move .ic {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-strong); font-weight: 800; font-size: 15px;
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; font-size: 13px; }
.kv dt { color: var(--text-2); font-weight: 550; }
.kv dd { margin: 0; font-weight: 550; }

.formula-box { position: relative; }
.formula {
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; overflow-x: auto; white-space: pre-wrap;
}
.copy-btn { position: absolute; top: 6px; right: 6px; }

.assume { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; }
.assume .field {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 13px;
}
.assume .hint { font-size: 11.5px; color: var(--muted); font-weight: 450; line-height: 1.38; }

.cov { display: grid; gap: 11px; }
.cov .line { display: grid; grid-template-columns: 160px 1fr 84px; gap: 12px; align-items: center; font-size: 13px; }
.cov .track { height: 9px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.cov .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--seq-4), var(--brand)); border-radius: 99px; }

/* ---------------------------------------------------------------- boot, toast, callout */
.boot { display: grid; place-items: center; gap: 14px; padding: 130px 0; color: var(--text-2); font-weight: 550; }
.boot-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--brand-soft-2); border-top-color: var(--brand);
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 3500;
  background: var(--text); color: var(--surface);
  padding: 10px 18px; border-radius: 11px; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
}
.callout {
  border-radius: 12px; padding: 12px 15px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  font-size: 13px; color: var(--text-2); line-height: 1.5;
}
.callout b { color: var(--text); }
.split-list { display: grid; gap: 8px; }
.split-list .li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; font-size: 13px; }

.lang-seg button { padding: 4px 8px; font-weight: 750; font-size: 12px; letter-spacing: 0.02em; }
.kbd-hint {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin: 0 2px;
  border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface);
  font: 700 10.5px var(--mono); color: var(--muted);
}
@media (max-width: 820px) { .kbd-hint { display: none; } }

/* Compare hero card */
.cmp-hero { position: relative; overflow: hidden; }
.cmp-hero.is-you {
  border-color: color-mix(in srgb, var(--home) 35%, var(--border));
  background: linear-gradient(160deg, var(--brand-soft), var(--surface) 42%);
}
.cmp-hero.is-them {
  border-color: color-mix(in srgb, var(--rival) 32%, var(--border));
  background: linear-gradient(160deg, var(--rival-soft), var(--surface) 42%);
}

/* Slider value badge */
.slider-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
}
.slider-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.slider-val {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 750; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- ALL OF TUCSON RANKINGS */
.podium {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  align-items: stretch;
}
@media (max-width: 960px) { .podium { grid-template-columns: minmax(0, 1fr); } }

.podium-card {
  position: relative; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px;
  transition: transform .16s var(--ease), border-color .16s, box-shadow .16s;
}
.podium-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.podium-card.r1 {
  border-color: color-mix(in srgb, #eab308 42%, var(--border));
  background: linear-gradient(155deg, rgba(234, 179, 8, 0.11), var(--surface) 58%);
}
.podium-card.r2 {
  border-color: color-mix(in srgb, #94a3b8 38%, var(--border));
  background: linear-gradient(155deg, rgba(148, 163, 184, 0.10), var(--surface) 58%);
}
.podium-card.r3 {
  border-color: color-mix(in srgb, #d97706 36%, var(--border));
  background: linear-gradient(155deg, rgba(217, 119, 6, 0.09), var(--surface) 58%);
}
.podium-card.is-home { box-shadow: 0 0 0 2px var(--home), var(--shadow); }

.rank-medal {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 28px; padding: 0 8px; border-radius: 9px;
  font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--surface-3); color: var(--text-2);
}
.rank-medal.m1 { background: linear-gradient(135deg, #facc15, #ca8a04); color: #1c1404; box-shadow: 0 2px 8px rgba(202, 138, 4, 0.35); }
.rank-medal.m2 { background: linear-gradient(135deg, #e2e8f0, #94a3b8); color: #0f172a; box-shadow: 0 2px 6px rgba(100, 116, 139, 0.25); }
.rank-medal.m3 { background: linear-gradient(135deg, #fdba74, #c2410c); color: #fff; box-shadow: 0 2px 6px rgba(194, 65, 12, 0.28); }

.podium-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.podium-name { margin: 8px 0 2px; font-size: 17.5px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.22; }
.podium-metric { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; text-align: right; font-variant-numeric: tabular-nums; }
.podium-metric-lbl { font-size: 11px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; text-align: right; margin-top: 2px; }
.podium-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  padding-top: 10px; border-top: 1px solid var(--border);
}
.podium-stats .ps-k { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.podium-stats .ps-v { font-size: 13.5px; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 1px; }

.rank-home-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; flex-wrap: wrap;
  padding: 12px 18px;
  background: linear-gradient(90deg, var(--brand-soft), color-mix(in srgb, var(--surface-2) 60%, var(--surface)));
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border));
}
.rank-home-bar .rh-rank { font-size: 20px; font-weight: 800; color: var(--brand-strong); font-variant-numeric: tabular-nums; }

.pct-track {
  height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px;
}
.pct-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #f43f5e); }

.score-bar { display: inline-flex; align-items: center; gap: 7px; cursor: default; }
.score-track { width: 58px; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; flex: none; }
.score-track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--seq-4), var(--brand)); }
.score-track i.q-elite { background: linear-gradient(90deg, #16a34a, #22c55e); }
.score-track i.q-high { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.score-track i.q-solid { background: linear-gradient(90deg, #d97706, #f59e0b); }
.score-track i.q-risk { background: linear-gradient(90deg, #dc2626, #f87171); }
.tier-pill {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 99px;
  font-size: 10.5px; font-weight: 750; letter-spacing: 0.01em; white-space: nowrap;
}
.tier-pill.elite { background: var(--good-soft); color: var(--good-text); }
.tier-pill.high { background: var(--rival-soft); color: var(--rival); }
.tier-pill.solid { background: var(--warn-soft); color: var(--warn-text); }
.tier-pill.risk { background: var(--bad-soft); color: var(--bad-text); }

.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 10px; }
.area-card {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: background .14s, border-color .14s, transform .12s;
}
.area-card:hover { background: var(--surface); border-color: var(--border-strong); transform: translateY(-1px); }
.area-card.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 44%, transparent); }
.area-card .ac-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.area-card .ac-name { font-weight: 750; font-size: 13.5px; color: var(--text); }
.area-card .ac-cnt { font-size: 12px; font-weight: 700; color: var(--brand-strong); font-variant-numeric: tabular-nums; }
.area-card .ac-meta { font-size: 11.5px; color: var(--text-2); line-height: 1.38; }

.rank-board-controls {
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 18px 14px; border-bottom: 1px solid var(--border);
}
.rank-board-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 50%, var(--surface));
}


/* ================================================================ FRIENDLY REDESIGN (Home, Map, Help) */
:root {
  --lvl-high: #b42318; --lvl-med: #f2761e; --lvl-low: #f7b27a; --lvl-avg: #a39aa0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --lvl-high: #ff6b5e; --lvl-med: #ec8f45; --lvl-low: #93644a; --lvl-avg: #7d747a; }
}
:root[data-theme="dark"] { --lvl-high: #ff6b5e; --lvl-med: #ec8f45; --lvl-low: #93644a; --lvl-avg: #7d747a; }

/* Slightly larger, calmer text everywhere */
body { font-size: 15px; }
.card-head p { font-size: 13px; }
.card-head h3 { font-size: 16.5px; }
.tag { font-size: 11.5px; }
.btn .ic { width: 15px; height: 15px; flex: none; }
.btn.sm .ic, .btn.xs .ic { width: 13px; height: 13px; }

/* Legend dots used on maps, the help guide and the Home preview */
.dot.lvl-you { background: var(--home); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px color-mix(in srgb, var(--home) 45%, transparent); }
.dot.lvl-high { background: var(--lvl-high); }
.dot.lvl-med { background: var(--lvl-med); }
.dot.lvl-low { background: var(--lvl-low); }
.dot.rate-above { background: var(--div-pos); }
.dot.rate-avg { background: var(--lvl-avg); }
.dot.rate-below { background: var(--div-neg); }

/* Competition level pills */
.level-pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700;
}
.level-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.level-pill.sm { padding: 2px 8px; font-size: 11.5px; }
.level-pill.high { background: color-mix(in srgb, var(--lvl-high) 13%, transparent); color: var(--lvl-high); }
.level-pill.medium { background: color-mix(in srgb, var(--lvl-med) 16%, transparent); color: color-mix(in srgb, var(--lvl-med) 78%, var(--text)); }
.level-pill.low { background: var(--surface-3); color: var(--text-2); }
.level-pill.low::before { background: var(--lvl-low); }

/* ---------------------------------------------------------------- Home */
.hero {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 26px 28px 24px;
  background:
    radial-gradient(700px 260px at 92% -20%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    linear-gradient(160deg, var(--brand-soft), var(--surface) 62%);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--border));
  box-shadow: var(--shadow);
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.hero-hello { font-size: 14px; font-weight: 700; color: var(--brand-strong); letter-spacing: .01em; }
.hero-title { margin: 2px 0 0; font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.08; }
.hero-sub { margin: 8px 0 0; font-size: 16px; color: var(--text-2); max-width: 640px; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-actions .btn { min-height: 42px; padding: 9px 16px; font-size: 14px; border-radius: 12px; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 22px; }
.hstat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 15px 16px 14px; display: flex; flex-direction: column; gap: 5px; min-width: 0;
  box-shadow: var(--shadow-xs); transition: transform .15s var(--ease), box-shadow .15s, border-color .15s;
}
.hstat.clickable { cursor: pointer; }
.hstat.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.hstat-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hstat-ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); flex: none; }
.hstat-ic .ic { width: 16px; height: 16px; }
.hstat-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.hstat-top .pill-badge { margin-left: auto; }
.hstat-value { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.hstat-value small { font-size: 14px; font-weight: 650; color: var(--text-2); letter-spacing: 0; }
.hstat-sub { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.hstat-foot { font-size: 12.5px; color: var(--muted); padding-top: 7px; margin-top: auto; border-top: 1px dashed var(--border-strong); line-height: 1.4; }

.home-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.moves { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.move {
  display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start;
  padding: 13px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
}
.move-num {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 15px;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--brand) 35%, transparent);
}
.move-title { font-weight: 750; font-size: 15px; line-height: 1.3; }
.move-why { margin: 4px 0 0; color: var(--text-2); font-size: 13.5px; line-height: 1.45; }
.move-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.move-impact { font-size: 12.5px; color: var(--text-2); }
.move-impact b { color: var(--text); font-size: 13.5px; }
.move-foot .btn { margin-left: auto; }

.preview-card { display: flex; flex-direction: column; }
.preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.preview-head h3 { margin: 0; font-size: 16.5px; font-weight: 750; }
.preview-head p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
.preview-stage { position: relative; flex: 1; min-height: 300px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.map.mini-map { height: 100%; min-height: 300px; position: absolute; inset: 0; }
.preview-legend { display: flex; gap: 12px; flex-wrap: wrap; padding: 10px 20px 12px; font-size: 12px; }

.rival-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.rival {
  display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border); min-width: 0;
}
.rival-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rival-name { font-weight: 750; font-size: 15.5px; line-height: 1.25; margin-top: 2px; }
.rival-meta { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rival-rating { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.rival-rating b { font-size: 18px; letter-spacing: -0.02em; }
.rival-actions { display: flex; gap: 6px; margin-top: 6px; }

.news-list { display: flex; flex-direction: column; }
.ni {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 11px; align-items: start; text-align: left;
  padding: 10px 6px; border: 0; border-top: 1px solid var(--border); background: transparent;
  color: var(--text); text-decoration: none; cursor: pointer; border-radius: 10px; width: 100%;
}
.ni:first-child { border-top: 0; }
.ni:hover { background: var(--surface-2); }
.ni-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.ni-ic .ic { width: 16px; height: 16px; }
.ni-title { font-weight: 650; font-size: 14px; line-height: 1.35; }
.ni-text { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.4; }
.ni-date { font-size: 12px; color: var(--muted); white-space: nowrap; padding-top: 2px; font-variant-numeric: tabular-nums; }

.tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tips li { display: grid; grid-template-columns: 32px 1fr; gap: 11px; align-items: center; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.tip-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.tip-ic .ic { width: 16px; height: 16px; }

@media (max-width: 1220px) {
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .rival-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .hero { padding: 20px 18px; border-radius: 18px; }
  .hero-stats { grid-template-columns: minmax(0, 1fr); }
  .rival-grid { grid-template-columns: minmax(0, 1fr); }
  .hstat-value { font-size: 28px; }
}

/* ---------------------------------------------------------------- Map page */
.map-page { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: stretch; }
.map-main .map { height: clamp(460px, calc(100vh - 330px), 760px); }
.map-bar2 {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.map-bar2 select { min-height: 36px; font-size: 13.5px; }
.mb-search { position: relative; flex: 1 1 240px; min-width: 200px; display: flex; align-items: center; }
.mb-search .ic { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.mb-search input { width: 100%; padding-left: 35px; padding-right: 34px; min-height: 38px; font-size: 14px; border-radius: 11px; }
.mb-search .kbd-hint { position: absolute; right: 8px; margin: 0; }
.pop-wrap { position: relative; }
.pop-btn { min-height: 36px; }
.pop-btn.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand-strong); }
.pop-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: inline-grid; place-items: center;
  background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 800;
}
.popover {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 1200; width: 320px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 14px; display: flex; flex-direction: column; gap: 10px;
  animation: popIn .16s var(--ease); max-height: min(70vh, 560px); overflow-y: auto;
}
.pop-title { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 4px; }
.pop-title:first-child { margin-top: 0; }
.pop-check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; cursor: pointer; line-height: 1.35; }
.pop-check input { margin-top: 2px; }
.pop-check small { display: block; color: var(--muted); font-size: 12px; }
.seg.seg-block { display: flex; width: 100%; }
.seg.seg-block button { flex: 1; padding: 7px 6px; font-size: 13px; white-space: normal; line-height: 1.2; }
.style-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-pick {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 6px; border-radius: 11px;
  border: 1.5px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--text-2);
}
.style-pick.on { border-color: var(--brand); color: var(--brand-strong); box-shadow: 0 0 0 3px var(--brand-soft); }
.sp-swatch { height: 38px; border-radius: 7px; border: 1px solid var(--border); }
.style-pick.clean .sp-swatch { background: linear-gradient(135deg, #f1f1ef 0 45%, #e3e3e0 45% 55%, #f1f1ef 55%), #eee; }
.style-pick.streets .sp-swatch { background: linear-gradient(90deg, transparent 46%, #f6c86a 46% 54%, transparent 54%), linear-gradient(0deg, transparent 40%, #fff 40% 50%, transparent 50%), #e8e3d7; }
.style-pick.satellite .sp-swatch { background: radial-gradient(circle at 30% 40%, #6b7a4a, transparent 40%), radial-gradient(circle at 70% 70%, #8a7a5c, transparent 45%), #4b5a3c; }

.map-scroll-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1000;
  padding: 10px 16px; border-radius: 12px; background: rgba(20, 12, 18, 0.78); color: #fff;
  font-size: 14px; font-weight: 650; pointer-events: none; opacity: 0; transition: opacity .2s;
  white-space: nowrap;
}
.map-scroll-hint.show { opacity: 1; }

/* contain: size lets the map card alone set the row height; the list scrolls inside it */
.list-card { display: flex; flex-direction: column; min-height: 0; contain: size; }
.lc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.lc-head h3 { margin: 0; font-size: 16.5px; font-weight: 750; }
.lc-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); }
.lc-head select { min-height: 34px; font-size: 13px; max-width: 170px; }
.slist { overflow-y: auto; flex: 1; min-height: 0; padding: 6px; }
.srow {
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 10px; border-radius: 12px; cursor: pointer; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.srow + .srow { margin-top: 2px; }
.srow:hover { background: var(--surface-2); }
.srow.sel { background: var(--rival-soft); border-color: color-mix(in srgb, var(--rival) 35%, transparent); }
.srow.is-home { background: color-mix(in srgb, var(--brand) 7%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
.srow-pin { width: 14px; height: 14px; border-radius: 50%; justify-self: center; box-shadow: 0 0 0 2px var(--surface), 0 1px 3px rgba(0,0,0,.2); }
.srow-pin.hollow { background: transparent; border: 1.8px solid var(--muted); box-shadow: none; }
.srow-pin.home { width: 22px; height: 22px; display: grid; place-items: center; background: var(--home); color: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--home) 40%, transparent); }
.srow-pin.home .ic { width: 13px; height: 13px; fill: #fff; stroke: #fff; }
.srow-main { min-width: 0; }
.srow-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.srow-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 1px; }
.srow-meta b { color: var(--text); font-weight: 750; }
.srow-meta .sep { color: var(--muted); }
.srow-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.srow-side { display: flex; align-items: center; gap: 4px; }

@media (max-width: 1220px) {
  .map-page { grid-template-columns: minmax(0, 1fr); }
  .list-card { max-height: 560px; contain: none; }
}
@media (max-width: 820px) {
  .map-main .map { height: 62vh; min-height: 380px; }
  .mb-search { flex-basis: 100%; }
  .popover { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; max-height: 70vh; overflow-y: auto; }
}

/* ---------------------------------------------------------------- Top bar extras */
a.icon-btn { color: var(--text-2); text-decoration: none; }
.icon-btn.active { background: var(--brand-soft); color: var(--brand-strong); border-color: color-mix(in srgb, var(--brand) 35%, transparent); }

/* ---------------------------------------------------------------- Help guide */
.help-scrim {
  position: fixed; inset: 0; z-index: 3200; display: grid; place-items: center; padding: 20px;
  background: rgba(16, 10, 14, 0.46); backdrop-filter: blur(3px);
}
.help-card {
  width: min(860px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px;
  box-shadow: var(--shadow-lg); animation: popIn .18s var(--ease);
}
.help-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 8px; }
.help-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.help-head p { margin: 4px 0 0; color: var(--text-2); }
.help-head .mi-close { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--text-2); }
.help-head .mi-close .ic { width: 16px; height: 16px; }
.help-body { padding: 10px 24px 24px; display: flex; flex-direction: column; gap: 18px; }
.help-body h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.help-pages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.help-page {
  display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 11px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; color: var(--text);
}
.help-page:hover { border-color: color-mix(in srgb, var(--brand) 35%, transparent); background: var(--brand-soft); }
.help-page b { font-size: 14px; }
.help-page span { font-size: 12.5px; color: var(--text-2); line-height: 1.4; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.hk { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); padding: 4px 0; }
.hk kbd, kbd.kbd-inline {
  min-width: 30px; text-align: center; padding: 2px 8px; border-radius: 7px; font: 700 12.5px var(--font);
  border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface-2); color: var(--text);
}
.hk .dot { width: 12px; height: 12px; }
@media (max-width: 720px) {
  .help-pages { grid-template-columns: minmax(0, 1fr); }
  .help-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- Phones: keep the top bar on one row */
@media (max-width: 560px) {
  .topbar-right { flex: 1 1 0; min-width: 0; gap: 6px; }
  .home-picker { flex: 1 1 auto; min-width: 0; padding-left: 8px; }
  .home-picker select { max-width: none; width: 100%; min-width: 0; text-overflow: ellipsis; }
  .lang-seg .kbd-hint { display: none; }
  .topbar-right .icon-btn { width: 32px; height: 32px; }
  .hero-actions { width: 100%; }
  .hero-actions .btn { flex: 1 1 100%; justify-content: center; }
}
@media (max-width: 820px) {
  /* two per row: the two pickers, then Filters + Layers */
  .map-bar2 select, .map-bar2 .pop-wrap { flex: 1 1 40%; min-width: 0; }
  .map-bar2 .pop-btn { width: 100%; justify-content: center; }
}
@media (hover: none), (max-width: 560px) {
  .mb-search .kbd-hint { display: none; }
  .mb-search input { padding-right: 12px; }
}
