:root {
  --ink: #142126;
  --muted: #5b6a70;
  --paper: #f3f5f1;
  --surface: #ffffff;
  --line: #d4dedf;
  --dark: #10191d;
  --mint: #bfe7d4;
  --teal: #15716b;
  --amber: #f0c35a;
  --coral: #d95d4f;
  --violet: #6b5ea8;
  --blue: #315f7a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(191, 231, 212, .46), rgba(243, 245, 241, 0) 270px),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.app {
  min-height: 100vh;
  padding: 22px;
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid rgba(20, 33, 38, .12);
  padding-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  font-size: 42px;
  line-height: 1.14;
  word-break: keep-all;
}

h2 {
  font-size: 20px;
  line-height: 1.28;
}

.system-status {
  min-width: 210px;
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 4px 9px;
  align-items: center;
  background: var(--dark);
  color: #f4fbf8;
  border-radius: 8px;
  padding: 14px;
}

.system-status small {
  grid-column: 2;
  color: #b8c9cc;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--mint);
  box-shadow: 0 0 0 5px rgba(191, 231, 212, .16);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, .92fr) minmax(260px, .78fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.panel,
.event-panel,
.evidence-strip {
  background: rgba(255, 255, 255, .92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(20, 33, 38, .06);
}

.panel {
  padding: 16px;
  min-width: 0;
}

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

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--dark);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.role-badge.passenger { background: var(--mint); }
.role-badge.driver { background: var(--amber); }
.role-badge.operator { background: #c9d8f5; }
.role-badge.audit { background: #e3d8ff; }
.role-badge.review { background: #d9edf0; }

.passenger-phone {
  display: grid;
  gap: 12px;
  background: var(--dark);
  color: #f8fffb;
  border-radius: 22px;
  min-height: 560px;
  padding: 18px;
  align-content: start;
}

.phone-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-weight: 900;
  font-size: 19px;
}

.icon-action {
  min-width: 54px;
  min-height: 38px;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
}

.icon-action.danger { background: var(--coral); }

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

.stop-card {
  width: 100%;
  min-height: 82px;
  padding: 14px;
  border-radius: 12px;
  color: #f7fffb;
  text-align: left;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
}

.stop-card[aria-pressed="true"] {
  background: #f6fff9;
  color: #102822;
  border-color: var(--mint);
}

.stop-card strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.stop-card span {
  display: block;
  margin-top: 8px;
  color: currentColor;
  opacity: .72;
  font-size: 13px;
  line-height: 1.3;
}

.countdown-box {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  border-radius: 12px;
  background: #223236;
  padding: 12px;
  color: var(--mint);
  font-weight: 900;
}

.primary-action,
.secondary-action,
.ghost-button,
.driver-actions button,
.operator-actions button {
  border-radius: 12px;
  min-height: 48px;
  font-weight: 900;
}

.primary-action {
  background: var(--mint);
  color: #102822;
}

.secondary-action {
  background: var(--amber);
  color: #241b00;
}

.ghost-button {
  padding: 0 12px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
}

.driver-card {
  min-height: 118px;
  display: grid;
  grid-template-columns: 1fr 118px;
  gap: 12px;
  align-items: stretch;
  background: #fff9e8;
  border: 1px solid #ead7a2;
  border-radius: 8px;
  padding: 14px;
}

.driver-card small,
.operator-grid small,
.evidence-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.driver-card strong,
.operator-grid strong,
.evidence-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.25;
  word-break: keep-all;
}

.driver-meter {
  display: grid;
  place-items: center;
  text-align: center;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #efdfb1;
}

.driver-meter span {
  color: var(--teal);
  font-size: 24px;
  font-weight: 900;
}

.driver-actions,
.operator-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.driver-actions button {
  color: #231b00;
  background: var(--amber);
}

.stage-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.stage-list li {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f7f5ed;
  color: var(--muted);
  font-weight: 800;
}

.stage-list li.active {
  color: var(--ink);
  background: #e8f6f0;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.operator-grid > div {
  min-height: 86px;
  border-radius: 8px;
  padding: 12px;
  background: #eef4fb;
  border: 1px solid #d7e3ef;
}

.route-board {
  position: relative;
  height: 214px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #cad8e1;
  background:
    linear-gradient(90deg, rgba(21, 113, 107, .08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(49, 95, 122, .09) 1px, transparent 1px),
    #f7fbfc;
  background-size: 38px 38px;
}

.route-line {
  position: absolute;
  left: 38px;
  right: 48px;
  top: 112px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--blue), var(--violet));
  transform: rotate(-8deg);
}

.route-pin {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 4px solid #fff;
  box-shadow: 0 8px 18px rgba(20, 33, 38, .18);
}

.route-pin.start { left: 42px; top: 122px; background: var(--teal); }
.route-pin.car { left: 47%; top: 88px; background: var(--amber); }
.route-pin.end { right: 58px; top: 74px; background: var(--coral); }

.operator-actions button {
  color: #fff;
  background: var(--blue);
}

.operator-actions button:last-child {
  background: var(--violet);
}

.evidence-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
}

.evidence-strip div {
  min-height: 74px;
  padding: 14px 16px;
  background: #fff;
}

.event-panel {
  padding: 16px;
}

.pre-contract-board {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(20, 33, 38, .06);
}

.review-intro {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  align-items: center;
}

.review-intro p {
  grid-column: 1 / -1;
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.review-grid article {
  min-height: 164px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #d7e3ef;
  background: #f8fbfc;
}

.review-grid small {
  display: block;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.review-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
  line-height: 1.28;
  word-break: keep-all;
}

.review-grid p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.event-log {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-log li {
  min-height: 58px;
  border-radius: 8px;
  padding: 10px;
  background: #f7faf8;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.event-log strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  }

  .operator-panel {
    grid-column: 1 / -1;
  }

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

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

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

  .topbar,
  .workspace,
  .evidence-strip,
  .event-log,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 31px;
  }

  .system-status {
    min-width: 0;
  }

  .passenger-phone {
    min-height: 500px;
    border-radius: 16px;
  }

  .driver-card,
  .operator-grid {
    grid-template-columns: 1fr;
  }

  .driver-actions,
  .operator-actions {
    grid-template-columns: 1fr;
  }
}
