* {
  box-sizing: border-box;
}
:root {
  color-scheme: light;
  --ink: #19392f;
  --muted: #56685e;
  --line: #d7dfd6;
  --green: #14634d;
  --paper: #fbfcf8;
}
body {
  margin: 0;
  background: #f2f4ed;
  color: var(--ink);
  font:
    15px/1.45 Inter,
    'Segoe UI',
    Arial,
    sans-serif;
}
button,
select,
input {
  font: inherit;
  color: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  background: transparent;
  border: none;
  font-weight: 600;
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid #ca792d;
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
[hidden] {
  display: none !important;
}
.top {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 42px;
  background: #183d34;
  color: #eff5ed;
  padding: 0 max(24px, calc((100vw - 1480px) / 2));
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.7px;
  white-space: nowrap;
}
.brandmark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #bce2b1;
  color: #184634;
  display: grid;
  place-content: center;
  font: bold 39px/0.7 Georgia;
  transform: rotate(-5deg);
}
nav {
  display: flex;
  gap: 16px;
  align-self: stretch;
}
.tab {
  color: #b8cdc1;
  position: relative;
  padding: 8px 5px;
  font-size: 14px;
}
.tab.active {
  color: #fff;
}
.tab.active:after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 3px;
  background: #bbdab1;
}
.tab span,
.count {
  padding: 1px 7px;
  border-radius: 12px;
  background: #deeadf;
  color: #365746;
  font-size: 12px;
  font-weight: 700;
}
.tab span {
  background: #33574a;
  color: #def1de;
}
.import {
  margin-left: auto;
  background: #e3efdb;
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 14px;
  color: #254735;
}
.import span,
.outline span {
  font-size: 17px;
  margin-right: 3px;
}
main {
  max-width: 1480px;
  margin: auto;
  padding: 26px 32px 40px;
}
.heading,
.sectionhead,
.toolbar,
.maptitle,
.mapfooter,
.dialoghead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.heading {
  margin-bottom: 18px;
}
.source {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #72966e;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(28px, 3.1vw, 45px);
  line-height: 1.16;
  letter-spacing: -1.6px;
  margin-top: 5px;
  font-weight: 650;
}
h2 {
  font-size: 19px;
  letter-spacing: -0.6px;
  font-weight: 650;
}
h3 {
  font-size: 16px;
}
.outline,
.primary,
.smallbtn {
  border: 1px solid #c6d1c5;
  background: var(--paper);
  padding: 9px 14px;
  border-radius: 7px;
  font-size: 14px;
}
.primary {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.outline:hover,
.smallbtn:hover {
  background: #ecf2e8;
}
.toolbar {
  justify-content: flex-start;
  background: #fafbf6;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 17px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
}
.toolbar label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolbar select {
  font-weight: 650;
  background: #edf2e9;
  border: 0;
  border-radius: 5px;
  padding: 5px 8px;
  color: var(--ink);
}
.toolbar i {
  height: 17px;
  width: 1px;
  background: var(--line);
}
#departure {
  margin-left: auto;
}
.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#departure.test-clock {
  color: #654714;
  background: #fff0c9;
  border-radius: 6px;
  padding: 5px 8px;
  font-weight: 650;
}
.trip-bookends {
  display: grid;
  gap: 4px;
  padding-top: 6px;
  margin-top: 3px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.3;
}
.trip-bookends small {
  display: block;
  color: var(--muted);
}
.quality-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.quality-list button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 3px 0;
  text-align: left;
}
#qualityFilter {
  margin: 0 0 12px;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 30%) minmax(0, 1fr);
  gap: 16px;
}
.workspace > *,
.schedule,
#orderPage {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  min-width: 0;
}
.workspace aside {
  padding: 17px;
  display: flex;
  flex-direction: column;
}
.sectionhead {
  margin-bottom: 15px;
}
.sectionhead > div > span,
.mapfooter,
.stats,
#tripMeta {
  font-size: 12px;
  color: var(--muted);
}
.manual-card, .routecard {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  text-align: left;
  display: grid;
  width: 100%;
  padding: 12px 14px;
  gap: 4px;
  margin: 0 0 9px;
  font-weight: 400;
}
.manual-card, .routecard.active {
  border: 1.5px solid #27735d;
  background: #eaf2e7;
  box-shadow: inset 3px 0 #27735d;
}
.routehead,
.money,
.mapfooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.routehead {
  font-weight: 650;
}
.routehead em {
  font-size: 11px;
  font-style: normal;
  font-weight: 550;
  color: #526c5b;
}
.money strong {
  font-size: 25px;
  letter-spacing: -1px;
  font-weight: 650;
}
.money small,
.stats {
  color: var(--muted);
  font-size: 12px;
}
.metrics {
  font-size: 13px;
  color: #3f594b;
}
.stats {
  margin-top: auto;
  padding-top: 8px;
}
.mapbox {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.maptitle {
  padding: 14px 18px;
}
.legend {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.legend b {
  width: 15px;
  height: 3px;
  background: #147058;
}
.legend b:nth-of-type(2) {
  background: #84978a;
  margin-left: 8px;
}
.maparea {
  position: relative;
  min-height: 332px;
  flex: 1;
  background: #e4e8dc;
}
.maparea canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.maparea canvas:active {
  cursor: grabbing;
}
.maptools {
  position: absolute;
  right: 12px;
  top: 12px;
  display: grid;
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 2px 12px #334a3226;
  overflow: hidden;
}
.maptools button {
  font-size: 20px;
  width: 40px;
  height: 39px;
}
.maptools button + button {
  border-top: 1px solid var(--line);
}
.maptools button:hover {
  background: #edf3ea;
}
.credit {
  position: absolute;
  right: 4px;
  bottom: 2px;
  color: #526554;
  background: #f6f8ebd9;
  font-size: 10px;
  text-decoration: none;
}
.mapfooter {
  min-height: 38px;
  padding: 6px 14px;
  justify-content: flex-start;
}
.mapfooter span {
  margin-right: auto;
}
.mapfooter button {
  font-size: 12px;
  color: #165c45;
  padding: 5px;
}
.maparea #scale {
  position: absolute;
  left: 12px;
  bottom: 6px;
  border-bottom: 2px solid #5d715e;
  text-align: center;
  font-size: 10px;
  text-shadow: 0 0 3px white;
}
#mapPick {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  max-width: calc(100% - 78px);
  background: var(--paper);
  box-shadow: 0 2px 16px #27403226;
  font-size: 13px;
}
#mapPick button {
  color: var(--green);
  padding: 5px 8px 2px 0;
}
.schedule,
#orderPage {
  margin-top: 16px;
  padding: 18px;
}
.tablewrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
  text-align: left;
}
th {
  font-size: 11px;
  letter-spacing: 0.3px;
  color: var(--muted);
  font-weight: 600;
  padding: 8px;
  background: #eff2eb;
}
td {
  padding: 9px 8px;
  border-bottom: 1px solid #e3e9df;
}
td small {
  display: block;
  color: var(--muted);
}
td b {
  font-weight: 600;
}
.tripnumbers {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 13px;
}
.tripnumbers b {
  color: var(--ink);
}
.tag {
  display: inline-block;
  padding: 2px 6px;
  background: #eaf0e5;
  border-radius: 5px;
  font-size: 11px;
}
.warn {
  color: #81571d;
}
.empty {
  padding: 14px;
  background: #f0f3eb;
  border-radius: 6px;
}
.smallbtn {
  padding: 5px 9px;
  font-size: 12px;
}
.dialoghead {
  position: sticky;
  top: 0;
  background: var(--paper);
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.dialoghead button {
  font-size: 25px;
  line-height: 1;
  padding: 6px 9px;
}
dialog {
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  width: min(720px, 96vw);
  max-height: 91dvh;
  background: var(--paper);
  box-shadow: 0 15px 80px #122f3128;
}
dialog::backdrop {
  background: #20372f66;
}
#dialogBody {
  padding: 18px 20px;
}
.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.formgrid label {
  font-size: 13px;
  color: var(--muted);
  display: grid;
  gap: 4px;
}
.formgrid input,
.formgrid select,
#search,
.roadline input {
  width: 100%;
  min-width: 0;
  border: 1px solid #c4d0c4;
  border-radius: 6px;
  padding: 8px;
  background: white;
}
.formgrid input[type='checkbox'] {
  width: auto;
}
.check {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px !important;
}
.full {
  grid-column: 1/-1;
}
.formgrid h3 {
  margin-top: 9px;
}
.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 15px;
}
.roadline {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.roadline p {
  font-size: 13px;
  margin-bottom: 5px;
}
.roadline input {
  width: 85px;
  margin-right: 4px;
}
.roadline a {
  color: var(--green);
  margin-right: 8px;
}
#notice {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #213f32;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  max-width: 90vw;
  z-index: 8;
  font-size: 14px;
  box-shadow: 0 2px 16px #162b2855;
}
#search {
  max-width: 340px;
}
#orderPage {
  margin-top: 0;
}
.error {
  color: #9a482e;
  font-size: 13px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.rank {
  border-radius: 50%;
  width: 9px;
  height: 9px;
  display: inline-block;
  margin-right: 6px;
  background: #14705a;
}
@media (max-width: 900px) {
  main {
    padding: 17px;
  }
  .top {
    padding: 0 18px;
    gap: 24px;
  }
  .workspace {
    grid-template-columns: minmax(225px, 33%) minmax(0, 1fr);
    gap: 10px;
  }
  .workspace aside {
    padding: 12px;
  }
  .routecard {
    padding: 10px;
  }
  .toolbar {
    gap: 10px;
  }
  #departure {
    margin-left: 0;
  }
  .maparea {
    min-height: 345px;
  }
}
@media (max-width: 650px) {
  main {
    padding: 13px 10px;
  }
  .top {
    gap: 12px;
    min-height: 58px;
    padding: 0 10px;
  }
  .brand {
    font-size: 16px;
  }
  .brandmark {
    width: 28px;
    height: 28px;
    font-size: 30px;
  }
  nav {
    gap: 6px;
  }
  .tab,
  .import {
    font-size: 12px;
  }
  .import {
    padding: 7px;
  }
  .heading {
    gap: 6px;
  }
  .heading .outline {
    padding: 7px 9px;
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .mapbox {
    order: -1;
  }
  .maparea {
    min-height: 305px;
  }
  .toolbar {
    padding: 9px;
  }
  .toolbar i {
    display: none;
  }
  .toolbar label {
    gap: 4px;
  }
  .legend {
    font-size: 10px;
  }
  .schedule,
  #orderPage {
    padding: 12px;
  }
  .formgrid {
    gap: 9px;
  }
  .sectionhead {
    flex-wrap: wrap;
  }
  #orderPage .sectionhead > div {
    display: flex;
    gap: 5px;
  }
  .routecard {
    margin-bottom: 6px;
  }
  .maptitle {
    padding: 9px 12px;
  }
  .tablewrap table {
    min-width: 530px;
  }
  dialog {
    width: 96vw;
  }
  .source {
    font-size: 11px;
  }
}

main {max-width: 1820px; padding-inline: clamp(10px,2vw,32px);}
.workspace {grid-template-columns:minmax(235px, min(24vw,340px)) minmax(0,1fr);}
.maparea {min-height:clamp(400px,54vh,780px);}
.maparea canvas {cursor:default;}
.mapactions, #fullRoute {display:flex;align-items:center;flex-wrap:wrap;gap:10px;}
.mapactions {margin-left:auto;font-size:13px;}
.maptitle {flex-wrap:wrap;}
#fullRoute {padding:10px 14px;background:#eef4eb;}
#fullRoute a {text-decoration:none;}
#fullRoute small {color:var(--muted);}
.mapbox.expanded {position:fixed;inset:0;z-index:7;border-radius:0;background:var(--paper);}
.mapOpen {overflow:hidden;}
.expanded .maparea {min-height:0;}
#mapPick {max-width:min(360px,calc(100% - 60px));max-height:calc(100% - 22px);overflow:auto;box-sizing:border-box}
.order-times {margin:6px 0;padding:5px 0;border-block:1px solid var(--line);font-size:13px;line-height:1.45}
#mapPick button {min-height:36px;padding:5px 10px;background:#e5eee2;border-radius:5px;margin:4px 4px 0 0;}
#routes>.primary {margin-top:10px;}
@media(max-width:650px){.maparea{min-height:45dvh}.mapactions{margin-left:0}.maptitle .legend{display:none;}}

.swatch{display:inline-block;width:14px;height:4px;vertical-align:middle;border-radius:2px}
.swatch.car{background:#226aba}.swatch.foot{background:#74ae4d}.swatch.unknown{background:#788780}
#mapHover{position:absolute;top:8px;max-width:min(320px,68%);pointer-events:none;border:1px solid var(--line);border-radius:8px;padding:9px 12px;background:#fffffff5;box-shadow:0 2px 12px #27403222;font-size:13px}
#mapHover small{color:var(--muted)}
#chainTotal{font-weight:650;background:#e7f1e7;color:#163f31;padding:9px 14px;font-size:14px}
#homeRoads{padding:5px 14px;font-size:12px}
#homeRead{padding:4px 8px;margin:3px}
#homeStatus{color:var(--muted)}
#pickFailure {
  margin: 8px 0 1px;
  color: #8a3b22;
  line-height: 1.4;
}
.route-orders {
  margin: -2px 0 12px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}
.route-orders details {
  border-left: 3px solid #27735d;
  border-radius: 5px;
  background: #edf3ec;
  padding: 7px 9px;
  font-size: 13px;
}
.route-orders summary { cursor: pointer; }
.route-orders summary strong { float: right; }
.route-orders summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.route-orders p { margin: 7px 0 1px; }
.manual-home {border-top:1px solid var(--line);margin-top:4px;padding-top:6px;font-size:13px;color:#375547}
.manual-times {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  margin: 4px 0;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.manual-times dd {margin:0;text-align:right;font-weight:650}
.manual-waits {
  margin: 0 0 6px;
  padding: 7px 8px 7px 23px;
  border-radius: 5px;
  background: #fbf5dd;
  color: #493b1e;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.manual-waits li + li {margin-top:4px}
#lessWait {margin-top:6px}

#driverTotal:not([hidden]) {display:flex;flex-wrap:wrap;align-items:center;gap:8px clamp(14px,3vw,48px);padding:14px 18px;margin:0 0 12px;background:#f8fbf6;border:1px solid var(--line);border-radius:10px}
#driverTotal div {display:grid;gap:2px}
#driverTotal strong {font-size:clamp(16px,1.45vw,23px)}
#driverTotal div:first-child strong {color:#14533f}
#driverTotal small {color:#425e51}
#driverTotal .total-note {flex-basis:100%}
.directions {font-size:13px;white-space:nowrap;color:#395c4c}
.directions b {font-size:16px}
.maplayers {position:relative;margin-left:auto}
.maplayers summary {cursor:pointer;padding:9px 12px}
.maplayers .mapactions {position:absolute;top:100%;right:0;z-index:4;background:var(--paper);border:1px solid var(--line);border-radius:8px;padding:12px;width:max-content;max-width:230px}
#mapPick #addChain,.trip-action {background:#196449;color:white;padding:8px 12px;border-radius:6px}
#mapPick button:disabled,.trip-action:disabled {opacity:.65}
#orderPage .sectionhead {flex-wrap:wrap;gap:8px}
#orderPage select {padding:7px}
@media(max-width:650px){.maplayers .mapactions{right:auto;left:0}.directions{white-space:normal}}

#editStops {width:100%;margin:0 0 12px}
#stopList {list-style:none;padding:0;margin:14px 0}
#stopList li {display:flex;align-items:center;gap:6px;border-top:1px solid #d6dfd5;padding:8px 0}
#stopList li div {flex:1;min-width:0;overflow-wrap:anywhere}
#stopList small {display:block;color:#4b625b}
#stopList button {min-width:44px;min-height:44px;font-size:18px}
#stopList button:disabled {opacity:.28}
#stopError {color:#9c3c19}

.rank-controls {display:flex;flex-wrap:wrap;gap:8px 12px;margin:10px 0 14px}
.rank-controls label {display:grid;gap:4px;flex:1 1 9em;font-size:.85rem}
.rank-controls select {min-width:0;max-width:100%;padding:6px;border:1px solid #b9c8bd;border-radius:5px;background:white;color:inherit}
