* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: #cfc8be;
  color: #111;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: center;
  width: min(64rem, calc(100% - 32px));
  margin: 18px auto 0;
  font-size: 14px;
}
.site-nav a {
  color: #111;
  text-decoration: none;
  font-weight: 600;
}
.site-nav a:hover { color: #333366; }
.site-nav a[aria-current="page"] { color: #333366; }
.site-nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.site-nav .brand img { display: block; width: 28px; height: 28px; }

.box {
  width: min(28rem, calc(100% - 32px));
  margin: 22px auto 24px;
  background: #fff;
  padding: 22px 22px 20px;
  border-left: 10px solid #333366;
}
body.changes .box {
  width: min(40rem, calc(100% - 32px));
}

h1 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 16px;
  color: #4a4a4a;
  font-size: 14px;
}

.choices { display: grid; gap: 10px; }
.choice {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-left: 6px solid #333366;
  padding: 14px 14px 14px 12px;
}
.choice:hover, .choice:focus { background: #f4f2ee; }
.choice .kicker { display: block; font-weight: 700; font-size: 16px; }
.choice .blurb { display: block; margin-top: 4px; color: #4a4a4a; font-size: 14px; line-height: 1.35; }

.site-foot {
  width: min(28rem, calc(100% - 32px));
  margin: 0 auto 28px;
  color: #4a4a4a;
  font-size: 12px;
  line-height: 1.45;
}

.field { display: block; }
.field span, .field-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #4a4a4a;
  margin-bottom: 6px;
}
.field input, .field input[type="search"], .field select {
  width: 100%;
  border: 1px solid #7a7a7a;
  padding: 9px 10px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}

.results {
  margin-top: 8px;
  border: 1px solid #d0d0d0;
  max-height: 22rem;
  overflow: auto;
}
.result, .address-hit {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #eee;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}
.result:last-child, .address-hit:last-child { border-bottom: 0; }
.result:hover, .result:focus, .address-hit:hover, .address-hit:focus { background: #f4f2ee; }
.result.gone, .result.gone:hover, .result.gone:focus { background: #ffd6d6; }
.change-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 14px;
  font-size: 13px;
}
.change-legend span { display: inline-flex; align-items: center; gap: 6px; }
.change-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid #666;
  font-style: normal;
}
.change-swatch.added { background: #d8f3dc; }
.change-swatch.removed { background: #ffd6d6; }
.change-swatch.moved { background: #fff3b0; }
.result .name { font-weight: 600; font-size: 14px; }
.result .code { color: #4a4a4a; font-size: 12px; margin-left: 6px; font-weight: 400; }
.result .lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 5px;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}
.dir {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #4a4a4a;
  margin-left: 2px;
}

.picked { margin-top: 18px; padding-top: 16px; border-top: 1px solid #d0d0d0; }
.picked-name { font-weight: 700; font-size: 18px; }
.picked-meta { color: #4a4a4a; font-size: 13px; margin: 2px 0 12px; }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-bottom: 10px;
  font-size: 14px;
}
.check { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.check[hidden] { display: none; }
.map-filter { margin-top: 12px; }
.map-count { margin: 8px 0 0; font-size: 13px; color: #333; }
.jur-row { display: flex; align-items: center; gap: 8px; }
.jur-only {
  border: 0;
  background: transparent;
  color: #333366;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.map-advanced { margin-top: 14px; font-size: 14px; }
.map-advanced summary { cursor: pointer; font-weight: 600; }
.map-advanced .check { margin-top: 8px; }
.jur-set { border: 0; margin: 12px 0 0; padding: 0; }
.jur-set legend { font-weight: 600; font-size: 13px; padding: 0; }
.jur-set .check { font-size: 13px; }

.routes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.routes label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #d0d0d0;
  padding: 4px 8px 4px 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.routes label.off { opacity: 0.4; }
.routes input { margin: 0; }

#go, .out-bar button, .map-clear {
  background: #111;
  color: #fff;
  border: 0;
  padding: 9px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
#go { width: 100%; }
#go:disabled, .gen-alt button:disabled { background: #999; color: #fff; cursor: not-allowed; }
.gen-alt {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.gen-alt button {
  flex: 1;
  background: #fff;
  color: #111;
  border: 1px solid #7a7a7a;
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.map-clear { background: #fff; color: #111; border: 1px solid #7a7a7a; margin-top: 12px; }

.err { color: #951f20; font-size: 13px; margin: 10px 0 0; }

.out { width: min(8.7in, calc(100% - 24px)); margin: 0 auto 40px; }
.out-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.out-bar button { background: #fff; color: #111; border: 1px solid #7a7a7a; }
#preview {
  width: 100%;
  height: 0;
  border: 0;
  background: transparent;
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
}

.map-body {
  height: 100vh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.map-body .site-nav {
  width: auto;
  margin: 0;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #d0d0d0;
}
.map-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 22rem 1fr;
}
.map-panel {
  background: #fff;
  border-right: 1px solid #d0d0d0;
  padding: 16px 16px 20px;
  overflow: auto;
}
.map-panel h1 { font-size: 20px; }
#map { height: 100%; min-height: 0; background: #d9d4cc; }
.map-status { color: #4a4a4a; font-size: 13px; margin: 10px 0 0; }
.leaflet-tooltip.address-tip {
  background: #fff;
  color: #111;
  border: 1px solid #d0d0d0;
  border-left: 4px solid #951f20;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 10px;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  font-weight: 700;
  white-space: normal;
  max-width: 16rem;
}
.address-hit .addr { font-size: 13px; line-height: 1.35; }

.leaflet-tooltip.stop-tip {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  border: 1px solid #d0d0d0;
  border-left: 4px solid #333366;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 10px 8px 8px;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  white-space: normal;
  width: max-content;
  max-width: min(40rem, calc(100vw - 2rem));
}
.leaflet-tooltip.stop-tip.stop-locked { border-left-color: #111; }
.leaflet-tooltip-top.stop-tip::before { border-top-color: #d0d0d0; }
.tip-name { font-weight: 700; font-size: 14px; }
.tip-code { color: #4a4a4a; font-size: 12px; margin-top: 1px; }
.tip-routes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.tip-actions { display: flex; flex-wrap: nowrap; gap: 8px 12px; margin-top: 8px; white-space: nowrap; }
.tip-actions a { color: #333366; font-size: 12px; font-weight: 700; }

@media (max-width: 800px) {
  .map-body { height: auto; min-height: 100vh; overflow: auto; }
  .map-layout { grid-template-columns: 1fr; }
  #map { height: 70vh; }
}
