/* ═══════════════════════════════════════════════════════════════════════════
   RMD FLEET THEME
   Typography: system fonts (no external font downloads)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --font-display: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;

  /* Timing functions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHT THEME (winter)
   ═══════════════════════════════════════════════════════════════════════════ */

[data-theme="winter"] {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-on-primary: #ffffff;
  --color-secondary: #64748b;
  --color-secondary-hover: #475569;
  --color-on-secondary: #ffffff;
  --color-accent: #059669;
  --color-accent-hover: #047857;
  --color-on-accent: #ffffff;
  --color-neutral: #243247;
  --color-neutral-hover: #1e293b;
  --color-on-neutral: #ffffff;
  --color-surface: #ffffff;
  --color-background: #f5f7fa;
  --color-border: #e2e8f0;
  --color-text: #101827;
  --color-info: #2563eb;
  --color-success: #059669;
  --color-warning: #b7790a;
  --color-error: #dc2626;
  --p: 0.546 0.245 262.881;
  --pf: 0.488 0.243 264.376;
  --pc: 1 0 0;
  --s: 0.554 0.046 257.417;
  --sc: 1 0 0;
  --a: 0.596 0.145 163.225;
  --ac: 1 0 0;
  --n: 0.279 0.041 260.031;
  --nc: 0.968 0.007 247.896;
  --b1: 1 0 0;
  --b2: 0.978 0.005 247.896;
  --b3: 0.929 0.013 255.508;
  --bc: 0.208 0.042 265.755;
  --in: 0.546 0.245 262.881;
  --inc: 1 0 0;
  --su: 0.596 0.145 163.225;
  --suc: 1 0 0;
  --wa: 0.828 0.189 84.429;
  --wac: 0.414 0.112 45.904;
  --er: 0.577 0.245 27.325;
  --erc: 1 0 0;
  --card-border: var(--color-border);
  --surface-glass: var(--color-surface);
  --muted: #74839a;
  color-scheme: light;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DARK THEME (business)
   ═══════════════════════════════════════════════════════════════════════════ */

[data-theme="business"] {
  --color-primary: #60a5fa;
  --color-primary-hover: #93c5fd;
  --color-on-primary: #101827;
  --color-secondary: #94a3b8;
  --color-secondary-hover: #cbd5e1;
  --color-on-secondary: #101827;
  --color-accent: #34d399;
  --color-accent-hover: #6ee7b7;
  --color-on-accent: #101827;
  --color-neutral: #243247;
  --color-neutral-hover: #334155;
  --color-on-neutral: #f1f5f9;
  --color-surface: #192334;
  --color-background: #111827;
  --color-border: #2d3b50;
  --color-text: #e5edf7;
  --color-info: #60a5fa;
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-error: #f87171;
  --p: 0.707 0.165 254.624;
  --pf: 0.488 0.243 264.376;
  --pc: 0.208 0.042 265.755;
  --s: 0.704 0.04 256.788;
  --sc: 0.208 0.042 265.755;
  --a: 0.765 0.177 163.223;
  --ac: 0.208 0.042 265.755;
  --n: 0.279 0.041 260.031;
  --nc: 0.968 0.007 247.896;
  --b1: 0.255 0.035 260;
  --b2: 0.208 0.042 265.755;
  --b3: 0.35 0.04 260;
  --bc: 0.968 0.007 247.896;
  --in: 0.546 0.245 262.881;
  --inc: 1 0 0;
  --su: 0.765 0.177 163.223;
  --suc: 1 0 0;
  --wa: 0.828 0.189 84.429;
  --wac: 0.414 0.112 45.904;
  --er: 0.704 0.191 22.216;
  --erc: 1 0 0;
  --card-border: var(--color-border);
  --surface-glass: var(--color-surface);
  --muted: #9baec6;
  color-scheme: dark;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  background: var(--color-background);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY SYSTEM
   ═══════════════════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6,
.card-title,
.stat-title,
.navbar-start a,
.btn,
.badge,
.tab {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

code, pre,
.font-mono {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

h1, .text-3xl {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

h2, .text-2xl {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h3, .text-xl {
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.page-shell {
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .page-shell {
    padding: 1.5rem;
    gap: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .page-shell {
    padding: 2rem 1.5rem;
    gap: 2rem;
  }
}

/* Dashboard hero grid */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: stretch;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SURFACE CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--color-surface);
  border: 1px solid var(--card-border);
  border-radius: 0.625rem;
  box-shadow: 0 1px 2px rgba(16, 24, 39, 0.04);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: none;
}


.card-body {
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .card-body {
    padding: 2rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATS - Data Display Components
   ═══════════════════════════════════════════════════════════════════════════ */

.stats {
  border-radius: 0.625rem;
  background: var(--color-surface);
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 2px rgba(16, 24, 39, 0.04);
  overflow: hidden;
}

.stat {
  position: relative;
  padding: 1.25rem 1.5rem;
  border-color: var(--card-border);
}

.stat::after {
  content: none;
}

.stat:last-child::after {
  display: none;
}

.stat-value {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-title {
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  opacity: 1;
  margin-bottom: 0.25rem;
}

.stat-desc {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.375rem;
}

.stat-figure {
  color: var(--color-primary);
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES - Status Indicators
   ═══════════════════════════════════════════════════════════════════════════ */

.badge {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid currentColor;
}

.badge-outline {
  background: transparent;
  border-color: var(--card-border);
}

.badge-lg {
  padding: 0.625rem 1.25rem;
  font-size: 0.8rem;
}

.badge-success {
  background: rgba(22, 163, 74, 0.15);
  border-color: var(--color-success);
  color: var(--color-success);
}

.badge-warning {
  background: rgba(217, 119, 6, 0.15);
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.badge-error {
  background: rgba(220, 38, 38, 0.15);
  border-color: var(--color-error);
  color: var(--color-error);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS - Interactive Elements
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 0.375rem;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  border-color: var(--card-border);
  color: var(--color-text);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 0.625rem;
}

.btn-circle {
  border-radius: 9999px;
  padding: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM CONTROLS
   ═══════════════════════════════════════════════════════════════════════════ */

.input,
.select,
.textarea {
  font-family: var(--font-body);
  background: var(--color-surface);
  border: 1px solid var(--card-border);
  border-radius: 0.625rem;
  color: var(--color-text);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.select option {
  background: var(--color-surface);
  color: var(--color-text);
}

.label-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--color-text);
  opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES - Data Grids
   ═══════════════════════════════════════════════════════════════════════════ */

.table {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  border-collapse: separate;
  border-spacing: 0;
}

.table thead th {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.035em;
  color: var(--muted);
  background: var(--color-background);
  border-bottom: 1px solid var(--card-border);
  padding: 0.875rem 1rem;
  white-space: nowrap;
}

.table tbody td {
  padding: 0.875rem 0.75rem;
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
}


.table-zebra tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="business"] .table-zebra tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

/* Sortable table headers */
.sortable-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem;
}

.sortable-table th.sortable::after {
  content: "";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  opacity: 0.3;
  border-top-color: currentColor;
  margin-top: 2px;
}

.sortable-table th.sortable::before {
  content: "";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  opacity: 0.3;
  border-bottom-color: currentColor;
  margin-top: -6px;
}

.sortable-table th[aria-sort="ascending"]::before,
.sortable-table th.sort-up::before {
  opacity: 1;
  border-bottom-color: var(--color-secondary);
}

.sortable-table th[aria-sort="descending"]::after,
.sortable-table th.sort-down::after {
  opacity: 1;
  border-top-color: var(--color-secondary);
}

.sortable-table th[data-sort-method="none"] {
  cursor: default;
}

.sortable-table th[data-sort-method="none"]::before,
.sortable-table th[data-sort-method="none"]::after {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */

.navbar {
  background: var(--color-background);
  border: none;
  box-shadow: none;
  min-height: 3.5rem;
  position: sticky;
}

.navbar::after {
  content: none;
}

@keyframes gradient-flow {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.navbar-start a {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-start a svg {
  color: var(--color-primary);
}

.menu a {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.625rem;
  padding: 0.625rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.menu a svg {
  width: 1.125rem;
  height: 1.125rem;
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Menu hover effects */
.menu a:hover {
  background: var(--color-border);
  color: var(--color-primary);
}

.menu a:hover svg {
  opacity: 1;
  transform: scale(1.1);
}

[data-theme="business"] .menu a:hover {
  background: rgba(34, 211, 238, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS & FEEDBACK
   ═══════════════════════════════════════════════════════════════════════════ */

.alert {
  font-family: var(--font-body);
  border-radius: 0.875rem;
  border: 1px solid;
  border-left-width: 4px;
  padding: 1rem 1.25rem;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background: rgba(22, 163, 74, 0.1);
  border-color: var(--color-success);
}

.alert-warning {
  background: rgba(217, 119, 6, 0.1);
  border-color: var(--color-warning);
}

.alert-error {
  background: rgba(220, 38, 38, 0.1);
  border-color: var(--color-error);
}

.alert-info {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--color-info);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS BARS
   ═══════════════════════════════════════════════════════════════════════════ */

.progress {
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--color-border);
  overflow: hidden;
}

.progress::-webkit-progress-bar {
  background: var(--color-border);
  border-radius: 9999px;
}

.progress::-webkit-progress-value {
  border-radius: 9999px;
  transition: width 0.5s var(--ease-out-expo);
}

.progress-success::-webkit-progress-value {
  background: linear-gradient(90deg, var(--color-success), var(--color-accent));
}

.progress-warning::-webkit-progress-value {
  background: linear-gradient(90deg, var(--color-warning), #f59e0b);
}

.progress-error::-webkit-progress-value {
  background: linear-gradient(90deg, var(--color-error), #f87171);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABS & COLLAPSE
   ═══════════════════════════════════════════════════════════════════════════ */

.tabs-boxed {
  background: var(--color-border);
  border-radius: 0.875rem;
  padding: 0.375rem;
  gap: 0.25rem;
}

.tab {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.625rem;
  padding: 0.625rem 1.25rem;
}

.tab-active,
.tabs .tab-active {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.collapse {
  background: var(--color-border);
  border-radius: 0.875rem;
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.collapse-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
}

/* Large screen collapse-open */
@media (min-width: 1024px) {
  .collapse.lg\:collapse-open {
    background: transparent;
    border: none;
    overflow: visible;
  }

  .collapse.lg\:collapse-open > .collapse-content {
    max-height: none !important;
    min-height: fit-content;
    height: auto;
    padding: 0;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible;
    position: relative;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHARTS & MAPS
   ═══════════════════════════════════════════════════════════════════════════ */

.timeseries {
  width: 100%;
  height: 400px;
}

.map {
  width: 100%;
  height: 360px;
  border-radius: 1rem;
  overflow: hidden;
  border: 2px solid var(--card-border);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.map-container {
  transition: height 0.4s var(--ease-out-expo);
  border-radius: 1rem;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DRAWER SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */

.drawer-side {
  z-index: 100;
}

.drawer-side .menu {
  width: 232px;
  background: #111827;
  color: #c1ccdc;
  padding: 0.625rem;
  min-height: 100%;
  border-right: 1px solid #263244;
  gap: 0.25rem;
}

.drawer-side .menu-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8294af;
  margin: 1rem 0 0.375rem;
  padding: 0.5rem 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BREADCRUMBS
   ═══════════════════════════════════════════════════════════════════════════ */

.breadcrumbs {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
}

.breadcrumbs ul li + li::before {
  content: "›";
  margin: 0 0.5rem;
  opacity: 0.4;
}

.breadcrumbs a {
  display: flex;
  align-items: center;
  opacity: 0.7;
}

.breadcrumbs a svg {
  width: 1rem;
  height: 1rem;
  margin-right: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FLOATING ACTION BAR (Bulk Actions)
   ═══════════════════════════════════════════════════════════════════════════ */

.floating-action-bar {
  background: var(--surface-glass);


  border: 1px solid var(--card-border);
  box-shadow:
    0 8px 32px -4px rgba(0, 0, 0, 0.2),
    0 4px 12px -2px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-backdrop {
  background: rgba(0, 0, 0, 0.3) !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--surface-glass) !important;


  border: 1px solid var(--card-border);
  box-shadow:
    0 16px 48px -8px rgba(0, 0, 0, 0.25),
    0 8px 24px -4px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */

.footer {
  font-family: var(--font-display);
  font-size: 0.8rem;
  opacity: 0.6;
  border-top: 1px solid var(--card-border);
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS & EFFECTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Page load stagger animation */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: none;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }


/* Loading spinner - daisyUI provides .loading component, no custom styles needed */

/* Notification toast animations */
@keyframes notification-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes notification-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

.animate-fade-in {
  animation: notification-fade-in 0.3s var(--ease-out-expo) both;
}

.animate-fade-out {
  animation: notification-fade-out 0.3s var(--ease-out-expo) both;
}

/* ═══════════════════════════════════════════════════════════════════════════
   THEME TRANSITIONS
   ═══════════════════════════════════════════════════════════════════════════ */

html,
body,
.card,
.btn,
.input,
.select,
.navbar,
.alert,
.badge,
.stat,
.stats,
.table {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.35s;
  transition-timing-function: var(--ease-out-expo);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════════════════ */

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
  h1, .text-3xl {
    font-size: 1.75rem;
  }
  h2, .text-2xl {
    font-size: 1.5rem;
  }
  h3, .text-xl {
    font-size: 1.25rem;
  }
  .stat-value {
    font-size: 2rem;
  }
  .card-body {
    padding: 1.25rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Heading emphasis */
.gradient-text {
  color: var(--color-text);
  background: none;
  -webkit-text-fill-color: currentColor;
}

/* Data highlight effect */
.data-highlight {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--color-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   HTMX LOADING INDICATORS
   ═══════════════════════════════════════════════════════════════════════════ */

/* HTMX indicator - hidden by default, shown during request */
.htmx-indicator {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* Subtle opacity reduction during HTMX requests */
.htmx-request:not(.htmx-indicator) {
  opacity: 0.7;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* Disable pointer events on the target during loading */
[hx-target].htmx-request {
  pointer-events: none;
}

/* Shared fleet interface details. */
h1, h2, h3, h4, h5, h6, .card-title, .btn, .badge, .tab {
  font-family: var(--font-body);
  letter-spacing: normal;
}
h1, .text-3xl { font-size: 2rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
h2, .text-2xl { font-size: 1.5rem; line-height: 1.3; }
h3, .text-xl { font-size: 1.125rem; line-height: 1.4; }
.card-body { padding: 1.25rem; }
.stat { padding: 1rem 1.125rem; }
.label-text { color: var(--muted); font-weight: 500; opacity: 1; letter-spacing: 0; }
.input, .select { height: 2.625rem; min-height: 2.625rem; font-size: 0.875rem; border-radius: 0.375rem; }
.btn { min-height: 2.625rem; height: 2.625rem; font-size: 0.9375rem; letter-spacing: 0; }
.btn-sm { min-height: 2rem; height: 2rem; font-size: 0.8125rem; }
.btn-xs { min-height: 1.5rem; height: 1.5rem; font-size: 0.75rem; }
.btn-circle { width: 2.625rem; padding: 0.5rem; }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-outline:hover { background: var(--color-background); border-color: var(--color-primary); color: var(--color-primary); }
.btn:disabled, .btn.btn-disabled { opacity: 0.45; cursor: not-allowed; }
.badge { padding: 0.25rem 0.625rem; font-size: 0.75rem; font-weight: 600; letter-spacing: 0; }
.badge-success, .badge-warning, .badge-error { border-color: transparent; }
.table tbody td { padding: 1rem; }
.table tbody tr:hover { background: var(--color-background); }
.table a { font-weight: 600; }
.map, .map-container, .modal-box { border-radius: 0.625rem; }
.map { border-width: 1px; box-shadow: none; }
.footer { background: transparent; padding: 1.25rem; opacity: 1; color: var(--muted); }
.drawer-side .menu a { color: #c1ccdc; font-weight: 400; border-radius: 0.375rem; padding: 0.75rem; gap: 0.875rem; }
.drawer-side .menu a svg { color: #8db9e9; opacity: 1; flex-shrink: 0; }
.drawer-side .menu a:hover, .drawer-side .menu a[aria-current="page"] { background: #243247; color: #fff; }
.drawer-side .menu a[aria-current="page"] { box-shadow: inset 2px 0 #60a5fa; }
.drawer-side .menu a:hover svg { transform: none; }
.drawer-side .menu .sidebar-brand { margin: -0.625rem -0.625rem 0.75rem; padding: 1rem 1.5rem; border-bottom: 1px solid #202c3e; border-radius: 0; }
.drawer-side .menu .sidebar-brand svg { width: 68px; height: 42px; }
.sidebar-brand span { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.1em; color: #8294af; }
.drawer-side a:focus-visible { outline-color: #93c5fd; }
@media (min-width: 1024px) {
  .navbar { min-height: 3rem; padding: 0.375rem 2rem; }
  .navbar-start > a { display: none; }
  .page-shell { padding: 0.75rem 2rem 2rem; gap: 1.5rem; }
}
@media (min-width: 1440px) { .page-shell { padding-left: 3rem; padding-right: 3rem; } }
@media (max-width: 640px) { h1, .text-3xl { font-size: 1.625rem; } }

.stats.shadow-lg { box-shadow: 0 1px 2px rgba(16, 24, 39, 0.04); }
.drawer-side .menu .sidebar-brand:hover { background: transparent; }

/* Quiet page labels and consistent panel elevation. */
.badge-outline.badge-lg {
  border: none;
  border-radius: 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.card.shadow-md, .card.shadow-lg { box-shadow: 0 1px 2px rgba(16, 24, 39, 0.04); }

/* Selectable live vehicle cards. */
.live-vehicle-card { cursor: pointer; transition: border-color 0.15s, background-color 0.15s; }
.live-vehicle-card:hover { border-color: var(--color-primary); }
.live-vehicle-card[aria-pressed="true"] { border-color: var(--color-primary); box-shadow: inset 3px 0 var(--color-primary); }

/* Transparent RMD artwork, colored for the actual background surface. */
.rmd-logo {
  display: inline-block;
  width: 6rem;
  aspect-ratio: 992 / 641;
  flex-shrink: 0;
  vertical-align: middle;
}
.rmd-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Recolor the exact original artwork without changing its transparent pixels. */
.rmd-logo--on-dark img,
[data-theme="business"] .rmd-logo--theme img {
  filter: brightness(0) invert(1);
}
.rmd-logo--header { width: 4.5rem; }
.rmd-logo--account { width: 16rem; max-width: 100%; }
.rmd-logo--footer { width: 3.5rem; }
.drawer-side .menu .sidebar-brand .rmd-logo { width: 6rem; }

/* Account pages: quiet technical detail, with the form as the focal point. */
.account-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  box-sizing: border-box;
  padding: 4.5rem 1.25rem 2.5rem;
  background: radial-gradient(ellipse at 50% 10%, rgba(96, 165, 250, 0.09), transparent 65%), var(--color-background);
}
.account-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(115deg, transparent 40%, var(--color-border) 40%, var(--color-border) calc(40% + 1px), transparent calc(40% + 1px)), linear-gradient(115deg, transparent 43%, var(--color-border) 43%, var(--color-border) calc(43% + 1px), transparent calc(43% + 1px));
  opacity: 0.35;
}
.account-shell { position: relative; width: 100%; max-width: 26rem; }
.account-branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1.75rem;
}
.account-theme-control { position: fixed; top: 1.25rem; right: 1.25rem; z-index: 1; }
.account-theme-toggle {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--muted);
  cursor: pointer;
}
.account-theme-toggle:hover { color: var(--color-text); border-color: var(--muted); }
.account-theme-toggle svg { width: 1.125rem; height: 1.125rem; }
.account-theme-toggle .account-theme-sun { display: none; }
[data-theme="business"] .account-theme-toggle .account-theme-sun { display: block; }
[data-theme="business"] .account-theme-toggle .account-theme-moon { display: none; }
.account-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 0.875rem;
  background: var(--color-surface);
  box-shadow: 0 16px 48px -24px rgba(16, 24, 39, 0.25);
}
.account-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), transparent);
}
.account-panel-body { padding: 2rem; }
.account-title {
  margin: 0 0 1.75rem;
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.035em;
}
.account-form p { margin: 1rem 0; }
.account-form label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 500;
}
.account-form input:not([type="hidden"]) {
  box-sizing: border-box;
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.4375rem;
  background: var(--color-background);
  color: var(--color-text);
  font-size: 1rem;
}
.account-form .helptext { display: block; margin-top: 0.4rem; font-size: 0.8rem; color: var(--muted); }
.account-form ul { padding-left: 1rem; }
.account-form .errorlist { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--color-error); }
.account-login-form { display: grid; gap: 1.25rem; }
.account-input { position: relative; }
.account-input svg {
  position: absolute;
  top: 50%;
  left: 0.875rem;
  width: 1.125rem;
  height: 1.125rem;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.account-form .account-input input { min-height: 3rem; padding-left: 2.75rem; }
.account-form input:not([type="hidden"]):focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}
.account-input:focus-within svg { color: var(--color-primary); }
.account-form input[aria-invalid="true"] { border-color: var(--color-error); }
.account-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 3rem;
  margin-top: 0.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.4375rem;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.account-submit:hover { background: var(--color-primary-hover); }
.account-submit svg { width: 1.125rem; height: 1.125rem; }
.account-panel-footer {
  margin: 1.75rem -2rem -2rem;
  padding: 1rem 2rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
}
.account-panel-footer a { color: var(--muted); font-size: 0.8125rem; }
.account-panel-footer a:hover { color: var(--color-primary); }
.account-panel-footer a span { display: inline-block; margin-left: 0.375rem; }
.account-theme-toggle:focus-visible, .account-submit:focus-visible, .account-panel-footer a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}
.account-form-errors { margin-bottom: 1.25rem; padding: 0.75rem; border-radius: 0.4375rem; background: var(--color-background); color: var(--color-error); font-size: 0.8125rem; }
.account-form-errors ul { margin: 0; list-style: none; padding: 0; }
.account-message { margin: 0 0 1rem; font-size: 0.875rem; }
@media (max-width: 480px) {
  .account-panel-body { padding: 1.5rem; }
  .account-panel-footer { margin: 1.5rem -1.5rem -1.5rem; padding: 1rem 1.5rem; }
}

/* Keep the logo centered independently of the navigation item alignment. */
.drawer-side .menu .sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 1024px) {
  #app-drawer {
    grid-template-columns: 232px minmax(0, 1fr);
    transition: grid-template-columns 240ms var(--ease-out-expo);
  }
  #app-drawer > .drawer-content { grid-column-start: 2; }
  #app-drawer > .drawer-side {
    width: 232px;
    min-width: 0;
    visibility: visible;
    transform: translateX(0);
    transition: transform 240ms var(--ease-out-expo), visibility 0s linear;
  }
  #app-drawer > .drawer-side > :not(.drawer-overlay) {
    width: 232px;
    transform: none;
    transition: none;
  }
  html[data-sidebar-collapsed="true"] #app-drawer {
    grid-template-columns: 0 minmax(0, 1fr);
  }
  html[data-sidebar-collapsed="true"] #app-drawer > .drawer-side {
    visibility: hidden;
    pointer-events: none;
    /* Hide the native scrollbar while closing; keep open-menu scrolling. */
    overflow: hidden;
    transform: translateX(-100%);
    transition: transform 240ms var(--ease-out-expo), visibility 0s linear 240ms;
  }
  html[data-sidebar-collapsed="true"] .navbar-start > .navbar-brand {
    display: flex;
  }
}
@media (min-width: 1024px) and (prefers-reduced-motion: reduce) {
  #app-drawer,
  #app-drawer > .drawer-side,
  html[data-sidebar-collapsed="true"] #app-drawer > .drawer-side,
  #app-drawer > .drawer-side > :not(.drawer-overlay) {
    transition: none;
  }
}
