:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: rgba(9, 22, 32, 0.92);
  --ink: #e7f2f1;
  --muted: #8ea4b0;
  --line: rgba(186, 230, 214, 0.16);
  --accent: #3ddc97;
  --accent-ink: #06281c;
  --brass: #e4c27a;
  --danger: #f07167;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --header: 76px;
  --radius: 18px;
  --font: "Tajawal", "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f1;
  --panel: rgba(255, 255, 255, 0.94);
  --ink: #122029;
  --muted: #5d7280;
  --line: rgba(16, 36, 48, 0.12);
  --accent: #0e9b6b;
  --accent-ink: #ffffff;
  --brass: #8d6418;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(18, 32, 41, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

#boot, #offline {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: var(--bg);
  text-align: center;
  padding: 24px;
}
#boot[hidden], #offline[hidden] { display: none; }
.boot-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: #102830;
  color: var(--accent);
  box-shadow: var(--shadow);
}
#boot p, #offline p { color: var(--muted); }

#shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
#stage { position: relative; min-height: 0; }
.view { position: absolute; inset: 0; overflow: auto; }
#workspace { overflow: hidden; }
#app {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  grid-column: 1 / -1;
  min-height: var(--header);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  z-index: 5;
}
.back-btn {
  flex: none;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  font-weight: 700;
}
.sheet .back-btn { margin-bottom: 16px; }
[dir="rtl"] .back-btn svg { transform: scaleX(-1); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.brand strong { display: block; font-size: 1.05rem; letter-spacing: 0; }
.brand span { display: block; color: var(--muted); font-size: 0.82rem; }
.mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #102830;
  color: var(--accent);
  flex: none;
}
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  min-height: 48px;
}
.search input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  min-height: 46px;
}
.suggest {
  position: absolute;
  z-index: 8;
  inset-inline: 0;
  top: calc(100% + 6px);
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow: auto;
}
.suggest[hidden] { display: none; }
.suggest-item {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: start;
  padding: 8px 10px;
}
.suggest-item:hover, .suggest-item:focus-visible { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.country, .icon-btn, .text-btn {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
}
.country { padding: 0 12px; max-width: 160px; }
.icon-btn, .text-btn { padding: 0 14px; }
.icon-btn { width: 48px; display: grid; place-items: center; }
.locate { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.locate[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--brass); }

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-inline-end: 1px solid var(--line);
  overflow: auto;
}
.panel-head, .card-actions, .topbar { }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 8px;
}
.panel-head h2 { margin: 0; font-size: 1.05rem; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }
.filters, .charge-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filters { padding: 0 14px 12px; }
.chip {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip[data-charge="fast"][aria-pressed="true"] { border-color: #1f9d55; }
.chip[data-charge="normal"][aria-pressed="true"] { border-color: #2f6fed; }
.chip[data-charge="unknown"][aria-pressed="true"] { border-color: #d92d20; }
.swatch {
  width: 18px;
  height: 18px;
  flex: none;
  display: block;
}
.card-title { display: flex; gap: 8px; align-items: flex-start; }
.card-title .swatch { margin-top: 2px; }
.legend {
  position: absolute;
  z-index: 2;
  bottom: 28px;
  inset-inline-end: 10px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  pointer-events: none;
}
.legend span { display: flex; align-items: center; gap: 8px; }
.chip[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); }
#list { flex: none; overflow: visible; padding: 0 12px 16px; }
.station-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}
.station-card.is-selected { border-color: var(--accent); }
.station-card h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.45; }
.station-card p { margin: 0 0 6px; color: var(--muted); font-size: 0.9rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.card-actions a, .card-actions button {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  text-decoration: none;
  color: inherit;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
}
.card-actions .primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.more, .empty {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--muted);
}
.map-wrap { position: relative; min-height: 0; display: flex; flex-direction: column; }
.map-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#map { width: 100%; height: 100%; }
.station-sheet {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  max-height: 38vh;
  overflow: auto;
}
.station-sheet-more { flex: 1 0 100%; display: grid; gap: 8px; min-width: 0; }
.station-sheet-more[hidden] { display: none !important; }
.sheet-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.station-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}
.station-status[data-state="available"] { color: #0e9b6b; }
.station-status[data-state="busy"] { color: #9a6700; }
.station-status[data-state="offline"] { color: #d92d20; }
.route-note { margin: 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
.route-bar[hidden] { display: none !important; }
.route-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}
.route-bar p { margin: 0; font-weight: 800; }
#route-clear { min-height: 44px; border: 0; border-radius: 12px; background: #e7edf1; color: #122029; font-weight: 800; padding: 0 14px; }
.station-sheet-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.station-sheet-copy { min-width: 0; }
.station-sheet-copy { min-width: 0; flex: 1; }
.station-sheet-copy h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.station-sheet-copy p { margin: 0; color: var(--muted); font-size: 0.88rem; line-height: 1.45; overflow-wrap: anywhere; }
.station-sheet-quick { display: flex; align-items: center; gap: 6px; }
.station-sheet-quick button,
.share-menu button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: inherit;
  padding: 0 12px;
  font-weight: 700;
}
.station-sheet-quick .primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.station-sheet .card-actions { margin: 0; }
.station-close {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}
.share-menu { display: grid; gap: 6px; }
.share-menu[hidden] { display: none !important; }
.share-menu p { margin: 0; color: var(--muted); line-height: 1.5; }
@media (max-width: 900px) {
  .station-sheet { align-items: stretch; max-height: 46%; }
  .route-bar { align-items: stretch; flex-direction: column; }
  .station-sheet-quick { width: 100%; }
  .station-sheet-quick #station-directions,
  .station-sheet-quick #station-expand { flex: 1; }
  .station-sheet .card-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .station-sheet .card-actions a,
  .station-sheet .card-actions button { justify-content: center; }
}
body.panel-hidden #app { grid-template-columns: 1fr; }
body.panel-hidden .panel { display: none; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.car-pin {
  width: 34px;
  height: 52px;
  background: transparent;
  border: 0;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}
.car-pin svg { width: 100%; height: 100%; display: block; }
.wind-bar[hidden] { display: none !important; }
.wind-bar {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 4px 16px;
  align-items: center;
  min-height: 56px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.92rem;
}
.wind-bar p { margin: 0; line-height: 1.45; }
.wind-bar strong { font-weight: 800; }
.wind-bar a { color: inherit; }
.wind-arrow { width: 22px; height: 22px; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.wind-arrow svg { width: 100%; height: 100%; display: block; }
.wind-option { display: flex; align-items: center; gap: 10px; min-height: 48px; font-weight: 700; }
.wind-option input { width: 22px; height: 22px; }
.phone-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px; }
.account-form { display: grid; gap: 10px; margin-top: 16px; }
.account-preview { color: var(--muted); line-height: 1.6; }
.account-links { display: grid; gap: 8px; margin-top: 16px; }
.account-links .text-btn { width: 100%; }
#account-logout:disabled { opacity: 0.55; }
@media (max-width: 900px) {
  .wind-bar { grid-template-columns: 1fr; min-height: 0; }
}
.gps-accuracy {
  border-radius: 50%;
  background: rgba(14, 155, 107, 0.14);
  box-shadow: inset 0 0 0 2px rgba(14, 155, 107, 0.55);
  pointer-events: none;
}
.gps-accuracy.is-weak {
  background: rgba(141, 100, 24, 0.18);
  box-shadow: inset 0 0 0 2px rgba(141, 100, 24, 0.75);
}
.gps-rough {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px dashed #9a6700;
  background: transparent;
  pointer-events: none;
}
.manual-pin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #122029;
  box-shadow: 0 0 0 4px #e4c27a;
  pointer-events: none;
}
.map-settings-title { margin: 26px 0 0; font-size: 1.25rem; }
.settings-save-note { margin: 16px 0 0; color: var(--muted); line-height: 1.6; }
.settings-save {
  width: 100%;
  min-height: 52px;
  margin-top: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}
.vehicle-choices { display: flex; gap: 6px; }
.vehicle-choices button {
  width: 56px;
  min-height: 52px;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
}
.vehicle-choices button svg { width: 100%; height: 40px; display: block; }
.vehicle-choices button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 24%, transparent); box-shadow: inset 0 0 0 2px var(--accent); }
.map-vehicle-row { flex-wrap: wrap; }
#accuracy-toggle[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.station-sheet-copy h2 { font-weight: 800; color: var(--ink); }
#station-sheet-power { font-weight: 800; }
#station-sheet-power[data-kind="fast"] { color: #1f9d55; }
#station-sheet-power[data-kind="normal"] { color: #2f6fed; }
#station-sheet-power[data-kind="unknown"] { color: #d92d20; }
.gps-panel {
  position: absolute;
  z-index: 3;
  top: 10px;
  inset-inline-start: 10px;
  width: max-content;
  max-width: min(320px, calc(100% - 20px));
  max-height: calc(100% - 20px);
  overflow: auto;
  padding: 4px 8px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.gps-compact { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 36px; }
.gps-brief { margin: 0; font-weight: 700; font-size: 0.86rem; }
.gps-warn { flex: 1 0 100%; margin: 0; color: var(--danger); font-weight: 800; font-size: 0.84rem; line-height: 1.4; }
.gps-warn[hidden], #gps-manual[hidden], #gps-auto[hidden] { display: none !important; }
#gps-manual, #gps-auto { flex: 1 0 100%; min-height: 40px; border: 0; border-radius: 10px; background: #e7edf1; color: #122029; font-weight: 800; }
.gps-details { max-height: 32vh; overflow: auto; padding-bottom: 6px; }
.gps-details[hidden] { display: none !important; }
#gps-expand { min-height: 32px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-weight: 800; }
.gps-status {
  margin: 0;
  font-weight: 700;
  white-space: nowrap;
}
.gps-status[data-state="connected"] { color: #0e9b6b; }
.gps-status[data-state="searching"] { color: var(--muted); }
.gps-status[data-state="weak"] { color: var(--brass); }
.gps-status[data-state="denied"],
.gps-status[data-state="unsupported"] { color: var(--danger); }
.gps-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0 0 10px;
}
.gps-facts div { min-width: 0; }
.gps-facts dt { color: var(--muted); font-size: 0.82rem; }
.gps-facts dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.gps-actions { display: flex; gap: 8px; }
.gps-actions button {
  flex: 1;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  font-weight: 700;
}
#gps-follow-btn { background: var(--accent); color: var(--accent-ink); }
#gps-follow-btn[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--brass); }
#gps-stop { background: #e7edf1; color: #122029; }
.maplibregl-popup-content { border-radius: 14px; color: #122029; font-family: var(--font); }
.maplibregl-ctrl-attrib { font-size: 11px; }

.sheet { max-width: 760px; margin: 0 auto; padding: 32px 22px 24px; }
.home-kicker { margin: 0 0 8px; color: var(--brass); font-size: 0.82rem; }
.sheet h1, .home-hero h1 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1.25; }
.sheet p, .home-hero p { color: var(--muted); line-height: 1.6; }
.home-hero { display: grid; gap: 8px; padding: 22px 22px 4px; max-width: 1400px; margin: 0 auto; width: 100%; }
.map-launch {
  margin-top: 8px;
  min-height: 72px;
  border: 0;
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  text-align: start;
  color: #f7fffb;
  background: linear-gradient(120deg, #10261f 0%, #0f8f62 58%, #b8924a 130%);
  box-shadow: var(--shadow);
}
.map-launch svg { width: 36px; height: 36px; flex: none; }
.map-launch strong, .map-launch span { display: block; }
.map-launch strong { font-size: 1.25rem; }
.map-launch span { opacity: 0.9; }
.menu-grid {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 22px 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.menu-card {
  min-height: 132px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: inherit;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  text-align: start;
}
button.menu-card { cursor: pointer; }
.menu-card svg { width: 32px; height: 32px; color: var(--accent); }
.menu-card.is-soon { color: var(--muted); }
.menu-card.is-soon svg { color: var(--brass); }
.menu-card strong { display: block; color: var(--ink); font-size: 19px; line-height: 1.35; overflow-wrap: break-word; }
@media (max-width: 420px) {
  .menu-grid { grid-template-columns: 1fr; }
}
@media (min-width: 1100px) {
  .menu-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 1100px) and (min-height: 860px) {
  #home-view { display: flex; flex-direction: column; justify-content: center; }
}
.soon-pill, .soon-flag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--brass);
  font-size: 0.75rem;
}
.soon-flag { display: inline-block; margin: 0 0 12px; }
#consumption-view .sheet, #charge-view .sheet { max-width: 1080px; }
.calc-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}
.calc-main { display: grid; gap: 12px; min-width: 0; }
.calc-field { display: grid; gap: 6px; }
.calc-field span { color: var(--muted); }
.calc-field input, .calc-field select {
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  padding: 0 14px;
}
.calc-field select {
  appearance: none;
  padding-inline-end: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23e7f2f1' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
}
html[data-theme="light"] .calc-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%235d7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
[dir="ltr"] .calc-field select { background-position: right 14px center; }
.calc-field input:focus-visible,
.calc-field select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}
.calc-field input[type="range"] {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}
.calc-note { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.calc-results { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.calc-result {
  min-height: 108px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.calc-result span { color: var(--muted); }
.calc-result strong { display: block; margin: 6px 0 2px; font-size: 2rem; line-height: 1.1; }
.calc-actions { display: flex; flex-direction: column; gap: 12px; }
.calc-actions button {
  min-height: 72px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.calc-locate { background: var(--accent); color: var(--accent-ink); }
.calc-reset { background: #e7edf1; color: #122029; }
.calc-actions svg { flex: none; }
#charge-view .calc-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "capacity power"
    "powerNote powerNote"
    "now target"
    "efficiency price"
    "currency currency"
    "warning warning"
    "results results";
  column-gap: 16px;
  container-type: inline-size;
}
#charge-view .calc-capacity { grid-area: capacity; }
#charge-view .calc-power { grid-area: power; }
#charge-view .calc-power-note { grid-area: powerNote; }
#charge-view .calc-now { grid-area: now; }
#charge-view .calc-target { grid-area: target; }
#charge-view .calc-efficiency { grid-area: efficiency; }
#charge-view .calc-price { grid-area: price; }
#charge-view .calc-currency { grid-area: currency; }
#charge-view #charge-warning { grid-area: warning; }
#charge-view .calc-results {
  grid-area: results;
  grid-template-columns: 1fr 1fr;
}
@container (min-width: 720px) {
  #charge-view .calc-results { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .calc-form { grid-template-columns: 1fr; }
  .calc-actions { width: 100%; }
  #charge-view .calc-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "capacity"
      "power"
      "powerNote"
      "now"
      "target"
      "efficiency"
      "price"
      "currency"
      "warning"
      "results";
  }
  #charge-view .calc-results { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .calc-results { grid-template-columns: 1fr; }
}
.setting-list { display: grid; gap: 10px; margin-top: 18px; }
.setting-row {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.dock {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
  z-index: 6;
}
.dock button {
  flex: 0 0 auto;
  min-width: 76px;
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  padding: 6px 8px;
}
.dock button.is-on { color: var(--ink); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.dock button.is-soon { opacity: 0.8; }
.dock svg { width: 28px; height: 28px; }
.dock small { font-size: 0.72rem; line-height: 1.2; }
#toast, #error {
  position: fixed;
  z-index: 20;
  inset-inline: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  margin-inline: auto;
  max-width: 520px;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
#toast { background: var(--panel); border: 1px solid var(--line); }
#error { background: color-mix(in srgb, var(--danger) 16%, var(--panel)); border: 1px solid var(--danger); }
#toast[hidden], #error[hidden] { display: none; }

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto minmax(240px, 48vh) minmax(0, 1fr); }
  .topbar { order: 1; }
  .map-wrap { order: 2; }
  .panel { order: 3; border-inline-end: 0; border-top: 1px solid var(--line); }
  body.panel-hidden #app { grid-template-rows: auto minmax(0, 1fr); }
  body.panel-hidden .map-wrap { order: 2; }
  .brand span { display: none; }
  .topbar { flex-wrap: wrap; }
  .search-wrap { order: 5; flex-basis: 100%; }
  .country { max-width: none; flex: 1; }
  .legend { bottom: 16px; }
}
@media (min-width: 1100px) {
  #shell { grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .dock {
    grid-column: 1;
    grid-row: 1;
    flex-direction: column;
    overflow: auto;
    border-top: 0;
    border-inline-end: 1px solid var(--line);
    padding: 12px 8px;
  }
  #stage { grid-column: 2; }
  .dock button { width: 100%; min-height: 74px; }
  #toast, #error { bottom: 16px; }
}
@media (min-width: 1200px) and (max-height: 900px) {
  :root { --header: 64px; }
  .topbar { padding-block: 8px; }
  .station-card { padding: 12px; }
  .chip, .card-actions a, .card-actions button, .suggest-item, .dock button { min-height: 48px; }
}
