/* Tops Pizza Competition Tracker - Design System */
/* Accent derived from logo: #C8102E red, #F5A623 gold */

:root {
  --accent: #C8102E;
  --accent-light: #F5A623;
  --accent-hover: #A00D25;
  --bg: #F8FAFC;
  --bg-elevated: #FFFFFF;
  --bg-muted: #F1F5F9;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --success: #16A34A;
  --warning: #D97706;
  --error: #DC2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
}

[data-theme="dark"] {
  --bg: #0F172A;
  --bg-elevated: #1E293B;
  --bg-muted: #172033;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.sidebar-brand img { width: 40px; height: 40px; border-radius: var(--radius); }

.sidebar-brand h1 {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.sidebar-nav { flex: 1; padding: var(--space-4) var(--space-2); overflow-y: auto; }

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: var(--space-1);
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover, .nav-link.active {
  background: rgba(200, 16, 46, 0.08);
  color: var(--accent);
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: var(--space-6);
  max-width: 1400px;
  width: 100%;
  min-width: 0;
}

.page-header {
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: var(--space-2);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.mobile-header {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-close-btn {
  display: none;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
}

.sidebar-footer p {
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

.btn-block {
  width: 100%;
}

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.card-title { font-size: 1rem; font-weight: 600; }

.card-header-stack {
  align-items: flex-start;
}

.card-header-stack .card-subtitle {
  margin-top: 4px;
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow);
}

.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8125rem; color: var(--text-muted); margin-top: var(--space-1); }

/* Forms */
.search-hero {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  max-width: 640px;
  margin: 0 auto var(--space-8);
}

.search-hero h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.search-hero p { color: var(--text-muted); margin-bottom: var(--space-6); }

.search-form {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-1);
  box-shadow: var(--shadow-lg);
  width: 100%;
}

.search-form input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  color: var(--text);
  outline: none;
}

.search-form input:-webkit-autofill,
.search-form input:-webkit-autofill:hover,
.search-form input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg-elevated) inset;
  -webkit-text-fill-color: var(--text);
}

.search-form .btn {
  flex-shrink: 0;
  align-self: center;
  margin-right: 2px;
}

.search-input-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}

.search-input-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding-right: 88px;
}

.search-location-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 2;
}

.search-location-btn:hover:not(:disabled) {
  border-color: rgba(200, 16, 46, 0.35);
  color: var(--accent);
}

.search-location-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.search-location-msg {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

.search-location-msg.is-error {
  color: var(--error);
}

.search-hero-alt {
  margin-top: 14px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.search-hero-alt a {
  font-weight: 600;
}

.search-method-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.search-method-hints span {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
}

/* Franchise check */
.franchise-check-layout {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr;
  gap: var(--space-4);
  align-items: start;
}

.franchise-coverage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.franchise-coverage-list li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.franchise-coverage-name {
  flex: 1;
  font-size: 0.8125rem;
}

.franchise-search-card {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
}

.franchise-search-form.search-form {
  display: flex;
  align-items: stretch;
}

.franchise-search-form .search-input-wrap {
  flex: 1;
}

.franchise-radius-inline {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: var(--space-2);
  margin-left: var(--space-1);
}

.franchise-radius-inline input {
  width: 52px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  outline: none;
}

.franchise-radius-inline .franchise-radius-unit {
  display: flex;
  align-items: center;
  padding-right: var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.franchise-search-card .franchise-radius-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: var(--space-3);
}

.franchise-search-error {
  margin-top: var(--space-2);
  margin-bottom: 0;
}

.franchise-coverage-heading {
  margin: var(--space-3) 0 var(--space-2);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.franchise-coverage-heading:first-of-type {
  margin-top: 0;
}

.franchise-page-header {
  margin-bottom: var(--space-4);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.franchise-radius-chip {
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.franchise-radius-chip:hover {
  border-color: rgba(200, 16, 46, 0.35);
  color: var(--accent);
}

.franchise-radius-chip.is-active {
  background: rgba(200, 16, 46, 0.12);
  border-color: rgba(200, 16, 46, 0.45);
  color: var(--accent);
}

.franchise-radius-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}

.franchise-radius-field label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.franchise-radius-field select {
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

.franchise-map-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.franchise-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.franchise-map-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.franchise-map-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
}

.franchise-map-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.franchise-map {
  height: 420px;
  width: 100%;
}

.store-map-header {
  margin-bottom: var(--space-4);
}

.store-map-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: var(--space-4);
  align-items: start;
}

.store-map-filters {
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.store-map-card {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 180px);
}

.store-map-toolbar {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.store-map-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.store-map {
  flex: 1;
  min-height: 520px;
  width: 100%;
}

.brand-detail-header {
  margin-bottom: 24px;
}

.brand-map-card {
  margin-bottom: 24px;
  padding: var(--space-4);
}

.brand-map-toolbar {
  margin-bottom: var(--space-3);
}

.brand-map-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.brand-map {
  height: min(52vh, 520px);
  min-height: 320px;
  width: 100%;
  border-radius: var(--radius);
}

.brand-outlets-card {
  margin-bottom: 24px;
}

.store-profile-kicker {
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.store-profile-kicker a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.store-profile-details {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0 var(--space-4) var(--space-4);
}

.store-profile-details div {
  display: grid;
  gap: 4px;
}

.store-profile-details dt {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.store-profile-details dd {
  margin: 0;
}

.store-profile-back {
  margin: 0;
  padding: 0 var(--space-4) var(--space-4);
  font-size: 0.875rem;
}

.store-map-toggle,
.store-map-brand-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  padding: var(--space-1) 0;
  cursor: pointer;
}

.store-map-brand-row {
  padding: 6px 0;
}

.store-map-option-row {
  padding-left: 2px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.store-map-legend-key {
  margin: 0 0 var(--space-3);
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.store-map-legend-icon {
  --brand-colour: #64748B;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 2px var(--brand-colour), 0 1px 4px rgba(15, 23, 42, 0.28);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.store-map-legend-icon-tops {
  box-shadow: 0 0 0 2px var(--brand-colour), 0 0 0 4px rgba(200, 16, 46, 0.15), 0 1px 4px rgba(15, 23, 42, 0.28);
}

.store-map-legend-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
  display: block;
}

.store-map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-colour);
  display: block;
}

[data-theme="dark"] .store-map-legend-icon {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.85);
}

.store-map-brand-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--space-2);
}

.store-map-brand-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-map-brand-count {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin-left: auto;
  flex-shrink: 0;
}

.store-map-filter-heading {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

.store-map-filter-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: 1.4;
}

.store-map-count-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.store-map-brand-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.store-map-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-3) 0;
}

.store-map-status {
  margin-top: var(--space-4);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Store map pins and clusters */
.store-map-pin-wrap {
  background: transparent !important;
  border: none !important;
}

.store-map-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
}

.store-map-dot-lg {
  width: 10px;
  height: 10px;
}

.store-map-dot-tops {
  background: var(--accent);
  width: 9px;
  height: 9px;
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.25), 0 1px 4px rgba(15, 23, 42, 0.35);
}

.store-map-logo-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.store-map-logo-shell-tops {
  border-color: rgba(200, 16, 46, 0.55);
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.18), 0 2px 8px rgba(15, 23, 42, 0.28);
}

.store-map-logo-mini {
  width: 16px;
  height: 16px;
}

.store-map-logo-compact {
  width: 22px;
  height: 22px;
}

.store-map-logo-full {
  width: 26px;
  height: 26px;
}

.store-map-logo-shell-tops.store-map-logo-mini { width: 18px; height: 18px; }
.store-map-logo-shell-tops.store-map-logo-compact { width: 24px; height: 24px; }
.store-map-logo-shell-tops.store-map-logo-full { width: 30px; height: 30px; }

.store-map-logo-img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  display: block;
}

.store-map-cluster {
  background: transparent !important;
  border: none !important;
}

.store-map-cluster-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.35);
}

.store-map-cluster-md .store-map-cluster-bubble {
  font-size: 0.8125rem;
}

.store-map-cluster-lg .store-map-cluster-bubble {
  font-size: 0.875rem;
  background: rgba(200, 16, 46, 0.92);
}

[data-theme="dark"] .store-map-cluster-bubble {
  background: rgba(30, 41, 59, 0.94);
  border-color: rgba(255, 255, 255, 0.85);
}

[data-theme="dark"] .store-map-cluster-lg .store-map-cluster-bubble {
  background: rgba(200, 16, 46, 0.95);
}

[data-theme="dark"] .store-map-logo-shell {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.75);
}

#store-map .marker-cluster-spider-leg line {
  stroke: rgba(100, 116, 139, 0.55);
  stroke-width: 1.5;
}

.map-popup-brand {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.map-popup-address {
  font-size: 0.8125rem;
  margin-top: 4px;
}

.map-popup-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.brand-reports-map-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.brand-reports-map-link:hover {
  text-decoration: underline;
}

.brand-reports-form-row-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

@media (max-width: 768px) {
  .brand-reports-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-reports-field,
  .brand-reports-field-grow {
    width: 100%;
    min-width: 0;
  }

  .brand-reports-form-row-secondary {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-reports-buttons {
    width: 100%;
    flex-direction: column;
  }

  .brand-reports-buttons .btn {
    width: 100%;
  }

  .brand-reports-table-wrap {
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    border-radius: 0;
  }

  .brand-reports-modal-panel {
    width: 100%;
    max-width: none;
    max-height: 92vh;
    margin: var(--space-3);
    border-radius: var(--radius);
  }

  .brand-reports-store-main {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
}

@media (max-width: 960px) {
  .store-map-layout {
    grid-template-columns: 1fr;
  }

  .store-map-filters {
    max-height: none;
  }

  .store-map-card {
    min-height: 420px;
  }

  .store-map {
    min-height: 420px;
  }
}

.franchise-search-marker {
  background: transparent;
  border: none;
}

.franchise-search-marker-dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #C8102E;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.search-suggestion-item span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.franchise-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.franchise-pick-item {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-muted);
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
}

.franchise-pick-item:hover {
  background: rgba(200, 16, 46, 0.08);
  color: var(--accent);
}

.franchise-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
}

.franchise-brand-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.franchise-brand-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  overflow: hidden;
}

.franchise-brand-card.is-present {
  border-color: rgba(22, 163, 74, 0.28);
  background: rgba(22, 163, 74, 0.05);
}

.franchise-brand-card.is-absent {
  opacity: 0.82;
}

.franchise-brand-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.franchise-brand-card.is-present .franchise-brand-card-head {
  background: rgba(22, 163, 74, 0.08);
}

.franchise-brand-card-title {
  flex: 1;
  min-width: 0;
}

.franchise-brand-card-title h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 2px;
}

.franchise-brand-card-count {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.franchise-brand-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(200, 16, 46, 0.1);
  border-radius: 999px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.franchise-store-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.franchise-store-item {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}

.franchise-store-item:first-child {
  border-top: none;
}

.franchise-store-item-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.franchise-store-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.franchise-store-distance {
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  flex-shrink: 0;
}

.franchise-store-address {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.franchise-store-source {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.franchise-brand-empty {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.franchise-brand-note {
  margin: 0;
  padding: 0 var(--space-4) var(--space-3);
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.franchise-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.franchise-summary-pill {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
}

.franchise-summary-pill strong {
  color: var(--text);
}

.franchise-results-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.franchise-rescan-bar {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--bg-muted);
  border: 1px solid var(--border);
}

.franchise-rescan-label {
  margin: 0 0 var(--space-2);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.franchise-rescan-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.franchise-radius-inline-results {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding-left: 0;
  margin-left: 0;
  border-left: 0;
}

.franchise-radius-inline-results input {
  width: 56px;
  min-height: 40px;
  text-align: center;
}

.franchise-rescan-presets {
  margin-top: 0;
}

.franchise-rescan-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.franchise-results-card.is-refreshing {
  opacity: 0.92;
}

.franchise-results-card.is-refreshing .franchise-brand-results {
  pointer-events: none;
}

.franchise-result-card {
  border-radius: var(--radius);
  padding: var(--space-4);
  border: 1px solid var(--border);
  background: var(--bg-muted);
}

.franchise-result-card.is-present {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.25);
}

.franchise-result-card.is-absent {
  opacity: 0.88;
}

.franchise-result-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.franchise-result-logo,
.franchise-result-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: contain;
}

.franchise-result-top h3 {
  font-size: 0.9375rem;
  margin: 0;
}

.franchise-result-status {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.franchise-result-card.is-present .franchise-result-status {
  color: var(--success);
}

.franchise-result-distance {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.franchise-result-address {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.franchise-results-foot {
  margin-top: var(--space-4);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.franchise-results-card {
  padding: var(--space-4);
}

.brand-reports-filters {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
}

.brand-reports-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
  margin-bottom: var(--space-3);
}

.brand-reports-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.brand-reports-field-grow {
  flex: 1;
  min-width: 200px;
}

.brand-reports-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.brand-reports-field select,
.brand-reports-field input {
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.9375rem;
}

.brand-reports-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.brand-reports-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.brand-reports-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-reports-table-wrap {
  max-height: 520px;
  overflow: auto;
}

.brand-reports-table {
  font-size: 0.8125rem;
}

.brand-reports-table th {
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
}

.brand-reports-foot,
.brand-reports-empty {
  padding: var(--space-3) var(--space-4);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.brand-reports-async-hint {
  margin: var(--space-3) 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.brand-reports-export-banner {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
}

.brand-reports-export-running,
.brand-reports-export-ready,
.brand-reports-export-error {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.brand-reports-export-running {
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-3);
}

.brand-reports-export-note {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.brand-reports-cell-clickable {
  text-align: center;
}

.brand-reports-count-btn {
  appearance: none;
  border: none;
  background: rgba(200, 16, 46, 0.08);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 2px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.brand-reports-count-btn:hover {
  background: rgba(200, 16, 46, 0.16);
}

.brand-reports-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.brand-reports-modal[hidden] {
  display: none;
}

body.brand-reports-modal-open {
  overflow: hidden;
}

.brand-reports-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.brand-reports-modal-panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(80vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.brand-reports-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.brand-reports-modal-header h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.brand-reports-modal-subtitle {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.brand-reports-modal-close {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.brand-reports-modal-body {
  padding: var(--space-4);
  overflow-y: auto;
}

.brand-reports-store-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.brand-reports-store-item {
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--bg-muted);
}

.brand-reports-store-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.brand-reports-store-brand {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.brand-reports-store-address,
.brand-reports-store-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.brand-reports-store-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.brand-reports-modal-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.account-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.account-settings-form .form-group input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.account-settings-check,
.register-notify-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.875rem;
}

.account-settings-check input,
.register-notify-check input {
  margin-top: 3px;
}

.account-settings-note,
.register-notify-note {
  margin: 12px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.register-notify-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
}

.register-notify-fieldset legend {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 4px;
}

.account-settings-messages {
  margin-bottom: var(--space-4);
}

.account-settings-message {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
  font-size: 0.875rem;
}

.login-log-agent {
  max-width: 280px;
  overflow-wrap: anywhere;
  font-size: 0.75rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .account-settings-grid {
    grid-template-columns: 1fr;
  }
}

.franchise-coverage-card {
  position: sticky;
  top: var(--space-4);
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  list-style: none;
  z-index: 300;
  max-height: 280px;
  overflow-y: auto;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}

.search-suggestion-item:last-child { border-bottom: none; }
.search-suggestion-item:hover { background: rgba(200, 16, 46, 0.06); }

.search-suggestion-tag {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* Tops map marker */
.tops-marker-wrap {
  background: transparent !important;
  border: none !important;
}

.tops-marker-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.tops-marker-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: rgba(200, 16, 46, 0.25);
  border: 2px solid rgba(200, 16, 46, 0.5);
  animation: tops-pulse 2s ease-out infinite;
  z-index: 1;
}

@keyframes tops-pulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  70% { transform: scale(1.15); opacity: 0.2; }
  100% { transform: scale(1.2); opacity: 0; }
}

.competitor-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.distance-label-icon { background: transparent !important; border: none !important; }

.distance-tag {
  display: inline-block;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

[data-theme="dark"] .distance-tag {
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.map-detail-panel { max-height: 360px; overflow-y: auto; }

.brand-toggle-list { display: flex; flex-direction: column; gap: 4px; }

.brand-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8125rem;
}

.brand-toggle-row:hover { background: rgba(200, 16, 46, 0.05); }

.brand-toggle-master {
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 4px;
  font-weight: 600;
}

.brand-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-toggle-logo, .brand-table-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 4px;
  vertical-align: middle;
}

.brand-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  min-width: 0;
}

.brand-card-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-card-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-map-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  background: white;
  display: block;
}

.brand-marker-wrap {
  background: transparent !important;
  border: none !important;
}

.brand-total-row.brand-absent td { opacity: 0.55; }

.brand-total-row.highlight td {
  background: rgba(245, 166, 35, 0.12);
}

.brand-total-clickable { cursor: pointer; }

.brand-total-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
}

.brand-total-num { white-space: nowrap; text-align: center; }

.brand-total-action { white-space: nowrap; text-align: right; }

.brand-not-here { color: var(--text-muted); font-size: 0.8125rem; }

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

.brand-compare-panel { margin-top: var(--space-4); }

.compare-from-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.compare-table td, .brand-totals-table td { vertical-align: middle; }

.brand-totals-wrap { max-height: 420px; overflow-y: auto; }

.brand-totals-table th:nth-child(n+2):nth-child(-n+4),
.brand-totals-table td:nth-child(n+2):nth-child(-n+4) {
  text-align: center;
  width: 72px;
}

.brand-totals-table .btn-compare-brand {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.brand-compare-panel .btn-secondary,
.brand-compare-panel #compare-close {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.brand-toggle-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
}

.brand-toggle-row input { display: none; }

.toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.brand-toggle-row input:checked + .toggle-switch {
  background: var(--accent);
}

.brand-toggle-row input:checked + .toggle-switch::after {
  transform: translateX(16px);
}

@media (prefers-reduced-motion: reduce) {
  .tops-marker-pulse { animation: none; opacity: 0.4; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover { background: var(--bg); }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th { font-weight: 600; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

tr:hover td { background: rgba(200, 16, 46, 0.04); }

tr.highlight td { background: rgba(245, 166, 35, 0.12); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  border: none;
}

.badge-success { background: rgba(22, 163, 74, 0.14); color: var(--success); }
.badge-warning { background: rgba(217, 119, 6, 0.14); color: var(--warning); }
.badge-error { background: rgba(220, 38, 38, 0.14); color: var(--error); }
.badge-scanning { background: rgba(59, 130, 246, 0.14); color: #2563eb; }

/* Map */
.area-map-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.map-container-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-elevated);
}

.map-container-wrap:fullscreen,
.map-container-wrap:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

.map-container-wrap:fullscreen .map-stage,
.map-container-wrap:-webkit-full-screen .map-stage {
  flex: 1;
  width: 100%;
  height: auto;
  min-height: 0;
}

.map-container-wrap:fullscreen #map,
.map-container-wrap:-webkit-full-screen #map {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  background: #e2e8f0;
}

[data-theme="dark"] .map-container-wrap:fullscreen #map,
[data-theme="dark"] .map-container-wrap:-webkit-full-screen #map {
  background: #1e293b;
}

.map-stage {
  position: relative;
  flex: 1;
  min-width: 0;
}

#map {
  width: 100%;
  height: min(65vh, 720px);
  min-height: 420px;
  z-index: 1;
  background: #e2e8f0;
}

[data-theme="dark"] #map {
  background: #1e293b;
}

.map-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-toolbar-btn {
  padding: 7px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.map-toolbar-btn:hover {
  background: var(--bg-muted);
}

.map-toolbar-btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.map-toolbar-btn-primary:hover {
  filter: brightness(1.05);
}

.map-container-wrap:fullscreen .map-toolbar {
  z-index: 1001;
}

.map-container-wrap:fullscreen .map-float-panel,
.map-container-wrap:-webkit-full-screen .map-float-panel {
  z-index: 1002;
}

.map-container-wrap:fullscreen .map-float-inner,
.map-container-wrap:-webkit-full-screen .map-float-inner {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}

.map-float-panel {
  position: absolute;
  z-index: 650;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.map-float-panel[data-state="open"],
.map-float-panel[data-state="minimized"] {
  pointer-events: auto;
  opacity: 1;
  transform: none;
}

.map-float-panel[data-state="closed"] {
  display: none;
}

.map-float-panel[data-position="right"] {
  top: 52px;
  right: 12px;
  bottom: 12px;
  width: min(360px, calc(100% - 24px));
}

.map-float-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.map-float-panel[data-state="minimized"] .map-float-inner {
  display: none;
}

.map-float-tab {
  display: none;
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.map-float-panel[data-state="minimized"] .map-float-tab {
  display: inline-flex;
}

.map-float-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.map-float-header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.map-float-back {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.map-float-back:hover {
  text-decoration: underline;
}

.map-float-tools {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.map-float-tool {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  cursor: pointer;
}

.map-float-tool:hover {
  background: var(--bg-elevated);
}

.map-float-tool-danger {
  color: var(--accent);
  border-color: rgba(200, 16, 46, 0.35);
}

.map-float-brands-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.map-float-brand-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(280px, 40vh);
  overflow-y: auto;
}

.map-float-brand-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  cursor: pointer;
  font-size: 0.8125rem;
  text-align: left;
}

.map-float-brand-btn:hover,
.map-float-brand-btn.is-active {
  background: rgba(200, 16, 46, 0.08);
  border-color: rgba(200, 16, 46, 0.35);
}

.map-float-view {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.map-float-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.map-float-download {
  text-decoration: none;
}

.compare-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.compare-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  font-size: 0.8125rem;
}

.compare-options {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 0;
}

.compare-options legend {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 4px;
}

.compare-option-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8125rem;
  margin-top: 6px;
  cursor: pointer;
}

.compare-option-row input {
  margin-top: 3px;
}

.compare-calculate-btn {
  width: 100%;
  justify-content: center;
}

.compare-results-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.compare-results-actions .btn {
  flex: 1;
  min-width: 120px;
  justify-content: center;
}

.compare-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.compare-loading-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: compare-spin 0.8s linear infinite;
}

@keyframes compare-spin {
  to { transform: rotate(360deg); }
}

.limitations-list {
  margin: 0;
  padding: 0 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.limitations-list strong {
  color: var(--text);
}

.data-limitations-card {
  margin-top: var(--space-2);
}

.compare-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.area-map-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.area-controls-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: var(--space-4);
  align-items: start;
}

.area-control-card {
  height: 100%;
}

.area-control-card .brand-toggle-list {
  max-height: 420px;
  overflow-y: auto;
}

/* Opportunity card */
.opportunity-card {
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.4);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.opportunity-card h3 { color: var(--warning); font-size: 1rem; margin-bottom: var(--space-2); }

/* Store presence */
.store-yes {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.3);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.store-no {
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.4);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

/* Brand swatch */
.brand-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-right: var(--space-2);
}

/* News feed */
.news-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.news-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.news-card-link:hover .news-card,
.news-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(200, 16, 46, 0.25);
  transform: translateY(-1px);
}

.news-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: var(--space-2);
}

.news-brand-bar {
  width: 4px;
  height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}

.news-brand-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.news-brand-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.news-external {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 700;
}

.news-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
  margin: 0 0 var(--space-2);
  color: var(--text);
  overflow-wrap: anywhere;
}

.news-card-link:hover .news-title {
  color: var(--accent);
}

.news-summary {
  margin: 0 0 var(--space-3);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.news-meta-sep {
  opacity: 0.5;
}

.badge-news {
  font-size: 0.6875rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  border: none;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* News dashboard layout */
.news-dashboard {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr;
  gap: var(--space-4);
  align-items: start;
}

.news-sidebar {
  position: sticky;
  top: var(--space-4);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: var(--space-4);
}

.news-sidebar-section + .news-sidebar-section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.news-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.news-filter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.news-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-size: 0.8125rem;
  transition: background 0.15s ease;
}

.news-filter-item:hover {
  background: var(--bg-muted);
}

.news-filter-item.is-active {
  background: rgba(200, 16, 46, 0.08);
  color: var(--accent);
  font-weight: 600;
}

.news-filter-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}

img[src*="/brands/caprinos"] {
  border-radius: 6px;
  object-fit: contain;
}

.franchise-result-logo[src*="/brands/caprinos"],
.franchise-coverage-list img[src*="/brands/caprinos"] {
  border-radius: 6px;
}

.news-filter-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
}

.news-filter-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-filter-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.news-filter-item.is-active .news-filter-count {
  background: rgba(200, 16, 46, 0.12);
  color: var(--accent);
}

.news-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.news-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--bg-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.news-chip:hover {
  color: var(--text);
}

.news-chip.is-active {
  background: rgba(200, 16, 46, 0.12);
  color: var(--accent);
  font-weight: 600;
}

.news-chip-count {
  opacity: 0.8;
  font-size: 0.6875rem;
}

.news-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding: var(--space-4);
}

.news-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.news-brand-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}

.news-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-3);
}

.news-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.news-tag-openings { background: rgba(22, 163, 74, 0.14); color: var(--success); }
.news-tag-closures { background: rgba(220, 38, 38, 0.14); color: var(--error); }
.news-tag-expansion { background: rgba(59, 130, 246, 0.14); color: #2563eb; }
.news-tag-franchise-news { background: rgba(217, 119, 6, 0.14); color: var(--warning); }
.news-tag-menu { background: rgba(168, 85, 247, 0.14); color: #9333ea; }
.news-tag-leadership { background: rgba(100, 116, 139, 0.16); color: var(--text-muted); }
.news-tag-marketing { background: rgba(200, 16, 46, 0.12); color: var(--accent); }
.news-tag-positive { background: rgba(22, 163, 74, 0.14); color: var(--success); }
.news-tag-negative { background: rgba(220, 38, 38, 0.14); color: var(--error); }
.news-tag-neutral { background: var(--bg-muted); color: var(--text-muted); }
.news-tag-sentiment { text-transform: capitalize; }

.news-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* Health strip */
.health-strip {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-6);
}

.news-feed-status {
  margin-top: 10px;
}

.news-feed-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-muted);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.news-main-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.intelligence-logs-panel {
  margin-top: var(--space-4);
}

.intelligence-logs-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: var(--space-4);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.intelligence-logs-summary::-webkit-details-marker {
  display: none;
}

.intelligence-logs-hint {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
}

.intelligence-logs-body {
  padding: 0 var(--space-4) var(--space-4);
}

.intelligence-logs-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--space-3);
}

.intelligence-logs-input {
  flex: 1;
  min-width: 220px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.intelligence-logs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.intelligence-log-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--bg-muted);
  font-size: 0.8125rem;
}

.intelligence-log-label {
  font-weight: 600;
  color: var(--text);
}

.intelligence-log-meta {
  grid-column: 2;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.intelligence-logs-empty {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.health-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-muted);
  border-radius: 999px;
  max-width: 100%;
}

.health-item-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.health-dot.green { background: var(--success); }
.health-dot.amber { background: var(--warning); }
.health-dot.red { background: var(--error); }

/* Theme toggle */
.theme-toggle {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: 200;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-card img { width: 64px; margin-bottom: var(--space-4); }

.login-card h1 { font-size: 1.25rem; margin-bottom: var(--space-6); }

.form-group { margin-bottom: var(--space-4); text-align: left; }

.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: var(--space-1); }

.form-group input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.form-group input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, transparent 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  height: 1rem;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-stat {
  display: inline-block;
  width: 48px;
  height: 1.75rem;
}

.skeleton-line {
  display: block;
  width: 100%;
  height: 0.875rem;
  margin-bottom: 8px;
}

.skeleton-line.short {
  width: 60%;
}

.area-progress {
  margin-bottom: var(--space-4);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  display: none;
}

.area-progress.is-visible {
  display: block;
}

.area-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 0.875rem;
}

.area-progress-label {
  font-weight: 600;
}

.area-progress-text {
  color: var(--text-muted);
}

.area-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
  margin-bottom: 10px;
}

.area-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.35s ease;
}

.area-progress-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

#area-live-content.is-loading .area-map-section {
  opacity: 0.72;
}

.search-loading {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.search-loading.is-visible {
  display: flex;
}

.store-skeleton {
  padding: 12px 0 4px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-8);
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    position: sticky;
    top: 0;
    z-index: 120;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 600;
  }

  .mobile-brand img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .mobile-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-menu-btn,
  .mobile-theme-btn {
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--bg-muted);
    color: var(--text);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 140;
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  body.menu-open {
    overflow: hidden;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 150;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-brand {
    position: relative;
    padding-right: 48px;
  }

  .sidebar-close-btn {
    display: inline-flex;
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    border: 1px solid var(--border);
    background: var(--bg-muted);
    color: var(--text);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
  }

  .main-content {
    margin-left: 0;
    padding: var(--space-4);
    max-width: none;
  }

  .theme-toggle {
    display: none;
  }

  .search-hero {
    padding: var(--space-6) 0 var(--space-4);
    text-align: left;
  }

  .search-hero h2 {
    font-size: 1.375rem;
  }

  .search-form {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-2);
  }

  .search-form .btn {
    width: 100%;
    margin-right: 0;
    align-self: stretch;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .area-controls-grid { grid-template-columns: 1fr; }
  .news-grid-two { grid-template-columns: 1fr; }
  .news-dashboard {
    grid-template-columns: 1fr;
  }
  .franchise-check-layout {
    grid-template-columns: 1fr;
  }
  .franchise-search-form.search-form {
    flex-direction: column;
    align-items: stretch;
  }
  .franchise-radius-inline {
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
    margin-top: var(--space-1);
    justify-content: flex-end;
  }
  .franchise-search-form .btn {
    width: 100%;
    margin-right: 0;
  }
  .franchise-rescan-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .franchise-rescan-controls .btn {
    width: 100%;
  }
  .franchise-search-submit-wrap .franchise-search-submit-label {
    display: none;
  }
  .franchise-search-btn {
    width: 100%;
  }
  .franchise-summary-bar {
    justify-content: flex-start;
  }
  .franchise-coverage-card {
    position: static;
  }
  .news-main-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .news-main-actions {
    width: 100%;
  }
  .news-main-actions .btn {
    flex: 1;
  }
  .intelligence-log-row {
    grid-template-columns: auto 1fr;
  }
  #map { height: min(50vh, 420px); min-height: 320px; }

  table {
    font-size: 0.8125rem;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .recent-area-cell {
    max-width: 180px;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .sidebar, .theme-toggle, .btn { display: none; }
  .main-content { margin-left: 0; }
}
