.ro-sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ro-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ro-border);
  background: var(--ro-surface-alt);
}

.ro-summary-card {
  background: #fff;
  border: 1px solid var(--ro-border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--ro-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ro-summary-card .label {
  color: var(--ro-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

.ro-summary-card .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--ro-text);
}

.ro-driver-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--ro-surface);
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.ro-driver-card {
  border: 1px solid var(--ro-border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  box-shadow: var(--ro-shadow-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  scroll-margin: 8px;
  min-width: 0;
}

.ro-driver-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--ro-shadow-md);
}

.ro-driver-card.active {
  border-color: var(--ro-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1), var(--ro-shadow-md);
}

.ro-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ro-driver-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.ro-driver-color {
  width: 10px;
  height: 44px;
  border-radius: 5px;
  flex-shrink: 0;
}

.ro-driver-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--ro-text-muted);
  font-size: 12px;
  margin-top: 4px;
}

.ro-stop-list {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--ro-border);
  display: grid;
  gap: 6px;
  transition: max-height 0.3s ease, opacity 0.18s ease;
  max-height: 2000px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ro-driver-card.collapsed .ro-stop-list {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.ro-card-toggle {
  border: 1px solid var(--ro-border);
  background: #fff;
  color: var(--ro-text-muted);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}

.ro-card-toggle:hover {
  border-color: var(--ro-primary);
  color: var(--ro-primary);
}

.ro-driver-card.collapsed .ro-card-toggle i {
  transform: rotate(-90deg);
}

.ro-stop-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--ro-surface-alt);
  color: var(--ro-text);
}

.ro-stop-seq {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 11px;
  color: #fff;
  background: var(--ro-primary);
}

.ro-stop-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ro-stop-body .address { font-size: 13px; color: var(--ro-text); }
.ro-stop-body .meta { font-size: 12px; color: var(--ro-text-muted); display: flex; gap: 8px; flex-wrap: wrap; }

.ro-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--ro-surface-alt);
  border: 1px solid var(--ro-border);
  color: var(--ro-text-muted);
  padding: 3px 7px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
}

.ro-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--ro-primary-soft);
  color: var(--ro-primary);
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.ro-audit-label {
  font-size: 10px;
  color: var(--ro-text-muted);
  padding: 6px 10px 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ro-empty-sidebar {
  padding: 20px;
  text-align: center;
  color: var(--ro-text-muted);
}

/* ── Apply & Schedule bar ──────────────────────────────────── */
.ro-apply-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: var(--ro-surface-alt);
  border: 1px solid var(--ro-border);
  border-radius: 12px;
  margin-bottom: 12px;
}

.ro-apply-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  background: #059669;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}

.ro-apply-btn:hover:not(:disabled) {
  background: #047857;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.ro-apply-btn:active:not(:disabled) {
  transform: translateY(0);
}

.ro-apply-btn:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
  opacity: 0.7;
}

.ro-apply-btn--done {
  background: #10B981 !important;
  cursor: default;
}

.ro-apply-hint {
  font-size: 11px;
  color: var(--ro-text-muted);
  text-align: center;
  line-height: 1.4;
}

/* ── Route filter chips ────────────────────────────────────── */
.ro-route-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ro-border);
  background: var(--ro-surface-alt);
}

.ro-route-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--_rf-color, var(--ro-border));
  background: #fff;
  color: var(--ro-text);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  user-select: none;
  -webkit-user-select: none;
}

.ro-route-filter:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--_rf-color, #999) 25%, transparent);
}

.ro-route-filter input[type="checkbox"] {
  display: none;
}

.ro-route-filter .rf-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--_rf-color, var(--ro-border));
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.ro-route-filter .rf-check i {
  font-size: 9px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.12s;
}

.ro-route-filter.active {
  background: color-mix(in srgb, var(--_rf-color, #3B82F6) 10%, #fff);
  border-color: var(--_rf-color, var(--ro-primary));
  box-shadow: 0 2px 8px color-mix(in srgb, var(--_rf-color, #999) 20%, transparent);
}

.ro-route-filter.active .rf-check {
  background: var(--_rf-color, var(--ro-primary));
  border-color: var(--_rf-color, var(--ro-primary));
}

.ro-route-filter.active .rf-check i {
  opacity: 1;
}

/* ── Mobile sidebar adjustments ─────────────────────────────── */
@media (max-width: 640px) {
  .ro-sidebar-inner {
    height: auto;                   /* let it flow instead of 100% */
  }

  .ro-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px 10px;
  }

  .ro-summary-card {
    padding: 8px 10px;
  }

  .ro-summary-card .value {
    font-size: 16px;
  }

  .ro-driver-list {
    padding: 8px 10px;
    gap: 8px;
    flex: none;                     /* don't flex-grow */
    overflow-y: visible;            /* no internal scroll — page scrolls */
    overflow-x: hidden;
    max-height: none;               /* no cap */
  }

  .ro-driver-card {
    padding: 10px;
    min-height: 44px;
  }

  .ro-driver-meta {
    gap: 4px;
  }

  .ro-tag {
    font-size: 10px;
    padding: 2px 6px;
  }

  .ro-stop-list {
    overflow-y: visible;            /* no internal scroll on mobile */
    overflow-x: hidden;
  }

  .ro-route-filters {
    gap: 5px;
    padding: 6px 10px;
  }

  .ro-route-filter {
    font-size: 11px;
    padding: 4px 10px 4px 6px;
  }

  .ro-route-filter .rf-check {
    width: 16px;
    height: 16px;
  }

  .ro-route-filter .rf-check i {
    font-size: 8px;
  }

  .ro-apply-bar {
    padding: 10px;
  }

  .ro-apply-btn {
    font-size: 12px;
    padding: 9px 14px;
  }
}
