.live-bus-summary-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.live-bus-summary-updated {
  white-space: nowrap;
}

.live-bus-table-frame {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow, 0 18px 40px rgba(15, 23, 42, .14));
}

.live-bus-table-scroll {
  overflow-x: auto;
}

.live-bus-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  color: var(--text, #0f172a);
}

.live-bus-table th,
.live-bus-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  text-align: left;
  vertical-align: middle;
}

.live-bus-table th {
  font-family: "Public Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--muted, #475569);
  background: var(--surface, #f8fafc);
}

.live-bus-table tbody tr:last-child td {
  border-bottom: 0;
}

.live-bus-route-cell {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 160px;
}

.live-bus-route-icon {
  width: 36px;
  height: 36px;
  display: block;
}

.live-bus-route-name {
  font-family: "Public Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
}

.live-bus-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.live-bus-status.is-on-time {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.live-bus-status.is-behind {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.live-bus-status.is-ahead {
  color: #854d0e;
  background: #fef3c7;
  border-color: #fde68a;
}

.live-bus-status.is-unknown {
  color: var(--muted, #475569);
  background: var(--surface, #f8fafc);
}

.live-bus-stop-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.live-bus-mobile-stop-label {
  display: none;
}

.live-bus-stop {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 9px;
  align-items: start;
}

.live-bus-stop::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--live-route-color, var(--route-green, #16a34a));
}

.live-bus-stop-name {
  font-family: "Public Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
}

.live-bus-stop-meta {
  margin-top: 1px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted, #475569);
}

.live-bus-empty,
.live-bus-error,
.live-bus-loading {
  padding: 14px;
  color: var(--muted, #475569);
}

.live-bus-loading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-bus-loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 3px solid var(--border, #e2e8f0);
  border-top-color: var(--navy, #2E378F);
  border-radius: 999px;
  animation: live-bus-spin .8s linear infinite;
}

@keyframes live-bus-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 720px) {
  .live-bus-summary-head {
    display: block;
  }

  .live-bus-summary-updated {
    display: block;
    margin-top: 8px;
    white-space: normal;
  }

  .live-bus-table th,
  .live-bus-table td {
    padding: 10px 12px;
  }

  .live-bus-table-scroll {
    overflow-x: visible;
  }

  .live-bus-table {
    min-width: 0;
    display: block;
  }

  .live-bus-table thead {
    display: none;
  }

  .live-bus-table tbody {
    display: block;
  }

  .live-bus-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border, #e2e8f0);
  }

  .live-bus-table tbody tr:last-child {
    border-bottom: 0;
  }

  .live-bus-table td {
    display: block;
    padding: 0;
    border-bottom: 0;
  }

  .live-bus-table td:nth-child(2) {
    align-self: center;
    justify-self: end;
  }

  .live-bus-table td:nth-child(3) {
    grid-column: 1 / -1;
    padding-top: 4px;
  }

  .live-bus-mobile-stop-label {
    display: block;
    margin-bottom: 6px;
    font-family: "Public Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--muted, #475569);
  }

  .live-bus-table th:nth-child(4),
  .live-bus-table td:nth-child(4) {
    display: none;
  }

  .live-bus-route-cell {
    min-width: 0;
  }

  .live-bus-status {
    font-size: 12px;
    min-height: 26px;
  }
}
