:root {
  --ink: #171717;
  --muted: #6f706d;
  --line: #ddd8cd;
  --paper: #f7f4ec;
  --panel: #ffffff;
  --coal: #22211f;
  --teal: #126de2;
  --green: #126de2;
  --amber: #c78320;
  --red: #b84534;
  --road: #d4cec1;
  --shadow: 0 24px 70px rgba(31, 30, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(18, 109, 226, 0.14), transparent 32rem),
    linear-gradient(145deg, #f8f5ee 0%, #ebe5d7 46%, #f8f5ee 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 2.4vw, 34px);
}

.tracking-gate,
.dashboard {
  animation: rise 460ms ease both;
}

.tracking-gate {
  min-height: calc(100vh - 68px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 42px;
}

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

.brand-row.compact h1 {
  font-size: clamp(1.55rem, 2vw, 2.35rem);
}

.brand-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid rgba(18, 109, 226, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(18, 109, 226, 0.16);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.2rem, 5vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  line-height: 1.05;
  letter-spacing: 0;
}

.gate-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 0.7fr);
  gap: clamp(22px, 4vw, 64px);
  align-items: stretch;
}

.gate-copy {
  max-width: 760px;
}

.gate-copy h2 {
  margin: 18px 0 18px;
  font-size: clamp(2.4rem, 6vw, 6.2rem);
}

.gate-copy > p {
  width: min(640px, 100%);
  color: #4e4f4b;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.65;
}

.status-pill {
  width: fit-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #3d3e3b;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.8rem;
  font-weight: 700;
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(18, 109, 226, 0.12);
}

.track-form {
  margin-top: 30px;
  width: min(620px, 100%);
  padding: 18px;
  border: 1px solid rgba(34, 33, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: var(--shadow);
}

.track-form label {
  display: block;
  margin-bottom: 9px;
  font-size: 0.86rem;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.input-row input {
  min-width: 0;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}

.input-row input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(18, 109, 226, 0.12);
}

.input-row button,
.ghost-button,
.control {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.input-row button {
  padding: 0 24px;
  color: #fff;
  background: var(--teal);
}

.form-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.form-error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--red);
  font-size: 0.88rem;
  font-weight: 700;
}

.vehicle-preview {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(18px, 2.2vw, 30px);
  border: 1px solid rgba(34, 33, 31, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.88), rgba(255,255,255,0.58)),
    repeating-linear-gradient(90deg, transparent 0 36px, rgba(34, 33, 31, 0.04) 36px 37px);
  box-shadow: var(--shadow);
}

.vehicle-preview::after {
  content: "";
  position: absolute;
  inset: auto -10% 16% -10%;
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(18, 109, 226, 0.13));
  transform: skewY(-6deg);
  pointer-events: none;
}

.preview-topline,
.preview-metrics {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #4a4a47;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.vehicle-preview img {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: 280px;
  object-fit: contain;
  margin: auto;
  filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.14));
}

.preview-metrics {
  align-items: end;
}

.preview-metrics div {
  padding: 12px 14px;
  border: 1px solid rgba(34, 33, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.preview-metrics strong {
  display: block;
  color: var(--ink);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.preview-metrics span {
  color: var(--muted);
}

.is-hidden {
  display: none;
}

.dashboard {
  display: block;
}

.dashboard.is-hidden {
  display: none;
}

.topbar,
.summary-band,
.workspace,
.details-grid {
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

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

.ghost-button {
  padding: 0 16px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.summary-item,
.map-panel,
.vehicle-card,
.stops,
.timeline-panel,
.driver-panel {
  border: 1px solid rgba(34, 33, 31, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.83);
  box-shadow: 0 16px 42px rgba(31, 30, 28, 0.08);
}

.summary-item {
  min-height: 86px;
  padding: 16px;
}

.summary-item span,
.driver-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-item strong {
  line-height: 1.22;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 14px;
  align-items: start;
}

.map-panel {
  overflow: hidden;
  min-height: 665px;
}

.map-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 18px 0;
}

.map-head h2,
.section-title h2,
.driver-head h2,
.vehicle-info h2 {
  margin-bottom: 0;
}

.speed-chip {
  min-width: 132px;
  padding: 11px 13px;
  border-radius: 8px;
  color: #fff;
  background: var(--coal);
  text-align: right;
}

.speed-chip span,
.speed-chip small {
  display: block;
}

.speed-chip span {
  font-size: 1.15rem;
  font-weight: 800;
}

.speed-chip small {
  margin-top: 3px;
  color: #dbd5ca;
  font-size: 0.72rem;
}

.map-wrap {
  position: relative;
  margin: 16px 18px 0;
  height: min(62vh, 540px);
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ebe5d7;
}

#routeCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.map-overlay {
  position: absolute;
  inset: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.eta-card,
.map-legend {
  padding: 10px 12px;
  border: 1px solid rgba(34, 33, 31, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
}

.eta-card span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.eta-card strong {
  display: block;
  margin-top: 4px;
}

.map-legend {
  display: grid;
  gap: 7px;
  color: #4d4e4b;
  font-size: 0.76rem;
  font-weight: 700;
}

.map-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: #99958c;
}

.map-legend i.done {
  background: var(--green);
}

.map-legend i.active {
  background: var(--amber);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px 18px;
}

.control {
  padding: 0 14px;
  border: 1px solid var(--line);
  color: #4b4b48;
  background: #fff;
}

.control.active {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.side-panel {
  display: grid;
  gap: 14px;
}

.vehicle-card {
  overflow: hidden;
}

.vehicle-image {
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    linear-gradient(150deg, rgba(34, 33, 31, 0.08), transparent 62%),
    #efebe2;
}

.vehicle-image img {
  width: min(370px, 96%);
  max-height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 16px 14px rgba(0, 0, 0, 0.16));
}

.vehicle-info,
.stops,
.timeline-panel,
.driver-panel {
  padding: 18px;
}

.vehicle-info dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 0;
}

.vehicle-info dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.vehicle-info dd {
  margin: 5px 0 0;
  font-size: 0.9rem;
  font-weight: 800;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.section-title span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

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

.stop-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stop-dot {
  width: 16px;
  height: 16px;
  margin-top: 4px;
  border: 3px solid #bbb6ab;
  border-radius: 50%;
  background: #fff;
}

.stop-item.done .stop-dot {
  border-color: var(--green);
  background: var(--green);
}

.stop-item.active .stop-dot {
  border-color: var(--amber);
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(199, 131, 32, 0.14);
}

.stop-item h3 {
  margin: 0 0 4px;
  font-size: 0.92rem;
}

.stop-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.stop-time {
  color: #3d3e3b;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.details-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  gap: 14px;
  margin-top: 14px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-row:last-child {
  border-bottom: 0;
}

.timeline-row time {
  color: var(--teal);
  font-weight: 800;
  font-size: 0.82rem;
}

.timeline-row strong {
  display: block;
  margin-bottom: 3px;
}

.timeline-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.42;
}

.driver-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.driver-avatar {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--coal);
  font-weight: 800;
}

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

.driver-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.driver-grid strong {
  font-size: 0.88rem;
}

.notice {
  margin-top: 14px;
  padding: 12px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  color: #5a4a31;
  background: rgba(199, 131, 32, 0.12);
  font-size: 0.9rem;
  line-height: 1.48;
}

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

@media (max-width: 1080px) {
  .gate-grid,
  .workspace,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .summary-band {
    grid-template-columns: repeat(2, 1fr);
  }

  .vehicle-preview {
    min-height: 390px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

  .tracking-gate {
    justify-content: flex-start;
    padding-top: 12px;
  }

  .topbar,
  .topbar-actions,
  .map-head,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-band,
  .vehicle-info dl,
  .driver-grid {
    grid-template-columns: 1fr;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .input-row button {
    height: 50px;
  }

  .map-wrap {
    height: 58vh;
    min-height: 370px;
    margin-inline: 12px;
  }

  .map-overlay {
    inset: 8px;
  }

  .map-legend {
    display: none;
  }

  .stop-item {
    grid-template-columns: 24px 1fr;
  }

  .stop-time {
    grid-column: 2;
  }
}
