:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020617;
  color: #f8fafc;
  --panel-bg: rgba(2, 6, 23, 0.84);
  --panel-border: rgba(255, 255, 255, 0.18);
  --muted: #cbd5e1;
  --text: #f8fafc;
  --accent: #2dd4bf;
  --accent-strong: #14b8a6;
  --danger: #f87171;
  --blue: #60a5fa;
  --green: #4ade80;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body,
.app,
.map-wrap,
#map {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #020617;
}

body.signed-out .map-wrap {
  display: none;
}

body.signed-in .auth-screen {
  display: none;
}

.auth-screen {
  display: grid;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 20%, rgba(45, 212, 191, 0.16), transparent 34%),
    linear-gradient(145deg, #020617 0%, #0f172a 54%, #111827 100%);
}

.map-wrap {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
}

.map-wrap::after {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  height: 46%;
  pointer-events: none;
  background: linear-gradient(to top, rgba(2, 6, 23, 0.58), rgba(2, 6, 23, 0));
  content: "";
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  height: 100vh;
  height: 100dvh;
  background: #dbeafe;
}

.maplibregl-map {
  width: 100%;
  height: 100%;
  background: #dbeafe;
  font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}

.maplibregl-ctrl-top-right {
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.2);
  backdrop-filter: blur(12px);
}

.maplibregl-ctrl-group button {
  width: 38px;
  height: 38px;
}

.maplibregl-ctrl-attrib {
  border-radius: 10px 0 0 0;
  background: rgba(255, 255, 255, 0.78);
  color: #111827;
  font-size: 10px;
}

.status-panel {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 2;
  display: grid;
  gap: 14px;
  max-width: 580px;
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 16% 0%, rgba(45, 212, 191, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(2, 6, 23, 0.92));
  box-shadow:
    0 24px 70px rgba(2, 6, 23, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px) saturate(130%);
}

.access-locked .status-panel {
  align-content: start;
  max-height: calc(100dvh - 48px);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.status-panel::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 34%, rgba(45, 212, 191, 0.08));
  content: "";
}

.status-panel > * {
  position: relative;
}

.status-panel .entitlement-banner {
  order: 1;
}

.status-panel .status-header {
  order: 2;
}

.status-panel .upgrade-panel {
  order: 3;
}

.status-panel .view-tabs {
  order: 4;
}

.status-panel .metrics,
.status-panel .coords,
.status-panel .map-actions,
.status-panel .history-panel {
  order: 5;
}

.auth-panel {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.auth-screen .auth-panel {
  width: min(100%, 390px);
  padding: 22px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 16% 0%, rgba(45, 212, 191, 0.18), transparent 38%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(2, 6, 23, 0.94));
  box-shadow:
    0 24px 70px rgba(2, 6, 23, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(24px) saturate(130%);
}

.auth-panel[hidden] {
  display: none;
}

.auth-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.42);
}

.auth-mode button {
  min-height: 36px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.auth-mode button.active {
  background: rgba(45, 212, 191, 0.18);
  color: #ccfbf1;
}

.auth-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.auth-panel label[hidden] {
  display: none;
}

.auth-panel input {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 15px;
  background: rgba(15, 23, 42, 0.68);
  color: var(--text);
  font: inherit;
  outline: none;
}

.auth-panel input:focus {
  border-color: rgba(45, 212, 191, 0.75);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14);
}

.auth-panel .auth-link-button {
  justify-self: end;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #99f6e4;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.auth-panel .auth-link-button:hover {
  color: #ccfbf1;
  text-decoration: underline;
}

.vehicle-id-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.scan-qr-button {
  min-width: 88px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid rgba(96, 165, 250, 0.38);
  border-radius: 15px;
  background: rgba(96, 165, 250, 0.16);
  color: #dbeafe;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.auth-panel button,
.sign-out {
  min-height: 44px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #5eead4, #14b8a6);
  color: #042f2e;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.auth-panel button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.auth-error {
  min-height: 16px;
  margin: 0;
  color: #fca5a5;
  font-size: 12px;
}

.qr-scanner[hidden] {
  display: none;
}

.qr-scanner {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(18px);
}

.qr-scanner-panel {
  display: grid;
  gap: 12px;
  width: min(100%, 440px);
  padding: 16px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.96));
  box-shadow: 0 24px 70px rgba(2, 6, 23, 0.58);
}

.qr-scanner-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.qr-scanner-head strong {
  color: var(--text);
  font-size: 16px;
}

.qr-scanner-head button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

#qrScannerVideo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  background: #020617;
  object-fit: cover;
}

#qrScannerStatus {
  margin: 0;
  color: rgba(203, 213, 225, 0.78);
  font-size: 13px;
  line-height: 1.35;
}

.entitlement-banner {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(45, 212, 191, 0.24);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.54);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entitlement-banner[hidden] {
  display: none;
}

.entitlement-banner.locked {
  border-color: rgba(248, 113, 113, 0.34);
  color: #fecaca;
}

.access-locked .entitlement-banner {
  display: none;
}

.upgrade-panel {
  display: grid;
  gap: 9px;
  width: min(100%, 360px);
  padding: 12px;
  border: 1px solid rgba(96, 165, 250, 0.26);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.64);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.upgrade-panel[hidden] {
  display: none;
}

.upgrade-panel div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.upgrade-panel strong {
  color: var(--text);
  font-size: 14px;
}

.upgrade-panel span {
  flex: 0 0 auto;
  color: #bfdbfe;
  font-size: 13px;
  font-weight: 850;
}

.upgrade-panel p,
.upgrade-panel small {
  margin: 0;
  color: rgba(203, 213, 225, 0.74);
  font-size: 12px;
  line-height: 1.35;
}

.paypal-checkout-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(252, 211, 77, 0.36);
  border-radius: 14px;
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #0f172a;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(245, 158, 11, 0.18);
}

.paypal-checkout-button:hover {
  filter: brightness(1.04);
}

.paypal-checkout-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.paypal-checkout-button span {
  color: #07111e;
  font-size: 14px;
  font-weight: 950;
}

.paypal-checkout-button strong {
  color: inherit;
  font-size: 14px;
}

.access-locked .upgrade-panel {
  width: min(100%, 430px);
}

.access-locked .view-tabs,
.access-locked .metrics,
.access-locked .coords,
.access-locked .map-actions,
.access-locked .history-panel {
  display: none;
}

.status-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.status-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.header-actions {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.icon-button:hover {
  background: rgba(248, 250, 252, 0.18);
}

.icon-button[hidden] {
  display: none;
}

.account-info-panel {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  align-items: start;
  justify-items: end;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  pointer-events: none;
}

.account-info-panel[hidden] {
  display: none;
}

.account-info-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  padding: 16px;
  pointer-events: auto;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.94);
  box-shadow: 0 24px 70px rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(18px);
}

.account-info-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.account-info-head h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.08;
}

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

.account-info-field,
.account-vehicle-box {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.32);
}

.account-info-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
}

.account-info-field span,
.account-vehicle-copy span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.account-info-field strong,
.account-vehicle-copy strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.account-vehicle-box {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
}

#accountVehicleQrCanvas {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  background: #f8fafc;
}

.account-vehicle-copy {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.account-vehicle-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-vehicle-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(45, 212, 191, 0.26);
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.14);
  color: #ccfbf1;
  font-weight: 800;
}

.account-vehicle-actions small {
  min-width: 0;
  color: rgba(203, 213, 225, 0.72);
  font-size: 12px;
}

.change-password-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.36);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.change-password-toggle svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 160ms ease;
}

.change-password-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.change-password-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.change-password-form[hidden] {
  display: none;
}

.change-password-head {
  display: grid;
  gap: 3px;
}

.change-password-head strong {
  color: var(--text);
  font-size: 14px;
}

.change-password-head small,
.change-password-form label span,
.change-password-actions small {
  color: rgba(203, 213, 225, 0.68);
  font-size: 12px;
  line-height: 1.35;
}

.change-password-form label {
  display: grid;
  gap: 6px;
}

.change-password-form input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.54);
  color: var(--text);
  font: inherit;
  outline: none;
}

.change-password-form input:focus {
  border-color: rgba(45, 212, 191, 0.68);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.change-password-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.change-password-actions button {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.16);
  color: #ccfbf1;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.change-password-actions button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.admin-page {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(16px);
}

.admin-page[hidden] {
  display: none;
}

.admin-shell {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 14px;
  width: min(1120px, 100%);
  max-height: 100%;
  margin: auto;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 16% 0%, rgba(45, 212, 191, 0.16), transparent 38%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.96));
  box-shadow: 0 24px 70px rgba(2, 6, 23, 0.58);
}

.admin-head,
.admin-search,
.admin-user-row,
.admin-user-main,
.admin-user-actions {
  min-width: 0;
}

.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.admin-head h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.05;
}

.admin-search button,
.admin-user-actions button {
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.admin-search button {
  padding: 0 14px;
}

.admin-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.admin-search input,
.admin-user-actions select,
.admin-user-actions input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.70);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.admin-search input {
  padding: 0 13px;
}

.admin-status {
  min-height: 18px;
  margin: 0;
  color: rgba(203, 213, 225, 0.78);
  font-size: 13px;
}

.admin-user-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.58);
}

.admin-user-main {
  display: grid;
  gap: 6px;
}

.admin-user-main strong {
  overflow: hidden;
  color: #f8fafc;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-main span,
.admin-user-main small {
  overflow-wrap: anywhere;
  color: rgba(203, 213, 225, 0.76);
  font-size: 12px;
  line-height: 1.25;
}

.admin-user-main .admin-entitlement {
  color: #ccfbf1;
  font-weight: 800;
}

.admin-user-actions {
  display: grid;
  grid-template-columns: minmax(82px, 0.8fr) minmax(92px, 0.8fr) minmax(136px, 1fr);
  gap: 8px;
  align-content: start;
}

.admin-vehicle-tools {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  min-width: 0;
}

.admin-user-actions .admin-action-buttons {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.admin-user-actions button.primary {
  border-color: rgba(20, 184, 166, 0.95);
  background: linear-gradient(135deg, #5eead4, #14b8a6);
  color: #042f2e;
}

.admin-user-actions button.danger {
  border-color: rgba(248, 113, 113, 0.42);
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}

.view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.48);
}

.view-tab {
  min-height: 38px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.view-tab.active {
  background: rgba(45, 212, 191, 0.18);
  color: #ccfbf1;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.28);
}

.eyebrow,
.coords,
h1 {
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  overflow-wrap: anywhere;
  margin-top: 4px;
  font-size: clamp(24px, 5.5vw, 32px);
  line-height: 1.03;
  letter-spacing: -0.04em;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metrics[hidden],
.map-actions[hidden] {
  display: none;
}

.metrics div {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.metrics span,
.metrics small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: #ffffff;
  font-size: 19px;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.metrics small {
  overflow-wrap: anywhere;
  margin-top: 4px;
  color: rgba(203, 213, 225, 0.72);
  font-size: 11px;
}

/* Coordinate text is kept in the DOM for accessibility/debug state, but hidden from the UI. */
.coords[hidden] {
  display: none;
}

.map-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.history-panel {
  display: grid;
  gap: 12px;
}

.history-panel[hidden] {
  display: none;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
}

.history-head div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.history-head strong {
  font-size: 17px;
  line-height: 1.15;
}

.history-head small {
  overflow: hidden;
  color: rgba(203, 213, 225, 0.76);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-head span {
  color: rgba(203, 213, 225, 0.76);
  font-size: 12px;
}

.history-head-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.history-collapse-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.56);
  color: #e2e8f0;
  cursor: pointer;
}

.history-collapse-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transition: transform 160ms ease;
}

.history-panel.collapsed {
  gap: 0;
}

.history-panel.collapsed .history-collapse-button svg {
  transform: rotate(180deg);
}

.history-panel.collapsed .history-controls,
.history-panel.collapsed .history-view-tabs,
.history-panel.collapsed .trip-list,
.history-panel.collapsed .charts-panel,
.history-panel.collapsed .history-empty {
  display: none;
}

.history-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.history-controls label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.history-controls span {
  color: rgba(203, 213, 225, 0.76);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.history-controls select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.68);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  outline: none;
}

.history-view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.42);
}

.history-view-tab {
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.history-view-tab.active {
  background: rgba(96, 165, 250, 0.18);
  color: #dbeafe;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.28);
}

.trip-list {
  display: grid;
  gap: 8px;
  max-height: min(50vh, 430px);
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.trip-list[hidden] {
  display: none;
}

.charts-panel {
  display: grid;
  gap: 10px;
  max-height: min(50vh, 430px);
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.charts-panel[hidden] {
  display: none;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chart-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.52);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.chart-head strong {
  color: var(--text);
  font-size: 13px;
}

.chart-head span {
  color: rgba(203, 213, 225, 0.76);
  font-size: 12px;
  font-weight: 800;
}

.history-chart {
  display: block;
  width: 100%;
  height: 180px;
}

.history-chart.compact {
  height: 150px;
}

.trip-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  width: 100%;
  min-height: 104px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.52);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.trip-item.active {
  border-color: rgba(45, 212, 191, 0.62);
  background: rgba(20, 184, 166, 0.16);
}

.trip-item strong {
  align-self: start;
  color: #ccfbf1;
  font-size: 17px;
  line-height: 1.1;
}

.trip-item span {
  min-width: 0;
  color: rgba(203, 213, 225, 0.76);
  font-size: 12px;
  line-height: 1.2;
}

.trip-item .trip-date {
  grid-column: 1;
  overflow: hidden;
  color: #f8fafc;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-empty {
  margin: 0;
  color: rgba(203, 213, 225, 0.76);
  font-size: 13px;
}

.history-empty[hidden] {
  display: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid rgba(20, 184, 166, 0.95);
  border-radius: 16px;
  background: linear-gradient(135deg, #5eead4, #14b8a6);
  color: #042f2e;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(20, 184, 166, 0.20);
}

.button svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.button span {
  min-width: 0;
}

#googleMapsLink {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.16);
  color: #bbf7d0;
  box-shadow: 0 14px 30px rgba(34, 197, 94, 0.12);
}

#appleMapsLink {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(96, 165, 250, 0.16);
  color: #bfdbfe;
  box-shadow: 0 14px 30px rgba(96, 165, 250, 0.12);
}

#googleMapsLink:hover,
#appleMapsLink:hover {
  filter: brightness(1.08);
}


.button:active,
.view-tab:active,
.history-view-tab:active,
.history-collapse-button:active,
.trip-item:active,
.sign-out:active,
.auth-panel button:active {
  transform: translateY(1px);
}

.button[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
}

.car-marker {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  background: #0f172a;
  color: #64748b;
  box-shadow: 0 14px 34px rgba(2, 6, 23, 0.42);
}

.car-marker::before {
  position: absolute;
  inset: -8px;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.22;
  animation: marker-pulse 1.8s infinite;
  content: "";
}

.car-marker::after {
  position: absolute;
  inset: 10px 8px 9px;
  border-radius: 8px;
  background: #fff;
  clip-path: polygon(18% 42%, 33% 20%, 67% 20%, 82% 42%, 88% 71%, 72% 78%, 66% 65%, 34% 65%, 28% 78%, 12% 71%);
  content: "";
}

.car-marker.moving { color: #22c55e; }
.car-marker.parked { color: #3b82f6; }
.car-marker.offline { color: #ef4444; }

@keyframes marker-pulse {
  0% {
    transform: scale(0.72);
    opacity: 0.28;
  }
  72% {
    transform: scale(1.55);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .account-info-panel {
    align-items: end;
    justify-items: center;
  }

  .account-info-card {
    width: 100%;
  }

  .account-info-grid {
    grid-template-columns: 1fr;
  }

  .account-vehicle-box {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  #accountVehicleQrCanvas {
    width: 82px;
    height: 82px;
  }
}

@media (min-width: 760px) {
  .status-panel {
    right: auto;
    bottom: 24px;
    left: 24px;
    width: min(580px, calc(100vw - 48px));
  }

  .status-panel:has(.history-panel:not([hidden])) {
    width: min(680px, calc(100vw - 48px));
  }
}

@media (max-width: 760px) {
  .admin-user-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .status-panel {
    gap: 12px;
    padding: 15px;
    border-radius: 22px;
  }

  .status-header {
    gap: 10px;
  }


  .metrics {
    grid-template-columns: 1fr;
  }

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

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .admin-page {
    padding: 10px;
  }

  .admin-shell {
    padding: 14px;
  }

  .admin-search,
  .admin-user-row,
  .admin-user-actions {
    grid-template-columns: 1fr;
  }

  .admin-user-actions .admin-action-buttons {
    grid-template-columns: 1fr;
  }

  .admin-vehicle-tools {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 340px) {
  .map-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .car-marker::before {
    animation: none;
  }
}
