/* App-level styles — design tokens live in css/icaap/dispatch-ui.css */

/* ─── Buttons ────────────────────────────────────────────────────────────── */

/* Base button reset for all .btn */
.dispatch-shell .page-content .btn,
.dispatch-auth .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
}

/* Primary */
.dispatch-shell .page-content .btn-primary,
.dispatch-auth .btn-primary {
  background: var(--color-brand-600) !important;
  border-color: var(--color-brand-600) !important;
  color: #fff !important;
}

.dispatch-shell .page-content .btn-primary:hover,
.dispatch-auth .btn-primary:hover {
  background: #4338ca !important;
  border-color: #4338ca !important;
  color: #fff !important;
}

/* Secondary */
.dispatch-shell .page-content .btn-secondary,
.dispatch-auth .btn-secondary {
  background: var(--surface-card) !important;
  border-color: var(--border-default) !important;
  color: var(--color-neutral-700) !important;
}

.dispatch-shell .page-content .btn-secondary:hover,
.dispatch-auth .btn-secondary:hover {
  background: var(--surface-muted) !important;
  border-color: var(--border-strong) !important;
  color: var(--color-neutral-900) !important;
}

/* Outline-primary (treated as secondary) */
.dispatch-shell .page-content .btn-outline-primary,
.dispatch-auth .btn-outline-primary {
  background: var(--surface-card) !important;
  border-color: var(--color-brand-600) !important;
  color: var(--color-brand-600) !important;
}

.dispatch-shell .page-content .btn-outline-primary:hover,
.dispatch-auth .btn-outline-primary:hover {
  background: var(--color-brand-50) !important;
  color: var(--color-brand-600) !important;
}

/* Outline-secondary (ghost style) */
.dispatch-shell .page-content .btn-outline-secondary,
.dispatch-auth .btn-outline-secondary {
  background: transparent !important;
  border-color: var(--border-default) !important;
  color: var(--color-neutral-700) !important;
}

.dispatch-shell .page-content .btn-outline-secondary:hover,
.dispatch-auth .btn-outline-secondary:hover {
  background: var(--surface-muted) !important;
  border-color: var(--border-strong) !important;
  color: var(--color-neutral-900) !important;
}

/* Danger */
.dispatch-shell .page-content .btn-danger,
.dispatch-auth .btn-danger {
  background: var(--color-danger-600) !important;
  border-color: var(--color-danger-600) !important;
  color: #fff !important;
}

.dispatch-shell .page-content .btn-danger:hover,
.dispatch-auth .btn-danger:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
  color: #fff !important;
}

/* Outline-danger */
.dispatch-shell .page-content .btn-outline-danger,
.dispatch-auth .btn-outline-danger {
  background: transparent !important;
  border-color: var(--color-danger-600) !important;
  color: var(--color-danger-600) !important;
}

.dispatch-shell .page-content .btn-outline-danger:hover,
.dispatch-auth .btn-outline-danger:hover {
  background: var(--color-danger-50) !important;
}

/* Success */
.dispatch-shell .page-content .btn-success,
.dispatch-auth .btn-success {
  background: var(--color-success-600) !important;
  border-color: var(--color-success-600) !important;
  color: #fff !important;
}

.dispatch-shell .page-content .btn-success:hover,
.dispatch-auth .btn-success:hover {
  background: #15803d !important;
  border-color: #15803d !important;
}

/* Ghost / icon-only buttons */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-neutral-500);
  height: 32px;
  width: 32px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s,
    color 0.15s;
  cursor: pointer;
}

.btn-ghost:hover {
  background: var(--surface-muted);
  color: var(--color-neutral-900);
}

/* Row action dropdowns */
.dispatch-shell .col-actions {
  width: 1%;
  white-space: nowrap;
}

.dispatch-shell .row-action-menu {
  display: inline-flex;
  justify-content: flex-end;
}

.dispatch-shell .page-content .row-action-toggle {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
}

.dispatch-shell .row-action-dropdown {
  min-width: 180px;
  padding: 4px 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.dispatch-shell .row-action-dropdown form {
  margin: 0;
}

.dispatch-shell .row-action-dropdown .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  width: 100%;
  padding: 7px 14px;
  border: 0;
  background: transparent;
  color: var(--color-neutral-700);
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
}

.dispatch-shell .row-action-dropdown .dropdown-item:hover,
.dispatch-shell .row-action-dropdown .dropdown-item:focus {
  background: var(--surface-muted);
  color: var(--color-neutral-900);
}

.dispatch-shell .row-action-dropdown .dropdown-item.text-danger:hover,
.dispatch-shell .row-action-dropdown .dropdown-item.text-danger:focus {
  background: var(--color-danger-50);
  color: var(--color-danger-600) !important;
}

.dispatch-shell .row-action-dropdown .dropdown-control {
  padding: 6px 14px;
}

.dispatch-shell .row-action-dropdown .form-control,
.dispatch-shell .row-action-dropdown .form-select {
  width: 100%;
  min-width: 180px;
}

.dispatch-shell .table-responsive.row-actions-open,
.dispatch-shell .data-table-wrap.row-actions-open {
  overflow: visible;
}

/* Small button modifier */
.dispatch-shell .btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

/* Page header action buttons */
.dispatch-shell .page-content .page-header-actions .btn,
.dispatch-shell .page-content .app-page-actions .btn {
  height: 36px;
}

/* ─── Form Controls ──────────────────────────────────────────────────────── */

.dispatch-shell .form-control,
.dispatch-shell .form-select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-neutral-900);
  background: var(--surface-card);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  box-shadow: none;
}

.dispatch-shell textarea.form-control {
  height: auto;
  padding: 8px 12px;
}

.dispatch-shell .form-control:focus,
.dispatch-shell .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  outline: none;
}

.dispatch-shell .form-control::placeholder {
  color: var(--color-neutral-400);
}

.dispatch-shell .form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-neutral-700);
  margin-bottom: 6px;
}

.dispatch-shell .form-text {
  font-size: 12px;
  color: var(--color-neutral-500);
}

.dispatch-shell .form-check-input:checked {
  background-color: var(--color-brand-600);
  border-color: var(--color-brand-600);
}

/* Input group */
.dispatch-shell .input-group .input-group-text {
  background: var(--surface-muted);
  border-color: var(--border-default);
  color: var(--color-neutral-500);
  font-size: 13px;
}

/* ─── Status Badges (semantic) ───────────────────────────────────────────── */

.badge-active,
.badge-complete,
.badge-paid,
.badge-approved,
.badge-won {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: var(--color-success-50);
  color: var(--color-success-600);
}

.badge-pending,
.badge-draft,
.badge-in-progress,
.badge-partial {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: var(--color-warning-50);
  color: var(--color-warning-600);
}

.badge-cancelled,
.badge-overdue,
.badge-rejected,
.badge-lost {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: var(--color-danger-50);
  color: var(--color-danger-600);
}

.badge-sent,
.badge-en-route,
.badge-info {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: var(--color-info-50);
  color: var(--color-info-600);
}

.badge-new,
.badge-unassigned,
.badge-inactive {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: var(--color-neutral-100);
  color: var(--color-neutral-700);
}

/* Bootstrap .badge overrides — keep Bootstrap badge but restyle */
.dispatch-shell .badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  letter-spacing: 0.3px;
}

.dispatch-shell .badge.bg-success,
.dispatch-shell .badge.text-bg-success {
  background: var(--color-success-50) !important;
  color: var(--color-success-600) !important;
}
.dispatch-shell .badge.bg-warning,
.dispatch-shell .badge.text-bg-warning {
  background: var(--color-warning-50) !important;
  color: var(--color-warning-600) !important;
}
.dispatch-shell .badge.bg-danger,
.dispatch-shell .badge.text-bg-danger {
  background: var(--color-danger-50) !important;
  color: var(--color-danger-600) !important;
}
.dispatch-shell .badge.bg-info,
.dispatch-shell .badge.text-bg-info {
  background: var(--color-info-50) !important;
  color: var(--color-info-600) !important;
}
.dispatch-shell .badge.bg-primary,
.dispatch-shell .badge.text-bg-primary {
  background: var(--color-brand-50) !important;
  color: var(--color-brand-600) !important;
}
.dispatch-shell .badge.bg-secondary,
.dispatch-shell .badge.text-bg-secondary,
.dispatch-shell .badge.text-bg-light,
.dispatch-shell .badge.bg-light {
  background: var(--color-neutral-100) !important;
  color: var(--color-neutral-700) !important;
}

/* ─── Toast / Alert Notifications ───────────────────────────────────────── */

.app-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 360px;
  max-width: calc(100vw - 32px);
}

.app-toast {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--color-neutral-400);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px 14px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  animation: toastIn 0.2s ease;
}

.app-toast.toast-success {
  border-left-color: var(--color-success-600);
}
.app-toast.toast-warning {
  border-left-color: var(--color-warning-600);
}
.app-toast.toast-danger {
  border-left-color: var(--color-danger-600);
}
.app-toast.toast-info {
  border-left-color: var(--color-info-600);
}

.app-toast-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.app-toast.toast-success .app-toast-icon {
  color: var(--color-success-600);
}
.app-toast.toast-warning .app-toast-icon {
  color: var(--color-warning-600);
}
.app-toast.toast-danger .app-toast-icon {
  color: var(--color-danger-600);
}
.app-toast.toast-info .app-toast-icon {
  color: var(--color-info-600);
}

.app-toast-body {
  flex: 1;
  min-width: 0;
}

.app-toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-neutral-900);
  margin-bottom: 2px;
}

.app-toast-message {
  font-size: 13px;
  color: var(--color-neutral-500);
}

.app-toast-close {
  background: none;
  border: none;
  color: var(--color-neutral-400);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
}

.app-toast-close:hover {
  color: var(--color-neutral-700);
}

.app-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--color-neutral-200);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

.app-toast-progress-bar {
  height: 100%;
  background: currentColor;
  animation: toastProgress 5s linear forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

/* Standard Bootstrap alerts — restyle */
.dispatch-shell .alert,
.dispatch-auth .alert {
  border-radius: var(--radius-md);
  font-size: 14px;
  border-left-width: 4px;
}

.dispatch-shell .alert:empty,
.dispatch-auth .alert:empty {
  display: none;
}

/* Keep Bootstrap dialogs above shell drawers, topbar menus, and page overlays. */
.dispatch-shell .modal-backdrop {
  z-index: 1050;
}

.dispatch-shell .modal {
  z-index: 1055;
}

.dispatch-shell .modal-dialog {
  pointer-events: auto;
}

/* ─── Dispatch Board ─────────────────────────────────────────────────────── */

.dispatch-board-content {
  padding: 0 28px 0 34px;
  min-width: 0;
}

.dispatch-board-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.dispatch-board-toolbar {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-areas:
    "views actions"
    "create create";
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.dispatch-view-tabs {
  grid-area: views;
}

.dispatch-board-actions {
  display: inline-flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 0;
  flex: 1 1 auto;
  min-width: 0;
  grid-area: actions;
}

.dispatch-board-create-actions {
  grid-area: create;
  justify-content: flex-start;
  margin-left: 0;
  width: 100%;
}

.dispatch-board-actions > .dispatch-tool-button,
.dispatch-board-create-action {
  min-height: 36px;
}

.dispatch-tool-button.active {
  background: var(--color-brand-50) !important;
  border-color: rgba(79, 70, 229, 0.35) !important;
  color: var(--color-brand-600) !important;
}

.dispatch-queue-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-brand-600) !important;
  border-color: var(--color-brand-600) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.28) !important;
}

.dispatch-queue-button:hover,
.dispatch-queue-button:focus-visible {
  background: #4338ca !important;
  border-color: #4338ca !important;
  color: #fff !important;
}

.dispatch-queue-button i,
.dispatch-queue-button .badge {
  color: inherit !important;
}

.dispatch-queue-button .badge {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.22);
}

.dispatch-view-tabs {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-card);
  box-shadow: var(--shadow-xs);
}

.dispatch-view-tab {
  align-items: center;
  border: 0;
  border-right: 1px solid var(--border-default);
  background: var(--surface-card);
  color: var(--color-neutral-700);
  display: inline-flex;
  gap: 7px;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  min-height: 36px;
  padding: 0 16px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.dispatch-view-tab:last-child {
  border-right: 0;
}

.dispatch-view-tab.active {
  background: var(--color-brand-600);
  color: #fff;
}

.dispatch-view-tab:not(.active):hover {
  background: var(--surface-muted);
  color: var(--color-neutral-900);
}

.dispatch-board-filters {
  margin-bottom: 0;
}

.dispatch-board-filters[hidden],
.dispatch-summary-panel[hidden] {
  display: none !important;
}

.module-dashboard-shell {
  display: grid;
  gap: 14px;
}

.module-kpi-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.module-kpi-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  color: var(--color-neutral-800);
  display: grid;
  gap: 6px;
  min-height: 96px;
  overflow: hidden;
  padding: 12px;
  position: relative;
  text-decoration: none !important;
}

.module-kpi-card:hover {
  border-color: var(--color-neutral-300);
  color: var(--color-neutral-900);
  text-decoration: none !important;
}

.module-kpi-accent {
  background: var(--color-neutral-300);
  height: 2px;
  inset: 0 0 auto;
  position: absolute;
}

.module-kpi-card.tone-info .module-kpi-accent {
  background: var(--color-info-500);
}
.module-kpi-card.tone-accent .module-kpi-accent {
  background: var(--color-brand-600);
}
.module-kpi-card.tone-money .module-kpi-accent {
  background: var(--color-success-500);
}
.module-kpi-card.tone-warning .module-kpi-accent {
  background: var(--color-warning-500);
}
.module-kpi-card.tone-danger .module-kpi-accent {
  background: var(--color-danger-500);
}

.module-kpi-top,
.module-kpi-bottom {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.module-kpi-label {
  color: var(--color-neutral-500);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.module-kpi-icon {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--color-neutral-600);
  display: inline-flex;
  flex: 0 0 auto;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.module-kpi-value {
  color: var(--color-neutral-950);
  font-size: 24px;
  font-weight: 850;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-kpi-bottom {
  margin-top: auto;
}

.module-kpi-bottom span {
  color: var(--color-neutral-500);
  font-size: 11px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-kpi-bottom b {
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--color-neutral-700);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
}

.module-panel-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.module-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
}

.module-panel-head {
  align-items: center;
  border-bottom: 1px solid var(--border-default);
  display: grid;
  gap: 10px;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  min-height: 62px;
  padding: 12px 14px;
}

.module-panel-icon {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  color: var(--color-neutral-600);
  display: inline-flex;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.module-panel-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.module-panel-title strong,
.module-panel-title small,
.module-panel-link {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-panel-title strong {
  color: var(--color-neutral-950);
  font-size: 15px;
  font-weight: 850;
}

.module-panel-title small {
  color: var(--color-neutral-500);
  font-size: 12px;
}

.module-panel-link {
  color: var(--color-brand-600);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none !important;
}

.module-table-wrap {
  overflow-x: auto;
}

.module-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
}

.module-table th,
.module-table td {
  border-bottom: 1px solid var(--border-default);
  padding: 9px 12px;
  vertical-align: middle;
}

.module-table th {
  background: var(--surface-muted);
  color: var(--color-neutral-500);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.module-table td {
  color: var(--color-neutral-700);
  font-size: 13px;
  height: 44px;
}

.module-table tbody tr:last-child td {
  border-bottom: 0;
}

.module-table tbody tr.is-clickable {
  cursor: pointer;
}

.module-table tbody tr.is-clickable:hover {
  background: rgba(99, 102, 241, 0.04);
}

.module-table span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-decoration: none !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-table .align-center {
  text-align: center;
}
.module-table .align-right {
  text-align: right;
}
.module-table .is-strong span {
  color: var(--color-neutral-950);
  font-weight: 850;
}
.module-table .is-muted span {
  color: var(--color-neutral-400);
}

.module-chip {
  border: 1px solid var(--border-default);
  border-radius: 999px;
  display: inline-block !important;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  max-width: 100%;
  padding: 5px 8px;
  text-align: center;
}

.module-chip.tone-default {
  background: var(--surface-muted);
  color: var(--color-neutral-700);
}
.module-chip.tone-info {
  background: var(--color-info-50);
  border-color: rgba(59, 130, 246, 0.22);
  color: var(--color-info-600);
}
.module-chip.tone-warning {
  background: var(--color-warning-50);
  border-color: rgba(245, 158, 11, 0.26);
  color: var(--color-warning-600);
}
.module-chip.tone-danger {
  background: var(--color-danger-50);
  border-color: rgba(239, 68, 68, 0.24);
  color: var(--color-danger-600);
}
.module-chip.tone-money {
  background: var(--color-success-50);
  border-color: rgba(34, 197, 94, 0.24);
  color: var(--color-success-600);
}

.module-row-action {
  color: var(--color-brand-600);
  font-size: 12px;
  font-weight: 850;
}

.module-empty {
  align-items: center;
  color: var(--color-neutral-500);
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 140px;
  padding: 28px 16px;
  text-align: center;
}

.module-empty span {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  color: var(--color-neutral-500);
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.module-empty strong {
  color: var(--color-neutral-800);
  font-size: 14px;
}

.module-empty small {
  color: var(--color-neutral-500);
  font-size: 12px;
}

.dispatch-status-filter {
  width: 100%;
}

.dispatch-status-select-wrap {
  align-items: center;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  width: 100%;
}

.dispatch-status-select-wrap .dispatch-status-dot {
  grid-column: 1;
  grid-row: 1;
  margin-left: 8px;
  pointer-events: none;
  z-index: 1;
}

.dispatch-status-select {
  grid-column: 1 / -1;
  grid-row: 1;
  padding-left: 30px;
}

.dispatch-status-filter-button {
  align-items: center;
  display: flex !important;
  gap: 8px;
  justify-content: flex-start;
  line-height: 1.2;
  text-align: left;
}

.dispatch-status-menu {
  min-width: 220px;
}

.dispatch-status-option {
  align-items: center;
  display: flex;
  gap: 9px;
}

.dispatch-status-dot {
  border-radius: 999px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.14);
}

.dispatch-status-dot.status-unscheduled {
  background: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.14);
}
.dispatch-status-dot.status-scheduled {
  background: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.dispatch-status-dot.status-assigned {
  background: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}
.dispatch-status-dot.status-en-route {
  background: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}
.dispatch-status-dot.status-on-site {
  background: #047857;
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.14);
}
.dispatch-status-dot.status-paused {
  background: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14);
}
.dispatch-status-dot.status-followup-required {
  background: #b45309;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.14);
}
.dispatch-status-dot.status-completed {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14);
}
.dispatch-status-dot.status-no-show {
  background: #6b7280;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.14);
}
.dispatch-status-dot.status-cancelled {
  background: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.dispatch-summary-panel,
.dispatch-grid-wrap,
.dispatch-drawer {
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.dispatch-summary-panel {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 360px;
  gap: 12px;
  padding: 12px;
  border-top: 3px solid var(--color-brand-600);
}

.dispatch-summary-date,
.dispatch-summary-tile,
.dispatch-status-tile {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card);
}

.dispatch-summary-date {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 120px;
  padding: 16px;
  background: var(--surface-muted);
}

.dispatch-summary-date span,
.dispatch-summary-tile span {
  color: var(--color-neutral-500);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dispatch-summary-date strong {
  color: var(--color-neutral-950);
  font-size: 24px;
  line-height: 1.1;
  margin-top: 8px;
}

.dispatch-summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dispatch-summary-tile {
  min-height: 58px;
  padding: 10px;
}

.dispatch-summary-tile:hover,
.dispatch-status-tile:hover {
  border-color: var(--border-strong);
}

.dispatch-summary-tile strong {
  display: block;
  color: var(--color-neutral-950);
  font-size: 23px;
  line-height: 1.05;
  margin-top: 2px;
}

.dispatch-summary-tile em,
.dispatch-status-tile em {
  color: var(--color-neutral-600);
  display: block;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.dispatch-summary-status {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dispatch-status-tile {
  align-content: center;
  display: grid;
  justify-items: center;
  min-height: 58px;
  padding: 8px;
}

.dispatch-status-tile span {
  border-radius: 3px;
  display: block;
  height: 10px;
  margin-bottom: 3px;
  width: 10px;
}

.dispatch-status-tile strong {
  color: var(--color-neutral-950);
  font-size: 20px;
  line-height: 1;
}

.dispatch-status-tile.status-unscheduled > span {
  background: #64748b;
}
.dispatch-status-tile.status-scheduled > span {
  background: #2563eb;
}
.dispatch-status-tile.status-assigned > span {
  background: #7c3aed;
}
.dispatch-status-tile.status-en-route > span {
  background: #1d4ed8;
}
.dispatch-status-tile.status-on-site > span {
  background: #047857;
}
.dispatch-status-tile.status-paused > span {
  background: #d97706;
}
.dispatch-status-tile.status-followup-required > span {
  background: #b45309;
}
.dispatch-status-tile.status-completed > span {
  background: #16a34a;
}
.dispatch-status-tile.status-no-show > span {
  background: #6b7280;
}
.dispatch-status-tile.status-cancelled > span,
.dispatch-status-tile.status-late > span {
  background: #c7302b;
}

.dispatch-board-shell.dispatch-calendar-shell {
  display: block;
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.dispatch-card-list {
  display: grid;
  gap: 8px;
}

.dispatch-grid-wrap {
  overflow: auto;
  min-width: 0;
  width: 100%;
}

.dispatch-calendar-wrap {
  min-height: 560px;
  width: 100%;
}

.dispatch-calendar-toolbar {
  align-items: center;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
  padding: 8px 12px;
}

.dispatch-toolbar-main {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dispatch-calendar-toolbar span {
  color: var(--color-neutral-600);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-right: 4px;
  text-transform: uppercase;
}

.dispatch-calendar-toolbar .dispatch-period-label {
  align-items: center;
  color: var(--color-neutral-900);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  min-height: 36px;
  padding: 0 6px;
}

.dispatch-calendar-grid {
  width: 100%;
  min-width: 100%;
}

.dispatch-day-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  min-height: 72px;
}

.dispatch-day-time {
  background: var(--color-neutral-50);
  border-bottom: 1px solid var(--color-neutral-200);
  border-right: 1px solid var(--color-neutral-200);
  color: #48617f;
  font-size: 13px;
  padding: 12px 16px;
}

.dispatch-day-slot {
  background: #fff;
  border-bottom: 1px solid var(--color-neutral-200);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  min-height: 72px;
  padding: 8px;
}

.dispatch-day-slot.has-visits {
  background: #eaf6ff;
  border-left: 3px solid #1f7fbb;
}

.dispatch-week-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(7, minmax(190px, 1fr));
  padding: 10px;
  min-width: 1410px;
}

.dispatch-week-time-grid {
  grid-template-columns: var(--dispatch-time-col-px) repeat(7, minmax(160px, 1fr));
  min-width: max(1194px, calc(var(--dispatch-time-col-px) + (7 * 160px)));
}

.dispatch-week-time-head {
  grid-template-columns: 1fr;
  gap: 2px;
}

.dispatch-week-time-head strong {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.dispatch-week-time-head .dispatch-day-revenue {
  display: inline;
  margin-top: 0;
  white-space: nowrap;
}

.dispatch-week-time-slot {
  cursor: crosshair;
}

.dispatch-week-day,
.dispatch-month-day {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.dispatch-week-day {
  min-height: 400px;
}

.dispatch-period-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--color-neutral-200);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
}

.dispatch-period-head span {
  color: var(--color-neutral-500);
  font-size: 12px;
}

.dispatch-period-head strong {
  color: var(--color-neutral-900);
  font-size: 14px;
}

.dispatch-week-stack,
.dispatch-month-stack {
  display: grid;
  gap: 8px;
  min-height: 80px;
  padding: 8px;
}

.dispatch-month-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(7, minmax(160px, 1fr));
  padding: 10px;
  min-width: 1188px;
}

.dispatch-month-day {
  min-height: 150px;
}

.dispatch-month-stack {
  gap: 6px;
}

.dispatch-empty-slot,
.dispatch-empty-compact {
  align-items: center;
  border: 1px dashed var(--color-neutral-200);
  border-radius: var(--radius-sm);
  color: var(--color-neutral-300);
  display: flex;
  font-size: 12px;
  justify-content: center;
  min-height: 38px;
  padding: 8px;
}

.drag-over {
  outline: 2px solid #1f7fbb;
  outline-offset: -2px;
}

.dispatch-visit-card {
  --visit-border: #1f7fbb;
  --visit-bg: #f2f9ff;
  --visit-text: #0b5c91;
  background: var(--visit-bg);
  border: 1px solid var(--visit-border);
  border-left: 4px solid var(--visit-border);
  border-radius: 6px;
  color: var(--color-neutral-800);
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  text-align: left;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
  width: 100%;
}

.dispatch-visit-card:hover,
.dispatch-month-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dispatch-visit-card.status-unscheduled {
  --visit-border: #64748b;
  --visit-bg: #f8fafc;
  --visit-text: #475569;
}

.dispatch-visit-card.status-scheduled {
  --visit-border: #2563eb;
  --visit-bg: #eff6ff;
  --visit-text: #1d4ed8;
}

.dispatch-visit-card.status-assigned {
  --visit-border: #7c3aed;
  --visit-bg: #f5f3ff;
  --visit-text: #6d28d9;
}

.dispatch-visit-card.status-dispatched {
  --visit-border: #9333ea;
  --visit-bg: #faf5ff;
  --visit-text: #7e22ce;
}

.dispatch-visit-card.status-en-route {
  --visit-border: #1d4ed8;
  --visit-bg: #eff6ff;
  --visit-text: #1e40af;
}

.dispatch-visit-card.status-on-site {
  --visit-border: #047857;
  --visit-bg: #ecfdf5;
  --visit-text: #065f46;
}

.dispatch-visit-card.status-paused {
  --visit-border: #d97706;
  --visit-bg: #fffbeb;
  --visit-text: #b45309;
}

.dispatch-visit-card.status-followup-required {
  --visit-border: #b45309;
  --visit-bg: #fff7ed;
  --visit-text: #9a3412;
}

.dispatch-visit-card.status-completed {
  --visit-border: #16a34a;
  --visit-bg: #f0fdf4;
  --visit-text: #15803d;
}

.dispatch-visit-card.status-no-show {
  --visit-border: #6b7280;
  --visit-bg: #f3f4f6;
  --visit-text: #4b5563;
}

.dispatch-visit-card.status-cancelled {
  --visit-border: #d33b32;
  --visit-bg: #fff1ef;
  --visit-text: #bc251f;
}

.visit-card-top,
.visit-card-bottom {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.visit-card-top strong,
.visit-customer-link {
  background: transparent;
  border: 0;
  color: var(--color-neutral-950);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visit-customer-link i {
  color: var(--color-neutral-500);
  flex: 0 0 auto;
  font-size: 11px;
}

.visit-card-meta {
  color: #53647a;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-day-slot .visit-card-meta:nth-of-type(3) {
  display: none;
}

.visit-priority-badge {
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 4px;
  color: var(--color-neutral-700);
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  text-transform: uppercase;
}

.visit-status-pill {
  border: 1px solid var(--visit-border);
  border-radius: 4px;
  color: var(--visit-text);
  font-size: 10px;
  font-weight: 800;
  padding: 3px 10px;
  text-transform: uppercase;
}

.visit-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

.visit-flags em {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 4px;
  color: var(--color-neutral-600);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  padding: 2px 5px;
}

.dispatch-month-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--color-neutral-200);
  border-radius: 5px;
  color: var(--color-neutral-800);
  display: grid;
  gap: 6px;
  grid-template-columns: 8px minmax(0, 1fr);
  min-height: 24px;
  padding: 4px 7px;
  text-align: left;
  width: 100%;
}

.dispatch-month-card span {
  background: #1f7fbb;
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.dispatch-month-card.status-unscheduled span {
  background: #64748b;
}
.dispatch-month-card.status-scheduled span {
  background: #2563eb;
}
.dispatch-month-card.status-assigned span {
  background: #7c3aed;
}
.dispatch-month-card.status-en-route span {
  background: #1d4ed8;
}
.dispatch-month-card.status-on-site span {
  background: #047857;
}
.dispatch-month-card.status-paused span {
  background: #d97706;
}
.dispatch-month-card.status-followup-required span {
  background: #b45309;
}
.dispatch-month-card.status-completed span {
  background: #16a34a;
}
.dispatch-month-card.status-no-show span {
  background: #6b7280;
}
.dispatch-month-card.status-cancelled span {
  background: #d33b32;
}

.dispatch-month-card strong {
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-month-more {
  background: transparent;
  border: 0;
  color: #0b5c91;
  font-size: 11px;
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.dispatch-map-grid {
  position: relative;
  min-height: 650px;
  padding: 12px;
}

.dispatch-map-canvas {
  min-height: 650px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-muted);
}

.dispatch-map-side {
  align-self: start;
  display: grid;
  gap: 12px;
}

.dispatch-map-details {
  align-self: start;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 14px;
}

.dispatch-tech-roster {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.dispatch-tech-roster-row {
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--color-neutral-700);
  display: grid;
  gap: 1px 8px;
  grid-template-columns: 10px minmax(0, 1fr);
  min-height: 48px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.dispatch-tech-roster-row:hover,
.dispatch-tech-roster-row:focus-visible {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.dispatch-tech-roster-row strong,
.dispatch-tech-roster-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dispatch-tech-roster-row strong {
  color: var(--color-neutral-950);
  font-size: 13px;
  font-weight: 800;
}

.dispatch-tech-roster-row em {
  color: var(--color-neutral-500);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.dispatch-tech-roster-dot {
  border-radius: 999px;
  display: block;
  grid-row: 1 / span 2;
  height: 10px;
  width: 10px;
}

.dispatch-tech-roster-row.live .dispatch-tech-roster-dot {
  background: #16a34a;
}
.dispatch-tech-roster-row.stale .dispatch-tech-roster-dot {
  background: #64748b;
}
.dispatch-tech-roster-row.none .dispatch-tech-roster-dot {
  background: #cbd5e1;
}

.dispatch-map-detail-list {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0 0 14px;
  font-size: 13px;
}

.dispatch-map-detail-list dt {
  color: var(--color-neutral-500);
  font-weight: 700;
}

.dispatch-map-detail-list dd {
  color: var(--color-neutral-900);
  margin: 0;
  overflow-wrap: anywhere;
}

.dispatch-map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dispatch-drawer {
  position: fixed;
  right: 18px;
  top: 84px;
  bottom: 18px;
  width: min(390px, calc(100vw - 24px));
  padding: 16px;
  overflow: auto;
  transform: translateX(calc(100% + 28px));
  transition: transform 0.18s ease;
  z-index: 1030;
}

.dispatch-quick-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.dispatch-quick-tabs {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 12px;
  scrollbar-width: none;
}

.dispatch-quick-tabs::-webkit-scrollbar {
  display: none;
}

.dispatch-quick-tab {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--color-neutral-500);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.dispatch-quick-tab i {
  font-size: 11px;
}

.dispatch-quick-tab.active {
  background: var(--color-brand-50);
  border-color: var(--color-brand-300);
  color: var(--color-brand-700);
  font-weight: 700;
}

.dispatch-quick-tab:not(.active):hover {
  background: var(--surface-muted);
  color: var(--color-neutral-700);
}

.dispatch-quick-tabpanes {
  min-height: 0;
  overflow: hidden;
}

.dispatch-quick-pane {
  display: none;
}

.dispatch-quick-pane.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.dispatch-quick-section {
  border-bottom: 1px solid var(--border-default);
  display: grid;
  flex-shrink: 0;
  gap: 12px;
  padding: 14px 16px;
}

.dispatch-quick-section:last-child {
  border-bottom: none;
}

.dispatch-quick-facts {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
}

.dispatch-quick-facts dt {
  color: var(--color-neutral-500);
  font-size: 12px;
  font-weight: 700;
}

.dispatch-quick-facts dd {
  color: var(--color-neutral-900);
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}

.dispatch-quick-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.dispatch-quick-field {
  display: grid;
  gap: 4px;
  margin: 0;
}

.dispatch-quick-field > span:not(.visually-hidden) {
  color: var(--color-neutral-500);
  font-size: 13px;
  font-weight: 600;
}

.dispatch-quick-drawer .form-control,
.dispatch-quick-drawer .form-select {
  border-color: var(--border-default);
  border-radius: var(--radius-md);
  min-height: 40px;
}

@media (min-width: 768px) {
  .dispatch-quick-drawer {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }

  .dispatch-quick-form,
  .dispatch-customer-body {
    min-height: 0;
    overflow: hidden;
  }

  .dispatch-quick-section {
    padding: 12px 16px;
  }

  .dispatch-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.dispatch-customer-body {
  display: grid;
}

.dispatch-customer-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dispatch-customer-metrics {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dispatch-customer-metrics div {
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 9px;
}

.dispatch-customer-metrics span,
.dispatch-customer-list span,
.dispatch-customer-list em {
  color: var(--color-neutral-500);
  display: block;
  font-size: 11px;
  font-style: normal;
}

.dispatch-customer-metrics strong {
  color: var(--color-neutral-950);
  display: block;
  font-size: 15px;
}

.dispatch-customer-list {
  display: grid;
  gap: 8px;
}

.dispatch-customer-list > div {
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 9px 10px;
}

.dispatch-job-marker {
  background: transparent;
  border: 0;
}

.dispatch-job-marker-pin {
  align-items: center;
  background: #2563eb;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 7px;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.24);
  color: #fff;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  transform: rotate(-45deg);
  width: 32px;
}

.dispatch-job-marker-pin i {
  font-size: 12px;
  transform: rotate(45deg);
}

.dispatch-job-marker.status-unscheduled .dispatch-job-marker-pin {
  background: #64748b;
}
.dispatch-job-marker.status-scheduled .dispatch-job-marker-pin {
  background: #2563eb;
}
.dispatch-job-marker.status-assigned .dispatch-job-marker-pin {
  background: #7c3aed;
}
.dispatch-job-marker.status-en-route .dispatch-job-marker-pin {
  background: #1d4ed8;
}
.dispatch-job-marker.status-on-site .dispatch-job-marker-pin {
  background: #047857;
}
.dispatch-job-marker.status-paused .dispatch-job-marker-pin {
  background: #d97706;
}
.dispatch-job-marker.status-followup-required .dispatch-job-marker-pin {
  background: #b45309;
}
.dispatch-job-marker.status-completed .dispatch-job-marker-pin {
  background: #16a34a;
}
.dispatch-job-marker.status-no-show .dispatch-job-marker-pin {
  background: #6b7280;
}
.dispatch-job-marker.status-cancelled .dispatch-job-marker-pin {
  background: #dc2626;
}

.dispatch-queue-drawer {
  width: min(430px, calc(100vw - 24px));
}

.dispatch-drawer.open {
  transform: translateX(0);
}

@media (max-width: 1200px) {
  .module-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .module-panel-grid {
    grid-template-columns: 1fr;
  }

  .dispatch-summary-panel {
    grid-template-columns: 1fr;
  }

  .dispatch-summary-date {
    min-height: 72px;
  }
}

@media (max-width: 767px) {
  .module-kpi-grid {
    grid-template-columns: 1fr;
  }

  .module-panel-head {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .module-panel-link {
    grid-column: 2;
    justify-self: start;
  }

  .module-table {
    min-width: 680px;
  }

  .dispatch-board-content {
    padding: 0;
  }

  .dispatch-board-toolbar {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .dispatch-board-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-left: 0;
    width: 100%;
  }

  .dispatch-tool-button {
    width: 100%;
  }

  .dispatch-view-tabs {
    width: 100%;
  }

  .dispatch-view-tab {
    flex: 1;
  }

  .dispatch-summary-metrics,
  .dispatch-summary-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dispatch-map-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .dispatch-map-canvas {
    min-height: 460px;
  }

  .dispatch-quick-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ─── Report Filter Extras ───────────────────────────────────────────────── */

.filter-search-clear {
  background: none;
  border: none;
  padding: 0 2px;
  line-height: 1;
  color: var(--color-neutral-400);
  cursor: pointer;
  flex-shrink: 0;
}

.filter-search-clear:hover {
  color: var(--color-neutral-700);
}

.filter-field-presets {
  flex: 0 0 auto;
  min-width: 0;
}

/* ─── Report Panels ──────────────────────────────────────────────────────── */

.report-panel {
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}

.report-filter-bar {
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: var(--space-2);
}

.report-panel h2 {
  color: var(--color-neutral-900);
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px;
}

.report-panel--tall .report-bar-chart {
  min-height: 300px;
}

.report-panel--tall .report-bar-item {
  grid-template-rows: auto minmax(208px, 1fr) auto;
}

.report-panel--tall .report-bar-column {
  min-height: 208px;
}

.report-bar-chart {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
  min-height: 220px;
  padding-top: 4px;
}

.report-bar-item {
  align-items: stretch;
  display: grid;
  gap: 6px;
  grid-template-rows: auto minmax(128px, 1fr) auto;
  min-width: 0;
}

.report-bar-column {
  align-items: end;
  background: linear-gradient(to top, var(--color-neutral-100), transparent);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  min-height: 128px;
  overflow: hidden;
}

.report-bar-fill {
  background: var(--color-brand-500, var(--color-brand-600));
  border-radius: 6px 6px 0 0;
  min-height: 0;
  transition: height 0.16s ease;
  width: 100%;
}

.report-bar-label,
.report-bar-value {
  color: var(--color-neutral-700);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.report-bar-label {
  color: var(--color-neutral-500);
  min-height: 28px;
  text-transform: uppercase;
}

.report-chart-empty {
  align-items: center;
  color: var(--color-neutral-500);
  display: flex;
  font-size: 13px;
  justify-content: center;
  min-height: 180px;
  text-align: center;
}

.report-line-chart {
  min-height: 220px;
  width: 100%;
}

.chart-toggle-wrap .chart-type-toggle .btn.active {
  background-color: var(--bs-primary, #0d6efd);
  color: #fff;
  border-color: var(--bs-primary, #0d6efd);
}

@media (max-width: 575px) {
  .report-bar-chart {
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
    min-height: 180px;
  }

  .report-panel--tall .report-bar-chart {
    min-height: 240px;
  }

  .report-bar-item {
    grid-template-rows: auto minmax(96px, 1fr) auto;
  }

  .report-panel--tall .report-bar-item {
    grid-template-rows: auto minmax(160px, 1fr) auto;
  }

  .report-bar-column {
    min-height: 96px;
  }

  .report-panel--tall .report-bar-column {
    min-height: 160px;
  }
}

/* ─── User / Admin forms ─────────────────────────────────────────────────── */

.user-create-form .form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 100%;
}

.user-role-select {
  min-height: 10.5rem;
}

.user-branch-check {
  margin-top: 1.55rem;
}

.user-state-form {
  width: 100%;
  max-width: 16rem;
}

.user-edit-modal {
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 2rem);
}

.user-edit-modal-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.user-edit-modal-form .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.user-edit-modal-form .modal-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border-default) !important;
  padding-top: 0.75rem !important;
}

.user-edit-modal .role-picker-grid {
  max-height: 14rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.role-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
}

.role-picker-item {
  display: block;
  margin: 0;
  position: relative;
}

.role-picker-input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.role-picker-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 100%;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
}

.role-picker-input:checked + .role-picker-card {
  border-color: var(--color-brand-600);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
}

.role-picker-input:focus-visible + .role-picker-card {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.role-picker-name {
  color: var(--color-neutral-900);
  font-weight: 700;
}

.role-picker-hint {
  color: var(--color-neutral-500);
  font-size: 0.78rem;
  line-height: 1.25;
}

/* ─── Compact page header + inline breadcrumbs ──────────────────────────── */

.dispatch-shell .app-page-header {
  align-items: flex-start;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
}

.dispatch-shell .app-page-heading {
  flex: 1;
}

.dispatch-shell .app-page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
  flex-wrap: wrap;
}

.dispatch-shell .dispatch-page-title,
.dispatch-shell .app-page-header .dispatch-page-title {
  font-size: 21px;
  line-height: 1.2;
}

.dispatch-shell .app-page-subtitle {
  margin-top: 4px;
}

.dispatch-shell .dispatch-page-breadcrumbs {
  margin-left: auto;
  min-width: 0;
}

.dispatch-shell .dispatch-page-toolbar {
  margin-bottom: 0;
}

.dispatch-shell .dispatch-breadcrumb {
  display: flex;
  align-items: center;
  margin-bottom: 0;
  font-size: 12px;
  min-width: 0;
}

.dispatch-shell .dispatch-breadcrumb .breadcrumb-item {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.dispatch-shell .dispatch-breadcrumb .breadcrumb-item.active {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Sidebar parent menus + flyout submenus ─────────────────────────────── */

.dispatch-shell .sidebar .sidebar-body {
  overflow-y: auto;
  overflow-x: visible;
}

.dispatch-shell .sidebar .sidebar-body .nav .nav-item.nav-has-submenu {
  position: relative;
}

.dispatch-shell .sidebar .sidebar-body .nav .nav-parent-button {
  width: calc(100% - var(--space-4));
  border: 0;
  background: transparent;
  text-align: left;
}

.dispatch-shell .sidebar .sidebar-body .nav .nav-parent-button:focus {
  outline: 0;
}

.dispatch-shell .sidebar .sidebar-body .nav .submenu-caret {
  width: auto;
  margin-left: auto;
  font-size: 10px;
  opacity: 0.45;
}

.dispatch-shell .sidebar .sidebar-body .nav .nav-submenu {
  display: none;
  position: fixed;
  left: calc(var(--sidebar-w) - 1px);
  top: 38px;
  min-width: 210px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  padding: 6px;
  list-style: none;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1100;
}

.dispatch-shell
  .sidebar
  .sidebar-body
  .nav
  .nav-has-submenu:hover
  > .nav-submenu,
.dispatch-shell
  .sidebar
  .sidebar-body
  .nav
  .nav-has-submenu:focus-within
  > .nav-submenu {
  display: block;
}

.dispatch-shell .sidebar .sidebar-body .nav .submenu-link {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-neutral-700);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.dispatch-shell .sidebar .sidebar-body .nav .submenu-link:hover,
.dispatch-shell .sidebar .sidebar-body .nav .submenu-link:focus {
  background: var(--surface-muted);
  color: var(--color-neutral-900);
}

.dispatch-shell .sidebar .sidebar-body .nav .submenu-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
}

.dispatch-shell.sidebar-folded .sidebar .nav-submenu {
  left: calc(var(--sidebar-collapsed) - 1px);
}

.dispatch-shell.sidebar-folded .sidebar .submenu-caret {
  display: none;
}

@media (max-width: 991px) {
  .dispatch-shell .sidebar {
    display: flex;
    overflow-y: auto;
  }

  .dispatch-shell .sidebar .sidebar-body {
    overflow-x: hidden;
  }

  .dispatch-shell .sidebar .sidebar-body .nav .nav-submenu {
    display: block;
    position: static;
    min-width: 0;
    margin: 0 0 4px 38px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .dispatch-shell .sidebar .sidebar-body .nav .submenu-link {
    min-height: 30px;
    padding: 5px 10px;
    color: var(--color-neutral-500);
  }
}

@media (max-width: 767px) {
  .dispatch-shell .app-page-header {
    gap: var(--space-2);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-3);
  }

  .dispatch-shell .app-page-title-row {
    gap: var(--space-2);
  }

  .dispatch-shell .dispatch-page-title,
  .dispatch-shell .app-page-header .dispatch-page-title {
    font-size: 20px;
  }

  .dispatch-shell .dispatch-breadcrumb .breadcrumb-item.active {
    max-width: 12rem;
  }
}

/* ─── Soft UI final app overrides ───────────────────────────────────────── */
.dispatch-shell .page-content .btn,
.dispatch-auth .btn {
  border-radius: 13px;
  box-shadow: none !important;
  letter-spacing: 0;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    box-shadow 0.15s;
}

.dispatch-shell .page-content .btn-primary,
.dispatch-auth .btn-primary {
  background: var(--color-brand-600) !important;
  border-color: var(--color-brand-600) !important;
}

.dispatch-shell .page-content .btn-primary:hover,
.dispatch-auth .btn-primary:hover {
  background: #4f46e5 !important;
  border-color: #4f46e5 !important;
}

.dispatch-shell .page-content .btn-outline-primary,
.dispatch-shell .page-content .btn-outline-secondary,
.dispatch-shell .page-content .btn-secondary,
.dispatch-auth .btn-outline-primary,
.dispatch-auth .btn-outline-secondary,
.dispatch-auth .btn-secondary {
  background: var(--surface-card) !important;
  border-color: var(--border-default) !important;
  color: var(--color-neutral-700) !important;
}

.dispatch-shell .page-content .btn-outline-primary:hover,
.dispatch-shell .page-content .btn-outline-secondary:hover,
.dispatch-shell .page-content .btn-secondary:hover,
.dispatch-auth .btn-outline-primary:hover,
.dispatch-auth .btn-outline-secondary:hover,
.dispatch-auth .btn-secondary:hover {
  background: var(--surface-muted) !important;
  border-color: var(--border-strong) !important;
  color: var(--color-neutral-900) !important;
}

.dispatch-shell
  .page-content
  .btn:not(.btn-primary):not(.btn-success):not(.btn-danger)
  i,
.dispatch-auth .btn:not(.btn-primary):not(.btn-success):not(.btn-danger) i,
.btn-ghost i {
  color: var(--color-neutral-500) !important;
}

.btn-ghost {
  border-radius: 12px;
}

.btn-ghost:hover {
  color: var(--color-neutral-700);
}

.dispatch-shell .row-action-dropdown {
  padding: 6px;
  border-radius: var(--radius-lg);
}

.dispatch-shell .row-action-dropdown .dropdown-item {
  border-radius: 10px;
}

.dispatch-shell .row-action-dropdown .dropdown-item:hover,
.dispatch-shell .row-action-dropdown .dropdown-item:focus {
  color: var(--color-neutral-700);
}

.dispatch-shell .form-control,
.dispatch-shell .form-select,
.dispatch-auth .form-control,
.dispatch-auth .form-select {
  background: #fff;
  border-color: var(--border-default);
  border-radius: var(--radius-md);
}

.dispatch-shell .form-control:focus,
.dispatch-shell .form-select:focus,
.dispatch-auth .form-control:focus,
.dispatch-auth .form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(91, 85, 245, 0.11);
}

.dispatch-shell .input-group .input-group-text,
.dispatch-auth .input-group .input-group-text {
  border-color: var(--border-default);
  border-radius: var(--radius-md);
}

.dispatch-shell .page-content .card,
.dispatch-shell .page-content .app-panel,
.report-panel,
.data-table-wrap {
  border-color: var(--border-default) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-sm) !important;
}

.dispatch-shell .page-content .card-header {
  background: var(--surface-muted) !important;
  border-color: var(--border-default);
}

.dispatch-shell .alert,
.dispatch-auth .alert {
  border-left-width: 1px;
  border-radius: var(--radius-lg);
}
@media print {
  .no-print,
  .app-sidebar,
  .dispatch-sidebar,
  .dispatch-topbar,
  .app-topbar,
  .app-page-actions,
  .row-action-menu,
  .modal {
    display: none !important;
  }

  body {
    background: #fff !important;
  }

  .app-shell,
  .app-main,
  .dispatch-main,
  .app-content {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .card,
  .alert {
    box-shadow: none !important;
  }
}

.invoice-print-document {
  display: none;
}

@media print {
  @page {
    margin: 18mm;
    size: letter;
  }

  body * {
    visibility: hidden !important;
  }

  .invoice-print-document,
  .invoice-print-document * {
    visibility: visible !important;
  }

  .invoice-print-document {
    box-sizing: border-box;
    color: #111827 !important;
    display: block !important;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
    line-height: 1.35;
    margin: 0 auto;
    max-width: 7.1in;
    padding: 0;
    position: static;
    width: 100%;
  }

  .invoice-print-document *,
  .invoice-print-document *::before,
  .invoice-print-document *::after {
    box-sizing: border-box;
  }

  .invoice-print-header {
    align-items: flex-start;
    border-bottom: 2px solid #111827;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 190px;
    padding-bottom: 18px;
  }

  .invoice-print-brand {
    color: #111827;
    font-size: 18pt;
    font-weight: 700;
    margin-bottom: 6px;
  }

  .invoice-print-branch {
    color: #374151 !important;
    font-size: 11pt;
    font-weight: 700;
    margin-bottom: 4px;
  }

  .invoice-print-title {
    text-align: right;
  }

  .invoice-print-title h1 {
    color: #111827;
    font-size: 24pt;
    font-weight: 700;
    line-height: 1;
    margin: 0 0 8px;
    text-transform: uppercase;
  }

  .invoice-print-title div {
    color: #374151;
    font-size: 10pt;
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .invoice-print-meta {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) 230px;
    margin-top: 22px;
  }

  .invoice-print-box {
    border: 1px solid #d1d5db;
    min-height: 118px;
    padding: 12px;
  }

  .invoice-print-box h2 {
    color: #6b7280;
    font-size: 9pt;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 0 0 8px;
    text-transform: uppercase;
  }

  .invoice-print-box strong,
  .invoice-print-box span {
    display: block;
  }

  .invoice-print-facts {
    display: grid;
    gap: 6px;
    min-height: 0;
  }

  .invoice-print-facts div,
  .invoice-print-totals div {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(82px, 1fr) minmax(0, auto);
    min-width: 0;
  }

  .invoice-print-facts span,
  .invoice-print-totals span {
    color: #6b7280;
  }

  .invoice-print-facts strong,
  .invoice-print-totals strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .invoice-print-note {
    border-left: 3px solid #111827;
    margin-top: 16px;
    padding: 8px 12px;
  }

  .invoice-print-note strong,
  .invoice-print-note span {
    display: block;
  }

  .invoice-print-table {
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 22px;
    width: 100%;
  }

  .invoice-print-table th:nth-child(1),
  .invoice-print-table td:nth-child(1) {
    width: 44%;
  }

  .invoice-print-table th:nth-child(2),
  .invoice-print-table td:nth-child(2) {
    width: 14%;
  }

  .invoice-print-table th:nth-child(3),
  .invoice-print-table td:nth-child(3),
  .invoice-print-table th:nth-child(4),
  .invoice-print-table td:nth-child(4) {
    width: 21%;
  }

  .invoice-print-table th {
    background: #111827 !important;
    color: #fff !important;
    font-size: 8.5pt;
    letter-spacing: 0.06em;
    padding: 9px 10px;
    text-transform: uppercase;
  }

  .invoice-print-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    vertical-align: top;
  }

  .invoice-print-table td strong,
  .invoice-print-table td span {
    display: block;
  }

  .invoice-print-table td span {
    color: #6b7280 !important;
    font-size: 9pt;
    margin-top: 2px;
  }

  .invoice-print-empty {
    color: #6b7280 !important;
    font-style: italic;
    text-align: center;
  }

  .invoice-print-bottom {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 230px;
    margin-top: 24px;
  }

  .invoice-print-signature {
    color: #6b7280 !important;
    min-height: 120px;
  }

  .invoice-print-signature-title {
    color: #111827 !important;
    font-weight: 700;
    margin-bottom: 10px;
  }

  .invoice-print-signature img {
    display: block;
    height: 58px;
    margin-bottom: 6px;
    max-width: 230px;
    object-fit: contain;
  }

  .invoice-print-signature-line {
    border-bottom: 1px solid #111827;
    height: 58px;
    margin-bottom: 6px;
    max-width: 260px;
    width: 85%;
  }

  .invoice-print-signed-by {
    color: #111827 !important;
    font-weight: 700;
  }

  .invoice-print-totals {
    border-top: 2px solid #111827;
    display: grid;
    gap: 8px;
    padding-top: 10px;
  }

  .invoice-print-totals strong {
    text-align: right;
  }

  .invoice-print-balance {
    border-top: 1px solid #d1d5db;
    font-size: 12pt;
    font-weight: 700;
    margin-top: 4px;
    padding-top: 8px;
  }
}

/* ─── Compact Dashboard Redesign Overrides ───────────────────────────────── */
.module-dashboard-shell {
  gap: 12px;
}

.module-kpi-grid,
.app-metric-grid {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-auto-rows: 1fr;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}

.module-kpi-card,
.app-metric-card {
  --dashboard-accent: var(--color-neutral-400);
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.92),
      rgba(255, 255, 255, 0.98)
    ),
    var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  color: var(--color-neutral-800);
  min-height: 82px;
  overflow: hidden;
  position: relative;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease;
}

.module-kpi-card {
  display: grid;
  gap: 5px;
  padding: 10px 10px 9px 13px;
}

a.module-kpi-card {
  cursor: pointer;
}

.app-metric-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 100%;
  padding: 10px 10px 9px 13px;
}

.module-kpi-card::before,
.app-metric-accent {
  background: var(--dashboard-accent);
  bottom: 10px;
  content: "";
  left: 0;
  position: absolute;
  top: 10px;
  width: 3px;
}

.module-kpi-accent {
  display: none;
}

.module-kpi-card:hover,
.app-metric-card:hover {
  border-color: color-mix(
    in srgb,
    var(--dashboard-accent) 45%,
    var(--border-default)
  );
  box-shadow: var(--shadow-md);
  color: var(--color-neutral-950);
  text-decoration: none !important;
  transform: translateY(-1px);
}

.module-kpi-card.tone-info,
.app-metric-card.tone-info {
  --dashboard-accent: var(--color-info-500);
}

.module-kpi-card.tone-accent,
.module-kpi-card.tone-brand,
.app-metric-card.tone-brand {
  --dashboard-accent: var(--color-brand-600);
}

.module-kpi-card.tone-money,
.app-metric-card.tone-money {
  --dashboard-accent: var(--color-success-500);
}

.module-kpi-card.tone-warning,
.app-metric-card.tone-warning {
  --dashboard-accent: var(--color-warning-500);
}

.module-kpi-card.tone-danger,
.app-metric-card.tone-danger {
  --dashboard-accent: var(--color-danger-500);
}

.module-kpi-top,
.app-metric-topline {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
  width: 100%;
}

.module-kpi-heading,
.app-metric-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.module-kpi-label,
.app-metric-label {
  color: var(--color-neutral-500);
  display: -webkit-box;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.module-kpi-icon,
.app-metric-icon {
  align-items: center;
  background: color-mix(
    in srgb,
    var(--dashboard-accent) 12%,
    var(--surface-card)
  );
  border: 1px solid
    color-mix(in srgb, var(--dashboard-accent) 26%, var(--border-default));
  border-radius: 7px;
  color: var(--dashboard-accent);
  display: inline-flex;
  flex: 0 0 26px;
  font-size: 12px;
  height: 26px;
  justify-content: center;
  overflow: hidden;
  width: 26px;
}

.module-kpi-icon i,
.app-metric-icon i {
  line-height: 1;
  max-width: 100%;
}

.module-kpi-value,
.app-metric-value {
  color: var(--color-neutral-950);
  font-size: clamp(18px, 1.7vw, 24px);
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-kpi-bottom,
.app-metric-footer {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-top: auto;
  min-width: 0;
}

.module-kpi-bottom span,
.app-metric-hint {
  color: var(--color-neutral-500);
  font-size: 10.5px;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-kpi-bottom b,
.app-metric-meta {
  background: color-mix(
    in srgb,
    var(--dashboard-accent) 10%,
    var(--surface-muted)
  );
  border: 1px solid
    color-mix(in srgb, var(--dashboard-accent) 18%, var(--border-default));
  border-radius: 999px;
  color: var(--color-neutral-700);
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
  padding: 2px 7px;
  white-space: nowrap;
}

.module-panel-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.module-panel,
.report-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
}

.module-panel {
  display: flex;
  flex-direction: column;
}

.module-panel-head {
  align-items: center;
  background: linear-gradient(
    180deg,
    var(--surface-card),
    var(--surface-muted)
  );
  border-bottom: 1px solid var(--border-default);
  display: grid;
  gap: 8px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  min-height: 48px;
  padding: 8px 10px;
}

.module-panel-icon {
  background: var(--surface-card);
  border-radius: 7px;
  font-size: 12px;
  height: 30px;
  width: 30px;
}

.module-panel-title {
  gap: 0;
}

.module-panel-title strong,
.report-panel h2 {
  color: var(--color-neutral-950);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.2;
}

.module-panel-title small {
  color: var(--color-neutral-500);
  font-size: 11px;
  line-height: 1.25;
}

.module-panel-link {
  font-size: 11px;
}

.module-table th,
.module-table td {
  padding: 7px 10px;
}

.module-table th {
  background: var(--surface-muted);
  color: var(--color-neutral-600);
  font-size: 10.5px;
  letter-spacing: 0;
}

.module-table td {
  font-size: 12.5px;
  height: 36px;
}

.module-table tbody tr:hover {
  background: color-mix(in srgb, var(--color-brand-600) 5%, transparent);
}

.module-chip {
  border-radius: 999px;
  font-size: 10.5px;
  padding: 4px 7px;
}

.module-empty,
.report-chart-empty {
  min-height: 112px;
}

.report-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  padding: 10px;
}

.report-panel h2 {
  align-items: center;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  margin: -2px 0 2px;
  min-height: 28px;
  padding-bottom: 7px;
}

.dashboard-table {
  min-height: 0;
}

.dashboard-table .table-responsive {
  border: 1px solid var(--border-default);
  border-radius: 7px;
  max-height: 220px;
}

.dashboard-data-table {
  border-collapse: separate;
  border-spacing: 0;
}

.dashboard-data-table thead th {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-default);
  color: var(--color-neutral-600);
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: 0;
  padding: 7px 9px;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.dashboard-data-table tbody td {
  border-bottom: 1px solid var(--border-default);
  color: var(--color-neutral-700);
  font-size: 12.5px;
  padding: 7px 9px;
  vertical-align: middle;
}

.dashboard-data-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-data-table tbody tr:hover td {
  background: color-mix(
    in srgb,
    var(--color-brand-600) 5%,
    var(--surface-card)
  );
}

.dashboard-data-table a {
  color: var(--color-brand-600);
  font-weight: 750;
  text-decoration: none;
}

.dashboard-data-table a:hover {
  text-decoration: underline;
}

.dashboard-table-empty {
  color: var(--color-neutral-500) !important;
  font-size: 12px !important;
  padding: 18px 8px !important;
  text-align: center;
}

.dashboard-show-more {
  font-size: 12px;
  padding: 2px 6px;
}

.report-bar-chart {
  align-items: end;
  background: repeating-linear-gradient(
    to top,
    transparent 0,
    transparent 39px,
    color-mix(in srgb, var(--border-default) 75%, transparent) 40px
  );
  border: 1px solid var(--border-default);
  border-radius: 7px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  min-height: 174px;
  padding: 8px 8px 7px;
}

.report-bar-item {
  align-items: stretch;
  display: grid;
  gap: 4px;
  grid-template-rows: 18px minmax(96px, 1fr) 24px;
  min-width: 0;
}

.report-bar-column {
  align-items: end;
  background: color-mix(
    in srgb,
    var(--color-brand-600) 4%,
    var(--surface-card)
  );
  border: 1px solid var(--border-default);
  border-radius: 6px;
  display: flex;
  min-height: 96px;
  overflow: hidden;
  padding: 2px;
}

.report-bar-fill {
  background: linear-gradient(
    180deg,
    var(--color-brand-500, var(--color-brand-600)),
    var(--color-brand-700, var(--color-brand-600))
  );
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
  min-height: 0;
  transition: height 0.16s ease;
  width: 100%;
}

.report-bar-value,
.report-bar-label {
  font-size: 10.5px;
  letter-spacing: 0;
  line-height: 1.15;
  min-width: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}

.report-bar-value {
  color: var(--color-neutral-700);
  font-weight: 800;
  white-space: nowrap;
}

.report-bar-label {
  color: var(--color-neutral-500);
  font-weight: 750;
  text-transform: uppercase;
}

@media (max-width: 1200px) {
  .module-kpi-grid,
  .app-metric-grid {
    grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  }

  .module-panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .module-kpi-grid,
  .app-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-kpi-card,
  .app-metric-card {
    min-height: 88px;
  }

  .module-panel-head {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .module-panel-link {
    grid-column: 2;
    justify-self: start;
  }

  .module-table {
    min-width: 620px;
  }
}

@media (max-width: 480px) {
  .module-kpi-grid,
  .app-metric-grid {
    grid-template-columns: 1fr;
  }

  .report-bar-chart {
    gap: 6px;
    grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
    min-height: 152px;
    padding: 7px;
  }

  .report-bar-item {
    grid-template-rows: 18px minmax(82px, 1fr) 22px;
  }

  .report-bar-column {
    min-height: 82px;
  }
}

/* ─── Mixed Report Visuals ───────────────────────────────────────────────── */
.report-horizontal-chart,
.report-funnel,
.report-donut-chart,
.report-map-panel {
  min-height: 174px;
}

.report-horizontal-chart {
  display: grid;
  gap: 8px;
  padding: 4px 0;
}

.report-horizontal-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(86px, 0.8fr) minmax(110px, 2fr) minmax(
      68px,
      auto
    );
  min-width: 0;
}

.report-horizontal-label,
.report-horizontal-value {
  color: var(--color-neutral-700);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-horizontal-label {
  color: var(--color-neutral-600);
  text-transform: uppercase;
}

.report-horizontal-value {
  text-align: right;
}

.report-horizontal-track {
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  height: 16px;
  overflow: hidden;
}

.report-horizontal-track span {
  background: linear-gradient(
    90deg,
    var(--color-brand-600),
    var(--color-info-500)
  );
  border-radius: inherit;
  display: block;
  height: 100%;
  min-width: 4px;
}

.report-funnel {
  align-items: center;
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 6px 0;
}

.report-funnel-step {
  display: flex;
  justify-content: center;
  width: 100%;
}

.report-funnel-bar {
  align-items: center;
  background: linear-gradient(
    90deg,
    var(--color-brand-600),
    var(--color-success-500)
  );
  border-radius: 7px;
  color: #fff;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 30px;
  min-width: min(100%, 150px);
  padding: 5px 10px;
}

.report-funnel-bar span,
.report-funnel-bar strong {
  font-size: 11px;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-funnel-bar span {
  font-weight: 850;
  text-transform: uppercase;
}

.report-donut-chart {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 150px minmax(0, 1fr);
}

.report-panel--donut-full .report-donut-chart {
  gap: 18px;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 280px;
  justify-items: center;
}

.report-panel--donut-stack .report-donut-chart {
  grid-template-columns: 1fr;
  justify-items: center;
  min-height: 0;
}

.report-panel--donut-stack .report-donut-legend {
  width: 100%;
}

.report-panel--donut-stack .report-donut-visual {
  width: min(100%, 236px);
}

.report-donut-ring {
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--border-default);
  display: grid;
  place-items: center;
  width: 150px;
}

.report-panel--donut-full .report-donut-ring {
  justify-self: center;
  width: min(100%, 240px);
}

.report-donut-ring > div {
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  display: grid;
  height: 92px;
  justify-items: center;
  width: 92px;
}

.report-panel--donut-full .report-donut-ring > div {
  height: 148px;
  width: 148px;
}

.report-donut-ring strong {
  color: var(--color-neutral-950);
  font-size: 17px;
  font-weight: 850;
  line-height: 1;
}

.report-panel--donut-full .report-donut-ring strong {
  font-size: 20px;
}

.report-donut-ring span {
  color: var(--color-neutral-500);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.report-donut-legend {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.report-panel--donut-full .report-donut-legend {
  width: 100%;
}

.report-donut-legend-row {
  align-items: center;
  display: grid;
  gap: 7px;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  min-width: 0;
}

.report-donut-dot {
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.report-donut-legend-row span:not(.report-donut-dot),
.report-donut-legend-row strong,
.report-donut-legend-row em {
  font-size: 11px;
  line-height: 1.2;
}

.report-donut-legend-row span:not(.report-donut-dot) {
  color: var(--color-neutral-700);
  font-weight: 750;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-donut-legend-row strong {
  color: var(--color-neutral-950);
  font-weight: 850;
}

.report-donut-legend-row em {
  color: var(--color-neutral-500);
  font-style: normal;
  text-align: right;
}

.report-map-panel {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 168px;
}

.report-map-canvas {
  background:
    radial-gradient(
      circle at 18% 28%,
      rgba(79, 70, 229, 0.12),
      transparent 22%
    ),
    radial-gradient(
      circle at 78% 62%,
      rgba(22, 163, 74, 0.12),
      transparent 24%
    ),
    linear-gradient(135deg, rgba(14, 165, 233, 0.14), rgba(241, 245, 249, 0.9)),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 31px,
      rgba(100, 116, 139, 0.12) 32px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 31px,
      rgba(100, 116, 139, 0.12) 32px
    );
  border: 1px solid var(--border-default);
  border-radius: 7px;
  min-height: 190px;
  overflow: hidden;
  position: relative;
}

.report-map-canvas::before,
.report-map-canvas::after {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 45% 55% 42% 58%;
  content: "";
  position: absolute;
}

.report-map-canvas::before {
  height: 72%;
  left: 12%;
  top: 11%;
  transform: rotate(-11deg);
  width: 48%;
}

.report-map-canvas::after {
  height: 56%;
  right: 9%;
  top: 22%;
  transform: rotate(14deg);
  width: 34%;
}

.report-map-compass {
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 7px;
  color: var(--color-brand-600);
  display: inline-flex;
  height: 28px;
  justify-content: center;
  position: absolute;
  right: 8px;
  top: 8px;
  width: 28px;
  z-index: 2;
}

.report-map-pin {
  --pin-color: var(--color-brand-600);
  color: var(--pin-color);
  position: absolute;
  text-decoration: none;
  transform: translate(-50%, -100%);
  z-index: 3;
}

.report-map-pin i {
  filter: drop-shadow(0 4px 6px rgba(15, 23, 42, 0.24));
  font-size: 24px;
}

.report-map-pin span {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  color: var(--color-neutral-700);
  display: none;
  font-size: 10px;
  font-weight: 800;
  left: 50%;
  max-width: 150px;
  overflow: hidden;
  padding: 2px 7px;
  position: absolute;
  text-overflow: ellipsis;
  top: 22px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.report-map-pin:hover {
  z-index: 5;
}

.report-map-pin:hover span {
  display: block;
}

.report-map-pin.tone-money {
  --pin-color: var(--color-success-600);
}

.report-map-pin.tone-warning {
  --pin-color: var(--color-warning-600);
}

.report-map-pin.tone-danger {
  --pin-color: var(--color-danger-600);
}

.report-map-pin.tone-accent {
  --pin-color: var(--color-brand-600);
}

.report-map-list {
  border: 1px solid var(--border-default);
  border-radius: 7px;
  display: grid;
  overflow: hidden;
}

.report-map-list a {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  text-decoration: none;
}

.report-map-list a + a {
  border-top: 1px solid var(--border-default);
}

.report-map-list a:hover {
  background: color-mix(
    in srgb,
    var(--color-brand-600) 5%,
    var(--surface-card)
  );
}

.report-map-list strong,
.report-map-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-map-list strong {
  color: var(--color-neutral-900);
  font-size: 11px;
  font-weight: 850;
}

.report-map-list span {
  color: var(--color-neutral-500);
  font-size: 10.5px;
}

@media (max-width: 767px) {
  .report-horizontal-row,
  .report-donut-chart,
  .report-map-panel {
    grid-template-columns: 1fr;
  }

  .report-horizontal-value {
    text-align: left;
  }

  .report-donut-ring {
    justify-self: center;
  }

  .report-map-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-map-list a + a {
    border-top: 0;
  }
}

/* ─── Compact Real Report Maps ───────────────────────────────────────────── */
.report-donut-chart,
.report-funnel {
  min-height: 116px;
}

.report-bar-chart {
  gap: 7px;
  min-height: 142px;
  padding: 7px;
}

.report-bar-item {
  grid-template-rows: 17px minmax(72px, 1fr) 21px;
}

.report-bar-column {
  min-height: 72px;
}

.report-donut-chart {
  gap: 10px;
  grid-template-columns: 108px minmax(0, 1fr);
}

.report-donut-ring {
  width: 108px;
}

.report-donut-ring > div {
  height: 66px;
  width: 66px;
}

.report-donut-ring strong {
  font-size: 15px;
}

.report-donut-legend {
  gap: 4px;
}

.report-donut-legend-row {
  gap: 6px;
  grid-template-columns: 9px minmax(0, 1fr) auto auto;
}

.report-funnel {
  gap: 6px;
  padding: 2px 0;
}

.report-funnel-bar {
  min-height: 24px;
  padding: 4px 8px;
}

.report-map-panel {
  min-height: 0;
}

.report-map-canvas {
  background: var(--surface-muted);
  min-height: 230px;
  z-index: 0;
}

.report-map-canvas::before,
.report-map-canvas::after {
  content: none;
}

.report-map-canvas .leaflet-control-attribution {
  font-size: 9px;
}

.report-map-canvas .leaflet-control-zoom a {
  align-items: center;
  display: flex;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.report-map-empty {
  align-content: center;
  color: var(--color-neutral-500);
  display: grid;
  gap: 4px;
  min-height: 100%;
  padding: 14px 10px;
}

.report-map-empty strong {
  color: var(--color-neutral-700);
  font-size: 12px;
}

.report-map-empty span {
  font-size: 11px;
  line-height: 1.35;
}

.report-leaflet-marker {
  background: transparent;
  border: 0;
}

.report-leaflet-marker span {
  align-items: center;
  color: var(--color-brand-600);
  display: inline-flex;
  filter: drop-shadow(0 4px 7px rgba(15, 23, 42, 0.28));
  font-size: 28px;
  justify-content: center;
}

.report-leaflet-marker.tone-money span {
  color: var(--color-success-600);
}

.report-leaflet-marker.tone-warning span {
  color: var(--color-warning-600);
}

.report-leaflet-marker.tone-danger span {
  color: var(--color-danger-600);
}

.report-leaflet-marker.tone-default span {
  color: var(--color-neutral-600);
}

@media (max-width: 767px) {
  .report-donut-chart {
    grid-template-columns: 1fr;
  }

  .report-panel--donut-full .report-donut-chart {
    min-height: 0;
  }

  .report-donut-ring {
    justify-self: start;
  }

  .report-panel--donut-full .report-donut-ring {
    justify-self: center;
    width: min(100%, 220px);
  }

  .report-panel--donut-full .report-donut-ring > div {
    height: 128px;
    width: 128px;
  }

  .report-map-canvas {
    min-height: 260px;
  }

  .report-bar-chart {
    min-height: 150px;
  }

  .report-bar-column {
    min-height: 80px;
  }
}

/* UX redesign shared patterns */
.ux-action-strip {
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  padding: 10px;
}

.ux-action-strip form,
.ux-task-actions form,
.ux-row-actions form {
  display: inline-flex;
  margin: 0;
}

.ux-payment-inline {
  align-items: center;
  gap: 8px;
}

.ux-payment-inline .form-control {
  width: 116px;
}

.ux-summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.ux-summary-tile {
  align-content: center;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--color-neutral-300);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  color: var(--color-neutral-700);
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 12px 14px;
  text-align: left;
  text-decoration: none;
}

button.ux-summary-tile {
  cursor: pointer;
}

.ux-summary-tile:hover,
.ux-summary-tile.active {
  border-color: var(--border-strong);
  color: var(--color-neutral-900);
}

.ux-summary-tile span {
  color: var(--color-neutral-500);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  overflow: hidden;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ux-summary-tile strong {
  color: var(--color-neutral-950);
  font-size: 20px;
  font-weight: 850;
  line-height: 1.05;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ux-summary-tile.tone-info {
  border-left-color: var(--color-info-600);
}

.ux-summary-tile.tone-warning {
  border-left-color: var(--color-warning-600);
}

.ux-summary-tile.tone-danger {
  border-left-color: var(--color-danger-600);
}

.ux-summary-tile.tone-danger strong {
  color: var(--color-danger-600);
}

.ux-summary-tile.tone-money {
  border-left-color: var(--color-success-600);
}

.ux-summary-tile.tone-money strong {
  color: var(--color-success-600);
}

.ux-status-strip {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ux-tabs {
  background: transparent;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0;
  scrollbar-width: thin;
}

.ux-tabs .nav-item {
  flex: 0 0 auto;
}

.ux-tabs .nav-link {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--color-neutral-500);
  display: inline-flex;
  font-size: 13px;
  font-weight: 750;
  gap: 4px;
  min-height: 38px;
  padding: 8px 12px;
  white-space: nowrap;
}

.ux-tabs .nav-link:hover {
  color: var(--color-neutral-900);
}

.ux-tabs .nav-link.active {
  background: var(--surface-card);
  border-color: var(--border-default);
  color: var(--color-neutral-900);
}

.ux-panel,
.ux-form-panel,
.ux-list-panel {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  padding: 14px;
}

.ux-list-panel {
  display: grid;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.ux-section-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
  min-width: 0;
}

.ux-section-head h2,
.ux-panel h2 {
  color: var(--color-neutral-950);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.25;
  margin: 0;
}

.ux-section-head p {
  color: var(--color-neutral-500);
  font-size: 12px;
  line-height: 1.3;
  margin: 2px 0 0;
}

.ux-fact-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.ux-fact-grid > div,
.ux-total-list > div {
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px;
}

.ux-fact-grid span,
.ux-total-list span {
  color: var(--color-neutral-500);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
}

.ux-fact-grid strong,
.ux-total-list strong {
  color: var(--color-neutral-900);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ux-total-list {
  display: grid;
  gap: 8px;
}

.ux-total-list > div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.ux-total-list .is-balance {
  background: var(--color-danger-50);
  border-color: #f7d7d7;
}

.ux-total-list .is-balance strong {
  color: var(--color-danger-600);
}

.ux-task-list,
.ux-timeline {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: grid;
  overflow: hidden;
}

.ux-task-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px 14px;
}

.ux-task-row + .ux-task-row,
.ux-alert-row + .ux-alert-row,
.ux-timeline-row + .ux-timeline-row {
  border-top: 1px solid var(--border-default);
}

.ux-task-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ux-task-title-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.ux-task-title-line strong {
  color: var(--color-neutral-900);
  font-size: 14px;
  line-height: 1.25;
}

.ux-task-description {
  color: var(--color-neutral-500);
  font-size: 12.5px;
  line-height: 1.35;
}

.ux-task-meta {
  align-items: center;
  color: var(--color-neutral-500);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  gap: 10px;
}

.ux-task-actions,
.ux-row-actions {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.ux-task-tools {
  display: grid;
  gap: 8px;
  grid-column: 1 / -1;
}

.ux-inline-form {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
}

.ux-inline-form .form-control,
.ux-inline-form .form-select {
  flex: 1 1 150px;
}

.ux-alert-row {
  align-items: center;
  color: var(--color-neutral-700);
  display: grid;
  gap: 12px;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  min-width: 0;
  padding: 12px 14px;
  text-decoration: none;
}

.ux-alert-row:hover {
  background: var(--surface-muted);
  color: var(--color-neutral-900);
  text-decoration: none;
}

.ux-alert-icon {
  align-items: center;
  background: var(--color-warning-50);
  border: 1px solid #f8e9bd;
  border-radius: 8px;
  color: var(--color-warning-600);
  display: inline-flex;
  height: 34px;
  justify-content: center;
  width: 34px;
}

.ux-alert-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ux-alert-copy strong,
.ux-alert-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ux-alert-copy strong {
  color: var(--color-neutral-900);
  font-size: 13.5px;
  font-weight: 800;
}

.ux-alert-copy small {
  color: var(--color-neutral-500);
  font-size: 12px;
}

.ux-row-link {
  color: var(--color-brand-600);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ux-timeline-row {
  display: grid;
  gap: 14px;
  grid-template-columns: 150px minmax(0, 1fr);
  padding: 11px 14px;
}

.ux-timeline-row time {
  color: var(--color-neutral-500);
  font-size: 12px;
  line-height: 1.25;
}

.ux-timeline-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ux-timeline-row strong {
  color: var(--color-neutral-900);
  font-size: 13px;
}

.ux-timeline-row span,
.ux-timeline-row small {
  color: var(--color-neutral-500);
  font-size: 12px;
}

.ux-empty-row {
  color: var(--color-neutral-500);
  font-size: 13px;
  padding: 18px 14px;
  text-align: center;
}

@media (max-width: 767px) {
  .ux-action-strip {
    align-items: stretch;
  }

  .ux-action-strip .btn,
  .ux-action-strip form,
  .ux-payment-inline,
  .ux-payment-inline .form-control {
    width: 100%;
  }

  .ux-task-row,
  .ux-alert-row,
  .ux-timeline-row {
    grid-template-columns: 1fr;
  }

  .ux-task-actions,
  .ux-row-actions {
    justify-content: flex-start;
  }
}


/* ─── Estimate status timeline ───────────────────────────────────────────── */

.estimate-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  padding-bottom: 20px;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 13px;
  top: 26px;
  bottom: 0;
  width: 2px;
  background: var(--bs-border-color, #dee2e6);
}

.timeline-step.done:not(:last-child)::before {
  background: var(--bs-success, #198754);
}

.timeline-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bs-border-color, #dee2e6);
  color: #6c757d;
  border: 2px solid transparent;
  position: relative;
  z-index: 1;
}

.timeline-step.done .timeline-dot {
  background: var(--bs-success, #198754);
  color: #fff;
  border-color: var(--bs-success, #198754);
}

.timeline-step.rejected .timeline-dot {
  background: var(--bs-danger, #dc3545);
  color: #fff;
  border-color: var(--bs-danger, #dc3545);
}

.timeline-content {
  padding-top: 4px;
}

/* Report Chart.js visuals */
.report-chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.report-chart-scroll::-webkit-scrollbar {
  height: 8px;
}

.report-chart-scroll::-webkit-scrollbar-track {
  background: var(--surface-muted);
  border-radius: 999px;
}

.report-chart-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong, #cbd5e1);
  border-radius: 999px;
}

.report-chart-frame {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(248, 250, 252, 0.72)),
    repeating-linear-gradient(
      to top,
      transparent 0,
      transparent 39px,
      rgba(148, 163, 184, 0.16) 40px
    );
  border: 1px solid var(--border-default);
  border-radius: 8px;
  height: 220px;
  min-width: 420px;
  padding: 10px 12px 8px;
  position: relative;
}

.report-panel--tall .report-chart-frame {
  height: 320px;
}

.report-chart-frame canvas,
.report-donut-visual canvas {
  display: block;
  height: 100% !important;
  width: 100% !important;
}

.report-donut-chart {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(130px, 168px) minmax(0, 1fr);
  min-height: 168px;
}

.report-panel--donut-full .report-donut-chart {
  gap: 14px;
  grid-template-columns: 1fr;
  justify-items: center;
  min-height: 280px;
}

.report-donut-visual {
  aspect-ratio: 1;
  max-width: 100%;
  position: relative;
  width: min(100%, 168px);
}

.report-panel--donut-full .report-donut-visual {
  width: min(100%, 236px);
}

.report-donut-center {
  align-items: center;
  background: color-mix(in srgb, var(--surface-card) 96%, transparent);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
  display: grid;
  height: 56%;
  justify-items: center;
  left: 50%;
  line-height: 1;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56%;
}

.report-donut-center strong {
  color: var(--color-neutral-950);
  font-size: 18px;
  font-weight: 850;
  max-width: 80%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-panel--donut-full .report-donut-center strong {
  font-size: 24px;
}

.report-donut-center span {
  color: var(--color-neutral-500);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.report-donut-legend {
  display: grid;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.report-donut-legend-row {
  align-items: center;
  background: color-mix(in srgb, var(--surface-muted) 56%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-default) 70%, transparent);
  border-radius: 7px;
  display: grid;
  gap: 7px;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  min-height: 30px;
  min-width: 0;
  padding: 5px 7px;
}

.report-donut-dot {
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.report-donut-legend-row span:not(.report-donut-dot),
.report-donut-legend-row strong,
.report-donut-legend-row em {
  font-size: 11px;
  line-height: 1.2;
}

.report-donut-legend-row span:not(.report-donut-dot) {
  color: var(--color-neutral-700);
  font-weight: 750;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-donut-legend-row strong {
  color: var(--color-neutral-950);
  font-weight: 850;
}

.report-donut-legend-row em {
  color: var(--color-neutral-500);
  font-style: normal;
  text-align: right;
}

@media (max-width: 767px) {
  .report-chart-frame {
    height: 210px;
  }

  .report-panel--tall .report-chart-frame {
    height: 260px;
  }

  .report-donut-chart,
  .report-panel--donut-full .report-donut-chart {
    grid-template-columns: 1fr;
    justify-items: center;
    min-height: 0;
  }

  .report-donut-visual {
    width: min(100%, 210px);
  }

  .report-donut-legend-row {
    grid-template-columns: 10px minmax(0, 1fr) auto;
  }

  .report-donut-legend-row em {
    display: none;
  }
}

.report-panel.report-panel--auto {
  height: auto !important;
  min-height: 0;
}

/* Business Credit workspace */
.bc-workspace-nav {
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  min-width: 0;
  overflow-x: auto;
  padding: 6px;
}

.bc-workspace-nav-link {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--color-neutral-700);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 750;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.bc-workspace-nav-link:hover,
.bc-workspace-nav-link.active {
  background: color-mix(in srgb, var(--color-brand-600) 9%, var(--surface-card));
  border-color: color-mix(in srgb, var(--color-brand-600) 28%, var(--border-default));
  color: var(--color-brand-700);
  text-decoration: none;
}

.bc-nav-badge,
.bc-status-chip,
.bc-evidence-chip {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 4px;
  line-height: 1;
  min-height: 20px;
  padding: 4px 7px;
  white-space: nowrap;
}

.bc-nav-badge {
  background: var(--surface-muted);
  color: var(--color-neutral-700);
}

.bc-nav-badge.success,
.bc-status-chip.success,
.bc-evidence-chip.has-evidence {
  background: #e9f8ef;
  color: #18794e;
}

.bc-nav-badge.warning,
.bc-status-chip.warning {
  background: #fff6d8;
  color: #8a6100;
}

.bc-nav-badge.danger,
.bc-status-chip.danger {
  background: #ffe8e8;
  color: #b42318;
}

.bc-command-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.4fr) minmax(260px, 0.9fr);
}

.bc-command-card,
.bc-list-panel,
.bc-filter-bar,
.bc-summary-card,
.bc-drawer-section {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.bc-command-card,
.bc-summary-card,
.bc-drawer-section {
  padding: 12px;
}

.bc-score-panel {
  align-content: start;
  display: grid;
  gap: 10px;
}

.bc-score-value {
  color: var(--color-neutral-950);
  font-size: 52px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 0.95;
}

.bc-score-label {
  color: var(--color-neutral-600);
  font-size: 12px;
  font-weight: 750;
}

.bc-action-list {
  display: grid;
  gap: 8px;
}

.bc-action-item {
  align-items: start;
  background: color-mix(in srgb, var(--surface-muted) 64%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-default) 72%, transparent);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-width: 0;
  padding: 9px;
}

.bc-action-item i {
  color: var(--color-brand-600);
  margin-top: 2px;
}

.bc-section-title {
  align-items: center;
  display: flex;
  font-size: 13px;
  font-weight: 850;
  gap: 8px;
  justify-content: space-between;
  margin: 0 0 10px;
}

.bc-kpi-strip,
.bc-status-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.bc-kpi,
.bc-status-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  min-width: 0;
  padding: 10px;
}

.bc-kpi span,
.bc-status-card span {
  color: var(--color-neutral-500);
  display: block;
  font-size: 11px;
  font-weight: 750;
}

.bc-kpi strong,
.bc-status-card strong {
  color: var(--color-neutral-950);
  display: block;
  font-size: 21px;
  font-weight: 850;
  line-height: 1.1;
  margin-top: 3px;
}

.bc-filter-bar {
  margin-bottom: 12px;
  padding: 10px;
}

.bc-filter-bar .form-label {
  color: var(--color-neutral-600);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
}

.bc-list-panel {
  overflow: hidden;
}

.bc-list-header {
  align-items: center;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 45px;
  padding: 10px 12px;
}

.bc-list-table {
  font-size: 12.5px;
  margin: 0;
}

.bc-list-table thead th {
  background: var(--surface-muted);
  color: var(--color-neutral-600);
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: 0;
  padding: 9px 10px;
  text-transform: uppercase;
}

.visit-type-badge {
  background: #ede9fe;
  border-radius: 999px;
  color: #5b21b6;
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  max-width: 110px;
  overflow: hidden;
  padding: 2px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visit-type-badge.visit-type-estimate {
  background: #fff7ed;
  color: #9a3412;
}

.dispatch-month-card-type {
  color: var(--color-neutral-500);
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.bc-list-table td {
  padding: 10px;
  vertical-align: middle;
}

.bc-primary-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bc-primary-cell strong,
.bc-primary-cell a {
  font-weight: 850;
  line-height: 1.2;
}

.bc-muted {
  color: var(--color-neutral-500);
  font-size: 11.5px;
}

.bc-row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
}

.bc-evidence-chip {
  background: var(--surface-muted);
  color: var(--color-neutral-600);
}

.bc-vendor-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.bc-vendor-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
}

.bc-vendor-head {
  align-items: start;
  display: grid;
  gap: 10px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-width: 0;
}

.bc-vendor-logo {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  border-radius: 7px;
  display: flex;
  height: 42px;
  justify-content: center;
  overflow: hidden;
  width: 42px;
}

.bc-vendor-logo img {
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.bc-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.bc-drawer.offcanvas {
  width: min(560px, 100vw);
}

.bc-drawer .offcanvas-header {
  border-bottom: 1px solid var(--border-default);
}

.bc-drawer .offcanvas-body {
  background: var(--surface-page);
}

.bc-drawer-section {
  margin-bottom: 12px;
}

.bc-drawer-section h3 {
  font-size: 13px;
  font-weight: 850;
  margin: 0 0 10px;
}

.bc-empty-state {
  align-items: center;
  color: var(--color-neutral-500);
  display: grid;
  gap: 7px;
  justify-items: center;
  min-height: 160px;
  padding: 24px;
  text-align: center;
}

.bc-empty-state i {
  color: var(--color-neutral-400);
  font-size: 24px;
}

.bc-empty-state strong {
  color: var(--color-neutral-800);
}

.bc-reference-toggle {
  margin-top: 12px;
}

.bc-catalog-nav {
  scroll-margin-top: 80px;
}

.bc-catalog-grid,
.bc-reference-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bc-seed-diagnostics {
  padding: 0;
}

.bc-seed-diagnostics summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
}

.bc-catalog-grid .bc-list-panel,
.bc-reference-grid .bc-list-panel {
  min-height: 0;
}

@media (max-width: 1199px) {
  .bc-command-grid {
    grid-template-columns: 1fr;
  }

  .bc-catalog-grid,
  .bc-reference-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .bc-workspace-nav {
    margin-left: calc(var(--space-3) * -1);
    margin-right: calc(var(--space-3) * -1);
    border-left: 0;
    border-radius: 0;
    border-right: 0;
  }

  .bc-kpi-strip,
  .bc-status-grid,
  .bc-vendor-grid {
    grid-template-columns: 1fr;
  }

  .bc-list-header,
  .bc-row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .bc-list-table {
    min-width: 720px;
  }
}

a.warehouse-kpi {
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

a.warehouse-kpi:hover {
  box-shadow: 0 0.4rem 0.9rem rgba(15, 23, 42, 0.12);
  border-color: #cbd5e1;
}
/* Personal display preferences are class-scoped so company data keeps its business semantics. */
body.density-compact .page-content { --bs-gutter-y: .75rem; }
body.density-compact .card-body { padding: .875rem; }
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
body.theme-dark { color-scheme: dark; background: #111827; }
body.theme-dark .page-wrapper, body.theme-dark .page-content { background: #111827; color: #e5e7eb; }
body.theme-dark .card, body.theme-dark .card-header, body.theme-dark .modal-content, body.theme-dark .dropdown-menu { background: #1f2937 !important; color: #e5e7eb; }
body.theme-dark .text-secondary, body.theme-dark .form-text { color: #a8b2c3 !important; }
body.theme-dark .form-control, body.theme-dark .form-select { background: #111827; border-color: rgba(255,255,255,.16); color: #f8fafc; }
