:root {
  --ink: #202b31;
  --muted: #52636e;
  --green: #4aa4a5;
  --line: #dce4e2;
  --soft: #f4f7f6;
  --red: #a52d2d;
}
* { box-sizing: border-box; letter-spacing: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #225ea8; outline-offset: 3px; }
button, a, select { touch-action: manipulation; }
h1, h2, h3, p, strong, dd, span { overflow-wrap: anywhere; }

body {
  min-width: 320px;
  margin: 0;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
  font: 15px/1.45 Segoe UI, Arial, sans-serif;
  color: var(--ink);
  background: #f3f5f6;
}

button,
a,
select { font: inherit; }

.driver-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  color: var(--ink);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.driver-header a {
  color: var(--ink);
  text-decoration: none;
  font-size: 22px;
  font-weight: 800;
}

.driver-header a span { color: var(--green); }

.driver-header button {
  border: 0;
  background: none;
  color: var(--muted);
  min-height: 44px;
  padding: 10px;
  cursor: pointer;
}

.driver-shell {
  max-width: 860px;
  margin: auto;
  padding: 30px 18px;
}

.driver-heading p {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.driver-heading h1 {
  margin: 5px 0 3px;
  font-size: 26px;
  font-weight: 650;
}

.driver-heading span { color: var(--muted); }

.driver-state {
  margin-top: 28px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.driver-state.error {
  border-color: #dfb5b5;
  color: #982f2f;
  background: #fff7f7;
}

.driver-workspaces { margin-top: 26px; }
.driver-workspaces > h2 { font-size: 18px; }

.driver-select {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  color: var(--muted);
  font-weight: 700;
}

.driver-select select {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  border-radius: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.driver-profile {
  display: grid;
  gap: 13px;
  margin: 0 0 18px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.driver-profile:empty { display: none; }

.driver-profile-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.driver-profile-heading small {
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.driver-profile-heading h2 {
  margin: 3px 0;
  font-size: 21px;
}

.driver-profile-status {
  padding: 5px 8px;
  background: #e4f5ee;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.driver-profile dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 7px 14px;
  margin: 0;
}

.driver-profile dt { color: var(--muted); }

.driver-profile dd {
  margin: 0;
  font-weight: 700;
}

.driver-profile > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.driver-trip-list {
  display: grid;
  gap: 10px;
}

.driver-trip-card {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.driver-trip-card div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.driver-trip-card span,
.driver-trip-card small { color: var(--muted); }

.driver-trip-card em {
  width: max-content;
  padding: 3px 6px;
  background: #edf5f2;
  color: var(--green);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.driver-action {
  border-radius: 4px;
  flex-shrink: 0;
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.driver-action:disabled {
  opacity: .55;
  cursor: wait;
}

.driver-action.danger { background: var(--red); }

.driver-execution {
  display: grid;
  gap: 15px;
  margin-top: 18px;
}

.driver-execution-heading {
  gap: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.driver-execution-heading h2 { margin: 3px 0; }

.driver-execution-heading small {
  color: var(--green);
  font-weight: 800;
}

.driver-execution-heading .driver-action {
  min-height: 38px;
  background: #e6efec;
  color: var(--ink);
}

.driver-stop-card,
.driver-passenger,
.driver-completion,
.driver-route-timeline {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.driver-stop-card > span {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.driver-stop-card h3 {
  margin: 5px 0;
  font-size: 22px;
}

.driver-stop-card p { color: var(--muted); }

.driver-primary-actions {
  display: grid;
  gap: 8px;
}

.driver-route-timeline h3 { margin: 0 0 15px; }

.driver-route-timeline ol {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.driver-route-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  min-height: 76px;
}

.driver-route-timeline li > i {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border: 2px solid #91a09b;
  border-radius: 50%;
  background: #fff;
}

.driver-route-timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 18px;
  bottom: 0;
  width: 1px;
  background: #d1dad7;
}

.driver-route-timeline li.confirmed > i {
  border-color: var(--green);
  background: var(--green);
}

.driver-route-timeline li.current > i { box-shadow: 0 0 0 4px #cdece0; }

.driver-route-timeline li > div {
  display: grid;
  gap: 3px;
  padding-bottom: 17px;
}

.driver-route-timeline li small { color: var(--muted); }
.driver-route-timeline li span { font-weight: 700; }

.driver-route-timeline > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.driver-counters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.driver-counters div {
  padding: 14px;
  text-align: center;
  border-right: 1px solid var(--line);
}

.driver-counters div:last-child { border: 0; }

.driver-counters strong,
.driver-counters small { display: block; }

.driver-counters strong { font-size: 22px; }

.driver-counters small {
  color: var(--muted);
  font-size: 11px;
}

.driver-passenger-list {
  display: grid;
  gap: 9px;
}

.driver-passenger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 13px;
  align-items: center;
}

.driver-passenger > div:first-child {
  display: grid;
  gap: 4px;
}

.driver-passenger small { color: var(--muted); }

.boarding-status {
  padding: 5px 8px;
  background: #eef2f1;
  font-size: 12px;
  font-weight: 800;
}

.status-boarded {
  color: #086747;
  background: #dff4eb;
}

.status-no_show {
  color: #962f2f;
  background: #fbe4e4;
}

.driver-passenger-actions {
  display: flex;
  gap: 7px;
}

.driver-passenger-actions .driver-action {
  min-height: 42px;
  padding: 9px 14px;
}

.driver-completion {
  display: grid;
  gap: 10px;
}

.driver-completion p {
  margin: 0;
  font-weight: 700;
}

.driver-updated { color: var(--muted); }

.driver-note {
  margin: 0;
  padding: 16px;
  border-left: 3px solid var(--green);
  background: #eaf6f1;
  color: #51625c;
}

.driver-note.error {
  border-left-color: var(--red);
  background: #fff0f0;
  color: #8b3030;
}

.driver-mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: calc(62px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  background: #fff;
}

.driver-mobile-nav a {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.driver-mobile-nav a.active {
  color: var(--green);
  border-top: 3px solid var(--green);
}

@media (max-width: 620px) {
  .driver-trip-card,
  .driver-execution-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .driver-trip-card .driver-action { width: 100%; }

  .driver-passenger {
    grid-template-columns: 1fr auto;
  }

  .driver-passenger-actions {
    grid-column: 1 / -1;
  }

  .driver-passenger-actions .driver-action { width: 100%; }

  .driver-counters {
    grid-template-columns: 1fr 1fr;
  }

  .driver-counters div:nth-child(2) { border-right: 0; }

  .driver-counters div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 390px) {
  .driver-shell { padding: 22px 12px; }
  .driver-heading h1 { font-size: 24px; }
  .driver-select { grid-template-columns: 1fr; }

  .driver-profile-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .driver-profile dl { grid-template-columns: 1fr; }
  .driver-profile dd { margin-bottom: 5px; }
  .driver-counters small { font-size: 10px; }
}
