@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');
:root {
  font-family: 'DM Sans', sans-serif;
  color: #203731;
  background: #f1f3ed;
  font-synthesis: none;
  --green: #203e35;
  --lime: #d5f184;
  --line: #dce2d7;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 3%;
  border-bottom: 1px solid var(--line);
  background: #fafbf7;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 23px;
}
.mark {
  background: var(--green);
  color: var(--lime);
  padding: 0 10px;
  border-radius: 9px;
  font-size: 36px;
}
.brand small {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 1.6px;
  margin-top: 4px;
  color: #69766a;
}
.live {
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.live span:first-child {
  width: 8px;
  height: 8px;
  background: #a2ac9a;
  border-radius: 50%;
}
.live span.running {
  background: #5d922c !important;
}
main {
  max-width: 1680px;
  margin: auto;
  padding: 28px 3%;
}
.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 27px;
}
h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(24px, 2.2vw, 36px);
  letter-spacing: -1px;
  margin: 0 0 7px;
}
p {
  color: #66736a;
  line-height: 1.5;
  font-size: 14px;
  margin: 8px 0 16px;
}
h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px;
  margin: 0;
}
h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
.workspace {
  display: grid;
  grid-template-columns: 260px minmax(420px, 1fr) 280px;
  gap: 18px;
  align-items: start;
}
.panel {
  background: #fcfdf9;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 22px;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.section-title > span {
  font-size: 13px;
  color: #819080;
}
.section-title .clock {
  font-family: 'Space Grotesk', monospace;
  font-size: 24px;
  color: var(--green);
}
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 13px;
}
label span {
  font-size: 12px;
  color: #788273;
  font-weight: 400;
}
input,
select {
  display: block;
  background: white;
  color: #203731;
  border: 1px solid #ced6c7;
  border-radius: 7px;
  padding: 10px;
  width: 100%;
  margin-top: 6px;
  font: inherit;
  font-size: 14px;
  min-height: 39px;
}
input:focus,
select:focus,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid #a4bf6a;
  outline-offset: 2px;
}
button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: #f4f6ed;
  color: var(--green);
  border: 1px solid #ced6c7;
  border-radius: 7px;
  min-height: 40px;
  padding: 9px 13px;
  cursor: pointer;
}
button:hover {
  background: #e7eddc;
}
button.primary {
  background: var(--green);
  color: #f6f9ed;
  border-color: var(--green);
}
button.primary:hover {
  background: #315848;
}
button.subtle {
  background: transparent;
  white-space: nowrap;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.settings .primary,
.dispatch button {
  width: 100%;
}
.hint {
  font-size: 12px;
  margin-bottom: 0;
}
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.speed {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 0 auto;
}
.speed select {
  margin: 0;
  width: 76px;
}
.route-wrap {
  position: relative;
  max-width: 750px;
  margin: auto;
}
.route-wrap svg {
  display: block;
  width: 100%;
  min-height: 320px;
}
.route-center {
  pointer-events: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 220px;
}
.route-center > span {
  font-size: 11px;
  letter-spacing: 1.5px;
}
.route-center strong {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 52px;
  letter-spacing: -2px;
  margin: 5px;
}
.route-center small {
  font-size: 12px;
  color: #74816b;
}
.legend {
  font-size: 12px;
  display: flex;
  justify-content: center;
  gap: 18px;
  color: #74816b;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.bus-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.bus-card {
  background: #f2f5eb;
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  display: flex;
  gap: 9px;
  align-items: start;
}
.bus-card strong {
  font-size: 14px;
  display: block;
  margin-bottom: 3px;
}
.bus-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-top: 4px;
  flex-shrink: 0;
}
.intervention {
  border-top: 1px solid var(--line);
  padding-top: 17px;
  margin-top: 18px;
}
.intervention p {
  font-size: 12px;
  margin-bottom: 12px;
}
.dispatch > p {
  margin-top: -8px;
}
#message {
  font-size: 13px;
  color: #556b35;
  min-height: 18px;
  margin-top: 15px;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin: 22px 0;
}
.metric {
  padding: 17px 19px;
  background: #e8eddf;
  border: 1px solid #dce3d2;
  border-radius: 11px;
}
.metric strong {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 27px;
  display: block;
  letter-spacing: -1px;
}
.metric span {
  font-size: 12px;
  color: #64745b;
  display: block;
  margin-bottom: 8px;
}
.metric small {
  font-size: 11px;
  color: #64745b;
}
.charts-panel {
  padding: 24px;
}
.chart-heading {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.chart-heading > div {
  flex: 1;
  min-width: 230px;
}
.chart-heading p {
  margin-bottom: 0;
}
.chart-heading label {
  width: 125px;
  margin: 0;
}
.system-chart {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  background: #f6f8f1;
}
.system-chart p,
.bus-charts p {
  font-size: 12px;
  margin: 0 0 12px;
}
canvas {
  display: block;
  width: 100%;
  height: 200px;
}
.system-chart canvas {
  height: 240px;
}
.chart-key {
  font-size: 12px;
  color: #697962;
  margin-top: 8px;
}
.chart-key span {
  float: right;
}
.bus-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.bus-chart {
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 10px;
}
.bus-chart h3 {
  font-size: 16px;
}
.bus-chart h4 {
  font-size: 13px;
  margin: 16px 0 8px;
}
.bottom {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 20px;
  margin-top: 22px;
}
.history {
  max-height: 240px;
  overflow: auto;
}
.history div {
  display: flex;
  gap: 13px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  padding: 12px 0;
}
.history time {
  font-family: monospace;
  color: #778571;
  white-space: nowrap;
}
.model p {
  font-size: 13px;
}
summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
footer {
  border-top: 1px solid var(--line);
  padding: 22px 3%;
  font-size: 11px;
  letter-spacing: 1.4px;
  color: #728069;
  display: flex;
  justify-content: space-between;
}
.stop-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  fill: #5f6e57;
}
.bus-label {
  font-weight: 700;
  font-size: 13px;
  fill: white;
}
.svg-stop {
  fill: #fcfdf9;
  stroke: #738566;
  stroke-width: 2;
}
.svg-queue {
  fill: #e4edd6;
  stroke: #c5d4b5;
}
@media (min-width: 1450px) {
  .workspace {
    grid-template-columns: 280px minmax(450px, 1fr) 290px;
  }
}
@media (max-width: 1150px) {
  .workspace {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .dispatch {
    grid-column: 1/-1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .dispatch > .section-title,
  .dispatch > p,
  .dispatch > label,
  .dispatch > #message {
    grid-column: 1/-1;
  }
  .dispatch > .section-title,
  .dispatch > p {
    margin-bottom: 0;
  }
  .dispatch > .intervention {
    margin-top: 0;
  }
  .dispatch > label {
    max-width: 240px;
  }
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 700px) {
  header {
    padding: 18px;
  }
  .brand {
    font-size: 19px;
  }
  .brand small {
    font-size: 9px;
  }
  .live {
    font-size: 12px;
  }
  .intro {
    display: block;
  }
  .intro button {
    margin-top: 5px;
  }
  main {
    padding: 22px 15px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .workspace > .panel {
    width: 100%;
  }
  .route-panel {
    order: -1;
  }
  .settings form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .settings form > .two {
    grid-column: 1/-1;
  }
  .settings form > .primary,
  .settings .hint {
    grid-column: 1/-1;
  }
  .settings label {
    margin: 0;
  }
  .dispatch {
    display: block;
  }
  .dispatch > .intervention {
    margin-top: 18px;
  }
  .metrics {
    gap: 8px;
  }
  .metric {
    padding: 12px;
  }
  .metric strong {
    font-size: 23px;
  }
  .bus-charts,
  .bottom {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 18px;
  }
  .legend {
    gap: 8px;
  }
  .route-center {
    width: 170px;
  }
  .route-center strong {
    font-size: 42px;
  }
  .route-center > span {
    font-size: 9px;
  }
  .toolbar button {
    padding: 8px;
  }
  .speed {
    margin-left: 0;
  }
  .chart-heading {
    gap: 13px;
  }
  footer span {
    display: none;
  }
}

.scenario-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.scenario-panel > div {
  flex: 1;
  min-width: 220px;
}
.scenario-panel > div p {
  margin-bottom: 0;
}
.scenario-panel label {
  margin: 0;
  min-width: 240px;
}
.scenario-panel > p {
  flex-basis: 100%;
  margin: 0;
}
.scenario-panel #nextEvent {
  color: #567140;
}
.timeline {
  padding: 15px 0 0;
}
.timeline label {
  display: flex;
  justify-content: space-between;
  margin: 0;
}
.timeline input {
  padding: 0;
  min-height: 24px;
  accent-color: #3f7960;
}
.timeline p {
  font-size: 12px;
  margin: 2px 0 0;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
@media (max-width: 700px) {
  .scenario-panel {
    gap: 12px;
  }
  .scenario-panel label,
  .scenario-panel button {
    width: 100%;
  }
}

.chart-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 8px;
}
.chart-numbers span {
  font-size: 12px;
  color: #64745b;
}
.chart-numbers strong {
  display: block;
  color: #203e35;
  font:
    600 21px 'Space Grotesk',
    sans-serif;
  margin-top: 4px;
}
.chart-numbers small {
  grid-column: 1/-1;
  color: #74816b;
  font-size: 11px;
}
.layout-controls {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin: 0 0 10px;
}
.layout-controls button {
  font-size: 12px;
  min-height: 30px;
  padding: 5px 9px;
}
.movable-block {
  margin: 20px 0;
}
.movable-block .metrics {
  margin: 0;
}
.movable-block .bottom {
  display: block;
}
.movable-block .bus-charts {
  margin-top: 0;
}
.chart-heading label {
  width: 145px;
}
.chart-heading > div {
  flex-basis: 100%;
}
.movable-block {
  position: relative;
}
.layout-controls {
  position: absolute;
  top: -12px;
  right: 8px;
  margin: 0;
  z-index: 5;
}
.layout-controls .layout-toggle {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  background: #fcfdf9;
  color: #66765d;
}
.layout-menu {
  position: absolute;
  top: 29px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 7px;
  min-width: 135px;
  background: #fcfdf9;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 5px 18px #20373126;
}
.layout-menu[hidden] {
  display: none;
}
.layout-menu button {
  text-align: left;
  white-space: nowrap;
}
.movable-block .scenario-panel {
  margin-bottom: 0;
}
.scenario-dialog {
  width: min(850px, calc(100vw - 28px));
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  background: #fcfdf9;
  color: #203731;
}
.scenario-dialog::backdrop {
  background: #20373166;
}
.dialog-heading,
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dialog-heading button {
  font-size: 23px;
  padding: 0 12px;
}
.scenario-dialog textarea {
  width: 100%;
  height: 40vh;
  min-height: 200px;
  resize: vertical;
  padding: 14px;
  border: 1px solid #ced6c7;
  border-radius: 8px;
  font:
    13px/1.5 Consolas,
    monospace;
  background: white;
  color: #203731;
}
.format-guide {
  margin: 16px 0;
}
.format-guide p {
  font-size: 13px;
}
.dialog-actions {
  justify-content: flex-end;
}
[data-help] {
  text-decoration: underline dotted #819080;
  text-underline-offset: 4px;
  cursor: help;
}
.route-center {
  pointer-events: auto;
}
.explanation-tooltip {
  position: fixed;
  z-index: 1000;
  width: max-content;
  max-width: min(360px, calc(100vw - 16px));
  padding: 12px 14px;
  border: 1px solid #9ba98c;
  border-radius: 9px;
  background: #203e35;
  color: #fff;
  font:
    13px/1.5 DM Sans,
    sans-serif;
  box-shadow: 0 5px 20px #20373133;
  text-align: left;
  text-decoration: none;
}
.explanation-tooltip[hidden] {
  display: none;
}
button[hidden] {
  display: none;
}
.explainer-title {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  padding: 0;
  min-height: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.explainer-title:hover {
  background: transparent;
  color: #47754d;
}
.explainer-title span {
  display: inline-block;
  font-size: 0.7em;
  color: #728069;
  transition: transform 0.15s;
}
.explainer-title[aria-expanded='true'] span {
  transform: rotate(180deg);
}
.brand-title {
  font-size: 23px;
}
.scenario-jump {
  color: #315848;
  font-size: 14px;
  font-weight: 600;
  text-underline-offset: 4px;
  white-space: nowrap;
}
.problem-explainer {
  margin: 0 0 25px;
}
.problem-explainer[hidden] {
  display: none;
}
.problem-explainer p:last-child {
  margin-bottom: 0;
}
.problem-explainer a {
  color: #315848;
}
#scenarioLibrary {
  scroll-margin-top: 20px;
}
.intro p {
  max-width: 760px;
}
@media (max-width: 700px) {
  .brand-title {
    font-size: 19px;
  }
  .scenario-jump {
    display: inline-block;
    margin: 0 0 8px;
  }
}
@media (max-width: 700px) {
  .layout-controls .layout-toggle {
    width: 28px;
    height: 28px;
    min-height: 28px;
  }
  .layout-menu {
    top: 33px;
  }
  .layout-menu button {
    min-height: 40px;
  }
  .movable-block > .settings,
  .movable-block > .route-panel,
  .movable-block > .dispatch {
    width: 100%;
  }
}
.setup-error {
  color: #8a3b22;
  font-size: 13px;
  grid-column: 1/-1;
  margin: 4px 0 8px;
}
.setup-error[hidden] {
  display: none;
}
.scenario-guide-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 13px;
  color: var(--green);
  border: 1px solid #ced6c7;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  text-underline-offset: 3px;
}
.scenario-guide-link:hover {
  background: #e7eddc;
}
.scenario-guide-link:focus-visible {
  outline: 3px solid #a4bf6a;
  outline-offset: 2px;
}
.scenario-dialog .guide-intro {
  padding: 12px 0;
  margin: 0;
}
.scenario-dialog .guide-intro a {
  color: var(--green);
  font-weight: 600;
  text-underline-offset: 3px;
}
