:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #17202a;
  --muted: #667085;
  --line: #d7dee8;
  --panel: #ffffff;
  --bg: #eef3f7;
  --accent: #0f766e;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(340px, 420px) 1fr;
  min-height: 100dvh;
  padding: 18px;
}

.panel,
.map-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
}

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

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 5px;
  text-transform: uppercase;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
  margin: 0;
}

.status {
  background: #e7f5f3;
  border: 1px solid #b9ded8;
  border-radius: 999px;
  color: #0f5f59;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
  white-space: nowrap;
}

.status.offline {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
}

.status.warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.intro {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.example-select {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
  grid-column: 1 / -1;
}

.example-select select {
  appearance: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  padding: 8px 34px 8px 10px;
  width: 100%;
}

button {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  min-height: 42px;
  padding: 9px 12px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.ghost {
  background: transparent;
  color: var(--accent);
}

.stops {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100dvh - 310px);
  overflow: auto;
  padding-right: 4px;
}

.stop-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
  position: relative;
}

.remove-stop {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  min-height: auto;
  padding: 2px 6px;
  position: absolute;
  right: 6px;
  top: 6px;
}

.remove-stop:hover {
  color: var(--danger);
}

.stop-card label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
}

.stop-card .address-label {
  grid-column: 1 / -1;
}

.stop-card input {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  padding: 8px;
  width: 100%;
}

.coord-row {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.coord-row.collapsed {
  display: none;
}

.map-section {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: calc(100dvh - 36px);
  overflow: hidden;
}

.metrics {
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.metrics article {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding: 16px 18px;
}

.metrics article:last-child {
  border-right: 0;
}

.metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metrics strong {
  font-size: 24px;
}

.metrics small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metrics .highlight strong {
  color: var(--accent);
}

.metrics-note {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  margin: 0;
  padding: 8px 18px;
}

#map {
  min-height: 520px;
}

.map-footer {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 18px;
}

.legend {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 16px;
}

.map-actions {
  display: flex;
  gap: 8px;
}

.map-actions button {
  font-size: 13px;
  min-height: 36px;
  padding: 6px 14px;
}

#printReport {
  display: none;
}

@media print {
  body > *:not(#printReport) {
    display: none !important;
  }

  #printReport {
    display: block;
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    max-width: 640px;
    padding: 32px;
  }

  #printReport h2 {
    font-size: 22px;
    margin: 0 0 4px;
  }

  #printReport .pr-meta {
    color: #667085;
    font-size: 13px;
    margin: 0 0 24px;
  }

  #printReport .pr-metrics {
    border: 1px solid #d7dee8;
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-bottom: 24px;
    overflow: hidden;
  }

  #printReport .pr-metric {
    border-right: 1px solid #d7dee8;
    padding: 14px 16px;
  }

  #printReport .pr-metric:last-child {
    border-right: 0;
  }

  #printReport .pr-metric span {
    color: #667085;
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
  }

  #printReport .pr-metric strong {
    font-size: 20px;
  }

  #printReport .pr-metric small {
    color: #667085;
    display: block;
    font-size: 12px;
  }

  #printReport .pr-saving strong {
    color: #0f766e;
  }

  #printReport h3 {
    font-size: 14px;
    margin: 0 0 10px;
    text-transform: uppercase;
  }

  #printReport ol {
    margin: 0;
    padding-left: 20px;
  }

  #printReport li {
    font-size: 14px;
    margin-bottom: 6px;
  }

  #printReport li small {
    color: #667085;
    display: block;
    font-size: 12px;
  }

  #printReport .pr-footer {
    border-top: 1px solid #d7dee8;
    color: #667085;
    font-size: 11px;
    margin-top: 32px;
    padding-top: 12px;
  }
}

.legend i {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  margin-right: 6px;
  width: 28px;
}

.legend .normal {
  background: var(--danger);
}

.legend .quantum {
  background: var(--accent);
}

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

  .map-section {
    min-height: 650px;
  }
}

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

  .actions,
  .coord-row,
  .metrics {
    grid-template-columns: 1fr;
  }

  .metrics article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
