:root {
  --sw-color-bg: #f3f6fb;
  --sw-color-surface: #ffffff;
  --sw-color-border: #d9e2ef;
  --sw-color-text: #0f172a;
  --sw-color-text-muted: #64748b;
  --sw-color-primary: #1e4bb5;
  --sw-color-primary-hover: #163a8f;
  --sw-color-accent: #2a72c6;
  --sw-color-info: #0369a1;
  --sw-color-success: #15803d;
  --sw-color-warning: #b45309;
  --sw-color-danger: #b91c1c;
  --sw-sidebar-bg: #0b1220;
  --sw-sidebar-text: #e2e8f0;
  --sw-sidebar-active: #1e4bb5;
  --sw-radius: 10px;
  --sw-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sw-font: "IBM Plex Sans", "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  --sw-color-bg: #0b1220;
  --sw-color-surface: #111827;
  --sw-color-border: #1f2a3d;
  --sw-color-text: #e5eefc;
  --sw-color-text-muted: #94a3b8;
  --sw-shadow: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--sw-font);
  background: var(--sw-color-bg);
  color: var(--sw-color-text);
  font-size: 14px;
}

a { color: var(--sw-color-primary); text-decoration: none; }
a:hover { color: var(--sw-color-primary-hover); }

.sw-app { min-height: 100vh; display: flex; }

.sw-sidebar {
  width: 260px;
  background: var(--sw-sidebar-bg);
  color: var(--sw-sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,.06);
}
.sw-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sw-sidebar-brand img { width: 42px; height: 42px; object-fit: contain; }
.sw-sidebar-brand span { font-weight: 600; letter-spacing: .02em; }
.sw-nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94a3b8;
  padding: 16px 16px 6px;
}
.sw-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  padding: 10px 16px;
  border-left: 3px solid transparent;
  scroll-margin: 0;
}
.sw-nav a:focus { outline: none; }
.sw-nav a:focus-visible {
  outline: 2px solid rgba(42, 114, 198, .55);
  outline-offset: -2px;
}
.sw-nav a:hover, .sw-nav a.active {
  background: rgba(30, 75, 181, .18);
  color: #fff;
  border-left-color: var(--sw-sidebar-active);
}

.sw-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sw-topbar {
  background: var(--sw-color-surface);
  border-bottom: 1px solid var(--sw-color-border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}
.sw-content { padding: 20px; }
.sw-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.sw-page-header h1 { font-size: 1.4rem; margin: 0; font-weight: 600; }

.sw-card {
  background: var(--sw-color-surface);
  border: 1px solid var(--sw-color-border);
  border-radius: var(--sw-radius);
  box-shadow: var(--sw-shadow);
}
.sw-card-body { padding: 16px 18px; }
.sw-kpi {
  padding: 16px 18px;
}
.sw-kpi .label { color: var(--sw-color-text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.sw-kpi .value { font-size: 1.6rem; font-weight: 600; margin-top: 6px; }
.sw-kpi .hint { color: var(--sw-color-text-muted); font-size: 12px; margin-top: 4px; }

.sw-table { width: 100%; border-collapse: collapse; }
.sw-table th, .sw-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sw-color-border);
  text-align: left;
  vertical-align: middle;
}
.sw-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--sw-color-text-muted);
  background: rgba(15, 23, 42, .02);
  position: sticky;
  top: 0;
}
html[data-theme="dark"] .sw-table th { background: rgba(255,255,255,.03); }

.btn-primary {
  --bs-btn-bg: var(--sw-color-primary);
  --bs-btn-border-color: var(--sw-color-primary);
  --bs-btn-hover-bg: var(--sw-color-primary-hover);
  --bs-btn-hover-border-color: var(--sw-color-primary-hover);
  --bs-btn-active-bg: var(--sw-color-primary-hover);
  --bs-btn-active-border-color: var(--sw-color-primary-hover);
}

.sw-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.sw-badge-success { background: rgba(21,128,61,.12); color: var(--sw-color-success); }
.sw-badge-danger { background: rgba(185,28,28,.12); color: var(--sw-color-danger); }
.sw-badge-muted { background: rgba(100,116,139,.15); color: var(--sw-color-text-muted); }

.sw-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top right, rgba(42,114,198,.25), transparent 40%),
    radial-gradient(circle at bottom left, rgba(30,75,181,.2), transparent 35%),
    #070b14;
  padding: 24px;
}
.sw-auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 16px;
  padding: 28px;
  color: #0f172a;
  box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
.sw-auth-card .form-label { color: #334155; }
.sw-auth-card .form-control {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}
.sw-auth-card .form-control:focus {
  background: #fff;
  color: #0f172a;
  border-color: var(--sw-color-accent);
  box-shadow: 0 0 0 .2rem rgba(42,114,198,.2);
}
.sw-auth-logo {
  width: min(100%, 320px);
  margin: 0 auto 20px;
  display: block;
  background: transparent;
  border-radius: 0;
  padding: 0;
}
.sw-auth-tag {
  text-align: center;
  color: #64748b;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.sw-auth-card a { color: var(--sw-color-primary); }
.sw-auth-card .text-muted,
.sw-auth-card .small { color: #64748b !important; }

.breadcrumb { background: transparent; padding: 0; margin-bottom: 8px; }
.form-label { font-weight: 500; }
.invalid-feedback, .text-danger.small { font-size: 12px; }

.sw-toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

@media (max-width: 991px) {
  .sw-sidebar { position: fixed; left: -280px; z-index: 1040; transition: left .2s ease; }
  .sw-sidebar.open { left: 0; }
  .sw-sidebar-backdrop {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1030;
  }
  .sw-sidebar-backdrop.show { display: block; }
}

/* ===== Dashboard ===== */
.sw-dash { display: flex; flex-direction: column; gap: 18px; }
.sw-dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 16px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, .18), transparent 45%),
    linear-gradient(120deg, #0f4c81 0%, #1e4bb5 45%, #0f766e 100%);
  box-shadow: 0 12px 30px rgba(30, 75, 181, .22);
}
.sw-dash-eyebrow {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .8;
  margin-bottom: 6px;
}
.sw-dash-hero h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 650;
}
.sw-dash-hero p {
  margin: 6px 0 0;
  opacity: .88;
  max-width: 520px;
}
.sw-dash-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.sw-dash-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  font-size: 12px;
  white-space: nowrap;
}
.sw-dash-chip.is-warn { background: rgba(251, 191, 36, .22); }
.sw-dash-chip.is-ok { background: rgba(34, 197, 94, .2); }

.sw-dash-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.sw-kpi-tile {
  display: flex;
  flex-direction: column;
  min-height: 128px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--sw-color-border);
  background: var(--sw-color-surface);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--sw-shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
  overflow: hidden;
}
.sw-kpi-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--tone);
}
.sw-kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
  color: inherit;
}
.sw-kpi-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sw-kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--tone) 16%, transparent);
  color: var(--tone);
  font-size: 15px;
}
.sw-kpi-label {
  font-size: 12px;
  color: var(--sw-color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}
.sw-kpi-value {
  margin-top: auto;
  padding-top: 14px;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--sw-color-text);
}
.sw-kpi-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--sw-color-text-muted);
}

.tone-blue { --tone: #1e4bb5; }
.tone-teal { --tone: #0f766e; }
.tone-indigo { --tone: #4338ca; }
.tone-amber { --tone: #b45309; }
.tone-rose { --tone: #be123c; }
.tone-emerald { --tone: #047857; }
.tone-cyan { --tone: #0e7490; }
.tone-slate { --tone: #475569; }

.sw-dash-fleet .sw-fleet-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}
.sw-fleet-bar .seg { display: block; height: 100%; }
.seg-available { background: #0f766e; }
.seg-assigned { background: #1e4bb5; }
.seg-maint { background: #b45309; }
.sw-fleet-legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  font-size: 13px;
}
.sw-fleet-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.dot.available { background: #0f766e; }
.dot.assigned { background: #1e4bb5; }
.dot.maint { background: #b45309; }
.dot.drivers { background: #4338ca; }

.sw-dash-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
  align-items: start;
}
.sw-dash-grid-bottom {
  grid-template-columns: 1.15fr .85fr;
}
.sw-dash-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sw-dash-panel { overflow: hidden; }

.sw-pulse-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.sw-pulse-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tone) 9%, var(--sw-color-surface));
  border: 1px solid color-mix(in srgb, var(--tone) 18%, var(--sw-color-border));
  color: inherit;
  text-decoration: none;
  min-height: 74px;
}
.sw-pulse-item:hover { color: inherit; filter: brightness(.98); }
.sw-pulse-item i {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--tone) 16%, transparent);
  color: var(--tone);
  flex-shrink: 0;
}
.sw-pulse-item strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.1;
}
.sw-pulse-item span {
  display: block;
  font-size: 12px;
  color: var(--sw-color-text-muted);
}

.sw-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.sw-action-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--sw-color-border);
  background: var(--sw-color-surface);
  color: inherit;
  text-decoration: none;
  font-weight: 550;
  min-height: 52px;
}
.sw-action-tile:hover {
  color: inherit;
  border-color: color-mix(in srgb, var(--tone) 35%, var(--sw-color-border));
  background: color-mix(in srgb, var(--tone) 8%, var(--sw-color-surface));
}
.sw-action-tile i {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--tone) 15%, transparent);
  color: var(--tone);
}

.sw-activity-list { display: flex; flex-direction: column; gap: 12px; }
.sw-activity-item { display: flex; gap: 12px; }
.sw-activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--tone);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 16%, transparent);
}
.sw-activity-title { font-size: 13px; }
.sw-activity-desc { color: var(--sw-color-text); margin-top: 2px; }
.sw-activity-meta { color: var(--sw-color-text-muted); font-size: 12px; margin-top: 4px; }

.sw-alert-list { display: flex; flex-direction: column; gap: 8px; }
.sw-alert-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, .03);
  border: 1px solid var(--sw-color-border);
}
.sw-alert-row.is-link {
  color: inherit;
  text-decoration: none;
}
.sw-alert-row.is-link:hover { background: rgba(30, 75, 181, .06); color: inherit; }
.sw-alert-row.is-unread { border-color: color-mix(in srgb, #1e4bb5 30%, var(--sw-color-border)); }
.sw-dot-new {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1e4bb5;
  flex-shrink: 0;
}
.sw-soft-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: color-mix(in srgb, var(--tone) 14%, transparent);
  color: var(--tone);
  white-space: nowrap;
}
.sw-empty-ok {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #047857;
  font-size: 13px;
}
.sw-health-grid { display: flex; flex-direction: column; gap: 8px; }
.sw-health-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid var(--sw-color-border);
}
.sw-health-item.ok { background: rgba(4, 120, 87, .08); color: #047857; border-color: rgba(4, 120, 87, .18); }
.sw-health-item.bad { background: rgba(185, 28, 28, .08); color: #b91c1c; border-color: rgba(185, 28, 28, .18); }
.sw-health-item.muted { background: rgba(15, 23, 42, .03); color: var(--sw-color-text-muted); }

html[data-theme="dark"] .sw-dash-hero {
  box-shadow: none;
}
html[data-theme="dark"] .sw-alert-row,
html[data-theme="dark"] .sw-health-item.muted {
  background: rgba(255,255,255,.03);
}
html[data-theme="dark"] .sw-dash-fleet .sw-fleet-bar { background: #1f2a3d; }

@media (max-width: 1199px) {
  .sw-dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sw-fleet-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
  .sw-dash-grid,
  .sw-dash-grid-bottom { grid-template-columns: 1fr; }
  .sw-dash-hero { flex-direction: column; align-items: flex-start; }
  .sw-dash-hero-meta { justify-content: flex-start; }
}
@media (max-width: 575px) {
  .sw-dash-kpis,
  .sw-pulse-grid,
  .sw-action-grid { grid-template-columns: 1fr; }
}

