:root {
  --bg: #eef2e7;
  --panel: rgba(247, 244, 233, 0.94);
  --panel-strong: #f8f1df;
  --line: rgba(23, 32, 22, 0.12);
  --ink: #1b2618;
  --muted: #5f6f58;
  --accent: #1f6d3d;
  --accent-2: #d97f2f;
  --avoid: #121212;
  --path: #111111;
  --shadow: 0 22px 50px rgba(34, 42, 26, 0.12);
  --radius: 24px;
  --mono: "IBM Plex Mono", "SFMono-Regular", monospace;
  --sans: "Space Grotesk", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(217, 127, 47, 0.18), transparent 30%),
    linear-gradient(135deg, #edf2e4 0%, #e5ebe0 44%, #f5efdf 100%);
  color: var(--ink);
  font-family: var(--sans);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 420px);
}

.login-card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.02;
}

.login-card__error {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(160, 40, 24, 0.1);
  color: #8c2c1f;
  font-weight: 600;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.login-form__label {
  font-size: 0.9rem;
  font-weight: 600;
}

.login-form__input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(23, 32, 22, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
}

.login-form__submit {
  justify-content: center;
}

.shell {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr) 360px;
  height: 100vh;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}

.sidebar,
.map-panel,
.revisions-column {
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.revisions-column {
  display: flex;
  overflow: hidden;
}

.sidebar__header,
.panel,
.map-panel__toolbar,
.map-frame {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar__header,
.panel,
.map-panel__toolbar {
  padding: 18px 20px;
}

.sidebar__header h1,
.map-panel__toolbar h2,
.panel h2 {
  margin: 0;
}

.sidebar__header h1 {
  font-size: 2rem;
  line-height: 1.02;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--mono);
}

.subtle {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.sidebar__action-buttons {
  display: grid;
  gap: 8px;
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sidebar__status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.panel--controls {
  gap: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.slider-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.slider-row input {
  width: 100%;
  accent-color: var(--accent);
}

.slider-row strong {
  min-width: 3ch;
  text-align: right;
}

.sidebar__actions .subtle {
  margin: 8px 0 0;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel--revisions {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel--battery {
  background: linear-gradient(160deg, rgba(31, 109, 61, 0.08), rgba(248, 241, 223, 0.96));
}

.map-panel__heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel__title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.action-button {
  padding: 9px 14px;
  border: 1px solid rgba(31, 109, 61, 0.18);
  border-radius: 999px;
  background: rgba(31, 109, 61, 0.12);
  color: var(--accent);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.action-button:disabled {
  background: rgba(23, 32, 22, 0.06);
  border-color: rgba(23, 32, 22, 0.08);
  color: #6f7b69;
  cursor: default;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 109, 61, 0.12);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.pill--offline {
  background: rgba(17, 17, 17, 0.1);
  color: #5d5d5d;
}

.pill--source {
  align-self: flex-start;
  background: rgba(31, 109, 61, 0.12);
  color: var(--accent);
}

.pill--api {
  background: rgba(217, 127, 47, 0.16);
  color: var(--accent-2);
}


.battery-bar {
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: rgba(23, 32, 22, 0.08);
  overflow: hidden;
}

.battery-bar__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #79b14b, #2c9c53);
  transition: width 240ms ease;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(23, 32, 22, 0.08);
}

.metric-card strong {
  display: block;
  font-size: 1.2rem;
  margin-top: 4px;
}

.metric-card__label {
  color: var(--muted);
  font-size: 0.8rem;
}

.info-list {
  display: grid;
  grid-template-columns: minmax(0, 110px) minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.info-list dt {
  color: var(--muted);
  font-size: 0.84rem;
}

.info-list dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}

.revision-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.revision-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(23, 32, 22, 0.08);
  background: rgba(255, 255, 255, 0.6);
  color: inherit;
  cursor: pointer;
  appearance: none;
  font: inherit;
}

.revision-item--active {
  background: rgba(31, 109, 61, 0.12);
  border-color: rgba(31, 109, 61, 0.24);
}

.revision-item--selected {
  background: rgba(217, 127, 47, 0.14);
  border-color: rgba(217, 127, 47, 0.34);
}

.revision-item:hover {
  border-color: rgba(23, 32, 22, 0.2);
}

.revision-item__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  font-family: var(--mono);
}

.revision-item__meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.map-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.map-panel__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}

.legend__swatch--completed {
  background: #1b5e34;
}

.legend__swatch--progress {
  background: #88ba3b;
}

.legend__swatch--pending {
  background: #d7e889;
}

.legend__swatch--avoid,
.legend__swatch--path {
  background: #111;
}

.map-frame {
  position: relative;
  flex: 1;
  min-height: 600px;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font-family: var(--sans);
}

.map-marker {
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 2px solid #ffffff;
  box-shadow: 0 8px 20px rgba(18, 18, 18, 0.18);
}

.map-marker__glyph {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
}

.map-marker--mower {
  width: 26px;
  height: 26px;
  background: #245ad6;
}

.map-marker--charger {
  width: 28px;
  height: 28px;
  background: #d97f2f;
}

.map-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  max-width: min(420px, calc(100% - 40px));
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(248, 241, 223, 0.92);
  border: 1px solid rgba(23, 32, 22, 0.08);
  box-shadow: var(--shadow);
  color: var(--muted);
  z-index: 500;
  pointer-events: none;
}

.map-overlay--error {
  color: #9d2d1f;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .revisions-column {
    min-height: 320px;
    overflow: visible;
  }

  .map-frame {
    min-height: 60vh;
  }

  .map-panel__toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .legend {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .shell {
    padding: 10px;
    gap: 10px;
  }

  .sidebar__actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar__header h1 {
    font-size: 1.6rem;
  }

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

  .info-list {
    grid-template-columns: 1fr;
  }
}