:root {
  color-scheme: light;
  --vb-page: #f3f4f6;
  --vb-page-soft: #f3f4f6;
  --vb-surface: #ffffff;
  --vb-surface-solid: #ffffff;
  --vb-surface-muted: #f3f4f6;
  --vb-border: #d1d5db;
  --vb-border-strong: #8a94a2;
  --vb-ink: #1f2937;
  --vb-muted: #475569;
  --vb-subtle: #526174;
  --vb-brand: #c2410c;
  --vb-brand-strong: #9a3412;
  --vb-cyan: #0369a1;
  --vb-success: #166534;
  --vb-warning: #854d0e;
  --vb-danger: #b91c1c;
  --vb-shadow: none;
  --vb-shadow-card: none;
  --vb-focus: 0 0 0 3px #c2410c;
  --vb-success-soft: #f0fdf4;
  --vb-warning-soft: #fffbeb;
  --vb-danger-soft: #fef2f2;
  --vb-brand-soft: #fff7ed;
}

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background:
    var(--vb-page);
  color: var(--vb-ink);
}

::selection {
  background-color: rgba(194, 65, 12, 0.35);
  color: var(--vb-muted);
}

.form-control::placeholder {
  color: var(--vb-muted);
  opacity: 1;
}

.glass-surface {
  background: var(--vb-surface-solid);
  border: 1px solid var(--vb-border);
  box-shadow: none;
  backdrop-filter: none;
}

/* Identity UI theming */
.identity-shell h1, .identity-shell h2, .identity-shell h3 {
  color: var(--vb-muted);
  margin-bottom: 0.65rem;
}

.identity-shell p {
  color: var(--vb-muted);
}

.identity-shell hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0.75rem 0;
}

.identity-shell .row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 0.75rem;
}

.identity-shell .row > [class*="col-"] {
  flex: 1 1 280px;
}

.identity-shell .row > .col-md-3 {
  max-width: 16rem;
}

.identity-shell .row > .col-md-4 {
  max-width: 22rem;
}

.identity-shell .row > .col-md-6 {
  max-width: 32rem;
}

.identity-shell .row > .col-md-9 {
  flex: 2 1 460px;
}

.identity-shell .row section {
  background: var(--vb-surface-solid);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: none;
}

.identity-shell form,
.app-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.identity-shell .form-floating,
.app-form .form-floating {
  position: relative;
  margin-bottom: 0.9rem;
}

.identity-shell .form-control,
.app-form .form-control {
  width: 100%;
  border-radius: 0.9rem;
  border: 1px solid var(--vb-border-strong);
  background-color: var(--vb-surface-solid);
  color: var(--vb-muted);
  padding: 1.35rem 1rem 0.55rem;
  min-height: 3.1rem;
  transition: all 0.15s ease;
}

.identity-shell .form-control:focus,
.app-form .form-control:focus {
  outline: none;
  border-color: var(--vb-border-strong);
  box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.18);
  background-color: var(--vb-surface-solid);
}

.identity-shell .form-control::placeholder,
.app-form .form-control::placeholder {
  color: var(--vb-subtle);
}

.identity-shell .form-floating > label,
.app-form .form-floating > label {
  position: absolute;
  top: 0.32rem;
  left: 1rem;
  color: var(--vb-muted);
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s ease;
  pointer-events: none;
  z-index: 1;
  background-color: #0f172a;
  padding: 0 0.35rem;
  border-radius: 999px;
}

.identity-shell .form-floating > input:focus + label,
.identity-shell .form-floating > textarea:focus + label,
.identity-shell .form-floating > select:focus + label,
.app-form .form-floating > input:focus + label,
.app-form .form-floating > textarea:focus + label,
.app-form .form-floating > select:focus + label {
  color: var(--vb-muted);
}

.identity-shell .form-check,
.app-form .form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.identity-shell .form-check-input,
.app-form .form-check-input {
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid var(--vb-border-strong);
  border-radius: 0.35rem;
  background-color: var(--vb-surface-solid);
  accent-color: var(--vb-brand);
}

.identity-shell .form-check-label,
.identity-shell .form-label,
.app-form .form-check-label,
.app-form .form-label {
  color: var(--vb-muted);
  font-weight: 500;
}

.identity-shell .checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mb-3 { margin-bottom: 0.9rem; }
.mb-4 { margin-bottom: 1.2rem; }
.mt-3 { margin-top: 0.9rem; }
.mt-4 { margin-top: 1.2rem; }
.w-100 { width: 100%; }
.col-md-offset-2 { margin-left: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.75rem 1.1rem;
  border-radius: 0.9rem;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
  /* Keep labels on one line so buttons never look broken; rows use flex-wrap
     to wrap between buttons instead. Long labels ellipsize rather than overflow. */
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  background: var(--vb-brand);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: none;
}

.btn-primary:hover {
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

.btn-danger {
  color: #fff;
  background: var(--vb-danger-soft);
  border-color: rgba(255, 255, 255, 0.08);
}

.btn-sm {
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
}

.btn-link {
  color: #93c5fd;
  background: transparent;
  border: none;
  padding: 0.1rem;
  box-shadow: none;
}

.btn-link:hover {
  color: var(--vb-muted);
  background: transparent;
}

.btn-lg {
  padding: 0.9rem 1.2rem;
  font-size: 1rem;
  border-radius: 0.95rem;
}

.btn-close {
  appearance: none;
  -webkit-appearance: none;
  height: 2rem;
  width: 2rem;
  border: none;
  border-radius: 0.75rem;
  background-color: var(--vb-surface-solid);
  color: var(--vb-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-close::before {
  content: "✕";
  font-size: 0.95rem;
}

.btn-close:hover {
  background-color: var(--vb-surface-solid);
  color: #fff;
}

.text-danger { color: #f87171; }
.text-success { color: #34d399; }
.text-info { color: #67e8f9; }
.text-dark { color: var(--vb-muted); }

.alert {
  border-radius: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.35);
  color: #d1fae5;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fee2e2;
}

.alert-dismissible {
  justify-content: space-between;
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: var(--vb-muted);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.nav-link:hover {
  color: #fff;
}

.identity-nav-link {
  display: block;
  padding: 0.65rem 0.9rem;
  border-radius: 0.9rem;
  color: var(--vb-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--vb-surface-solid);
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.identity-nav-link:hover {
  background: var(--vb-surface-solid);
  border-color: rgba(255, 255, 255, 0.12);
}

.identity-nav-link.active {
  color: #fff;
  background: var(--vb-brand);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  background: var(--vb-surface-solid);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  overflow: hidden;
}

.table th, .table td {
  padding: 0.75rem 0.9rem;
  color: var(--vb-ink);
  border-bottom: 1px solid var(--vb-border);
}

.table th {
  text-align: left;
  color: var(--vb-muted);
  background: var(--vb-surface-muted);
}

.table tr:last-child td {
  border-bottom: none;
}

.tracker-map-canvas {
  min-height: 540px;
  border-radius: 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tracker-map-panel-surface {
  position: relative;
}

.tracker-map-panel-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  border-radius: 1.5rem;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  background: rgba(2, 6, 23, 0.82);
}

.tracker-map-panel-empty.hidden,
.tracker-map-wallboard__empty.hidden {
  display: none !important;
}

.tracker-map-wallboard {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #0f172a;
}

.tracker-map-wallboard__surface {
  position: relative;
  width: 100%;
  height: 100%;
}

.tracker-map-wallboard__canvas,
.tracker-map-wallboard__empty {
  position: absolute;
  inset: 0;
}

.tracker-map-wallboard__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.tracker-map-wallboard__overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  gap: 1rem;
}

.tracker-map-wallboard__panel,
.tracker-map-wallboard__legend {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px -40px rgba(15, 23, 42, 0.95);
}

.tracker-map-wallboard__panel {
  border-radius: 1.5rem;
  padding: 1.1rem 1.2rem;
}

.tracker-map-wallboard__legend {
  align-self: flex-end;
  width: min(360px, calc(100vw - 2rem));
  max-height: min(44vh, 420px);
  border-radius: 1.5rem;
  padding: 1rem 1.1rem;
  overflow: hidden;
}

.tracker-map-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 35px -18px rgba(15, 23, 42, 0.9);
  font-weight: 700;
  color: #fff;
}

.tracker-map-cluster span {
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
}

.tracker-map-cluster--small {
  width: 42px !important;
  height: 42px !important;
  margin-left: -21px !important;
  margin-top: -21px !important;
  font-size: 0.82rem;
}

.tracker-map-cluster--medium {
  width: 48px !important;
  height: 48px !important;
  margin-left: -24px !important;
  margin-top: -24px !important;
  font-size: 0.9rem;
}

.tracker-map-cluster--large {
  width: 56px !important;
  height: 56px !important;
  margin-left: -28px !important;
  margin-top: -28px !important;
  font-size: 1rem;
}

.tracker-map-legend-swatch {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
  border-radius: 9999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.tracker-map-popup {
  min-width: 200px;
}

.tracker-map-popup__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.tracker-map-popup__title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
  color: #0f172a;
}

.tracker-map-popup__meta {
  margin: 0.9rem 0 0;
  display: grid;
  gap: 0.5rem;
}

.tracker-map-popup__meta div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
}

.tracker-map-popup__meta dt {
  color: #475569;
  font-weight: 600;
}

.tracker-map-popup__meta dd {
  margin: 0;
  color: #0f172a;
  text-align: right;
}

@media (max-width: 960px) {
  .tracker-map-wallboard__overlay {
    justify-content: flex-start;
  }

  .tracker-map-wallboard__legend {
    align-self: stretch;
    width: auto;
    max-height: 32vh;
  }
}

/* Shared light theme compatibility layer.
   Many MVC views use Tailwind utilities directly. These overrides keep one
   centralized light theme without rewriting every view in one pass. */
.bg-slate-950,
.bg-slate-950\/90,
.bg-slate-950\/80,
.bg-slate-950\/70,
.bg-slate-950\/60,
.bg-slate-950\/50,
.bg-slate-950\/45,
.bg-slate-950\/40,
.bg-slate-950\/35 {
  background-color: rgba(248, 250, 252, 0.92) !important;
}

.bg-slate-900\/95,
.bg-slate-900\/70,
.bg-slate-900\/60,
.bg-white\/10,
.bg-white\/5 {
  background-color: var(--vb-surface-solid) !important;
}

.bg-brand-500\/10,
.bg-brand-500\/20,
.bg-brand-500\/25,
.bg-brand-500\/30,
.bg-cyan-500\/10,
.bg-cyan-500\/20,
.bg-sky-500\/10,
.bg-sky-500\/20,
.bg-indigo-500\/20,
.bg-fuchsia-500\/20 {
  background-color: rgba(194, 65, 12, 0.08) !important;
}

.bg-emerald-500\/10,
.bg-emerald-500\/15,
.bg-emerald-500\/20 {
  background-color: rgba(4, 120, 87, 0.08) !important;
}

.bg-amber-400\/10,
.bg-amber-500\/10,
.bg-amber-500\/15,
.bg-amber-500\/20 {
  background-color: rgba(180, 83, 9, 0.08) !important;
}

.bg-rose-500\/10,
.bg-rose-500\/15,
.bg-rose-500\/20 {
  background-color: rgba(190, 18, 60, 0.08) !important;
}

.text-white,
.text-slate-100,
.text-slate-200,
.text-slate-300 {
  color: var(--vb-ink) !important;
}

.text-slate-400,
.text-slate-500,
.text-slate-600,
.text-slate-200\/70,
.text-slate-200\/80,
.text-slate-300\/70 {
  color: var(--vb-muted) !important;
}

.text-brand-100,
.text-brand-100\/70,
.text-brand-100\/75,
.text-brand-100\/80,
.text-brand-200,
.text-brand-300,
.text-brand-400,
.hover\:text-brand-100:hover,
.hover\:text-brand-200:hover {
  color: var(--vb-brand-strong) !important;
}

.text-cyan-100,
.text-cyan-200,
.text-cyan-50,
.text-sky-100 {
  color: var(--vb-cyan) !important;
}

.text-emerald-100,
.text-emerald-200,
.text-emerald-300,
.text-emerald-50,
.text-success {
  color: var(--vb-success) !important;
}

.text-amber-100,
.text-amber-200,
.text-amber-300,
.text-amber-50 {
  color: var(--vb-warning) !important;
}

.text-rose-100,
.text-rose-200,
.text-rose-300,
.text-rose-50,
.text-danger {
  color: var(--vb-danger) !important;
}

.border-white\/5,
.border-white\/10,
.border-white\/15,
.border-white\/20,
.border-slate-300\/20,
.divide-white\/5 > :not([hidden]) ~ :not([hidden]),
.divide-white\/10 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--vb-border) !important;
}

.border-brand-300,
.border-brand-300\/30,
.border-brand-300\/40,
.border-brand-400\/20,
.border-brand-400\/40,
.border-brand-400\/50,
.border-cyan-400\/20,
.border-cyan-400\/30,
.border-cyan-400\/40,
.border-sky-400\/30 {
  border-color: rgba(194, 65, 12, 0.18) !important;
}

.rounded-3xl {
  border-radius: 1.15rem !important;
}

.rounded-2xl {
  border-radius: 0.9rem !important;
}

.shadow-card,
.shadow-glow-brand {
  box-shadow: none !important;
}

.btn,
.identity-nav-link,
.table,
.tracker-map-panel-empty,
.tracker-map-wallboard__panel,
.tracker-map-wallboard__legend {
  border-color: var(--vb-border) !important;
}

.btn-primary,
.btn-primary *,
.bg-brand-500,
.bg-brand-500 *,
.bg-rose-500,
.bg-rose-500 * {
  color: #ffffff !important;
}

.btn-primary {
  background: var(--vb-brand) !important;
}

.btn-link {
  color: var(--vb-brand-strong) !important;
}

.identity-shell .row section,
.table {
  background: var(--vb-surface) !important;
  box-shadow: none;
}

.identity-shell .form-control,
.app-form .form-control,
input,
select,
textarea {
  color: var(--vb-ink) !important;
}

.identity-shell .form-control,
.app-form .form-control,
.rounded-xl.border,
.rounded-lg.border {
  background-color: var(--vb-surface-solid) !important;
  border-color: var(--vb-border-strong) !important;
}

.identity-shell .form-floating > label,
.app-form .form-floating > label {
  background-color: #ffffff;
  color: var(--vb-muted);
}

.alert-success {
  color: var(--vb-success);
  background: rgba(4, 120, 87, 0.08);
  border-color: rgba(4, 120, 87, 0.18);
}

.alert-danger {
  color: var(--vb-danger);
  background: rgba(190, 18, 60, 0.08);
  border-color: rgba(190, 18, 60, 0.18);
}

.vb-public-hero {
  background:
    var(--vb-surface-solid);
  border: 1px solid var(--vb-border);
  box-shadow: none;
}

.vb-public-band {
  background: var(--vb-surface-solid);
  border-block: 1px solid rgba(15, 23, 42, 0.07);
}

.vb-soft-grid {
  background-image:
    none;
  background-size: 36px 36px;
}

/* =====================================================================
   Vision BI component layer (Phase 0 foundations)
   Semantic, token-driven components. Authored for the light theme so they
   don't depend on the dark->light override map above. Reserve .btn-primary
   for the single most important action per context; use secondary/ghost
   for everything else.
   ===================================================================== */

/* --- Overflow safety helpers ---------------------------------------- */
/* Apply .vb-min-w-0 to flex/grid children that hold long values (emails,
   IMEIs, API keys, URLs) so they can shrink and truncate instead of
   pushing the layout wide. */
.vb-min-w-0 { min-width: 0; }
.vb-truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vb-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vb-break { overflow-wrap: anywhere; word-break: break-word; }

/* --- Button variants ------------------------------------------------ */
/* Neutral / outline action. Border matches the forced .btn border color so
   we don't fight the !important override; differentiation is via fill. */
.btn-secondary {
  color: var(--vb-ink);
  background: var(--vb-surface-solid);
  border-color: var(--vb-border);
  box-shadow: none;
}
.btn-secondary:hover {
  background: var(--vb-surface-muted);
  border-color: var(--vb-border-strong);
}

/* Low-emphasis action (row-level edit/links). No fill until hover. */
.btn-ghost {
  color: var(--vb-muted);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn-ghost:hover {
  color: var(--vb-ink);
  background: rgba(15, 23, 42, 0.05);
}

/* --- Status badges -------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: currentColor;
  flex: 0 0 auto;
}
.badge--plain::before { display: none; }
.badge--success {
  color: var(--vb-success);
  background: rgba(4, 120, 87, 0.10);
  border-color: rgba(4, 120, 87, 0.22);
}
.badge--warning {
  color: var(--vb-warning);
  background: rgba(180, 83, 9, 0.10);
  border-color: rgba(180, 83, 9, 0.22);
}
.badge--danger {
  color: var(--vb-danger);
  background: rgba(190, 18, 60, 0.10);
  border-color: rgba(190, 18, 60, 0.22);
}
.badge--info {
  color: var(--vb-cyan);
  background: rgba(8, 145, 178, 0.10);
  border-color: rgba(8, 145, 178, 0.22);
}
.badge--brand {
  color: var(--vb-brand-strong);
  background: rgba(194, 65, 12, 0.10);
  border-color: rgba(194, 65, 12, 0.22);
}
.badge--neutral {
  color: var(--vb-muted);
  background: rgba(15, 23, 42, 0.06);
  border-color: var(--vb-border);
}

/* --- Card ----------------------------------------------------------- */
.vb-card {
  background: var(--vb-surface);
  border: 1px solid var(--vb-border);
  border-radius: 1.15rem;
  box-shadow: none;
  overflow-wrap: anywhere;
}

/* --- Empty state ---------------------------------------------------- */
.vb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--vb-border-strong);
  border-radius: 1.15rem;
  color: var(--vb-muted);
}
.vb-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: rgba(194, 65, 12, 0.08);
  color: var(--vb-brand-strong);
}
.vb-empty__title { color: var(--vb-ink); font-weight: 600; }

/* --- Confirmation dialog -------------------------------------------- */
.vb-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.vb-modal-backdrop[hidden] { display: none; }
.vb-modal {
  width: min(440px, 100%);
  background: var(--vb-surface-solid);
  border: 1px solid var(--vb-border);
  border-radius: 1rem;
  box-shadow: var(--vb-shadow);
  padding: 1.35rem 1.35rem 1.15rem;
}
.vb-modal__title { color: var(--vb-ink); font-weight: 600; font-size: 1.05rem; }
.vb-modal__message { margin-top: 0.5rem; color: var(--vb-muted); font-size: 0.9rem; line-height: 1.5; }
.vb-modal__actions { margin-top: 1.35rem; display: flex; justify-content: flex-end; gap: 0.6rem; }

/* --- Busy / loading state ------------------------------------------- */
.is-busy {
  opacity: 1;
  pointer-events: none;
  cursor: progress;
}
.is-busy::after {
  content: "";
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -0.15em;
  animation: vb-spin 0.6s linear infinite;
}
@keyframes vb-spin { to { transform: rotate(360deg); } }

/* Reusable application surfaces and Fleet Dashboard components. */
.vb-card {
  background: var(--vb-surface-solid);
  border: 1px solid var(--vb-border);
  border-radius: 1.15rem;
  box-shadow: none;
}

.vb-card--danger {
  background: var(--vb-danger-soft);
  border-color: rgba(190, 18, 60, 0.2);
}

.vb-eyebrow,
.vb-kpi-card__label {
  color: var(--vb-subtle);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.vb-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--vb-surface-muted);
  border: 1px solid var(--vb-border);
  border-radius: 0.9rem;
  padding: 0.75rem;
}

.vb-field {
  min-height: 2.65rem;
  border: 1px solid var(--vb-border-strong) !important;
  border-radius: 0.7rem !important;
  background: #fff !important;
  color: var(--vb-ink) !important;
  font-size: 0.875rem;
  padding: 0.65rem 0.8rem;
}

.vb-field:focus,
.vb-button:focus-visible,
.vb-path-link:focus-visible,
.vb-tools-menu summary:focus-visible,
.fleet-table th[role="button"]:focus-visible {
  outline: none;
  border-color: var(--vb-brand) !important;
  box-shadow: var(--vb-focus);
}

.vb-button {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  padding: 0.65rem 1rem;
  color: var(--vb-ink);
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.vb-button:hover { transform: translateY(-1px); }
.vb-button--primary { background: var(--vb-brand); color: #fff; box-shadow: none; }
.vb-button--primary:hover { background: var(--vb-brand-strong); }
.vb-button--secondary { background: #fff; border-color: var(--vb-border-strong); }
.vb-button--secondary:hover, .vb-button--secondary.is-active { border-color: rgba(194, 65, 12, 0.45); background: var(--vb-brand-soft); color: var(--vb-brand-strong); }
.vb-button--ghost { background: transparent; color: var(--vb-muted); }
.vb-button--ghost:hover { background: #fff; color: var(--vb-ink); }
.vb-button:disabled { cursor: not-allowed; opacity: 0.45; transform: none; transition: none !important; }

.fleet-dashboard__header { padding: clamp(1.25rem, 3vw, 2rem); }
.fleet-dashboard__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.fleet-dashboard__heading h1 { margin-top: 0.35rem; color: var(--vb-ink); font-size: clamp(1.8rem, 4vw, 2.35rem); font-weight: 650; letter-spacing: -0.035em; }
.fleet-dashboard__intro { max-width: 52rem; margin-top: 0.55rem; color: var(--vb-muted); font-size: 0.9rem; line-height: 1.6; }
.vb-freshness { display: flex; align-items: center; gap: 0.55rem; flex: 0 0 auto; margin-top: 0.25rem; color: var(--vb-muted); font-size: .8125rem; }
.vb-freshness__dot { width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--vb-success); box-shadow: none; }
.vb-freshness__divider { width: 1px; height: 1rem; background: var(--vb-border-strong); }
.fleet-dashboard__controls { justify-content: space-between; margin-top: 1.25rem; }
.fleet-dashboard__scope-form { display: flex; align-items: end; gap: 0.6rem; }
.fleet-dashboard__scope-form label { align-self: center; color: var(--vb-muted); font-size: 14px; font-weight: 650; }
.fleet-dashboard__scope-form .vb-field { min-width: min(17rem, 42vw); }

.fleet-dashboard__paths { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; margin-top: 1rem; }
.vb-path-link, .vb-tools-menu summary { display: inline-flex; min-height: 2.35rem; align-items: center; gap: 0.65rem; border: 1px solid transparent; border-radius: 0.65rem; padding: 0.5rem 0.7rem; color: var(--vb-muted); cursor: pointer; font-size: .8125rem; font-weight: 650; transition: background-color 150ms ease, color 150ms ease; }
.vb-path-link span { color: var(--vb-muted); }
.vb-path-link:hover, .vb-tools-menu summary:hover { background: var(--vb-surface-muted); color: var(--vb-brand-strong); }
.vb-tools-menu { position: relative; }
.vb-tools-menu__panel { position: absolute; z-index: 20; right: 0; display: grid; min-width: 14rem; gap: 0.25rem; margin-top: 0.4rem; padding: 0.5rem; background: #fff; border: 1px solid var(--vb-border); border-radius: 0.75rem; box-shadow: none; }
.vb-tools-menu__panel a { border-radius: 0.5rem; padding: 0.6rem 0.7rem; color: var(--vb-muted); font-size: .8125rem; }
.vb-tools-menu__panel a:hover { background: var(--vb-surface-muted); color: var(--vb-ink); }

.fleet-kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.vb-kpi-card { position: relative; display: flex; min-height: 10.5rem; flex-direction: column; overflow: hidden; padding: 1.25rem; background: #fff; border: 1px solid var(--vb-border); border-radius: 1rem; box-shadow: none; }
.vb-kpi-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #94a3b8; }
.vb-kpi-card[data-tone="success"] { background: var(--vb-surface-solid); border-color: rgba(4, 120, 87, 0.18); }
.vb-kpi-card[data-tone="success"]::before { background: var(--vb-success); }
.vb-kpi-card[data-tone="warning"] { background: var(--vb-surface-solid); border-color: rgba(180, 83, 9, 0.18); }
.vb-kpi-card[data-tone="warning"]::before { background: var(--vb-warning); }
.vb-kpi-card[data-tone="brand"] { background: var(--vb-surface-solid); border-color: rgba(194, 65, 12, 0.18); }
.vb-kpi-card[data-tone="brand"]::before { background: var(--vb-brand); }
.vb-kpi-card__value { margin-top: 0.45rem; color: var(--vb-ink); font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.045em; line-height: 1.15; overflow-wrap: anywhere; }
.vb-kpi-card__support { margin-top: 0.5rem; color: var(--vb-ink); font-size: 0.875rem; font-weight: 600; }
.vb-kpi-card__meta, .vb-trend { margin-top: auto; padding-top: 0.75rem; color: var(--vb-muted); font-size: .8125rem; line-height: 1.4; }
.vb-trend { display: flex; align-items: center; gap: 0.4rem; font-weight: 600; }
.vb-trend span::before { content: "→"; }
.vb-trend[data-direction="up"] span::before { content: "↗"; color: var(--vb-success); }
.vb-trend[data-direction="down"] span::before { content: "↘"; color: var(--vb-danger); }

.fleet-risk-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(18rem, 0.75fr); align-items: start; gap: 1.25rem; }
.fleet-risk-grid > .vb-card { padding: 1.5rem; }
.fleet-impact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1.25rem; }
.vb-impact-metric { min-width: 0; padding: 1rem; background: var(--vb-surface-solid); border: 1px solid rgba(190, 18, 60, 0.16); border-radius: 0.8rem; }
.vb-impact-metric p:last-child { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.vb-assessment-row { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--vb-border); border-radius: 0.75rem; padding: 0.75rem 0.9rem; color: var(--vb-ink); background: #fff; }
.vb-assessment-row[data-tone="danger"] { color: #9f1239; background: var(--vb-danger-soft); border-color: rgba(190, 18, 60, 0.22); }
.vb-assessment-row[data-tone="critical"], .vb-assessment-row[data-tone="warning"] { color: #92400e; background: var(--vb-warning-soft); border-color: rgba(180, 83, 9, 0.2); }
.vb-assessment-row[data-tone="monitor"] { color: #065f46; background: var(--vb-success-soft); border-color: rgba(4, 120, 87, 0.2); }
.vb-assessment-row[data-total="true"] { margin-top: 0.75rem; border-top-width: 2px; font-weight: 700; }

.fleet-report { overflow: hidden; }
.fleet-report__header { padding: 1.5rem; border-bottom: 1px solid var(--vb-border); }
.fleet-report__facts { display: grid; min-width: 26rem; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.vb-inline-stat { padding: 0.65rem 0.8rem; background: var(--vb-surface-muted); border: 1px solid var(--vb-border); border-radius: 0.7rem; color: var(--vb-muted); font-size: .8125rem; line-height: 1.45; }
.fleet-report__toolbar { justify-content: space-between; margin-top: 1.25rem; }
.fleet-report__filter-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem; }
.fleet-report__search { min-width: min(18rem, 100%); }
.vb-filter-status, .vb-refresh-status { color: var(--vb-muted); font-size: .8125rem; white-space: nowrap; }
.vb-filter-status[data-active="true"] { color: var(--vb-brand-strong); font-weight: 650; }
.vb-exposure { display: flex; flex: 0 0 auto; flex-direction: column; border-left: 1px solid var(--vb-border-strong); padding: 0.1rem 0.5rem 0.1rem 1rem; }
.vb-exposure span { color: var(--vb-subtle); font-size: .8125rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.vb-exposure strong { color: var(--vb-brand-strong); font-size: 1rem; font-variant-numeric: tabular-nums; }

.fleet-table-wrap { max-width: 100%; overflow: auto; }
.fleet-table { width: 100%; min-width: 72rem; border-collapse: separate; border-spacing: 0; color: var(--vb-ink); font-size: 0.82rem; text-align: left; }
.fleet-table thead { position: sticky; top: 0; z-index: 5; background: #f8fafc; color: var(--vb-muted); font-size: .8125rem; letter-spacing: 0.06em; text-transform: uppercase; }
.fleet-table th, .fleet-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--vb-border); vertical-align: middle; }
.fleet-table th { white-space: nowrap; }
.fleet-table th[role="button"]::after { content: "↕"; display: inline-block; margin-left: 0.35rem; color: var(--vb-muted); font-size: .8125rem; }
.fleet-table th[data-sort-direction="asc"]::after { content: "↑"; color: var(--vb-brand); }
.fleet-table th[data-sort-direction="desc"]::after { content: "↓"; color: var(--vb-brand); }
.fleet-table tbody tr { background: #fff; transition: background-color 120ms ease; }
.fleet-table tbody tr:hover { background: #f8fafc; }
.fleet-table tbody tr[data-tone="danger"] { background: rgba(255, 241, 242, 0.62); }
.fleet-table tbody tr[data-tone="danger"]:hover { background: #fff1f2; }
.fleet-table td.text-right, .fleet-table th.text-right { font-variant-numeric: tabular-nums; }
.vb-badge { display: inline-flex; align-items: center; border: 1px solid var(--vb-border); border-radius: 999px; padding: 0.3rem 0.65rem; background: var(--vb-surface-muted); color: var(--vb-muted); font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.vb-badge[data-tone="danger"] { background: var(--vb-danger-soft); border-color: rgba(190, 18, 60, 0.22); color: #9f1239; }
.vb-badge[data-tone="critical"], .vb-badge[data-tone="warning"] { background: var(--vb-warning-soft); border-color: rgba(180, 83, 9, 0.2); color: #92400e; }
.vb-badge[data-tone="monitor"] { background: var(--vb-success-soft); border-color: rgba(4, 120, 87, 0.2); color: #065f46; }

@media (max-width: 1023px) {
  .fleet-risk-grid { grid-template-columns: 1fr; }
  .fleet-report__facts { min-width: 0; }
  .fleet-report__toolbar { align-items: stretch; flex-direction: column; }
  .vb-exposure { border-top: 1px solid var(--vb-border-strong); border-left: 0; padding: 0.75rem 0 0; }
}

@media (max-width: 767px) {
  .fleet-dashboard__heading { flex-direction: column; gap: 0.75rem; }
  .vb-freshness { flex-wrap: wrap; }
  .fleet-dashboard__controls, .fleet-dashboard__scope-form { align-items: stretch; flex-direction: column; }
  .fleet-dashboard__scope-form label { align-self: flex-start; }
  .fleet-dashboard__scope-form .vb-field { min-width: 0; width: 100%; }
  .fleet-dashboard__controls form:last-child .vb-button { width: 100%; }
  .fleet-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fleet-impact-grid, .fleet-report__facts { grid-template-columns: 1fr; }
  .fleet-report__filter-controls { align-items: stretch; flex-direction: column; }
  .fleet-report__filter-controls > * { width: 100%; }
  .vb-filter-status, .vb-refresh-status { white-space: normal; }
}

@media (max-width: 479px) {
  .fleet-kpi-grid { grid-template-columns: 1fr; }
  .vb-kpi-card { min-height: 9.5rem; }
  .fleet-dashboard__paths { align-items: stretch; flex-direction: column; }
  .vb-path-link, .vb-tools-menu, .vb-tools-menu summary { width: 100%; }
  .vb-tools-menu__panel { position: static; }
}

.sim-cost-dashboard__filters { align-items: end; flex-wrap: wrap; margin-top: 1.25rem; }
.sim-cost-dashboard__filters > div { display: flex; flex-direction: column; gap: 0.3rem; }
.sim-cost-dashboard__filters label { color: var(--vb-muted); font-size: 14px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.sim-cost-dashboard__account-filter { flex: 1 1 15rem; }
.sim-cost-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.sim-cost-warning { padding: 0.8rem 1rem; border: 1px solid rgba(180, 83, 9, 0.22); border-radius: 0.8rem; background: var(--vb-warning-soft); color: #92400e; font-size: 0.82rem; }
.sim-cost-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.sim-cost-section-heading h2, .sim-cost-dashboard .fleet-report__header h2 { margin-top: 0.35rem; color: var(--vb-ink); font-size: 1.25rem; font-weight: 650; letter-spacing: -0.02em; }
.sim-cost-section-heading p, .sim-cost-section-copy { margin-top: 0.35rem; color: var(--vb-muted); font-size: 0.82rem; }
.sim-cost-section-heading .vb-field { min-width: min(22rem, 40vw); }
.sim-cost-table td { white-space: nowrap; }
.sim-cost-table td:nth-child(7) { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1023px) {
  .sim-cost-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim-cost-section-heading { align-items: stretch; flex-direction: column; }
  .sim-cost-section-heading .vb-field { min-width: 0; width: 100%; }
}

@media (max-width: 639px) {
  .sim-cost-dashboard__filters { align-items: stretch; flex-direction: column; }
  .sim-cost-dashboard__filters > *, .sim-cost-dashboard__filters .vb-field { width: 100%; }
  .sim-cost-kpis { grid-template-columns: 1fr; }
}

/* Shared interaction states. All app surfaces use the semantic light-theme tokens. */
html { color-scheme: light; }
::selection { background: #fed7aa; color: var(--vb-ink); }
:where(input, select, textarea)::placeholder { color: var(--vb-subtle) !important; opacity: 1; }
:where(input, select, textarea) { accent-color: var(--vb-brand); }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--vb-brand); outline-offset: 3px; }
:where(.workspace-main) a:not(.btn):hover { text-decoration: underline; text-underline-offset: 3px; }
.btn.btn-primary, .workspace-main button.primary, .identity-nav-link.active {
  background: var(--vb-brand) !important; border-color: var(--vb-brand) !important; color: #fff !important; box-shadow: none;
}
.btn.btn-primary:hover, .workspace-main button.primary:hover { background: var(--vb-brand-strong) !important; border-color: var(--vb-brand-strong) !important; }
.btn.btn-primary *, .identity-nav-link.active * { color: #fff !important; }
.btn.btn-danger { background: var(--vb-danger-soft) !important; color: var(--vb-danger) !important; border-color: var(--vb-danger) !important; }
.btn.btn-danger:hover { background: #fee2e2 !important; }
.btn.btn-secondary { background: var(--vb-surface-solid); color: var(--vb-ink); border-color: var(--vb-border-strong) !important; }
.btn.btn-secondary:hover { background: var(--vb-surface-muted); }
.btn:disabled, button:disabled, .btn[aria-disabled=true] { opacity: 1 !important; background: #e5e7eb !important; color: var(--vb-muted) !important; border-color: var(--vb-border-strong) !important; cursor: not-allowed; box-shadow: none; transition: none !important; }
.btn:disabled *, button:disabled * { color: var(--vb-muted) !important; transition: none !important; }
.badge--neutral { color: var(--vb-muted); background: var(--vb-surface-muted); border-color: var(--vb-border); }
.badge--success { color: var(--vb-success); background: var(--vb-success-soft); border-color: #86b99a; }
.badge--warning { color: var(--vb-warning); background: var(--vb-warning-soft); border-color: #c8a265; }
.badge--danger { color: var(--vb-danger); background: var(--vb-danger-soft); border-color: #dc9a9a; }
.table td { color: var(--vb-ink); font-size: 14px; }
.table th { color: var(--vb-muted); font-size: 13px; font-weight: 650; background: var(--vb-surface-muted); }
.table tbody tr:hover { background: #f9fafb; }
.user-table { min-width: 1000px; }
.user-table th:nth-child(1) { width: 24%; min-width: 230px; }
.user-table th:nth-child(2) { width: 17%; min-width: 160px; }
.user-table th:nth-child(3) { width: 29%; min-width: 250px; }
.user-table th:nth-child(4) { min-width: 100px; }
.user-table th:last-child { min-width: 290px; }
.user-table td:last-child form { margin: 0; }
.user-table .btn { min-height: 44px; white-space: nowrap; }
.user-management .shadow-card { box-shadow: none !important; }
.user-management .table { border: 0; }
.user-management .table td, .user-management .table th { padding: 18px 16px; }
.workspace-main, .workspace-body { min-width: 0; }
.workspace-main :where(.overflow-x-auto, .table-wrap) { max-width: 100%; }
.workspace-main :where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea) { border-color: var(--vb-border-strong); font-size: 16px; min-height: 44px; }
.workspace-main :where(label) { font-size: 14px; }
.workspace-main :where(small, .text-xs) { font-size: 13px; }
.workspace-main :where(.btn), .workspace-header :where(button, .btn) { min-height: 44px; font-size: 14px; }
/* Legacy hover utilities must remain readable on light surfaces. */
.hover\:text-white:hover, .hover\:text-slate-100:hover, .hover\:text-slate-200:hover, .hover\:text-slate-300:hover { color: var(--vb-ink) !important; }
.hover\:text-rose-200:hover { color: var(--vb-danger) !important; }
.btn.btn-primary:hover, .btn.btn-primary:hover * { color: #fff !important; }
.btn.btn-primary:disabled, .btn.btn-primary:disabled:hover { color: var(--vb-muted) !important; background: #e5e7eb !important; transition: none !important; }

/* Floating labels retain their own vertical space when an input contains text. */
.workspace-main .identity-shell .form-floating > .form-control,
.workspace-main .app-form .form-floating > .form-control {
  min-height: 64px; padding: 1.6rem .875rem .5rem; line-height: 1.5;
}
.identity-shell .form-floating > label, .app-form .form-floating > label {
  top: .5rem; left: .875rem; padding: 0; line-height: 1.2; background: transparent; font-size: 14px;
}
.input-validation-error, .form-control.is-invalid { border-color: var(--vb-danger) !important; }
.field-validation-error, .validation-summary-errors { color: var(--vb-danger); }
.btn.btn-primary[aria-disabled=true], .btn.btn-primary[aria-disabled=true]:hover {
  color: var(--vb-muted) !important; background: #e5e7eb !important; border-color: var(--vb-border-strong) !important; transition: none !important;
}
.workspace-main :is(a, button, input, select, textarea, summary):focus-visible,
.workspace-header :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--vb-brand); outline-offset: 3px; box-shadow: none;
}
