/* RESDOGS — the `new kwizi` design tokens, ported verbatim.
   Source: new kwizi/src/app/globals.css + the map page's Tailwind classes. */

:root {
  --background: #ffffff;
  --foreground: #171717;
  --surface: #121620;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --page: #0a0c10;
  --panel: #121620;
  --panel-2: #1f2937;
  --panel-3: #374151;
  --report: #0f172a;
  --tile: #0b0e14;
  --card-from: #161b26;
  --card-to: #10141d;
  --blue: #2c7be5;
  --blue-600: #2563eb;
  --cyan: #00d4ff;
  --purple: #a855f7;
  --pink: #ec4899;
  --green: #34d399;
  --amber: #f59e0b;
  --orange: #fb923c;
}

@media (prefers-color-scheme: dark) {
  :root { --background: #0a0a0a; --foreground: #ededed; }
}

* { box-sizing: border-box; }

/* A `hidden` attribute must win over any author `display` rule below
   (.apply-fab, .map-overlay, etc. all set display:flex). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page);
  color: #e5e7eb;
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

@supports (padding: env(safe-area-inset-bottom)) {
  body { padding-bottom: env(safe-area-inset-bottom); }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

button { font-family: inherit; }

/* ── layout ─────────────────────────────────────────────────────────────── */
.app {
  min-height: 100vh;
  background: var(--page);
  color: #fff;
  display: flex;
  flex-direction: column;
}

.workspace { flex: 1; display: flex; flex-direction: column; min-height: 0; }
@media (min-width: 1024px) { .workspace { flex-direction: row; } }

.main-col {
  flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto;
}
.main-inner { padding: 1rem; display: flex; flex-direction: column; min-height: 100%; }
@media (min-width: 1024px) { .main-inner { padding: 1.5rem; } }

/* ── header ─────────────────────────────────────────────────────────────── */
.header {
  background: var(--panel);
  border-bottom: 1px solid rgba(255,255,255,.06);
  padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0; z-index: 30;
}
@media (min-width: 1024px) { .header { padding: .75rem 1.5rem; } }

.header-left, .header-right { display: flex; align-items: center; gap: .5rem; }
.header-btn {
  background: var(--panel-2); color: #fff; padding: .5rem; border-radius: .5rem;
  display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .875rem;
  border: none; cursor: pointer; transition: background .15s;
}
@media (min-width: 640px) { .header-btn { padding: .5rem .75rem; } }
.header-btn:hover { background: var(--panel-3); }
.header-btn .lbl { display: none; }
@media (min-width: 640px) { .header-btn .lbl { display: inline; } }
@media (min-width: 1024px) { .header-btn .lbl { display: inline; } }

.logo-tile {
  width: 2rem; height: 2rem; background: #2563eb; border-radius: .5rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.3); font-weight: 700; font-size: 1.125rem;
}
.h-sep { height: 1.25rem; width: 1px; background: rgba(255,255,255,.1); margin: 0 .25rem; }
.h-title { font-size: .875rem; font-weight: 700; color: #fff; line-height: 1.25; }
@media (min-width: 640px) { .h-title { font-size: 1rem; } }
.h-back { display: flex; align-items: center; gap: .5rem; color: #9ca3af; text-decoration: none; font-size: .875rem; font-weight: 500; }
.h-back:hover { color: #fff; }
.h-back .lbl { display: none; }
@media (min-width: 640px) { .h-back .lbl { display: inline; } }

.status-loading { display: flex; align-items: center; gap: .5rem; color: #93c5fd; font-size: .875rem; margin-right: .5rem; }
.spinner {
  width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid #60a5fa; border-top-color: transparent;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── summary bar ────────────────────────────────────────────────────────── */
.summary {
  background: var(--page); border-bottom: 1px solid rgba(255,255,255,.06);
  padding: .625rem 1rem; display: flex; flex-wrap: wrap; align-items: center;
  gap: 1rem .5rem; font-size: .75rem;
}
@media (min-width: 1024px) { .summary { padding: .625rem 1.5rem; } }
.summary-item { display: flex; align-items: center; gap: .375rem; }
.summary-label { color: #6b7280; text-transform: uppercase; font-weight: 700; }
.summary-value { color: #fff; font-weight: 600; }
.summary-sep { height: 1rem; width: 1px; background: rgba(255,255,255,.1); }
@media (max-width: 639px) { .summary-sep { display: none; } }
.summary-right { flex: 1; display: flex; align-items: center; gap: .75rem; color: #9ca3af; }
.summary-right b { color: #fff; font-weight: 600; }

/* ── sidebar ────────────────────────────────────────────────────────────── */
.sidebar-toggle {
  margin: .75rem .75rem 0; display: flex; align-items: center; gap: .5rem;
  padding: .5rem .75rem; border-radius: .75rem; background: var(--panel);
  border: 1px solid rgba(255,255,255,.06); color: #d1d5db;
  font-size: .875rem; font-weight: 600; cursor: pointer;
}
@media (min-width: 1024px) { .sidebar-toggle { display: none; } }

.badge {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 .375rem; border-radius: 9999px;
  background: #2563eb; color: #fff; font-size: 10px; font-weight: 700;
}

.backdrop {
  position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
}
@media (min-width: 1024px) { .backdrop { display: none; } }

.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40;
  width: 92vw; max-width: 28rem; flex-shrink: 0;
  background: var(--page); border-right: 1px solid rgba(255,255,255,.06);
  padding: 1rem; overflow-y: auto; display: none; flex-direction: column; gap: 1rem;
}
.sidebar.open { display: flex; }
@media (min-width: 1024px) {
  .sidebar {
    position: static; display: flex !important; width: 20rem; z-index: auto;
  }
}
@media (min-width: 1280px) { .sidebar { width: 22rem; } }

.sheet-head {
  position: sticky; top: 0; z-index: 10; margin: 0 -1rem 0; padding: .25rem 1rem .75rem;
  background: var(--page); border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
@media (min-width: 1024px) { .sheet-head { display: none; } }
.sheet-title { font-size: .875rem; font-weight: 700; color: #fff; }
.icon-btn {
  padding: .375rem; border-radius: .5rem; border: none; background: transparent;
  color: #9ca3af; cursor: pointer; flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ── filter section ─────────────────────────────────────────────────────── */
.section {
  background: var(--panel); border: 1px solid rgba(255,255,255,.06);
  border-radius: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.2); overflow: hidden;
}
.section-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 1rem; color: #9ca3af; background: none; border: none; cursor: pointer;
  transition: background .15s, color .15s;
}
.section-head:hover { color: #fff; background: rgba(255,255,255,.02); }
.section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.chev { transition: transform .25s ease-in-out; }
.chev.open { transform: rotate(180deg); }
.section-body { padding: 0 1rem 1rem; }

/* ── controls ───────────────────────────────────────────────────────────── */
.seg { display: flex; flex-wrap: wrap; gap: .25rem; }
.seg-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .25rem;
  font-size: .75rem; font-weight: 600; padding: .5rem; border-radius: .5rem;
  border: none; background: transparent; color: #d1d5db; cursor: pointer;
  transition: background .15s; white-space: nowrap;
}
.seg-btn:hover { background: rgba(255,255,255,.05); }
.seg-btn.active { background: #2563eb; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.seg-btn .full { display: none; }
@media (min-width: 640px) { .seg-btn .full { display: inline; } .seg-btn .short { display: none; } }

.prem {
  margin-left: .125rem; display: inline-flex; align-items: center; gap: .125rem;
  font-size: 9px; font-weight: 700; color: #fcd34d; background: rgba(245,158,11,.1);
  padding: .125rem .25rem; border-radius: .25rem;
}
.prem .p-full { display: none; }
@media (min-width: 640px) { .prem .p-full { display: inline; } }

.select-wrap { position: relative; }
.select-trigger {
  width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  color: #fff; font-size: .875rem; border-radius: .75rem; padding: .625rem .75rem;
  padding-right: 2.25rem; outline: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  transition: border-color .15s;
}
.select-trigger:hover { border-color: rgba(255,255,255,.2); }
.select-trigger:focus { border-color: rgba(59,130,246,.6); }
.select-panel {
  position: absolute; z-index: 9500; top: calc(100% + 4px); left: 0; right: 0;
  max-height: 18rem; overflow-y: auto; background: var(--panel);
  border: 1px solid rgba(255,255,255,.08); border-radius: .75rem;
  box-shadow: 0 20px 25px rgba(0,0,0,.4); padding: .25rem 0;
}
.select-panel.up { top: auto; bottom: calc(100% + 4px); }
.select-opt {
  width: 100%; text-align: left; padding: .5rem .75rem; font-size: .875rem;
  background: none; border: none; color: #e5e7eb; cursor: pointer; transition: background .15s;
}
.select-opt:hover { background: rgba(255,255,255,.05); }
.select-opt.active { background: rgba(59,130,246,.2); color: #93c5fd; }

.hint { font-size: 10px; color: #6b7280; margin-top: .375rem; display: flex; align-items: center; gap: .25rem; }

input[type="text"], input[type="number"], select {
  width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.06);
  color: #fff; font-size: .875rem; border-radius: .5rem; padding: .375rem .5rem; outline: none;
}
select { cursor: pointer; }
select option { background: var(--panel); color: #fff; }
input:focus, select:focus { border-color: rgba(59,130,246,.5); }
input[type="text"].sm, select.sm { font-size: .75rem; }

.label {
  display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: #9ca3af; margin-bottom: .375rem;
}
.label.tiny { font-size: 9px; margin-bottom: .25rem; }
.opt-count { color: #6b7280; font-weight: 600; text-transform: none; letter-spacing: 0; }
select[multiple] { padding: .25rem; line-height: 1.5; }
/* One option per row: long school names must not wrap into 4-line blocks. */
select[multiple] option { padding: .2rem .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }

/* dual range slider */
.range-label {
  display: flex; justify-content: space-between; font-size: .75rem; color: #9ca3af;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem;
}
.range-value { color: #60a5fa; }
.range-pair { display: flex; gap: .5rem; }
.kwizi-range {
  -webkit-appearance: none; appearance: none; display: block; width: 100%;
  min-width: 0; height: 6px; border-radius: 9999px; background: rgba(255,255,255,.12);
  outline: none; cursor: pointer; margin: 8px 0;
}
.kwizi-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: #3b82f6; border: 2px solid #0a0c10;
  box-shadow: 0 0 0 1.5px rgba(59,130,246,.65); cursor: grab;
}
.kwizi-range::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.15); }
.kwizi-range::-webkit-slider-runnable-track { height: 6px; border-radius: 9999px; background: transparent; }
.kwizi-range::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #3b82f6;
  border: 2px solid #0a0c10; box-shadow: 0 0 0 1.5px rgba(59,130,246,.65); cursor: grab;
}
.kwizi-range::-moz-range-track { height: 6px; border-radius: 9999px; background: transparent; }

.check {
  display: flex; align-items: center; gap: .375rem; font-size: .75rem;
  color: #d1d5db; cursor: pointer; user-select: none;
}
.check input { width: auto; accent-color: #3b82f6; }

.chip {
  padding: .25rem .5rem; border-radius: .375rem; font-size: 10px; font-weight: 700;
  border: 1px solid rgba(255,255,255,.06); background: rgba(255,255,255,.05);
  color: #9ca3af; cursor: pointer; transition: background .15s;
}
.chip:hover { background: rgba(255,255,255,.1); }
.chip.active { background: #7c3aed; border-color: #a855f7; color: #fff; }

.layer-btn {
  width: 100%; display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem;
  border-radius: .75rem; border: 1px solid transparent; cursor: pointer;
  font-size: .875rem; font-weight: 600; text-align: left;
  background: rgba(0,0,0,.4); border-color: rgba(255,255,255,.06); color: #9ca3af;
  transition: background .2s, color .2s, border-color .2s;
}
.layer-btn:hover { background: rgba(255,255,255,.1); }
.layer-btn.on { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.2); color: #fff; }

.reset-btn {
  width: 100%; padding: .75rem; font-size: .75rem; font-weight: 600; color: #9ca3af;
  background: var(--panel); border: 1px solid rgba(255,255,255,.06); border-radius: .75rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem;
  transition: color .15s;
}
.reset-btn:hover { color: #fff; }

/* ── ads ────────────────────────────────────────────────────────────────── */
.map-row { display: flex; gap: .75rem; align-items: stretch; }
.ad-slot { position: relative; overflow: hidden; border-radius: .75rem; background: #0b0e14; border: 1px solid rgba(255,255,255,.08); }
.ad-slot a { display: block; width: 100%; height: 100%; }
.ad-slot img, .ad-slot video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-banner { width: 100%; max-width: 64rem; margin: .5rem auto; height: 96px; }
@media (max-width: 640px) { .ad-banner { height: 72px; } }
.ad-side { width: 180px; flex-shrink: 0; display: none; }
@media (min-width: 1280px) { .ad-side { display: block; } }
.ad-slot .sponsored {
  position: absolute; top: .35rem; left: .35rem; z-index: 2; background: rgba(0,0,0,.65);
  color: #d1d5db; font-size: 9px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding: .15rem .4rem; border-radius: .25rem;
}
@media (max-width: 1279px) { #ad-left, #ad-right { display: none !important; } }

/* Free plan: the map is readable but the filters are locked. */
.plan-locked #sidebar .section,
.plan-locked #reset-all,
.plan-locked #apply-filters,
.plan-locked #tool-report { opacity: .4; pointer-events: none; }
.plan-locked #sidebar { position: relative; }
.plan-locked #sidebar::before {
  content: ''; position: absolute; inset: 0; z-index: 5;
  background: linear-gradient(to bottom, rgba(10,12,16,.2), rgba(10,12,16,.65));
  pointer-events: none;
}
.plan-banner {
  position: sticky; top: 0; z-index: 6; background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #fff; border-radius: .75rem; padding: .8rem .9rem; margin-bottom: .5rem;
  font-size: .78rem; line-height: 1.4;
}
.plan-banner b { display: block; font-size: .85rem; margin-bottom: .2rem; }
.plan-banner a {
  display: inline-block; margin-top: .5rem; background: #fff; color: #0b1220;
  padding: .35rem .7rem; border-radius: .4rem; font-weight: 700; font-size: .72rem;
}
.premium-locked { opacity: .35; pointer-events: none; position: relative; }

/* ── map card ───────────────────────────────────────────────────────────── */
/* The map fills the viewport by default. Each active banner takes ~96 px
   from the height; the side skyscrapers take their width from the row. */
.map-card {
  position: relative; min-width: 0; flex: 1 1 auto;
  height: calc(100vh - 170px); min-height: 480px; max-height: none;
}
@media (max-width: 639px) {
  .map-card { height: calc(100vh - 235px); min-height: 420px; }
}
body.ads-top .map-card,
body.ads-bottom .map-card { height: calc(100vh - 266px); }
body.ads-top.ads-bottom .map-card { height: calc(100vh - 362px); }
@media (max-width: 639px) {
  body.ads-top .map-card,
  body.ads-bottom .map-card { height: calc(100vh - 331px); }
  body.ads-top.ads-bottom .map-card { height: calc(100vh - 427px); }
}
.map-shell {
  position: absolute; inset: 0; background: var(--panel);
  border: 1px solid rgba(255,255,255,.06); border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.5);
  padding: .75rem; display: flex; flex-direction: column; overflow: hidden;
}
.map-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .75rem; padding: 0 .25rem; gap: .5rem; flex-wrap: wrap;
}
.map-toolbar-left { display: flex; align-items: center; gap: .5rem; color: #9ca3af; }
.map-toolbar-left .t { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.map-toolbar-left .c { font-size: .75rem; color: #6b7280; }
.map-toolbar-right { display: flex; align-items: center; gap: .75rem; }
#map { position: absolute; inset: 0; }
.map-host {
  flex: 1; position: relative; border-radius: .75rem; overflow: hidden;
  border: 1px solid rgba(255,255,255,.06); isolation: isolate; min-height: 0;
}

/* map tool column */
.map-tools {
  position: absolute; top: .75rem; right: .75rem; z-index: 500;
  display: flex; flex-direction: column; gap: .5rem;
}
.tool-btn {
  width: 2.25rem; height: 2.25rem; border-radius: .5rem; border: 1px solid rgba(255,255,255,.06);
  background: var(--panel); color: #d1d5db; display: flex; align-items: center;
  justify-content: center; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: background .15s, color .15s;
}
.tool-btn:hover { background: var(--panel-2); }
.tool-btn.active { background: #2563eb; border-color: #3b82f6; color: #fff; }
.tool-btn.danger:hover { background: rgba(190,18,60,.4); color: #fb7185; border-color: #9f1239; }
.tool-btn.pill {
  width: auto; height: 2.25rem; padding: 0 .75rem; gap: .5rem; font-weight: 700;
  font-size: .75rem; white-space: nowrap; color: #fff; border-color: transparent;
  background: linear-gradient(to right, #2563eb, #10b981);
}
.tool-btn.pill:hover { filter: brightness(1.1); }
.tool-btn:disabled { cursor: not-allowed; opacity: .6; }

.tool-tip {
  position: absolute; right: calc(100% + .5rem); top: 50%; transform: translateY(-50%);
  white-space: nowrap; background: #111827; border: 1px solid #374151; color: #e5e7eb;
  font-size: .75rem; padding: .25rem .5rem; border-radius: .375rem; box-shadow: 0 10px 15px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.tool-wrap { position: relative; }
.tool-wrap:hover .tool-tip { opacity: 1; }
.tool-tip b { color: #fff; }
.tool-tip span { color: #9ca3af; }

/* apply filters */
.apply-fab {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); z-index: 800;
  padding: .75rem 1.25rem; border-radius: 9999px; background: #2563eb; color: #fff;
  font-size: .875rem; font-weight: 700; border: 1px solid rgba(96,165,250,.4);
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.5); display: flex; align-items: center;
  gap: .5rem; white-space: nowrap; cursor: pointer;
  transition: transform .15s;
}
.apply-fab:hover { transform: translateY(-50%) scale(1.05); }
.pulse-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #34d399; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* map overlays */
.map-overlay {
  position: absolute; inset: 0; z-index: 1000; background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.overlay-card {
  background: var(--panel); border: 1px solid rgba(255,255,255,.06); border-radius: 1rem;
  padding: 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.5); max-width: 260px; text-align: center;
}
.overlay-card .t { font-size: .875rem; font-weight: 600; }
.overlay-card .d { font-size: .75rem; color: #9ca3af; }
.big-spinner {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 3px solid #3b82f6;
  border-top-color: transparent; animation: spin .6s linear infinite;
}

.banner {
  position: absolute; top: .75rem; left: 50%; transform: translateX(-50%); z-index: 995;
  max-width: 85%; background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.4);
  color: #fde68a; font-size: 11px; line-height: 1.4; border-radius: .75rem;
  padding: .625rem .875rem; box-shadow: 0 10px 15px rgba(0,0,0,.3);
}

.tool-hint {
  position: absolute; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 1001;
  background: rgba(37,99,235,.9); backdrop-filter: blur(8px); color: #fff;
  padding: .5rem 1.25rem; border-radius: 9999px; font-size: .875rem; font-weight: 600;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.2);
  max-width: 92vw; text-align: center; pointer-events: none;
}

/* ── scale range bar ────────────────────────────────────────────────────── */
.scale-bar {
  position: relative; height: .875rem; width: 100%; border-radius: 9999px;
  user-select: none; touch-action: none; cursor: pointer;
}
.scale-handle {
  position: absolute; top: 50%; z-index: 10; width: 1rem; height: 1rem;
  transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid rgba(255,255,255,.7);
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); cursor: grab;
}
.scale-handle.active { border-color: #22d3ee; }
.scale-dim { position: absolute; top: 0; bottom: 0; background: rgba(0,0,0,.6); }
.scale-dim.l { left: 0; border-radius: 9999px 0 0 9999px; }
.scale-dim.r { right: 0; border-radius: 0 9999px 9999px 0; }
.scale-ends { display: flex; justify-content: space-between; font-size: .75rem; font-weight: 600; color: #d1d5db; }

/* ── Hommie AI chat ─────────────────────────────────────────────────────── */
.chat-fab {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 1000;
  width: 3.5rem; height: 3.5rem; border-radius: 9999px;
  background: linear-gradient(to top right, #2563eb, #4f46e5);
  color: #fff; border: 2px solid #fff; display: flex; align-items: center;
  justify-content: center; box-shadow: 0 25px 50px -12px rgba(0,0,0,.6);
  cursor: pointer; transition: transform .15s;
}
.chat-fab:hover { transform: scale(1.08); }
.chat-panel {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 1001;
  width: 24rem; max-width: calc(100vw - 1.5rem); max-height: 34rem;
  background: rgba(18,22,32,.96); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.7); display: flex; flex-direction: column;
  overflow: hidden;
}
@media (max-width: 639px) { .chat-panel { left: .75rem; right: .75rem; width: auto; bottom: .75rem; } }
.chat-head {
  display: flex; align-items: center; gap: .6rem; padding: .75rem .9rem;
  background: linear-gradient(to right, #2563eb, #4f46e5); color: #fff;
}
.chat-avatar {
  width: 2rem; height: 2rem; border-radius: 9999px; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chat-titles { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.chat-titles b { font-size: .85rem; }
.chat-titles small { font-size: .65rem; color: rgba(255,255,255,.75); }
.chat-close { background: none; border: none; color: rgba(255,255,255,.85); cursor: pointer; font-size: .9rem; }
.chat-close:hover { color: #fff; }
.chat-messages { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .55rem; }
.chat-msg { max-width: 85%; padding: .55rem .75rem; border-radius: .85rem; font-size: .78rem; line-height: 1.45; white-space: pre-wrap; }
.chat-msg.user { align-self: flex-end; background: #2563eb; color: #fff; border-bottom-right-radius: .2rem; }
.chat-msg.bot { align-self: flex-start; background: rgba(255,255,255,.08); color: #e5e7eb; border-bottom-left-radius: .2rem; }
.chat-msg.typing { color: #9ca3af; font-style: italic; }
.chat-options { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .8rem .6rem; }
.chat-options button {
  padding: .35rem .6rem; border-radius: 9999px; font-size: .7rem; font-weight: 600;
  background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.35); color: #93c5fd; cursor: pointer;
}
.chat-options button:hover { background: rgba(59,130,246,.28); color: #fff; }
.chat-form { display: flex; gap: .4rem; padding: .65rem; border-top: 1px solid rgba(255,255,255,.08); }
.chat-form input {
  flex: 1; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: .6rem; padding: .5rem .65rem; color: #fff; font-size: .78rem; outline: none;
}
.chat-form input:focus { border-color: #3b82f6; }
.chat-form button {
  width: 2.25rem; height: 2.25rem; border-radius: .6rem; border: none; background: #2563eb;
  color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.chat-form button:disabled { opacity: .5; cursor: not-allowed; }

/* ── report ─────────────────────────────────────────────────────────────── */
.report { margin-top: 1.5rem; scroll-margin-top: 1.5rem; }
.report-root { background: var(--report); padding: 1rem; border-radius: .75rem; display: flex; flex-direction: column; gap: 1rem; }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.report-title { display: flex; align-items: center; gap: .5rem; color: #9ca3af; min-width: 0; }
.report-title h2 { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; margin: 0; }
.rows-badge {
  display: inline-flex; align-items: center; gap: .25rem; padding: .125rem .5rem;
  border-radius: 9999px; background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3);
  color: #93c5fd; font-size: 10px; font-weight: 600; white-space: nowrap;
}
.report-actions { display: flex; align-items: center; gap: 1rem; }
.report-sel { font-size: .75rem; color: #6b7280; font-weight: 700; white-space: nowrap; }
.link-btn { font-size: .75rem; color: #9ca3af; text-decoration: underline; background: none; border: none; cursor: pointer; white-space: nowrap; }
.link-btn:hover { color: #fff; }
.export-btn {
  display: flex; align-items: center; gap: .5rem; background: #2563eb; color: #fff;
  padding: .375rem .75rem; border-radius: .5rem; font-size: .75rem; font-weight: 700;
  border: none; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.export-btn:hover { background: #1d4ed8; }

.report-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 1024px) { .report-grid.two { grid-template-columns: 1fr 1fr; } }

/* ── report boxes ON the map (owner 2026-10-25: "permiteme agregar cajas al
   mapa") — every report card can be pinned as a draggable window over the
   map, up to 3 at a time. ───────────────────────────────────────────────── */
.pin-btn {
  width: 1.6rem; height: 1.6rem; border-radius: .45rem; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
  color: #9ca3af; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.pin-btn:hover { color: #fff; background: rgba(59,130,246,.25); border-color: rgba(59,130,246,.5); }
.card.pinned .pin-btn { color: #93c5fd; background: rgba(59,130,246,.25); border-color: rgba(59,130,246,.5); }

.map-windows { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.map-window {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column;
  max-height: calc(100% - 2rem); max-width: calc(100% - 2rem);
  background: var(--report); border: 1px solid rgba(255,255,255,.14); border-radius: .75rem;
  box-shadow: 0 18px 40px rgba(0,0,0,.6); overflow: hidden;
}
.map-window-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .45rem .55rem .45rem .75rem; cursor: grab; user-select: none;
  border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03);
}
.map-window-head:active { cursor: grabbing; }
.map-window-title {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #e5e7eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-window-close {
  background: none; border: none; color: #9ca3af; cursor: pointer; line-height: 1;
  font-size: .8rem; padding: .2rem .35rem; border-radius: .35rem; flex-shrink: 0;
}
.map-window-close:hover { color: #fff; background: rgba(255,255,255,.1); }
.map-window-body { overflow: auto; padding: .5rem .65rem .65rem; }
.map-window-body .card-body { padding: 0; }
.map-window-body .empty-state { font-size: .72rem; }

.card {
  position: relative; overflow: hidden; border-radius: 1rem;
  background: linear-gradient(to bottom right, var(--card-from), var(--card-to));
  border: 1px solid rgba(255,255,255,.08); box-shadow: 0 10px 15px -3px rgba(0,0,0,.3);
}
.card.accent::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(to right, transparent, currentColor, transparent); opacity: .4;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1rem; border-bottom: 1px solid rgba(255,255,255,.06);
}
.card-icon { width: 1.75rem; height: 1.75rem; border-radius: .5rem; background: rgba(255,255,255,.05); display: flex; align-items: center; justify-content: center; }
.card-title { font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #e5e7eb; font-size: .75rem; margin: 0; }
.card-body { padding: 1rem; }

.tiles { display: grid; gap: .5rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 1024px) { .tiles.four { grid-template-columns: repeat(4, 1fr); } }
.tile {
  position: relative; overflow: hidden; background: var(--tile);
  border: 1px solid rgba(255,255,255,.06); border-radius: .75rem; padding: .875rem;
}
.tile .k { display: block; color: #6b7280; text-transform: uppercase; font-weight: 700; font-size: 10px; margin-bottom: .25rem; }
.tile .v { display: block; font-weight: 700; font-size: 1.25rem; }
.tile.wide {
  grid-column: span 2; background: linear-gradient(to right, rgba(16,185,129,.1), transparent);
  border-color: rgba(16,185,129,.2);
}
@media (min-width: 1024px) { .tile.wide { grid-column: span 4; } }
.tile.wide .k { color: rgba(52,211,153,.8); }
.tile.wide .v { color: var(--green); }

.subpanel { background: var(--tile); border: 1px solid rgba(255,255,255,.06); border-radius: .75rem; padding: .75rem; }
.subpanel .h { text-transform: uppercase; font-weight: 700; letter-spacing: .05em; font-size: 10px; margin-bottom: .5rem; }
.subrow { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.subrow .k { color: #6b7280; font-size: 10px; }
.subrow .v { font-weight: 700; color: #fff; font-size: .75rem; }
.subpanel .empty { color: #6b7280; font-size: 11px; }
.footnote { margin-top: .5rem; color: #4b5563; font-size: 9px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem 1rem; margin-top: 1rem; }
.stat-tile { background: var(--tile); border: 1px solid rgba(255,255,255,.06); border-radius: .5rem; padding: .5rem; text-align: center; }
.stat-tile .k { color: #6b7280; text-transform: uppercase; font-weight: 700; font-size: 10px; }
.stat-tile .v { font-weight: 600; color: #fff; font-size: .875rem; }

.gauge-wrap { display: flex; flex-direction: column; align-items: center; }
.gauge-val { font-size: 1.5rem; font-weight: 700; text-align: center; margin-top: -1.25rem; }
.gauge-label { font-size: .875rem; font-weight: 700; margin-top: .25rem; text-align: center; }
.gauge-scale { display: flex; justify-content: space-between; width: 10rem; font-size: 10px; color: #6b7280; margin-top: .25rem; }

.empty-state { color: #6b7280; text-align: center; font-size: .75rem; padding: 1rem 0; }

.bar-chart { display: flex; flex-direction: column; gap: .5rem; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; }
.bar-row.clickable { cursor: pointer; border-radius: .4rem; padding: .15rem .25rem; margin: -.15rem -.25rem; transition: background .15s; }
.bar-row.clickable:hover { background: rgba(59,130,246,.12); }
.bar-name { font-size: .75rem; color: #d1d5db; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { grid-column: 1 / -1; height: .375rem; background: rgba(255,255,255,.05); border-radius: 9999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9999px; }
.bar-val { font-size: .75rem; font-weight: 700; color: #fff; }

.table { width: 100%; border-collapse: collapse; font-size: .75rem; }
.table th { text-align: left; color: #6b7280; text-transform: uppercase; font-weight: 700; font-size: 10px; padding: .375rem .5rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.table td { padding: .375rem .5rem; border-bottom: 1px solid rgba(255,255,255,.04); color: #e5e7eb; }
.table td.num { text-align: right; font-weight: 600; }

/* leaflet overrides */
.leaflet-container { background: #0a0c10; font-family: Arial, Helvetica, sans-serif; }
.leaflet-control-zoom a { background: var(--panel) !important; color: #fff !important; border-color: rgba(255,255,255,.1) !important; }
.leaflet-control-attribution { background: rgba(18,22,32,.85) !important; color: #9ca3af !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: #60a5fa !important; }
.maplibregl-popup-content {
  font: 12px Arial, sans-serif; color: #fff; background: #161a24;
  border: 1px solid #374151; border-radius: 8px; padding: 10px 12px;
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: #161a24 !important; }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: #161a24 !important; }
.maplibregl-popup-close-button { color: #9ca3af !important; font-size: 18px !important; padding: 4px 8px 0 0 !important; }
.pop-name { font-size: 13px; display: block; margin-bottom: 3px; }
.pop-val { color: #4d9fff; font-weight: 700; }
.pop-meta { color: #9ca3af; font-size: 11px; }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 10000;
  background: var(--panel); border: 1px solid rgba(255,255,255,.08); color: #e5e7eb;
  padding: .625rem 1rem; border-radius: .75rem; font-size: .75rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.5);
}

@media print {
  html, body { background: #fff !important; color: #000 !important; }
  .header, .summary, .sidebar, .map-card, .sidebar-toggle { display: none !important; }
  .report-root { background: #fff !important; }
}

/* ── Forecast legend, collapsible cards, guided tour ─────────────────────── */
.fc-legend { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .6rem; }
.fc-chip {
  display: inline-flex; align-items: center; gap: .28rem; font-size: .65rem;
  padding: .12rem .45rem; border-radius: 9999px; border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04); color: #d1d5db; cursor: pointer;
}
.fc-chip:hover { border-color: rgba(96,165,250,.6); color: #fff; }
.fc-chip.off { opacity: .35; }
.fc-dot { width: .45rem; height: .45rem; border-radius: 9999px; display: inline-block; }

.card-head { cursor: pointer; }
.card.collapsed .card-body { display: none; }

.tour-body { padding: 1rem 1.25rem; }
.tour-body h3 { margin: 0 0 .4rem; font-size: 1rem; }
.tour-body p { margin: 0; font-size: .82rem; line-height: 1.6; color: #d1d5db; }
.tour-step { font-size: .7rem; color: #6b7280; font-weight: 700; }
.tour-focus { outline: 3px solid #60a5fa; outline-offset: 4px; border-radius: .75rem; position: relative; z-index: 1001; }

/* Modal overlay (the tour; the same pattern the CMS uses) */
.umodal {
  position: fixed; inset: 0; z-index: 10001; background: rgba(17,19,26,.9);
  backdrop-filter: blur(4px); display: flex; align-items: center;
  justify-content: center; padding: 1rem;
}
.umodal.hidden { display: none; }
.modal-close { background: none; border: none; color: #9ca3af; font-size: 1rem; cursor: pointer; }
.modal-close:hover { color: #fff; }

.fc-tip {
  position: absolute; pointer-events: none; z-index: 6; white-space: nowrap;
  background: rgba(10,12,16,.96); border: 1px solid rgba(96,165,250,.55);
  border-radius: .5rem; padding: .4rem .55rem; font-size: .72rem; color: #e5e7eb;
  box-shadow: 0 10px 24px rgba(0,0,0,.55);
}
.fc-bar { cursor: crosshair; }
.fc-bar:hover { stroke: #fff; stroke-width: 1; }

/* Guided tour — bottom sheet with a progress bar and a soft spotlight. */
.tour-focus { outline: none !important; box-shadow: 0 0 0 3px rgba(96,165,250,.95), 0 0 0 9999px rgba(8,10,14,.55); border-radius: .75rem; position: relative; z-index: 1001; }


/* Interactive cards */
.tile.clickable, .subpanel.clickable { cursor: pointer; transition: background .15s, border-color .15s; }
.tile.clickable:hover { background: rgba(96,165,250,.12); border-color: rgba(96,165,250,.4); }
.subpanel.clickable { border-radius: .6rem; }
.subpanel.clickable:hover { background: rgba(96,165,250,.09); }

/* Forecast: compact chart + date list */
.fc-chart svg { max-height: 260px; }
.fc-table { width: 100%; border-collapse: collapse; margin-top: .7rem; font-size: .75rem; }
.fc-table th { text-align: left; color: #9ca3af; font-weight: 700; padding: .35rem .5rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.fc-table td { padding: .32rem .5rem; color: #e5e7eb; border-bottom: 1px solid rgba(255,255,255,.05); }
.fc-table tr.fc-row { cursor: pointer; }
.fc-table tr.fc-row:hover { background: rgba(96,165,250,.1); }

/* Tour — centered card like new kwizi */
.umodal.tour { align-items: flex-start; justify-content: flex-start; background: transparent; backdrop-filter: none; }
.tour-dim { position: absolute; inset: 0; background: rgba(8,10,14,.62); }
.tour-dim[hidden] { display: none; }
.tour-card {
  position: absolute; width: 26rem; max-width: calc(100vw - 2rem); border-radius: 1rem;
  background: var(--surface); border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 30px 70px rgba(0,0,0,.65); padding: 1.4rem 1.4rem 1rem;
}
.tour-top { display: flex; gap: .85rem; align-items: flex-start; margin-bottom: .8rem; }
.tour-icon {
  width: 2.8rem; height: 2.8rem; border-radius: .7rem; flex-shrink: 0;
  background: rgba(96,165,250,.12); display: flex; align-items: center;
  justify-content: center; font-size: 1.15rem; color: #93c5fd;
}
.tour-kicker { font-size: .65rem; font-weight: 800; letter-spacing: .08em; color: #60a5fa; text-transform: uppercase; margin: 0 0 .3rem; }
.tour-body { padding: 0; }
.tour-body h3 { font-size: 1.05rem; margin: 0; }
.tour-body p { margin: .6rem 0 0; font-size: .85rem; color: #cbd5e1; line-height: 1.6; }
.tour-dots { display: flex; gap: .3rem; margin: 1rem 0 .9rem; }
.tour-dot { width: .42rem; height: .42rem; border-radius: 9999px; background: rgba(255,255,255,.18); }
.tour-dot.on { background: #60a5fa; }
.tour-actions { display: flex; gap: .5rem; justify-content: flex-end; }


/* Tour buttons — clean, like the reference app */
.tour-actions .btn {
  border-radius: .6rem; padding: .5rem .95rem; font-size: .8rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06);
  color: #e5e7eb; cursor: pointer; transition: background .15s, border-color .15s;
}
.tour-actions .btn:hover { background: rgba(255,255,255,.13); }
.tour-actions .btn.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.tour-actions .btn.primary:hover { background: #1d4ed8; }
.tour-actions .btn[hidden] { display: none; }
