:root {
  --primary: #0b1f3a;
  --primary-strong: #08192d;
  --primary-soft: #eaf0f8;
  --accent: #d99a22;
  --accent-soft: rgba(217, 154, 34, 0.12);
  --background: #f6f8fb;
  --surface: #ffffff;
  --surface-alt: #f2f5f9;
  --text: #172033;
  --muted: #667085;
  --border: #e8edf4;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #2563eb;
  --shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --sidebar-width: 256px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--text);
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

body {
  background: linear-gradient(180deg, #f7f8fb 0%, #edf2f8 100%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell {
  min-height: 100vh;
  background: var(--background);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  padding: 1.2rem 1rem 1.5rem;
  overflow-y: auto;
  z-index: 30;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(11,31,58,0.14); border-radius: 999px; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.7rem 1.2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.1rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 1.15rem;
  color: var(--primary);
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.side-section {
  margin-bottom: 0.9rem;
}

.side-section-label {
  padding: 0.55rem 0.7rem 0.35rem;
  color: var(--muted);
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.72rem 0.8rem;
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  transition: all 0.2s ease;
}

.nav-link i, .nav-link svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.nav-link:hover {
  background: rgba(11, 31, 58, 0.04);
}

.nav-link.active {
  background: rgba(11, 31, 58, 0.08);
  color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(11, 31, 58, 0.04);
}

.nav-link.active::before {
  content: "";
  width: 3px;
  height: 18px;
  border-radius: 10px;
  background: var(--accent);
  margin-right: 0.14rem;
}

.main-panel {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.main-panel.auth-main-panel {
  margin-left: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2rem 1rem 2.2rem;
  background: rgba(246, 248, 251, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(232, 237, 244, 0.9);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.topbar-copy {
  min-width: 0;
}

.page-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.3rem, 2vw, 2rem);
  line-height: 1.2;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.icon-button {
  width: 39px;
  height: 39px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-radius: 12px;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover {
  border-color: rgba(11, 31, 58, 0.18);
  box-shadow: var(--shadow);
}

.noti-dot {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9);
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.55rem 0.4rem 0.45rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  color: var(--text);
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  color: #fff;
  font-weight: 700;
}

.profile-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.profile-copy strong {
  font-size: 0.9rem;
}

.profile-copy small {
  color: var(--muted);
}

/* ---------------------------------------------------------------------
   Topbar dropdowns (notifications + profile)
--------------------------------------------------------------------- */

.dropdown-wrap {
  position: relative;
}

.icon-button, .profile-trigger {
  cursor: pointer;
}

.profile-trigger .chevron-icon {
  transition: transform 0.2s ease;
}

.dropdown-wrap.open .profile-trigger .chevron-icon {
  transform: rotate(180deg);
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14);
  z-index: 60;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  overflow: hidden;
}

.dropdown-wrap.open .dropdown-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9rem 1rem 0.7rem;
  border-bottom: 1px solid var(--border);
}

.dropdown-header strong {
  font-size: 0.92rem;
}

.dropdown-header span {
  color: var(--muted);
  font-size: 0.75rem;
}

.dropdown-body {
  max-height: 320px;
  overflow-y: auto;
}

.dropdown-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 2rem 1.2rem 2.1rem;
  text-align: center;
  color: var(--muted);
}

.dropdown-empty i {
  width: 30px;
  height: 30px;
  color: var(--muted);
  opacity: 0.6;
}

.dropdown-empty strong {
  color: var(--text);
  font-size: 0.88rem;
}

.dropdown-empty small {
  font-size: 0.78rem;
}

.notif-item {
  display: flex;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
}

.notif-item:last-child { border-bottom: none; }

.notif-dot-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.notif-item strong {
  display: block;
  font-size: 0.85rem;
}

.notif-item p {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.profile-panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.profile-panel-header .avatar {
  width: 42px;
  height: 42px;
}

.profile-panel-header strong {
  display: block;
  font-size: 0.94rem;
}

.profile-panel-header small {
  color: var(--muted);
  font-size: 0.78rem;
}

.dropdown-menu-list {
  padding: 0.5rem;
}

.dropdown-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.86rem;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
}

.dropdown-menu-item:hover {
  background: var(--surface-alt);
}

.dropdown-menu-item i {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.dropdown-menu-item.danger {
  color: var(--danger);
}

.dropdown-menu-item.danger i {
  color: var(--danger);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.3rem 0.2rem;
}

/* ---------------------------------------------------------------------
   Row actions (edit / delete) in data tables
--------------------------------------------------------------------- */

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-action i { width: 15px; height: 15px; }

.icon-action:hover {
  color: var(--primary);
  border-color: rgba(11,31,58,0.2);
  box-shadow: var(--shadow);
}

.icon-action.danger:hover {
  color: var(--danger);
  border-color: rgba(220,38,38,0.25);
  background: rgba(220,38,38,0.06);
}

.inline-form { display: inline-flex; margin: 0; }

/* ---------------------------------------------------------------------
   Confirm modal
--------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 19, 32, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.28);
  padding: 1.6rem 1.5rem 1.4rem;
  text-align: center;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.16s ease;
}

.modal-overlay.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(220,38,38,0.1);
  color: var(--danger);
}

.modal-icon i { width: 24px; height: 24px; }

.modal-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.3rem;
}

.modal-actions .secondary-btn,
.modal-actions .danger-solid-btn {
  flex: 1;
}

.danger-solid-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.72rem 1.05rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--danger);
  color: #fff;
  box-shadow: 0 12px 20px rgba(220,38,38,0.18);
  transition: all 0.2s ease;
}

.danger-solid-btn:hover { background: #b91c1c; }

.content-area {
  padding: 1.6rem 2.2rem 2rem;
}

.welcome-card,
.panel,
.stat-card,
.trip-row,
.form-card,
.summary-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.welcome-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.5rem;
}

.welcome-card h2 {
  margin: 0.2rem 0 0.3rem;
  font-size: clamp(1.4rem, 2vw, 2.2rem);
  line-height: 1.2;
}

.welcome-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  padding: 1.1rem 1.1rem 1rem;
  min-height: 156px;
  position: relative;
  overflow: hidden;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 0.9rem;
}

.kpi-card .meta {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-value {
  font-size: clamp(1.5rem, 2.2vw, 2.2rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
}

.kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.trend-up, .trend-down, .trend-neutral {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-neutral { color: var(--info); }

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.panel {
  padding: 1.2rem 1.2rem 0.7rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 0.8rem;
}

.panel-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.mini-link {
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.list-row strong {
  display: block;
  font-size: 0.94rem;
}

.list-row small {
  color: var(--muted);
}

.list-row .subtle-value {
  font-weight: 700;
  color: var(--primary);
}

.trip-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.trip-row {
  padding: 1rem 1rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.trip-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.trip-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.trip-info {
  min-width: 0;
}

.trip-route {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.trip-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.trip-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  padding: 0.44rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.status-planned { background: rgba(37, 99, 235, 0.08); color: var(--info); border-color: rgba(37,99,235,0.12); }
.status-in_transit { background: rgba(217,154,34,0.12); color: #8a5b00; border-color: rgba(217,154,34,0.18); }
.status-completed { background: rgba(22,163,74,0.1); color: var(--success); border-color: rgba(22,163,74,0.15); }
.status-cancelled { background: rgba(220,38,38,0.08); color: var(--danger); border-color: rgba(220,38,38,0.14); }
.status-active { background: rgba(37, 99, 235, 0.08); color: var(--info); border-color: rgba(37,99,235,0.12); }
.status-partially_used { background: rgba(217,154,34,0.12); color: #8a5b00; border-color: rgba(217,154,34,0.18); }
.status-ready_for_refuel { background: rgba(220,38,38,0.08); color: var(--danger); border-color: rgba(220,38,38,0.14); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255,255,255,0.9);
}

.data-table th,
.data-table td {
  padding: 0.8rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.data-table tbody tr {
  transition: all 0.15s ease;
}

.data-table tbody tr:hover {
  background: rgba(11, 31, 58, 0.02);
}

.table-action {
  color: var(--primary);
  font-weight: 700;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.8);
}

.empty-state strong {
  display: block;
  margin-top: 0.5rem;
  color: var(--text);
  font-size: 1.05rem;
}

.empty-state .primary-btn { margin-top: 1rem; }

.primary-btn, .secondary-btn, .danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.72rem 1.05rem;
  font-weight: 700;
  transition: all 0.2s ease;
  cursor: pointer;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 20px rgba(11, 31, 58, 0.18);
}

.primary-btn:hover { background: var(--primary-strong); color: #fff; }

.secondary-btn {
  background: #fff;
  border-color: rgba(11,31,58,0.15);
  color: var(--primary);
}

.danger-btn {
  background: rgba(220,38,38,0.08);
  color: var(--danger);
  border-color: rgba(220,38,38,0.12);
}

.page-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.3rem;
}

.page-head-row h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.summary-card {
  padding: 1.2rem 1.15rem;
}

.summary-card h3 {
  margin: 0 0 0.8rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-amount {
  font-size: clamp(1.5rem, 2.2vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.journey-card {
  padding: 1.3rem;
}

.journey-strip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.9rem;
}

.journey-stop {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.journey-stop small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.journey-stop strong {
  font-size: 1.1rem;
}

.route-line {
  position: relative;
  height: 2px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.route-line::before,
.route-line::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--primary);
}

.route-line::before { left: 0; }
.route-line::after { right: 0; background: var(--accent); }

.route-center {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  background: rgba(217, 154, 34, 0.1);
  border-radius: 999px;
  border: 1px solid rgba(217, 154, 34, 0.18);
}

.mileage-comparison {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0.6rem;
  align-items: center;
  padding-top: 0.6rem;
}

.mileage-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 0.8rem;
}

.mileage-box small {
  color: var(--muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mileage-box strong {
  display: block;
  font-size: 1.2rem;
  margin-top: 0.25rem;
}

.fuel-card {
  padding: 1.2rem;
}

.fuel-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.metric-item {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 0.85rem;
  border: 1px solid var(--border);
}

.metric-item small {
  display: block;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.metric-item strong {
  font-size: 1.25rem;
}

.form-shell {
  max-width: 860px;
}

.form-card {
  padding: 1.2rem 1.1rem;
}

.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-header h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
  color: var(--muted);
}

.step-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  background: rgba(11,31,58,0.04);
  color: var(--text);
}

.step-item.active {
  background: rgba(11,31,58,0.08);
  color: var(--primary);
  border: 1px solid rgba(11,31,58,0.05);
}

.step-item .number {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(11,31,58,0.12);
  font-size: 0.72rem;
  font-weight: 800;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.1rem;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.field-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-control, .form-select, .form-check-input {
  width: 100%;
  border: 1px solid #dfe6ef;
  background: #fff;
  border-radius: 12px;
  min-height: 46px;
  padding: 0.7rem 0.9rem;
  color: var(--text);
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: rgba(11,31,58,0.42);
  box-shadow: 0 0 0 0.15rem rgba(11,31,58,0.1);
  outline: none;
}

textarea.form-control {
  min-height: 110px;
  resize: vertical;
}

.help-text {
  font-size: 0.78rem;
  color: var(--muted);
}

.errorlist {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--danger);
  font-size: 0.78rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0b1f3a 0%, #11294d 58%, #17345d 100%);
  padding: 1.5rem;
}

.login-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  border-radius: 28px;
  overflow: hidden;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 22px 52px rgba(11,31,58,0.25);
}

.login-brand {
  background: linear-gradient(180deg, rgba(11,31,58,0.98), rgba(14,41,70,0.94));
  color: #fff;
  padding: 2rem 2rem 2.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

.login-brand .brand {
  padding: 0;
  border: none;
  margin: 0;
  color: #fff;
}

.login-brand .brand strong,
.login-brand .brand-copy small {
  color: #fff;
}

.login-brand h2 {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.1;
}

.login-brand p {
  margin: 0;
  color: rgba(255,255,255,0.75);
  font-size: 1.02rem;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 2rem 1.6rem;
}

.login-form {
  width: min(100%, 380px);
}

.login-form h3 {
  margin: 0 0 1rem;
  color: var(--text);
  font-size: 2rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.7rem 0 1.2rem;
}

.form-check-label {
  color: var(--muted);
}

.toast-container {
  position: fixed;
  top: 5.4rem;
  right: 1.2rem;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: min(360px, calc(100vw - 2.4rem));
}

.toast {
  min-width: 260px;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: rgba(23,32,51,0.92);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.2);
}

.toast.success { background: rgba(22,163,74,0.92); }
.toast.error { background: rgba(220,38,38,0.92); }
.toast.warning { background: rgba(245,158,11,0.92); color: #1f2937; }
.toast.info { background: rgba(37,99,235,0.92); }

.mobile-menu-toggle {
  display: none;
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-grid, .card-grid, .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .main-panel {
    margin-left: 0;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: 0 18px 42px rgba(15,23,42,0.15);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.9);
  }

  .content-area, .topbar { padding-left: 1.1rem; padding-right: 1.1rem; }
  .topbar { padding-top: 0.9rem; padding-bottom: 0.9rem; }
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(255,255,255,0.96);
    border-top: 1px solid var(--border);
    padding: 0.6rem 0.8rem calc(0.6rem + env(safe-area-inset-bottom));
    z-index: 50;
    box-shadow: 0 -8px 22px rgba(11,31,58,0.08);
  }

  .mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.18rem;
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 700;
  }

  .mobile-bottom-nav a.active {
    color: var(--primary);
  }

  body { padding-bottom: 4.2rem; }
}

@media (max-width: 640px) {
  .welcome-card,
  .page-head-row,
  .form-header,
  .trip-row,
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar { align-items: center; }
  .topbar-right { width: 100%; justify-content: flex-end; }
  .login-card { grid-template-columns: 1fr; }
  .login-form { width: 100%; }
  .kpi-grid { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions > * { width: 100%; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tbody tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.7rem;
    padding: 0.7rem;
    background: #fff;
  }
  .data-table td {
    border: none;
    padding: 0.35rem 0;
  }
  .dropdown-panel {
    width: min(300px, calc(100vw - 2rem));
    right: -0.6rem;
  }
  .data-table td::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }
}

/* =========================================================================
   FLEET OS DESIGN SYSTEM — v2 additions
   Dark/light theme tokens, filter bar, report sections, profitability
   table, mobile trip rows, theme toggle, notification states, dedup
   header fix. Everything below builds on the existing tokens/components
   above rather than replacing them.
========================================================================= */

/* -------------------------------------------------------------------
   Theme tokens — light is the existing :root; dark overrides here.
   Toggled via [data-theme="dark"] on <html>, persisted client-side.
------------------------------------------------------------------- */
html[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-strong: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --accent: #e3ab3d;
  --accent-soft: rgba(227, 171, 61, 0.16);
  --background: #0e1420;
  --surface: #161d2b;
  --surface-alt: #1c2434;
  --text: #e7ebf3;
  --muted: #93a0b8;
  --border: #2a3345;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] body {
  background: linear-gradient(180deg, #0e1420 0%, #10182a 100%);
}

html[data-theme="dark"] .app-shell { background: transparent; }
html[data-theme="dark"] .sidebar { background: rgba(22, 29, 43, 0.96); }
html[data-theme="dark"] .brand-mark { background: var(--surface-alt); }
html[data-theme="dark"] .topbar { background: rgba(14, 20, 32, 0.94); }
html[data-theme="dark"] .nav-link:hover { background: rgba(255, 255, 255, 0.06); }
html[data-theme="dark"] .nav-link.active { background: rgba(59, 130, 246, 0.16); box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.18); }

html[data-theme="dark"] .sidebar {
  background: rgba(22, 29, 43, 0.92);
}

html[data-theme="dark"] .topbar {
  background: rgba(14, 20, 32, 0.9);
  border-bottom-color: rgba(42, 51, 69, 0.9);
}

html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .profile-trigger,
html[data-theme="dark"] .mobile-menu-toggle,
html[data-theme="dark"] .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .brand-mark { background: #1c2434; }

html[data-theme="dark"] .data-table { background: var(--surface); }
html[data-theme="dark"] .data-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }

html[data-theme="dark"] .data-table tbody tr { background: transparent; }

html[data-theme="dark"] .status-in_transit { color: var(--warning); }

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-check-input {
  background: var(--surface-alt);
  color: var(--text);
}

html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .dropdown-panel,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .kpi-card,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .chart-card,
html[data-theme="dark"] .welcome-card,
html[data-theme="dark"] .summary-card {
  background: var(--surface);
}

html[data-theme="dark"] .modal-overlay { background: rgba(0, 0, 0, 0.6); }

html[data-theme="dark"] .login-card { background: var(--surface); }

/* Theme toggle button, sits in topbar-right next to the notification bell */
.theme-toggle {
  width: 39px;
  height: 39px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

html[data-theme="dark"] .theme-toggle { background: rgba(255,255,255,0.04); }

.theme-toggle:hover { border-color: rgba(11, 31, 58, 0.18); box-shadow: var(--shadow); }

.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* -------------------------------------------------------------------
   Notification badge + unread state (replaces the old static dot)
------------------------------------------------------------------- */
.noti-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--background);
  line-height: 1;
}

.dropdown-header .mark-all-read {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.notif-item { position: relative; align-items: flex-start; text-align: left; width: 100%; cursor: pointer; background: transparent; border: none; border-bottom: 1px solid var(--border); }

.notif-item.is-unread { background: var(--accent-soft); }

.notif-item.is-unread .notif-dot-icon { background: var(--accent-soft); color: var(--accent); }

.notif-item .notif-time { display: block; margin-top: 0.25rem; font-size: 0.68rem; color: var(--muted); }

.notif-unread-dot {
  position: absolute;
  top: 0.95rem;
  right: 0.9rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* -------------------------------------------------------------------
   Page header dedup fix: an actions-only row (no repeated <h2>) for
   list pages where the topbar h1 already carries the page title.
------------------------------------------------------------------- */
.page-actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.page-lede {
  color: var(--muted);
  font-size: 0.86rem;
  margin: -0.6rem 0 1.1rem;
}

/* -------------------------------------------------------------------
   Compact filter bar (Reports / Profitability month+year filters)
------------------------------------------------------------------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.report-filter-bar {
  justify-content: flex-end;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.filter-copy { margin-right: auto; display: grid; gap: 0.1rem; }
.filter-copy strong { font-size: 0.88rem; }
.filter-eyebrow { color: var(--accent); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }

.analytics-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.2rem;
  padding: 1.2rem 1.35rem;
  color: #fff;
  background: linear-gradient(115deg, var(--primary) 0%, #174d72 100%);
  border-radius: var(--radius);
  box-shadow: 0 16px 28px rgba(11, 31, 58, 0.18);
}

.analytics-banner h2 { margin: 0.2rem 0 0.25rem; font-size: 1.2rem; line-height: 1.25; }
.analytics-banner p { margin: 0; color: rgba(255, 255, 255, 0.72); font-size: 0.82rem; }
.analytics-banner-icon { display: grid; place-items: center; width: 46px; height: 46px; color: #f4c96b; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px; flex-shrink: 0; }
.analytics-banner-icon svg { width: 22px; height: 22px; }

.profitability-chart-grid .chart-card { min-height: 290px; min-width: 0; overflow: hidden; }
.profitability-chart-grid .chart-card canvas { height: 220px !important; }

.filter-bar select {
  width: auto;
  min-width: 108px;
  padding: 0.55rem 2rem 0.55rem 0.8rem;
}

.filter-bar label { display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.filter-bar input[type="date"] { min-height: 36px; padding: 0.45rem 0.65rem; color: var(--text); background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; }
.filter-divider { color: var(--muted); font-size: 0.75rem; }

.filter-bar .primary-btn,
.filter-bar .secondary-btn {
  padding: 0.55rem 1rem;
}

/* -------------------------------------------------------------------
   Report / analytics page structure: section titles, secondary
   metrics grid, chart cards.
------------------------------------------------------------------- */
.section-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.8rem 0 0.8rem;
}

.section-title:first-child { margin-top: 0; }

.metric-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.4rem;
}

.metric-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.metric-tile .metric-tile-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.metric-tile .metric-tile-value {
  font-size: 1.05rem;
  font-weight: 700;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 0.8rem;
  box-shadow: var(--shadow);
  min-height: 290px;   /* NEW — gives the container a real height to size against */
  min-width: 0;         /* NEW — prevents grid blowout */
  overflow: hidden;      /* NEW — matches profitability-chart-grid behavior */
}

.chart-card h3 {
  margin: 0 0 0.8rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.chart-card canvas { height: 220px !important; }  /* CHANGED from max-height */
.overhead-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-top: 0.4rem;
}

.overhead-summary .overhead-figure { text-align: right; }
.overhead-summary .overhead-figure .metric-tile-label { font-size: 0.72rem; color: var(--muted); }
.overhead-summary .overhead-figure .metric-tile-value { font-size: 1.2rem; font-weight: 800; }

/* -------------------------------------------------------------------
   Profitability page: truck comparison table + KPI ribbon
------------------------------------------------------------------- */
.profit-cell-positive { color: var(--success); font-weight: 700; }
.profit-cell-negative { color: var(--danger); font-weight: 700; }

.data-table th.sortable a { color: inherit; display: inline-flex; align-items: center; gap: 0.25rem; }
.data-table th.sortable i { width: 13px; height: 13px; }

.truck-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.truck-cell .kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.truck-cell .kpi-icon i { width: 15px; height: 15px; }

/* =========================================================================
   Mobile trips list — compact rows, not stacked "card" fields.
   Two markups exist in trip_list.html: a desktop <table class="data-table">
   and a mobile-only <div class="mobile-trip-list">. Only one is visible
   at a time via the media query below.
========================================================================= */
.mobile-trip-list { display: none; }

.mobile-trip-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.mobile-trip-row:last-child { border-bottom: none; }

.mobile-trip-main {
  flex: 1;
  min-width: 0;
}

.mobile-trip-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.mobile-trip-top strong {
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-trip-route {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-trip-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.mobile-trip-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.mobile-trip-figure {
  font-size: 0.82rem;
  font-weight: 700;
}

.mobile-trip-chevron {
  color: var(--muted);
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  /* Trips specifically get compact rows instead of the generic stacked
     card treatment other data tables use. */
  .trip-table-desktop { display: none; }
  .mobile-trip-list { display: block; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); padding: 0 0.9rem; }

  .chart-grid { grid-template-columns: 1fr; }
  .chart-card canvas { max-width: 100%; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overhead-summary { flex-direction: column; align-items: stretch; }
  .overhead-summary .overhead-figure { text-align: left; }
  .filter-bar select { flex: 1; min-width: 0; }
  .report-filter-bar { align-items: stretch; }
  .filter-copy { flex-basis: 100%; }
  .filter-divider { display: none; }
  .filter-bar label { flex: 1; min-width: 0; }
  .analytics-banner { align-items: flex-start; }
  .analytics-banner h2 { font-size: 1.05rem; }
}
