:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #eef3ff;
  background: #07111b;
  --surface: rgba(12, 21, 38, 0.92);
  --surface-strong: rgba(14, 28, 55, 0.96);
  --border: rgba(255, 255, 255, 0.08);
  --accent: #4a90ff;
  --accent-soft: rgba(74, 144, 255, 0.14);
  --muted: #96a8c4;
  --text: #eef3ff;
  --shadow: 0 32px 90px rgba(3, 9, 24, 0.4);
  --danger: #ff8b8b;
  --success: #8ef1bd;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background-color: #07111b;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(74, 144, 255, 0.16), transparent 18%),
    radial-gradient(circle at 80% 5%, rgba(0, 201, 255, 0.12), transparent 16%),
    radial-gradient(circle at 45% 80%, rgba(255, 255, 255, 0.06), transparent 12%),
    linear-gradient(135deg, #08101d 0%, #07111b 28%, #0f1b30 100%);
  color: var(--text);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 56px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 46px);
  pointer-events: none;
  z-index: 0;
}

.page-background {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.45;
  background: radial-gradient(circle at top right, rgba(74, 144, 255, 0.12), transparent 22%),
    radial-gradient(circle at left center, rgba(0, 201, 255, 0.08), transparent 20%),
    linear-gradient(180deg, transparent 0%, rgba(8, 17, 32, 0.85) 30%, rgba(4, 10, 20, 0.92) 100%);
}

.page,
.page-header {
  position: relative;
  z-index: 1;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 24px 32px 0;
}

.brand-link,
.top-nav a {
  color: #eef3ff;
  text-decoration: none;
}

.settings-cog {
  color: #eef3ff;
  text-decoration: none;
  font-size: 1.45rem;
  line-height: 1;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.settings-cog:hover {
  color: var(--accent);
  border-color: rgba(74, 144, 255, 0.55);
}

.brand-link {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.top-nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.top-nav a:hover {
  color: var(--accent);
}

.auth-panel,
.content-panel {
  width: min(760px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 36px;
}

.content-panel.fullwidth {
  width: min(1120px, 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(74, 144, 255, 0.9), rgba(0, 201, 255, 0.7));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-subtitle {
  display: block;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.auth-panel h1,
.panel-head h1,
.admin-card h2 {
  margin: 0;
  font-size: clamp(2.1rem, 2.2vw, 3rem);
}

.admin-card h2 {
  font-size: 1.5rem;
}

.auth-intro,
.section-copy {
  margin: 0 0 26px;
  color: var(--muted);
  line-height: 1.8;
}

.field {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.field label,
.permission-grid legend {
  font-size: 0.95rem;
  color: #cdd7ed;
}

.field input[type='email'],
.field input[type='password'],
.field input[type='url'] {
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.field input[type='email']::placeholder,
.field input[type='password']::placeholder,
.field input[type='url']::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.field input[type='time'],
.field select {
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.field.remember {
  margin-top: -4px;
}

.field.remember label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #aac3eb;
}

.field.remember input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.btn {
  border: none;
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
}

.btn.primary {
  width: 100%;
  background: linear-gradient(135deg, #4a90ff, #28c1ff);
  box-shadow: 0 12px 30px rgba(35, 125, 255, 0.32);
}

.btn.secondary,
.btn.nav-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn.compact,
.btn.nav-button {
  width: auto;
  padding: 12px 16px;
  box-shadow: none;
}

.message,
.map-note,
.map-status {
  margin-top: 20px;
  font-size: 0.96rem;
  color: var(--muted);
  line-height: 1.65;
}

.message {
  min-height: 28px;
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--danger);
}

.placeholder-card,
.admin-card,
.user-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  padding: 24px;
  border-radius: 22px;
}

.map-fallback-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
  padding: 16px;
}

.map-fallback-iframe {
  width: 100%;
  min-height: 520px;
  border: 0;
  border-radius: 16px;
}

.map-shell {
  height: 480px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(12, 25, 45, 0.95), rgba(7, 15, 28, 0.98));
  margin-top: 22px;
  --vehicle-flag-scale: 0.3;
  --vehicle-flag-opacity: 0.18;
}

.tracking-panel {
  width: min(1480px, 100%);
}

.tracking-head {
  align-items: flex-end;
}

.tracking-copy {
  max-width: 760px;
}

.tracking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 10px;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  padding: 8px 10px 10px;
}

.tracking-map-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
}

.map-shell-tracking {
  min-height: 0;
  height: 100%;
  margin-top: 0;
  position: relative;
  border-radius: 14px;
}

.map-shell-tracking #map {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.map-canvas,
.map-shell-tracking .mapboxgl-canvas-container,
.map-shell-tracking .mapboxgl-canvas {
  width: 100% !important;
  height: 100% !important;
}

.tracking-sidebar {
  min-height: 0;
  overflow: auto;
}

.tracking-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 10;
  margin-top: 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(7, 17, 31, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #cdd7ed;
  font-size: 0.9rem;
  user-select: none;
}

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

.toggle-visual {
  position: relative;
  width: 48px;
  height: 28px;
  flex: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.toggle-visual::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f7fbff, #c7d7ea);
  transition: transform 0.18s ease;
}

.toggle-switch input:checked + .toggle-visual {
  background: linear-gradient(135deg, rgba(74, 144, 255, 0.92), rgba(40, 193, 255, 0.86));
  border-color: rgba(124, 211, 255, 0.7);
}

.toggle-switch input:checked + .toggle-visual::after {
  transform: translateX(20px);
}

.tracking-sidebar-empty,
.sidebar-note {
  color: var(--muted);
  line-height: 1.6;
}

.tracking-sidebar-panel {
  display: grid;
  gap: 10px;
}

.sidebar-pill,
.service-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #eef3ff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.punctuality-pill.green {
  background: rgba(59, 130, 246, 0.16);
  border-color: rgba(74, 222, 128, 0.35);
  color: #b7f7c6;
}

.punctuality-pill.yellow {
  background: rgba(250, 204, 21, 0.16);
  border-color: rgba(250, 204, 21, 0.35);
  color: #fde68a;
}

.punctuality-pill.red {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.punctuality-pill.neutral {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #eef3ff;
}

.tracking-detail-list,
.service-detail-list {
  margin: 0;
  display: grid;
  gap: 10px;
}

.tracking-detail-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.tracking-detail-list div,
.service-detail-list div {
  display: grid;
  gap: 4px;
}

.tracking-detail-list dt,
.service-detail-list dt {
  color: var(--muted);
  font-size: 0.8rem;
}

.label-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
  flex: none;
}

.icon-route {
  color: #8fc5ff;
}

.icon-fleet {
  color: #9de8ff;
}

.icon-direction {
  color: #ffd38f;
}

.icon-destination {
  color: #8ef1bd;
}

.icon-board {
  color: #c8d7ff;
}

.icon-journey {
  color: #ffcf9a;
}

.icon-stop {
  color: #f4b6ff;
}

.icon-time {
  color: #9fd8ff;
}

.tracking-detail-list dd,
.service-detail-list dd {
  margin: 0;
  color: #eef3ff;
  font-size: 0.92rem;
}

.map-toolbar {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 16px;
}

.map-route-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #cdd7ed;
  font-size: 0.9rem;
}

.map-route-check input {
  accent-color: var(--accent);
}

.map-route-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  min-height: 22px;
}

.map-meta {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(7, 17, 31, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.map-status {
  min-height: 24px;
  margin-left: auto;
}

.vehicle-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.vehicle-flag {
  max-width: 320px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(7, 17, 27, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 28px rgba(3, 9, 24, 0.38);
  color: #eef3ff;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  transform: scale(var(--vehicle-flag-scale));
  transform-origin: bottom center;
  opacity: var(--vehicle-flag-opacity);
  transition: transform 0.18s ease, opacity 0.18s ease;
  pointer-events: none;
}

.vehicle-flag-line {
  display: block;
}

.vehicle-flag-line + .vehicle-flag-line {
  margin-top: 2px;
}

.vehicle-direction-badge {
  font-weight: 800;
  margin-left: 6px;
}

.vehicle-direction-badge.inbound {
  color: #ff5f62;
}

.vehicle-direction-badge.outbound {
  color: #66eabe;
}

.vehicle-direction-badge.unknown {
  color: #ffd27d;
}

.vehicle-flag .service-line {
  font-size: 0.78rem;
  font-weight: 700;
}

.vehicle-flag .board-line {
  color: #b6c8e9;
}

.vehicle-flag[data-direction='inbound'] {
  border-color: rgba(102, 234, 190, 0.58);
}

.vehicle-flag[data-direction='outbound'] {
  border-color: rgba(255, 168, 104, 0.58);
}

.vehicle-pin {
  min-width: 46px;
  min-height: 42px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #4a90ff, #28c1ff);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(35, 125, 255, 0.35);
}

.hours-layout {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: 22px;
  align-items: start;
}

.hours-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 22px;
  padding: 24px;
}

.hours-card h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
}

.hours-fields {
  display: grid;
  gap: 14px;
}

.hours-card.full-span {
  grid-column: 1 / -1;
}

.hours-table-wrap {
  overflow-x: auto;
}

.hours-table {
  width: 100%;
  border-collapse: collapse;
}

.hours-table th,
.hours-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.segment-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hours-table th {
  color: #cdd7ed;
  font-weight: 600;
}

.hours-empty {
  text-align: center;
  color: var(--muted);
}

.hours-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.hours-metric {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.hours-metric p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.hours-metric strong {
  font-size: 1.1rem;
}

.hours-alerts {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.hours-alert {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.hours-alert.ok {
  background: rgba(78, 184, 122, 0.16);
  border: 1px solid rgba(109, 231, 157, 0.4);
  color: #b8f5cf;
}

.hours-alert.breach {
  background: rgba(217, 73, 73, 0.18);
  border: 1px solid rgba(255, 136, 136, 0.48);
  color: #ffd2d2;
}

.overview-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.025);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.overview-card {
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.overview-card h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
}

.overview-status {
  margin: 0;
  font-size: 1rem;
  color: #eaf2ff;
  font-weight: 600;
}

.overview-window,
.overview-location {
  margin: 8px 0 0;
  color: var(--muted);
}

.overview-upcoming {
  margin-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

.upcoming-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.upcoming-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #cdd7ed;
  font-size: 0.9rem;
  margin: 0 6px 8px 0;
}

.upcoming-checkbox input {
  accent-color: var(--accent);
}

.upcoming-controls[hidden],
#upcoming-period[hidden],
#upcoming-message[hidden],
#upcoming-list[hidden] {
  display: none !important;
}

.compact-field {
  margin: 0;
}

.compact-field span {
  display: block;
  margin-bottom: 6px;
  color: #cdd7ed;
  font-size: 0.85rem;
}

.upcoming-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.upcoming-item h3 {
  font-size: 0.96rem;
}

.overview-page {
  width: min(1480px, 100%);
}

.overview-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 16px;
  flex-wrap: wrap;
}

.overview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.overview-summary-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.overview-summary-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.overview-summary-card strong {
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.service-overview-list {
  display: grid;
  gap: 16px;
}

.service-group {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.service-group-head,
.service-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.service-group-head h2,
.service-card-route {
  margin: 0;
}

.service-group-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.service-group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #d9edff;
  cursor: pointer;
}

.service-group-toggle:hover {
  border-color: rgba(124, 211, 255, 0.7);
  background: rgba(74, 144, 255, 0.16);
}

.service-group-toggle .chevron {
  display: inline-block;
  transition: transform 0.2s ease;
}

.service-group.is-collapsed .service-group-toggle .chevron {
  transform: rotate(-90deg);
}

.service-group.is-collapsed .service-group-list {
  display: none;
}

.service-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 17, 31, 0.58);
}

.service-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1rem;
}

.service-card .sidebar-pill {
  white-space: nowrap;
}

.service-card .service-detail-list {
  margin-top: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.service-card-route {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.service-count-pill {
  color: #aee9ff;
}

.sidebar-note {
  margin: 0;
  font-size: 0.86rem;
}

.vehicle-marker.is-selected .vehicle-pin {
  box-shadow: 0 0 0 4px rgba(95, 193, 255, 0.2), 0 18px 30px rgba(5, 13, 25, 0.45);
}

.vehicle-marker.is-selected .vehicle-flag {
  border-color: rgba(95, 193, 255, 0.8);
  background: rgba(7, 17, 31, 0.98);
}

.vehicle-pin,
.vehicle-flag {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.calendar-fullpage {
  margin: -32px;
  min-height: calc(100vh - 88px);
  display: flex;
  flex-direction: column;
  background: rgba(5, 12, 24, 0.92);
  border-radius: 0 0 28px 28px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(3, 9, 24, 0.35);
}

.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(3, 9, 24, 0.95);
}

.calendar-toolbar h1 {
  margin: 0;
  font-size: 1.35rem;
}

.calendar-toolbar-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.calendar-view-shell {
  flex: 1;
  min-height: 0;
  background: #fff;
}

.calendar-page-frame {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 160px);
  border: 0;
  background: #fff;
}

@keyframes journeyFlashRed {
  0%,
  100% {
    filter: none;
  }
  50% {
    filter: brightness(1.2);
  }
}

.vehicle-marker.is-flashing-journey .vehicle-pin {
  background: linear-gradient(135deg, #ff4b4b, #ff7b7b);
  box-shadow: 0 0 0 3px rgba(255, 76, 76, 0.28), 0 14px 28px rgba(255, 76, 76, 0.42);
  animation: journeyFlashRed 1.1s ease-in-out infinite;
}

.vehicle-marker.is-flashing-journey .vehicle-flag {
  border-color: rgba(255, 76, 76, 0.85);
  box-shadow: 0 0 0 2px rgba(255, 76, 76, 0.22), 0 14px 28px rgba(255, 76, 76, 0.28);
  animation: journeyFlashRed 1.1s ease-in-out infinite;
}

#tracking-selected-journey.journey-flash {
  color: #ff6363;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 82, 82, 0.45);
  animation: journeyFlashRed 1.1s ease-in-out infinite;
}

body.driving-hours-active {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

body.tracking-active {
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

body.tracking-active .page {
  min-height: 0;
}

body.tracking-active .shell {
  max-width: 100%;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
}

body.tracking-active .tracking-panel {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body.tracking-active .tracking-head {
  display: none;
}

body.tracking-active .panel-head {
  margin-bottom: 0;
}

body.driving-hours-active .page {
  min-height: 0;
}

body.driving-hours-active .shell {
  height: 100%;
  padding-top: 14px;
  padding-bottom: 14px;
}

.compact-hours-panel {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  padding: 14px;
}

.compact-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.compact-copy {
  margin: 0;
  font-size: 0.9rem;
}

.compact-note {
  margin: 0;
  font-size: 0.84rem;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
}

.driver-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.driver-details-grid .field {
  margin-bottom: 0;
}

.driver-details-grid input {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}

.hours-layout {
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  gap: 14px;
  min-height: 0;
}

.hours-column {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
}

.entry-card {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  min-height: 0;
}

.compact-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.compact-fields .field {
  margin-bottom: 0;
}

.compact-fields .field label {
  font-size: 0.82rem;
}

.compact-fields .btn.compact {
  margin-bottom: 0;
  height: 48px;
}

.tight-scroll {
  max-height: 250px;
  overflow: auto;
}

.snapshot-save-row {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.saved-snapshots-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.saved-search-row {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.saved-search-label {
  font-size: 0.82rem;
  color: #cdd7ed;
}

.saved-search-input {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}

.saved-search-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.saved-snapshots-list {
  margin-top: 10px;
  max-height: 150px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.saved-item {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
}

.saved-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
}

.saved-head span,
.saved-head time {
  color: var(--muted);
}

.saved-summary-line {
  margin: 8px 0 4px;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.saved-status {
  margin: 0;
  font-weight: 700;
  font-size: 0.84rem;
}

.saved-status.compliant,
.saved-item.compliant .saved-status {
  color: #aef4cd;
}

.saved-status.breached,
.saved-item.breached .saved-status {
  color: #ffc0c0;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 24px;
  align-items: start;
}

.permission-grid {
  display: grid;
  gap: 12px;
  margin: 0 0 20px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
}

.permission-option,
.permission-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #d9e4fb;
}

.permission-option input,
.permission-toggle input {
  accent-color: var(--accent);
}

.section-row,
.user-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.user-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.users-list {
  display: grid;
  gap: 18px;
}

.gtfs-upload-card {
  margin-top: 20px;
}

.gtfs-upload-form {
  display: grid;
  gap: 12px;
}

.gtfs-upload-form input[type='file'] {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
}

.user-card-head h3,
.user-card-head p {
  margin: 0;
}

.user-meta {
  color: var(--muted);
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(74, 144, 255, 0.14);
  color: #cfe0ff;
  font-size: 0.9rem;
}

.btn.danger {
  background: rgba(220, 53, 69, 0.18);
  color: #ffdce1;
  border-color: rgba(220, 53, 69, 0.35);
}

.btn.danger:hover {
  background: rgba(220, 53, 69, 0.28);
}

.permission-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px 20px;
  margin-top: 18px;
}

.toggle {
  position: relative;
  width: 52px;
  height: 30px;
  display: inline-flex;
  align-items: center;
}

.toggle input {
  position: absolute;
  opacity: 0;
}

.toggle span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
}

.toggle span::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}

.toggle input:checked + span {
  background: linear-gradient(135deg, #4a90ff, #28c1ff);
}

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

.toggle input:disabled + span {
  opacity: 0.5;
}

@media (max-width: 920px) {
  .hours-layout,
  .admin-layout,
  .permission-list,
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .tracking-layout,
  .overview-summary,
  .service-card .service-detail-list,
  .tracking-detail-list {
    grid-template-columns: 1fr;
  }

  .tracking-layout {
    min-height: auto;
  }

  body.tracking-active {
    overflow: auto;
  }

  .map-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .service-group-head,
  .service-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .compact-hours-panel {
    height: auto;
    max-height: none;
    overflow: visible;
    grid-template-rows: auto;
  }

  body.driving-hours-active {
    overflow: auto;
  }

  .driver-details-grid,
  .compact-fields,
  .saved-head {
    grid-template-columns: 1fr;
  }

  .hours-column {
    grid-template-rows: auto;
  }

  .tight-scroll,
  .saved-snapshots-list {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .page-header,
  .shell {
    padding: 18px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
  }

  .top-nav,
  .section-row,
  .user-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-panel,
  .content-panel {
    padding: 28px 22px;
    border-radius: 22px;
  }

  .tracking-sidebar,
  .service-group,
  .overview-summary-card {
    border-radius: 18px;
  }
}