/* q2w-mapcss v0.1.0 | MIT License | https://github.com/dhanyyudi/q2w-mapcss */
/* ============================================================
   q2w design tokens
   Brand-neutral framework for qgis2web (Leaflet) exports.
   All colors expressed as CSS custom properties so themes
   can override at :root or [data-theme="..."].
   ============================================================ */

:root {
  /* Type ------------------------------------------------------ */
  --q2w-font-sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --q2w-font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --q2w-font-display: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Neutrals (slate-tinted, matches existing redesign) -------- */
  --q2w-neutral-0:   #ffffff;
  --q2w-neutral-50:  #f7f8fa;
  --q2w-neutral-100: #eef0f3;
  --q2w-neutral-200: #dde1e7;
  --q2w-neutral-300: #c2c8d2;
  --q2w-neutral-400: #8a93a3;
  --q2w-neutral-500: #5b6577;
  --q2w-neutral-600: #3f4a5c;
  --q2w-neutral-700: #2a3344;
  --q2w-neutral-800: #1b2230;
  --q2w-neutral-900: #0f1520;

  /* Semantic surfaces ---------------------------------------- */
  --q2w-surface:        var(--q2w-neutral-0);
  --q2w-surface-soft:   var(--q2w-neutral-50);
  --q2w-surface-sunken: var(--q2w-neutral-100);
  --q2w-border:         var(--q2w-neutral-200);
  --q2w-border-strong:  var(--q2w-neutral-300);
  --q2w-text:           var(--q2w-neutral-800);
  --q2w-text-muted:     var(--q2w-neutral-500);
  --q2w-text-faint:     var(--q2w-neutral-400);

  /* Accent (teal — overridable per theme) -------------------- */
  --q2w-accent:        #0f7a78;
  --q2w-accent-hover:  #0c615f;
  --q2w-accent-soft:   #e6f3f2;
  --q2w-accent-fg:     #ffffff;

  /* Status --------------------------------------------------- */
  --q2w-success: #1f8a4c;
  --q2w-warning: #c98a14;
  --q2w-danger:  #c4452f;
  --q2w-info:    #2769c4;

  /* Status soft variants ------------------------------------ */
  --q2w-success-soft: #e6f5ec;
  --q2w-warning-soft: #fef4e0;
  --q2w-danger-soft:  #faeae7;
  --q2w-info-soft:    #e5eefa;

  /* Radii ---------------------------------------------------- */
  --q2w-radius-xs: 4px;
  --q2w-radius-sm: 6px;
  --q2w-radius-md: 10px;
  --q2w-radius-lg: 14px;
  --q2w-radius-xl: 20px;
  --q2w-radius-full: 9999px;

  /* Shadows -------------------------------------------------- */
  --q2w-shadow-xs: 0 1px 2px rgba(15, 21, 32, 0.06);
  --q2w-shadow-sm: 0 2px 6px rgba(15, 21, 32, 0.08);
  --q2w-shadow-md: 0 6px 18px rgba(15, 21, 32, 0.10), 0 1px 3px rgba(15, 21, 32, 0.06);
  --q2w-shadow-lg: 0 18px 40px rgba(15, 21, 32, 0.16), 0 2px 6px rgba(15, 21, 32, 0.08);

  /* Spacing scale ------------------------------------------- */
  --q2w-space-1: 4px;
  --q2w-space-2: 8px;
  --q2w-space-3: 12px;
  --q2w-space-4: 16px;
  --q2w-space-5: 20px;
  --q2w-space-6: 24px;
  --q2w-space-8: 32px;

  /* Z-index scale ------------------------------------------- */
  --q2w-z-map:     0;
  --q2w-z-ground:  100;
  --q2w-z-control: 400;
  --q2w-z-panel:   500;
  --q2w-z-overlay: 700;
  --q2w-z-modal:   900;
  --q2w-z-toast:   1000;

  /* Motion -------------------------------------------------- */
  --q2w-duration-fast:   100ms;
  --q2w-duration-normal: 180ms;
  --q2w-duration-slow:   300ms;
  --q2w-ease:            cubic-bezier(0.4, 0, 0.2, 1);
  --q2w-ease-out:        cubic-bezier(0, 0, 0.2, 1);

  /* Layout --------------------------------------------------- */
  --q2w-header-h: 56px;
  --q2w-footer-h: 28px;
  --q2w-panel-w:  280px;

  /* Choropleth defaults (sequential warm — matches example) -- */
  --q2w-seq-1: #fff5d6;
  --q2w-seq-2: #fde29a;
  --q2w-seq-3: #fbb04c;
  --q2w-seq-4: #f47a2b;
  --q2w-seq-5: #d83a2c;
  --q2w-seq-6: #8a1d2a;

  /* Diverging ------------------------------------------------ */
  --q2w-div-1: #2c7bb6;
  --q2w-div-2: #abd9e9;
  --q2w-div-3: #ffffbf;
  --q2w-div-4: #fdae61;
  --q2w-div-5: #d7191c;

  /* Qualitative --------------------------------------------- */
  --q2w-qual-1: #2a6f97;
  --q2w-qual-2: #d6802b;
  --q2w-qual-3: #4a8c3b;
  --q2w-qual-4: #b34a6c;
  --q2w-qual-5: #6b4ea0;
  --q2w-qual-6: #c4a23b;

  /* Sequential cool (blues — population, elevation) --------- */
  --q2w-seq-cool-1: #f7fbff;
  --q2w-seq-cool-2: #c6dbef;
  --q2w-seq-cool-3: #6baed6;
  --q2w-seq-cool-4: #2171b5;
  --q2w-seq-cool-5: #08306b;

  /* Sequential green (vegetation, land cover) ---------------- */
  --q2w-seq-green-1: #f7fcf5;
  --q2w-seq-green-2: #c7e9c0;
  --q2w-seq-green-3: #74c476;
  --q2w-seq-green-4: #238b45;
  --q2w-seq-green-5: #00441b;

  /* Sequential purple (density, risk) ----------------------- */
  --q2w-seq-purple-1: #fcfbfd;
  --q2w-seq-purple-2: #dadaeb;
  --q2w-seq-purple-3: #9e9ac8;
  --q2w-seq-purple-4: #6a51a3;
  --q2w-seq-purple-5: #3f007d;

  /* Diverging brown-teal (change, balance) ------------------ */
  --q2w-div-bt-1: #543005;
  --q2w-div-bt-2: #bf812d;
  --q2w-div-bt-3: #f6e8c3;
  --q2w-div-bt-4: #c7eae5;
  --q2w-div-bt-5: #35978f;
  --q2w-div-bt-6: #003c30;

  /* Qualitative extended (categories 7–9) ------------------- */
  --q2w-qual-7: #4a9e8a;
  --q2w-qual-8: #9e4a6b;
  --q2w-qual-9: #7a9e4a;
}

/* ============================================================
   Dark mode
   ============================================================ */
[data-theme="dark"] {
  --q2w-neutral-0:   #0f1520;
  --q2w-neutral-50:  #141b29;
  --q2w-neutral-100: #1b2230;
  --q2w-neutral-200: #2a3344;
  --q2w-neutral-300: #3f4a5c;
  --q2w-neutral-400: #5b6577;
  --q2w-neutral-500: #8a93a3;
  --q2w-neutral-600: #c2c8d2;
  --q2w-neutral-700: #dde1e7;
  --q2w-neutral-800: #eef0f3;
  --q2w-neutral-900: #f7f8fa;

  --q2w-surface:        #141b29;
  --q2w-surface-soft:   #1b2230;
  --q2w-surface-sunken: #0f1520;
  --q2w-border:         #2a3344;
  --q2w-border-strong:  #3f4a5c;
  --q2w-text:           #eef0f3;
  --q2w-text-muted:     #8a93a3;
  --q2w-text-faint:     #5b6577;

  --q2w-accent:       #2dd4d0;
  --q2w-accent-hover: #5ee5e2;
  --q2w-accent-soft:  rgba(45, 212, 208, 0.14);
  --q2w-accent-fg:    #0f1520;

  --q2w-shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.3);
  --q2w-shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);

  /* Status — adjusted for dark backgrounds */
  --q2w-success: #34c675;
  --q2w-warning: #f0a829;
  --q2w-danger:  #f05a44;
  --q2w-info:    #4d8ff0;

  --q2w-success-soft: rgba(52, 198, 117, 0.15);
  --q2w-warning-soft: rgba(240, 168, 41, 0.15);
  --q2w-danger-soft:  rgba(240, 90, 68, 0.15);
  --q2w-info-soft:    rgba(77, 143, 240, 0.15);
}

/* ============================================================
   Preset themes (recolor accent + tone)
   ============================================================ */
[data-theme="ocean"] {
  --q2w-accent:         #1d6fc4;
  --q2w-accent-hover:   #185a9f;
  --q2w-accent-soft:    #e3eefa;
  --q2w-surface:        #f5f8fc;
  --q2w-surface-soft:   #eaf2fa;
  --q2w-surface-sunken: #ddeaf5;
  --q2w-border:         #c8daf0;
}
[data-theme="forest"] {
  --q2w-accent:         #2f7d4a;
  --q2w-accent-hover:   #25633a;
  --q2w-accent-soft:    #e4f1e8;
  --q2w-surface:        #f6faf7;
  --q2w-surface-soft:   #edf6f0;
  --q2w-surface-sunken: #dff0e5;
  --q2w-border:         #c6e0ce;
}
[data-theme="sunset"] {
  --q2w-accent:         #d8632a;
  --q2w-accent-hover:   #b04f1f;
  --q2w-accent-soft:    #fbece2;
  --q2w-surface:        #fdfaf7;
  --q2w-surface-soft:   #faf3ec;
  --q2w-surface-sunken: #f5e9da;
  --q2w-border:         #eedcc8;
}
[data-theme="slate"] {
  --q2w-accent:         #3f4a5c;
  --q2w-accent-hover:   #2a3344;
  --q2w-accent-soft:    #eef0f3;
  --q2w-surface:        #f7f8fa;
  --q2w-surface-soft:   #f0f2f5;
  --q2w-surface-sunken: #e8eaee;
  --q2w-border:         #d0d5de;
}

/* ============================================================
   Auto dark mode — follows OS preference
   unless data-theme is explicitly set
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --q2w-neutral-0:   #0f1520;
    --q2w-neutral-50:  #141b29;
    --q2w-neutral-100: #1b2230;
    --q2w-neutral-200: #2a3344;
    --q2w-neutral-300: #3f4a5c;
    --q2w-neutral-400: #5b6577;
    --q2w-neutral-500: #8a93a3;
    --q2w-neutral-600: #c2c8d2;
    --q2w-neutral-700: #dde1e7;
    --q2w-neutral-800: #eef0f3;
    --q2w-neutral-900: #f7f8fa;

    --q2w-surface:        #141b29;
    --q2w-surface-soft:   #1b2230;
    --q2w-surface-sunken: #0f1520;
    --q2w-border:         #2a3344;
    --q2w-border-strong:  #3f4a5c;
    --q2w-text:           #eef0f3;
    --q2w-text-muted:     #8a93a3;
    --q2w-text-faint:     #5b6577;

    --q2w-accent:       #2dd4d0;
    --q2w-accent-hover: #5ee5e2;
    --q2w-accent-soft:  rgba(45, 212, 208, 0.14);
    --q2w-accent-fg:    #0f1520;

    --q2w-shadow-md: 0 6px 18px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.3);
    --q2w-shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35);

    --q2w-success: #34c675;
    --q2w-warning: #f0a829;
    --q2w-danger:  #f05a44;
    --q2w-info:    #4d8ff0;

    --q2w-success-soft: rgba(52, 198, 117, 0.15);
    --q2w-warning-soft: rgba(240, 168, 41, 0.15);
    --q2w-danger-soft:  rgba(240, 90, 68, 0.15);
    --q2w-info-soft:    rgba(77, 143, 240, 0.15);
  }
}


/* ============================================================
   q2w component styles
   Pre-built classes; in production these would be authored with
   Tailwind @apply. Here they're plain CSS that mirrors what the
   compiled output would be.
   ============================================================ */

* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: var(--q2w-font-sans);
  color: var(--q2w-text);
  background: var(--q2w-surface);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Map base ================================================== */
.q2w-map {
  position: absolute;
  inset: 0;
  background: var(--q2w-surface-sunken);
}

/* ---------- Header ---------------------------------------- */
.q2w-header {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: var(--q2w-header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-sm);
  z-index: var(--q2w-z-panel);
}
.q2w-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.q2w-header__logo {
  width: 32px; height: 32px;
  border-radius: var(--q2w-radius-sm);
  background: var(--q2w-accent);
  color: var(--q2w-accent-fg);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  flex: none;
}
.q2w-header__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--q2w-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q2w-header__sub {
  font-size: 12px;
  color: var(--q2w-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q2w-header__divider {
  width: 1px; height: 24px;
  background: var(--q2w-border);
}
.q2w-header__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Header variants */
.q2w-header--bar {            /* full-width bar, no float */
  top: 0; left: 0; right: 0;
  border-radius: 0;
  border-left: 0; border-right: 0; border-top: 0;
  box-shadow: var(--q2w-shadow-xs);
}
.q2w-header--minimal {
  background: transparent;
  border: 0;
  box-shadow: none;
}
.q2w-header--minimal .q2w-header__title { background: var(--q2w-surface); padding: 6px 12px; border-radius: var(--q2w-radius-sm); box-shadow: var(--q2w-shadow-sm); }

.q2w-header--expressive {
  border-radius: var(--q2w-radius-xl);
  border: 0;
  background: linear-gradient(180deg, var(--q2w-surface), var(--q2w-surface-soft));
  box-shadow: var(--q2w-shadow-md);
}
.q2w-header--expressive .q2w-header__logo { border-radius: 50%; }

.q2w-header--technical {
  font-family: var(--q2w-font-mono);
  border-radius: var(--q2w-radius-xs);
  background: var(--q2w-neutral-900);
  border-color: var(--q2w-neutral-700);
  color: var(--q2w-neutral-50);
  height: 44px;
}
.q2w-header--technical .q2w-header__title { color: var(--q2w-neutral-50); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.q2w-header--technical .q2w-header__sub { color: var(--q2w-neutral-400); font-size: 11px; }
.q2w-header--technical .q2w-header__logo { background: var(--q2w-accent); border-radius: var(--q2w-radius-xs); }

/* ---------- Footer ---------------------------------------- */
.q2w-footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--q2w-footer-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--q2w-border);
  font-size: 11px;
  color: var(--q2w-text-muted);
  z-index: var(--q2w-z-panel);
}
[data-theme="dark"] .q2w-footer { background: rgba(20, 27, 41, 0.92); }
.q2w-footer__group { display: flex; align-items: center; gap: 8px; }
.q2w-footer__group + .q2w-footer__group::before { content: ""; width: 1px; height: 12px; background: var(--q2w-border); }
.q2w-footer__push { margin-left: auto; }
.q2w-footer__coord { font-family: var(--q2w-font-mono); font-size: 10.5px; }

/* Footer variant: scale bar */
.q2w-scalebar { display: inline-flex; align-items: flex-end; gap: 6px; font-family: var(--q2w-font-mono); font-size: 10px; color: var(--q2w-text-muted); }
.q2w-scalebar__bar {
  height: 8px; width: 80px;
  border: 1px solid var(--q2w-text-muted);
  border-top: 0;
  position: relative;
}
.q2w-scalebar__bar::before {
  content: ""; position: absolute;
  left: 0; right: 50%; bottom: -1px; height: 4px;
  background: var(--q2w-text);
}

/* ---------- Buttons --------------------------------------- */
.q2w-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--q2w-radius-sm);
  border: 1px solid var(--q2w-border);
  background: var(--q2w-surface);
  color: var(--q2w-text);
  font-size: 12px; font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--q2w-duration-fast) var(--q2w-ease), border-color var(--q2w-duration-fast) var(--q2w-ease);
}
.q2w-btn:hover { background: var(--q2w-surface-soft); border-color: var(--q2w-border-strong); }
.q2w-btn--primary {
  background: var(--q2w-accent);
  color: var(--q2w-accent-fg);
  border-color: transparent;
}
.q2w-btn--primary:hover { background: var(--q2w-accent-hover); }
.q2w-btn--ghost { border-color: transparent; background: transparent; }
.q2w-btn--ghost:hover { background: var(--q2w-surface-soft); }
.q2w-btn--icon { padding: 6px; width: 30px; height: 30px; justify-content: center; }
.q2w-btn--pill { border-radius: var(--q2w-radius-full); padding: 6px 14px; }

/* Button states ------------------------------------------- */
.q2w-btn:disabled,
.q2w-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.q2w-btn--loading {
  position: relative;
  cursor: wait;
  color: transparent !important;
  pointer-events: none;
}
.q2w-btn--loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--q2w-text);
  border-top-color: transparent;
  border-radius: 50%;
  animation: q2w-spin 0.6s linear infinite;
}
.q2w-btn--primary.q2w-btn--loading::after {
  border-color: var(--q2w-accent-fg);
  border-top-color: transparent;
}

/* ---------- Map control (zoom, etc) ----------------------- */
.q2w-control {
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  box-shadow: var(--q2w-shadow-sm);
  overflow: hidden;
}
.q2w-control__btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 0;
  background: transparent;
  color: var(--q2w-text);
  cursor: pointer;
  border-bottom: 1px solid var(--q2w-border);
}
.q2w-control__btn:last-child { border-bottom: 0; }
.q2w-control__btn:hover { background: var(--q2w-surface-soft); color: var(--q2w-accent); }
.q2w-control--rounded { border-radius: var(--q2w-radius-full); }
.q2w-control--rounded .q2w-control__btn { border-bottom: 0; border-right: 1px solid var(--q2w-border); }
.q2w-control--rounded .q2w-control__btn:last-child { border-right: 0; }

.q2w-toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- Layer panel ----------------------------------- */
.q2w-panel {
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-md);
  width: var(--q2w-panel-w);
  overflow: hidden;
  font-size: 12px;
}
.q2w-panel__header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--q2w-border);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--q2w-text-muted);
}
.q2w-panel__header .q2w-panel__close { margin-left: auto; }
.q2w-panel__body { padding: 8px 12px 12px; max-height: 480px; overflow: auto; }
.q2w-panel__section { padding: 6px 0; }
.q2w-panel__section + .q2w-panel__section { border-top: 1px dashed var(--q2w-border); }
.q2w-panel__section-title {
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--q2w-text-faint);
  margin: 6px 0 4px;
}

/* Layer row */
.q2w-layer {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--q2w-text);
}
.q2w-layer__check {
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--q2w-border-strong);
  display: grid; place-items: center;
  flex: none;
  background: var(--q2w-surface);
}
.q2w-layer__check--on {
  background: var(--q2w-accent);
  border-color: var(--q2w-accent);
  color: var(--q2w-accent-fg);
}
.q2w-layer__name { flex: 1; }
.q2w-layer__opacity { color: var(--q2w-text-faint); font-family: var(--q2w-font-mono); font-size: 10px; }

/* Layer children (sub-symbology rows) */
.q2w-sublayer {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0 2px 22px;
  font-size: 11.5px;
  color: var(--q2w-text-muted);
}

/* ---------- Legend ---------------------------------------- */
.q2w-legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 11.5px; }
.q2w-legend-swatch { width: 14px; height: 12px; border-radius: 2px; flex: none; }
.q2w-legend-line { width: 18px; height: 0; border-top: 2px solid currentColor; flex: none; }
.q2w-legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.q2w-legend-label { font-family: var(--q2w-font-mono); font-size: 10.5px; color: var(--q2w-text-muted); }

/* Gradient legend */
.q2w-grad {
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    var(--q2w-seq-1), var(--q2w-seq-2), var(--q2w-seq-3),
    var(--q2w-seq-4), var(--q2w-seq-5), var(--q2w-seq-6));
}
.q2w-grad__labels { display: flex; justify-content: space-between; font-family: var(--q2w-font-mono); font-size: 10px; color: var(--q2w-text-muted); margin-top: 4px; }

/* Floating mini-legend */
.q2w-minilegend {
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  box-shadow: var(--q2w-shadow-sm);
  padding: 8px 10px;
  width: 200px;
}
.q2w-minilegend__title { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--q2w-text-muted); margin-bottom: 6px; }

/* ---------- Popup ----------------------------------------- */
.q2w-popup {
  background: var(--q2w-surface);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-lg);
  width: 280px;
  overflow: hidden;
  font-size: 12.5px;
}
.q2w-popup__header {
  background: var(--q2w-accent);
  color: var(--q2w-accent-fg);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 8px;
}
.q2w-popup__title { font-weight: 600; font-size: 13px; }
.q2w-popup__sub { font-size: 11px; opacity: 0.8; }
.q2w-popup__close {
  margin-left: auto; background: transparent; color: inherit; border: 0;
  width: 22px; height: 22px; border-radius: 4px; cursor: pointer;
  display: grid; place-items: center;
}
.q2w-popup__close:hover { background: rgba(255, 255, 255, 0.15); }
.q2w-popup__body { padding: 4px 0; }

/* Attribute row */
.q2w-attr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--q2w-border);
  align-items: center;
}
.q2w-attr:last-child { border-bottom: 0; }
.q2w-attr__key {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--q2w-text-faint);
  font-weight: 500;
}
.q2w-attr__val {
  font-size: 12.5px;
  color: var(--q2w-text);
  font-family: var(--q2w-font-mono);
  text-align: right;
}

/* Tabs */
.q2w-tabs { display: flex; border-bottom: 1px solid var(--q2w-border); padding: 0 4px; }
.q2w-tab {
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--q2w-text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
}
.q2w-tab--active { color: var(--q2w-accent); border-bottom-color: var(--q2w-accent); }

/* Rich popup with image */
.q2w-popup__media {
  width: 100%; height: 120px;
  background:
    repeating-linear-gradient(45deg,
      var(--q2w-surface-sunken) 0 8px,
      var(--q2w-surface-soft) 8px 16px);
  display: grid; place-items: center;
  font-family: var(--q2w-font-mono);
  font-size: 10px;
  color: var(--q2w-text-faint);
}

/* Popup actions */
.q2w-popup__actions {
  display: flex; gap: 6px;
  padding: 10px 12px;
  background: var(--q2w-surface-soft);
  border-top: 1px solid var(--q2w-border);
}

/* Popup variants */
.q2w-popup--minimal { box-shadow: var(--q2w-shadow-md); }
.q2w-popup--minimal .q2w-popup__header { background: var(--q2w-surface); color: var(--q2w-text); border-bottom: 1px solid var(--q2w-border); }
.q2w-popup--expressive { border-radius: var(--q2w-radius-xl); }
.q2w-popup--expressive .q2w-popup__header { border-radius: var(--q2w-radius-xl) var(--q2w-radius-xl) 0 0; background: linear-gradient(135deg, var(--q2w-accent), var(--q2w-accent-hover)); }
.q2w-popup--technical { border-radius: var(--q2w-radius-xs); border: 1px solid var(--q2w-border); }
.q2w-popup--technical .q2w-popup__header { background: var(--q2w-neutral-900); color: var(--q2w-neutral-50); font-family: var(--q2w-font-mono); }
.q2w-popup--technical .q2w-attr__val { font-size: 11.5px; }

/* ---------- Welcome modal --------------------------------- */
.q2w-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 21, 32, 0.32);
  display: grid; place-items: center;
  z-index: var(--q2w-z-modal);
}
.q2w-modal {
  width: 420px;
  background: var(--q2w-surface);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-lg);
  overflow: hidden;
}
.q2w-modal__header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px 6px;
}
.q2w-modal__close { margin-left: auto; }
.q2w-modal__title { font-size: 16px; font-weight: 600; }
.q2w-modal__sub { font-size: 12px; color: var(--q2w-text-muted); }
.q2w-modal__body { padding: 8px 20px 16px; font-size: 12.5px; line-height: 1.55; }
.q2w-modal__body p { margin: 0 0 10px; }
.q2w-modal__body p strong { color: var(--q2w-text); }
.q2w-modal__footer { padding: 12px 20px 16px; }
.q2w-modal__footer .q2w-btn--primary { width: 100%; justify-content: center; }

/* ---------- Sidebar (info panel) -------------------------- */
.q2w-sidebar {
  position: absolute;
  top: 12px; bottom: 36px; left: 12px;
  width: 320px;
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-md);
  display: flex; flex-direction: column;
  z-index: var(--q2w-z-panel);
  overflow: hidden;
}
.q2w-sidebar__header { padding: 14px 16px; border-bottom: 1px solid var(--q2w-border); }
.q2w-sidebar__title { font-size: 14px; font-weight: 600; }
.q2w-sidebar__sub { font-size: 11.5px; color: var(--q2w-text-muted); margin-top: 2px; }
.q2w-sidebar__body { padding: 12px 16px; overflow: auto; flex: 1; }

/* ---------- Search ---------------------------------------- */
.q2w-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  box-shadow: var(--q2w-shadow-sm);
  padding: 6px 10px;
  width: 280px;
}
.q2w-search input {
  border: 0; background: transparent; outline: none;
  flex: 1; font-size: 12.5px;
  color: var(--q2w-text);
  font-family: inherit;
}
.q2w-search input::placeholder { color: var(--q2w-text-faint); }
.q2w-search__icon { color: var(--q2w-text-muted); }
.q2w-search__results {
  margin-top: 4px;
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  box-shadow: var(--q2w-shadow-md);
  padding: 4px;
}
.q2w-search__item { padding: 6px 10px; border-radius: var(--q2w-radius-xs); cursor: pointer; font-size: 12px; }
.q2w-search__item:hover { background: var(--q2w-surface-soft); }
.q2w-search__item small { color: var(--q2w-text-faint); display: block; }

/* ---------- Tooltip --------------------------------------- */
.q2w-tooltip {
  background: var(--q2w-neutral-900);
  color: var(--q2w-neutral-0);
  padding: 5px 8px;
  border-radius: var(--q2w-radius-xs);
  font-size: 11px;
  font-family: var(--q2w-font-mono);
  box-shadow: var(--q2w-shadow-sm);
  white-space: nowrap;
}
[data-theme="dark"] .q2w-tooltip { background: var(--q2w-neutral-50); color: var(--q2w-neutral-900); }

/* ---------- Measure --------------------------------------- */
.q2w-measure {
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-md);
  width: 220px;
  font-size: 12px;
  overflow: hidden;
}
.q2w-measure__header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--q2w-border); }
.q2w-measure__title { font-weight: 600; font-size: 12px; }
.q2w-measure__modes { display: flex; padding: 8px; gap: 4px; }
.q2w-measure__mode {
  flex: 1; padding: 6px;
  border-radius: var(--q2w-radius-xs);
  border: 1px solid var(--q2w-border);
  background: var(--q2w-surface);
  font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
}
.q2w-measure__mode--active { background: var(--q2w-accent); border-color: var(--q2w-accent); color: var(--q2w-accent-fg); }
.q2w-measure__readout { padding: 8px 12px 12px; font-family: var(--q2w-font-mono); }
.q2w-measure__readout-row { display: flex; justify-content: space-between; font-size: 11px; padding: 3px 0; color: var(--q2w-text-muted); }
.q2w-measure__readout-row strong { color: var(--q2w-text); font-size: 12.5px; }

/* ---------- Basemap --------------------------------------- */
.q2w-basemap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.q2w-basemap {
  border: 1.5px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--q2w-surface-sunken);
  position: relative;
}
.q2w-basemap--active { border-color: var(--q2w-accent); box-shadow: 0 0 0 2px var(--q2w-accent-soft); }
.q2w-basemap__thumb { height: 56px; }
.q2w-basemap__label { padding: 4px 8px; font-size: 11px; font-weight: 500; background: var(--q2w-surface); }

/* swatch backgrounds for thumbs */
.q2w-bm-streets { background: linear-gradient(135deg, #e8e2d4 0%, #d6cdb6 100%); position: relative; }
.q2w-bm-streets::before, .q2w-bm-streets::after {
  content: ""; position: absolute; background: #fff;
}
.q2w-bm-streets::before { left: 10%; top: 30%; right: 5%; height: 3px; transform: rotate(8deg); }
.q2w-bm-streets::after  { left: 20%; top: 60%; right: 15%; height: 2px; transform: rotate(-12deg); }

.q2w-bm-satellite { background: linear-gradient(135deg, #2a3f1f 0%, #4a6936 50%, #1f2e15 100%); }
.q2w-bm-dark { background: #1b2230; }
.q2w-bm-light { background: #f5f5f0; border: 1px solid var(--q2w-border); }
.q2w-bm-terrain { background: linear-gradient(135deg, #b3a07a 0%, #786850 100%); }
.q2w-bm-voyager { background: linear-gradient(135deg, #f1eee8 0%, #d9d2c3 100%); }

/* ---------- Loading --------------------------------------- */
@keyframes q2w-spin { to { transform: rotate(360deg); } }
@keyframes q2w-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes q2w-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.q2w-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--q2w-border);
  border-top-color: var(--q2w-accent);
  border-radius: 50%;
  animation: q2w-spin 0.8s linear infinite;
}
.q2w-loadbar {
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  padding: 8px 12px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  box-shadow: var(--q2w-shadow-sm);
}
.q2w-skeleton {
  background: linear-gradient(90deg,
    var(--q2w-surface-sunken) 0%,
    var(--q2w-surface-soft) 50%,
    var(--q2w-surface-sunken) 100%);
  background-size: 200% 100%;
  border-radius: var(--q2w-radius-xs);
  animation: q2w-shimmer 1.6s ease-in-out infinite;
}

/* ---------- Print --------------------------------------- */
.q2w-print {
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-md);
  width: 240px;
  font-size: 12px;
  overflow: hidden;
}
.q2w-print__header { padding: 10px 12px; border-bottom: 1px solid var(--q2w-border); font-weight: 600; }
.q2w-print__row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; font-size: 11.5px; border-bottom: 1px solid var(--q2w-border); }
.q2w-print__row:last-of-type { border-bottom: 0; }
.q2w-print__row select { font-family: inherit; font-size: 11px; padding: 3px 6px; border-radius: var(--q2w-radius-xs); border: 1px solid var(--q2w-border); background: var(--q2w-surface); color: var(--q2w-text); }
.q2w-print__footer { padding: 10px 12px; }
.q2w-print__footer .q2w-btn--primary { width: 100%; justify-content: center; }

/* ---------- Bottom sheet (mobile) ------------------------- */
.q2w-sheet {
  position: absolute;
  left: 8px; right: 8px; bottom: 8px;
  background: var(--q2w-surface);
  border-radius: var(--q2w-radius-lg);
  box-shadow: var(--q2w-shadow-lg);
  padding: 8px 0 12px;
  z-index: var(--q2w-z-overlay);
}
.q2w-sheet__handle {
  width: 36px; height: 4px;
  background: var(--q2w-border-strong);
  border-radius: 2px;
  margin: 4px auto 8px;
}
.q2w-sheet__title { padding: 0 16px; font-weight: 600; font-size: 14px; }
.q2w-sheet__body { padding: 8px 16px; font-size: 12.5px; }

/* ---------- Marker placeholders --------------------------- */
.q2w-marker {
  width: 24px; height: 24px;
  border-radius: 50% 50% 50% 0;
  background: var(--q2w-accent);
  transform: rotate(-45deg);
  box-shadow: var(--q2w-shadow-sm);
  border: 2px solid var(--q2w-surface);
}
.q2w-cluster {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--q2w-accent);
  color: var(--q2w-accent-fg);
  font-weight: 600;
  font-size: 12px;
  box-shadow: 0 0 0 6px color-mix(in oklch, var(--q2w-accent) 30%, transparent), var(--q2w-shadow-sm);
}

/* ============================================================
   Phase 2 components
   ============================================================ */

/* Slider (used in opacity, etc.) */
.q2w-slider { display: flex; align-items: center; gap: 8px; }
.q2w-slider__track {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--q2w-border);
  position: relative;
}
.q2w-slider__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--q2w-accent);
  border-radius: 2px;
}
.q2w-slider__thumb {
  position: absolute; top: 50%;
  width: 12px; height: 12px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--q2w-surface);
  border: 2px solid var(--q2w-accent);
  box-shadow: var(--q2w-shadow-sm);
}
.q2w-slider__val { font-family: var(--q2w-font-mono); font-size: 10px; color: var(--q2w-text-muted); width: 28px; text-align: right; }

/* Layer with controls expanded */
.q2w-layer__handle { color: var(--q2w-text-faint); cursor: grab; flex: none; }
.q2w-layer__expand { padding: 8px 0 4px 24px; font-size: 11px; }

/* Share modal */
.q2w-share { width: 460px; }
.q2w-share__tabs { display: flex; padding: 0 20px; border-bottom: 1px solid var(--q2w-border); gap: 6px; }
.q2w-share__field {
  display: flex; align-items: center;
  background: var(--q2w-surface-soft);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  padding: 0 4px 0 12px;
  font-family: var(--q2w-font-mono);
  font-size: 11.5px;
}
.q2w-share__field input { flex: 1; border: 0; background: transparent; padding: 8px 0; outline: none; font-family: inherit; font-size: inherit; color: var(--q2w-text); min-width: 0; }
.q2w-share__field code { flex: 1; padding: 8px 0; overflow-x: auto; white-space: nowrap; color: var(--q2w-text); }

/* Compass */
.q2w-compass {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  box-shadow: var(--q2w-shadow-sm);
  position: relative;
  cursor: pointer;
}
.q2w-compass__needle {
  position: absolute; left: 50%; top: 50%;
  width: 4px; height: 30px;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, var(--q2w-danger) 0 50%, var(--q2w-text-muted) 50% 100%);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.q2w-compass__n { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-size: 9px; font-weight: 700; font-family: var(--q2w-font-mono); color: var(--q2w-text-muted); }

/* Inset minimap */
.q2w-minimap {
  width: 160px; height: 110px;
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  box-shadow: var(--q2w-shadow-sm);
  position: relative;
  overflow: hidden;
}
.q2w-minimap__tiles {
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 30% 30%, rgba(0,0,0,0.06), transparent 60%),
    linear-gradient(135deg, #c5d6c5 0%, #a9c1a8 50%, #7d9c7c 100%);
}
.q2w-minimap__tiles--dark {
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.06), transparent 60%),
    linear-gradient(135deg, #1f2e3a, #15212c);
}
.q2w-minimap__viewport {
  position: absolute;
  border: 1.5px solid var(--q2w-accent);
  background: rgba(15, 122, 120, 0.15);
  border-radius: 2px;
}

/* Quick-info card (between tooltip and popup) */
.q2w-quick {
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  box-shadow: var(--q2w-shadow-md);
  padding: 8px 10px;
  width: 200px;
  font-size: 12px;
}
.q2w-quick__title { font-weight: 600; font-size: 12.5px; margin-bottom: 2px; }
.q2w-quick__sub { font-size: 10.5px; color: var(--q2w-text-muted); margin-bottom: 6px; font-family: var(--q2w-font-mono); }
.q2w-quick__row { display: flex; justify-content: space-between; font-size: 11px; padding: 2px 0; }
.q2w-quick__row span:first-child { color: var(--q2w-text-faint); }
.q2w-quick__row span:last-child { font-family: var(--q2w-font-mono); }

/* Toast */
.q2w-toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-md);
  padding: 10px 12px 10px 10px;
  width: 320px;
  font-size: 12px;
}
.q2w-toast__icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex: none;
  background: var(--q2w-accent-soft);
  color: var(--q2w-accent);
  font-weight: 700;
}
.q2w-toast--success .q2w-toast__icon { background: var(--q2w-success-soft); color: var(--q2w-success); }
.q2w-toast--warning .q2w-toast__icon { background: var(--q2w-warning-soft); color: var(--q2w-warning); }
.q2w-toast--error .q2w-toast__icon { background: var(--q2w-danger-soft); color: var(--q2w-danger); }
.q2w-toast__title { font-weight: 600; }
.q2w-toast__msg { color: var(--q2w-text-muted); font-size: 11.5px; margin-top: 2px; }
.q2w-toast__close { margin-left: auto; align-self: flex-start; color: var(--q2w-text-faint); background: transparent; border: 0; cursor: pointer; }

/* Compare slider */
.q2w-compare {
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
}
.q2w-compare__divider {
  position: absolute; top: 0; bottom: 0;
  width: 2px;
  background: var(--q2w-surface);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 2px 8px rgba(0,0,0,0.25);
}
.q2w-compare__handle {
  position: absolute; top: 50%;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--q2w-surface);
  box-shadow: var(--q2w-shadow-md);
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  font-family: var(--q2w-font-mono);
  font-size: 11px;
  color: var(--q2w-text);
  border: 1px solid var(--q2w-border);
}
.q2w-compare__label {
  position: absolute;
  background: rgba(15, 21, 32, 0.85);
  color: #fff;
  font-size: 11px;
  font-family: var(--q2w-font-mono);
  padding: 4px 8px;
  border-radius: var(--q2w-radius-xs);
}

/* Drawing toolbar */
.q2w-draw {
  display: flex;
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-md);
  box-shadow: var(--q2w-shadow-sm);
  padding: 4px;
  gap: 2px;
}
.q2w-draw__btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--q2w-radius-xs);
  cursor: pointer;
  color: var(--q2w-text-muted);
  border: 0; background: transparent;
}
.q2w-draw__btn:hover { background: var(--q2w-surface-soft); color: var(--q2w-text); }
.q2w-draw__btn--active { background: var(--q2w-accent-soft); color: var(--q2w-accent); }
.q2w-draw__sep { width: 1px; background: var(--q2w-border); margin: 4px 2px; }

/* Coordinate go-to */
.q2w-goto {
  background: var(--q2w-surface);
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-sm);
  box-shadow: var(--q2w-shadow-sm);
  padding: 8px;
  display: flex; gap: 6px; align-items: center;
}
.q2w-goto input {
  width: 110px; padding: 5px 8px;
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-xs);
  font-family: var(--q2w-font-mono);
  font-size: 11px;
  background: var(--q2w-surface);
  color: var(--q2w-text);
}
.q2w-goto input:focus { outline: none; border-color: var(--q2w-accent); }

/* Filter / query builder */
.q2w-filter { width: 320px; }
.q2w-filter__rule {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px dashed var(--q2w-border);
}
.q2w-filter__rule select,
.q2w-filter__rule input {
  font-family: inherit; font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-xs);
  background: var(--q2w-surface);
  color: var(--q2w-text);
}
.q2w-filter__rule select { min-width: 0; }
.q2w-filter__op {
  font-family: var(--q2w-font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--q2w-text-faint);
  padding: 0 6px;
}

/* ============================================================
   Reduced motion — respect OS accessibility setting
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .q2w-spinner { animation: none; border-top-color: var(--q2w-accent); }
  .q2w-skeleton { animation: none; background: var(--q2w-surface-sunken); }
}

/* ============================================================
   Focus visible — keyboard navigation
   ============================================================ */
.q2w-btn:focus-visible,
.q2w-control__btn:focus-visible,
.q2w-popup__close:focus-visible,
.q2w-modal__close:focus-visible,
.q2w-layer__check:focus-visible {
  outline: 2px solid var(--q2w-accent);
  outline-offset: 2px;
}

.q2w-search input:focus-visible,
.q2w-goto input:focus-visible,
.q2w-filter input:focus-visible,
.q2w-filter select:focus-visible {
  outline: 2px solid var(--q2w-accent);
  outline-offset: 0;
}



/* ============================================================
   q2w-mapcss universal Leaflet adapter
   Styles common Leaflet DOM for plain Leaflet apps and qgis2web
   exports. Load after Leaflet/plugin CSS.
   ============================================================ */

:root {
  --q2w-map-bg: #d8dde2;
  --q2w-control-size: 32px;
}

html,
body {
  height: 100%;
}

.leaflet-container {
  font-family: var(--q2w-font-sans);
  color: var(--q2w-text);
  background: var(--q2w-map-bg);
}

.leaflet-container a {
  color: var(--q2w-accent);
}

.leaflet-control {
  border: 0 !important;
  border-radius: var(--q2w-radius-sm) !important;
  box-shadow: var(--q2w-shadow-sm) !important;
}

.leaflet-bar {
  border: 1px solid var(--q2w-border) !important;
  overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-touch .leaflet-bar a {
  width: var(--q2w-control-size) !important;
  height: var(--q2w-control-size) !important;
  line-height: var(--q2w-control-size) !important;
  background: var(--q2w-surface) !important;
  color: var(--q2w-text) !important;
  border-bottom: 1px solid var(--q2w-border) !important;
  font-family: var(--q2w-font-sans);
  font-size: 16px;
  font-weight: 600;
}

.leaflet-bar a:hover {
  background: var(--q2w-surface-soft) !important;
  color: var(--q2w-accent) !important;
}

.leaflet-bar a:last-child {
  border-bottom: 0 !important;
}

.leaflet-control-attribution {
  padding: 3px 8px !important;
  background: color-mix(in srgb, var(--q2w-surface) 92%, transparent) !important;
  border: 1px solid var(--q2w-border);
  border-radius: var(--q2w-radius-xs) 0 0 0;
  box-shadow: none !important;
  font-size: 10.5px;
  color: var(--q2w-text-muted);
}

.leaflet-control-scale-line {
  border-color: var(--q2w-text-muted) !important;
  border-top: 0 !important;
  color: var(--q2w-text-muted) !important;
  background: color-mix(in srgb, var(--q2w-surface) 86%, transparent) !important;
  font-family: var(--q2w-font-mono);
  font-size: 10px;
}

/* Layer tree control. */
.leaflet-control-layers {
  background: var(--q2w-surface) !important;
  border: 1px solid var(--q2w-border) !important;
  border-radius: var(--q2w-radius-md) !important;
  box-shadow: var(--q2w-shadow-md) !important;
  color: var(--q2w-text) !important;
  font-family: var(--q2w-font-sans);
  font-size: 12px;
  overflow: hidden;
  z-index: var(--q2w-z-panel) !important;
}

.leaflet-control-layers-toggle {
  width: 34px !important;
  height: 34px !important;
  background-color: var(--q2w-surface) !important;
  background-size: 16px 16px !important;
}

.leaflet-control-layers-expanded {
  width: var(--q2w-panel-w);
  padding: 0 !important;
}

.leaflet-control-layers-list {
  max-height: min(480px, calc(100vh - 140px));
  overflow: auto;
  padding: 10px 12px 12px;
}

.leaflet-layerstree-header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: var(--q2w-text);
}

.leaflet-layerstree-header input {
  accent-color: var(--q2w-accent);
}

.leaflet-layerstree-header-name {
  font-size: 12px;
}

.leaflet-layerstree-children {
  margin-left: 16px;
  padding-left: 8px;
  border-left: 1px dashed var(--q2w-border);
}

.leaflet-layerstree-closed,
.leaflet-layerstree-opened,
.leaflet-layerstree-header-space {
  color: var(--q2w-text-faint);
  font-family: var(--q2w-font-mono);
  font-size: 11px;
}

.leaflet-layerstree-expand-collapse {
  margin: 4px 0 8px;
  color: var(--q2w-accent);
  font-size: 11px;
  font-weight: 600;
}

.leaflet-popup-content-wrapper {
  padding: 0 !important;
  border-radius: var(--q2w-radius-md) !important;
  background: var(--q2w-surface) !important;
  color: var(--q2w-text) !important;
  box-shadow: var(--q2w-shadow-lg) !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: min(320px, calc(100vw - 48px)) !important;
  max-height: min(70vh, 520px);
  overflow: auto;
  font-family: var(--q2w-font-sans);
  font-size: 12.5px;
}

.leaflet-popup-content table {
  width: 100%;
  border-collapse: collapse;
}

.leaflet-popup-content th,
.leaflet-popup-content td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--q2w-border);
  vertical-align: top;
}

.leaflet-popup-content th {
  width: 42%;
  color: var(--q2w-text-faint);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

.leaflet-popup-content td {
  color: var(--q2w-text);
  text-align: right;
}

.leaflet-popup-content td[colspan="2"] {
  background: var(--q2w-accent);
  color: var(--q2w-accent-fg);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.leaflet-popup-content tr:last-child th,
.leaflet-popup-content tr:last-child td {
  border-bottom: 0;
}

.leaflet-popup-content td img,
.leaflet-popup-content.media img,
.leaflet-popup-content.media video {
  max-width: 100%;
  height: auto;
  border-radius: var(--q2w-radius-sm);
}

.leaflet-popup-tip {
  background: var(--q2w-surface) !important;
  box-shadow: var(--q2w-shadow-sm) !important;
}

.leaflet-popup-close-button {
  width: 26px !important;
  height: 26px !important;
  color: var(--q2w-accent-fg) !important;
  font-size: 18px !important;
  line-height: 26px !important;
}

.leaflet-tooltip {
  padding: 4px 7px !important;
  border: 0 !important;
  border-radius: var(--q2w-radius-xs) !important;
  background: color-mix(in srgb, var(--q2w-neutral-900) 88%, transparent) !important;
  color: var(--q2w-neutral-0) !important;
  box-shadow: var(--q2w-shadow-sm) !important;
  font-family: var(--q2w-font-mono);
  font-size: 11px;
}

.leaflet-tooltip-left::before,
.leaflet-tooltip-right::before,
.leaflet-tooltip-top::before,
.leaflet-tooltip-bottom::before {
  border: 0 !important;
}

@media (max-width: 640px) {
  :root {
    --q2w-panel-w: min(320px, calc(100vw - 24px));
  }

  .leaflet-control-layers-expanded {
    width: var(--q2w-panel-w);
  }
}


/* ============================================================
   q2w-mapcss Leaflet qgis2web adapter
   Styles the DOM emitted by qgis2web Leaflet exports without
   requiring users to rewrite generated JavaScript.
   Depends on adapter-leaflet.css being loaded first.
   ============================================================ */

:root {
  --q2w-control-offset-top: calc(var(--q2w-header-h) + 24px);
}

body.q2w-qgis2web,
body.q2w-fullscreen {
  overflow: hidden;
}

body.q2w-qgis2web #map,
body.q2w-fullscreen #map,
#map.q2w-map {
  position: absolute !important;
  inset: 0 !important;
  width: auto !important;
  height: auto !important;
  min-height: 100vh;
  background: var(--q2w-map-bg);
}

body.q2w-has-footer #map {
  bottom: var(--q2w-footer-h) !important;
}

body.q2w-controls-below-header .leaflet-top.leaflet-left,
body.q2w-controls-below-header .leaflet-top.leaflet-right {
  top: var(--q2w-control-offset-top) !important;
  z-index: var(--q2w-z-control) !important;
}

/* Search and measure controls emitted by common qgis2web plugins. */
.leaflet-control-search,
.leaflet-control-measure {
  background: var(--q2w-surface) !important;
  border: 1px solid var(--q2w-border) !important;
  border-radius: var(--q2w-radius-sm) !important;
  box-shadow: var(--q2w-shadow-sm) !important;
  color: var(--q2w-text) !important;
}

.leaflet-control-search .search-button,
.leaflet-control-measure .leaflet-control-measure-toggle,
.leaflet-touch .leaflet-control-measure .leaflet-control-measure-toggle {
  width: var(--q2w-control-size) !important;
  height: var(--q2w-control-size) !important;
  line-height: var(--q2w-control-size) !important;
  background: var(--q2w-surface) !important;
  color: var(--q2w-text) !important;
  border-radius: var(--q2w-radius-sm) !important;
  text-align: center;
  text-indent: 0 !important;
}

.leaflet-control-search .search-button:hover,
.leaflet-control-measure .leaflet-control-measure-toggle:hover {
  background: var(--q2w-surface-soft) !important;
  color: var(--q2w-accent) !important;
}

.leaflet-control-search .search-input {
  height: var(--q2w-control-size) !important;
  border: 1px solid var(--q2w-border) !important;
  border-radius: var(--q2w-radius-sm) !important;
  background: var(--q2w-surface) !important;
  color: var(--q2w-text) !important;
  font-family: var(--q2w-font-sans);
  font-size: 12px;
  box-shadow: var(--q2w-shadow-sm);
}

.leaflet-control-measure .leaflet-control-measure-interaction,
.leaflet-control-measure .leaflet-control-measure-results {
  background: var(--q2w-surface) !important;
  color: var(--q2w-text) !important;
  border-color: var(--q2w-border) !important;
  border-radius: var(--q2w-radius-sm) !important;
  font-family: var(--q2w-font-sans);
  box-shadow: var(--q2w-shadow-md);
}

.q2w-label-halo,
body.q2w-labels-halo .leaflet-tooltip {
  text-shadow:
    -1px -1px 0 var(--q2w-surface),
    1px -1px 0 var(--q2w-surface),
    -1px 1px 0 var(--q2w-surface),
    1px 1px 0 var(--q2w-surface);
}

@media (max-width: 640px) {
  .q2w-header {
    left: 8px;
    right: 8px;
    top: 8px;
    height: 48px;
    padding: 0 10px;
  }

  .q2w-header__sub,
  .q2w-footer__group:not(.q2w-footer__coord) {
    display: none;
  }

  .q2w-footer {
    padding: 0 10px;
  }

  body.q2w-controls-below-header .leaflet-top.leaflet-left,
  body.q2w-controls-below-header .leaflet-top.leaflet-right {
    top: 64px !important;
  }
}

