:root {
  color-scheme: light;
  --bg: #f4f4f4;
  --panel: #ffffff;
  --ink: #0b0b0b;
  --muted: #626262;
  --line: #dddddd;
  --green: #111111;
  --green-dark: #000000;
  --amber: #8f8f8f;
  --blue: #3d3d3d;
  --red: #2b2b2b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-sprite {
  display: none;
}

.icon {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  margin-right: auto;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--green);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.1;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand small {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.driver-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
}

.status-dot.offline {
  background: #8a8a8a;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.topbar-link {
  flex: 0 0 auto;
  text-decoration: none;
}

.button-label {
  display: inline;
}

.dashboard {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.driver-shift-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.plate-summary {
  min-width: 0;
}

.plate-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plate-summary strong {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1;
}

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

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

h1 {
  max-width: 620px;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.28rem;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 7px;
  font-size: 1.02rem;
}

.availability-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 7px 12px 7px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f7f7;
}

.availability-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 56px;
  height: 34px;
  border-radius: 999px;
  background: #9a9a9a;
  transition: background 160ms ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.availability-toggle input:checked + .toggle-track {
  background: var(--green);
}

.availability-toggle input:checked + .toggle-track::after {
  transform: translateX(22px);
}

.toggle-text {
  min-width: 78px;
  font-weight: 800;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metric,
.active-panel,
.ride-list-section,
.detail-panel,
.new-ride-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1;
}

.active-panel {
  min-height: 126px;
  margin-top: 16px;
  padding: 18px;
}

.workspace > .active-panel {
  margin-top: 0;
}

#driverDashboard.has-active-ride > .ride-list-section {
  margin-top: 16px;
}

.active-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 88px;
}

.active-empty p {
  margin: 0;
  color: var(--muted);
}

.active-trip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.route-line {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.route-line .route-dots {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
  padding-top: 6px;
}

.route-line .route-dots::before {
  content: "";
  position: absolute;
  top: 17px;
  bottom: 17px;
  width: 2px;
  background: var(--line);
}

.route-dot {
  z-index: 1;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
}

.route-dot.destination {
  background: var(--amber);
}

.route-addresses {
  min-width: 0;
}

.route-addresses strong,
.route-addresses span {
  display: block;
}

.route-addresses strong {
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.route-addresses span {
  margin: 4px 0 13px;
  color: var(--muted);
  font-size: 0.86rem;
}

.active-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.progress {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}

.progress span {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}

.progress span.done {
  background: var(--green);
}

.client-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f7f7;
}

.client-strip span,
.client-strip strong,
.client-strip a {
  display: block;
}

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

.client-strip strong,
.client-strip a {
  overflow-wrap: anywhere;
}

.client-strip a {
  color: var(--green-dark);
  font-weight: 900;
  text-decoration: none;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  min-width: 0;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input,
.field select {
  height: 44px;
}

.field textarea {
  min-height: 84px;
  padding-top: 11px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 390px);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.ride-list-section,
.detail-panel,
.new-ride-panel {
  padding: 18px;
}

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

.section-heading.compact {
  margin-bottom: 14px;
}

.count-pill,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f3f3f3;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

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

.ride-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.ride-card:hover,
.ride-card.selected {
  border-color: #111111;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}

.ride-card:hover {
  transform: translateY(-1px);
}

.ride-card.disabled {
  opacity: 0.6;
}

.ride-main {
  min-width: 0;
}

.ride-topline,
.ride-meta,
.detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ride-topline {
  margin-bottom: 8px;
}

.ride-id {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.ride-price {
  margin-left: auto;
  color: var(--green-dark);
  font-size: 1.25rem;
  font-weight: 900;
  white-space: nowrap;
}

.ride-card h3 {
  overflow-wrap: anywhere;
}

.ride-meta,
.detail-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.ride-actions {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 112px;
}

.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 900;
  white-space: nowrap;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  background: var(--green-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--green);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
}

.ghost-button:hover:not(:disabled) {
  color: var(--ink);
  background: #f1f1f1;
}

.full {
  width: 100%;
}

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

.detail-panel {
  min-height: 300px;
}

.detail-empty {
  display: grid;
  place-items: center;
  min-height: 264px;
  color: var(--muted);
  text-align: center;
}

.detail-map {
  position: relative;
  overflow: hidden;
  min-height: 152px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 49%, rgba(0, 0, 0, 0.08) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(0, 0, 0, 0.08) 50%, transparent 51%),
    #eeeeee;
  background-size:
    56px 56px,
    56px 56px,
    auto;
}

.map-route {
  position: absolute;
  inset: 28px 30px;
  border-left: 4px solid var(--green);
  border-bottom: 4px solid var(--green);
  border-radius: 0 0 0 36px;
}

.map-route::before,
.map-route::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.map-route::before {
  top: -8px;
  left: -10px;
  background: var(--green);
}

.map-route::after {
  right: -9px;
  bottom: -10px;
  background: var(--amber);
}

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

.muted-copy {
  color: var(--muted);
  line-height: 1.55;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.detail-row span:first-child {
  color: var(--muted);
}

.detail-row strong {
  text-align: right;
}

.new-ride-form {
  display: grid;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 10px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.history-panel {
  min-height: 220px;
}

.driver-history-panel {
  margin-top: 16px;
}

.history-heading {
  align-items: flex-start;
}

.history-toggle {
  white-space: nowrap;
}

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

.history-summary-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7f7f7;
}

.history-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.history-summary-item strong {
  display: block;
  margin-top: 8px;
  color: var(--green-dark);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  line-height: 1;
}

.history-drawer {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.money-summary {
  padding: 4px 12px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.compact-empty {
  min-height: 112px;
}

.history-list,
.ledger-list {
  display: grid;
  gap: 10px;
}

.history-card,
.driver-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.history-card strong,
.history-card span,
.driver-card strong,
.driver-card span {
  min-width: 0;
}

.history-card span,
.driver-card .ride-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.history-amount,
.settlement-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  text-align: right;
}

.history-amount strong,
.settlement-actions > strong {
  color: var(--green-dark);
  font-size: 1.1rem;
  white-space: nowrap;
}

.paid-tag,
.unpaid-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.paid-tag {
  background: #efefef;
  color: var(--muted);
}

.unpaid-tag {
  background: #111111;
  color: #ffffff;
}

.driver-card-main {
  min-width: 0;
}

.driver-card h3 {
  margin-bottom: 4px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.dispatcher-dashboard {
  padding-top: 24px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(300px, 410px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.auth-card,
.auth-visual {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 420px;
  padding: clamp(22px, 4vw, 34px);
}

.auth-card h1 {
  margin-bottom: 28px;
  color: var(--ink);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-error {
  min-height: 22px;
  margin: 0;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 800;
}

.auth-visual {
  position: relative;
  min-height: 420px;
}

.auth-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
}

.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.12));
}

.auth-badge {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 1;
  color: #fff;
}

.auth-badge span,
.auth-badge strong {
  display: block;
  line-height: 1;
}

.auth-badge span {
  color: #d8d8d8;
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-badge strong {
  margin-top: 4px;
  font-size: clamp(2rem, 5vw, 4rem);
}

.dispatcher-panel {
  display: grid;
  gap: 16px;
}

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

.dispatch-column {
  display: grid;
  gap: 16px;
}

.dispatch-active-panel {
  margin-top: 0;
}

.dispatch-active-trip {
  grid-template-columns: 1fr;
}

.dispatch-queue {
  min-height: 340px;
}

.driver-ledger-panel,
.completed-rides-panel {
  min-height: 260px;
}

.driver-admin-block {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.drivers-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: #fff;
}

.drivers-table th,
.drivers-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.drivers-table th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drivers-table tr:last-child td {
  border-bottom: 0;
}

.drivers-table td strong,
.drivers-table td span {
  display: block;
}

.drivers-table td span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.drivers-table code {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #efefef;
  color: var(--ink);
  font-family: inherit;
  font-weight: 900;
}

.table-select,
.table-input {
  width: 100%;
  min-width: 132px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.table-input {
  min-width: 190px;
}

.table-select:disabled {
  opacity: 0.58;
}

.table-action {
  min-height: 36px;
  padding-inline: 10px;
}

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

  .side-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .auth-layout,
  .dispatcher-workspace {
    grid-template-columns: 1fr;
  }

  .auth-card,
  .auth-visual {
    min-height: 320px;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 64px;
    padding-inline: 14px;
  }

  .brand strong {
    max-width: 152px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .driver-status {
    display: none;
  }

  .dashboard {
    width: min(100% - 20px, 1220px);
    padding-top: 14px;
  }

  .driver-shift-strip {
    min-height: 86px;
    padding: 16px;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.05;
  }

  .metrics,
  .history-summary-grid,
  .side-panel,
  .active-trip,
  .ride-card,
  .history-card,
  .driver-card,
  .form-grid,
  .dispatcher-workspace {
    grid-template-columns: 1fr;
  }

  .history-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

  .history-toggle {
    width: 100%;
  }

  .active-actions,
  .active-empty,
  .client-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .ride-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .ride-actions .primary-button,
  .ride-actions .secondary-button {
    min-width: 0;
    white-space: normal;
  }

  .history-amount,
  .settlement-actions {
    justify-items: stretch;
    text-align: left;
  }

  .topbar-link {
    min-height: 40px;
    padding-inline: 10px;
  }

  .auth-layout {
    gap: 10px;
  }

  .auth-visual {
    display: none;
  }
}

@media (max-width: 430px) {
  .brand strong {
    max-width: 112px;
  }

  .driver-shift-strip {
    gap: 12px;
    padding: 14px;
  }

  .plate-summary strong {
    font-size: 1.45rem;
  }

  .ride-actions {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 8px;
  }

  .topbar-link {
    width: 42px;
    padding: 0;
  }

  .topbar-link .button-label {
    display: none;
  }
}
