:root {
  --app-bg: linear-gradient(180deg, #f6f8ff 0%, #eef3fb 48%, #e8eef7 100%);
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.97);
  --surface-muted: #eef2f8;
  --surface-accent: #e7f0ff;
  --text-strong: #18212f;
  --text-muted: #627089;
  --outline-soft: rgba(71, 85, 105, 0.12);
  --outline-strong: rgba(65, 95, 145, 0.18);
  --brand: #0b57d0;
  --brand-soft: #d7e6ff;
  --brand-strong: #083b93;
  --success-soft: #dff4e8;
  --warning-soft: #fff1cf;
  --danger-soft: #fde0df;
  --shadow-soft: 0 10px 30px rgba(28, 45, 80, 0.08);
  --shadow-strong: 0 18px 36px rgba(28, 45, 80, 0.12);
  --radius-card: 1.75rem;
  --radius-pill: 999px;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text-strong);
  background: var(--app-bg);
  font-family: "Manrope", "Segoe UI", sans-serif;
  padding-bottom: 6.5rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

.app-shell {
  max-width: 820px;
}

.app-header {
  padding: 0.4rem 0 0.35rem;
}

.app-title {
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-strong);
}

.app-subtitle {
  color: var(--text-muted);
}

.card {
  border: 1px solid var(--outline-soft) !important;
  border-radius: var(--radius-card) !important;
  background: var(--surface);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft) !important;
  overflow: hidden;
}

.card-body {
  position: relative;
  padding: 1.15rem 1.1rem;
}

.card .text-muted,
.small.text-muted,
.journey-stat {
  color: var(--text-muted) !important;
}

.journey-stat {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge {
  border-radius: var(--radius-pill);
  font-weight: 700;
  padding: 0.45rem 0.75rem;
  letter-spacing: 0.01em;
}

.text-bg-primary {
  background: var(--brand-soft) !important;
  color: var(--brand-strong) !important;
}

.text-bg-success {
  background: var(--success-soft) !important;
  color: #0f6a3b !important;
}

.text-bg-warning {
  background: var(--warning-soft) !important;
  color: #8a5a00 !important;
}

.text-bg-secondary {
  background: #e8edf5 !important;
  color: #43536d !important;
}

.text-bg-dark {
  background: #dce7f8 !important;
  color: #21324d !important;
}

.btn {
  border-radius: 1.25rem;
  font-weight: 700;
  padding: 0.8rem 1rem;
  border-width: 0;
  box-shadow: none;
}

.btn-lg {
  padding: 0.95rem 1.15rem;
}

.btn-primary,
.btn-success {
  background: linear-gradient(180deg, #2c6be7 0%, #0b57d0 100%);
  color: #fff;
}

.btn:disabled {
  opacity: 0.78;
}

.btn-outline-secondary {
  border: 1px solid var(--outline-strong);
  background: var(--surface-strong);
  color: var(--text-strong);
}

.form-control,
.form-select,
.input-group-text,
textarea {
  border-radius: 1.15rem !important;
  border: 1px solid var(--outline-soft) !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: var(--text-strong) !important;
  padding: 0.85rem 1rem;
  box-shadow: none !important;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  border-color: rgba(11, 87, 208, 0.35) !important;
  box-shadow: 0 0 0 0.25rem rgba(11, 87, 208, 0.12) !important;
}

.input-group > .btn {
  border-radius: 1.15rem !important;
}

.form-check-input {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.1rem;
}

.duty-entry-card,
.entered-duty-line {
  border: 1px solid var(--outline-soft);
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, 0.64);
  padding: 1rem;
}

.progress {
  height: 0.95rem;
  border-radius: var(--radius-pill);
  background: #dce6f5;
  overflow: hidden;
}

.progress-bar {
  border-radius: inherit;
  background: linear-gradient(90deg, #0b57d0, #3c82f6);
  font-size: 0.72rem;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0.85rem;
  transform: translateX(-50%);
  width: min(calc(100% - 1.25rem), 760px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  padding: 0.5rem;
  border-radius: 1.75rem;
  background: rgba(248, 250, 255, 0.9);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(111, 132, 170, 0.18);
  box-shadow: 0 18px 48px rgba(28, 45, 80, 0.18);
  z-index: 1030;
}

.bottom-nav .nav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1.3rem;
  padding: 0.95rem 0.6rem;
  text-align: center;
  color: var(--text-muted);
  font-weight: 700;
  line-height: 1.1;
  min-height: 3.35rem;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.bottom-nav .nav-link.active {
  background: linear-gradient(180deg, #dbe8ff 0%, #cfe0ff 100%);
  color: var(--brand-strong);
  transform: translateY(-1px);
}

.map-card {
  position: relative;
  isolation: isolate;
  z-index: 0;
  height: 300px;
  width: 100%;
  border-radius: 1.45rem;
  overflow: hidden;
  border: 1px solid rgba(120, 148, 196, 0.15);
  background: linear-gradient(145deg, #d8e7ff 0%, #edf4ff 100%);
}

.map-card .leaflet-pane,
.map-card .leaflet-top,
.map-card .leaflet-bottom {
  z-index: auto;
}

.map-card .leaflet-container,
.map-card.leaflet-container {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(145deg, #d8e7ff 0%, #edf4ff 100%);
}

.map-card--page {
  position: fixed;
  inset: 0;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
  border: 0;
  z-index: 0;
}

.vehicle-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-pill);
  background: #eaf2ff;
  color: var(--brand-strong);
  border: 1px solid rgba(11, 87, 208, 0.12);
  font-size: 0.92rem;
}

.vehicle-chip__label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #5872a2;
}

.vehicle-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.vehicle-detail-tile {
  padding: 0.85rem 0.95rem;
  border-radius: 1.2rem;
  background: rgba(235, 241, 252, 0.88);
  border: 1px solid rgba(95, 122, 170, 0.12);
}

.vehicle-photo-link {
  display: block;
  border-radius: 1.35rem;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.vehicle-photo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #dce7f8;
}

.playback-date-list {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.playback-date-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 6.8rem;
  padding: 0.8rem 0.95rem;
  border-radius: 1.15rem;
  background: rgba(235, 241, 252, 0.88);
  border: 1px solid rgba(95, 122, 170, 0.12);
  color: inherit;
  text-decoration: none;
}

.playback-date-pill.active {
  background: #0b57d0;
  color: #fff;
}

.playback-date-pill small {
  opacity: 0.82;
}

.playback-segment-button {
  width: 100%;
  border: 1px solid var(--outline-soft);
  background: rgba(255, 255, 255, 0.68);
}

.playback-segment-button.active {
  border-color: rgba(11, 87, 208, 0.32);
  background: linear-gradient(180deg, #dbe8ff 0%, #edf4ff 100%);
}

.map-page-body {
  overflow: hidden;
  padding-bottom: 0;
}

.map-page-body .app-shell {
  max-width: none;
}

.map-page-main.map-page-main {
  max-width: none;
  width: 100%;
  min-height: 100vh;
  padding: 0 !important;
}

.map-page-body .app-header {
  display: none;
}

.map-page-body #map-live {
  min-height: 100vh;
}

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

.map-overlay-card {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: min(80vw, 26rem);
  z-index: 1010;
  padding: 1rem 1.05rem;
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(111, 132, 170, 0.18);
  box-shadow: var(--shadow-soft);
}

@media (max-width: 420px) {
  .bottom-nav .nav-link {
    padding: 0.9rem 0.2rem;
    font-size: 0.9rem;
  }

  .map-overlay-card {
    top: 0.8rem;
    right: 0.8rem;
    width: min(80vw, 22rem);
  }
}

.vehicle-marker {
  background: transparent;
  border: 0;
}

.vehicle-marker__bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #0b57d0 0%, #0847ac 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(11, 87, 208, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.92);
}

.vehicle-marker__icon {
  font-size: 0.7rem;
  line-height: 1;
}

.vehicle-marker__label {
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.map-popup {
  min-width: 7rem;
}

.map-popup__meta {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.stop-pill,
.timeline-card {
  border-radius: 1.3rem;
  padding: 0.95rem 1rem;
  background: var(--surface-muted);
  border: 1px solid rgba(116, 131, 156, 0.08);
}

.stop-pill.completed {
  background: #e8edf4;
}

.stop-pill.current {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 800;
}

.stop-pill.future {
  background: #f4f7fb;
}

.timeline-card.active {
  border: 1px solid rgba(11, 87, 208, 0.2);
  background: linear-gradient(180deg, #edf4ff 0%, #e6f0ff 100%);
  box-shadow: inset 0 0 0 1px rgba(11, 87, 208, 0.08);
}

.border.rounded-4.p-3 {
  border-color: rgba(111, 132, 170, 0.18) !important;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 1.3rem !important;
}

.table,
table {
  --bs-table-bg: transparent;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-strong);
  box-shadow: var(--shadow-soft);
}

.loading-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.loading-button__spinner {
  display: none;
}

.loading-button.is-loading .loading-button__spinner {
  display: inline-block;
}

@media (min-width: 768px) {
  .card-body {
    padding: 1.35rem 1.4rem;
  }

  .map-card {
    height: 340px;
  }
}
