:root {
  --bg: #f9f8f6;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e4e7ec;
  --accent: #03b238;
  --accent-ink: #04220d;
  --map-bg: #eef0f3;
  --road: #c5cad3;
  --road-major: #9aa3b2;
  --free: #2fb35a;
  --slow: #f2b705;
  --jam: #e5484d;
  --heavy: #8f1d22;
  --pick: #1f6fd1;
  --danger: #c0392b;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  display: flex;
  font:
    14px/1.45 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.side {
  width: 372px;
  flex: none;
  height: 100%;
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
#map {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: var(--map-bg);
}
.head__title {
  font-size: 18px;
  font-weight: 590;
  letter-spacing: -0.01em;
}
.head__sub {
  color: var(--muted);
  font-size: 13px;
}
.tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0 0;
  padding: 4px;
  border-radius: 8px;
  background: #ecebe8;
}
.tabs button {
  flex: 1;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  font-weight: 510;
  padding: 7px 8px;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 8%);
}
.note {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--slow);
  background: #fff8e1;
  border-radius: 4px;
  font-size: 13px;
  color: #5c4a00;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 590;
  color: var(--ink);
}
.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.count {
  color: var(--ink);
  font-weight: 590;
}
.stat-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.stat {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.stat b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 590;
}
.stat span {
  font-size: 12px;
  color: var(--muted);
}
.line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}
.dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.line.ok .dot {
  background: var(--free);
}
.line.bad .dot {
  background: var(--jam);
}
.line.bad {
  color: var(--danger);
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row--wrap {
  flex-wrap: wrap;
}
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 510;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  border-color: #c9ced6;
  background: #fafbfc;
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover {
  background: #02a032;
  border-color: #02a032;
}
.btn--ghost {
  border-color: transparent;
  color: var(--muted);
}
.link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--pick);
  cursor: pointer;
}
.link:hover {
  text-decoration: underline;
}
.input,
select {
  width: 100%;
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}
.input:focus,
select:focus {
  outline: 2px solid color-mix(in srgb, var(--pick) 35%, transparent);
  border-color: var(--pick);
}
.results {
  margin-top: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.results button {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  font: inherit;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.results button:hover {
  background: var(--bg);
}
.results small {
  color: var(--muted);
  white-space: nowrap;
}
.hint {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.pick {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}
.pick__name {
  font-weight: 590;
  overflow-wrap: anywhere;
}
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.seg button {
  flex: 1;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  font: inherit;
  font-size: 13px;
  padding: 7px 6px;
  cursor: pointer;
  color: var(--muted);
}
.seg button:last-child {
  border-right: 0;
}
.seg button.on {
  background: var(--ink);
  color: #fff;
  font-weight: 590;
}
.seg--level button[data-v='slow'].on {
  background: var(--slow);
  color: #3d2f00;
}
.seg--level button[data-v='jam'].on {
  background: var(--jam);
}
.seg--level button[data-v='heavy'].on {
  background: var(--heavy);
}
.field {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.pick .field {
  margin-bottom: 0;
}
.field output {
  float: right;
  color: var(--ink);
  font-weight: 590;
  font-variant-numeric: tabular-nums;
}
input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}
.rules {
  display: grid;
  gap: 8px;
}
.rules:empty::before {
  content: 'Әзір кептеліс қойылмаған: қала бос.';
  color: var(--muted);
  font-size: 13px;
}
.rule {
  border: 1px solid var(--line);
  border-left: 4px solid var(--jam);
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
}
.rule[data-level='slow'] {
  border-left-color: var(--slow);
}
.rule[data-level='heavy'] {
  border-left-color: var(--heavy);
}
.rule.off {
  opacity: 0.55;
  border-left-color: var(--line);
}
.rule__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.rule__title {
  font-weight: 590;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.rule__title:hover {
  color: var(--pick);
}
.rule__km {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.rule__ctl {
  display: flex;
  gap: 6px;
  align-items: center;
}
.rule__ctl select {
  padding: 4px 6px;
  font-size: 13px;
  min-width: 0;
}
.rule__ctl select:first-of-type {
  flex: 1.5;
}
.rule__ctl select:last-of-type {
  flex: 1;
}
.rule__ctl .x {
  flex: none;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 6px;
}
.rule__ctl .x:hover {
  background: var(--bg);
  color: var(--danger);
}
.rule__ctl input[type='checkbox'] {
  flex: none;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.legend {
  position: fixed;
  left: 388px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  max-width: calc(100vw - 404px);
  padding: 8px 12px;
  border-radius: 8px;
  background: rgb(255 255 255 / 92%);
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.legend i {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}
.legend__note {
  color: var(--muted);
}
.toast {
  position: fixed;
  right: 16px;
  top: 16px;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 18%);
}
.toast.bad {
  background: var(--danger);
}
@media (max-width: 820px) {
  body {
    flex-direction: column-reverse;
  }
  .side {
    width: 100%;
    height: 55%;
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  #map {
    height: 45%;
    flex: none;
  }
  .legend {
    left: 8px;
    top: 8px;
    bottom: auto;
    max-width: calc(100vw - 16px);
  }
  .legend__note {
    display: none;
  }
}

/* ───── жеткізу ───── */
.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 10px;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.6s linear;
}
.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.btn--wide {
  width: 100%;
  text-align: center;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.couriers {
  display: grid;
  gap: 6px;
}
.courier {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.courier:hover {
  background: var(--bg);
}
.courier__dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.courier__main {
  display: grid;
  min-width: 0;
}
.courier__main b {
  font-weight: 590;
}
.courier__main small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.tracks {
  display: grid;
  gap: 4px;
}
.tracks a {
  color: var(--pick);
  text-decoration: none;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tracks a:hover {
  text-decoration: underline;
}
.lg {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--line);
}
.lg--depot {
  background: var(--ink);
}
.lg--order {
  background: #ffffff;
  border-color: var(--pick);
}
.lg--done {
  background: var(--free);
  border-color: var(--free);
}
.lg--courier {
  background: #1e88e5;
}
[hidden] {
  display: none !important;
}
