.modems-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 700;
  color: #1f2937;
}

.modems-title-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.modems-title-text {
  font-size: 18px;
  font-weight: 700;
}
.modems-count-top {
  font-size: 12px;
  color: #4b5563;
}
.modems-title {
  font-size: 20px;
}
.modems-count {
  font-size: 14px;
  color: #4b5563;
}
.modems-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.modems-toolbar input,
.modems-toolbar select {
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
}
.modems-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}
.modems-table th,
.modems-table td {
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  text-align: left;
  font-size: 12px;
}
.modems-table th {
  background: #f9fafb;
  font-weight: 700;
  cursor: pointer;
}
.modem-assigned {
  color: #065f46;
  font-weight: 600;
}
.modem-unassigned {
  color: #b91c1c;
  font-weight: 600;
}
.modems-footer {
  font-size: 13px;
  color: #4b5563;
}

.modem-stale {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
  border-radius: 6px;
  padding: 6px 8px;
}

.modem-recent {
  background: #ecfdf3;
  color: #166534;
  font-weight: 700;
  border-radius: 6px;
  padding: 6px 8px;
}

.modems-table th .sort-indicator {
  font-size: 10px;
  color: #6b7280;
}

.sr-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
}
.pill-complete {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 10px rgba(34, 197, 94, 0.25);
}
.pill-pending {
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  box-shadow: 0 4px 10px rgba(96, 165, 250, 0.25);
}

.variance-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 12px;
}
.variance-positive {
  background: #ecfdf3;
  color: #166534;
  box-shadow: 0 3px 8px rgba(34, 197, 94, 0.2);
}
.variance-negative {
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: 0 3px 8px rgba(185, 28, 28, 0.2);
}
.variance-neutral {
  background: #f3f4f6;
  color: #374151;
}

.sr-info-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.sr-info-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.sr-info-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}
.sr-info-value {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
}
.metric-good {
  background: #ecfdf3;
  color: #166534;
}
.metric-warn {
  background: #fffbeb;
  color: #92400e;
}
.metric-bad {
  background: #fef2f2;
  color: #b91c1c;
}

/* --- Service Run Add Machine Modal --- */
.sr-add-overlay {
  backdrop-filter: blur(4px);
}
.sr-add-modal {
  width: min(520px, 92vw);
  border-radius: 18px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.2);
  border: 1px solid #e5e7eb;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
}
.sr-add-modal .modems-title {
  padding: 18px 20px;
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  letter-spacing: 0.2px;
}
.sr-add-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px 12px;
}
.sr-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}
.sr-field label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  width: 160px;
  text-align: right;
}
.sr-control {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d4d8e0;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.sr-control:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.sr-control textarea,
.sr-control:has(textarea) {
  min-height: 90px;
  resize: vertical;
}
.sr-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed #d4d8e0;
  background: #f8fafc;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.18s ease;
}
.sr-toggle input {
  width: 16px;
  height: 16px;
}
.sr-toggle:hover {
  border-color: #2563eb;
  background: #eef2ff;
}
.template-product-footer {
  padding: 14px 20px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
}
.template-product-close {
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.template-product-close:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.32);
}
.template-action-btn.ghost {
  border: 1px solid #d4d8e0;
  background: #fff;
  color: #111827;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}
.template-action-btn.ghost:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.sr-machine-field {
  grid-column: 1 / -1;
}
.sr-select {
  position: relative;
  width: 100%;
}
.sr-select-trigger {
  width: 100%;
  border: 1px solid #d4d8e0;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}
.sr-select.open .sr-select-trigger {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.sr-select-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #d4d8e0;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  padding: 10px 10px 8px;
  display: none;
  z-index: 10;
}
.sr-select.open .sr-select-panel {
  display: block;
}
.sr-select-search {
  margin-bottom: 8px;
}
.sr-caret {
  font-size: 12px;
  color: #475569;
}
.sr-machine-list {
  border: 1px solid #d4d8e0;
  border-radius: 12px;
  background: #fff;
  max-height: 260px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}
.sr-machine-options {
  max-height: 260px;
  overflow-y: auto;
}
.sr-machine-option {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}
.sr-machine-option:last-child {
  border-bottom: none;
}
.sr-machine-option:hover {
  background: #f8fafc;
}
.sr-machine-option.active {
  background: #eef2ff;
  border-left: 4px solid #4f46e5;
}
.sr-machine-title {
  font-weight: 700;
  color: #0f172a;
  font-size: 13px;
}
.sr-machine-sub {
  font-size: 12px;
  color: #475569;
  margin-top: 2px;
}
.sr-machine-empty {
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}
.sr-notes-field {
  grid-column: 1 / -1;
}

.sr-section {
  margin-bottom: 16px;
}
.sr-section h5 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
}
.sr-section-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Service run detail actions --- */
.sr-actions-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.sr-actions-bar .template-action-btn,
.sr-actions-bar .btn {
  font-size: 12px;
}
.sr-edit-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
}
.sr-map-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0ea5e9;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.3);
}
.sr-map-btn:hover {
  background: #0284c7;
}
.sr-map-closest::before,
.sr-map-furthest::before {
  content: "🗺️";
  font-size: 14px;
}
.sr-map-closest::after {
  content: "↦";
  font-size: 12px;
}
.sr-map-furthest::after {
  content: "⇌";
  font-size: 12px;
}
.sr-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  justify-content: flex-end;
}
.sr-pagination button {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
}
.sr-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sr-back-btn {
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  margin-right: 4px;
}
.sr-back-btn:hover {
  color: red;
  background: transparent !important;
}
.popup-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sr-route-modal {
  width: 360px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.25);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sr-route-modal h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}
.sr-route-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
}
.sr-route-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
