html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
}

.stat-card {
  border-left: 4px solid #0d6efd;
}

.stat-card.warning {
  border-left-color: #ffc107;
}

.stat-card.info {
  border-left-color: #0dcaf0;
}

.stat-card.danger {
  border-left-color: #dc3545;
}

a.stat-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.stat-card-link:hover .stat-card {
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
}

.stat-card-current {
  box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.25);
}

.stat-card.warning.stat-card-current {
  box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.55);
}

.stat-card.info.stat-card-current {
  box-shadow: 0 0 0 1px rgba(13, 202, 240, 0.55);
}

.stat-card.danger.stat-card-current {
  box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.45);
}

.dashboard-routes {
  margin-top: 0.5rem;
}

.dashboard-routes-summary {
  cursor: pointer;
  font-weight: 600;
  color: #6c757d;
  list-style: none;
}

.dashboard-routes-summary::-webkit-details-marker {
  display: none;
}

.dashboard-routes-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}

.dashboard-routes[open] > .dashboard-routes-summary::before {
  transform: rotate(90deg);
}

.pipeline-days-input {
  width: 4.5rem;
}

.pipeline-scope-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  color: #6c757d;
}

.pipeline-scope-switch .is-active {
  color: #212529;
  font-weight: 600;
}

.pipeline-scope-switch .form-check-input {
  cursor: pointer;
  margin-left: 0;
}

.pipeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.pipeline-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #6c757d;
}

.pipeline-legend-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0.15rem;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.pipeline-lane {
  display: flex;
  flex-direction: column;
  min-height: 22rem;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
}

.pipeline-lane.is-target {
  border-color: #0d6efd;
  background: #f4f8ff;
}

.pipeline-lane-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem 0.35rem;
}

.pipeline-lane-cards {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem 0.75rem;
  overflow-y: auto;
  flex: 1;
  min-height: 16rem;
}

.pipeline-empty {
  font-size: 0.85rem;
  padding: 0.85rem 0.2rem;
}

.pipeline-lane-cards:has(.pipeline-card) .pipeline-empty {
  display: none;
}

.pipeline-card {
  position: relative;
  border: 1px solid #e9ecef;
  border-left-width: 4px;
  border-radius: 0.5rem;
  padding: 0.7rem 2rem 0.7rem 0.8rem;
  background: #fff;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.pipeline-card:active {
  cursor: grabbing;
}

.pipeline-card.is-dragging {
  opacity: 0.35;
}

.pipeline-card-ghost {
  position: fixed;
  z-index: 1080;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
}

.pipeline-card:hover {
  border-color: #ced4da;
}

.pipeline-card-note {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: #6c757d;
  cursor: pointer;
  z-index: 2;
}

.pipeline-card-note:hover,
.pipeline-card-note:focus-visible {
  color: #0d6efd;
  background: rgba(13, 110, 253, 0.08);
}

.pipeline-card-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.2rem;
}

.pipeline-card-name {
  font-weight: 600;
}

.pipeline-card-due {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.15rem;
}

.pipeline-card-due.is-overdue {
  color: #dc3545;
  font-weight: 600;
}

.pipeline-card-preview {
  font-size: 0.8rem;
  color: #6c757d;
  margin-top: 0.35rem;
}

.kind-note,
.pipeline-legend-swatch.kind-note { background: #6c757d; }
.pipeline-card.kind-note { border-left-color: #6c757d; background: #f8f9fa; }

.kind-call,
.pipeline-legend-swatch.kind-call { background: #0d6efd; }
.pipeline-card.kind-call { border-left-color: #0d6efd; background: #f4f8ff; }

.kind-email,
.pipeline-legend-swatch.kind-email { background: #0dcaf0; }
.pipeline-card.kind-email { border-left-color: #0dcaf0; background: #f1fcff; }

.kind-meeting,
.pipeline-legend-swatch.kind-meeting { background: #6f42c1; }
.pipeline-card.kind-meeting { border-left-color: #6f42c1; background: #f7f3fc; }

.kind-action,
.pipeline-legend-swatch.kind-action { background: #fd7e14; }
.pipeline-card.kind-action { border-left-color: #fd7e14; background: #fff7f0; }

.kind-task,
.pipeline-legend-swatch.kind-task { background: #198754; }
.pipeline-card.kind-task { border-left-color: #198754; background: #f3fff6; }

.kind-brochures,
.pipeline-legend-swatch.kind-brochures { background: #dc3545; }
.pipeline-card.kind-brochures { border-left-color: #dc3545; background: #fff5f5; }

@media (max-width: 991.98px) {
  .pipeline {
    grid-template-columns: 1fr;
  }

  .pipeline-lane {
    min-height: 0;
  }

  .pipeline-lane-cards {
    min-height: 8rem;
  }
}

.table-actions {
  white-space: nowrap;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.route-estimate-list {
  max-height: 22rem;
  overflow: auto;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
}

.route-estimate-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.contracted-customer-jump-wrap {
  min-width: 16rem;
  max-width: 24rem;
}

.contracted-customer-jump {
  min-width: 16rem;
}

.billing-client-block {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.billing-client-header {
  background: #f8f9fa;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #dee2e6;
}

.brochure-scan-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  width: 100%;
  background: #f8f9fa;
  overflow: hidden;
}

button.brochure-scan-preview {
  border: 0;
  padding: 0;
  cursor: zoom-in;
}

.brochure-scan-preview-pdf {
  flex-direction: column;
}

.brochure-scan-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.brochure-scan-notes {
  white-space: pre-wrap;
}

.brochure-preview-body {
  background: #111;
  min-height: 50vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.brochure-preview-image {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
}

.brochure-preview-pdf {
  width: 100%;
  min-height: 75vh;
  border: 0;
  background: #fff;
}

.customer-card {
  overflow: hidden;
  transition: box-shadow 0.15s ease-in-out;
}

.customer-card:hover {
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
}

.customer-card-link:hover .customer-card-name {
  color: #0d6efd;
}

.customer-card-thumb {
  aspect-ratio: 1;
  background: #f8f9fa;
  overflow: hidden;
  border-bottom: 1px solid #dee2e6;
}

.customer-card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.customer-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f1f3f5;
}

.customer-card-placeholder-pdf {
  background: #fff5f5;
}

.customer-card-name {
  font-size: 0.875rem;
  line-height: 1.25;
}

.expanded-route-section {
  margin-bottom: 2rem;
}

.expanded-route-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #dee2e6;
}

.crm-record {
  margin-bottom: 2rem;
}

.crm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e9ecef;
  border-radius: 0.75rem;
}

.crm-avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  background: #0d6efd;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.crm-tabs {
  border-bottom-color: #dee2e6;
}

.crm-tabs .nav-link {
  color: #6c757d;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.75rem 1rem;
}

.crm-tabs .nav-link:hover {
  color: #0d6efd;
  border-color: transparent;
}

.crm-tabs .nav-link.active {
  color: #0d6efd;
  background: transparent;
  border-color: transparent transparent #0d6efd;
  font-weight: 600;
}

.crm-tab-content {
  border: 1px solid #e9ecef;
  border-top: none;
  border-radius: 0 0 0.75rem 0.75rem;
  background: #fff;
}

.crm-panel {
  padding: 1.25rem;
}

.customer-map {
  height: 420px;
  min-height: 320px;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
}

.overview-map img.leaflet-tile,
.route-map img.leaflet-tile,
.customer-map img.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
}

.crm-composer {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 1rem;
}

.crm-warehouse-location {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
}

.crm-timeline {
  position: relative;
  padding-left: 1.25rem;
}

.crm-timeline::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  background: #dee2e6;
}

.crm-timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}

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

.crm-timeline-dot {
  position: absolute;
  left: -1.05rem;
  top: 0.4rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: #0d6efd;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #0d6efd;
}

.crm-timeline-body {
  background: #fff;
}

.crm-subnotes {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f3f5;
}

.crm-subnote {
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid #ced4da;
  background: #f8f9fa;
  border-radius: 0 0.35rem 0.35rem 0;
}

.crm-subnote-form {
  margin-top: 0.35rem;
}

.crm-pre {
  white-space: pre-wrap;
}

.crm-task {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border: 1px solid #e9ecef;
  border-left-width: 4px;
  border-radius: 0.5rem;
  background: #fff;
}

.crm-task.kind-note { border-left-color: #6c757d; }
.crm-task.kind-call { border-left-color: #0d6efd; }
.crm-task.kind-email { border-left-color: #0dcaf0; }
.crm-task.kind-meeting { border-left-color: #6f42c1; }
.crm-task.kind-action { border-left-color: #fd7e14; }
.crm-task.kind-task { border-left-color: #198754; background: #f3fff6; }
.crm-task.kind-brochures { border-left-color: #dc3545; background: #fff5f5; }

.crm-task-overdue {
  border-color: #f1aeb5;
  background: #fff5f5;
}

.crm-task-done {
  background: #f8f9fa;
}

.crm-contact-card,
.crm-brochure-card {
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 0.85rem;
  background: #fff;
}

.crm-side-card {
  border: 1px solid #e9ecef;
  border-radius: 0.75rem;
  padding: 1rem 1.1rem;
  background: #fff;
}

.crm-side-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
  margin-bottom: 0.75rem;
}

.crm-meta > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f1f3f5;
}

.crm-meta > div:last-child {
  border-bottom: none;
}

.crm-meta dt {
  margin: 0;
  color: #6c757d;
  font-weight: 500;
}

.crm-meta dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
}

.crm-side-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  border-radius: 0.5rem;
  overflow: hidden;
}

.crm-side-thumb .brochure-scan-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 991.98px) {
  .crm-header {
    padding: 1rem;
  }
}

.crm-flag-icon,
.crm-flag-icon-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.crm-flag-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.crm-flag-icon-sm svg {
  width: 0.95rem;
  height: 0.95rem;
}

.crm-flag-high-value {
  color: #e6a700;
}

.crm-flag-needs-info {
  color: #0dcaf0;
}

.crm-flag-at-risk {
  color: #dc3545;
}

.crm-badge-high-value {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffe69c;
}

.crm-badge-needs-info {
  background: #cff4fc;
  color: #055160;
  border: 1px solid #9eeaf9;
}

.crm-badge-at-risk {
  background: #f8d7da;
  color: #842029;
  border: 1px solid #f1aeb5;
}

@media print {
  .crm-flag-icon,
  .crm-flag-icon-sm {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .crm-header .btn,
  .crm-header .btn-group,
  .crm-tabs,
  .crm-composer {
    display: none !important;
  }
}

.invoice-receipt-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border: 1px solid #dee2e6;
  border-radius: 999px;
  color: #6c757d;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  vertical-align: middle;
  white-space: nowrap;
}

.invoice-receipt-icon svg {
  flex-shrink: 0;
}

.billing-forecast-month {
  border-color: #e9ecef;
  color: inherit;
}

.billing-forecast-month-current {
  border-color: #ced4da;
}

.billing-forecast-month-selected {
  border-color: #0d6efd;
  box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.25);
}

a:hover .billing-forecast-month {
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.08);
}

#inventory-table tbody tr.inventory-rack-break > td {
  border-top: 2px solid #495057;
}

.linkedin-profile-form {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.linkedin-url-input {
  min-width: 16rem;
}

