:root {
  color-scheme: dark;
  --bg: #020617;
  --panel: rgba(7, 17, 31, 0.88);
  --panel-soft: rgba(3, 7, 18, 0.82);
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(0, 217, 255, 0.22);
  --nav: #020617;
  --nav-2: #07111f;
  --blue: #00d9ff;
  --blue-dark: #006bff;
  --blue-soft: rgba(0, 217, 255, 0.16);
  --green: #16a34a;
  --amber: #006bff;
  --red: #dc2626;
  --deep-blue: #071bff;
  --glow: rgba(0, 217, 255, 0.34);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% -10%, rgba(0, 107, 255, 0.22), transparent 34%),
    radial-gradient(circle at 90% 12%, rgba(0, 217, 255, 0.14), transparent 30%),
    linear-gradient(135deg, #020617 0%, #030712 48%, #07111f 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#root {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

button {
  cursor: pointer;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(0, 217, 255, 0.24);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.76);
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.16), 0 0 24px rgba(0, 217, 255, 0.18);
  outline: none;
}

label {
  display: grid;
  gap: 7px;
  color: #e6f7ff;
  font-size: 0.9rem;
  font-weight: 700;
}

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

h1 {
  font-size: 1.35rem;
  line-height: 1.2;
}

h2 {
  font-size: 1rem;
}

.hidden {
  display: none !important;
}

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

.eyebrow {
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 217, 255, 0.28);
  background: rgba(2, 6, 23, 0.82);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 0 24px rgba(0, 217, 255, 0.28);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.tab-button {
  min-height: 40px;
  border-radius: 6px;
  border: 0;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: linear-gradient(135deg, #00d9ff, #006bff 62%, #071bff);
  color: #f8fafc;
  box-shadow: 0 0 22px rgba(0, 217, 255, 0.28);
}

.primary-button:hover {
  filter: brightness(1.08);
}

.ghost-button {
  border: 1px solid rgba(0, 217, 255, 0.24);
  background: rgba(7, 17, 31, 0.64);
  color: #e6f7ff;
}

.ghost-button:hover {
  background: rgba(0, 217, 255, 0.12);
}

.ghost-button.compact,
.primary-button.compact,
.danger-button.compact {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.82rem;
}

.ghost-button.light {
  border-color: rgba(0, 217, 255, 0.24);
  background: rgba(2, 6, 23, 0.7);
  color: #e6f7ff;
}

.ghost-button.light:hover {
  background: rgba(0, 217, 255, 0.12);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(220, 38, 38, 0.12);
  color: #fecaca;
}

.danger-button:hover {
  background: rgba(220, 38, 38, 0.2);
}

.icon-button {
  min-width: 36px;
  padding: 0;
  background: rgba(7, 17, 31, 0.82);
  color: var(--ink);
}

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

.spin-icon {
  animation: spin 0.9s linear infinite;
}

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

.app-notice {
  position: fixed;
  top: 78px;
  right: 18px;
  z-index: 60;
  width: min(390px, calc(100% - 36px));
  max-width: calc(100% - 36px);
  min-height: 64px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
  padding: 12px;
  font-size: 0.88rem;
  animation: notice-in 0.18s ease-out;
}

.notice-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
}

.notice-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  line-height: 1.35;
}

.notice-copy strong,
.notice-copy span {
  overflow-wrap: anywhere;
}

.notice-copy strong {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
}

.app-notice.success {
  border-color: #86efac;
  border-left: 5px solid var(--green);
  color: #166534;
}

.app-notice.success .notice-icon {
  background: #dcfce7;
}

.app-notice.error {
  border-color: #fca5a5;
  border-left: 5px solid var(--red);
  color: #991b1b;
}

.app-notice.error .notice-icon {
  background: #fee2e2;
}

.notice-close {
  min-height: 30px;
  width: 30px;
  background: transparent;
  color: inherit;
}

@keyframes notice-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.inline-status {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.3;
}

.inline-status span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.inline-status.loading {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--blue-dark);
}

.inline-status.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.inline-status.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  border: 1px solid rgba(203, 213, 225, 0.85);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 30px;
  margin: auto;
}

.login-brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.login-brand p:not(.eyebrow) {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.form-error {
  min-height: 20px;
  color: var(--red);
  font-size: 0.9rem;
}

.dashboard {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
}

.top-nav {
  width: 100%;
  max-width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(90deg, var(--nav), var(--nav-2));
  color: #f8fafc;
  padding: 10px 18px;
  box-shadow: 0 8px 26px rgba(15, 23, 42, 0.24);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  min-width: 0;
}

.nav-brand strong,
.nav-brand span {
  display: block;
}

.nav-brand span {
  color: #94a3b8;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  max-width: 100%;
  min-width: 0;
}

.connection-pill {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  padding: 0 12px;
  font-weight: 750;
}

.connection-pill svg {
  flex: 0 0 auto;
}

.connection-pill.online {
  color: #bbf7d0;
}

.connection-pill.offline {
  color: #cbd5e1;
}

.socket-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--blue-dark);
  box-shadow: 0 0 0 4px rgba(0, 107, 255, 0.16), 0 0 14px rgba(0, 217, 255, 0.28);
}

.socket-dot.online {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16);
}

.socket-dot.offline {
  background: #475569;
  box-shadow: 0 0 0 4px rgba(71, 85, 105, 0.18);
}

.dashboard-grid {
  width: 100%;
  max-width: 100%;
  min-height: calc(100vh - 64px);
  position: relative;
  display: block;
  padding: 14px;
}

.fleet-sidebar,
.data-panel,
.floating-info,
.approval-modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.fleet-sidebar {
  position: absolute;
  left: 26px;
  top: 86px;
  bottom: 26px;
  z-index: 20;
  width: min(500px, calc(100% - 52px));
  max-width: calc(100% - 52px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-18px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fleet-sidebar.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.sidebar-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 10px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.sidebar-summary strong,
.sidebar-summary span {
  overflow-wrap: anywhere;
}

.sidebar-summary span,
.panel-title span,
.vehicle-main small,
.vehicle-details,
.event-item span,
.event-item small,
dt {
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px 14px;
  background: #ffffff;
}

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

.summary-metrics div {
  min-width: 0;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px;
}

.summary-metrics svg {
  color: var(--blue);
}

.summary-metrics span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.summary-metrics strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #334155;
}

.tab-button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.sidebar-panel {
  display: none;
  min-height: 0;
  flex: 1;
}

.sidebar-panel.active {
  display: flex;
  flex-direction: column;
}

.panel-title,
.panel-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
}

.vehicle-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding: 14px;
}

.vehicle-card {
  min-width: 0;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 11px;
}

.vehicle-card.selected {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.pending-card {
  border-style: dashed;
  background: #fffbeb;
}

.vehicle-main {
  max-width: 100%;
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.vehicle-main.static {
  cursor: default;
}

.vehicle-main strong,
.vehicle-main small {
  display: block;
  overflow-wrap: anywhere;
}

.vehicle-icon {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 34%, rgba(255, 255, 255, 0.5) 35% 39%, transparent 40%),
    linear-gradient(135deg, var(--blue), #38bdf8);
  box-shadow: inset 0 -8px 0 rgba(15, 23, 42, 0.12);
  color: #ffffff;
}

.vehicle-icon.moving {
  background:
    linear-gradient(90deg, transparent 34%, rgba(255, 255, 255, 0.55) 35% 39%, transparent 40%),
    linear-gradient(135deg, #16a34a, #22c55e);
}

.vehicle-icon.stopped {
  background:
    linear-gradient(90deg, transparent 34%, rgba(255, 255, 255, 0.55) 35% 39%, transparent 40%),
    linear-gradient(135deg, #d97706, #fbbf24);
}

.vehicle-icon.offline {
  background:
    linear-gradient(90deg, transparent 34%, rgba(255, 255, 255, 0.44) 35% 39%, transparent 40%),
    linear-gradient(135deg, #64748b, #334155);
}

.vehicle-state-mark {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 13px;
  height: 13px;
  display: grid;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #39ff14;
  color: #020617;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.9);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
}

.vehicle-icon.stopped .vehicle-state-mark {
  background: #fff200;
  box-shadow: 0 0 12px rgba(255, 242, 0, 0.9);
}

.vehicle-icon.offline .vehicle-state-mark {
  background: #ff1744;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.9);
  text-transform: uppercase;
}

.vehicle-icon.pending {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.speed-chip,
.badge {
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
  font-size: 0.76rem;
  font-weight: 850;
}

.speed-chip {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.badge {
  background: #dcfce7;
  color: #166534;
}

.badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.badge.neutral {
  background: #f1f5f9;
  color: #475569;
}

.vehicle-details {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.edit-toggle-button {
  width: 100%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #1e293b;
  font-size: 0.84rem;
  font-weight: 850;
}

.edit-toggle-button:hover,
.edit-toggle-button.open {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--blue-dark);
}

.edit-toggle-button svg {
  flex: 0 0 auto;
}

.delete-vehicle-button {
  width: 100%;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.84rem;
  font-weight: 850;
}

.delete-vehicle-button:hover {
  border-color: #fca5a5;
  background: #fee2e2;
}

.pending-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.vehicle-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.vehicle-form .ghost-button {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.vehicle-form .ghost-button {
  border-color: var(--line);
  background: #f8fafc;
  color: #334155;
}

.vehicle-form .inline-status {
  grid-column: 1 / -1;
}

.map-workspace {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(620px, calc(100vh - 146px));
  gap: 12px;
}

.map-toolbar {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
}

.map-toolbar h1 {
  font-size: 1.4rem;
}

.workspace-nav,
.map-link,
.map-live-badge {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  border-radius: 8px;
}

.workspace-nav {
  width: auto;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-end;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 5px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.workspace-tab {
  flex: 0 0 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  padding: 0 11px;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 850;
}

.workspace-tab span {
  min-width: 20px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  padding: 2px 6px;
  font-size: 0.72rem;
}

.workspace-tab.active {
  background: var(--blue);
  color: #ffffff;
}

.workspace-tab.active span {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.map-link,
.map-live-badge {
  background: var(--blue);
  color: #ffffff;
  padding: 0 14px;
  text-decoration: none;
  font-weight: 800;
}

.map-live-badge {
  background: #ffffff;
  color: var(--blue-dark);
  border: 1px solid #bfdbfe;
}

.map-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e5e7eb;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.1);
}

.map-summary-strip {
  position: relative;
  z-index: 2;
  width: 100%;
  border: 1px solid rgba(0, 217, 255, 0.15);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(31, 41, 55, 0.96), rgba(17, 24, 39, 0.96)),
    #1f2937;
  color: #f8fafc;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(230, 247, 255, 0.04);
  overflow: hidden;
}

.map-summary-toggle {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10px auto auto 34px;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: #f8fafc;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
}

.map-summary-toggle small,
.map-summary-details dt {
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.map-summary-toggle strong {
  display: block;
  margin-top: 2px;
  color: #f8fafc;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.map-summary-toggle > span:not(:first-child) {
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.map-summary-toggle svg {
  justify-self: end;
  color: #00d9ff;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #94a3b8;
}

.status-dot.moving {
  background: #16a34a;
}

.status-dot.stopped {
  background: #f59e0b;
}

.status-dot.offline {
  background: #64748b;
}

.map-summary-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  border-top: 1px solid rgba(0, 217, 255, 0.12);
  padding: 12px 14px 14px;
}

.map-summary-details div {
  min-width: 0;
  border: 1px solid rgba(0, 217, 255, 0.12);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.45);
  padding: 9px 10px;
}

.map-summary-details .wide {
  grid-column: 1 / -1;
}

.dashboard[data-map-fullscreen="true"] .top-nav,
.dashboard[data-map-fullscreen="true"] .fleet-sidebar,
.dashboard[data-map-fullscreen="true"] .bottom-nav {
  display: none;
}

.dashboard[data-map-fullscreen="true"] .dashboard-grid {
  min-height: 100vh;
  padding: 0;
}

.dashboard[data-map-fullscreen="true"] .map-workspace {
  position: fixed;
  inset: 0;
  z-index: 80;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
}

.dashboard[data-map-fullscreen="true"] .map-card {
  min-height: 0;
  height: calc(100vh - 146px);
}

.dashboard[data-map-fullscreen="true"] .leaflet-map {
  min-height: 0;
  height: 100%;
}

.dashboard[data-map-fullscreen="true"] .map-drawer {
  display: none;
}

.leaflet-map {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  z-index: 1;
  min-height: 620px;
  background: #dbeafe;
}

.leaflet-container {
  font-family: inherit;
}

.vehicle-map-icon {
  background: transparent;
  border: 0;
}

.vehicle-map-marker {
  position: relative;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.22), transparent 34%),
    linear-gradient(145deg, #0f172a, #1e293b);
  color: #ffffff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.32);
}

.vehicle-map-marker::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
  z-index: -1;
}

.vehicle-map-marker.stopped::before {
  background: rgba(245, 158, 11, 0.2);
}

.vehicle-map-marker.offline::before {
  background: rgba(15, 23, 42, 0.18);
}

.map-car-shape {
  position: relative;
  width: 34px;
  height: 21px;
  border-radius: 10px 10px 6px 6px;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow:
    inset 0 -5px 0 rgba(15, 23, 42, 0.22),
    0 4px 10px rgba(15, 23, 42, 0.22);
}

.map-car-shape::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: -8px;
  height: 12px;
  border-radius: 8px 8px 3px 3px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.78) 0 45%, rgba(191, 219, 254, 0.88) 46% 100%);
}

.map-car-shape::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: -4px;
  height: 8px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 2px 4px, #111827 0 4px, transparent 4px),
    radial-gradient(circle at calc(100% - 2px) 4px, #111827 0 4px, transparent 4px);
}

.map-car-shape i {
  position: absolute;
  left: 7px;
  right: 7px;
  top: 3px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.vehicle-map-marker.moving .map-car-shape {
  background: linear-gradient(135deg, #22c55e, #15803d);
}

.vehicle-map-marker.stopped .map-car-shape {
  background: linear-gradient(135deg, #fbbf24, #d97706);
}

.vehicle-map-marker.offline .map-car-shape {
  background: linear-gradient(135deg, #94a3b8, #475569);
}

.vehicle-map-marker b {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #39ff14;
  color: #020617;
  box-shadow: 0 0 14px rgba(57, 255, 20, 0.88);
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.vehicle-map-marker.stopped b {
  background: #fff200;
  color: #020617;
  box-shadow: 0 0 14px rgba(255, 242, 0, 0.9);
}

.vehicle-map-marker.offline b {
  background: #ff1744;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 23, 68, 0.9);
}

.vehicle-map-marker span {
  position: absolute;
  top: 58px;
  left: 50%;
  max-width: 92px;
  overflow: hidden;
  border-radius: 999px;
  background: #0f172a;
  color: #ffffff;
  padding: 3px 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 900;
  transform: translateX(-50%);
}

.history-map-icon {
  background: transparent;
  border: 0;
}

.history-map-marker {
  position: relative;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #dc2626);
  color: #ffffff;
  box-shadow: 0 14px 32px rgba(249, 115, 22, 0.38);
}

.history-map-marker .map-car-shape {
  background: linear-gradient(135deg, #fed7aa, #f97316);
}

.history-map-marker .map-car-shape::before {
  background: #ffedd5;
}

.history-map-marker span {
  position: absolute;
  top: 50px;
  left: 50%;
  max-width: 110px;
  overflow: hidden;
  border-radius: 999px;
  background: #7c2d12;
  color: #ffffff;
  padding: 3px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 900;
  transform: translateX(-50%);
}

.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-layer-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  padding: 5px;
  backdrop-filter: blur(10px);
}

.map-control-button {
  min-width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
}

.map-control-button:hover,
.map-layer-switch button:hover {
  background: #f8fafc;
}

.map-layer-switch svg {
  color: var(--muted);
  margin: 0 4px;
}

.map-layer-switch button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  padding: 0 9px;
  font-size: 0.8rem;
  font-weight: 850;
}

.map-layer-switch button.active {
  background: var(--blue);
  color: #ffffff;
}

.map-grid {
  position: absolute;
  inset: -50px;
  background:
    repeating-linear-gradient(22deg, transparent 0 58px, rgba(30, 41, 59, 0.12) 59px 62px, transparent 63px 128px),
    repeating-linear-gradient(112deg, transparent 0 76px, rgba(37, 99, 235, 0.13) 77px 81px, transparent 82px 154px);
  transform: rotate(-8deg) scale(1.16);
}

.map-route {
  position: absolute;
  height: 12px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.22);
  transform-origin: center;
}

.route-a {
  left: 7%;
  right: 16%;
  top: 38%;
  transform: rotate(-9deg);
}

.route-b {
  left: 28%;
  right: 7%;
  top: 63%;
  transform: rotate(15deg);
}

.map-pin {
  position: absolute;
  left: 56%;
  top: 43%;
  width: 30px;
  height: 30px;
  border: 7px solid var(--blue);
  border-radius: 50% 50% 50% 0;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.35);
  transform: translate(-50%, -50%) rotate(-45deg);
}

.map-pin::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: var(--blue);
}

.floating-info {
  position: absolute;
  z-index: 5;
  right: 18px;
  bottom: 18px;
  width: min(360px, calc(100% - 36px));
  max-width: calc(100% - 36px);
  display: grid;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

.floating-info h2 {
  margin-top: 3px;
  font-size: 1.35rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.info-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px;
}

.info-grid .wide {
  grid-column: 1 / -1;
}

dt {
  font-weight: 800;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.map-drawer {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 26px;
  z-index: 18;
  max-width: calc(100% - 52px);
}

.map-drawer .data-panel {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.map-drawer.compact {
  left: auto;
  width: min(420px, calc(100% - 52px));
}

.table-wrap,
.event-feed {
  max-height: 260px;
  overflow: auto;
}

.history-panel {
  overflow: hidden;
}

.history-header {
  align-items: center;
}

.history-header .eyebrow {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  color: #cbd5e1;
  padding: 0 9px;
}

.history-header .ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px 0;
}

.history-meta span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.history-map-link {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(0, 107, 255, 0.34);
  border-radius: 999px;
  background: rgba(0, 107, 255, 0.14);
  color: #e6f7ff;
  padding: 0 10px;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 850;
}

.history-header > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.history-controls {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1.2fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.history-current {
  min-height: 68px;
  display: grid;
  gap: 4px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  padding: 10px 12px;
}

.history-current span,
.history-current small {
  color: var(--muted);
  font-size: 0.8rem;
}

.history-current strong {
  font-size: 1rem;
}

.history-range input {
  min-height: 28px;
  padding: 0;
  accent-color: #f97316;
}

.history-range-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.history-range {
  gap: 8px;
  border: 1px solid rgba(0, 217, 255, 0.22);
  border-radius: 8px;
  background: rgba(7, 17, 31, 0.82);
  color: #94a3b8;
  padding: 9px;
  font-weight: 850;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(230, 247, 255, 0.04);
  backdrop-filter: blur(14px);
}

.history-range-title {
  width: fit-content;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 217, 255, 0.18);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.58);
  color: #94a3b8;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 900;
}

.history-range-labels small {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 217, 255, 0.16);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.52);
  color: #94a3b8;
  padding: 0 9px;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

td {
  overflow-wrap: anywhere;
}

.coord-button,
td a {
  color: var(--blue-dark);
  font-weight: 800;
}

.coord-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  text-decoration: underline;
}

.event-feed {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.event-item {
  display: grid;
  gap: 3px;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #f8fafc;
  padding: 9px 11px;
}

.event-item.pending {
  border-left-color: var(--amber);
}

.event-item.gateway {
  border-left-color: #475569;
}

.event-item.gateway.pacote_desconhecido,
.event-item.gateway.trafego_invalido,
.event-item.gateway.envio_api_rejeitado,
.event-item.gateway.envio_api_falhou {
  border-left-color: var(--red);
}

.event-item.gateway.envio_api_ok,
.event-item.gateway.pacote_decodificado {
  border-left-color: var(--green);
}

.event-item small {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.empty-state {
  color: var(--muted);
  padding: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.58);
  padding: 20px;
}

.approval-modal {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: 20px;
}

.approval-modal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.approval-modal header p:not(.eyebrow) {
  margin-top: 5px;
  color: var(--muted);
}

.danger-modal {
  border-top: 4px solid #dc2626;
}

.confirm-delete-button {
  min-height: 44px;
  width: 100%;
  color: #ffffff;
  background: #b91c1c;
}

.confirm-delete-button:hover {
  background: #991b1b;
}

.bottom-nav {
  display: none;
}

/* Dark tracking theme */
.app-notice,
.login-card,
.fleet-sidebar,
.data-panel,
.floating-info,
.approval-modal,
.vehicle-card,
.sidebar-summary,
.summary-metrics,
.summary-metrics div,
.tab-button,
.workspace-nav,
.map-summary-details div,
.history-current,
.inline-status,
.edit-toggle-button,
.map-layer-switch,
.map-control-button,
.event-item,
.info-grid div {
  border-color: rgba(0, 217, 255, 0.22);
  background: rgba(7, 17, 31, 0.82);
  color: #f8fafc;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(230, 247, 255, 0.04);
  backdrop-filter: blur(14px);
}

.login-screen,
.dashboard,
.dashboard[data-map-fullscreen="true"] .map-workspace {
  background:
    radial-gradient(circle at 18% 0%, rgba(0, 107, 255, 0.26), transparent 35%),
    radial-gradient(circle at 82% 12%, rgba(0, 217, 255, 0.16), transparent 32%),
    linear-gradient(135deg, #020617, #030712 48%, #07111f);
}

.top-nav {
  border-bottom: 1px solid rgba(0, 217, 255, 0.22);
  background: rgba(2, 6, 23, 0.88);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.38), 0 0 24px rgba(0, 217, 255, 0.1);
  backdrop-filter: blur(18px);
}

.map-card {
  border-color: rgba(0, 217, 255, 0.28);
  background: #020617;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5), 0 0 34px rgba(0, 217, 255, 0.16);
}

.leaflet-map {
  background: #020617;
}

.map-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(rgba(0, 217, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 217, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mix-blend-mode: screen;
  opacity: 0.32;
}

.map-controls,
.floating-info,
.map-drawer {
  z-index: 5;
}

.workspace-tab,
.tab-button {
  color: #94a3b8;
}

.workspace-tab.active,
.tab-button.active,
.map-layer-switch button.active {
  background: linear-gradient(135deg, #00d9ff, #006bff 60%, #071bff);
  color: #f8fafc;
  box-shadow: 0 0 20px rgba(0, 217, 255, 0.26);
}

.vehicle-card.selected {
  border-color: rgba(0, 217, 255, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 217, 255, 0.32), 0 0 26px rgba(0, 217, 255, 0.22);
}

.pending-card {
  border-style: solid;
  background: rgba(7, 17, 31, 0.7);
}

.speed-chip,
.badge,
.connection-pill {
  border: 1px solid rgba(0, 217, 255, 0.18);
  background: rgba(0, 217, 255, 0.12);
  color: #e6f7ff;
}

.badge.pending,
.badge.neutral {
  background: rgba(7, 27, 255, 0.18);
  color: #e6f7ff;
}

.vehicle-icon,
.vehicle-icon.pending {
  border: 1px solid rgba(0, 217, 255, 0.28);
  background: linear-gradient(135deg, #006bff, #071bff);
  box-shadow: 0 0 18px rgba(0, 217, 255, 0.2), inset 0 -8px 0 rgba(2, 6, 23, 0.24);
}

.vehicle-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 217, 255, 0.65));
}

.vehicle-icon.moving {
  background: linear-gradient(135deg, #00d9ff, #006bff);
}

.vehicle-icon.stopped {
  background: linear-gradient(135deg, #07111f, #071bff);
}

.vehicle-icon.offline {
  background: linear-gradient(135deg, #07111f, #334155);
}

.vehicle-state-mark {
  background: #39ff14;
  color: #020617;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.9);
}

.vehicle-icon.stopped .vehicle-state-mark {
  background: #fff200;
  color: #020617;
  box-shadow: 0 0 12px rgba(255, 242, 0, 0.9);
}

.vehicle-icon.offline .vehicle-state-mark {
  background: #ff1744;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.9);
}

.vehicle-map-marker {
  border-color: rgba(230, 247, 255, 0.9);
  background:
    radial-gradient(circle at 50% 38%, rgba(0, 217, 255, 0.22), transparent 35%),
    linear-gradient(145deg, #020617, #07111f);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46), 0 0 28px rgba(0, 217, 255, 0.28);
}

.vehicle-map-marker::before {
  background: rgba(0, 217, 255, 0.18);
}

.vehicle-map-marker.stopped::before {
  background: rgba(0, 107, 255, 0.16);
}

.vehicle-map-marker.offline::before {
  background: rgba(148, 163, 184, 0.12);
}

.map-car-logo {
  width: 37px;
  height: 37px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 217, 255, 0.8));
}

.vehicle-map-marker.stopped .map-car-logo {
  filter: drop-shadow(0 0 8px rgba(0, 107, 255, 0.7));
}

.vehicle-map-marker.offline .map-car-logo {
  opacity: 0.72;
  filter: grayscale(1) drop-shadow(0 0 6px rgba(148, 163, 184, 0.55));
}

.vehicle-map-marker.moving .map-car-shape {
  background: linear-gradient(135deg, #00d9ff, #006bff);
}

.vehicle-map-marker.stopped .map-car-shape {
  background: linear-gradient(135deg, #006bff, #071bff);
}

.vehicle-map-marker.offline .map-car-shape {
  background: linear-gradient(135deg, #334155, #07111f);
}

.vehicle-map-marker b {
  background: #39ff14;
  color: #020617;
  box-shadow: 0 0 16px rgba(57, 255, 20, 0.86);
}

.vehicle-map-marker.stopped b {
  background: #fff200;
  color: #020617;
  box-shadow: 0 0 16px rgba(255, 242, 0, 0.86);
}

.vehicle-map-marker.offline b {
  background: #ff1744;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(255, 23, 68, 0.86);
}

.vehicle-map-marker span,
.history-map-marker span {
  background: rgba(2, 6, 23, 0.92);
  color: #e6f7ff;
  border: 1px solid rgba(0, 217, 255, 0.22);
}

.history-map-marker {
  background: linear-gradient(135deg, #00d9ff, #071bff);
  box-shadow: 0 16px 42px rgba(0, 217, 255, 0.28);
}

.history-map-marker .map-car-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(230, 247, 255, 0.85));
}

.history-map-marker .map-car-shape {
  background: linear-gradient(135deg, #00d9ff, #006bff);
}

.history-map-marker .map-car-shape::before {
  background: #e6f7ff;
}

.history-meta span,
.history-map-link {
  border-color: rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.9);
  color: #cbd5e1;
}

.history-panel {
  background: rgba(2, 6, 23, 0.96);
}

.history-controls label,
.history-current strong,
.history-current span,
.history-current small,
.history-range-labels {
  color: #cbd5e1;
}

.history-current {
  border-color: rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.86);
}

.history-current span,
.history-current small,
.history-range-labels small {
  color: #94a3b8;
}

.history-range input {
  accent-color: #00d9ff;
}

.map-drawer .history-panel,
.history-panel {
  display: grid;
  gap: 14px;
  overflow: hidden;
  border: 1px solid rgba(0, 217, 255, 0.15);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(31, 41, 55, 0.96), rgba(17, 24, 39, 0.96)),
    #1f2937;
  color: #f8fafc;
  padding: 16px;
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(230, 247, 255, 0.04);
  backdrop-filter: blur(16px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.history-panel:hover {
  border-color: rgba(0, 217, 255, 0.34);
  box-shadow: 0 26px 68px rgba(0, 0, 0, 0.42), 0 0 28px rgba(0, 217, 255, 0.14);
}

.history-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.history-card-header > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.history-card-header .eyebrow {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 217, 255, 0.2);
  border-radius: 6px;
  background: rgba(0, 217, 255, 0.08);
  color: #00d9ff;
  padding: 0 9px;
  font-size: 0.68rem;
}

.history-card-header h2 {
  margin: 0;
  color: #f8fafc;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.history-card-header span {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 800;
}

.history-card-header .ghost-button {
  border-color: rgba(0, 217, 255, 0.22);
  background: linear-gradient(135deg, rgba(0, 217, 255, 0.16), rgba(0, 107, 255, 0.14));
  color: #e6f7ff;
  box-shadow: 0 0 18px rgba(0, 217, 255, 0.1);
}

.history-controls {
  grid-template-columns: minmax(170px, 0.8fr) minmax(220px, 1fr) minmax(280px, 1.35fr);
  align-items: stretch;
  border-bottom: 0;
  padding: 0;
}

.history-controls > label:not(.history-range),
.history-current,
.history-range {
  min-width: 0;
  border: 1px solid rgba(0, 217, 255, 0.15);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.76);
  color: #94a3b8;
  padding: 10px;
  box-shadow: inset 0 1px 0 rgba(230, 247, 255, 0.03);
}

.history-controls > label:not(.history-range) {
  display: grid;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.history-controls select {
  border-color: rgba(0, 217, 255, 0.2);
  background: rgba(2, 6, 23, 0.74);
  color: #f8fafc;
}

.history-current {
  min-height: 0;
}

.history-current span,
.history-current small {
  color: #94a3b8;
}

.history-current strong {
  color: #f8fafc;
}

.history-range {
  box-shadow: inset 0 1px 0 rgba(230, 247, 255, 0.03);
}

.history-range-title {
  border-color: rgba(0, 217, 255, 0.18);
  background: rgba(0, 217, 255, 0.08);
  color: #94a3b8;
}

.history-range input {
  height: 26px;
  accent-color: #00d9ff;
}

.history-range input::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 107, 255, 0.55), rgba(0, 217, 255, 0.9));
  box-shadow: 0 0 14px rgba(0, 217, 255, 0.24);
}

.history-range input::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 2px solid #e6f7ff;
  border-radius: 999px;
  background: #00d9ff;
  box-shadow: 0 0 18px rgba(0, 217, 255, 0.74);
}

.history-range input::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 107, 255, 0.55), rgba(0, 217, 255, 0.9));
}

.history-range input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid #e6f7ff;
  border-radius: 999px;
  background: #00d9ff;
  box-shadow: 0 0 18px rgba(0, 217, 255, 0.74);
}

.history-range-labels small {
  border-color: rgba(0, 217, 255, 0.14);
  background: rgba(2, 6, 23, 0.45);
  color: #94a3b8;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 0;
  padding: 0;
}

.history-meta span,
.history-map-link {
  border-color: rgba(0, 217, 255, 0.14);
  background: rgba(2, 6, 23, 0.5);
  color: #cbd5e1;
}

.history-map-link:hover {
  border-color: rgba(0, 217, 255, 0.34);
  background: rgba(0, 107, 255, 0.18);
  color: #e6f7ff;
}

.leaflet-control-zoom a,
.leaflet-control-zoom a:hover {
  border-color: rgba(0, 217, 255, 0.22);
  background: rgba(2, 6, 23, 0.86);
  color: #e6f7ff;
}

.map-drawer:has(.history-panel) {
  left: 18px;
  right: 18px;
  bottom: 18px;
  max-width: calc(100% - 36px);
  pointer-events: none;
}

.map-drawer:has(.history-panel) .history-panel {
  pointer-events: auto;
}

.map-drawer .history-panel.collapsed,
.history-panel.collapsed {
  width: min(980px, 100%);
  margin: 0 auto;
  gap: 10px;
  border-radius: 16px;
  padding: 12px;
}

.map-drawer .history-panel.expanded,
.history-panel.expanded {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.history-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.history-panel.collapsed .history-card-header {
  align-items: center;
}

.history-panel.collapsed .history-card-header h2 {
  font-size: 0.95rem;
}

.history-panel.collapsed .history-card-header span {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-panel.collapsed .history-controls {
  grid-template-columns: minmax(150px, 0.7fr) minmax(0, 2.2fr);
  gap: 10px;
}

.history-panel.collapsed .history-current {
  display: none;
}

.history-panel.collapsed .history-range {
  min-height: 78px;
}

.history-panel .history-range {
  border-color: rgba(0, 217, 255, 0.24);
  background:
    linear-gradient(135deg, rgba(2, 6, 23, 0.88), rgba(15, 23, 42, 0.82)),
    rgba(2, 6, 23, 0.82);
}

.history-panel .history-range-title {
  color: #e6f7ff;
}

.history-panel .history-range input {
  width: 100%;
  height: 34px;
  cursor: grab;
}

.history-panel .history-range input:active {
  cursor: grabbing;
}

.history-panel .history-range input::-webkit-slider-runnable-track {
  height: 9px;
}

.history-panel .history-range input::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border-width: 3px;
}

.history-panel .history-range input::-moz-range-track {
  height: 9px;
}

.history-panel .history-range input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-width: 3px;
}

@media (max-width: 1024px) {
  .map-workspace {
    grid-template-rows: auto minmax(560px, calc(100vh - 146px));
  }

  .map-card,
  .leaflet-map {
    min-height: 560px;
  }

}

@media (max-width: 768px) {
  h1 {
    font-size: 1.16rem;
  }

  .app-notice {
    top: 10px;
    left: 10px;
    right: 10px;
    width: auto;
  }

  .dashboard[data-mobile-tab="frota"] .sidebar-panel:not(.active),
  .dashboard[data-mobile-tab="aprovacao"] .sidebar-panel:not(.active) {
    display: none;
  }

  .top-nav {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    min-height: auto;
    padding: 10px 8px;
  }

  .nav-brand {
    width: 100%;
  }

  .nav-brand > div:last-child {
    min-width: 0;
  }

  .nav-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(44px, auto) minmax(44px, auto);
    justify-content: stretch;
    gap: 8px;
    width: 100%;
  }

  .nav-actions > * {
    min-width: 0;
  }

  .nav-actions .ghost-button,
  .nav-actions .danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 44px;
    padding: 0 11px;
  }

  .dashboard-grid {
    display: block;
    min-height: calc(100dvh - 116px);
    padding: 8px 8px calc(74px + env(safe-area-inset-bottom));
  }

  .fleet-sidebar {
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    max-height: none;
  }

  .map-workspace {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: calc(100dvh - 202px);
    gap: 8px;
  }

  .map-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    min-height: auto;
  }

  .workspace-nav {
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
  }

  .map-card,
  .leaflet-map {
    min-height: 0;
    height: clamp(420px, 60dvh, 620px);
  }

  .dashboard[data-mobile-tab="historico"] .map-workspace {
    min-height: auto;
  }

  .dashboard[data-mobile-tab="historico"] .map-card,
  .dashboard[data-mobile-tab="historico"] .leaflet-map {
    height: clamp(300px, 42dvh, 430px);
  }

  .map-drawer,
  .map-drawer.compact {
    left: 8px;
    right: 8px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
  }

  .dashboard[data-mobile-tab="historico"] .map-drawer {
    position: static;
    width: 100%;
    max-width: none;
  }

  .dashboard[data-mobile-tab="historico"] .floating-info {
    display: none;
  }

  .map-controls {
    top: 10px;
    right: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .map-summary-strip {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }

  .map-summary-toggle {
    grid-template-columns: minmax(0, 1fr) 10px auto 34px;
  }

  .map-summary-toggle > span:nth-of-type(4) {
    display: none;
  }

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

  .floating-info {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-width: none;
    max-height: 46%;
    overflow: auto;
    padding: 12px;
  }

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

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: 100%;
    max-width: 100%;
    display: grid;
    gap: 5px;
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 0;
    background: rgba(15, 23, 42, 0.94);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow);
  }

  .bottom-nav.admin {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .bottom-nav.user {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bottom-nav .tab-button {
    border-color: rgba(148, 163, 184, 0.25);
    background: transparent;
    color: #cbd5e1;
    padding: 0 6px;
    font-size: 0.76rem;
  }

  .bottom-nav .tab-button.active {
    background: var(--blue);
    color: #ffffff;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 22px;
  }

  .login-brand {
    flex-direction: column;
  }

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

  .connection-pill {
    grid-column: 1 / -1;
    justify-content: center;
    font-size: 0.82rem;
    padding: 0 10px;
    text-align: center;
    overflow-wrap: anywhere;
  }

  .vehicle-main {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 8px;
  }

  .vehicle-icon {
    width: 32px;
    height: 32px;
  }

  .speed-chip,
  .vehicle-main .badge {
    grid-column: 2;
    justify-self: start;
    white-space: normal;
  }

  .vehicle-details {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions .ghost-button,
  .nav-actions .danger-button {
    width: 100%;
    min-height: 38px;
    padding: 0 8px;
    font-size: 0.82rem;
  }

  .map-toolbar h1 {
    font-size: 1.12rem;
  }

  .workspace-tab {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.8rem;
  }

  .history-header {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .history-header .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .history-meta {
    padding: 10px 12px 0;
  }

  .history-meta span {
    width: 100%;
    justify-content: center;
  }

  .map-workspace {
    min-height: calc(100dvh - 228px);
  }

  .map-card,
  .leaflet-map {
    height: clamp(420px, 58dvh, 560px);
  }

  .dashboard[data-mobile-tab="historico"] .map-workspace {
    min-height: auto;
  }

  .dashboard[data-mobile-tab="historico"] .map-card,
  .dashboard[data-mobile-tab="historico"] .leaflet-map {
    height: clamp(280px, 40dvh, 400px);
  }

  .map-controls {
    left: 10px;
    right: 10px;
    justify-content: center;
  }

  .info-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .map-summary-details {
    grid-template-columns: 1fr;
  }

  .floating-info h2 {
    font-size: 1rem;
  }

  .info-grid div {
    padding: 7px;
  }

  dt {
    font-size: 0.72rem;
  }

  dd {
    font-size: 0.78rem;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }

  .table-wrap td {
    border-bottom: 0;
    padding: 4px 0;
  }

  .bottom-nav {
    gap: 5px;
    padding: 7px 7px calc(7px + env(safe-area-inset-bottom));
  }

  .bottom-nav .tab-button {
    min-height: 38px;
    padding: 0 4px;
    font-size: 0.7rem;
  }
}

@media (max-width: 768px) {
  .history-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .history-card-header .ghost-button {
    width: 100%;
    justify-content: center;
  }

  .map-drawer .history-panel,
  .history-panel {
    border-radius: 16px;
    padding: 12px;
  }
}

@media (max-width: 980px) {
  .dashboard[data-mobile-tab="historico"] .map-card,
  .dashboard[data-mobile-tab="historico"] .leaflet-map {
    height: clamp(430px, 64dvh, 680px);
  }

  .dashboard[data-mobile-tab="historico"] .map-drawer:has(.history-panel) {
    position: static;
    width: 100%;
    max-width: none;
    pointer-events: auto;
  }

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

  .history-panel.collapsed .history-current {
    display: none;
  }

  .history-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-actions .ghost-button {
    width: auto;
    min-width: 0;
    justify-content: center;
  }

  .history-panel.collapsed .history-card-header span {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .history-panel.collapsed .history-card-header {
    gap: 8px;
  }

  .history-panel.collapsed .history-vehicle-select {
    padding: 8px;
  }

  .history-panel.collapsed .history-range {
    min-height: 86px;
    padding: 10px;
  }

  .history-panel .history-range input {
    height: 38px;
  }

  .history-range-labels small {
    padding: 0 7px;
  }
}

.map-summary-strip {
  left: auto;
  right: auto;
  bottom: auto;
}

.map-summary-strip dd {
  color: #f8fafc;
}

@media (max-width: 768px) {
  .map-summary-strip {
    width: 100%;
  }

  .map-summary-toggle {
    grid-template-columns: minmax(0, 1fr) 10px auto 34px;
  }

  .map-summary-toggle > span:nth-of-type(4) {
    display: none;
  }
}
