/* ============================================================
   Route Planner — Tournees VISAP
   ============================================================ */

/* --- View container --- */
#view-routing {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  min-height: 500px;
  gap: 0;
  overflow: hidden;
}

/* --- Top config bar --- */
.rp-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--color-muted-light, #f1f5f9);
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  flex-wrap: wrap;
  font-size: 13px;
}
.rp-topbar-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #fff;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-xs, 8px);
  font-weight: 600;
}
.rp-topbar-stat.is-ok { border-color: #86efac; background: #f0fdf4; }
.rp-topbar-stat.is-warn { border-color: #fcd34d; background: #fffbeb; }
.rp-topbar-stat.is-error { border-color: #fca5a5; background: #fef2f2; }

/* --- Main 3-panel layout --- */
.rp-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* --- Left panel: unit list --- */
.rp-panel-left {
  width: 260px;
  min-width: 220px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-light, #e2e8f0);
  background: #fff;
  overflow: hidden;
}
.rp-search-box {
  padding: 8px;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
}
.rp-search-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: var(--radius-xs, 8px);
  font-size: 13px;
  outline: none;
}
.rp-search-input:focus { border-color: var(--color-info, #3b82f6); box-shadow: 0 0 0 2px rgba(59,130,246,.15); }

.rp-list-actions {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
}
.rp-list-actions button,
#rpRoot .rp-list-actions button,
body .rp-list-actions button {
  flex: 1;
  padding: 8px 10px !important;
  font-size: 12px !important;
  min-height: 36px !important;
  border: 1px solid var(--color-muted-dark, #64748b) !important;
  border-radius: 4px !important;
  background: var(--border-light, #e2e8f0) !important;
  color: var(--ink, #0f172a) !important;
  -webkit-text-fill-color: var(--ink, #0f172a) !important;
  cursor: pointer !important;
  white-space: nowrap;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  line-height: 1.4 !important;
  text-indent: 0 !important;
  font-family: inherit !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.rp-list-actions button:hover,
#rpRoot .rp-list-actions button:hover { background: var(--border, #cbd5e1) !important; -webkit-text-fill-color: var(--ink, #0f172a) !important; }

.rp-unit-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.rp-unit-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-muted-light, #f1f5f9);
  transition: background .15s;
}
.rp-unit-item:hover { background: var(--panel-hover, #f8fafc); }
.rp-unit-item.is-selected { background: #eff6ff; }
.rp-unit-item input[type="checkbox"] { flex-shrink: 0; }

.rp-unit-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-unit-addr {
  font-size: 11px;
  color: var(--color-muted-dark, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-unit-info {
  flex: 1;
  min-width: 0;
}
.rp-gps-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rp-gps-dot.is-ok { background: var(--color-success, #22c55e); }
.rp-gps-dot.is-missing { background: var(--color-danger, #ef4444); }

.rp-gps-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: 11px;
  color: var(--color-muted-dark, #64748b);
  padding: 4px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
}

/* --- Center panel: map --- */
.rp-panel-center {
  flex: 1;
  min-width: 300px;
  position: relative;
}
.rp-map {
  width: 100%;
  height: 100%;
}

/* --- Right panel: day plan --- */
.rp-panel-right {
  width: 300px;
  min-width: 260px;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-light, #e2e8f0);
  background: #fff;
  overflow: hidden;
}
.rp-day-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  flex-shrink: 0;
}
.rp-day-tab {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  color: var(--color-muted-dark, #64748b);
  transition: color .15s, border-color .15s;
}
.rp-day-tab:hover { color: var(--ink, #1e293b); }
.rp-day-tab.is-active {
  color: var(--ink, #1e293b);
  border-bottom-color: var(--color-info, #3b82f6);
}

.rp-day-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.rp-day-empty {
  text-align: center;
  color: var(--muted, #94a3b8);
  padding: 40px 16px;
  font-size: 13px;
}

.rp-visit-card {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-xs, 8px);
  background: #fff;
  font-size: 12px;
  transition: border-color .15s;
}
.rp-visit-card:hover { border-color: var(--muted, #94a3b8); }

.rp-visit-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}
.rp-visit-details { flex: 1; min-width: 0; }
.rp-visit-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-visit-addr {
  color: var(--color-muted-dark, #64748b);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-visit-time {
  color: var(--color-info, #3b82f6);
  font-weight: 600;
}

.rp-day-summary {
  padding: 10px;
  border-top: 1px solid var(--border-light, #e2e8f0);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.rp-day-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rp-day-summary-val { font-weight: 700; }

.rp-gmaps-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: var(--radius-xs, 8px);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.rp-gmaps-btn:hover { background: #3367d6; color: #fff; }

/* --- Bottom action bar --- */
.rp-bottombar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--border-light, #e2e8f0);
  background: var(--panel-hover, #f8fafc);
  flex-wrap: wrap;
}
.rp-btn,
#rpRoot .rp-btn,
body .rp-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 8px 16px !important;
  border: 1px solid var(--color-muted-dark, #64748b) !important;
  border-radius: 6px !important;
  background: var(--border-light, #e2e8f0) !important;
  color: var(--ink, #0f172a) !important;
  -webkit-text-fill-color: var(--ink, #0f172a) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: background .15s, border-color .15s;
  text-transform: none !important;
  letter-spacing: normal !important;
  line-height: 1.4 !important;
  text-indent: 0 !important;
  visibility: visible !important;
}
.rp-btn:hover,
#rpRoot .rp-btn:hover { background: var(--border, #cbd5e1) !important; -webkit-text-fill-color: var(--ink, #0f172a) !important; }
.rp-btn:disabled { opacity: .5 !important; cursor: not-allowed !important; }
.rp-btn.is-primary {
  background: var(--color-info, #3b82f6) !important;
  color: #fff !important;
  border-color: var(--color-info, #3b82f6) !important;
}
.rp-btn.is-primary:hover { background: #2563eb !important; }

.rp-progress {
  flex: 1;
  font-size: 12px;
  color: var(--color-muted-dark, #64748b);
}

/* --- Day colors --- */
.rp-day-1 { background-color: var(--color-info, #3b82f6); }
.rp-day-2 { background-color: var(--color-success, #22c55e); }
.rp-day-3 { background-color: #f59e0b; }
.rp-day-4 { background-color: #8b5cf6; }
.rp-day-5 { background-color: var(--color-danger, #ef4444); }
.rp-day-6 { background-color: #06b6d4; }
.rp-day-7 { background-color: #ec4899; }
.rp-day-8 { background-color: #84cc16; }

/* Tab active indicator colors */
.rp-day-tab[data-day="0"].is-active { border-bottom-color: var(--color-info, #3b82f6); }
.rp-day-tab[data-day="1"].is-active { border-bottom-color: var(--color-success, #22c55e); }
.rp-day-tab[data-day="2"].is-active { border-bottom-color: #f59e0b; }
.rp-day-tab[data-day="3"].is-active { border-bottom-color: #8b5cf6; }
.rp-day-tab[data-day="4"].is-active { border-bottom-color: var(--color-danger, #ef4444); }
.rp-day-tab[data-day="5"].is-active { border-bottom-color: #06b6d4; }
.rp-day-tab[data-day="6"].is-active { border-bottom-color: #ec4899; }
.rp-day-tab[data-day="7"].is-active { border-bottom-color: #84cc16; }

/* --- Nav "Travail" collapsible menu --- */
.xb-nav-group {
  display: flex;
  flex-direction: column;
}
.xb-nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
/* Inherit exact same look as xb-nav-item */
.xb-nav-group-toggle .dashicons { font-size: 18px; width: 18px; height: 18px; }
.xb-nav-group-arrow {
  margin-left: auto;
  font-size: 12px;
  opacity: .5;
  transition: transform .25s;
}
.xb-nav-group.is-open .xb-nav-group-arrow { transform: rotate(180deg); opacity: .8; }

.xb-nav-group-items {
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.xb-nav-group.is-open .xb-nav-group-items {
  display: flex;
}
.xb-nav-group-items .xb-nav-item {
  padding-left: 34px !important;
  font-size: 13px;
  opacity: .85;
}
.xb-nav-group-items .xb-nav-item:hover {
  opacity: 1;
}
.xb-nav-group-items .xb-nav-item .dashicons {
  font-size: 15px;
  width: 15px;
  height: 15px;
}

/* --- Technician dropdown in day summary --- */
.rp-day-tech {
  margin: 4px 0 8px;
}
.rp-tech-select {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: var(--radius-2xs, 4px);
  background: #fff;
}
.rp-tech-select:focus { border-color: var(--color-info, #3b82f6); outline: none; }

/* --- Move visit dropdown --- */
.rp-visit-move {
  flex-shrink: 0;
}
.rp-move-select {
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-2xs, 4px);
  background: var(--panel-hover, #f8fafc);
  color: var(--color-muted-dark, #64748b);
  cursor: pointer;
}
.rp-move-select:focus { border-color: var(--color-info, #3b82f6); }

/* --- Workflow progress bar --- */
.rp-workflow {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 16px;
  background: var(--panel-hover, #f8fafc);
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  overflow-x: auto;
}
.rp-wf-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-xs, 8px);
  background: #fff;
  border: 1px solid var(--border-light, #e2e8f0);
  transition: all .2s;
}
.rp-wf-step.rp-wf-active {
  background: #eff6ff;
  border-color: var(--color-info, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
.rp-wf-step.rp-wf-done {
  background: #f0fdf4;
  border-color: #86efac;
}
.rp-wf-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border-light, #e2e8f0);
  color: var(--color-muted-dark, #64748b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.rp-wf-active .rp-wf-num { background: var(--color-info, #3b82f6); color: #fff; }
.rp-wf-done .rp-wf-num { background: var(--color-success, #22c55e); color: #fff; }
.rp-wf-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--ink, #1e293b);
}
.rp-wf-desc {
  font-size: 10px;
  color: var(--muted, #94a3b8);
  display: none;
}
.rp-wf-active .rp-wf-desc { display: inline; color: var(--color-info, #3b82f6); }
.rp-wf-arrow {
  padding: 0 6px;
  color: var(--border, #cbd5e1);
  font-size: 14px;
}
.rp-wf-arrow.rp-wf-done { color: var(--color-success, #22c55e); }

/* --- Confirmation modal --- */
.rp-modal-backdrop {
  position: fixed;
  inset: 0 0 0 0;
  background: rgba(0,0,0,.5);
  z-index: 10000;
}
.rp-modal-box {
  position: relative;
  z-index: 10001;
  background: #fff;
  border-radius: var(--radius-sm, 12px);
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  max-width: 500px;
  width: 90%;
  margin: auto;
  padding: 24px;
}
.rp-confirm-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
}
.rp-confirm-header p { margin: 0 0 12px; color: var(--color-muted-dark, #64748b); font-size: 13px; }
.rp-confirm-body { margin-bottom: 16px; font-size: 13px; }
.rp-confirm-day {
  padding: 6px 0;
  border-bottom: 1px solid var(--color-muted-light, #f1f5f9);
}
.rp-confirm-ok { color: var(--color-success, #22c55e); }
.rp-confirm-warn { color: #f59e0b; }
.rp-confirm-note {
  margin-top: 8px;
  padding: 8px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-xs, 8px);
  font-size: 12px;
  color: #92400e;
}
.rp-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.rp-progress-bar {
  height: 6px;
  background: var(--border-light, #e2e8f0);
  border-radius: var(--radius-2xs, 4px);
  margin-top: 12px;
  overflow: hidden;
}
.rp-progress-fill {
  height: 100%;
  background: var(--color-info, #3b82f6);
  border-radius: var(--radius-2xs, 4px);
  width: 100%;
  animation: rp-progress-pulse 1.5s ease-in-out infinite;
}
@keyframes rp-progress-pulse {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}

/* --- VISAP badges in Chantiers table --- */
.ch-visap-planned {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border: 1px solid #93c5fd;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-2xs, 4px);
}
.ch-visap-done {
  background: #dcfce7 !important;
  color: #166534 !important;
  border: 1px solid #86efac;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-2xs, 4px);
}

/* --- Priority dots --- */
.rp-priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.15);
  transition: transform .15s;
}
.rp-priority-dot:hover { transform: scale(1.3); }
.rp-priority-dot.is-normal { background: #d1d5db; }
.rp-priority-dot.is-urgent { background: var(--color-danger, #ef4444); }
.rp-priority-dot.is-medium { background: #f59e0b; }

/* Priority dot inline in visit card (day panel) */
.rp-visit-name .rp-priority-dot {
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
  width: 8px;
  height: 8px;
  cursor: default;
}

/* --- Travel time between visits --- */
.rp-visit-travel {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  padding: 0 0 0 30px;
  margin: -2px 0 2px;
}

/* --- Reorder buttons --- */
.rp-visit-reorder {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}
.rp-reorder-btn {
  background: none;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-2xs, 4px);
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  color: var(--muted, #94a3b8);
  line-height: 1.2;
  min-width: 24px;
  min-height: 22px;
}
.rp-reorder-btn:hover { color: var(--ink, #1e293b); border-color: var(--muted, #94a3b8); }

/* --- Date picker in topbar --- */
.rp-start-date {
  padding: 4px 8px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: var(--radius-2xs, 4px);
  font-size: 12px;
}
.rp-max-day-input {
  width: 40px;
  padding: 4px 6px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: var(--radius-2xs, 4px);
  font-size: 12px;
  text-align: center;
}

/* --- Responsive: tablet --- */
@media (width <= 900px) {
  .rp-main { flex-direction: column; }
  .rp-panel-left { width: 100%; min-width: 0; height: auto !important; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border-light, #e2e8f0); }
  .rp-panel-right { width: 100%; min-width: 0; height: auto !important; max-height: 280px; border-left: none; border-top: 1px solid var(--border-light, #e2e8f0); }
  .rp-panel-center { min-width: 0; min-height: 350px; }
  .rp-wf-desc { display: none !important; }
  .rp-topbar { flex-wrap: wrap; gap: 8px; }
  .rp-topbar-stat { font-size: 12px; padding: 3px 8px; }
  /* Touch targets for tablet */
  .rp-btn, .rp-list-actions button { min-height: 44px; }
  .rp-day-tab { min-height: 44px; padding: 10px 14px; }
  .rp-unit-item { min-height: 48px; padding: 8px 12px; }
  .rp-unit-item input[type="checkbox"] { width: 20px; height: 20px; }
}
/* --- Responsive: mobile panel tabs --- */
@media (width <= 768px) {
  .rp-mobile-nav { display: flex; gap: 0; border-bottom: 2px solid var(--border-light, #e2e8f0); background: var(--panel-hover, #f8fafc); }
  .rp-mobile-nav button { flex: 1; padding: 10px 8px; font-size: 13px; font-weight: 600;
    border: none; background: transparent; cursor: pointer; color: var(--color-muted-dark, #64748b);
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; }
  .rp-mobile-nav button.is-active { background: #fff; border-bottom-color: #2563eb; color: var(--ink, #1e293b); }
  .rp-main { flex-direction: column; }
  .rp-panel-left, .rp-panel-center, .rp-panel-right {
    display: none; width: 100% !important; height: calc(100vh - 260px) !important;
    max-height: none !important; border: none !important; overflow-y: auto;
  }
  .rp-panel-left.rp-panel-active,
  .rp-panel-center.rp-panel-active,
  .rp-panel-right.rp-panel-active { display: flex; flex-direction: column; }
  .rp-panel-center.rp-panel-active { display: block; min-height: 400px; }
  .rp-panel-center.rp-panel-active .rp-map { height: 100% !important; min-height: 400px; }
  .rp-workflow { display: none; }
  .rp-topbar { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
  .rp-topbar-stat { font-size: 11px; padding: 2px 6px; }
  .rp-topbar-stat:nth-child(-n+2) { display: none; } /* hide Base + logements count on mobile */
  .rp-bottombar { flex-wrap: wrap; gap: 6px; padding: 8px; }
  .rp-bottombar button { font-size: 12px; padding: 8px 12px; flex: 1 1 auto; min-width: 0; }
}
/* Desktop: hide mobile nav */
@media (width >= 769px) { .rp-mobile-nav { display: none; } }
/* --- Responsive: small mobile --- */
@media (width <= 480px) {
  .rp-panel-left.rp-panel-active, .rp-panel-center.rp-panel-active, .rp-panel-right.rp-panel-active {
    height: calc(100vh - 240px) !important;
  }
  .rp-topbar { gap: 4px; padding: 6px 8px; }
  .rp-day-tabs { gap: 2px; }
  .rp-day-tab { font-size: 12px; padding: 6px 8px; }
  .rp-visit-card { padding: 8px; }
}

/* --- Pre-optimization selected list --- */
.rp-preopt-header {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  color: #334155;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
}
.rp-preopt-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-muted-light, #f1f5f9);
  border-left: 3px solid transparent;
}
.rp-preopt-item.rp-prio-urgent { border-left-color: var(--color-danger, #ef4444); background: #fef2f2; }
.rp-preopt-item.rp-prio-medium { border-left-color: #f59e0b; background: #fffbeb; }
.rp-preopt-name { font-weight: 600; font-size: 13px; color: var(--ink, #0f172a); }
.rp-preopt-addr { font-size: 11px; color: var(--color-muted-dark, #64748b); }
.rp-preopt-phone { font-size: 11px; }
.rp-preopt-phone a { color: var(--color-info, #3b82f6); text-decoration: none; }

/* --- Visit card extras (notes + priority) --- */
.rp-visit-extras {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  align-items: center;
}
.rp-visit-prio {
  padding: 2px 4px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: var(--radius-2xs, 4px);
  font-size: 11px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.rp-visit-note {
  flex: 1;
  padding: 3px 6px;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-2xs, 4px);
  font-size: 11px;
  background: var(--panel-hover, #f8fafc);
  min-width: 0;
}
.rp-visit-note:focus {
  border-color: var(--color-info, #3b82f6);
  outline: none;
  background: #fff;
}

/* --- Priority border on visit cards --- */
.rp-visit-card.rp-card-urgent { border-left: 3px solid var(--color-danger, #ef4444); background: #fef2f2; }
.rp-visit-card.rp-card-medium { border-left: 3px solid #f59e0b; background: #fffbeb; }

/* --- Unselected pin marker --- */
.rp-marker-pin {
  background: none !important;
  border: none !important;
}

/* --- Map popup action buttons --- */
.rp-map-add-btn,
.rp-map-remove-btn {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-xs, 8px);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}
.rp-map-add-btn { background: #2563eb; }
.rp-map-remove-btn { background: var(--color-danger, #ef4444); }
.rp-map-add-btn:hover { background: #1d4ed8; }
.rp-map-remove-btn:hover { background: #dc2626; }

/* --- Export CSV button in topbar --- */
.rp-export-csv-btn {
  margin-left: auto;
  padding: 4px 10px !important;
  font-size: 12px !important;
  background: transparent !important;
  border: 1px solid var(--muted, #94a3b8) !important;
  color: #334155 !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  -webkit-text-fill-color: #334155 !important;
}
.rp-export-csv-btn:hover {
  background: var(--color-muted-light, #f1f5f9) !important;
  border-color: var(--color-muted-dark, #64748b) !important;
}

/* Units with VISAP already confirmed — dimmed to distinguish from pending */
.rp-unit-item.rp-unit-visap-done {
  opacity: 0.55;
}
.rp-visap-badge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--radius-2xs, 4px);
  color: #fff;
  white-space: nowrap;
  line-height: 1.3;
}
.rp-visap-done { background: var(--color-success, #22c55e); }
.rp-visap-planned { background: #f59e0b; }
.rp-unit-item.rp-unit-visap-done:hover {
  opacity: 0.8;
}
