:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --surface: rgba(250, 252, 255, 0.94);
  --surface-strong: #ffffff;
  --ink: #172033;
  --muted: #5c687a;
  --subtle: #8b96a7;
  --line: rgba(20, 32, 50, 0.12);
  --field: rgba(255, 255, 255, 0.88);
  --primary: #2d6cdf;
  --primary-strong: #1f55b8;
  --route: #1f6fff;
  --route-alt: #27313f;
  --closed: #d94236;
  --shadow: 10px 0 34px rgba(15, 23, 42, 0.10);
  --soft-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  font-family: "Gotham Rounded", "Gotham Rounded SSm", "Avenir Next Rounded", "Nunito Sans", "SF Pro Rounded", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161c27;
  --surface: rgba(31, 39, 52, 0.94);
  --surface-strong: rgba(43, 52, 67, 0.96);
  --ink: #f4f7fb;
  --muted: #c0cad8;
  --subtle: #9ca8b8;
  --line: rgba(255, 255, 255, 0.13);
  --field: rgba(255, 255, 255, 0.12);
  --primary: #4da3ff;
  --primary-strong: #7bbcff;
  --route: #4da3ff;
  --route-alt: #b4a7ff;
  --closed: #ff6961;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --soft-shadow: 0 12px 36px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow: hidden;
}

body {
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(45, 108, 223, 0.18), transparent 30%),
    linear-gradient(135deg, rgba(243, 246, 250, 0.96), rgba(224, 231, 241, 0.96));
}

body[data-theme="dark"] .auth-gate {
  background:
    radial-gradient(circle at 20% 20%, rgba(77, 163, 255, 0.18), transparent 30%),
    linear-gradient(135deg, rgba(22, 28, 39, 0.98), rgba(31, 39, 52, 0.98));
}

.auth-gate[hidden] {
  display: none;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(380px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(24px) saturate(1.2);
}

.login-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: 0;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--closed);
  font-size: 13px;
  font-weight: 720;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(360px, 404px) 1fr;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  background: var(--bg);
  transition: grid-template-columns 0.22s ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0 1fr;
}

.sidebar {
  position: relative;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0)),
    var(--surface);
  border-right: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 0;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.25);
  transition:
    opacity 0.18s ease,
    transform 0.22s ease;
}

body.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.current-user {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.logout-button {
  min-width: 52px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--field);
  cursor: pointer;
  font-size: 12px;
  font-weight: 780;
}

.logout-button:hover {
  color: var(--ink);
  background: var(--surface-strong);
}

.panel-toggle-button,
.show-sidebar-button,
.traffic-legend-toggle {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--field);
  cursor: pointer;
}

.panel-toggle-button::before,
.show-sidebar-button::before {
  width: 16px;
  height: 16px;
  background: currentColor;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Crect x='2.25' y='3' width='13.5' height='12' rx='2' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M6.75 3V15M11.25 7L13.5 9L11.25 11' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Crect x='2.25' y='3' width='13.5' height='12' rx='2' stroke='black' stroke-width='1.8'/%3E%3Cpath d='M6.75 3V15M11.25 7L13.5 9L11.25 11' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.panel-toggle-button::before {
  transform: rotate(180deg);
}

.show-sidebar-button {
  position: absolute;
  z-index: 470;
  top: 14px;
  left: 14px;
  display: none;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(24px) saturate(1.35);
}

body.sidebar-collapsed .show-sidebar-button {
  display: grid;
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.workflow-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.workflow-tabs button {
  display: grid;
  place-items: center;
  position: relative;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.workflow-tabs button.active {
  color: var(--primary);
}

.workflow-tabs button.active::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 2px;
  border-radius: 999px 999px 0 0;
  background: var(--primary);
  content: "";
}

.status-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #30d158;
  box-shadow: 0 0 0 5px rgba(48, 209, 88, 0.16);
  flex: 0 0 auto;
}

.status-dot.is-offline {
  background: #ff9f0a;
  box-shadow: 0 0 0 5px rgba(255, 159, 10, 0.16);
}

.status-dot.is-pending {
  background: #8e8e93;
  box-shadow: 0 0 0 5px rgba(142, 142, 147, 0.14);
}

.tab-panel[hidden] {
  display: none;
}

.geometry-panel[hidden] {
  display: none;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 17px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.panel h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
}

.geometry-panel {
  display: grid;
  gap: 13px;
  margin-top: auto;
  padding: 0;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(45, 108, 223, 0.09), rgba(48, 209, 88, 0.07)),
    var(--surface);
}

.geometry-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
  text-transform: uppercase;
}

.geometry-panel summary::-webkit-details-marker {
  display: none;
}

.geometry-panel summary::after {
  width: 14px;
  height: 14px;
  background: currentColor;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.16s ease;
}

.geometry-panel[open] summary::after {
  transform: rotate(180deg);
}

.geometry-pill {
  display: inline-grid;
  min-height: 24px;
  place-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: #176333;
  background: rgba(48, 209, 88, 0.16);
  font-size: 11px;
  font-weight: 800;
}

.geometry-pill.warning {
  color: #8a3a00;
  background: rgba(255, 159, 10, 0.17);
}

.geometry-status {
  display: grid;
  gap: 12px;
  padding: 0 20px 18px;
}

.geometry-main {
  display: grid;
  gap: 3px;
}

.geometry-main strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
}

.geometry-main span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.geometry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.geometry-grid div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.46);
}

body[data-theme="dark"] .geometry-grid div {
  background: rgba(255, 255, 255, 0.07);
}

.geometry-grid dt {
  margin: 0 0 3px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.geometry-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.2;
}

.geometry-pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.geometry-pipeline span {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--field);
  font-size: 10px;
  font-weight: 760;
}

.geometry-change-list {
  display: grid;
  gap: 8px;
}

.geometry-change-list > strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.geometry-change-list article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.geometry-change-list b {
  color: var(--ink);
  font-size: 12px;
}

.geometry-change-list span,
.geometry-change-list small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
select {
  min-width: 0;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--field);
  outline: none;
}

select option {
  color: #111827;
  background: #ffffff;
}

body[data-theme="dark"] select option {
  color: #f4f7fb;
  background: #2a3240;
}

input:focus,
select:focus {
  border-color: rgba(0, 122, 255, 0.72);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.13);
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.trip-editor {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 10px;
  align-items: center;
}

.trip-fields {
  display: grid;
  gap: 10px;
}

.waypoint-list {
  display: grid;
  gap: 10px;
}

.waypoint-search-row {
  grid-template-columns: 1fr 42px 42px;
}

.swap-trip-button {
  display: grid;
  width: 42px;
  height: 72px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--field);
  cursor: pointer;
  font-size: 27px;
  font-weight: 800;
  line-height: 1;
}

.swap-trip-button:hover,
.add-destination-button:hover {
  border-color: rgba(0, 122, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.add-destination-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 760;
  text-align: left;
}

.add-destination-button::before {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #172033;
  background: currentColor;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28' fill='none'%3E%3Ccircle cx='14' cy='14' r='11.25' stroke='black' stroke-width='2.5'/%3E%3Cpath d='M14 8.5V19.5M8.5 14H19.5' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center / 28px 28px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28' fill='none'%3E%3Ccircle cx='14' cy='14' r='11.25' stroke='black' stroke-width='2.5'/%3E%3Cpath d='M14 8.5V19.5M8.5 14H19.5' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center / 28px 28px no-repeat;
}

.add-destination-button::after {
  content: none;
}

.split,
.draw-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

#closureDirection {
  height: 38px;
}

.speed-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-input-row input {
  max-width: 96px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary-button {
  color: #fff;
  background: linear-gradient(180deg, #3578ee, var(--primary-strong));
  font-weight: 760;
  box-shadow: 0 12px 24px rgba(45, 108, 223, 0.26);
}

.primary-button:hover,
.secondary-button:hover {
  filter: brightness(1.04);
}

.secondary-button {
  color: #fff;
  background: linear-gradient(180deg, #5856d6, #3d3bb0);
  font-weight: 720;
}

.secondary-button.active {
  background: linear-gradient(180deg, var(--closed), #d22f27);
}

.ghost-button,
.icon-button {
  padding: 0 11px;
  color: var(--primary);
  background: var(--field);
  border-color: var(--line);
}

.icon-button {
  position: relative;
  display: grid;
  place-items: center;
  line-height: 1;
}

.search-icon-button::before {
  width: 19px;
  height: 19px;
  background: currentColor;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22' fill='none'%3E%3Ccircle cx='9.5' cy='9.5' r='6.25' stroke='black' stroke-width='2.25'/%3E%3Cpath d='M14.2 14.2L19 19' stroke='black' stroke-width='2.25' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22' fill='none'%3E%3Ccircle cx='9.5' cy='9.5' r='6.25' stroke='black' stroke-width='2.25'/%3E%3Cpath d='M14.2 14.2L19 19' stroke='black' stroke-width='2.25' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.search-icon-button::after {
  content: none;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.closure-list,
.route-list {
  display: grid;
  gap: 10px;
}

.empty {
  padding: 12px;
  color: var(--muted);
  border: 1px dashed rgba(92, 104, 122, 0.24);
  border-radius: 8px;
  font-size: 12px;
  background: rgba(127, 127, 127, 0.04);
}

.empty.warning {
  color: var(--closed);
  border-color: rgba(217, 66, 54, 0.38);
  background: rgba(217, 66, 54, 0.08);
}

.empty span {
  display: block;
  margin-top: 6px;
  color: var(--subtle);
  font-size: 11px;
  line-height: 1.35;
}

.closure-item,
.route-item {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-align: left;
  background: var(--field);
}

.route-item {
  grid-template-columns: 28px 1fr;
  align-items: center;
  cursor: pointer;
  min-height: 68px;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.route-item:hover,
.route-item:focus-visible {
  border-color: rgba(0, 122, 255, 0.72);
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.11);
  transform: translateY(-1px);
}

.route-item b {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--subtle);
  font-size: 12px;
  font-weight: 800;
}

.route-copy {
  display: grid;
  gap: 6px;
}

.closure-item strong,
.route-copy strong {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  font-weight: 760;
}

.route-copy strong span {
  font-size: 17px;
  letter-spacing: 0;
}

.route-copy strong em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 740;
}

.closure-item span,
.route-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.38;
}

.direction-edit-item {
  border-color: rgba(8, 127, 140, 0.28);
  background:
    linear-gradient(180deg, rgba(8, 127, 140, 0.10), rgba(8, 127, 140, 0.04)),
    var(--field);
}

.direction-edit-item strong::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.speed-edit-item {
  border-color: rgba(242, 183, 5, 0.34);
  background:
    linear-gradient(180deg, rgba(242, 183, 5, 0.14), rgba(242, 183, 5, 0.05)),
    var(--field);
}

.speed-edit-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
}

.speed-edit-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-delete-button {
  position: relative;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(217, 66, 54, 0.22);
  border-radius: 999px;
  background: rgba(217, 66, 54, 0.08);
  cursor: pointer;
}

.item-delete-button:hover {
  background: rgba(217, 66, 54, 0.15);
}

.item-delete-button::before,
.item-delete-button::after {
  position: absolute;
  top: 13px;
  left: 8px;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: var(--closed);
  content: "";
}

.item-delete-button::before {
  transform: rotate(45deg);
}

.item-delete-button::after {
  transform: rotate(-45deg);
}

.selected-road-card {
  display: grid;
  gap: 10px;
}

.selected-road-summary {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(8, 127, 140, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 127, 140, 0.10), rgba(8, 127, 140, 0.04)),
    var(--field);
}

.selected-road-summary strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.selected-road-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.route-detail {
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.route-item.expanded {
  align-items: start;
}

.route-item.primary {
  border-color: rgba(31, 111, 255, 0.45);
  background:
    linear-gradient(180deg, rgba(31, 111, 255, 0.13), rgba(31, 111, 255, 0.07)),
    var(--field);
  box-shadow: inset 0 0 0 1px rgba(31, 111, 255, 0.12);
}

.route-item.primary b {
  background: var(--route);
}

.route-item.alternative {
  background: rgba(255, 255, 255, 0.64);
}

body[data-theme="dark"] .route-item.alternative {
  background: rgba(255, 255, 255, 0.08);
}

.route-item.alternative b {
  background: var(--route-alt);
}

.route-item.blocked {
  cursor: default;
  opacity: 0.82;
  background: rgba(217, 66, 54, 0.06);
}

.route-item.blocked:hover,
.route-item.blocked:focus-visible {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.route-item.blocked b {
  background: var(--closed);
}

.discarded-routes {
  display: grid;
  gap: 9px;
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(127, 127, 127, 0.05);
  overflow: hidden;
}

.discarded-routes summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
  list-style: none;
}

.discarded-routes summary::-webkit-details-marker {
  display: none;
}

.discarded-routes summary::after {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease;
}

.discarded-routes[open] summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.discarded-routes summary span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: var(--closed);
  background: rgba(217, 66, 54, 0.12);
  margin-left: auto;
  margin-right: 10px;
}

.discarded-route-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.closure-item {
  position: relative;
  padding-left: 44px;
}

.closure-item::before {
  position: absolute;
  top: 13px;
  left: 12px;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--closed);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  content: "";
}

.closure-item::after {
  position: absolute;
  top: 23px;
  left: 17px;
  width: 14px;
  height: 4px;
  border-radius: 999px;
  background: #fff;
  content: "";
}

.routes-panel {
  margin-bottom: 4px;
}

.speed-profile-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.speed-profile-card:empty {
  display: none;
}

.speed-profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.speed-profile-head div {
  display: grid;
  gap: 2px;
}

.speed-profile-head strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 820;
}

.speed-profile-head span,
.speed-profile-head b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.speed-chart {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(248, 250, 252, 0.52));
}

body[data-theme="dark"] .speed-chart {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
}

.speed-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.speed-chart-grid line {
  stroke: rgba(100, 116, 139, 0.18);
  stroke-width: 1;
}

.speed-chart-grid text,
.speed-chart-distance text,
.speed-chart-origin {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.speed-chart-axis {
  stroke: rgba(71, 85, 105, 0.42);
  stroke-width: 1.2;
}

.speed-profile-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.speed-profile-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.speed-profile-legend i {
  width: 18px;
  height: 4px;
  border-radius: 999px;
}

.speed-profile-legend .traffic-speed {
  background: #1f6fff;
}

.speed-profile-legend .edited-speed {
  background: #d94236;
}

.speed-profile-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.map-wrap {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  background: #cfd9e4;
}

.map-toolbar {
  position: absolute;
  z-index: 450;
  top: 14px;
  left: 14px;
  right: auto;
  display: flex;
  justify-content: space-between;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(24px) saturate(1.35);
}

body.sidebar-collapsed .map-toolbar {
  left: 58px;
}

.map-appearance-control {
  position: absolute;
  z-index: 460;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(24px) saturate(1.35);
}

.traffic-control {
  position: absolute;
  z-index: 455;
  left: 14px;
  bottom: 28px;
  display: grid;
  gap: 8px;
  width: min(278px, calc(100vw - 420px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(24px) saturate(1.35);
}

.traffic-control[hidden] {
  display: none !important;
}

.traffic-control-head {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 8px;
  align-items: center;
}

.traffic-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--field);
  cursor: pointer;
  font-size: 13px;
  font-weight: 760;
}

.traffic-legend-toggle::before {
  width: 16px;
  height: 16px;
  background: currentColor;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M4 6.5H14M4 9H14M4 11.5H10.5' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Crect x='2.25' y='3.25' width='13.5' height='11.5' rx='2' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M4 6.5H14M4 9H14M4 11.5H10.5' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Crect x='2.25' y='3.25' width='13.5' height='11.5' rx='2' stroke='black' stroke-width='1.6'/%3E%3C/svg%3E") center / contain no-repeat;
}

body.traffic-legend-collapsed .traffic-legend {
  display: none;
}

body.traffic-legend-collapsed .traffic-legend-toggle {
  color: var(--primary);
  background: var(--surface-strong);
}

.traffic-toggle.active {
  color: #fff;
  border-color: rgba(45, 108, 223, 0.42);
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
}

.traffic-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

#trafficStatus {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.traffic-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.13);
}

.traffic-mode-toggle button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

.traffic-mode-toggle button.active {
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.13);
}

.traffic-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  color: var(--muted);
  font-size: 11px;
}

.traffic-legend.hidden {
  display: none;
}

.traffic-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.traffic-legend i {
  width: 18px;
  height: 4px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.range-1 {
  background: #7ee36d;
}

.range-2 {
  background: #52ff31;
}

.range-3 {
  background: #08cc22;
}

.range-4 {
  background: #037c1b;
}

.range-5 {
  background: #ffff00;
}

.range-6 {
  background: #ff8040;
}

.range-7 {
  background: #ff55aa;
}

.range-9 {
  background: #804040;
}

.level-fluid {
  background: #7ee36d;
}

.level-slow {
  background: #e3ae5b;
}

.level-retention {
  background: #df7d54;
}

.level-congestion {
  background: #d94f45;
}

.level-empty {
  background: #9b5da6;
}

.map-theme-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.13);
}

.map-theme-button {
  position: relative;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.map-theme-button.active {
  color: var(--ink);
  background: var(--surface-strong);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.16);
}

.map-theme-button::before,
.map-theme-button::after {
  position: absolute;
  content: "";
}

.sun-icon::before {
  inset: 0;
  margin: auto;
  width: 19px;
  height: 19px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22' fill='none'%3E%3Ccircle cx='11' cy='11' r='4' stroke='black' stroke-width='2'/%3E%3Cpath d='M11 1.75V4M11 18V20.25M20.25 11H18M4 11H1.75M17.54 4.46L15.95 6.05M6.05 15.95L4.46 17.54M17.54 17.54L15.95 15.95M6.05 6.05L4.46 4.46' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22' fill='none'%3E%3Ccircle cx='11' cy='11' r='4' stroke='black' stroke-width='2'/%3E%3Cpath d='M11 1.75V4M11 18V20.25M20.25 11H18M4 11H1.75M17.54 4.46L15.95 6.05M6.05 15.95L4.46 17.54M17.54 17.54L15.95 15.95M6.05 6.05L4.46 4.46' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.sun-icon::after {
  content: none;
}

.moon-icon::before {
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22' fill='none'%3E%3Cpath d='M18.35 14.28C17.07 16.98 14.32 18.85 11.13 18.85C6.72 18.85 3.15 15.28 3.15 10.87C3.15 7.68 5.02 4.93 7.72 3.65C7.33 4.56 7.12 5.57 7.12 6.62C7.12 11 10.7 14.58 15.08 14.58C16.13 14.58 17.14 14.37 18.05 13.98L18.35 14.28Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22' fill='none'%3E%3Cpath d='M18.35 14.28C17.07 16.98 14.32 18.85 11.13 18.85C6.72 18.85 3.15 15.28 3.15 10.87C3.15 7.68 5.02 4.93 7.72 3.65C7.33 4.56 7.12 5.57 7.12 6.62C7.12 11 10.7 14.58 15.08 14.58C16.13 14.58 17.14 14.37 18.05 13.98L18.35 14.28Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}

.moon-icon::after {
  content: none;
}

.speed-colors-icon {
  background: var(--field);
}

.speed-colors-icon::before {
  inset: 8px 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #d94236 0 28%, #f2b84b 28% 58%, #24a148 58% 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.speed-colors-icon::after {
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.42;
}

.speed-color-slider {
  --red-pos: 12.5%;
  --green-pos: 41.6%;
  display: grid;
  grid-template-columns: 42px 158px 42px;
  align-items: center;
  gap: 7px;
  min-width: 256px;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 780;
}

.speed-range-value {
  width: 42px;
  height: 30px;
  padding: 0 5px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 5px 14px rgba(45, 108, 223, 0.22);
  font-size: 12px;
  font-weight: 820;
  text-align: center;
}

.speed-range-value::-webkit-outer-spin-button,
.speed-range-value::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.speed-range-track {
  position: relative;
  height: 30px;
}

.speed-range-track::before,
.speed-range-track::after {
  position: absolute;
  left: 0;
  right: 0;
  top: 14px;
  height: 3px;
  border-radius: 999px;
  content: "";
}

.speed-range-track::before {
  background: rgba(45, 108, 223, 0.24);
}

.speed-range-track::after {
  left: var(--red-pos);
  right: calc(100% - var(--green-pos));
  background: linear-gradient(90deg, #d94236, #f2b84b 48%, #24a148);
}

.speed-range-track input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 30px;
  margin: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
}

.speed-range-track input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: transparent;
}

.speed-range-track input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--surface), 0 4px 12px rgba(15, 23, 42, 0.2);
  cursor: grab;
  pointer-events: auto;
  appearance: none;
}

.speed-range-track input[type="range"]::-moz-range-track {
  height: 3px;
  background: transparent;
}

.speed-range-track input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--surface), 0 4px 12px rgba(15, 23, 42, 0.2);
  cursor: grab;
  pointer-events: auto;
}

.map-appearance-control select {
  width: 132px;
  height: 34px;
  border-radius: 7px;
  background: var(--surface-strong);
}

.map-context-menu {
  position: absolute;
  z-index: 620;
  display: grid;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(24px) saturate(1.35);
}

.map-context-menu[hidden] {
  display: none;
}

.map-context-menu button {
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
  text-align: left;
}

.map-context-menu button:hover,
.map-context-menu button:focus-visible {
  background: rgba(45, 108, 223, 0.12);
  outline: none;
}

#map {
  width: 100%;
  height: 100vh;
}

.maplibregl-map {
  font-family: inherit;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: var(--soft-shadow);
}

.maplibregl-ctrl-group button {
  width: 34px;
  height: 34px;
  background-color: var(--surface-strong);
}

.maplibregl-ctrl-group button + button {
  border-top-color: var(--line);
}

body[data-theme="dark"] .maplibregl-ctrl-group {
  border-color: rgba(15, 23, 42, 0.16);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .maplibregl-ctrl-group button {
  background-color: rgba(255, 255, 255, 0.96);
}

body[data-theme="dark"] .maplibregl-ctrl-group button + button {
  border-top-color: rgba(15, 23, 42, 0.14);
}

body[data-theme="dark"] .maplibregl-ctrl button .maplibregl-ctrl-icon {
  filter: none;
}

.maplibregl-ctrl-attrib {
  border-radius: 10px 0 0 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.traffic-popup {
  display: grid;
  gap: 6px;
  color: #172033;
  font-family: inherit;
  font-size: 12px;
}

.traffic-popup strong {
  font-size: 13px;
  line-height: 1.25;
}

.traffic-popup span {
  color: #2d6cdf;
  font-weight: 760;
}

.traffic-popup dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  margin: 0;
}

.traffic-popup dt {
  color: #5c687a;
}

.traffic-popup dd {
  margin: 0;
  font-weight: 760;
}

.route-map-label {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.route-map-label-card {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: max-content;
  padding: 8px 11px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 11px;
  color: #172033;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.20);
  transform-origin: center;
  transition:
    opacity 0.16s ease,
    transform 0.16s ease,
    box-shadow 0.16s ease;
  white-space: nowrap;
}

.route-map-label-card strong {
  font-size: 15px;
  font-weight: 820;
}

.route-map-label-card > span {
  color: #5c687a;
  font-size: 12px;
  font-weight: 780;
}

.route-map-label.alternative .route-map-label-card {
  opacity: 0.42;
  padding: 6px 9px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.13);
  transform: scale(0.84);
}

.route-map-label.alternative .route-map-label-card strong {
  font-size: 13px;
}

.route-map-label.alternative .route-map-label-card > span {
  font-size: 11px;
}

.route-map-label.selected .route-map-label-card {
  opacity: 0.98;
  border-color: rgba(31, 111, 255, 0.36);
  box-shadow: 0 14px 32px rgba(31, 111, 255, 0.24);
  transform: scale(1);
}

.route-map-label:hover .route-map-label-card {
  opacity: 1;
}

body[data-theme="dark"] .route-map-label-card {
  color: #f8fafc;
  background: rgba(31, 39, 52, 0.94);
  border-color: rgba(255, 255, 255, 0.14);
}

body[data-theme="dark"] .route-map-label-card > span {
  color: #c0cad8;
}

.map-marker {
  display: grid;
  justify-items: center;
  gap: 4px;
  cursor: grab;
  transform: translateY(-9px);
  user-select: none;
}

.map-marker:active {
  cursor: grabbing;
}

.marker-head {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 9px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  transform: rotate(-45deg);
}

.marker-symbol {
  position: relative;
  display: block;
  transform: rotate(45deg);
}

.marker-caption,
.closure-map-label {
  max-width: 132px;
  padding: 4px 8px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  color: #172033;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.18);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

body[data-theme="dark"] .marker-caption,
body[data-theme="dark"] .closure-map-label {
  color: #f8fafc;
  background: rgba(31, 39, 52, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
}

.map-marker.origin .marker-head {
  background: linear-gradient(180deg, #34c759, #1f9d45);
}

.map-marker.origin .marker-symbol {
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: transparent;
}

.map-marker.destination .marker-head {
  background: linear-gradient(180deg, var(--route), #174ea6);
}

.map-marker.waypoint .marker-head {
  background: linear-gradient(180deg, #ff9f0a, #d97706);
}

.map-marker.waypoint .marker-symbol {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}

.map-marker.destination .marker-symbol {
  width: 15px;
  height: 16px;
}

.map-marker.destination .marker-symbol::before {
  position: absolute;
  top: 1px;
  left: 2px;
  width: 3px;
  height: 15px;
  border-radius: 999px;
  background: #fff;
  content: "";
}

.map-marker.destination .marker-symbol::after {
  position: absolute;
  top: 1px;
  left: 5px;
  width: 10px;
  height: 8px;
  border-radius: 2px 5px 5px 2px;
  background: #fff;
  content: "";
}

.closure-map-marker {
  display: grid;
  position: relative;
  width: 36px;
  height: 36px;
  place-items: center;
  pointer-events: none;
}

.closure-map-marker .closure-map-label {
  position: absolute;
  top: 38px;
  left: 50%;
  transform: translateX(-50%);
}

.closure-arrow-marker {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  pointer-events: none;
}

.no-entry-icon {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: linear-gradient(180deg, #ef4d42, var(--closed));
  box-shadow: 0 8px 22px rgba(120, 17, 17, 0.34), 0 0 0 1px rgba(120, 17, 17, 0.16);
}

.no-entry-icon::after {
  position: absolute;
  top: 11px;
  left: 6px;
  width: 14px;
  height: 5px;
  border-radius: 999px;
  background: #fff;
  content: "";
}

.closure-endpoint-marker {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  pointer-events: none;
}

.closure-endpoint-cross {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--closed);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(120, 17, 17, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.closure-endpoint-cross::before,
.closure-endpoint-cross::after {
  position: absolute;
  top: 9px;
  left: 4px;
  width: 12px;
  height: 3px;
  border-radius: 999px;
  background: var(--closed);
  content: "";
}

.closure-endpoint-cross::before {
  transform: rotate(45deg);
}

.closure-endpoint-cross::after {
  transform: rotate(-45deg);
}

.closure-arrow-head {
  position: relative;
  display: block;
  width: 6px;
  height: 24px;
  border-radius: 999px;
  background: #111827;
  filter: drop-shadow(0 2px 0 #fff) drop-shadow(0 5px 10px rgba(17, 24, 39, 0.38));
  transform-origin: 50% 50%;
}

.closure-arrow-head::before {
  position: absolute;
  top: -8px;
  left: -9px;
  width: 0;
  height: 0;
  border-right: 12px solid transparent;
  border-bottom: 14px solid #111827;
  border-left: 12px solid transparent;
  content: "";
}

.speed-map-marker {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 4px;
}

.speed-sign {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 3px;
  border: 4px solid var(--closed);
  border-radius: 999px;
  background: #fff;
  color: #111827;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  font-size: 13px;
  line-height: 1;
}

.speed-sign strong {
  font-weight: 850;
}

.speed-sign.mini {
  min-width: 32px;
  height: 32px;
  border-width: 3px;
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.14);
  font-size: 11px;
}

@media (max-width: 900px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    margin: 10px;
    border-radius: 22px;
  }

  .map-wrap {
    min-height: 560px;
  }

  .traffic-control {
    left: 10px;
    right: auto;
    bottom: 18px;
    width: min(250px, calc(100vw - 20px));
  }

  #map {
    height: 560px;
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding: 12px;
  }

  .split,
  .draw-actions {
    grid-template-columns: 1fr;
  }

  .map-appearance-control {
    right: 10px;
    left: 10px;
    justify-content: space-between;
  }

  .traffic-control {
    left: 10px;
    right: 10px;
    width: auto;
  }
}
