/* Mapsteader public pages — dealer page + map popups. Tenant primary color is
   injected per-page as --primary. */
:root {
  --primary: #1d4ed8;
  --text: #1a202c;
  --muted: #64748b;
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

.container { max-width: 1020px; margin: 0 auto; padding: 0 20px; }

/* ── Header / footer ─────────────────────────────────────────── */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.tenant-logo { max-height: 40px; max-width: 220px; }
.tenant-name { font-size: 1.15rem; font-weight: 700; }
.header-tag {
  margin-left: auto; font-size: 0.78rem; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}
.site-footer {
  padding: 28px 0 40px; text-align: center; color: var(--muted); font-size: 0.85rem;
}
.site-footer a { color: var(--muted); }

/* ── Dealer page layout ──────────────────────────────────────── */
.dealer-main {
  display: grid; grid-template-columns: 1fr 340px; gap: 24px; padding: 28px 20px 12px;
  align-items: start;
}
@media (max-width: 820px) { .dealer-main { grid-template-columns: 1fr; } }
/* No contact form (dealer has no lead email) → single centered column. */
.dealer-main-solo { grid-template-columns: minmax(0, 720px); justify-content: center; }

.dealer-card, .contact-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
}
.dealer-photo { width: 100%; max-height: 380px; object-fit: cover; display: block; }
.dealer-body { padding: 22px 24px 26px; }
.dealer-name { margin: 0 0 2px; font-size: 1.7rem; line-height: 1.25; }
.dealer-tagline { margin: 0 0 4px; font-weight: 600; color: var(--primary); font-size: .95rem; }
.dealer-address { margin: 0 0 16px; color: var(--muted); }
.dealer-seo-text p { color: var(--muted); line-height: 1.6; }

.dealer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.btn {
  display: inline-block; padding: 10px 16px; border-radius: 8px; font-weight: 600;
  font-size: 0.95rem; text-decoration: none; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); cursor: pointer;
}
.btn:hover { filter: brightness(0.97); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.6; cursor: default; }

.dealer-section { margin-top: 20px; }
.dealer-section h2 {
  margin: 0 0 6px; font-size: 0.8rem; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}
.dealer-section p { margin: 0; }
.pre-line { white-space: pre-line; }

/* ── Contact form ────────────────────────────────────────────── */
.contact-card { padding: 22px 22px 24px; }
.contact-card h2 { margin: 0 0 2px; font-size: 1.15rem; }
.contact-sub { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; }
.contact-card label { display: block; margin-bottom: 12px; font-size: 0.88rem; font-weight: 600; }
.contact-card input, .contact-card textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 8px; font: inherit; font-weight: 400;
  background: #fff;
}
.contact-card input:focus, .contact-card textarea:focus {
  outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent;
}
.hp-field { position: absolute !important; left: -9999px !important; height: 1px; width: 1px; opacity: 0; }

/* Sent state: the fields give way to a centered thank-you */
.contact-success { display: none; text-align: center; padding: 42px 10px 46px; }
.contact-card.sent .contact-success { display: block; }
.contact-card.sent > h2, .contact-card.sent .contact-sub, .contact-card.sent form { display: none; }
.contact-success h2 { margin: 0 0 4px; font-size: 1.3rem; }
.contact-success p { margin: 0; color: var(--muted); }
.success-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; margin-bottom: 16px; border-radius: 50%;
  background: var(--primary); color: #fff;
  box-shadow: 0 10px 26px color-mix(in srgb, var(--primary) 35%, transparent);
  animation: ms-pop .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.success-check svg polyline {
  stroke-dasharray: 26; stroke-dashoffset: 26;
  animation: ms-draw .35s ease-out .25s forwards;
}
@keyframes ms-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ms-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .success-check { animation: none; }
  .success-check svg polyline { animation: none; stroke-dashoffset: 0; }
}
#form-status { min-height: 1.2em; margin: 10px 0 0; font-size: 0.9rem; }
#form-status.ok { color: #15803d; }
#form-status.err { color: #b91c1c; }

/* ── Map page: glass search + results (inside the Leaflet iframe) ── */
.ms-glass {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
  border-radius: 14px;
}

.ms-search-wrap {
  position: absolute; top: 14px; left: 14px; z-index: 1000;
  width: min(360px, calc(100% - 28px));
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.ms-search { display: flex; align-items: center; gap: 8px; padding: 9px 12px; }
.ms-search-icon { flex: 0 0 auto; color: #64748b; }
.ms-search input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font: inherit; font-size: .93rem; color: #0f172a;
}
.ms-search input::placeholder { color: #64748b; }
.ms-btn {
  flex: 0 0 auto; border: 0; border-radius: 9px; padding: 7px 14px;
  color: #fff; font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.ms-btn:hover { filter: brightness(1.08); }
.ms-locate {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(15, 23, 42, 0.12); background: rgba(255, 255, 255, 0.6);
  color: #334155;
}
.ms-locate:hover { background: #fff; color: #0f172a; }

.ms-status { margin-top: 8px; padding: 9px 14px; font-size: .87rem; color: #334155; }

.ms-results { margin-top: 8px; overflow: hidden; }
.ms-results-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px; font-size: .78rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: #475569;
}
.ms-head-actions { display: flex; align-items: center; gap: 8px; }
.ms-sheet-handle, .ms-sheet-chev { display: none; }

/* Phones: results become a collapsible bottom sheet so the map stays visible */
@media (max-width: 640px) {
  .ms-results {
    position: fixed;
    left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    margin-top: 0;
    display: flex; flex-direction: column;
    /* ~3.5 result rows: enough to scan, a visible half-row cues scrolling,
       and the map keeps most of the screen. */
    max-height: min(40vh, 268px);
    z-index: 1100;
  }
  .ms-results[hidden] { display: none; }
  #ms-results-list { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .ms-sheet-handle {
    display: block; flex: 0 0 auto;
    width: 40px; height: 4px; border-radius: 2px;
    background: rgba(15, 23, 42, 0.22); margin: 8px auto 0;
  }
  .ms-results-head {
    padding-top: 6px; cursor: pointer;
    user-select: none; -webkit-user-select: none;
  }
  .ms-sheet-chev { display: block; color: #64748b; transition: transform .25s ease; }
  .ms-results.ms-collapsed { cursor: pointer; }
  .ms-results.ms-collapsed .ms-sheet-chev { transform: rotate(180deg); }
  .ms-results.ms-collapsed #ms-results-list { display: none; }
  @media (prefers-reduced-motion: reduce) { .ms-sheet-chev { transition: none; } }
}
.ms-clear {
  border: 0; background: transparent; cursor: pointer; color: #64748b;
  font-size: 1.15rem; line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.ms-clear:hover { color: #0f172a; background: rgba(15, 23, 42, 0.06); }
.ms-result {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 10px 14px; border: 0; cursor: pointer; text-align: left;
  background: transparent; font: inherit;
  border-top: 1px solid rgba(15, 23, 42, 0.07);
}
.ms-result:hover { background: rgba(255, 255, 255, 0.65); }
.ms-result-main { display: flex; flex-direction: column; min-width: 0; }
.ms-result-name {
  font-size: .92rem; font-weight: 600; color: #0f172a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ms-result-city { font-size: .8rem; color: #64748b; }
.ms-result-mi { flex: 0 0 auto; font-size: .88rem; font-weight: 700; }

/* Reset-view control (sits above the zoom control) */
.ms-reset {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-bottom: 8px; cursor: pointer;
  border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.18);
  color: #334155;
}
.ms-reset:hover { background: #fff; color: #0f172a; }

/* Cluster bubbles + searched-location dot */
.ms-cluster-wrap { background: none; border: none; }
.ms-cluster {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: color-mix(in srgb, var(--ms-accent, #1d4ed8) 88%, black);
  color: #fff; font: 700 .92rem/1 system-ui, sans-serif;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.35);
}
.ms-here { background: none; border: none; }
.ms-here-dot {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ms-accent, #1d4ed8); border: 3px solid #fff;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ms-accent, #1d4ed8) 55%, transparent);
  animation: ms-pulse 2s ease-out infinite;
}
@keyframes ms-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ms-accent, #1d4ed8) 55%, transparent); }
  70%  { box-shadow: 0 0 0 16px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .ms-here-dot { animation: none; } }

/* ── Map page popups (inside the Leaflet iframe) ─────────────── */
.ms-pin { background: none; border: none; }

/* Glass chrome for the popup — matches the search bar */
.ms-popup-glass .leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18);
  border-radius: 14px;
}
.ms-popup-glass .leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12);
}
.ms-popup-glass .leaflet-popup-content { margin: 12px 14px; }
.ms-popup-glass a.leaflet-popup-close-button { color: #64748b; }

.ms-popup { min-width: 190px; font-family: system-ui, sans-serif; }
.ms-popup-photo {
  width: 100%; height: 104px; object-fit: cover; border-radius: 9px; margin-bottom: 9px;
}
.ms-popup-name { font-weight: 700; font-size: 0.98rem; color: #0f172a; }
/* Dealer description (shown when details pages are off). */
.ms-popup-desc {
  margin: 6px 0 2px; font-size: 0.82rem; color: #334155; line-height: 1.5;
}
.ms-popup-details { margin: 4px 0 10px; font-size: 0.85rem; color: #475569; line-height: 1.45; }
.ms-popup-phone {
  display: inline-block; margin-top: 3px; color: #0f172a !important;
  font-weight: 600; text-decoration: none;
}
.ms-popup-phone:hover { text-decoration: underline; }
.ms-popup-actions { display: flex; gap: 7px; }
.ms-popup-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff !important; padding: 7px 13px; border-radius: 8px;
  font-size: 0.85rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.ms-popup-link:hover { filter: brightness(1.08); }
.ms-popup-link-ghost {
  background: rgba(255, 255, 255, 0.6); color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.14);
}
.ms-popup-link-ghost:hover { background: #fff; filter: none; }

/* Ctrl + scroll reminder for desktop: a small centered toast, no veil or
   blur — the map stays fully visible behind it. */
.ms-ctrl-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.ms-ctrl-overlay.visible {
  opacity: 1;
}
.ms-ctrl-overlay-text {
  background: rgba(15, 23, 42, 0.78);
  padding: 9px 18px;
  border-radius: 999px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(4px);
  transition: transform 0.25s ease;
}
.ms-ctrl-overlay.visible .ms-ctrl-overlay-text {
  transform: translateY(0);
}

/* ── Standalone maps (/s/:slug): county service-area overlay ── */
.sa-legend {
  position: absolute; top: 14px; left: 14px; z-index: 1000;
  display: flex; flex-direction: column; gap: 6px; padding: 10px 15px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .86rem; font-weight: 600; color: #0f172a; max-width: 240px;
}
.sa-legend-row { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sa-legend-row span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-legend-swatch {
  width: 13px; height: 13px; border-radius: 4px; flex: 0 0 auto;
  opacity: .55; box-shadow: inset 0 0 0 1.5px rgba(15, 23, 42, 0.25);
}
.sa-legend-ring {
  background: transparent !important; opacity: 1; border-radius: 50%;
  border: 2px dashed; box-shadow: none;
}

/* "Do you serve my area?" checker (top-right, full-width on phones) */
.sa-check {
  position: absolute; top: 14px; right: 14px; z-index: 1001;
  width: min(320px, calc(100% - 28px)); padding: 13px 15px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
  /* Fallback for iframes that ignore the resize bridge: if the lead form
     outgrows the frame, the card scrolls instead of clipping the submit. */
  max-height: calc(100vh - 28px); overflow-y: auto;
}
/* Collapsed checker launcher — on small embeds the full card would cover half
   the map, so it starts as a pill and expands on demand. */
.sa-check-toggle {
  display: none; position: absolute; top: 14px; right: 14px; z-index: 1001;
  align-items: center; gap: 8px; max-width: calc(100% - 28px);
  padding: 10px 15px; border-radius: 999px; cursor: pointer;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .88rem; font-weight: 700; color: #0f172a;
}
.sa-check-toggle-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}
.sa-check-toggle-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-check-close {
  display: none; position: absolute; top: 6px; right: 6px; width: 28px; height: 28px;
  align-items: center; justify-content: center; border: 0; border-radius: 8px;
  background: transparent; color: #64748b; font-size: 1.15rem; line-height: 1; cursor: pointer;
}
.sa-check-close:hover { background: rgba(15, 23, 42, 0.06); color: #0f172a; }
@media (max-width: 719px) {
  #map.sa-has-check:not(.sa-check-open) ~ .sa-check { display: none; }
  #map.sa-has-check:not(.sa-check-open) ~ .sa-check-toggle { display: inline-flex; }
  .sa-check-close { display: flex; }
  .sa-check-title { padding-right: 26px; }
  .sa-legend { top: 10px; left: 10px; padding: 8px 12px; gap: 5px; font-size: .78rem; max-width: 45%; }
  .sa-legend-swatch { width: 11px; height: 11px; }
}
@media (max-width: 560px) {
  .sa-check { top: auto; bottom: 14px; left: 14px; right: 14px; width: auto; }
  .sa-check-toggle { top: auto; bottom: 14px; left: 50%; right: auto; transform: translateX(-50%); }
  /* The checker owns the bottom edge on phones: the county tap chip moves to
     the top-right (the checker's vacated desktop spot) and the zoom control
     shifts above the panel instead of hiding behind it. */
  #map.sa-has-check ~ .sa-tap {
    bottom: auto; top: 14px; left: auto; right: 14px;
    transform: none; white-space: normal; max-width: 55%; text-align: right;
  }
  #map.sa-check-open .leaflet-bottom.leaflet-right { bottom: 160px; }
}
.sa-check-title { font-size: .95rem; font-weight: 700; margin-bottom: 9px; }
.sa-check-row { display: flex; gap: 8px; }
.sa-check-row input {
  flex: 1; min-width: 0; border: 1px solid rgba(15, 23, 42, 0.15); border-radius: 9px;
  padding: 8px 11px; font: inherit; font-size: .9rem; color: #0f172a;
  background: rgba(255, 255, 255, 0.75); outline: none;
}
.sa-check-row input:focus { border-color: rgba(15, 23, 42, 0.35); }
.sa-check-result { margin-top: 10px; font-size: .9rem; line-height: 1.45; }
.sa-check-result.sa-yes strong { color: #15803d; }
.sa-check-result.sa-no strong { color: #b91c1c; }
.sa-check-result.sa-neutral { color: #475569; }
/* Rendered as a <button> (opens the lead form) or an <a> (custom button link). */
.sa-check-result .sa-lead-open {
  display: block; width: 100%; margin-top: 9px; padding: 8px 12px;
  text-align: center; text-decoration: none;
}
.sa-lead-ghost {
  background: rgba(255, 255, 255, 0.7) !important; color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.18) !important;
}
.sa-zone-chip {
  display: inline-block; margin-left: 7px; padding: 2px 9px; border-radius: 999px;
  color: #fff; font-size: .72rem; font-weight: 700; vertical-align: 1px;
}
.sa-lead { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
/* display:flex beats the UA's [hidden]{display:none} — reassert it, or the
   lead form shows expanded before any check runs. */
.sa-lead[hidden] { display: none; }
.sa-lead input, .sa-lead textarea {
  border: 1px solid rgba(15, 23, 42, 0.15); border-radius: 9px; padding: 8px 11px;
  font: inherit; font-size: .88rem; color: #0f172a; background: rgba(255, 255, 255, 0.75);
  outline: none; resize: vertical;
}
.sa-lead button { padding: 9px 12px; }
.sa-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Cursor-following county label (desktop hover) */
.sa-hover {
  position: fixed; z-index: 1200; pointer-events: none; max-width: 260px;
  padding: 9px 13px; border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.22);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
}
.sa-hover-name { font-size: .88rem; font-weight: 700; line-height: 1.3; }
.sa-hover-badge {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 6px;
  padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; color: #fff;
}

/* Tap chip (touch devices — no hover): same info, pinned to the map bottom */
.sa-tap {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 1100; max-width: calc(100% - 28px); padding: 10px 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #0f172a; text-align: center; white-space: nowrap;
}
.sa-tap .sa-hover-name { display: inline; }
.sa-tap .sa-hover-badge { margin: 0 0 0 8px; vertical-align: 1px; }

/* Smooth hover transitions on the county polygons (SVG presentation
   attributes animate like CSS properties). */
path.sa-county {
  transition: fill-opacity .18s ease, stroke-opacity .18s ease, stroke-width .18s ease;
}
@media (prefers-reduced-motion: reduce) {
  path.sa-county { transition: none; }
}

/* ── Private dealer territory map (/p/:tenantSlug) ── */
.tm-login-wrap {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.tm-login { width: min(360px, 100%); padding: 26px 26px 22px; text-align: center; }
.tm-login h1 { margin: 0 0 6px; font-size: 1.15rem; color: #0f172a; }
.tm-login p { margin: 0 0 16px; font-size: .88rem; color: #475569; }
.tm-login input {
  width: 100%; box-sizing: border-box; margin-bottom: 10px;
  border: 1px solid rgba(15, 23, 42, 0.15); border-radius: 9px; padding: 10px 12px;
  font: inherit; font-size: 16px; color: #0f172a; background: rgba(255,255,255,.8); outline: none;
}
.tm-login button { width: 100%; padding: 10px 12px; }
.tm-login-err { margin: 0 0 12px; font-size: .86rem; color: #b91c1c; font-weight: 600; }

.tm-panel {
  position: absolute; top: 14px; left: 14px; z-index: 1000;
  width: min(380px, calc(100% - 28px)); padding: 14px 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #0f172a;
  max-height: calc(100% - 28px); overflow-y: auto;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  transition: max-height 0.3s ease, transform 0.3s ease, border-radius 0.3s ease;
}
.tm-handle-bar {
  display: none; padding: 4px 0 8px; cursor: pointer; align-items: center; justify-content: center;
}
.tm-handle-pill {
  width: 38px; height: 5px; border-radius: 999px; background: rgba(15, 23, 42, 0.22);
}
.tm-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px;
}
.tm-title { font-size: .95rem; font-weight: 700; flex: 1; min-width: 0; }
.tm-radius {
  display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px;
  background: rgba(15, 23, 42, 0.08); font-size: .72rem; font-weight: 700; color: #475569;
}
.tm-toggle-btn {
  display: none; width: 28px; height: 28px; border: none; background: rgba(15, 23, 42, 0.06);
  border-radius: 50%; color: #475569; align-items: center; justify-content: center;
  cursor: pointer; transition: transform 0.2s ease, background-color 0.2s ease;
  flex: 0 0 auto;
}
.tm-toggle-btn:hover { background: rgba(15, 23, 42, 0.12); color: #0f172a; }
.tm-chevron { transition: transform 0.25s ease; }
.tm-panel.tm-collapsed .tm-chevron { transform: rotate(180deg); }

.tm-body { transition: opacity 0.2s ease; }
.tm-row { display: flex; gap: 8px; }
.tm-row input {
  flex: 1; min-width: 0; border: 1px solid rgba(15, 23, 42, 0.15); border-radius: 9px;
  padding: 8px 11px; font: inherit; font-size: .9rem; color: #0f172a;
  background: rgba(255, 255, 255, 0.75); outline: none;
}
.tm-row input:focus { border-color: rgba(15, 23, 42, 0.4); background: #fff; }
.tm-hint { margin: 8px 0 0; font-size: .8rem; color: #64748b; }
.tm-result { margin-top: 10px; font-size: .88rem; line-height: 1.5; }
.tm-verdict { font-weight: 700; margin-bottom: 6px; }
.tm-verdict.tm-bad { color: #b91c1c; }
.tm-verdict.tm-ok { color: #15803d; }
.tm-row-dealer { padding: 3px 0; border-bottom: 1px dotted rgba(0,0,0,0.05); }
.tm-row-dealer:last-child { border-bottom: none; }
.tm-row-dealer.tm-conflict { color: #b91c1c; }
.tm-muted { color: #64748b; font-size: .82rem; }

/* ── Mobile bottom sheet styling (< 640px) ── */
@media (max-width: 640px) {
  .leaflet-bottom.leaflet-right {
    top: 14px; bottom: auto; right: 14px;
  }
  .tm-panel {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%;
    border-radius: 18px 18px 0 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0;
    padding: 8px 16px max(14px, env(safe-area-inset-bottom));
    max-height: 65vh; box-shadow: 0 -6px 25px rgba(0, 0, 0, 0.16);
  }
  .tm-handle-bar { display: flex; }
  .tm-toggle-btn { display: flex; }
  .tm-row input {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    padding: 10px 12px;
  }
  .tm-row button {
    padding: 10px 16px; font-size: 0.95rem; min-height: 44px;
  }
  .tm-panel.tm-collapsed {
    max-height: 52px; overflow: hidden;
  }
  .tm-panel.tm-collapsed .tm-body {
    display: none;
  }
  .tm-panel.tm-collapsed .tm-header {
    margin-bottom: 0;
  }
}
