/* 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;
}

/* ─── Dispatch Board ─────────────────────────────────────────────────────── */

.dispatch-board-content {
  padding-inline: 18px;
}

.dispatch-board-page {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.dispatch-board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dispatch-queue-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dispatch-view-tabs {
  display: inline-flex;
  width: max-content;
  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 {
  border: 0;
  border-right: 1px solid var(--border-default);
  background: var(--surface-card);
  color: var(--color-neutral-700);
  font-size: 13px;
  font-weight: 700;
  min-height: 36px;
  padding: 0 16px;
  transition: background .15s ease, color .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-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: .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-new > span { background: #1f7fbb; }
.dispatch-status-tile.status-pending > span { background: #a36500; }
.dispatch-status-tile.status-confirmed > span { background: #188445; }
.dispatch-status-tile.status-booked > span { background: #5b3db7; }
.dispatch-status-tile.status-dispatched > span { background: #9a6700; }
.dispatch-status-tile.status-delivered > span { background: #5f6368; }
.dispatch-status-tile.status-cancelled > span,
.dispatch-status-tile.status-late > span { background: #c7302b; }

.dispatch-board-shell.dispatch-calendar-shell {
  display: block;
  position: relative;
}

.dispatch-card-list {
  display: grid;
  gap: 8px;
}

.dispatch-grid-wrap {
  overflow: auto;
  min-width: 0;
}

.dispatch-calendar-wrap {
  min-height: 560px;
}

.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-calendar-toolbar span {
  color: var(--color-neutral-600);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .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 {
  min-width: 980px;
}

.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;
}

.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;
}

.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 .15s ease, box-shadow .15s ease, transform .15s ease;
  width: 100%;
}

.dispatch-visit-card:hover,
.dispatch-month-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.dispatch-visit-card.status-pending {
  --visit-border: #b56b00;
  --visit-bg: #fff7e8;
  --visit-text: #9a5a00;
}

.dispatch-visit-card.status-confirmed {
  --visit-border: #188445;
  --visit-bg: #ecfff3;
  --visit-text: #087533;
}

.dispatch-visit-card.status-booked {
  --visit-border: #5b3db7;
  --visit-bg: #f3efff;
  --visit-text: #4b2ba3;
}

.dispatch-visit-card.status-dispatched {
  --visit-border: #9a6700;
  --visit-bg: #fff7df;
  --visit-text: #7d5300;
}

.dispatch-visit-card.status-delivered {
  --visit-border: #5f6368;
  --visit-bg: #f6f7f8;
  --visit-text: #3f454a;
}

.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 {
  color: var(--color-neutral-950);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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,.74);
  border: 1px solid rgba(15,23,42,.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,.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-pending span { background: #b56b00; }
.dispatch-month-card.status-confirmed span { background: #188445; }
.dispatch-month-card.status-booked span { background: #5b3db7; }
.dispatch-month-card.status-dispatched span { background: #9a6700; }
.dispatch-month-card.status-delivered span { background: #5f6368; }
.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-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: 1040;
}

.dispatch-queue-drawer {
  width: min(430px, calc(100vw - 24px));
}

.dispatch-drawer.open {
  transform: translateX(0);
}

@media (max-width: 1200px) {
  .dispatch-summary-panel {
    grid-template-columns: 1fr;
  }

  .dispatch-summary-date {
    min-height: 72px;
  }
}

@media (max-width: 767px) {
  .dispatch-board-content {
    padding-inline: 0;
  }

  .dispatch-board-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dispatch-view-tabs {
    width: 100%;
  }

  .dispatch-view-tab {
    flex: 1;
  }

  .dispatch-summary-metrics,
  .dispatch-summary-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ─── 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-list {
  display: grid;
  gap: 10px;
}

.report-bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(120px, 2fr) minmax(
      84px,
      auto
    );
  gap: 10px;
  align-items: center;
}

.report-bar-label,
.report-bar-value {
  color: var(--color-neutral-700);
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-bar-value {
  text-align: right;
}

.report-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 100px;
  background: var(--color-neutral-100);
}

.report-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: var(--color-brand-600);
}

@media (max-width: 575px) {
  .report-bar-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .report-bar-value {
    text-align: left;
  }
}

/* ─── 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);
}

.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);
  min-width: 210px;
  margin: -38px 0 0 0;
  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;
  }
}
