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

:root {
  --c-top:    #16a34a;
  --c-filler: #6b7280;
  --c-dc:     #2563eb;
  --c-ac:     #16a34a;
  --c-bg:     #f9fafb;
  --c-card:   #ffffff;
  --c-border: #e5e7eb;
  --c-text:   #111827;
  --c-muted:  #6b7280;
  --radius:   10px;
}

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--c-bg); color: var(--c-text); }

/* ── Header ─────────────────────────────────────────── */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: #fff; border-bottom: 1px solid var(--c-border);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.app-header h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }
.header-sub { font-size: 13px; color: var(--c-muted); }

/* Power-class Toggle */
.toggle-wrap { margin-left: auto; display: flex; background: #f3f4f6; border-radius: 8px; padding: 3px; gap: 2px; }
.toggle-btn {
  font-size: 13px; font-weight: 500; padding: 5px 12px;
  border: none; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--c-muted); transition: all 0.15s;
}
.toggle-btn.active { background: #fff; color: var(--c-text); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* ── Map ─────────────────────────────────────────────── */
#map { position: fixed; top: 57px; left: 0; right: 0; bottom: 0; z-index: 1; }

/* ── Bottom sheet ────────────────────────────────────── */
#sheet {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 500;
  background: var(--c-card); border-radius: 18px 18px 0 0;
  border-top: 1px solid var(--c-border);
  max-height: 55vh; overflow-y: auto;
  transition: transform 0.3s ease;
}
#sheet.collapsed { transform: translateY(calc(100% - 54px)); }

.sheet-handle {
  display: flex; align-items: center; justify-content: center;
  padding: 10px; cursor: pointer; gap: 8px;
}
.sheet-handle-bar { width: 36px; height: 4px; background: #d1d5db; border-radius: 99px; }
.sheet-count { font-size: 13px; color: var(--c-muted); font-weight: 500; }

.station-list { padding: 0 12px 16px; display: flex; flex-direction: column; gap: 8px; }

/* ── Station Card ────────────────────────────────────── */
.station-card {
  background: var(--c-card); border: 1.5px solid var(--c-border);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: border-color 0.15s;
}
.station-card:hover { border-color: #9ca3af; }
.station-card.top { border-color: var(--c-top); border-width: 2px; }

.rank-badge {
  min-width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-top); color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rank-badge.filler { background: var(--c-border); color: var(--c-muted); }

.card-body { flex: 1; min-width: 0; }
.card-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-addr { font-size: 12px; color: var(--c-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; gap: 8px; margin-top: 6px; align-items: center; flex-wrap: wrap; }

.pill {
  font-size: 11px; font-weight: 600; padding: 2px 7px;
  border-radius: 99px; display: inline-flex; align-items: center; gap: 3px;
}
.pill-price { background: #dcfce7; color: #15803d; }
.pill-price.no-price { background: #f3f4f6; color: var(--c-muted); font-weight: 400; }
.pill-power { background: #dbeafe; color: #1d4ed8; }
.pill-power.ac { background: #dcfce7; color: #15803d; }
.pill-notes { background: #fef3c7; color: #92400e; }
.pill-op { background: #f3f4f6; color: #374151; }

/* ── Leaflet pin overrides ───────────────────────────── */
.pin-top .pin-inner { background: var(--c-top) !important; }
.pin-filler .pin-inner { background: var(--c-filler) !important; }
.pin-label {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--c-top); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 5px; border-radius: 5px;
  white-space: nowrap; pointer-events: none;
}
.pin-filler .pin-label { background: var(--c-filler); }

/* ── Loading overlay ─────────────────────────────────── */
#loading {
  position: fixed; top: 57px; left: 50%; transform: translateX(-50%);
  z-index: 900; background: rgba(255,255,255,0.95);
  padding: 8px 16px; border-radius: 99px; font-size: 13px; color: var(--c-muted);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12); display: none;
}
