* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100vh;
  overflow: hidden;
  background: #f0f2f5;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ── Banner ── */
#banner {
  flex-shrink: 0;
  line-height: 0;
  background: #042C53;
}
#banner-img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── App body ── */
#app-body { display: flex; flex: 1; min-height: 0; }

/* ── Data attribution bar ── */
#data-attribution {
  flex-shrink: 0;
  background: #0f172a;
  color: #94a3b8;
  font-size: 10.5px;
  line-height: 1;
  padding: 5px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}
#data-attribution #attr-label {
  font-weight: 600;
  color: #cbd5e1;
  margin-right: 2px;
}
#data-attribution .attr-sep {
  color: #475569;
  user-select: none;
}
#data-attribution a {
  color: #7dd3fc;
  text-decoration: none;
}
#data-attribution a:hover {
  color: #bae6fd;
  text-decoration: underline;
}
@media (max-width: 820px) {
  #data-attribution {
    font-size: 9.5px;
    padding: 4px 8px;
  }
}

/* ── MAP ── */
#map-container { flex: 1; position: relative; min-width: 0; }
#map { width: 100%; height: 100%; }

#map-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  padding: 9px 18px;
  border-radius: 24px;
  font-size: 13px;
  pointer-events: none;
  z-index: 1000;
  transition: opacity 0.4s;
  white-space: nowrap;
}
#map-hint.hidden { opacity: 0; }

/* ── PANEL ── */
#panel {
  width: 420px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -3px 0 24px rgba(0,0,0,0.10);
  overflow: hidden;
}

#panel-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #fff;
  padding: 20px 24px 18px;
  flex-shrink: 0;
  position: relative;
}

/* ── Language toggle ── */
#lang-toggle-wrap {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}
#lang-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.30);
  border-radius: 20px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.5px;
  transition: background 0.2s;
}
#lang-toggle:hover { background: rgba(255,255,255,0.25); }
.lang-opt { transition: color 0.2s; }
.lang-opt.active { color: #fff; }
.lang-sep { color: rgba(255,255,255,0.35); margin: 0 2px; }
#panel-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
#panel-header p  { font-size: 13px; opacity: 0.80; margin-top: 3px; }
#dev-credit { font-size: 11px; opacity: 0.65; margin-top: 5px; }
#dev-credit a { color: #93c5fd; text-decoration: none; }
#dev-credit a:hover { text-decoration: underline; }
#copyright { font-size: 10px; opacity: 0.50; margin-top: 3px; }
#disclaimer-footer {
  font-size: 10px;
  color: #6b7280;
  line-height: 1.5;
  padding: 8px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  flex-shrink: 0;
}

/* ── FORM ── */
#panel-form {
  padding: 18px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

#location-display {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 9px 13px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: #1e40af;
  font-weight: 500;
}
#location-display.hidden { display: none; }

.form-group { margin-bottom: 10px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
}
.form-group input {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.quick-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}
.chip-group { border-bottom: 1px solid #f3f4f6; }
.chip-group:last-child { border-bottom: none; }
.chip-category-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #4b5563;
  padding: 5px 2px 4px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.chip-category-label:hover { color: #2563eb; }
.chip-chevron {
  font-size: 13px;
  transition: transform 0.2s ease;
  transform: rotate(-90deg);
  color: #9ca3af;
}
.chip-group.open .chip-chevron { transform: rotate(0deg); }
.chip-group-body {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  overflow: hidden;
  max-height: 0;
  padding-bottom: 0;
  transition: max-height 0.25s ease, padding-bottom 0.25s ease;
}
.chip-group.open .chip-group-body {
  max-height: 600px;
  padding-bottom: 7px;
}
.chip {
  padding: 4px 11px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chip:hover  { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.chip.active { background: #2563eb; border-color: #2563eb; color: #fff; }

#analyze-btn {
  width: 100%;
  padding: 11px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  position: sticky;
  bottom: 0;
  z-index: 10;
}
#analyze-btn:hover:not(:disabled) {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,0.30);
}
#analyze-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
#analyze-btn.loading { background: #6366f1; cursor: wait; }

/* ── RESULTS ── */
#results {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 24px;
}
#results.hidden { display: none; }

#export-btn {
  display: block;
  width: calc(100% - 48px);
  margin: 12px 24px 20px;
  padding: 10px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  flex-shrink: 0;
}
#export-btn:hover:not(:disabled) {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5,150,105,0.30);
}
#export-btn:disabled { background: #9ca3af; cursor: wait; transform: none; }
#export-btn.btn-locked { background: #d1d5db; color: #6b7280; cursor: pointer; opacity: 0.75; }
#export-btn.btn-locked:hover { background: #c4c9d4; opacity: 0.9; transform: none; box-shadow: none; }
#export-btn.hidden { display: none; }

/* ── Results toolbar ── */
#results-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}
#expand-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 15px;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#expand-btn:hover { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }

/* ── Expanded (fullscreen) report overlay ── */
#panel.expanded {
  position: fixed;
  inset: 0;
  width: 100%;
  min-width: unset;
  z-index: 2000;
  box-shadow: none;
}
#panel.expanded #results {
  font-size: 15px;
  padding: 24px 10% 40px;
  max-width: 860px;
  margin: 0 auto;
}
#panel.expanded #results-content { font-size: 15px; line-height: 1.75; }
#panel.expanded #results-content h3 { font-size: 16.5px; }
#panel.expanded #revenue-chart-container { margin: 8px 10% 20px; max-width: 860px; }
#panel.expanded #revenue-chart { height: 220px !important; }
#panel.expanded #export-btn { width: auto; margin: 12px 10% 24px; padding: 10px 28px; }
#panel.expanded #expand-btn { font-size: 17px; }
#panel.expanded #panel-form,
#panel.expanded #disclaimer-footer { display: none; }

/* ── Revenue chart ── */
#revenue-chart-container {
  margin: 4px 24px 16px;
  background: #f8faff;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 14px 16px 12px;
  flex-shrink: 0;
}
#revenue-chart-container.hidden { display: none; }
#revenue-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
#revenue-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e3a8a;
}
#revenue-confidence {
  font-size: 11px;
  font-weight: 600;
}
#revenue-chart {
  height: 160px !important;
  width: 100% !important;
}
#revenue-note {
  font-size: 10.5px;
  color: #6b7280;
  margin-top: 8px;
  font-style: italic;
}

#results-content {
  font-size: 13.5px;
  line-height: 1.68;
  color: #1f2937;
}

/* Markdown rendering */
#results-content h3 {
  font-size: 14.5px;
  font-weight: 700;
  color: #111827;
  margin: 20px 0 7px;
  padding-bottom: 5px;
  border-bottom: 2px solid #e5e7eb;
}
#results-content h3:first-child { margin-top: 0; }
#results-content ul  { padding-left: 18px; margin: 6px 0; }
#results-content li  { margin: 4px 0; }
#results-content p   { margin: 7px 0; }
#results-content strong { color: #111827; }
#results-content code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

/* Loading dots */
.loading-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6b7280;
  font-size: 13px;
  padding: 10px 0;
}
.loading-dot {
  width: 7px; height: 7px;
  background: #3b82f6;
  border-radius: 50%;
  animation: pulse 1.1s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.18s; }
.loading-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes pulse {
  0%,100% { opacity: 0.25; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1.2); }
}

/* Map custom markers */
.marker-selected {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.45));
}
.marker-shop {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: #fff;
  border: 2.5px solid #2563eb;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(37,99,235,0.55), 0 1px 4px rgba(0,0,0,0.25);
  font-size: 18px;
  line-height: 1;
}
.marker-comp {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.25);
}
.marker-comp-direct {
  width: 24px; height: 24px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  opacity: 0.95;
}
.marker-rec {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.45), 0 1px 4px rgba(0,0,0,0.25);
}

/* ── Save button (results toolbar) ── */
#save-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 15px;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#save-btn:hover { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
#save-btn.saved { color: #16a34a; border-color: #bbf7d0; }
#save-btn.hidden { display: none; }

/* ── Sessions modal overlay ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(10, 20, 40, 0.60);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  width: 100%;
  max-width: 440px;
  padding: 28px 28px 24px;
  position: relative;
  animation: modalIn 0.18s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal-sub {
  font-size: 12.5px;
  color: #6b7280;
  margin-bottom: 14px;
}

/* Name input + notes textarea inside save view */
#session-name-input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#session-name-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
#session-notes-input {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  resize: none;
  color: #374151;
  margin-bottom: 18px;
  transition: border-color 0.2s;
  font-family: inherit;
}
#session-notes-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.btn-primary {
  padding: 9px 22px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-ghost {
  padding: 9px 18px;
  background: none;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover { background: #f3f4f6; color: #374151; }
.btn-icon {
  background: none;
  border: none;
  font-size: 16px;
  color: #9ca3af;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.btn-icon:hover { color: #374151; background: #f3f4f6; }

/* List view */
.modal-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
#sessions-list {
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-empty {
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
  padding: 24px 0 8px;
}
.modal-empty.hidden { display: none; }

/* Session card */
.session-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.session-card:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.10);
}
.session-card-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}
.session-card-body { flex: 1; min-width: 0; }
.session-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-card-meta {
  font-size: 11.5px;
  color: #6b7280;
  margin-top: 2px;
}
.session-card-delete {
  background: none;
  border: none;
  font-size: 14px;
  color: #d1d5db;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  align-self: flex-start;
  transition: color 0.15s, background 0.15s;
}
.session-card-delete:hover { color: #ef4444; background: #fef2f2; }

/* Leaflet "My Saves" map control */
.leaflet-control-mysaves a {
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1 !important;
  width: 30px !important;
  height: 30px !important;
  background: #fff;
  color: #374151;
  border-radius: 4px !important;
  text-decoration: none !important;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.leaflet-control-mysaves a:hover {
  background: #f0fdf4;
  color: #16a34a;
}

@media (max-width: 820px) {
  .modal-card { padding: 20px 18px 18px; }
  #sessions-list { max-height: 260px; }
}

/* ── Hex grid Leaflet control ── */
.leaflet-control-hexgrid a {
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  line-height: 1 !important;
  width: 30px !important;
  height: 30px !important;
  background: #fff;
  color: #374151;
  border-radius: 4px !important;
  text-decoration: none !important;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.leaflet-control-hexgrid a:hover {
  background: #eff6ff;
  color: #2563eb;
}
.leaflet-control-hexgrid.active a {
  background: #2563eb;
  color: #fff;
}
/* Hex grid point tooltip override */
.hex-tooltip {
  background: rgba(15, 23, 42, 0.82) !important;
  color: #e2e8f0 !important;
  border: none !important;
  border-radius: 5px !important;
  font-size: 11.5px !important;
  padding: 4px 9px !important;
  white-space: nowrap;
  box-shadow: none !important;
}
.hex-tooltip::before { display: none !important; }

/* Data boundary tooltip */
.boundary-tip {
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  padding: 5px 10px;
}
.boundary-tip::before { display: none; }

/* Coverage legend badge */
#coverage-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.78);
  color: #93c5fd;
  font-size: 11.5px;
  padding: 5px 11px;
  border-radius: 6px;
  pointer-events: none;
  border: 1px solid rgba(37, 99, 235, 0.45);
  white-space: nowrap;
}

/* ── Legend ── */
#map-legend {
  position: absolute;
  bottom: 36px;
  right: 12px;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
  font-size: 11.5px;
  border-radius: 8px;
  border: 1px solid rgba(37, 99, 235, 0.35);
  min-width: 190px;
  overflow: hidden;
}
.legend-toggle-btn {
  width: 100%;
  background: none;
  border: none;
  color: #93c5fd;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.3px;
  padding: 8px 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.legend-toggle-btn:hover { background: rgba(37,99,235,0.15); }
.legend-chevron { font-size: 10px; transition: transform 0.2s; }
#map-legend.open .legend-chevron { transform: rotate(180deg); }
.legend-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding: 0 13px;
}
#map-legend.open .legend-body { max-height: 300px; padding-bottom: 10px; }
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  line-height: 1.3;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
  transition: background 0.15s;
  user-select: none;
}
.legend-row:hover { background: rgba(255,255,255,0.07); }
.legend-row.layer-hidden { opacity: 0.35; text-decoration: line-through; }
.legend-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  flex-shrink: 0;
  font-size: 16px;
}
.legend-icon .marker-comp-direct {
  width: 18px; height: 18px;
  font-size: 9px;
}
.legend-icon .marker-rec {
  width: 20px; height: 20px;
  font-size: 11px;
}

/* ── Responsive ── */
@media (max-width: 820px) {
  /* Stack map above panel */
  #app-body { flex-direction: column; }
  #map-container { height: 45vh; flex-shrink: 0; }

  /* Panel fills remaining height and scrolls */
  #panel {
    width: 100%;
    min-width: unset;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  /* Compact panel header — hide non-essential lines */
  #panel-header { padding: 10px 16px 8px; }
  #panel-header h1 { font-size: 17px; }
  #panel-header p  { font-size: 11px; margin-top: 2px; }
  #dev-credit, #copyright { display: none; }

  /* Results must not flex-expand on mobile — let panel scroll as one unit */
  #results { flex: none; overflow-y: visible; }

  /* Tighter form */
  #panel-form { padding: 12px 16px 12px; }
  #results    { padding: 12px 16px 16px; }

  /* Bigger touch targets for chips */
  .chip { padding: 6px 13px; font-size: 13px; }

  /* Bigger analyze button */
  #analyze-btn { padding: 13px; font-size: 15px; }

  /* Map overlays */
  #map-legend    { bottom: 8px; right: 6px; font-size: 10px; min-width: 155px; }
  #coverage-badge { font-size: 10px; padding: 4px 8px; top: 8px; left: 8px; }
  #map-hint      { font-size: 12px; padding: 7px 14px; bottom: 12px; }

  /* Revenue chart */
  #revenue-chart-container { margin: 4px 16px 12px; }
  #export-btn { width: calc(100% - 32px); margin: 10px 16px 16px; }
}

@media (max-width: 480px) {
  #map-container { height: 38vh; }
  #panel-header h1 { font-size: 15px; }
}

/* ── Account button ── */
.account-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.30);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  color: #fff;
  transition: background 0.2s;
  margin-left: 6px;
  flex-shrink: 0;
}
.account-btn:hover { background: rgba(255,255,255,0.28); }
.account-btn.signed-in { background: rgba(255,255,255,0.25); }

/* ── Auth modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  position: relative;
}
.auth-card { max-width: 360px; }

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}
.modal-sub {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 20px;
  line-height: 1.5;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #6b7280;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s;
}
.btn-icon:hover { background: #f3f4f6; color: #111; }

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #111827;
}
.oauth-btn:hover { background: #f9fafb; border-color: #9ca3af; }
.oauth-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.oauth-logo { display: flex; align-items: center; flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 12px;
  color: #9ca3af;
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-ghost {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 13px;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 6px;
  transition: color 0.15s;
  width: 100%;
  text-align: center;
}
.btn-ghost:hover { color: #111827; background: #f3f4f6; }

.email-auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.email-auth-form input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.email-auth-form input:focus { border-color: #2563eb; }
.email-auth-actions {
  display: flex;
  gap: 8px;
}
.email-auth-actions .btn-primary,
.email-auth-actions .btn-ghost {
  flex: 1;
  padding: 9px 0;
  font-size: 14px;
}
.auth-email-error {
  font-size: 12px;
  color: #dc2626;
  margin: 0;
}
.auth-anon { margin-top: 2px; }
.auth-privacy {
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
  margin-top: 12px;
  line-height: 1.5;
}
.auth-privacy a { color: #6b7280; }
.auth-privacy a:hover { color: #111; text-decoration: underline; }

/* ── Account dropdown menu ── */
.account-menu {
  position: fixed;
  top: 50px;
  right: 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 8000;
  min-width: 210px;
  overflow: hidden;
}
.account-menu.hidden { display: none; }

.account-menu-email {
  padding: 12px 16px 10px;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-menu-divider { border: none; border-top: 1px solid #e5e7eb; margin: 0; }
.account-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 16px;
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  color: #374151;
  transition: background 0.12s;
}
.account-menu-item:hover { background: #f9fafb; }
.account-menu-danger { color: #ef4444; }
.account-menu-danger:hover { background: #fef2f2; }

/* ── GDPR consent banner ── */
#consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1e3a8a;
  color: #e0e7ff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 7000;
  font-size: 13px;
  line-height: 1.5;
  flex-wrap: wrap;
}
#consent-banner.hidden { display: none; }
#consent-text { margin: 0; flex: 1; }
#consent-text a { color: #93c5fd; text-decoration: underline; }
#consent-accept {
  padding: 7px 18px;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Saved sessions modal ── */
.modal-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
}
.modal-empty {
  color: #9ca3af;
  font-size: 13px;
  text-align: center;
  padding: 24px 0;
}
.modal-empty.hidden { display: none; }

#session-name-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.2s;
}
#session-name-input:focus { border-color: #3b82f6; }

#session-notes-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
#session-notes-input:focus { border-color: #3b82f6; }

/* ── Glass card map popup ────────────────────────────────────────────────── */
.glass-popup .leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
  padding: 0;
  overflow: hidden;
}
.glass-popup .leaflet-popup-content {
  margin: 0;
  padding: 0;
  min-width: 220px;
}
.glass-popup .leaflet-popup-tip-container,
.glass-popup .leaflet-popup-tip { display: none; }
.glass-popup .leaflet-popup-close-button {
  color: #6b7280 !important;
  font-size: 16px !important;
  top: 8px !important;
  right: 10px !important;
  padding: 0 !important;
  width: 20px !important;
  height: 20px !important;
  line-height: 20px !important;
  text-align: center !important;
}
.glass-card {
  padding: 14px 16px 12px;
}
.gc-header {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  padding-right: 20px; /* room for close button */
}
.gc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.gc-table td {
  padding: 5px 6px;
  color: #374151;
  vertical-align: middle;
}
.gc-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.gc-badge-you { background: #2563eb; }
.gc-label { color: #111827; }
.gc-dist {
  color: #6b7280;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
  padding-left: 8px;
}
.gc-divider {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.07);
  margin: 8px 0;
}
.gc-btn {
  display: block;
  width: 100%;
  padding: 8px 0;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 10px;
  text-align: center;
}
.gc-btn:hover { background: #1d4ed8; }

/* ── Expand button: back-to-map label in expanded mode ───────────────────── */
#panel.expanded #expand-btn {
  font-size: 13px;
  padding: 4px 12px;
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
  letter-spacing: 0;
}
