:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #101c27;
  --panel-2: #142331;
  --line: #263847;
  --text: #f5f8fa;
  --muted: #91a5b5;
  --accent: #42e7be;
  --warning: #ffbb3e;
  --danger: #ff6b6b;
  --shadow: 0 16px 42px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 85% -10%, #173953 0, transparent 36%), var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }

.shell {
  width: min(100%, 980px);
  margin: auto;
  padding: max(24px, env(safe-area-inset-top)) clamp(18px, 4vw, 42px) max(38px, env(safe-area-inset-bottom));
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .16em;
}
.topbar h1 { margin: 0; font-size: clamp(2.2rem, 6vw, 3.4rem); letter-spacing: -.045em; }
.no-gps-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 28, 39, .82);
  color: #c6d3dc;
  font-size: .85rem;
  font-weight: 750;
}
.no-gps-badge i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(66, 231, 190, .11); }

section { margin-top: 26px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 1.12rem; }
.section-heading > span, .section-heading p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }
.section-heading button { border: 0; background: transparent; color: var(--accent); font-size: .88rem; font-weight: 750; }

.search-panel {
  margin-top: 0;
  padding: clamp(17px, 4vw, 24px);
  border: 1px solid #315064;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(21, 54, 66, .96), rgba(13, 27, 38, .96));
  box-shadow: var(--shadow);
}
.search-heading { margin-bottom: 16px; }
.search-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid #345164;
  border-radius: 14px;
  background: rgba(5, 16, 24, .72);
}
.search-switch button {
  min-height: 43px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 820;
}
.search-switch button span { margin-right: 5px; font-size: 1.05rem; }
.search-switch button.active { background: #193442; color: var(--text); box-shadow: inset 0 0 0 1px #436376; }
.search-switch button.active span { color: var(--accent); }
.search-view[hidden] { display: none; }
.place-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.route-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.place-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 7px 7px 7px 15px;
  border: 1px solid #3c596b;
  border-radius: 15px;
  background: #08141e;
}
.place-field > span { flex: 0 0 auto; color: var(--muted); font-size: .79rem; font-weight: 750; }
.place-field input {
  width: 100%;
  min-width: 0;
  padding: 8px 5px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
}
.place-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66, 231, 190, .1); }
.place-field input::placeholder { color: #617685; }
.place-form > button, .route-form > button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 19px;
  border: 0;
  border-radius: 15px;
  background: var(--accent);
  color: #052019;
  font-weight: 850;
}
.place-form > button span, .route-form > button span { font-size: 1.35rem; }
.route-form > button { grid-column: 1 / -1; min-height: 50px; }
.search-options { display: flex; align-items: center; gap: 9px; margin-top: 13px; color: var(--muted); font-size: .82rem; }
.search-options label { font-weight: 700; }
.search-options select {
  padding: 7px 28px 7px 9px;
  border: 1px solid #385062;
  border-radius: 9px;
  background: #0b1822;
  color: var(--text);
}
.search-options > span { min-width: 0; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-options { display: flex; align-items: center; gap: 12px; margin-top: 13px; color: var(--muted); font-size: .78rem; }
.route-options > span { min-width: 0; margin-left: auto; text-align: right; }
.prefer-facility { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; color: #d7e2e8; cursor: pointer; font-weight: 750; }
.prefer-facility input { position: absolute; opacity: 0; pointer-events: none; }
.prefer-facility > span { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #435665; transition: .2s ease; }
.prefer-facility > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .2s ease; }
.prefer-facility input:checked + span { background: var(--accent); }
.prefer-facility input:checked + span::after { transform: translateX(14px); background: #062019; }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mode {
  min-height: 105px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(150deg, var(--panel-2), var(--panel));
  color: var(--text);
  text-align: left;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .1);
}
.mode > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 1.45rem; }
.mode strong, .mode small { display: block; }
.mode strong { font-size: .94rem; }
.mode small { margin-top: 4px; color: var(--muted); font-size: .74rem; }
.mode.active { border-color: var(--accent); background: linear-gradient(150deg, #153a37, #10252b); box-shadow: inset 0 0 0 1px var(--accent), 0 10px 25px rgba(20, 204, 161, .08); }
.mode.active > span { color: var(--accent); }

.filters { padding: 18px; border: 1px solid var(--line); border-radius: 22px; background: rgba(16, 28, 39, .9); box-shadow: var(--shadow); }
.providers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.provider { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: #0b1620; cursor: pointer; }
.provider input { position: absolute; opacity: 0; }
.provider-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #253745; font-weight: 900; }
.provider strong, .provider small { display: block; }
.provider strong { font-size: .87rem; }
.provider small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.provider i { width: 9px; height: 9px; margin-left: auto; border: 2px solid #607383; border-radius: 50%; }
.provider:has(input:checked) { border-color: #607383; background: #142431; }
.provider:has(input:checked) i { border-color: var(--accent); background: var(--accent); }
.shell-provider .provider-mark { background: #ffd400; color: #d71920; }
.aral-provider .provider-mark { background: #1265a8; color: white; }
.ionity-provider .provider-mark { background: #691cff; color: #fff; }
.enbw-provider .provider-mark { background: #ffd419; color: #111; }
.power-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .88rem; }
.power-row strong { color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }

.results { margin-top: 30px; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line) !important; border-radius: 13px; background: var(--panel) !important; color: var(--text) !important; font-size: 1.35rem !important; }
.availability-note { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 12px 14px; border: 1px solid #334856; border-radius: 14px; background: rgba(15, 29, 40, .72); }
.availability-note p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.availability-note strong { color: #dbe5eb; }
.availability-dot { flex: 0 0 auto; width: 9px; height: 9px; margin-top: 4px; border-radius: 50%; background: #778a97; }
.status-card { display: flex; align-items: center; gap: 16px; padding: 18px; border: 1px dashed #405362; border-radius: 18px; color: var(--muted); }
.status-card strong { color: var(--text); }
.status-card p { margin: 3px 0 0; font-size: .84rem; }
.radar { position: relative; flex: 0 0 auto; width: 42px; height: 42px; border: 1px solid #416151; border-radius: 50%; background: radial-gradient(circle, var(--accent) 0 2px, transparent 3px); }
.radar::before, .radar::after { content: ""; position: absolute; inset: 7px; border: 1px solid #294f43; border-radius: 50%; }
.radar::after { inset: 14px; }
.status-card.loading .radar span { position: absolute; inset: 3px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 75%, rgba(66, 231, 190, .45)); animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.charger-list { display: grid; gap: 12px; }
.charger-card { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, #142330, #0d1923); box-shadow: 0 12px 28px rgba(0, 0, 0, .16); }
.charger-card.recommended { border-color: rgba(66, 231, 190, .72); box-shadow: inset 0 0 0 1px rgba(66, 231, 190, .35), 0 16px 34px rgba(0, 0, 0, .24); }
.charger-main { display: flex; gap: 14px; padding: 17px; }
.brand-badge { flex: 0 0 auto; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; font-weight: 900; }
.charger-copy { min-width: 0; flex: 1; }
.card-flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.recommendation, .facility-badge { display: inline-flex; align-items: center; width: max-content; padding: 4px 8px; border-radius: 999px; font-size: .69rem; font-weight: 850; }
.recommendation[hidden], .facility-badge[hidden], .route-offset[hidden] { display: none; }
.recommendation { background: var(--accent); color: #052019; }
.facility-badge { border: 1px solid rgba(255, 187, 62, .32); background: rgba(255, 187, 62, .1); color: #ffd27e; }
.facility-badge.unknown { border-color: #394c59; background: #182630; color: #8497a4; }
.charger-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.charger-title-row h3 { margin: 1px 0 7px; font-size: 1.03rem; }
.power { padding: 4px 8px; border-radius: 8px; background: rgba(66, 231, 190, .12); color: var(--accent); font-size: .8rem; font-weight: 800; white-space: nowrap; }
.address { margin: 0; color: #d4dee5; font-size: .88rem; line-height: 1.4; }
.facts { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 10px; color: #aebec9; font-size: .78rem; }
.availability-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.availability-badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid rgba(66, 231, 190, .28); border-radius: 999px; background: rgba(66, 231, 190, .1); color: #82f4d6; font-size: .76rem; font-weight: 800; }
.availability-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.availability-badge.unavailable { border-color: #3b4d59; background: #182630; color: #9aabb6; }
.availability-badge.unavailable i { background: #71828d; }
.availability-badge.busy { border-color: rgba(255, 107, 107, .35); background: rgba(255, 107, 107, .09); color: #ff9c9c; }
.availability-badge.busy i { background: var(--danger); }
.address-source { color: #718591; font-size: .72rem; }
.station-actions { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.station-actions button, .station-actions a { display: flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px; padding: 12px 15px; border: 0; background: rgba(255, 255, 255, .018); color: var(--text); text-decoration: none; font-size: .86rem; font-weight: 780; }
.station-actions button { border-right: 1px solid var(--line); }
.station-actions a { color: var(--accent); }
.station-actions b { font-size: 1.25rem; }
.empty { padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); }
.toast { position: fixed; z-index: 2000; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 11px 16px; border: 1px solid #416153; border-radius: 999px; background: #10251f; color: #cffff2; box-shadow: 0 12px 35px rgba(0, 0, 0, .38); font-size: .86rem; font-weight: 800; }

@media (max-width: 720px) {
  .modes, .providers { grid-template-columns: repeat(2, 1fr); }
  .mode { min-height: 96px; }
  .place-form, .route-form { grid-template-columns: 1fr; }
  .place-form > button, .route-form > button { min-height: 50px; }
  .power-row { grid-template-columns: 1fr; }
  .shell { padding-left: 15px; padding-right: 15px; }
  .route-options { align-items: flex-start; flex-direction: column; }
  .route-options > span { margin-left: 0; text-align: left; }
}

@media (max-width: 440px) {
  .topbar { align-items: flex-start; }
  .no-gps-badge { padding: 9px 11px; font-size: .75rem; }
  .search-options { align-items: flex-start; flex-wrap: wrap; }
  .search-options > span { width: 100%; margin-left: 0; white-space: normal; }
  .search-switch button { padding: 7px 5px; font-size: .76rem; }
  .charger-main { gap: 11px; padding: 15px 13px; }
  .brand-badge { width: 40px; height: 40px; }
  .charger-title-row { display: block; }
  .power { display: inline-block; margin-bottom: 8px; }
  .station-actions { grid-template-columns: 1fr; }
  .station-actions button { border-right: 0; border-bottom: 1px solid var(--line); }
}
