:root {
  color-scheme: light;
  --bg: #eef1f4;
  --panel: #ffffff;
  --ink: #18202a;
  --muted: #5c6572;
  --line: #d8dde4;
  --accent: #d91635;
  --accent-dark: #a70f28;
  --route: #2563eb;
  --stop: #00a676;
  --warn: #b45309;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 440px) 1fr;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  height: 100vh;
  padding: 24px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand-actions {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.language-field {
  position: relative;
  min-width: 148px;
  gap: 6px;
}

.language-field > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.language-field::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 13px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  pointer-events: none;
  transform: rotate(45deg);
}

.language-field select {
  min-height: 38px;
  appearance: none;
  border: 1px solid #cbd3df;
  border-radius: 8px;
  padding: 8px 34px 8px 12px;
  color: var(--ink);
  background: #f8fafc;
  box-shadow: 0 1px 2px rgba(24, 32, 42, 0.06);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.language-field select:hover {
  border-color: #aeb8c6;
  background: #fff;
}

.language-field select:focus {
  border-color: var(--route);
  outline: 3px solid rgba(37, 99, 235, 0.16);
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.planner-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

input:focus {
  border-color: var(--route);
  outline: 3px solid rgba(37, 99, 235, 0.16);
}

.address-field {
  position: relative;
}

.address-field.with-location input {
  padding-right: 50px;
}

.location-button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 1.05rem;
}

.location-button:hover,
.location-button:focus-visible {
  color: #fff;
  background: var(--route);
}

.location-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.suggestions {
  position: absolute;
  z-index: 600;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 220px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(24, 32, 42, 0.16);
  list-style: none;
}

.suggestions.visible {
  display: grid;
  gap: 3px;
}

.suggestion-item {
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.3;
  cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: #eef4ff;
  color: #123b8f;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.number-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.number-field:focus-within {
  border-color: var(--route);
  outline: 3px solid rgba(37, 99, 235, 0.16);
}

.number-field input {
  min-height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
}

.number-field span {
  padding-right: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.checkbox-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.checkbox-field span {
  display: grid;
  gap: 4px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.summary {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  color: var(--muted);
  line-height: 1.45;
}

.summary.visible {
  display: block;
}

.summary strong {
  color: var(--ink);
}

.summary.error {
  border-color: rgba(180, 83, 9, 0.36);
  background: #fff7ed;
  color: #78350f;
}

.summary a {
  color: var(--route);
  font-weight: 800;
  text-decoration: none;
}

.stops-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stop-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.stop-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stop-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.25;
}

.stop-badge {
  align-self: flex-start;
  border-radius: 999px;
  padding: 4px 8px;
  color: #065f46;
  background: #d1fae5;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.stop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.stop-link {
  width: fit-content;
  color: var(--route);
  font-weight: 800;
  text-decoration: none;
}

.map-panel {
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.charger-marker,
.stop-marker {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  font-size: 12px;
  font-weight: 900;
}

.charger-marker {
  background: var(--accent);
}

.stop-marker {
  background: var(--stop);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .control-panel {
    height: auto;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .map-panel,
  #map {
    min-height: 58vh;
    height: 58vh;
  }
}

@media (max-width: 520px) {
  .control-panel {
    padding: 18px;
  }

  .brand-row {
    flex-direction: column;
  }

  .brand-actions {
    width: 100%;
    justify-content: space-between;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }
}
