/* ===================================
   USER MENU STYLES
   =================================== */

#userMenuContainer {
  display: flex;
  align-items: flex-start;
}

/* Overlay: top-right, above everything but non-blocking outside its own footprint */
.user-menu-overlay {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 4000;
  pointer-events: none;
}

.user-menu-overlay .user-menu-wrapper {
  pointer-events: auto;
}

/* User Menu Wrapper */
.user-menu-wrapper {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

/* When Feature Pill is vertical, wrapper should stack vertically */
.user-menu-wrapper:has(.feature-pill.vertical) {
  flex-direction: column;
  align-items: flex-end;
}

/* User pill stack - vertical layout for pill + clock */
.user-pill-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  position: relative;
  order: 1;
}

/* Feature Pill order changes in vertical mode */
.feature-pill {
  order: 0;
}

.feature-pill.vertical {
  order: 2;
}

/* ===================================
   FEATURE PILL STYLES
   =================================== */

/* Feature Pill Container */
.feature-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 3px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: all 0.2s ease;
  order: 0;
}

/* Feature Pill Vertical Mode */
.feature-pill.vertical {
  flex-direction: column;
  align-items: stretch;
  padding: 6px;
  gap: 6px;
  order: 2;
  margin-top: 4px;
  width: auto;
  min-width: 160px;
}

.feature-pill.vertical .layout-toggle-inline {
  justify-content: center;
}

.feature-pill.vertical .auto-farmout-toggle {
  justify-content: center;
}

.feature-pill.vertical .auto-pay-toggle {
  justify-content: center;
}

.feature-pill.vertical .default-selector {
  width: 100%;
}

.feature-pill.vertical .default-select {
  width: 100%;
}

.feature-pill.vertical .feature-pill-controls {
  justify-content: center;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
  margin-bottom: 2px;
}

/* Feature Pill Float/Draggable Mode */
.feature-pill.floating {
  position: fixed;
  z-index: 4500;
  cursor: move;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  border-color: #667eea;
}

/* Feature Pill Locked Mode - fixed position but not draggable */
.feature-pill.floating.locked {
  cursor: default;
  border-color: #28a745;
  box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.feature-pill.floating:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.feature-pill.dragging {
  opacity: 0.9;
  transform: scale(1.02);
}

/* Feature Pill Controls */
.feature-pill-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  border-right: 1px solid #eee;
  margin-right: 4px;
}

.pill-control-btn {
  border: none;
  background: transparent;
  padding: 2px 4px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
  color: #888;
  transition: all 0.15s;
  line-height: 1;
}

.pill-control-btn:hover {
  background: #f0f0f0;
  color: #333;
}

.pill-control-btn.active {
  background: #667eea;
  color: #fff;
}

.pill-orient-icon,
.pill-float-icon {
  display: inline-block;
}

/* Drag Handle */
.pill-drag-handle {
  display: none;
  cursor: grab;
  padding: 2px 4px;
  color: #aaa;
  font-size: 12px;
  letter-spacing: -2px;
  user-select: none;
  transition: color 0.15s;
}

.pill-drag-handle:hover {
  color: #667eea;
}

.pill-drag-handle:active {
  cursor: grabbing;
}

/* Show drag handle only in float mode */
.feature-pill.floating .pill-drag-handle {
  display: inline-block;
}

/* Hide controls border in vertical mode when at top */
.feature-pill.vertical .feature-pill-controls {
  border-right: none;
  margin-right: 0;
}

/* Pill Action Buttons (Search, Settings) */
.pill-action-btn {
  border: none;
  background: transparent;
  padding: 3px 6px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  color: #666;
  transition: all 0.15s;
  line-height: 1;
}

.pill-action-btn:hover {
  background: #f0f0f0;
  color: #333;
  transform: scale(1.1);
}

.pill-action-btn.active {
  background: #667eea;
  color: #fff;
}

/* Pill Status Indicators (SMS, Email) */
.pill-status-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: #f5f5f5;
  border: 1px solid #ddd;
}

.pill-status-indicator:hover {
  background: #eee;
  border-color: #ccc;
}

.pill-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #999;
  transition: background 0.2s;
}

.pill-status-text {
  color: #666;
  white-space: nowrap;
}

/* Status states */
.pill-status-indicator.configured .pill-status-dot,
.pill-status-indicator.ok .pill-status-dot {
  background: #28a745;
}

.pill-status-indicator.configured,
.pill-status-indicator.ok {
  background: #e8f5e9;
  border-color: #a5d6a7;
}

.pill-status-indicator.configured .pill-status-text,
.pill-status-indicator.ok .pill-status-text {
  color: #2e7d32;
}

.pill-status-indicator.not-configured .pill-status-dot,
.pill-status-indicator.error .pill-status-dot {
  background: #ffc107;
}

.pill-status-indicator.not-configured,
.pill-status-indicator.error {
  background: #fff8e1;
  border-color: #ffcc80;
}

.pill-status-indicator.not-configured .pill-status-text,
.pill-status-indicator.error .pill-status-text {
  color: #f57c00;
}

.pill-status-indicator.fail .pill-status-dot {
  background: #dc3545;
}

.pill-status-indicator.fail {
  background: #ffebee;
  border-color: #ef9a9a;
}

.pill-status-indicator.fail .pill-status-text {
  color: #c62828;
}

/* Vertical mode adjustments for new elements */
.feature-pill.vertical .pill-action-btn {
  width: 100%;
  text-align: center;
}

.feature-pill.vertical .pill-status-indicator {
  width: 100%;
  justify-content: center;
}

/* Inline Layout Toggle Buttons (next to user pill) */
.layout-toggle-inline {
  display: flex;
  gap: 2px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Remove redundant styles when inside feature pill */
.feature-pill .layout-toggle-inline {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.layout-toggle-inline button {
  border: none;
  background: transparent;
  padding: 3px 6px;
  font-size: 10px;
  cursor: pointer;
  border-radius: 3px;
  color: #666;
  transition: all 0.15s;
}

.layout-toggle-inline button:hover {
  background: #f0f0f0;
  color: #333;
}

.layout-toggle-inline button.active {
  background: #667eea;
  color: #fff;
}

/* Compact inline supabase badge */
.supabase-status-badge.inline-badge {
  display: inline-block;
  min-width: 110px;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 6px;
  margin-left: 8px;
}

.supabase-status-badge.inline-badge.ok { background: #28a745; border-color: #1e7e34; color: white; }
.supabase-status-badge.inline-badge.fail { background: #dc3545; border-color: #b02a37; color: white; }

.user-menu-floating {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 4000;
}

/* User Menu Toggle Button */
.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 6px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 5px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  color: #333;
  transition: all 0.2s;
  min-width: 120px;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-menu-toggle:hover {
  background: #f5f5f5;
  border-color: #bbb;
}

.user-menu-toggle.active {
  background: #f0f0f0;
  border-color: #667eea;
  color: #667eea;
}

.user-menu-toggle:focus {
  outline: none;
}

/* User Avatar */
.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}

.user-email {
  flex: 1;
  text-align: left;
  font-size: 10px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-icon {
  font-size: 11px;
  color: #999;
  transition: transform 0.2s;
}

.user-menu-toggle.active .menu-icon {
  transform: rotate(180deg);
}

/* User Menu Dropdown */
.user-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 280px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Menu Header */
.menu-header {
  padding: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.menu-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.menu-email {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  word-break: break-all;
}

.menu-role {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

/* Menu Divider */
.menu-divider {
  height: 1px;
  background: #eee;
  margin: 8px 0;
}

/* ─────────────────────────────────────────────────────────
   Active Sessions Panel (admins + drivers logged in now)
   ───────────────────────────────────────────────────────── */
.active-sessions-panel {
  padding: 6px 12px 8px;
  max-height: 320px;
  overflow-y: auto;
}
.active-sessions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.active-sessions-title {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.active-sessions-refresh {
  background: transparent;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: #888;
  padding: 2px 6px;
  border-radius: 4px;
}
.active-sessions-refresh:hover { background: #f0f0f0; color: #333; }
.active-sessions-loading,
.active-sessions-empty {
  font-size: 12px;
  color: #999;
  padding: 6px 4px;
  font-style: italic;
}
.active-sessions-group-title {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  margin: 8px 0 4px;
  text-transform: uppercase;
}
.active-session-row {
  padding: 6px 8px;
  border-radius: 6px;
  background: #fafafa;
  margin-bottom: 4px;
  border-left: 3px solid #4caf50;
}
.active-session-row.driver { border-left-color: #2196f3; }
.as-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #222;
}
.as-row-dot { font-size: 13px; }
.as-row-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-row-ago { font-size: 11px; color: #888; font-weight: 400; }
.as-row-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: #666;
  margin-top: 2px;
  overflow: hidden;
}
.as-row-meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.as-row-email { color: #555; }

/* Menu Items */
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: all 0.2s;
  text-align: left;
}

.menu-item:hover {
  background: #f5f5f5;
  color: #667eea;
}

.menu-item:active {
  background: #efefef;
}

.menu-item .menu-icon {
  font-size: 16px;
  min-width: 20px;
  text-align: center;
}

/* Danger Item */
.menu-item-danger {
  color: #c62828;
}

.menu-item-danger:hover {
  background: #ffebee;
  color: #d32f2f;
}

/* Responsive */
@media (max-width: 768px) {
  .user-menu-toggle {
    padding: 6px 10px;
    min-width: 160px;
    font-size: 12px;
  }

  .user-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .user-email {
    font-size: 11px;
  }

  .user-menu-dropdown {
    width: 260px;
  }

  .menu-email {
    font-size: 12px;
  }

  .menu-item {
    padding: 10px 14px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .user-menu-toggle {
    padding: 6px 8px;
    min-width: auto;
    gap: 8px;
  }

  .user-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .user-email {
    display: none;
  }

  .user-menu-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 12px 12px 0 0;
    margin-top: 0;
    animation: slideUp 0.3s ease-out;
  }

  @keyframes slideUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ===================================
   TRIP MODE TOGGLE (In-House / Farm-Out)
   =================================== */

.trip-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-left: 8px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.25);
}

.trip-mode-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.08);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.trip-mode-btn:hover {
  background: rgba(255,255,255,0.15);
}
.trip-mode-btn.active[data-mode="in-house"] {
  background: #22c55e;
  color: #fff;
}
.trip-mode-btn.active[data-mode="farm-out"] {
  background: #3b82f6;
  color: #fff;
}

.mode-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Reassign Modal */
.reassign-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
.reassign-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  color: #1f2937;
}
.reassign-modal h3 {
  margin: 0 0 8px;
  font-size: 16px;
}
.reassign-modal p {
  margin: 4px 0;
  font-size: 13px;
  color: #4b5563;
}
.reassign-date-range {
  display: flex;
  gap: 12px;
  margin: 14px 0;
}
.reassign-date-range label {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reassign-date-range input[type="date"] {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
}
.reassign-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}
.reassign-modal-actions .btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}
.reassign-modal-actions .btn-primary {
  background: #3b82f6;
  color: #fff;
}
.reassign-modal-actions .btn-primary:hover {
  background: #2563eb;
}
.reassign-modal-actions .btn-secondary {
  background: #e5e7eb;
  color: #374151;
}
.reassign-modal-actions .btn-secondary:hover {
  background: #d1d5db;
}

/* Vertical layout adjustments */
.feature-pill.vertical .trip-mode-toggle {
  justify-content: center;
}
.feature-pill.vertical .mode-controls {
  flex-direction: column;
  width: 100%;
}

/* ===================================
   AUTO FARMOUT TOGGLE STYLES
   =================================== */

.auto-farmout-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-left: 8px;
  font-size: 11px;
  color: #666;
  transition: all 0.2s;
}

.auto-farmout-toggle:hover {
  border-color: #22c55e;
  background: #f0fdf4;
}

.auto-farmout-toggle input[type="checkbox"] {
  display: none;
}

.auto-farmout-toggle .toggle-slider {
  position: relative;
  width: 28px;
  height: 16px;
  background: #ccc;
  border-radius: 8px;
  transition: all 0.2s;
}

.auto-farmout-toggle .toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.auto-farmout-toggle input:checked + .toggle-slider {
  background: #22c55e;
}

.auto-farmout-toggle input:checked + .toggle-slider::before {
  transform: translateX(12px);
}

.auto-farmout-toggle .toggle-label {
  font-weight: 500;
  white-space: nowrap;
}

.auto-farmout-toggle input:checked ~ .toggle-label {
  color: #166534;
}

/* Auto Pay Toggle */
.auto-pay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-left: 4px;
  font-size: 11px;
  color: #666;
  transition: all 0.2s;
}

.auto-pay-toggle:hover {
  border-color: #22c55e;
  background: #f0fdf4;
}

.auto-pay-toggle input[type="checkbox"] {
  display: none;
}

.auto-pay-toggle .toggle-slider {
  position: relative;
  width: 28px;
  height: 16px;
  background: #ccc;
  border-radius: 8px;
  transition: all 0.2s;
}

.auto-pay-toggle .toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.auto-pay-toggle input:checked + .toggle-slider {
  background: #22c55e;
}

.auto-pay-toggle input:checked + .toggle-slider::before {
  transform: translateX(12px);
}

.auto-pay-toggle .toggle-label {
  font-weight: 500;
  white-space: nowrap;
}

.auto-pay-toggle input:checked ~ .toggle-label {
  color: #166534;
}

/* Default Driver/Vehicle Selector */
.default-selector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  margin-left: 8px;
}

.default-selector .selector-icon {
  font-size: 14px;
}

.default-selector .default-select {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 4px;
  cursor: pointer;
  max-width: 120px;
}

.default-selector .default-select:focus {
  outline: none;
}

.default-selector .default-select option {
  background: #1f2a44;
  color: white;
}

/* ---- Affiliate Searchable Selector + Toggle ---- */
.affiliate-selector-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  margin-left: 8px;
  position: relative;
}

.affiliate-top-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.affiliate-selector-wrap .selector-icon {
  font-size: 12px;
}

.affiliate-search-box {
  position: relative;
}

.affiliate-search-input {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px;
  color: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 6px;
  width: 120px;
  outline: none;
}
.affiliate-search-input::placeholder {
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}
.affiliate-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59,130,246,0.35);
}

.affiliate-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  max-height: 220px;
  overflow-y: auto;
  background: #1f2a44;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  z-index: 9999;
  margin-top: 2px;
}

.affiliate-dropdown-item {
  padding: 6px 10px;
  font-size: 12px;
  color: #e2e8f0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.affiliate-dropdown-item:hover {
  background: rgba(59,130,246,0.3);
}
.affiliate-dropdown-item.none {
  color: #94a3b8;
  cursor: default;
  font-style: italic;
}
.affiliate-dropdown-item b {
  color: #60a5fa;
  font-weight: 700;
}

/* On/Off toggle button */
.affiliate-toggle-btn {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  position: relative;
  transition: background 0.25s;
  flex-shrink: 0;
}
.affiliate-toggle-btn.off {
  background: #4b5563;
}
.affiliate-toggle-btn.on {
  background: #22c55e;
}
.affiliate-toggle-dot {
  position: absolute;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.25s;
}
.affiliate-toggle-btn.off .affiliate-toggle-dot {
  left: 2px;
}
.affiliate-toggle-btn.on .affiliate-toggle-dot {
  left: 18px;
}

.affiliate-selected-name {
  font-size: 10px;
  font-weight: 600;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255,255,255,0.75);
}

/* Horizontal layout overrides */
html[data-layout="horizontal"] .affiliate-dropdown {
  background: #333;
}

/* Timezone Selector in Dropdown Menu */
.timezone-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: default;
}

.timezone-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.timezone-dropdown {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  min-width: 140px;
}

.timezone-dropdown:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.timezone-dropdown option {
  padding: 8px;
}

/* Language Selector in Dropdown Menu */
.language-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: default;
}

.language-menu-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.language-dropdown {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  font-size: 13px;
  cursor: pointer;
  min-width: 140px;
}

.language-dropdown:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.language-dropdown option {
  padding: 8px;
}

html[data-layout="horizontal"] .default-selector .default-select option {
  background: #333;
}

/* Auto Farmout Indicator */
.auto-farmout-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
  border: 1px solid #22c55e;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  color: #166534;
  margin-left: 6px;
  animation: farmoutPulse 2s ease-in-out infinite;
}

@keyframes farmoutPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 8px 2px rgba(34, 197, 94, 0.3); }
}

/* Badge Container for Multiple Badges */
.badge-container {
  position: absolute;
  top: -6px;
  right: -6px;
  display: flex;
  gap: 2px;
  z-index: 10;
}

/* Auto Farmout Badge on Reservations Button */
.auto-farmout-badge {
  font-size: 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: badgeBounce 1s ease-in-out infinite;
  cursor: help;
}

/* Default Driver Badge */
.default-driver-badge {
  font-size: 12px;
  background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
  border: 2px solid #3b82f6;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: badgeBounce 1.2s ease-in-out infinite;
  cursor: help;
}

/* Default Vehicle Badge */
.default-vehicle-badge {
  font-size: 12px;
  background: linear-gradient(135deg, #d1fae5 0%, #6ee7b7 100%);
  border: 2px solid #10b981;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  animation: badgeBounce 1.4s ease-in-out infinite;
  cursor: help;
}

@keyframes badgeBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ===================================
   HEADER CLOCK STYLES
   =================================== */

.header-clock {
  cursor: pointer;
  user-select: none;
  margin: 0;
  text-align: right;
}

/* Digital Clock Styles */
.digital-clock {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 20px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: transform 0.15s, box-shadow 0.15s;
}

.digital-clock:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.digital-clock .clock-time {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 29px;
  font-weight: 700;
  color: #22c55e;
  text-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
  letter-spacing: 2px;
}

.digital-clock .clock-date {
  font-size: 20px;
  color: #94a3b8;
  margin-top: 2px;
  letter-spacing: 1px;
}

/* Digital Modern - green LED */
.digital-clock.digital-modern .clock-time {
  color: #22c55e;
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* Digital Classic - amber LED */
.digital-clock.digital-classic {
  background: linear-gradient(135deg, #292524 0%, #1c1917 100%);
  border-color: #44403c;
}

.digital-clock.digital-classic .clock-time {
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

/* Digital Minimal - blue on dark */
.digital-clock.digital-minimal {
  background: #0f172a;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
}

.digital-clock.digital-minimal .clock-time {
  font-size: 31px;
  color: #60a5fa;
  text-shadow: none;
}

/* Analog Clock Styles */
.clock-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.clock-date-small {
  font-size: 14px;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
}

.analog-clock {
  width: 132px;
  height: 132px;
  position: relative;
}

.clock-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  background: white;
  border: 4px solid #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.clock-face::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #1e293b;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom center;
  border-radius: 2px;
}

.hour-hand {
  width: 6px;
  height: 36px;
  background: #1e293b;
  margin-left: -3px;
}

.minute-hand {
  width: 4px;
  height: 46px;
  background: #475569;
  margin-left: -2px;
}

.second-hand {
  width: 2px;
  height: 53px;
  background: #ef4444;
  margin-left: -1px;
}

.clock-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13px;
  height: 13px;
  background: #1e293b;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
}

/* Analog Classic - with markers */
.analog-classic .clock-face {
  background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
  border-color: #92400e;
}

.analog-classic .clock-markers::before,
.analog-classic .clock-markers::after {
  content: '';
  position: absolute;
  background: #92400e;
}

.analog-classic .clock-markers::before {
  top: 4px;
  left: 50%;
  width: 2px;
  height: 4px;
  margin-left: -1px;
  box-shadow: 0 36px 0 #92400e;
}

.analog-classic .clock-markers::after {
  left: 4px;
  top: 50%;
  width: 4px;
  height: 2px;
  margin-top: -1px;
  box-shadow: 36px 0 0 #92400e;
}

.analog-classic .hour-hand {
  background: #78350f;
}

.analog-classic .minute-hand {
  background: #92400e;
}

.analog-classic .clock-center {
  background: #78350f;
}

/* Analog Modern - sleek dark */
.analog-modern .clock-face {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.analog-modern .hour-hand {
  background: #f8fafc;
}

.analog-modern .minute-hand {
  background: #94a3b8;
}

.analog-modern .second-hand {
  background: #3b82f6;
}

.analog-modern .clock-center {
  background: #3b82f6;
}

/* Analog Minimal - simple white */
.analog-minimal .clock-face {
  background: white;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}

.analog-minimal .hour-hand {
  width: 2px;
  height: 12px;
  background: #334155;
}

.analog-minimal .minute-hand {
  width: 1px;
  height: 16px;
  background: #64748b;
}

.analog-minimal .clock-center {
  width: 4px;
  height: 4px;
  background: #334155;
}

/* ===================================
   FARMOUT COUNTDOWN TIMER
   =================================== */

.farmout-countdown-timer {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  animation: countdownPulse 2s ease-in-out infinite;
  margin-top: 6px;
}

@keyframes countdownPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 4px 20px rgba(245, 158, 11, 0.6); }
}

.countdown-chime-icon {
  font-size: 24px;
  animation: chimeBounce 1s ease-in-out infinite;
}

@keyframes chimeBounce {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}

.countdown-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.countdown-driver-name {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.countdown-company {
  font-size: 11px;
  color: #b45309;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
  min-height: 14px;
}

.countdown-time {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 22px;
  font-weight: 700;
  color: #dc2626;
  text-shadow: 0 0 6px rgba(220, 38, 38, 0.3);
  letter-spacing: 1px;
}

.countdown-label {
  font-size: 10px;
  color: #78350f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* When time is running low (under 1 minute) */
.farmout-countdown-timer.urgent {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-color: #dc2626;
  animation: countdownUrgent 0.5s ease-in-out infinite;
}

@keyframes countdownUrgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

.farmout-countdown-timer.urgent .countdown-chime-icon {
  animation: chimeUrgent 0.3s ease-in-out infinite;
}

@keyframes chimeUrgent {
  0%, 100% { transform: rotate(-20deg); }
  50% { transform: rotate(20deg); }
}
/* ===================================
   TIMER COLOR THEMES
   =================================== */

/* Blue Theme */
.farmout-countdown-timer.theme-blue {
  background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.farmout-countdown-timer.theme-blue .countdown-driver-name { color: #1e40af; }
.farmout-countdown-timer.theme-blue .countdown-company { color: #2563eb; }
.farmout-countdown-timer.theme-blue .countdown-label { color: #1d4ed8; }

/* Green Theme */
.farmout-countdown-timer.theme-green {
  background: linear-gradient(135deg, #dcfce7 0%, #86efac 100%);
  border-color: #22c55e;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.farmout-countdown-timer.theme-green .countdown-driver-name { color: #166534; }
.farmout-countdown-timer.theme-green .countdown-company { color: #15803d; }
.farmout-countdown-timer.theme-green .countdown-label { color: #14532d; }

/* Purple Theme */
.farmout-countdown-timer.theme-purple {
  background: linear-gradient(135deg, #ede9fe 0%, #c4b5fd 100%);
  border-color: #8b5cf6;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.farmout-countdown-timer.theme-purple .countdown-driver-name { color: #5b21b6; }
.farmout-countdown-timer.theme-purple .countdown-company { color: #7c3aed; }
.farmout-countdown-timer.theme-purple .countdown-label { color: #4c1d95; }

/* Dark Theme */
.farmout-countdown-timer.theme-dark {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  border-color: #6b7280;
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.farmout-countdown-timer.theme-dark .countdown-chime-icon { filter: grayscale(1) brightness(2); }
.farmout-countdown-timer.theme-dark .countdown-driver-name { color: #f9fafb; }
.farmout-countdown-timer.theme-dark .countdown-company { color: #d1d5db; }
.farmout-countdown-timer.theme-dark .countdown-time { color: #fbbf24; }
.farmout-countdown-timer.theme-dark .countdown-label { color: #9ca3af; }

/* ===================================
   DRAGGABLE WIDGET STYLES
   =================================== */

.farmout-countdown-timer[style*="position: fixed"],
#headerClock[style*="position: fixed"],
#systemMonitorWidget[style*="position: fixed"] {
  z-index: 9999;
}

.farmout-countdown-timer:active,
#headerClock:active,
#systemMonitorWidget:active {
  cursor: grabbing !important;
}

/* ===================================
   SYSTEM MONITOR WIDGET STYLES
   =================================== */

.system-monitor-widget {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 11px;
  min-width: 140px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  margin-top: 6px;
}

.system-monitor-widget:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.sys-monitor-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sys-monitor-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sys-monitor-bar-container {
  flex: 1;
  height: 10px;
  background: #e2e8f0;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.sys-monitor-bar {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease, background 0.3s ease;
  min-width: 2px;
}

.sys-monitor-bar.cpu-bar {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.sys-monitor-bar.ram-bar {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.sys-monitor-value {
  min-width: 32px;
  text-align: right;
  font-weight: 600;
  color: #475569;
  font-size: 10px;
  font-family: 'SF Mono', 'Consolas', monospace;
}

/* Compact Style */
.system-monitor-widget.style-compact {
  flex-direction: row;
  gap: 12px;
  padding: 6px 10px;
  min-width: auto;
}

.system-monitor-widget.style-compact .sys-monitor-row {
  flex: 1;
}

.system-monitor-widget.style-compact .sys-monitor-bar-container {
  height: 6px;
}

/* Circle Style */
.system-monitor-widget.style-circles {
  flex-direction: row;
  gap: 12px;
  padding: 8px 12px;
}

.system-monitor-widget.style-circles .sys-monitor-row {
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.system-monitor-widget.style-circles .sys-monitor-bar-container {
  display: none;
}

.system-monitor-widget.style-circles .sys-monitor-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: conic-gradient(var(--progress-color) var(--progress), #e2e8f0 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.system-monitor-widget.style-circles .sys-monitor-circle::before {
  content: '';
  width: 28px;
  height: 28px;
  background: #f8fafc;
  border-radius: 50%;
  position: absolute;
}

.system-monitor-widget.style-circles .sys-monitor-value {
  position: relative;
  z-index: 1;
  font-size: 9px;
  min-width: auto;
}

/* Dark theme for system monitor */
.system-monitor-widget.theme-dark {
  background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
  border-color: #4b5563;
}

.system-monitor-widget.theme-dark .sys-monitor-bar-container {
  background: #4b5563;
}

.system-monitor-widget.theme-dark .sys-monitor-value {
  color: #e5e7eb;
}

/* Responsive */
@media (max-width: 480px) {
  .system-monitor-widget {
    min-width: 120px;
    padding: 8px 10px;
    font-size: 10px;
  }
  
  .sys-monitor-bar-container {
    height: 8px;
  }
}

/* ============================================
   DRIVER-DISPATCH CHAT SYSTEM
   ============================================ */

/* Chat indicator in pill */
.pill-chat-indicator {
  position: relative;
  cursor: pointer;
  background: #f0f4ff !important;
  border-color: #b3c6ff !important;
}

.pill-chat-indicator:hover {
  background: #dbe4ff !important;
  border-color: #667eea !important;
}

.pill-chat-indicator.has-unread {
  background: #fff3e0 !important;
  border-color: #ff9800 !important;
  animation: chatPulse 2s ease-in-out infinite;
}

@keyframes chatPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(255, 152, 0, 0); }
}

.pill-chat-icon {
  font-size: 12px;
  line-height: 1;
}

.pill-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc3545;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  border: 1.5px solid #fff;
}

/* Mute toggle button */
.pill-chat-mute {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.pill-chat-mute:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* Typing indicator in chat */
.chat-typing-indicator {
  padding: 4px 12px 8px;
  font-size: 12px;
  color: #888;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}
.typing-dots {
  animation: typingBounce 1.2s ease-in-out infinite;
  letter-spacing: 2px;
  font-size: 14px;
  color: #667eea;
}
@keyframes typingBounce {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}
.typing-label {
  font-size: 11px;
  color: #999;
}

/* Chat Panel */
.dispatch-chat-panel {
  position: fixed;
  top: 60px;
  right: 20px;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

.dispatch-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.dispatch-chat-title {
  font-size: 14px;
  font-weight: 600;
}

.dispatch-chat-header-actions {
  display: flex;
  gap: 4px;
}

.dispatch-chat-refresh-btn,
.dispatch-chat-close-btn {
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.dispatch-chat-refresh-btn:hover,
.dispatch-chat-close-btn:hover {
  background: rgba(255,255,255,0.35);
}

/* Thread List */
.dispatch-chat-threads {
  flex: 1;
  overflow-y: auto;
  max-height: 400px;
}

.chat-thread-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.12s;
  position: relative;
}

.chat-thread-item:hover {
  background: #f5f7ff;
}

.chat-thread-item.unread {
  background: #fff8e1;
}

.chat-thread-item.unread:hover {
  background: #fff3cd;
}

.thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e8eaf6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.thread-content {
  flex: 1;
  min-width: 0;
}

.thread-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.thread-driver-name {
  font-weight: 600;
  font-size: 13px;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-time {
  font-size: 10px;
  color: #999;
  flex-shrink: 0;
  margin-left: 6px;
}

.thread-preview {
  font-size: 12px;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-sender {
  color: #667eea;
  font-weight: 500;
}

.thread-unread-badge {
  background: #dc3545;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.chat-empty {
  padding: 40px 20px;
  text-align: center;
  color: #aaa;
  font-size: 13px;
}

.chat-loading {
  padding: 40px 20px;
  text-align: center;
  color: #aaa;
  font-size: 13px;
}

/* Conversation View */
.dispatch-chat-conversation {
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.chat-conv-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
}

.chat-back-btn {
  border: none;
  background: none;
  color: #667eea;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.chat-back-btn:hover {
  background: #e8eaf6;
}

.chat-conv-driver-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  color: #333;
}

.chat-delete-thread-btn {
  border: none;
  background: none;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.chat-delete-thread-btn:hover {
  opacity: 1;
  background: #ffebee;
}

.chat-conv-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  display: flex;
  max-width: 85%;
}

.chat-msg-driver {
  align-self: flex-start;
}

.chat-msg-dispatch {
  align-self: flex-end;
}

.chat-msg-bubble {
  padding: 8px 12px;
  border-radius: 12px;
  max-width: 100%;
}

.chat-msg-driver .chat-msg-bubble {
  background: #f0f0f0;
  border-bottom-left-radius: 4px;
}

.chat-msg-dispatch .chat-msg-bubble {
  background: #fff3e0;
  color: #333;
  border-bottom-right-radius: 4px;
}

.chat-msg-text {
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 3px;
}

.chat-msg-time {
  font-size: 10px;
  opacity: 0.7;
}

.chat-msg-sender {
  font-size: 10px;
  opacity: 0.7;
  font-weight: 500;
}

.chat-msg-dispatch .chat-msg-meta {
  justify-content: flex-end;
}

/* Chat Input */
.chat-conv-input {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid #e0e0e0;
  background: #fafafa;
}

.chat-input-field {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.chat-input-field:focus {
  border-color: #667eea;
}

.chat-send-btn {
  border: none;
  background: #667eea;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.chat-send-btn:hover {
  background: #5a6dd6;
}

/* ==== Global Incoming Message Popup ==== */
.driver-message-popup {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 340px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22), 0 4px 12px rgba(0,0,0,0.1);
  z-index: 99999;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid #667eea;
  animation: popupSlideIn 0.3s ease-out;
}

@keyframes popupSlideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.driver-msg-popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.driver-msg-popup-icon {
  font-size: 16px;
}

.driver-msg-popup-title {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
}

.driver-msg-popup-close {
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.driver-msg-popup-close:hover {
  background: rgba(255,255,255,0.35);
}

.driver-msg-popup-body {
  padding: 12px 14px;
}

.popup-msg-text {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  word-break: break-word;
}

.popup-msg-time {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.driver-msg-popup-actions {
  display: flex;
  gap: 6px;
  padding: 8px 14px 12px;
  border-top: 1px solid #eee;
}

.msg-popup-reply-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 7px 12px;
  font-size: 12px;
  outline: none;
}

.msg-popup-reply-input:focus {
  border-color: #667eea;
}

.msg-popup-send-btn {
  border: none;
  background: #667eea;
  color: #fff;
  padding: 7px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.15s;
}

.msg-popup-send-btn:hover {
  background: #5a6dd6;
}

/* Responsive */
@media (max-width: 480px) {
  .dispatch-chat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    max-height: 80vh;
  }
  .driver-message-popup {
    right: 8px;
    left: 8px;
    width: auto;
  }
}

/* ===================================
   ROLE BADGES (Admin, Driver, Account)
   =================================== */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.4;
  flex-shrink: 0;
}

.role-badge.admin-badge {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  box-shadow: 0 1px 3px rgba(102, 126, 234, 0.4);
}

.role-badge.driver-badge {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  color: #fff;
  box-shadow: 0 1px 3px rgba(17, 153, 142, 0.4);
}

.role-badge.account-badge {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #fff;
  box-shadow: 0 1px 3px rgba(245, 87, 108, 0.4);
}

/* ===================================
   SET DEFAULTS MODAL
   =================================== */
.defaults-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.defaults-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 340px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalSlideUp 0.2s ease-out;
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.defaults-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
  border-radius: 12px 12px 0 0;
}

.defaults-modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.defaults-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #888;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}

.defaults-modal-close:hover {
  background: #eee;
  color: #333;
}

.defaults-modal-body {
  padding: 16px 18px;
}

.defaults-section {
  margin-bottom: 14px;
}

.defaults-section:last-child {
  margin-bottom: 0;
}

.defaults-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.defaults-status-row {
  display: flex;
  gap: 14px;
  justify-content: flex-start;
}

/* Mirror shared styles (used in modal) */
.mirror-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #555;
  cursor: default;
}

.mirror-status-dot .mirror-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: #ccc;
  transition: background 0.3s;
}

.mirror-status-dot.configured .mirror-dot,
.mirror-status-dot.ok .mirror-dot {
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

.mirror-status-dot.fail .mirror-dot {
  background: #ef4444;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}

.mirror-status-dot.not-configured .mirror-dot {
  background: #f59e0b;
  box-shadow: 0 0 4px rgba(245, 158, 11, 0.3);
}

/* Auto Pay toggle (compact) */
.mirror-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: #444;
  user-select: none;
}

.mirror-toggle input[type="checkbox"] {
  display: none;
}

.mirror-toggle-slider {
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: #ccc;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.mirror-toggle-slider::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.mirror-toggle input:checked + .mirror-toggle-slider {
  background: #22c55e;
}

.mirror-toggle input:checked + .mirror-toggle-slider::after {
  transform: translateX(14px);
}

/* Trip mode buttons */
.mirror-mode-row {
  display: flex;
  gap: 6px;
}

.mirror-mode-btn {
  padding: 5px 14px;
  font-size: 12px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  border-radius: 6px;
  cursor: pointer;
  color: #555;
  transition: all 0.15s;
}

.mirror-mode-btn.active {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}

.mirror-mode-btn:hover:not(.active) {
  background: #eee;
}

/* Driver/Vehicle selectors */
.mirror-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.mirror-select-wrap span {
  flex-shrink: 0;
}

.mirror-select {
  flex: 1;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  min-width: 0;
  max-width: 100%;
}

.mirror-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}