:root {
  --ink: #17202a;
  --paper: #f7f3e8;
  --jade: #2f8f83;
  --amber: #f2b544;
  --line: rgba(23, 32, 42, 0.14);
  --muted: rgba(23, 32, 42, 0.62);
  --white: #fffdf7;
  --danger: #b54d4d;
  --shadow: 0 22px 60px rgba(23, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(47, 143, 131, 0.09) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 32, 42, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 72px 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

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

.brand strong {
  font-size: 18px;
  letter-spacing: 0;
}

.brand small {
  margin-top: 3px;
  color: rgba(247, 243, 232, 0.66);
  font-size: 12px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid rgba(247, 243, 232, 0.12);
  border-radius: 8px;
  color: rgba(247, 243, 232, 0.72);
  background: transparent;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.tab:hover,
.tab.is-active {
  color: var(--paper);
  background: rgba(47, 143, 131, 0.18);
  border-color: rgba(47, 143, 131, 0.7);
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--ink);
  background: var(--amber);
  font-size: 11px;
  font-weight: 800;
}

.rail-note {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(247, 243, 232, 0.16);
}

.rail-note span,
.eyebrow {
  color: var(--jade);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail-note strong {
  display: block;
  margin-top: 8px;
  color: rgba(247, 243, 232, 0.9);
  font-size: 15px;
  line-height: 1.35;
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 54px);
  line-height: 0.94;
}

h2 {
  margin-bottom: 12px;
  font-size: 22px;
  line-height: 1.05;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.search,
.select,
.driver-select {
  display: grid;
  gap: 5px;
  min-width: 170px;
}

.search span,
.select span,
.driver-select span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.78);
  outline: none;
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(47, 143, 131, 0.14);
}

.metrics-strip {
  display: grid;
  grid-template-columns: minmax(220px, 330px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin: 20px 0;
}

.metric-main {
  padding: 18px;
  border-radius: 8px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: var(--shadow);
}

.metric-main span {
  display: block;
  color: rgba(247, 243, 232, 0.7);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-main strong {
  display: block;
  margin: 10px 0 14px;
  font-size: 44px;
  line-height: 1;
}

.bar,
.progress,
.lane-track,
.inspector-progress {
  overflow: hidden;
  height: 8px;
  border-radius: 99px;
  background: rgba(23, 32, 42, 0.12);
}

.metric-main .bar {
  background: rgba(247, 243, 232, 0.16);
}

.bar i,
.progress i,
.lane-track i,
.inspector-progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jade), var(--amber));
  transition: width 260ms ease;
}

.status-pills {
  display: grid;
  grid-template-columns: repeat(5, minmax(105px, 1fr));
  gap: 10px;
}

.status-pill {
  min-width: 0;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.76);
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.status-pill:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 143, 131, 0.42);
  background: var(--white);
}

.status-pill span,
.status-pill strong {
  display: block;
}

.status-pill span {
  color: var(--muted);
  font-size: 12px;
}

.status-pill strong {
  margin-top: 10px;
  font-size: 28px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: viewIn 180ms ease both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.planner {
  display: grid;
  grid-template-columns: 240px minmax(320px, 1fr) minmax(310px, 420px);
  gap: 16px;
  align-items: start;
}

.lane-board,
.route-grid,
.inspector,
.chart-panel,
.import-panel,
.public-board {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.78);
  box-shadow: 0 12px 34px rgba(23, 32, 42, 0.06);
}

.lane-board {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.lane {
  padding: 12px;
  border-left: 4px solid var(--jade);
  background: rgba(247, 243, 232, 0.78);
}

.lane:nth-child(2n) {
  border-left-color: var(--amber);
}

.lane-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.lane-head span,
.lane small,
.route-card p,
.route-meta,
.inspector-sub,
.stop small,
.public-item small {
  color: var(--muted);
}

.lane-head span,
.lane small {
  font-size: 12px;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 12px;
  padding: 12px;
}

.route-card {
  display: grid;
  gap: 12px;
  min-height: 196px;
  padding: 14px;
  border: 1px solid rgba(23, 32, 42, 0.12);
  border-radius: 8px;
  background: var(--white);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.route-card:hover,
.route-card.is-selected {
  transform: translateY(-2px);
  border-color: rgba(47, 143, 131, 0.5);
  box-shadow: 0 16px 38px rgba(23, 32, 42, 0.1);
}

.route-card header,
.inspector-head,
.public-board header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.route-card h2 {
  margin: 0;
  font-size: 20px;
}

.route-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.route-time {
  font-size: 12px;
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 99px;
  color: var(--ink);
  background: rgba(23, 32, 42, 0.1);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.status-new,
.stage-row i.status-new {
  background: rgba(242, 181, 68, 0.32);
}

.badge.status-assigned,
.stage-row i.status-assigned {
  background: rgba(47, 143, 131, 0.26);
}

.badge.status-enroute,
.stage-row i.status-enroute {
  background: rgba(47, 143, 131, 0.52);
}

.badge.status-delivered,
.stage-row i.status-delivered {
  background: rgba(23, 32, 42, 0.18);
}

.badge.status-confirmed,
.stage-row i.status-confirmed {
  color: var(--paper);
  background: var(--ink);
}

.route-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.inspector {
  position: sticky;
  top: 22px;
  min-height: 520px;
  padding: 18px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 430px;
  text-align: center;
}

.empty-state p {
  max-width: 260px;
  color: var(--muted);
}

.signal-mark {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, var(--jade) 0 48%, transparent 48% 52%, var(--amber) 52% 100%),
    var(--paper);
  box-shadow: inset 0 0 0 8px var(--ink);
}

.ghost-button,
.small-button {
  min-height: 34px;
  border: 1px solid rgba(23, 32, 42, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
  padding: 0 12px;
  font-weight: 800;
}

.ghost-button:hover,
.small-button:hover {
  border-color: var(--jade);
}

.driver-select {
  margin: 18px 0;
}

.inspector-progress {
  position: relative;
  height: 28px;
  margin-bottom: 18px;
}

.inspector-progress span {
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 5px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.stop-list {
  display: grid;
  gap: 10px;
}

.stop {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 243, 232, 0.56);
}

.stop.is-done {
  border-color: rgba(47, 143, 131, 0.48);
  background: rgba(47, 143, 131, 0.08);
}

.stop-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

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

.stop strong,
.stop small {
  display: block;
}

.stop ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.analytics-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-panel,
.import-panel,
.public-board {
  padding: 18px;
}

.stage-chart,
.lane-chart,
.public-list,
.import-steps {
  display: grid;
  gap: 12px;
}

.stage-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 34px;
  gap: 12px;
  align-items: center;
}

.stage-row div {
  overflow: hidden;
  height: 28px;
  border-radius: 8px;
  background: rgba(23, 32, 42, 0.09);
}

.stage-row i {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
}

.lane-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 74px minmax(110px, 1fr);
  gap: 10px;
  align-items: center;
}

.lane-row span {
  color: var(--muted);
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 1.1fr);
  gap: 22px;
  align-items: start;
}

.import-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.import-steps code {
  display: block;
  overflow-x: auto;
  padding: 14px;
  border-radius: 8px;
  color: var(--paper);
  background: var(--ink);
}

.public-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(120px, 220px);
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.public-item strong,
.public-item small {
  display: block;
}

.empty-list {
  grid-column: 1 / -1;
  padding: 24px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.72);
}

.empty-list.error {
  color: var(--danger);
}

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

  .rail {
    position: relative;
    height: auto;
  }

  .tabs,
  .metrics-strip,
  .planner,
  .analytics-layout,
  .import-panel {
    grid-template-columns: 1fr;
  }

  .inspector {
    position: relative;
    top: auto;
  }
}

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

  .topbar,
  .toolbar,
  .public-board header {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .route-grid {
    grid-template-columns: 1fr;
  }

  .public-item,
  .stage-row,
  .lane-row {
    grid-template-columns: 1fr;
  }

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

