:root {
  color-scheme: dark;
  --bg: #101112;
  --panel: #1b1d1f;
  --text: #f7f5ef;
  --muted: #a5a6a5;
  --gold: #d9b56d;
  --border: #343638;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #29251d 0, var(--bg) 48%);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
}
.shell { width: min(calc(100% - 32px), 460px); margin: 0 auto; padding: 38px 0 24px; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.brand-mark {
  display: grid; place-items: center; width: 56px; height: 56px;
  border: 1px solid var(--gold); color: var(--gold); font-weight: 800;
  letter-spacing: -2px; font-size: 20px;
}
h1 { margin: 0; font-size: 20px; letter-spacing: 3px; }
.brand p, .muted { color: var(--muted); }
.brand p { margin: 2px 0 0; font-size: 13px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: 0 18px 50px #0004; }
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: 2px; }
h2 { margin: 4px 0 8px; font-size: 25px; }
.muted { margin-top: 0; font-size: 14px; }
label { display: block; margin: 18px 0 7px; font-size: 13px; color: #dededb; }
input {
  width: 100%; padding: 14px; border: 1px solid #45474a; border-radius: 10px;
  background: #111213; color: var(--text); font: inherit;
}
input:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
button {
  min-height: 46px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid #555; background: #27292b; color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer;
}
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.primary { width: 100%; margin-top: 22px; background: var(--gold); color: #191713; border-color: var(--gold); }
.secondary { width: 100%; margin-top: 16px; }
.status-card { margin: 22px 0 16px; padding: 18px; border-radius: 12px; background: #111213; border: 1px solid var(--border); }
.status-card span, .status-card strong { display: block; }
.status-card strong { margin-top: 5px; font-size: 21px; color: var(--gold); }
.status-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.status-actions button { min-height: 52px; }
.status-actions button.active { border-color: var(--gold); color: var(--gold); }
.message { min-height: 22px; font-size: 13px; color: var(--gold); overflow-wrap: anywhere; }
.hidden { display: none; }
footer { text-align: center; color: #777; font-size: 12px; margin: 24px 0 0; }
@media (min-width: 390px) {
  .status-actions { grid-template-columns: 1fr 1fr; }
  .status-actions button:last-child { grid-column: 1 / -1; }
}

/* Keep original HIGH DUKE logo shape */
.brand-mark {
    border-radius: 12px;
}

/* HIGH DUKE digital meter */
#meter-panel {
  margin-top: 16px;
}

#meter-fare {
  font-size: 42px;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.meter-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.meter-details > div {
  padding: 15px 12px;
  background: #111213;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.meter-details span,
.meter-details strong {
  display: block;
}

.meter-details span {
  color: var(--muted);
  font-size: 12px;
}

.meter-details strong {
  margin-top: 5px;
  color: var(--gold);
  font-size: 18px;
}

#meter-panel button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* HIGH DUKE compact driver dashboard */
#dashboard-panel {
  padding: 14px;
}

#dashboard-panel .status-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

#dashboard-panel .status-actions button {
  min-width: 0;
  padding: 14px 8px;
}

#meter-panel.meter-compact {
  margin: 12px 0;
  padding: 14px;
  background: #111213;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}

#meter-panel.meter-compact #meter-fare {
  display: block;
  color: var(--gold);
  font-size: 42px;
  line-height: 1.2;
  margin: 10px 0;
}

#meter-panel.meter-compact .meter-details {
  margin: 12px 0;
}

#dashboard-panel #logout-button {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 430px) {
  .shell { padding: 12px; }
  #meter-panel.meter-compact { padding: 12px; }
}

/* Compact signed-in driver screen */
body:has(#dashboard-panel:not(.hidden)) .brand {
  padding: 4px 0 8px;
  margin-bottom: 8px;
}

body:has(#dashboard-panel:not(.hidden)) .brand-mark,
body:has(#dashboard-panel:not(.hidden)) .brand p,
body:has(#dashboard-panel:not(.hidden)) #dashboard-panel > .eyebrow,
body:has(#dashboard-panel:not(.hidden)) #driver-name {
  display: none;
}

body:has(#dashboard-panel:not(.hidden)) .brand h1 {
  font-size: 20px;
  margin: 0;
}

body:has(#dashboard-panel:not(.hidden)) #dashboard-panel > .muted {
  font-size: 12px;
  margin: 0 0 8px;
}

/* HIGH DUKE driver button arrangement */
#dashboard-panel .status-actions {
  display: block;
  margin: 10px 0;
}

#dashboard-panel .status-actions button {
  width: 100%;
  min-height: 48px;
}

#dashboard-panel .bottom-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

#dashboard-panel .bottom-actions button {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 10px 6px;
  font-size: 14px;
}

#dashboard-panel .bottom-actions button span,
#dashboard-panel .status-actions button span {
  margin-right: 4px;
}

/* Equal height and consistent styling for driver controls */
#dashboard-panel .status-actions button,
#dashboard-panel .bottom-actions button {
  box-sizing: border-box;
  height: 54px;
  min-height: 54px;
  padding: 0 12px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  line-height: 1.2;
}

#dashboard-panel .status-actions button span,
#dashboard-panel .bottom-actions button span {
  font-size: 20px;
  vertical-align: middle;
}

/* Keep all three driver buttons exactly the same height */
#dashboard-panel .status-actions > button,
#dashboard-panel .bottom-actions > button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 54px !important;
  min-height: 54px !important;
  max-height: 54px !important;
  box-sizing: border-box;
  margin: 0 !important;
  padding: 0 10px !important;
}

#dashboard-panel .status-actions button span,
#dashboard-panel .bottom-actions button span {
  margin: 0;
}

/* Highlight whichever driver availability status is selected */
#dashboard-panel .bottom-actions button[data-status].active {
  border-color: var(--gold);
  color: var(--gold);
}

/* HIGH DUKES: Available and Pending Jobs side by side */
#dashboard-panel .status-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#dashboard-panel .status-actions > button {
  width: 100%;
  min-width: 0;
  grid-column: auto;
}

/* Gold alert when a new pending job arrives */
#pending-jobs-button.new-pending-job {
  border-color: #d4af37;
  color: #d4af37;
  animation: pending-gold-flash 1s ease-in-out infinite;
}

@keyframes pending-gold-flash {
  50% {
    background: #d4af37;
    color: #111;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.65);
  }
}

@media (prefers-reduced-motion: reduce) {
  #pending-jobs-button.new-pending-job {
    animation: none;
    background: #d4af37;
    color: #111;
  }
}

/* HIGH DUKES: Available and Pending Jobs side by side */
#dashboard-panel .status-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#dashboard-panel .status-actions > button {
  width: 100%;
  min-width: 0;
  grid-column: auto;
}

/* Gold alert when a new pending job arrives */
#pending-jobs-button.new-pending-job {
  border-color: #d4af37;
  color: #d4af37;
  animation: pending-gold-flash 1s ease-in-out infinite;
}

@keyframes pending-gold-flash {
  50% {
    background: #d4af37;
    color: #111;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.65);
  }
}

@media (prefers-reduced-motion: reduce) {
  #pending-jobs-button.new-pending-job {
    animation: none;
    background: #d4af37;
    color: #111;
  }
}

/* HIGH DUKES: Scrollable, individually bordered pending job tabs */
#pending-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 65vh;
  overflow-y: auto;
  padding: 4px;
}

.pending-job-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #111213;
  border: 2px solid #706044;
  border-radius: 14px;
}

.pending-job-details {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.pending-job-details p {
  margin: 3px 0;
}

.pending-job-details strong {
  color: var(--gold);
}

.pending-job-timer {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.pending-job-slide {
  position: relative;
  min-width: 0;
  height: 54px;
  border: 1px solid var(--gold);
  border-radius: 30px;
  background: #29251d;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.pending-job-slide-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-left: 35px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  pointer-events: none;
}

.pending-job-slide-handle {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: var(--gold);
  color: #111;
  font-size: 22px;
  touch-action: none;
  cursor: grab;
}

.pending-job-slide-handle:active {
  cursor: grabbing;
}

/* HIGH DUKES: Full-screen active journey */
#job-progress-panel:not(.hidden) {
  position: fixed;
  inset: 0;
  z-index: 100;
  overflow-y: auto;
  background: #101112;
  padding: max(24px, env(safe-area-inset-top)) 20px 32px;
}

#job-progress-panel h2 {
  color: var(--gold);
  margin: 14px 0 24px;
}

.job-progress-details {
  background: #1b1d1f;
  border: 2px solid #706044;
  border-radius: 16px;
  padding: 18px;
}

.job-progress-details p {
  margin: 12px 0;
  overflow-wrap: anywhere;
}

.job-progress-details strong {
  color: var(--gold);
}

/* HIGH DUKES: Large journey navigation map */
#job-map {
  width: 100%;
  height: 80dvh;
  min-height: 320px;
  background: #202326;
  border: 2px solid #706044;
  border-radius: 16px;
  overflow: hidden;
  margin: 16px 0;
  position: relative;
}

#job-map > .muted {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
}

#job-map .leaflet-container {
  width: 100%;
  height: 100%;
}


/* TEST ONLY: HIGH DUKES journey controls */
#journey-controls {
  display: grid;
  gap: 14px;
  margin: 20px 0;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

#journey-controls button {
  width: 100%;
  min-height: 62px;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: 700;
  touch-action: manipulation;
}

#journey-controls .hidden {
  display: none;
}

.journey-primary {
  background: #d8b66b;
  color: #111;
  border: 2px solid #d8b66b;
}

.journey-secondary {
  background: #25282b;
  color: #f3e4c2;
  border: 2px solid #706044;
}

.journey-waiting {
  color: #f3e4c2;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}

.journey-potential-fare {
  color: #999da3;
  font-size: 0.82rem;
  font-weight: 400;
  text-align: right;
}

.journey-active-fare {
  color: #f3d28d;
  font-size: 2.1rem;
  font-weight: 800;
  text-align: center;
}

/* Keep controls closer to the map on Samsung-sized screens. */
#job-map {
  height: 38dvh;
  min-height: 220px;
  max-height: 400px;
}

/* Test-only driver booking suspension screen */
#suspension-panel {
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#suspension-panel.hidden { display: none; }
.suspension-card {
  width: 100%;
  max-width: 520px;
  box-sizing: border-box;
  padding: 32px 22px;
  border-radius: 22px;
  background: #282b2a;
  color: #f5f5f5;
  text-align: center;
  border: 1px solid #494c4a;
}
.suspension-lock { font-size: 46px; margin-bottom: 14px; filter: grayscale(1); }
.suspension-card h2 { color: #f5f5f5; font-size: 23px; line-height: 1.3; }
.suspension-subtitle, .suspension-note { color: #c0c2c1; line-height: 1.6; }
.suspension-label { color: #aeb1af; letter-spacing: 2px; font-size: 12px; margin-top: 35px; }
.suspension-countdown {
  font-size: clamp(42px, 10vw, 72px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  color: white;
  margin: 12px 0 26px;
}
.suspension-locked-controls { margin: 28px 0; opacity: .48; }
.suspension-locked-controls div {
  background: #444745;
  padding: 16px;
  margin: 8px 0;
  border-radius: 10px;
  color: #ddd;
}
#suspension-logout-button { margin-top: 12px; }


/* HIGH DUKES: Approved journey completion layout */
#journey-completion-controls.hidden {
  display: none !important;
}

.journey-completion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
  margin-top: 12px;
}

.journey-completion-grid > #journey-completed-button {
  width: 100%;
  min-height: 132px;
  font-size: 21px;
  font-weight: 800;
}

.journey-payment-buttons {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
}

.journey-payment-buttons button {
  width: 100%;
  min-height: 61px;
  font-size: 21px;
  font-weight: 800;
}

#journey-completion-controls button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* HIGH DUKES TEST ONLY: keep NO-SHOW slider handle compact */
#journey-controls #journey-no-show-handle {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 50%;
  touch-action: none;
  cursor: grab;
}

#journey-controls #journey-no-show-button {
  width: 100%;
  height: 54px;
  min-height: 54px;
  margin-top: 8px;
  overflow: hidden;
}

/* HIGH DUKES TEST ONLY: compact customer call button */
#journey-passenger-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: 8px;
  align-items: stretch;
}

#journey-passenger-actions:has(#journey-onboard-button.hidden) {
  display: none;
}

#journey-controls #journey-call-button {
  width: 56px;
  min-height: 56px;
  padding: 0;
  font-size: 1.35rem;
  border-radius: 14px;
}

/* HIGH DUKES TEST ONLY: compact journey completion tab */
#journey-completion-tab {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: #303438;
}

#journey-payment-choice {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 5px;
}

#journey-controls .journey-payment-option {
  width: 100%;
  min-height: 48px;
  padding: 8px 4px;
  border: 0;
  border-radius: 9px;
  background: #484c50;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

#journey-controls .journey-payment-option[aria-pressed="true"] {
  background: #d8b66b;
  color: #171717;
}

#journey-controls #journey-complete-slider {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 101px;
  margin: 0;
  overflow: hidden;
  border-radius: 11px;
  background: #202326;
}

#journey-controls #journey-complete-handle {
  position: absolute;
  left: 4px;
  top: 50%;
  width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 50%;
  transform: translateY(-50%);
  touch-action: none;
  cursor: grab;
  z-index: 2;
}

#journey-controls #journey-complete-handle:disabled {
  cursor: not-allowed;
  opacity: .55;
}

#journey-controls #journey-complete-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 8px 8px 51px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  white-space: normal;
}


/* HIGH DUKES TEST ONLY: Gold ARRIVED TO CUSTOMER swipe */
#journey-controls #journey-arrived-button {
  width: 100%;
  height: 78px;
  min-height: 78px;
  margin: 10px 0;
  border-radius: 18px;
  display: block;
}

#journey-controls #journey-arrived-button.hidden {
  display: none !important;
}

#journey-controls #journey-arrived-handle {
  width: min(64%, 230px);
  height: 70px;
  min-height: 70px;
  top: 3px;
  left: 3px;
  border-radius: 15px;
  font-size: clamp(12px, 3.4vw, 17px);
  font-weight: 900;
  line-height: 1.1;
  padding: 0 9px;
  white-space: normal;
  z-index: 2;
}

#journey-controls .journey-arrived-arrows {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: clamp(21px, 5vw, 32px);
  font-weight: 900;
  white-space: nowrap;
  pointer-events: none;
}


/* HIGH DUKES TEST: Pending Jobs call warning */
.pending-job-call-warning {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #ff4040;
  border-radius: 10px;
  background: #a50000;
  color: #fff;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
  animation: high-dukes-call-flash 1.2s ease-in-out infinite;
}

.pending-job-call-warning.acknowledged {
  animation: none;
  background: #7d1717;
}

@keyframes high-dukes-call-flash {
  50% {
    background: #ff3333;
    box-shadow: 0 0 16px rgba(255, 45, 45, .8);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pending-job-call-warning {
    animation: none;
    background: #d00000;
  }
}

/* HIGH DUKES TEST: matching red slide-to-call control */
.pending-job-slide.pending-job-call-warning {
  animation: none;
  width: 100%;
  height: 54px;
  padding: 0;
  border: 1px solid #ff4040;
  border-radius: 30px;
  background: #a50000;
  animation: high-dukes-call-flash 1.2s ease-in-out infinite;
}

.pending-job-call-warning .pending-job-slide-label {
  color: #fff;
}

.pending-job-call-warning .pending-job-slide-handle {
  background: #ffdddd;
  color: #9b0000;
}

.pending-job-slide.pending-job-call-warning.acknowledged {
  animation: none;
  background: #7d1717;
}

@media (prefers-reduced-motion: reduce) {
  .pending-job-slide.pending-job-call-warning {
    animation: none;
  }
}
