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

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

/* ── Sidebar ── */

#sidebar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 1001;
  transition: margin-left 0.3s ease, transform 0.3s ease;
}

#sidebar.collapsed {
  margin-left: -280px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: 0.3px;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #94a3b8;
  padding: 0 4px;
  line-height: 1;
}

.sidebar-toggle:hover {
  color: #475569;
}

.canton-list {
  flex: 1;
  overflow-y: auto;
}

.canton-row {
  display: flex;
  align-items: center;
  padding: 7px 16px;
  border-bottom: 1px solid #f1f5f9;
  gap: 8px;
}

.canton-row:hover {
  background: #f8fafc;
}

.canton-abbr {
  font-weight: 600;
  font-size: 12px;
  width: 22px;
  color: #334155;
  flex-shrink: 0;
}

.canton-name {
  flex: 1;
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.canton-bar {
  width: 60px;
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.canton-bar-fill {
  height: 100%;
  background: #22c55e;
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0;
}

.canton-pct {
  font-size: 11px;
  font-weight: 500;
  width: 40px;
  text-align: right;
  color: #334155;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.sidebar-footer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer-pct {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.sidebar-footer-stats {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.sidebar-footer-meta {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 6px;
  letter-spacing: 0.2px;
  cursor: help;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #22c55e;
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0;
}

.sidebar-toggle-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1002;
  background: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.sidebar-toggle-btn:hover {
  background: #f0f0f0;
}

/* ── Map ── */

#map {
  flex: 1;
  height: 100%;
  background: #f8fafc;
}

/* ── Status bar ── */

#status-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(255,255,255,0.95);
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.15);
  font-size: 13px;
  color: #444;
  display: none;
}

#status-bar.visible {
  display: block;
}

/* ── Mobile ── */
/* Below 640 px the sidebar takes the entire viewport: map and list are
   mutually exclusive, switched via the ☰ / × buttons (wiring in sidebar.js). */

@media (max-width: 640px) {
  #sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
    z-index: 1003;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }

  /* Override the desktop margin-based collapse: at 100 vw, transform is the
     only thing that reliably slides the panel off-screen. */
  #sidebar.collapsed {
    margin-left: 0;
    transform: translateX(-100%);
  }

  /* Bump touch targets to ≥ 44 px (Apple HIG / Material Design). */
  .sidebar-toggle {
    padding: 10px;
    font-size: 26px;
  }

  .sidebar-toggle-btn {
    padding: 12px 14px;
    font-size: 22px;
  }
}
