:root {
  --ink: #1b1b3a;
  --paper: #fbfefb;
  --coral: #ff6b6b;
  --aqua: #4ecdc4;
  --line: rgba(27, 27, 58, 0.14);
  --muted: #6d7186;
  --soft: #eef5f2;
  --shadow: 0 18px 48px rgba(27, 27, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  background:
    linear-gradient(90deg, rgba(27, 27, 58, 0.05) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(180deg, #fbfefb 0%, #edf5f3 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100svh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100svh;
  padding: 22px 18px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.brand span,
.rail__note span,
.eyebrow,
.metric span,
.metric small,
label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand span,
.rail__note span {
  color: rgba(251, 254, 251, 0.62);
}

.nav {
  display: grid;
  gap: 7px;
}

.nav__item {
  width: 100%;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  color: rgba(251, 254, 251, 0.74);
  text-align: left;
  padding: 12px 10px;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.nav__item:hover,
.nav__item.is-active {
  background: rgba(251, 254, 251, 0.08);
  border-color: var(--aqua);
  color: var(--paper);
}

.rail__note {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(251, 254, 251, 0.14);
}

.rail__note b {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: rgba(251, 254, 251, 0.82);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 540px);
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--coral);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 0.95;
}

h2 {
  font-size: 18px;
  line-height: 1.15;
}

.filters {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
}

input,
select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 254, 251, 0.86);
  color: var(--ink);
  padding: 12px 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--aqua);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.22);
}

.metrics,
.lower-grid,
.content-grid {
  display: grid;
  gap: 14px;
}

.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.metric,
.pane {
  background: rgba(251, 254, 251, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 132px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  overflow: hidden;
}

.metric strong {
  font-size: 34px;
  line-height: 1;
}

.metric small {
  color: var(--muted);
  text-transform: none;
}

.metric i,
.progress-line,
.progress-block i {
  display: block;
  height: 6px;
  background: linear-gradient(90deg, var(--aqua) var(--value), rgba(27, 27, 58, 0.1) var(--value));
}

.content-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  align-items: start;
}

.lower-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  margin-top: 14px;
}

.pane {
  min-width: 0;
  border-radius: 8px;
  overflow: hidden;
}

.pane__head {
  min-height: 76px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ghost-button,
.primary-button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ghost-button {
  background: rgba(27, 27, 58, 0.08);
  color: var(--ink);
}

.primary-button {
  background: var(--coral);
  color: #fff;
  font-weight: 800;
}

.primary-button--wide {
  width: 100%;
  margin-top: 14px;
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(27, 27, 58, 0.16);
}

.route-grid {
  display: grid;
}

.route-row {
  width: 100%;
  min-height: 84px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  display: grid;
  grid-template-columns: 14px minmax(160px, 1.4fr) minmax(112px, 0.6fr) minmax(96px, 0.7fr) minmax(88px, 0.4fr);
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  text-align: left;
  transition: background 160ms ease;
}

.route-row:hover,
.route-row.is-selected {
  background: rgba(78, 205, 196, 0.12);
}

.route-row__main,
.route-row__numbers,
.detail-item,
.driver,
.timeline__item {
  min-width: 0;
}

.route-row b,
.route-row small,
.detail-item b,
.detail-item span,
.detail-item small,
.driver b,
.driver small,
.timeline b,
.timeline small {
  display: block;
  overflow-wrap: anywhere;
}

.route-row small,
.detail-item small,
.driver small,
.timeline small,
.muted {
  color: var(--muted);
}

.signal {
  width: 10px;
  height: 42px;
  background: var(--aqua);
  display: block;
}

.signal--critical {
  background: var(--coral);
}

.signal--high {
  background: #f7b267;
}

.signal--low {
  background: #86a8e7;
}

.route-row__status,
.status-chip,
.availability {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  background: rgba(251, 254, 251, 0.72);
  white-space: nowrap;
}

.request-panel {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(78, 205, 196, 0.08);
}

.request-panel form {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.8fr 0.7fr auto;
  gap: 12px;
  align-items: end;
}

.inspector {
  position: sticky;
  top: 24px;
}

.inspector__body {
  padding: 16px;
}

.inspector__summary {
  display: grid;
  gap: 9px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.inspector__summary strong {
  font-size: 22px;
}

.inspector__summary p {
  margin: 0;
  color: var(--muted);
}

.progress-block {
  margin: 16px 0;
}

.progress-block div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 800;
}

.detail-list,
.driver-list,
.timeline {
  display: grid;
}

.detail-item,
.driver,
.timeline__item {
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.detail-item:first-child,
.driver:first-child,
.timeline__item:first-child {
  border-top: 0;
}

.driver {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 50%;
  font-weight: 900;
}

.availability {
  font-style: normal;
}

.availability--available {
  border-color: rgba(78, 205, 196, 0.55);
  color: #127a73;
}

.availability--blocked {
  border-color: rgba(255, 107, 107, 0.55);
  color: #b73d3d;
}

.timeline__item {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  padding-left: 16px;
  padding-right: 16px;
}

.timeline time {
  color: var(--coral);
  font-weight: 900;
  font-size: 13px;
}

.empty {
  padding: 34px 16px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: calc(100vw - 36px);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
  }

  .rail__note {
    display: none;
  }

  .topbar,
  .content-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .inspector {
    position: static;
  }
}

@media (max-width: 760px) {
  .workspace,
  .rail {
    padding: 14px;
  }

  h1 {
    font-size: 32px;
    line-height: 1;
  }

  .filters,
  .metrics,
  .request-panel form {
    grid-template-columns: 1fr;
  }

  .route-row {
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 10px;
  }

  .route-row__status,
  .progress-line,
  .route-row__numbers {
    grid-column: 2;
  }

  .driver {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .availability {
    grid-column: 2;
  }
}
