/* ==========================================================
   MAGPY ATLAS — Editorial cartography theme
   ========================================================== */

:root {
  /* Surface palette — warm dark taupe (Skyline reference: graphite with subtle warm undertone) */
  --atlas-bg:           #1c1815;
  --atlas-surface:      #211d1a;
  --atlas-elevated:     #28231f;
  --atlas-elevated-2:   #322d28;
  --atlas-border:       #322d27;
  --atlas-border-strong:#56504a;

  /* Text — warm cream scale, NOT cold white. Brightness lifted slightly for readability */
  --atlas-text:         #f0eadd;
  --atlas-text-2:       #d4cebf;
  --atlas-muted:        #a09a8c;
  --atlas-dim:          #6e685e;

  /* Active state — bright cream as the "selected" highlight (no chromatic accent) */
  --atlas-indigo:       #ece6d8;   /* primary "active" inversion — bright cream */
  --atlas-indigo-deep:  #d4cdbd;
  --atlas-indigo-soft:  #b5b0a3;
  --atlas-indigo-glow:  rgba(236, 230, 216, 0.08);
  --atlas-gold:         #ece6d8;   /* gold removed — collapse to cream highlight */
  --atlas-gold-soft:    #c5c0b3;

  /* Semantic — desaturated to live within the warm grayscale */
  --atlas-emerald:      #8aab8e;
  --atlas-amber:        #c4a575;
  --atlas-amber:        #c4a575;
  --atlas-coral:        #c4877a;
  --atlas-violet:       #a89db5;
  --atlas-sky:          #8a9eaf;

  /* Logo backgrounds — pure white (matches Archiproducts thumb format) */
  --atlas-paper:        #ffffff;

  /* Type */
  --font-display: "Geist", -apple-system, "Helvetica Neue", sans-serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
/* Defensive: HTML5 [hidden] often gets overridden by author display rules
   (e.g. .grid { display: grid }). Force the UA semantic to win. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--atlas-bg);
  color: var(--atlas-text);
  line-height: 1.45;
  font-size: 14px;
  /* clip > hidden: prevents horizontal overflow without breaking sticky descendants */
  overflow-x: clip;
}
/* Lock background scroll when an overlay is shown — sidebar drawer (mobile)
   or detail panel in overlay mode (≤1024px). On full desktop the detail is the 3rd column
   of the layout, grid scroll stays independent. */
@media (max-width: 1024px) {
  body.no-scroll { overflow-y: hidden; }
}

/* Custom scrollbars */
* { scrollbar-color: var(--atlas-border-strong) var(--atlas-surface); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--atlas-surface); }
::-webkit-scrollbar-thumb { background: var(--atlas-border-strong); border-radius: 5px; border: 2px solid var(--atlas-surface); }
::-webkit-scrollbar-thumb:hover { background: var(--atlas-indigo); }
::-webkit-scrollbar-corner { background: var(--atlas-surface); }

/* ==========================================================
   Layout grid
   ========================================================== */
.app {
  display: grid;
  grid-template-columns: 280px 1fr 0;
  min-height: 100vh;
}
.app.detail-open { grid-template-columns: 280px 1fr 460px; }

.sidebar {
  background: var(--atlas-surface);
  border-right: 1px solid var(--atlas-border-strong);
  padding: 20px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  /* tick marks along the right edge — architectural ruler feel */
  background-image: linear-gradient(to bottom, transparent calc(100% - 1px), var(--atlas-border-strong) 100%);
}
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  overflow-x: clip;
}
/* Topbar: single sticky wrapper for the whole header stack — no gap leaks */
.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--atlas-surface);
}

/* Desktop: search + actions on the same row, mobile: stacked (overridden in @media) */
.toolbar-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  background: var(--atlas-surface);
  border-bottom: 1px solid var(--atlas-border-strong);
}

.toolbar-search {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
}
.toolbar-search .search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.toolbar-search .search-icon {
  position: absolute;
  left: 14px;
  color: var(--atlas-dim);
  font-size: 16px;
  pointer-events: none;
  z-index: 1;
}
.toolbar-search input[type=text] {
  flex: 1;
  min-width: 0;
  width: auto;
  /* Box height matched to .toolbar-actions select/button: padding 10 + font 14×1.15 + border 2 */
  padding: 10px 38px;
  font-size: 14px;
  line-height: 1.15;
  font-family: var(--font-sans);
  background: var(--atlas-bg);
  border: 1px solid var(--atlas-border);
  color: var(--atlas-text);
  border-radius: 6px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.toolbar-search input[type=text]:focus {
  outline: none;
  border-color: var(--atlas-indigo);
  box-shadow: 0 0 0 3px var(--atlas-indigo-glow);
}
.toolbar-search input[type=text]::placeholder { color: var(--atlas-dim); }
.search-clear {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--atlas-muted);
  cursor: pointer;
  font-size: 22px;
  padding: 0 8px;
  line-height: 1;
}
.search-clear:hover { color: var(--atlas-text); }

.toolbar-actions {
  padding: 0;
  background: transparent;
  border: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.toolbar-actions .btn-label { margin-left: 6px; }
.toolbar-actions .stats > span { white-space: nowrap; }
.toolbar-actions select, .toolbar-actions button {
  /* Height matched to search input: padding 10px + font 14px + border 2px = 38px box */
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border);
  color: var(--atlas-text);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.15;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: border-color 0.12s, background 0.12s;
}
.toolbar-actions select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4.5 L6 8.5 L10 4.5' stroke='%23ece6d8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 10px;
}
.toolbar-actions select:hover { border-color: var(--atlas-border-strong); }
.toolbar-actions select:focus { outline: none; border-color: var(--atlas-text-2); }
.toolbar-actions button:hover { background: var(--atlas-elevated-2); border-color: var(--atlas-border-strong); }
.toolbar-actions .stats {
  font-size: 12px;
  color: var(--atlas-muted);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.toolbar-actions .stats strong {
  color: var(--atlas-text);
  font-weight: 600;
}

/* Active filters bar — atlas blueprint feel */
.active-filters {
  padding: 11px 22px;
  background: var(--atlas-surface);
  border-bottom: 1px solid var(--atlas-border-strong);
  /* prominent left edge tick — register-mark style */
  box-shadow: inset 3px 0 0 var(--atlas-text);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.active-filters[hidden] { display: none; }
.active-filters .label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 11px;
  color: var(--atlas-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-right: 6px;
}
.active-filters .pill {
  /* pill style aligned with sidebar chips: cream pill, dark text inversion */
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--atlas-indigo);
  color: var(--atlas-bg);
  font-size: 12px;
  padding: 3px 4px 3px 11px;
  border-radius: 12px;
  font-weight: 500;
  border: 1px solid var(--atlas-indigo-deep);
}
.active-filters .pill button {
  background: rgba(28, 24, 21, 0.18);
  border: none;
  color: var(--atlas-bg);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.active-filters .pill button:hover { background: rgba(28, 24, 21, 0.4); }
.active-filters .clear-all {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--atlas-border-strong);
  color: var(--atlas-text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
}
.active-filters .clear-all:hover {
  background: var(--atlas-elevated);
  color: var(--atlas-text);
  border-color: var(--atlas-text-2);
}

/* Letter strip — condensed, centered. Sticky behavior comes from the .topbar wrapper */
.letter-strip {
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 6px 18px;
  background: var(--atlas-bg);
  border-bottom: 1px solid var(--atlas-border-strong);
  flex-wrap: wrap;
  font-family: var(--font-display);
}
.letter-strip .letter {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--atlas-text-2);
  padding: 3px 7px;
  cursor: pointer;
  border-radius: 3px;
  user-select: none;
  letter-spacing: 0.02em;
  transition: color 0.1s, background 0.1s;
  text-align: center;
  min-width: 18px;
}
.letter-strip .letter:hover { color: var(--atlas-text); background: var(--atlas-elevated); }

.grid {
  padding: 14px 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  align-content: start;
}

/* ==========================================================
   Branding — wordmark + logo
   ========================================================== */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  position: relative;
  /* heavy register-mark bottom border (architectural blueprint) */
  border-bottom: 2px solid var(--atlas-text);
}
.brand::after {
  /* offset register tick — architectural detail */
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 72px;
  height: 2px;
  background: var(--atlas-text-2);
}
.brand-mark {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  min-width: 0;
  flex: 1;
}
.brand-text .family-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  color: var(--atlas-muted);
  letter-spacing: 0.24em;
  text-transform: lowercase;
  margin-bottom: 2px;
  margin-left: 1px;
}
.brand-text .wordmark-atlas {
  font-family: "Righteous", "Geist", sans-serif;
  font-size: 50px;
  font-weight: 400;
  color: var(--atlas-text);
  letter-spacing: 0.012em;
  line-height: 0.88;
  margin-top: -1px;
}
.brand-text .tagline {
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--atlas-dim);
  letter-spacing: 0.185em;
  text-transform: uppercase;
  margin-top: 7px;
  font-weight: 500;
  white-space: nowrap;
}

/* ==========================================================
   Filter sections
   ========================================================== */
.filter-group {
  margin-bottom: 18px;
}
.filter-group-label { display: none; }  /* macro-group labels removed — section h3 are the true headers */

.filter-section { margin-bottom: 18px; }
.filter-section:last-child { margin-bottom: 0; }
.filter-section h3 {
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  color: var(--atlas-text);
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--atlas-border-strong);
}
.filter-section h3 i {
  color: var(--atlas-text);
  font-size: 14px;
}

/* Compact aligned input rows for min-* filters */
.filter-row-grid {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 6px 10px;
  align-items: center;
  margin-top: 6px;
}
.filter-row-grid label {
  font-size: 12px;
  color: var(--atlas-muted);
}
.filter-row-grid input[type=number] {
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 6px 8px;
  font-size: 12.5px;
}

.filter-section .toggles { display: flex; flex-direction: column; gap: 6px; }
.filter-section .options { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--atlas-elevated);
  color: var(--atlas-text-2);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
  font-family: var(--font-sans);
}
.chip:hover { background: var(--atlas-elevated-2); color: var(--atlas-text); }
.chip.on {
  background: var(--atlas-indigo);
  color: var(--atlas-bg);  /* cream pill → dark text inversion */
  border-color: var(--atlas-indigo-deep);
}
.chip .count {
  color: var(--atlas-dim);
  font-size: 10px;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.chip.on .count { color: rgba(28, 24, 21, 0.6); }

input[type=text], input[type=number], select, textarea {
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border);
  color: var(--atlas-text);
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 13px;
  font-family: var(--font-sans);
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input[type=text]:focus, input[type=number]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--atlas-indigo);
  box-shadow: 0 0 0 2px var(--atlas-indigo-glow);
}
.range-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--atlas-muted); }
.range-row input { flex: 1; font-variant-numeric: tabular-nums; }

label.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12px;
  color: var(--atlas-text-2);
  padding: 2px 0;
}
label.toggle input { accent-color: var(--atlas-bg); }
label.toggle:hover { color: var(--atlas-text); }

/* ==========================================================
   Cards
   ========================================================== */
.card {
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border-strong);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  height: 100%;
  min-height: 320px;
  content-visibility: auto;
  contain-intrinsic-size: 320px 320px;
  position: relative;
}
.card::before {
  /* subtle blueprint-style corner ticks, decorative atlas detail */
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-top: 1px solid var(--atlas-gold);
  border-right: 1px solid var(--atlas-gold);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  border-top-right-radius: 8px;
}
.card:hover {
  border-color: var(--atlas-border-strong);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.card:hover::before { opacity: 1; }
.card.selected {
  border-color: var(--atlas-indigo);
  box-shadow: 0 0 0 2px var(--atlas-indigo-glow), 0 4px 16px rgba(0, 0, 0, 0.3);
}
.card.selected::before {
  opacity: 1;
  border-color: var(--atlas-indigo);
}

.card .logo {
  aspect-ratio: 1 / 1;
  background-color: var(--atlas-paper);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 70%;
  border-bottom: 1px solid var(--atlas-border-strong);
  flex-shrink: 0;
  position: relative;
  /* subtle inset shadow for depth on logo plate */
  box-shadow: inset 0 -8px 24px rgba(0, 0, 0, 0.05);
}

/* Partner brand: sticker band pinned to the bottom of the logo area
   — does not affect card layout dimensions or content alignment */
.card.partner {
  border-color: var(--atlas-emerald);
}
.card .partner-band {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--atlas-emerald);
  color: var(--atlas-bg);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-align: center;
  padding: 4px 0 3px;
  pointer-events: none;
}
.card.tracked {
  border-color: var(--atlas-amber);
}
.card .partner-band.tracked-band {
  background: var(--atlas-amber);
}

.card-website-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: rgba(28, 24, 21, 0.85);
  color: var(--atlas-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid rgba(236, 230, 216, 0.12);
  backdrop-filter: blur(4px);
  transition: background 0.12s, transform 0.12s, color 0.12s;
}
.card-website-btn:hover {
  background: var(--atlas-indigo);
  color: var(--atlas-bg);
  transform: scale(1.08);
  text-decoration: none;
}
.card-website-btn.unknown {
  background: rgba(28, 24, 21, 0.65);
  color: var(--atlas-muted);
}
.card-website-btn.unknown:hover {
  background: var(--atlas-elevated-2);
  color: var(--atlas-text);
}
.card-stage1-flag {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(28, 24, 21, 0.85);
  color: var(--atlas-muted);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.card-markers {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
}
.card-marker {
  width: 24px;
  height: 24px;
  border-radius: 12px;
  background: rgba(28, 24, 21, 0.85);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 1px solid rgba(236, 230, 216, 0.12);
  backdrop-filter: blur(4px);
}
.card-marker.notes { color: var(--atlas-text); }

.card .body {
  padding: 11px 13px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.card .name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  font-variation-settings: "opsz" 24, "wdth" 100;
  color: var(--atlas-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.card .loc {
  font-size: 11.5px;
  color: var(--atlas-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}
.card .blurb {
  font-size: 12px;
  color: var(--atlas-text-2);
  line-height: 1.4;
  margin: 4px 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
  max-height: 2.8em;
}
.card .meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--atlas-border);
  min-height: 56px;
}
.card .meta-score {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}
.card .meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-height: 18px;
  max-height: 22px;
  overflow: hidden;
}
.seg-tag.cad {
  background: var(--atlas-elevated-2);
  color: var(--atlas-text-2);
  border: 1px solid var(--atlas-border-strong);
}

.seg-tag {
  font-size: 9.5px;
  padding: 2px 7px;
  background: var(--atlas-elevated-2);
  color: var(--atlas-indigo-soft);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  font-weight: 500;
}

.designer-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  padding: 3px 9px;
  background: var(--atlas-elevated);
  color: var(--atlas-text-2);
  border: 1px solid var(--atlas-border);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.12s;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.005em;
}
a.designer-chip:hover {
  background: var(--atlas-elevated-2);
  border-color: var(--atlas-border-strong);
  color: var(--atlas-text);
  text-decoration: none;
}
.seg-tag.more { color: var(--atlas-dim); cursor: help; }

.score {
  display: inline-flex;
  gap: 1px;
  align-items: center;
  font-size: 13px;
  letter-spacing: -0.5px;
}
.score .star.on { color: #f5efdf; }
.score .star.off { color: var(--atlas-border-strong); }
.score.manual::after {
  content: "·M";
  color: var(--atlas-emerald);
  font-size: 9px;
  font-weight: 700;
  margin-left: 4px;
  letter-spacing: 0;
}

.card .partner-flag {
  font-size: 9px;
  padding: 2px 6px;
  background: rgba(95, 199, 138, 0.16);
  color: var(--atlas-emerald);
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border: 1px solid rgba(95, 199, 138, 0.25);
}
.partner-flag.tracked-flag {
  background: rgba(196, 165, 117, 0.14);
  color: var(--atlas-amber);
  border-color: rgba(196, 165, 117, 0.28);
}
.card .status-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.status-contacted { background: rgba(88, 164, 247, 0.16); color: var(--atlas-sky); }
.status-replied   { background: rgba(192, 138, 239, 0.16); color: var(--atlas-violet); }
.status-in-talks  { background: rgba(247, 164, 88, 0.16); color: var(--atlas-amber); }
.status-partner   { background: rgba(95, 199, 138, 0.16); color: var(--atlas-emerald); }
.status-declined  { background: rgba(247, 110, 110, 0.16); color: var(--atlas-coral); }

/* ==========================================================
   Detail panel
   ========================================================== */
.detail-panel {
  background: var(--atlas-surface);
  border-left: 1px solid var(--atlas-border-strong);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.15s;
}
.app.detail-open .detail-panel {
  visibility: visible;
  opacity: 1;
}

.detail-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--atlas-border-strong);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-shrink: 0;
  background: var(--atlas-elevated);
}
.detail-header img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: var(--atlas-paper);
  border-radius: 5px;
  padding: 5px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.detail-header .h-info { flex: 1; min-width: 0; }
.detail-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  font-variation-settings: "opsz" 48, "wdth" 95;
  word-break: break-word;
  letter-spacing: -0.025em;
  color: var(--atlas-text);
  line-height: 1.1;
}
.detail-header .h-loc {
  font-size: 12px;
  color: var(--atlas-muted);
  margin-top: 4px;
  letter-spacing: 0.02em;
}
.detail-header .close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border-strong);
  color: var(--atlas-text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}
.detail-header .close:hover { background: var(--atlas-elevated-2); border-color: var(--atlas-text-2); }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--atlas-border-strong);
  flex-shrink: 0;
  background: var(--atlas-surface);
}
.tab {
  padding: 11px 18px;
  cursor: pointer;
  font-size: 12px;
  color: var(--atlas-muted);
  border-bottom: 2px solid transparent;
  letter-spacing: 0.04em;
  font-weight: 500;
  transition: color 0.12s, background 0.12s;
}
.tab.active {
  color: var(--atlas-text);
  border-bottom-color: var(--atlas-text);
}
.tab:hover { background: var(--atlas-elevated); color: var(--atlas-text-2); }

.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  min-height: 0;
}
.tab-content.hidden { display: none; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--atlas-muted);
  margin-bottom: 5px;
  letter-spacing: 0.14em;
  font-weight: 600;
}
.field .val { font-size: 14px; word-break: break-word; color: var(--atlas-text-2); }
.field .val a { color: var(--atlas-indigo-soft); }
.field .val a:hover { color: var(--atlas-indigo); text-decoration: underline; }
.field .breakdown {
  font-size: 11.5px;
  color: var(--atlas-muted);
  margin-top: 6px;
  line-height: 1.6;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

/* Score breakdown popover — hover on desktop, tap-toggle on touch */
.score-info {
  margin-left: 6px;
  position: relative;
  display: inline-block;
}
.score-info-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--atlas-muted);
  padding: 2px 5px;
  border-radius: 3px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.score-info-btn:hover { color: var(--atlas-text); background: var(--atlas-elevated); }
.score-info-body {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-width: 320px;
  font-size: 11.5px;
  color: var(--atlas-text-2);
  padding: 10px 12px;
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border-strong);
  border-radius: 5px;
  font-family: var(--font-mono);
  line-height: 1.65;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
  white-space: normal;
}
.score-info.is-open .score-info-body { display: block; }
@media (hover: hover) {
  .score-info:hover .score-info-body { display: block; }
  .score-info:hover .score-info-btn { color: var(--atlas-text); background: var(--atlas-elevated); }
}
.score-edit {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 4px;
}
.score-edit .star {
  cursor: pointer;
  font-size: 22px;
  color: var(--atlas-border-strong);
  transition: color 0.1s, transform 0.1s;
}
.score-edit .star.on { color: #f5efdf; }
.score-edit .star:hover { transform: scale(1.15); color: #ffffff; }

.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn {
  padding: 8px 14px;
  border-radius: 5px;
  border: 1px solid var(--atlas-border);
  background: var(--atlas-elevated);
  color: var(--atlas-text);
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--atlas-elevated-2); border-color: var(--atlas-border-strong); text-decoration: none; }
.btn.primary {
  background: var(--atlas-indigo);
  border-color: var(--atlas-indigo-deep);
  color: var(--atlas-bg);
}
.btn.primary:hover { background: var(--atlas-indigo-deep); color: var(--atlas-bg); }
.btn.danger { color: var(--atlas-coral); }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--atlas-indigo);
  color: var(--atlas-bg);
  padding: 12px 22px;
  border-radius: 6px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-family: var(--font-sans);
}

/* Back-to-top floating button */
.back-to-top {
  /* Stacked ABOVE the Magpy launcher button (which sits at bottom:18px right:18px,
     48×48px). Launcher is the canonical anchor — back-to-top is conditional and
     appears above it when relevant. Right edge aligned for vertical column. */
  position: fixed;
  bottom: 78px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border-strong);
  color: var(--atlas-text);
  cursor: pointer;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, background 0.12s, border-color 0.12s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--atlas-elevated-2);
  border-color: var(--atlas-text-2);
}
/* Hide back-to-top whenever an overlay is locking the page (mobile drawer, tablet/mobile detail).
   On full desktop (>1024px) detail is part of the layout, no lock, button stays usable. */
body.no-scroll .back-to-top {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}
@media (max-width: 768px) {
  .back-to-top { bottom: 70px; right: 14px; }
}
.toast.show { opacity: 1; }

/* Empty state — brutalist heavy-weight statement */
.empty {
  padding: 80px 20px;
  text-align: center;
  color: var(--atlas-muted);
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "opsz" 48, "wdth" 80;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.empty i {
  font-size: 56px;
  color: var(--atlas-border-strong);
  display: block;
  margin-bottom: 14px;
}

.muted { color: var(--atlas-muted); }
a { color: var(--atlas-indigo-soft); text-decoration: none; }
a:hover { color: var(--atlas-indigo); text-decoration: underline; }
.link-row { display: flex; flex-direction: column; gap: 6px; }
.link-row a {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 7px 11px;
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border);
  border-radius: 5px;
  font-size: 12px;
  color: var(--atlas-text-2);
  word-break: break-all;
  transition: border-color 0.12s, background 0.12s;
}
.link-row a:hover {
  background: var(--atlas-elevated-2);
  border-color: var(--atlas-indigo);
  color: var(--atlas-indigo-soft);
  text-decoration: none;
}

/* Dropdown */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: var(--atlas-surface);
  border: 1px solid var(--atlas-border);
  border-radius: 6px;
  padding: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: var(--atlas-text);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-sans);
  text-align: left;
  border-radius: 4px;
  width: 100%;
}
.dropdown-item:hover { background: var(--atlas-elevated); }
.dropdown-item i { color: var(--atlas-indigo-soft); }

/* Mobile filters trigger — visible only on small screens */
.mobile-filters-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border-strong);
  color: var(--atlas-text);
  width: 40px;
  height: 40px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 18px;
}
.mobile-filters-btn:hover { background: var(--atlas-elevated-2); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 40;
  backdrop-filter: blur(2px);
}
.app.sidebar-open .sidebar-backdrop { display: block; }

/* Sidebar close button: hidden on desktop, shown on mobile via @media below */
.sidebar-close { display: none; }

/* ==========================================================
   Responsive — tablet (≤1024px) + mobile (≤640px)
   ========================================================== */

@media (max-width: 1024px) {
  /* Detail panel: when open, becomes overlay full-right instead of pushing grid */
  .app, .app.detail-open { grid-template-columns: 280px 1fr 0; }
  .detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 480px;
    max-width: 100vw;
    height: 100vh;
    z-index: 45;
    transform: translateX(100%);
    transition: transform 0.2s ease-out, visibility 0s linear 0.2s, opacity 0s linear 0.2s;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
  }
  .app.detail-open .detail-panel {
    transform: translateX(0);
    transition: transform 0.2s ease-out;
  }

  /* Toolbar splits into two stacked rows at tablet width — same as mobile */
  .toolbar-main {
    display: block;
    padding: 0;
    background: transparent;
    border: 0;
  }
  .toolbar-search {
    padding: 12px 22px;
    background: var(--atlas-surface);
    border-bottom: 1px solid var(--atlas-border-strong);
    display: flex;
    gap: 10px;
    align-items: center;
  }
  .toolbar-search .search-wrap { flex: 1; min-width: 0; }
  .toolbar-actions {
    padding: 10px 22px;
    background: var(--atlas-surface);
    border-bottom: 1px solid var(--atlas-border-strong);
    gap: 8px;
  }
}

@media (max-width: 768px) {
  /* sidebar collapses into full-width drawer */
  .app, .app.detail-open { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s ease-out;
    border-right: none;
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }

  .sidebar .brand { padding-right: 46px; }

  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: var(--atlas-elevated);
    border: 1px solid var(--atlas-border-strong);
    color: var(--atlas-text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    z-index: 2;
    transition: background 0.12s, border-color 0.12s;
  }
  .sidebar-close:hover { background: var(--atlas-elevated-2); border-color: var(--atlas-text-2); }

  .mobile-filters-btn { display: inline-flex; }

  /* Mobile: stack search above actions in two distinct rows */
  .toolbar-main {
    display: block;
    padding: 0;
    background: transparent;
    border: 0;
  }
  .toolbar-search {
    padding: 10px 14px;
    background: var(--atlas-surface);
    border-bottom: 1px solid var(--atlas-border-strong);
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .toolbar-search .search-wrap { flex: 1; min-width: 0; }
  .toolbar-search input[type=text] { padding: 9px 36px; font-size: 13.5px; line-height: 1.15; }

  .toolbar-actions {
    padding: 9px 14px;
    background: var(--atlas-surface);
    border-bottom: 1px solid var(--atlas-border-strong);
    gap: 6px;
  }
  .toolbar-actions select, .toolbar-actions button {
    /* Mobile: padding 9px + font 13.5×1.15 + border 2 ≈ matches search input */
    font-size: 13.5px;
    padding: 9px 10px;
  }
  /* Compact: drop button labels, keep icons. Stats shows only the count. */
  .toolbar-actions .btn-label { display: none; }
  .toolbar-actions .stats { font-size: 12px; }
  .toolbar-actions .stats .stats-total,
  .toolbar-actions .stats .stats-noun,
  .toolbar-actions .stats .stats-hint { display: none; }
  .toolbar-actions select {
    padding-right: 26px;
    background-position: right 8px center;
    flex: 1 1 0;
    min-width: 0;
    text-overflow: ellipsis;
  }

  .active-filters {
    padding: 9px 14px;
  }

  .grid {
    padding: 12px 14px;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .card { min-height: 280px; }
  .card .name { font-size: 14px; }
  .card .body { padding: 10px 11px; }

  /* Detail panel: full-screen on phones */
  .detail-panel { width: 100vw; max-width: 100vw; }

  /* Letter strip: horizontal scroll, start from left so all letters reachable */
  .letter-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: flex-start;
    padding: 6px 12px;
    -webkit-overflow-scrolling: touch;
  }
  .letter-strip .letter { flex: 0 0 auto; min-width: 26px; }
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }
  .card { min-height: 240px; }
  .toolbar-search { padding: 8px 12px; }
  .toolbar-actions { padding: 7px 12px; gap: 5px; }
  .toolbar-actions button .ph-database, .toolbar-actions button .ph-file-csv { font-size: 14px; }
  .detail-header { padding: 14px 16px; }
  .detail-header h2 { font-size: 20px; }
  .tab-content { padding: 16px 16px; }
}

/* ---------- Context tabs (Brands / Designers) ---------- */
.context-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--atlas-border);
  margin-bottom: 8px;
}
.ctx-tab {
  background: transparent;
  border: none;
  color: var(--atlas-muted);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 8px 14px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}
.ctx-tab:hover { color: var(--atlas-text-2); }
.ctx-tab.active {
  color: var(--atlas-text);
  border-bottom-color: var(--atlas-text);
}
.ctx-tab .ctx-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--atlas-dim);
  background: var(--atlas-elevated);
  padding: 1px 7px;
  border-radius: 8px;
  letter-spacing: 0;
}
.ctx-tab.active .ctx-count {
  background: var(--atlas-elevated-2);
  color: var(--atlas-text-2);
}
.ctx-tab .ph { font-size: 15px; }

/* ---------- Designer card: photo cover-fit, native lazy <img> ----------
   Browsers natively defer fetching for <img loading="lazy"> until the image is
   near viewport. This is what keeps a 5000-card grid from melting your CPU. */
.card.designer .logo.designer-photo {
  background-color: #2a2421;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card.designer .designer-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card.designer.partner-collab {
  border-color: var(--atlas-emerald);
}

/* Sidebar h3 inline counter: smaller, compact, single-line */
.filter-section h3 .filter-counter {
  margin-left: 5px;
  font-size: 10px;
  font-weight: 400;
  color: var(--atlas-muted);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

/* ---------- Detail panel header in designer mode ----------
   Same dimensions and rounded-square shape as brand mode, but photo cover-fit
   with dark background instead of paper plate. */
.context-designers .detail-header img {
  width: 52px;
  height: 52px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--atlas-elevated-2);
  padding: 0;
}

/* ---------- Brand chip (clickable, used in designer detail) ---------- */
.brand-chips, .designer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.brand-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  padding: 3px 9px;
  background: var(--atlas-elevated);
  color: var(--atlas-text-2);
  border: 1px solid var(--atlas-border);
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.12s;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.005em;
}
a.brand-chip:hover {
  background: var(--atlas-elevated-2);
  border-color: var(--atlas-border-strong);
  color: var(--atlas-text);
  text-decoration: none;
}
.brand-chip.is-partner {
  border-color: rgba(138, 171, 142, 0.4);
  color: var(--atlas-emerald);
}
a.brand-chip.is-partner:hover {
  background: rgba(138, 171, 142, 0.10);
  border-color: var(--atlas-emerald);
}
.brand-chip.is-tracked {
  border-color: rgba(196, 165, 117, 0.35);
  color: var(--atlas-amber);
}
a.brand-chip.is-tracked:hover {
  background: rgba(196, 165, 117, 0.10);
  border-color: var(--atlas-amber);
}

/* ================== Map view (Leaflet + CARTO Dark Matter) ================== */
.map-view {
  width: 100%;
  background: var(--atlas-bg);
  flex: 1;
  min-height: 0;
}
.map-view[hidden] { display: none; }
/* When map is the active context, lock .main to viewport height so the flex
   children (topbar + map) compute against a real bound. Without this, .main
   inherits its natural content height (huge from the grid) and flex:1 on the
   map collapses to 0. Switching back to brands restores normal page scroll. */
body.context-map .main {
  height: 100vh;
  overflow: hidden;
}

/* Leaflet panes — make sure they sit under our header/sidebar overlays */
.leaflet-container {
  background: #0c0a09 !important; /* matches Carto dark base */
  font-family: var(--font-display);
  outline: none;
}
.leaflet-control-zoom {
  border: 1px solid var(--atlas-border) !important;
  border-radius: 6px !important;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.leaflet-control-zoom a {
  background: var(--atlas-elevated) !important;
  color: var(--atlas-text) !important;
  border: none !important;
  border-bottom: 1px solid var(--atlas-border) !important;
  width: 30px; height: 30px; line-height: 30px !important;
  font-size: 18px;
}
.leaflet-control-zoom a:last-child { border-bottom: none !important; }
.leaflet-control-zoom a:hover {
  background: var(--atlas-elevated-2) !important;
  color: var(--atlas-text) !important;
}
.leaflet-control-attribution {
  background: rgba(28, 24, 21, 0.85) !important;
  color: var(--atlas-dim) !important;
  font-size: 9px !important;
  padding: 2px 6px !important;
  border-radius: 3px;
}
.leaflet-control-attribution a {
  color: var(--atlas-muted) !important;
  text-decoration: none;
}

/* Atlas brand markers — small palette dots.
   Default brands stay subdued; partner/tracked are bumped in size + brightness
   so they pop above the dark CARTO basemap. The brighter shades only live
   here on the markers — the rest of the UI keeps the editorial desaturated palette. */
.atlas-marker {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--atlas-muted);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.55), 0 0 4px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.atlas-marker:hover {
  transform: scale(1.5);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.55), 0 0 14px rgba(255,255,255,0.3);
  z-index: 1000;
}
.atlas-marker.marker-default { background: var(--atlas-muted); }

/* Partner: brighter saturated emerald, larger radius, outer glow ring */
.atlas-marker.marker-partner {
  width: 16px;
  height: 16px;
  background: #5fc788;
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.6),
    0 0 0 4px rgba(95, 199, 136, 0.35),
    0 0 12px rgba(95, 199, 136, 0.55);
}
.atlas-marker.marker-partner:hover {
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.6),
    0 0 0 5px rgba(95, 199, 136, 0.5),
    0 0 18px rgba(95, 199, 136, 0.85);
}

/* Tracked: brighter saturated amber, slightly smaller than partner but bigger than default */
.atlas-marker.marker-tracked {
  width: 14px;
  height: 14px;
  background: #e8b765;
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.6),
    0 0 0 3px rgba(232, 183, 101, 0.32),
    0 0 10px rgba(232, 183, 101, 0.5);
}
.atlas-marker.marker-tracked:hover {
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.6),
    0 0 0 4px rgba(232, 183, 101, 0.5),
    0 0 16px rgba(232, 183, 101, 0.8);
}

/* Atlas cluster donut — SVG pie segmented by partner/tracked/default proportions */
.atlas-cluster {
  background: transparent !important;
}
.atlas-cluster-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.55));
  transition: transform 0.12s;
}
.atlas-cluster:hover .atlas-cluster-svg {
  transform: scale(1.08);
}
.atlas-cluster-count {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  fill: var(--atlas-text);
  letter-spacing: -0.02em;
}
/* Override default leaflet.markercluster CSS */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: transparent !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: transparent !important;
  color: var(--atlas-text) !important;
}

/* Hide loading "empty" overlay when map is the active view */
body.context-map .empty { display: none; }

/* Hide the letter-strip in map mode — irrelevant to map */
body.context-map .letter-strip { display: none; }

/* ========== Atlas map tooltip (hover preview: logo + name + location) ========== */
.leaflet-tooltip.atlas-tooltip {
  background: var(--atlas-elevated);
  border: 1px solid var(--atlas-border-strong);
  color: var(--atlas-text);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1.3;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  opacity: 1;
}
.leaflet-tooltip.atlas-tooltip::before {
  /* arrow tip */
  border-top-color: var(--atlas-border-strong) !important;
}
.leaflet-tooltip.atlas-tooltip.is-partner {
  border-color: var(--atlas-emerald);
}
.leaflet-tooltip.atlas-tooltip.is-partner::before {
  border-top-color: var(--atlas-emerald) !important;
}
.leaflet-tooltip.atlas-tooltip.is-tracked {
  border-color: var(--atlas-amber);
}
.leaflet-tooltip.atlas-tooltip.is-tracked::before {
  border-top-color: var(--atlas-amber) !important;
}
.atlas-tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 9px;
}
.atlas-tooltip .tt-logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  object-fit: contain;
  background: var(--atlas-paper);
  border-radius: 5px;
  padding: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.atlas-tooltip .tt-logo-fallback {
  background: var(--atlas-elevated-2);
  color: var(--atlas-muted);
  font-size: 20px;
}
.atlas-tooltip .tt-text { min-width: 0; }
.atlas-tooltip .tt-name {
  font-weight: 600;
  color: var(--atlas-text);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.atlas-tooltip .tt-loc {
  font-size: 10.5px;
  color: var(--atlas-muted);
  margin-top: 2px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.atlas-tooltip .tt-badge {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 1px 5px;
  border-radius: 2px;
}
.atlas-tooltip .tt-partner {
  background: rgba(138, 171, 142, 0.18);
  color: var(--atlas-emerald);
  border: 1px solid rgba(138, 171, 142, 0.35);
}
.atlas-tooltip .tt-tracked {
  background: rgba(196, 165, 117, 0.16);
  color: var(--atlas-amber);
  border: 1px solid rgba(196, 165, 117, 0.32);
}

/* ========== Contact info block (Sources tab in detail panel) ========== */
.contact-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.contact-row {
  font-size: 12.5px;
  color: var(--atlas-text-2);
  display: flex;
  align-items: flex-start;
  gap: 7px;
  line-height: 1.45;
}
.contact-row > .ph {
  font-size: 14px;
  color: var(--atlas-muted);
  flex-shrink: 0;
  margin-top: 2px;
}
/* Wrapping content slot: takes remaining width, breaks on long emails or slugs.
   Without min-width:0 a flex item refuses to shrink below intrinsic content size,
   forcing the parent to overflow horizontally — that was the scrollbar bug. */
.contact-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.contact-row a {
  color: var(--atlas-text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.12s;
}
.contact-row a:hover { border-bottom-color: var(--atlas-text-2); }
.contact-row code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: var(--atlas-elevated);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--atlas-amber);
}
