/**
 * Malabar Technology Service Management
 * Core Component Styles & Layout Utilities
 */

/* ==========================================================================
   1. CARDS & SECTION CARDS
   ========================================================================== */
.mt-card {
  background-color: var(--mt-surface-card);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  box-shadow: var(--mt-shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.mt-card-hover:hover {
  box-shadow: var(--mt-shadow-md);
  border-color: var(--mt-border-subtle);
}

.mt-card-header {
  padding: 1rem 1.25rem;
  background-color: transparent;
  border-bottom: 1px solid var(--mt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mt-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--mt-text-main);
}

.mt-card-subtitle {
  margin: 0.25rem 0 0 0;
  font-size: 0.8125rem;
  color: var(--mt-text-muted);
}

.mt-card-body {
  padding: 1.25rem;
}

.mt-card-footer {
  padding: 0.875rem 1.25rem;
  background-color: var(--mt-surface-subtle);
  border-top: 1px solid var(--mt-border);
}

/* ==========================================================================
   2. STAT CARDS / KPI TILES
   ========================================================================== */
.stat-card {
  background-color: var(--mt-surface-card);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  padding: 1.25rem;
  box-shadow: var(--mt-shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--mt-shadow-md);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--mt-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.stat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: var(--mt-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-icon-primary {
  background-color: var(--mt-primary-subtle);
  color: var(--mt-primary);
}

.stat-icon-accent {
  background-color: var(--mt-accent-subtle);
  color: var(--mt-accent);
}

.stat-icon-success {
  background-color: var(--mt-success-subtle);
  color: var(--mt-success);
}

.stat-icon-warning {
  background-color: var(--mt-warning-subtle);
  color: var(--mt-warning);
}

.stat-icon-danger {
  background-color: var(--mt-danger-subtle);
  color: var(--mt-danger);
}

.stat-icon-info {
  background-color: var(--mt-info-subtle);
  color: var(--mt-info);
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--mt-text-main);
  letter-spacing: -0.02em;
  margin: 0;
}

.stat-footer {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--mt-text-muted);
}

.stat-trend {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-trend-up {
  color: var(--mt-success);
}

.stat-trend-down {
  color: var(--mt-danger);
}

/* ==========================================================================
   3. STATUS BADGES
   ========================================================================== */
.mt-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--mt-radius-pill);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  background-color: currentColor;
}

/* Status variants */
.badge-status-new {
  background-color: var(--mt-info-subtle);
  color: var(--mt-info);
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.badge-status-assigned {
  background-color: var(--mt-primary-subtle);
  color: var(--mt-primary);
  border: 1px solid rgba(11, 59, 143, 0.25);
}

.badge-status-accepted {
  background-color: var(--mt-accent-subtle);
  color: var(--mt-accent);
  border: 1px solid rgba(14, 165, 164, 0.25);
}

.badge-status-in-progress {
  background-color: var(--mt-warning-subtle);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
[data-bs-theme="dark"] .badge-status-in-progress {
  color: #fbbf24;
}

.badge-status-completed {
  background-color: var(--mt-success-subtle);
  color: var(--mt-success);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.badge-status-invoiced {
  background-color: rgba(99, 102, 241, 0.15);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.badge-status-paid {
  background-color: var(--mt-success-subtle);
  color: var(--mt-success);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.badge-status-cancelled {
  background-color: var(--mt-surface-subtle);
  color: var(--mt-text-muted);
  border: 1px solid var(--mt-border);
}

.badge-status-declined {
  background-color: var(--mt-danger-subtle);
  color: var(--mt-danger);
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.badge-status-waiting-parts {
  background-color: var(--mt-warning-subtle, #fef3c7);
  color: var(--mt-warning, #d97706);
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.badge-status-rescheduled {
  background-color: var(--mt-info-subtle, #e0f2fe);
  color: var(--mt-info, #0284c7);
  border: 1px solid rgba(2, 132, 199, 0.25);
}

/* Priority variants */
.badge-priority-normal {
  background-color: var(--mt-surface-subtle);
  color: var(--mt-text-muted);
  border: 1px solid var(--mt-border);
}

.badge-priority-high {
  background-color: var(--mt-warning-subtle);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
[data-bs-theme="dark"] .badge-priority-high {
  color: #fbbf24;
}

.badge-priority-urgent {
  background-color: var(--mt-danger-subtle);
  color: var(--mt-danger);
  border: 1px solid rgba(220, 38, 38, 0.35);
  font-weight: 700;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.badge-priority-unset {
  background-color: transparent;
  color: var(--mt-text-muted);
  border: 1px dashed var(--mt-border);
}

/* Channel variants */
.badge-channel-online {
  background-color: var(--mt-primary-subtle);
  color: var(--mt-primary);
  border: 1px solid rgba(11, 59, 143, 0.2);
}

.badge-channel-offline {
  background-color: var(--mt-surface-subtle);
  color: var(--mt-text-muted);
  border: 1px solid var(--mt-border);
}

/* Invoice variants */
.badge-invoice-draft { background-color: var(--mt-surface-subtle); color: var(--mt-text-muted); border: 1px solid var(--mt-border); }
.badge-invoice-sent { background-color: var(--mt-primary-subtle); color: var(--mt-primary); border: 1px solid rgba(11, 59, 143, 0.2); }
.badge-invoice-paid { background-color: var(--mt-success-subtle); color: var(--mt-success); border: 1px solid rgba(22, 163, 74, 0.2); }
.badge-invoice-overdue { background-color: var(--mt-danger-subtle); color: var(--mt-danger); border: 1px solid rgba(220, 38, 38, 0.2); }
.badge-invoice-cancelled { background-color: var(--mt-surface-subtle); color: var(--mt-text-muted); border: 1px solid var(--mt-border); }


/* Tech Availability */
.badge-tech-available { background-color: var(--mt-success-subtle); color: var(--mt-success); border: 1px solid rgba(22, 163, 74, 0.2); }
.badge-tech-onduty { background-color: var(--mt-primary-subtle); color: var(--mt-primary); border: 1px solid rgba(11, 59, 143, 0.2); }
.badge-tech-busy { background-color: var(--mt-warning-subtle); color: #b45309; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-tech-onleave { background-color: var(--mt-surface-subtle); color: var(--mt-text-muted); border: 1px solid var(--mt-border); }
.badge-tech-offline { background-color: var(--mt-surface-subtle); color: var(--mt-text-muted); border: 1px solid var(--mt-border); }
.badge-status-default { background-color: var(--mt-surface-subtle); color: var(--mt-text-muted); border: 1px solid var(--mt-border); }

/* ==========================================================================
   4. TIMELINE
   ========================================================================== */
.mt-timeline {
  position: relative;
  padding-left: 2rem;
}

.mt-timeline::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0.8125rem;
  width: 2px;
  background-color: var(--mt-border);
}

.mt-timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.mt-timeline-item:last-child {
  padding-bottom: 0;
}

.mt-timeline-marker {
  position: absolute;
  left: -2rem;
  top: 0.15rem;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background-color: var(--mt-surface-card);
  border: 2px solid var(--mt-primary);
  color: var(--mt-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  z-index: 1;
}

.mt-timeline-marker.success { border-color: var(--mt-success); color: var(--mt-success); }
.mt-timeline-marker.warning { border-color: var(--mt-warning); color: var(--mt-warning); }
.mt-timeline-marker.danger { border-color: var(--mt-danger); color: var(--mt-danger); }
.mt-timeline-marker.info { border-color: var(--mt-info); color: var(--mt-info); }

.mt-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.mt-timeline-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--mt-text-main);
  margin: 0;
}

.mt-timeline-time {
  font-size: 0.75rem;
  color: var(--mt-text-muted);
  white-space: nowrap;
}

.mt-timeline-desc {
  font-size: 0.84rem;
  color: var(--mt-text-muted);
  margin: 0.25rem 0 0 0;
}

/* ==========================================================================
   5. STEPPER
   ========================================================================== */
.mt-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  width: 100%;
}

.mt-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  flex: 1;
  z-index: 2;
}

.mt-step-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: var(--mt-surface-subtle);
  border: 2px solid var(--mt-border);
  color: var(--mt-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.mt-step.active .mt-step-circle {
  background-color: var(--mt-primary);
  border-color: var(--mt-primary);
  color: #ffffff;
  box-shadow: 0 0 0 3px var(--mt-primary-subtle);
}

.mt-step.completed .mt-step-circle {
  background-color: var(--mt-success);
  border-color: var(--mt-success);
  color: #ffffff;
}

.mt-step-label {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--mt-text-muted);
}

.mt-step.active .mt-step-label {
  color: var(--mt-text-main);
  font-weight: 600;
}

.mt-step.completed .mt-step-label {
  color: var(--mt-text-main);
}

.mt-step-line {
  position: absolute;
  top: 19px;
  left: 50%;
  width: 100%;
  height: 2px;
  background-color: var(--mt-border);
  z-index: 1;
}

.mt-step:last-child .mt-step-line {
  display: none;
}

.mt-step.completed .mt-step-line {
  background-color: var(--mt-success);
}

/* ==========================================================================
   APP SHELL LAYOUT
   Authoritative rules for staff layout shell, sidebar, topbar, and main column.
   ========================================================================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
}

.app-sidebar {
  width: var(--sidebar-w);
  background-color: var(--mt-surface);
  border-right: 1px solid var(--mt-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-sidebar:not(.offcanvas) {
  z-index: var(--z-sidebar, 1020);
}

.offcanvas,
.offcanvas.app-sidebar,
.allocation-offcanvas {
  z-index: var(--z-offcanvas, 1045) !important;
}

.offcanvas-backdrop {
  z-index: var(--z-backdrop, 1040) !important;
}

.modal {
  z-index: var(--z-modal, 1055) !important;
}

.modal-backdrop {
  z-index: var(--z-modal-backdrop, 1050) !important;
}

.toast-container {
  pointer-events: none !important;
  z-index: var(--z-toast, 1090) !important;
}

.toast-container .toast {
  pointer-events: auto !important;
}

.sidebar-brand-block {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--mt-border);
  gap: 0.75rem;
  text-decoration: none;
  color: var(--mt-text-main);
  background-color: var(--mt-surface);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--mt-radius-sm);
  background-color: var(--mt-primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar-brand-title {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mt-text-muted);
}

.sidebar-nav-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  padding: 1rem 0.75rem;
}

.sidebar-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mt-text-muted);
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--mt-radius-pill);
  color: var(--mt-text-main);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  min-height: 40px;
  transition: all 0.15s ease;
  margin-bottom: 0.15rem;
  position: relative;
}

.sidebar-nav-item:hover {
  background-color: var(--mt-surface-subtle);
  color: var(--mt-primary);
}

.sidebar-nav-item.active {
  background-color: var(--mt-primary) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: var(--mt-shadow-sm);
}

.sidebar-nav-item.active i {
  color: #ffffff !important;
}

.sidebar-nav-icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--mt-border);
  font-size: 0.75rem;
  color: var(--mt-text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--mt-surface);
  flex-shrink: 0;
}

/* Topbar */
.app-topbar {
  height: var(--topbar-h);
  background-color: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: var(--z-topbar, 1020);
}

.topbar-search-btn {
  background-color: var(--mt-surface-subtle);
  border: 1px solid var(--mt-border);
  color: var(--mt-text-muted);
  border-radius: var(--mt-radius);
  padding: 0.4rem 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  min-width: 240px;
}

.topbar-search-btn:hover {
  background-color: var(--mt-surface);
  border-color: var(--mt-accent);
  color: var(--mt-text-main);
}

.cmd-kbd {
  background-color: var(--mt-surface-card);
  border: 1px solid var(--mt-border);
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  color: var(--mt-text-muted);
}

.app-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--mt-bg-body);
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-main {
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
  min-height: calc(100dvh - var(--topbar-h));
  padding: 1.25rem 0;
}

/* Desktop App Shell Layout (>= 992px) */
@media (min-width: 992px) {
  body.sidebar-collapsed {
    --sidebar-w: var(--sidebar-w-collapsed);
  }

  .app-sidebar:not(.offcanvas) {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    height: 100dvh;
    width: var(--sidebar-w);
  }

  .app-content-area {
    margin-left: var(--sidebar-w);
  }

  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .sidebar-section-label,
  body.sidebar-collapsed .sidebar-item-label,
  body.sidebar-collapsed .sidebar-item-badge,
  body.sidebar-collapsed .sidebar-footer-text {
    display: none !important;
  }

  body.sidebar-collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 0.6rem 0;
    border-radius: var(--mt-radius-sm);
  }

  body.sidebar-collapsed .sidebar-brand-block {
    justify-content: center;
    padding: 0;
  }

  body.sidebar-collapsed .sidebar-footer {
    justify-content: center;
    padding: 0.75rem 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar,
  .app-sidebar:not(.offcanvas),
  .app-content-area {
    transition: none !important;
  }
}

/* ==========================================================================
   Page Container (Wider staff layout up to 2000px, responsive horizontal padding)
   ========================================================================== */
.page-container {
  max-width: 2000px;
  overflow-x: clip;
}

/* ==========================================================================
   Client Portal Layout Utilities (Phone-first, 1200px max container)
   ========================================================================== */
.client-container {
  max-width: 1200px;
}

.client-topbar {
  height: 56px;
  background-color: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

@media (min-width: 768px) {
  .client-topbar {
    height: var(--topbar-h);
    padding: 0 1.5rem;
  }
}

.client-tab-nav {
  background-color: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
  padding: 0 1rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  position: sticky;
  top: var(--topbar-h);
  z-index: 1015;
}

.client-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--mt-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.client-tab-item:hover {
  color: var(--mt-primary);
}

.client-tab-item.active {
  color: var(--mt-primary);
  font-weight: 600;
  border-bottom-color: var(--mt-primary);
}

.client-portal-main {
  flex: 1;
  padding: 1.25rem 0;
}

/* ==========================================================================
   Technician Layout Utilities (Phone-first 360px, 1000px max container)
   ========================================================================== */
.tech-container {
  width: 100%;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 12px;
  padding-right: 12px;
}

@media (min-width: 768px) {
  .tech-container {
    padding-left: 24px;
    padding-right: 24px;
  }
}

.tech-topbar {
  height: 56px;
  background-color: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.75rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}

@media (min-width: 768px) {
  .tech-topbar {
    height: var(--topbar-h);
    padding: 0 1.5rem;
  }
}

.tech-tab-nav {
  background-color: var(--mt-surface);
  border-bottom: 1px solid var(--mt-border);
  padding: 0 1rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.tech-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--mt-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tech-tab-item:hover {
  color: var(--mt-primary);
}

.tech-tab-item.active {
  color: var(--mt-primary);
  font-weight: 600;
  border-bottom-color: var(--mt-primary);
}

.tech-main-content {
  flex: 1;
  padding: 0.75rem 0 calc(60px + env(safe-area-inset-bottom, 0px)) 0;
}

@media (min-width: 768px) {
  .tech-main-content {
    padding: 1.5rem 0 2rem 0;
  }
}

.availability-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--mt-border);
  background-color: var(--mt-surface);
  transition: all 0.15s ease;
  min-height: 32px;
}

.availability-pill:hover {
  background-color: var(--mt-surface-hover, var(--mt-body-bg));
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.available { background-color: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }
.status-dot.busy { background-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }
.status-dot.offduty { background-color: #6b7280; box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.2); }

.tech-timer-display {
  font-family: var(--mt-font-mono, monospace);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--mt-primary);
}

.signature-canvas {
  width: 100%;
  height: 180px;
  border: 2px dashed var(--mt-border);
  border-radius: 8px;
  background-color: #ffffff;
  touch-action: none;
  cursor: crosshair;
}

.btn-touch-target {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tech-sticky-action-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--mt-surface);
  border-top: 1px solid var(--mt-border);
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px)) 1rem;
  z-index: 1010;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
}

@media (max-width: 767.98px) {
  .client-portal-main {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Bottom Navigation Bar for Mobile (< 768px) */
.app-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--mt-surface);
  border-top: 1px solid var(--mt-border);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 1030;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-decoration: none;
  color: var(--mt-text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.25rem 0;
  min-height: 48px;
  transition: color 0.15s ease;
}

.bottom-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.bottom-nav-item.active {
  color: var(--mt-primary);
  font-weight: 700;
}

/* When bottom navigation is visible, protect content from overlap */
.has-bottom-nav .app-main {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
}

/* Command Palette Modal Styling */
.cmd-result-group-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mt-text-muted);
  padding: 0.5rem 0.75rem 0.25rem 0.75rem;
}

.cmd-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--mt-radius-sm);
  text-decoration: none;
  color: var(--mt-text-main);
  transition: background-color 0.15s ease;
  cursor: pointer;
}

.cmd-result-item:hover,
.cmd-result-item.active {
  background-color: var(--mt-primary-subtle);
  color: var(--mt-primary);
}

.cmd-result-item.active i {
  color: var(--mt-primary);
}

.cmd-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--mt-radius-sm);
  background-color: var(--mt-surface-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ==========================================================================
   7. TABLES-TO-CARDS ON PHONE (< 768px)
   ========================================================================== */
@media (max-width: 767.98px) {
  .table-cards {
    border: none;
    background: transparent;
  }

  .table-cards thead {
    display: none;
  }

  .table-cards tbody,
  .table-cards tr {
    display: block;
    width: 100%;
  }

  .table-cards tr {
    background-color: var(--mt-surface-card);
    border: 1px solid var(--mt-border);
    border-radius: var(--mt-radius);
    margin-bottom: 0.875rem;
    padding: 0.875rem;
    box-shadow: var(--mt-shadow-sm);
  }

  .table-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    border-bottom: 1px dashed var(--mt-border-light);
    padding: 0.45rem 0;
    font-size: 0.875rem;
    text-align: right;
  }

  .table-cards td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .table-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--mt-text-muted);
    font-size: 0.8125rem;
    text-align: left;
    margin-right: 0.75rem;
    flex-shrink: 0;
  }
}

/* ==========================================================================
   8. AVATAR, EMPTY STATE & FILTER BAR
   ========================================================================== */
.mt-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  background-color: var(--mt-primary-subtle);
  color: var(--mt-primary);
  flex-shrink: 0;
}

.mt-avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.mt-avatar-md { width: 40px; height: 40px; font-size: 0.875rem; }
.mt-avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }

.empty-state-box {
  padding: 3rem 1.5rem;
  text-align: center;
  background-color: var(--mt-surface-card);
  border: 1px dashed var(--mt-border-subtle);
  border-radius: var(--mt-radius);
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--mt-text-muted);
  opacity: 0.6;
  margin-bottom: 1rem;
}

.filter-bar-card {
  background-color: var(--mt-surface-card);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  padding: 0.875rem 1rem;
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   9. A4 PRINT RULES AND INVOICE / RECEIPT SHEET STYLES
   ========================================================================== */
@page {
  size: A4;
  margin: 12mm;
}

@media print {
  /* Hide shell, bottom nav, action controls, and diagnostics in print */
  .app-sidebar,
  .app-topbar,
  .app-bottom-nav,
  .app-footer,
  .invoice-action-bar,
  .receipt-action-bar,
  .portal-nav-bar,
  .filter-bar-card,
  .pagination-container,
  .modal,
  .modal-backdrop,
  .offcanvas,
  .offcanvas-backdrop,
  .btn,
  .no-print,
  #diagnosticsHud,
  #diagnosticsBackdrop {
    display: none !important;
  }

  body, html {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #111827 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 10pt !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Force light theme colors on print regardless of active theme */
  [data-bs-theme="dark"] body,
  [data-bs-theme="dark"] .invoice-sheet,
  [data-bs-theme="dark"] .receipt-sheet {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #111827 !important;
  }

  .invoice-sheet,
  .receipt-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    background: #ffffff !important;
    color: #111827 !important;
  }

  /* Repeat table headers on page breaks */
  thead {
    display: table-header-group !important;
  }

  /* Avoid breaking inside table rows */
  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .table th,
  .table td,
  .invoice-table th,
  .invoice-table td,
  .receipt-table th,
  .receipt-table td {
    color: #111827 !important;
    border-color: #cbd5e1 !important;
    background-color: transparent !important;
  }

  .badge {
    border: 1px solid #94a3b8 !important;
    color: #0f172a !important;
    background: #f1f5f9 !important;
  }
}

/* Screen Display Styles for Printable Sheets */
.invoice-sheet-container,
.receipt-sheet-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1rem;
}

.invoice-sheet {
  width: 100%;
  max-width: 860px;
  min-width: 680px;
  margin: 0 auto;
  background-color: var(--mt-surface-card);
  color: var(--mt-text-main);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  padding: 2.25rem 2.5rem;
  box-shadow: var(--mt-shadow-md);
  position: relative;
}

.receipt-sheet {
  width: 100%;
  max-width: 760px;
  min-width: 600px;
  margin: 0 auto;
  background-color: var(--mt-surface-card);
  color: var(--mt-text-main);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius);
  padding: 2rem 2.25rem;
  box-shadow: var(--mt-shadow-md);
  position: relative;
}

@media (max-width: 767.98px) {
  .invoice-sheet,
  .receipt-sheet {
    min-width: 580px;
    padding: 1.25rem;
  }
}

/* Watermark status stamp */
.invoice-status-stamp {
  position: absolute;
  top: 6.5rem;
  right: 2.5rem;
  border: 3px solid;
  border-radius: 8px;
  padding: 0.25rem 1rem;
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transform: rotate(-10deg);
  opacity: 0.78;
  pointer-events: none;
}
.invoice-status-stamp.stamp-paid {
  border-color: #16a34a;
  color: #16a34a;
}
.invoice-status-stamp.stamp-overdue {
  border-color: #dc2626;
  color: #dc2626;
}
.invoice-status-stamp.stamp-cancelled {
  border-color: #475569;
  color: #475569;
}
.invoice-status-stamp.stamp-issued {
  border-color: #0284c7;
  color: #0284c7;
}

/* Mobile Sticky Totals Bar */
.totals-sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky-action);
  background-color: var(--mt-surface-card);
  border-top: 1px solid var(--mt-border);
  box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.08);
  padding: 0.75rem 1rem;
}

/* ==========================================================================
   10. STAFF DASHBOARD SPECIFIC UTILITIES & COMPONENTS
   ========================================================================== */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--mt-success);
  display: inline-block;
  animation: pulse-live 1.8s infinite;
}

@keyframes pulse-live {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(22, 163, 74, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
  }
}

.distribution-bar {
  display: flex;
  height: 10px;
  border-radius: var(--mt-radius-pill);
  overflow: hidden;
  background-color: var(--mt-border-light);
}

.distribution-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.distribution-legend-tile {
  background-color: var(--mt-surface-subtle);
  border: 1px solid var(--mt-border);
  border-radius: var(--mt-radius-sm);
  padding: 0.5rem 0.65rem;
}

/* Today's Service Snapshot Status Row */
.snapshot-status-row {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0.75rem;
  padding-bottom: 0.25rem;
}

.snapshot-status-card {
  flex: 0 0 auto;
  min-width: 150px;
  scroll-snap-align: start;
  background-color: var(--mt-surface-subtle);
  border-radius: var(--mt-radius-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.snapshot-status-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--mt-shadow-sm);
}

@media (min-width: 992px) {
  .snapshot-status-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    overflow-x: visible;
    scroll-snap-type: none;
    gap: 0.75rem;
    padding-bottom: 0;
  }
  .snapshot-status-card {
    min-width: 0;
  }
}

.activity-feed-container {
  max-height: 380px;
  overflow-y: auto;
}

.btn-toggle-group .btn-check:checked + .btn {
  background-color: var(--mt-primary) !important;
  color: #ffffff !important;
  border-color: var(--mt-primary) !important;
}

/* Skeleton Shimmer Loading Placeholder */
@keyframes mt-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.shimmer-placeholder {
  background: linear-gradient(
    90deg,
    var(--mt-surface-card) 25%,
    var(--mt-surface-subtle) 50%,
    var(--mt-surface-card) 75%
  );
  background-size: 200% 100%;
  animation: mt-shimmer 1.4s infinite;
  border-radius: var(--mt-radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  .pulse-dot {
    animation: none;
  }
  .shimmer-placeholder {
    animation: none;
  }
}

.activity-feed-container::-webkit-scrollbar {
  width: 6px;
}

.activity-feed-container::-webkit-scrollbar-track {
  background: transparent;
}

.activity-feed-container::-webkit-scrollbar-thumb {
  background-color: var(--mt-border-subtle);
  border-radius: 3px;
}

/* ==========================================================================
   11. COMPLAINTS MODULE STYLES & STEPPER
   ========================================================================== */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Lifecycle Stepper */
.mt-stepper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  position: relative;
  overflow-x: auto;
  padding: 0.5rem 0.25rem;
}

.mt-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
  text-align: center;
  min-width: 80px;
}

.mt-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  background-color: var(--mt-surface-subtle);
  color: var(--mt-text-muted);
  border: 2px solid var(--mt-border);
  z-index: 2;
  transition: all 0.2s ease;
}

.mt-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mt-text-muted);
  margin-top: 0.4rem;
  line-height: 1.2;
}

.mt-step-time {
  font-size: 0.6875rem;
  color: var(--mt-text-muted);
  margin-top: 0.15rem;
  font-family: monospace;
}

.mt-step-line {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background-color: var(--mt-border);
  z-index: 1;
}

.mt-step:last-child .mt-step-line {
  display: none;
}

/* Stepper state modifiers */
.mt-step.completed .mt-step-circle {
  background-color: var(--mt-success);
  border-color: var(--mt-success);
  color: #ffffff;
}

.mt-step.completed .mt-step-line {
  background-color: var(--mt-success);
}

.mt-step.completed .mt-step-label {
  color: var(--mt-text-main);
}

.mt-step.active .mt-step-circle {
  background-color: var(--mt-primary-subtle);
  border-color: var(--mt-primary);
  color: var(--mt-primary);
  box-shadow: 0 0 0 4px rgba(11, 59, 143, 0.15);
}

.mt-step.active .mt-step-label {
  color: var(--mt-primary);
  font-weight: 700;
}

.mt-step.cancelled .mt-step-circle {
  background-color: var(--mt-danger);
  border-color: var(--mt-danger);
  color: #ffffff;
}

.mt-step.cancelled .mt-step-label {
  color: var(--mt-danger);
  font-weight: 700;
}

/* Photo Tile Card */
.photo-tile-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
}

.photo-tile-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--mt-shadow-md);
  border-color: var(--mt-primary);
}

/* Bulk Select Floating Bar */
.bulk-select-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1040;
  background-color: var(--mt-surface-card);
  border: 1px solid var(--mt-border);
  box-shadow: var(--mt-shadow-lg);
  border-radius: var(--mt-radius-pill);
  padding: 0.5rem 1.25rem;
  display: none;
  align-items: center;
  gap: 1rem;
}

.bulk-select-bar.show {
  display: flex !important;
  animation: slideUpBulk 0.2s ease-out;
}

@keyframes slideUpBulk {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Status Chips Bar */
.status-chips-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--mt-radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  background-color: var(--mt-surface-card);
  border: 1px solid var(--mt-border);
  color: var(--mt-text-main);
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
}

.status-chip:hover {
  border-color: var(--mt-primary);
  color: var(--mt-primary);
}

.status-chip.active {
  background-color: var(--mt-primary);
  border-color: var(--mt-primary);
  color: #ffffff;
}

.status-chip.active .badge {
  background-color: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

/* Sticky Action Bar on Phone */
@media (max-width: 767.98px) {
  .sticky-form-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--mt-surface-card);
    border-top: 1px solid var(--mt-border);
    padding: 0.75rem 1rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1030;
    display: flex;
    gap: 0.5rem;
  }
}

/* ==========================================================================
   12. UI-5B BOOKING & SERVICE ADDRESS COMPONENTS
   ========================================================================== */

/* Clickable Selection Radio Cards (Request Type, Equipment, Address) */
.selection-radio-card {
  border: 1.5px solid var(--mt-border);
  border-radius: var(--mt-radius-md);
  background-color: var(--mt-surface-card);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: block;
}

.selection-radio-card:hover {
  border-color: var(--mt-primary);
  background-color: var(--mt-surface-subtle);
  transform: translateY(-1px);
}

.selection-radio-card.active,
.selection-radio-card:has(input:checked) {
  border-color: var(--mt-primary) !important;
  background-color: var(--mt-primary-subtle) !important;
  box-shadow: 0 0 0 2px rgba(11, 59, 143, 0.15);
}

.selection-radio-card input[type="radio"] {
  accent-color: var(--mt-primary);
}

/* Channel Big Toggle Buttons */
.channel-toggle-group .btn-check:checked + .btn {
  background-color: var(--mt-primary);
  border-color: var(--mt-primary);
  color: #ffffff;
  box-shadow: var(--mt-shadow-sm);
}

/* Map Placeholder Box */
.map-placeholder-box {
  width: 100%;
  height: 160px;
  background: repeating-linear-gradient(
    45deg,
    var(--mt-surface-subtle),
    var(--mt-surface-subtle) 10px,
    var(--mt-surface-card) 10px,
    var(--mt-surface-card) 20px
  );
  border: 1px dashed var(--mt-border);
  border-radius: var(--mt-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--mt-text-muted);
}

/* Request Type Badges */
.badge-breakdown {
  background-color: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

.badge-scheduled {
  background-color: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

[data-bs-theme="dark"] .badge-breakdown {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

[data-bs-theme="dark"] .badge-scheduled {
  background-color: rgba(129, 140, 248, 0.2);
  color: #a5b4fc;
  border-color: rgba(129, 140, 248, 0.4);
}

/* ==============================================================================
   MAP COMPONENTS (UI-7)
   ============================================================================== */

/* Responsive Map Containers */
.map-container {
  width: 100%;
  height: 260px;
  min-height: 260px;
  border-radius: var(--mt-card-radius, 10px);
  position: relative;
  background-color: var(--mt-surface-alt, #f8fafc);
  overflow: hidden;
}

@media (min-width: 768px) {
  .map-container {
    height: 380px;
    min-height: 380px;
  }
}

.map-container-compact {
  height: 200px !important;
  min-height: 200px !important;
}

.map-container-lg {
  height: 480px;
  min-height: 480px;
}

@media (min-width: 992px) {
  .map-container-lg {
    height: 600px;
    min-height: 600px;
  }
}

/* Dark Theme Filter for OpenStreetMap Tiles */
[data-bs-theme="dark"] .leaflet-tile-pane {
  filter: brightness(0.65) invert(1) contrast(3) hue-rotate(200deg) saturate(0.35);
}

[data-bs-theme="dark"] .leaflet-container {
  background-color: #0f172a !important;
}

/* Leaflet Zoom Control Touch Target (Min 40px) */
.leaflet-bar a {
  min-width: 40px !important;
  min-height: 40px !important;
  line-height: 40px !important;
  font-size: 18px !important;
  color: var(--mt-text, #0f172a) !important;
  background-color: var(--mt-surface, #ffffff) !important;
  border-color: var(--mt-border, #e2e8f0) !important;
}

.leaflet-bar a:hover {
  background-color: var(--mt-surface-alt, #f1f5f9) !important;
}

.map-container {
  min-height: 280px;
  position: relative;
}

/* Touch Protection Overlay scoped under .map-container */
.map-container .map-touch-overlay,
.map-container-wrapper .map-touch-overlay {
  position: absolute;
  inset: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.map-container .map-touch-overlay.unlocked,
.map-container-wrapper .map-touch-overlay.unlocked,
.map-container .map-touch-overlay[style*="display: none"],
.map-container-wrapper .map-touch-overlay[style*="display: none"] {
  display: none !important;
}

@media not (pointer: coarse) {
  .map-container .map-touch-overlay,
  .map-container-wrapper .map-touch-overlay {
    display: none !important;
  }
}

.map-touch-badge {
  background: var(--mt-surface, #ffffff);
  color: var(--mt-text, #0f172a);
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Tile Error Notice Banner */
.map-tile-error-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1010;
  background-color: var(--mt-surface, #ffffff);
  color: var(--mt-text-muted, #64748b);
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--mt-border, #e2e8f0);
  font-size: 0.78rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: none;
}

/* Custom DivIcon Markers (No Image Files) */
.map-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  border: 2px solid #ffffff;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.map-marker i {
  transform: rotate(45deg);
  font-size: 1rem;
  color: #ffffff;
}

.map-marker:hover {
  transform: rotate(-45deg) scale(1.15);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

/* Marker Color Variants */
.map-marker-site {
  background-color: #0284c7; /* Primary blue */
}

.map-marker-start {
  background-color: #16a34a; /* Green */
}

.map-marker-end {
  background-color: #dc2626; /* Red */
}

.map-marker-tech {
  background-color: #2563eb; /* Cobalt blue */
}

.map-marker-available {
  background-color: #16a34a; /* Green */
}

.map-marker-busy {
  background-color: #d97706; /* Amber */
}

.map-marker-offduty {
  background-color: #64748b; /* Slate */
}

.map-marker-urgent {
  background-color: #dc2626; /* Red */
}

.map-marker-high {
  background-color: #ea580c; /* Orange */
}

.map-marker-normal {
  background-color: #0284c7; /* Sky */
}

.map-marker-low {
  background-color: #0d9488; /* Teal */
}

/* Pulsing live technician ring */
.map-marker-pulse {
  animation: marker-pulse-ring 2s infinite ease-out;
}

@keyframes marker-pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(37, 99, 235, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  background-color: var(--mt-surface, #ffffff);
  color: var(--mt-text, #0f172a);
  border-radius: var(--mt-card-radius, 8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--mt-border, #e2e8f0);
}

.leaflet-popup-tip {
  background-color: var(--mt-surface, #ffffff);
}

/* ==============================================================================
   Notifications Module & Bell Component (UI-14)
   ============================================================================== */

.mt-notification-dropdown {
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: 70vh;
  z-index: var(--z-dropdown, 1030);
  border-radius: var(--mt-radius, 10px);
}

.mt-notification-dropdown .mt-notification-body {
  max-height: calc(70vh - 110px);
  overflow-y: auto;
}

@media (max-width: 767.98px) {
  .mt-notification-dropdown {
    display: none !important;
  }
}

.mt-notification-sheet {
  height: 85vh !important;
  max-height: 85vh !important;
  z-index: var(--z-offcanvas, 1045) !important;
  border-top-left-radius: 16px !important;
  border-top-right-radius: 16px !important;
}

.mt-sheet-drag-handle {
  width: 44px;
  height: 5px;
  background-color: var(--bs-border-color);
  border-radius: 3px;
  margin: 10px auto 4px auto;
  cursor: grab;
}

.mt-notification-message {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.mt-notif-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.mt-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--bs-primary);
  flex-shrink: 0;
}

.mt-notification-item {
  min-height: 48px;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
  text-decoration: none !important;
}

.mt-notification-item:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: -2px;
}

/* Toast Container (Live Toasts) */
.mt-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-toast, 1090);
  pointer-events: none;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  max-width: 380px;
  width: calc(100% - 2rem);
}

.mt-toast-container .toast {
  pointer-events: auto;
}

@media (max-width: 575.98px) {
  .mt-toast-container {
    bottom: 4.5rem; /* above mobile bottom nav */
    right: 1rem;
    left: 1rem;
    width: auto;
  }
}

/* ==========================================================================
   16. BREADCRUMBS RESPONSIVE SINGLE-LINE TRUNCATION (UI-20)
   ========================================================================== */
.breadcrumb {
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.breadcrumb-item.active {
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
