/* Step 2: Fahrer-Auswahl */

.rp-step2-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  padding: 24px 28px;
}
@media (max-width: 1100px) {
  .rp-step2-layout {
    grid-template-columns: 1fr;
  }
}

.rp-step2-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
  position: sticky;
  top: 18px;
}
.rp-step2-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Tour-Übersicht */
.rp-summary-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 12px;
  row-gap: 4px;
  margin: 0 0 12px;
  font-size: var(--font-size-sm);
}
.rp-summary-dl dt { color: var(--color-text-muted); }
.rp-summary-dl dd { margin: 0; font-weight: var(--font-weight-semibold); }

/* Schicht-Display */
.rp-shift-display {
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  font-weight: var(--font-weight-semibold);
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--color-surface-muted);
  border-radius: var(--radius-md);
}
.rp-travel-label {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
  margin-bottom: 6px;
}

/* Anfahrt-Block (klappt weg wenn Toggle aus) */
.rp-travel-block {
  margin-bottom: 10px;
}
.rp-travel-block.is-hidden { display: none; }
.rp-anfahrt-mount gmp-place-autocomplete {
  display: block;
  width: 100%;
}
.rp-travel-info {
  margin-top: 4px;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  font-style: italic;
  line-height: 1.5;
}
.rp-travel-info.is-loaded { font-style: normal; color: var(--color-text-default); }

/* Vorlauf/Nachlauf — untereinander, alle Spalten zwischen Zeilen alignt via Subgrid */
.rp-buffer-grid {
  display: grid;
  grid-template-columns: 80px minmax(0, max-content) 14px 56px 1fr;
  gap: 6px 10px;
  margin-bottom: 8px;
  align-items: center;
}
.rp-buffer-cell {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  align-items: center;
  padding: 8px 12px;
  background: var(--color-surface-muted);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color 100ms ease, background 100ms ease, opacity 100ms ease;
  position: relative;
}
.rp-buffer-cell:hover { border-color: var(--color-border-strong); }
.rp-buffer-cell:has(.rp-buffer-hidden-check:checked) {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary-soft);
}
.rp-buffer-cell:has(.rp-buffer-hidden-check:not(:checked)) {
  opacity: 0.55;
}
.rp-buffer-hidden-check {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.rp-buffer-label {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}
.rp-buffer-prefix {
  color: var(--color-text-default);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: var(--font-size-sm);
  text-align: left;
}
.rp-buffer-plus {
  text-align: center;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-muted);
}
.rp-buffer-plus:empty { color: transparent; }
.rp-buffer-num {
  width: 56px;
  padding: 3px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  text-align: center;
  background: var(--color-surface);
  font-variant-numeric: tabular-nums;
}
.rp-buffer-min {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}
.rp-buffer-total {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-brand-primary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  justify-self: end;
}
.rp-buffer-cell:has(.rp-buffer-hidden-check:not(:checked)) .rp-buffer-total {
  color: var(--color-text-muted);
}
.rp-recheck-btn {
  margin-top: 10px;
  width: 100%;
}

/* Ausgewählte Fahrer */
.rp-selected-drivers {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rp-selected-drivers li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--color-brand-primary-soft);
  border: 1px solid var(--color-brand-primary);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}
.rp-selected-drivers li.rp-selected-empty {
  background: var(--color-surface-muted);
  border-color: var(--color-border);
  color: var(--color-text-muted);
  font-style: italic;
  justify-content: center;
}
.rp-selected-info { flex: 1; min-width: 0; overflow: hidden; }
.rp-selected-name {
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-selected-role {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}
.rp-selected-role select {
  font-size: var(--font-size-xs);
  padding: 1px 4px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.rp-selected-remove {
  padding: 2px 7px;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: #dc2626;
  cursor: pointer;
  font-size: 13px;
  font-weight: var(--font-weight-bold);
}
.rp-selected-remove:hover { background: #fde2e2; }
.rp-selected-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin: 0;
}

/* Fahrer-Liste */
.rp-step2-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.rp-step2-filters {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rp-step2-filters input[type="text"] {
  width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}
.rp-step2-filters .rp-checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.rp-drivers-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rp-driver-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  align-items: center;
}
.rp-driver-card.is-blocked {
  background: #fef2f2;
  border-color: #fecaca;
}
.rp-driver-card.is-selected {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary-soft);
}
.rp-driver-main { min-width: 0; }
.rp-driver-name {
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-md);
}
.rp-driver-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rp-driver-licenses {
  display: inline-flex;
  gap: 4px;
}
.rp-driver-license-pill {
  display: inline-block;
  padding: 1px 6px;
  background: var(--color-surface-muted);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.02em;
}
.rp-driver-issues {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rp-driver-issue {
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
  align-self: flex-start;
}
.rp-driver-issue.is-blocker {
  background: #fee2e2;
  color: #991b1b;
  font-weight: var(--font-weight-semibold);
}
.rp-driver-issue.is-warning {
  background: #fef3c7;
  color: #92400e;
}

.rp-driver-action button {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  cursor: pointer;
}
.rp-driver-action .rp-driver-pick {
  background: var(--color-brand-primary);
  color: var(--color-brand-primary-on);
  border: 1px solid var(--color-brand-primary);
}
.rp-driver-action .rp-driver-pick:hover { background: var(--color-brand-primary-hover); color: var(--color-brand-primary-on-hover); }
.rp-driver-action .rp-driver-pick:disabled {
  background: var(--color-border);
  color: var(--color-text-muted);
  cursor: not-allowed;
  border-color: var(--color-border);
}
.rp-driver-action .rp-driver-picked {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-primary);
  border: 1px solid var(--color-brand-primary);
  cursor: pointer;
  font-weight: var(--font-weight-semibold);
}
.rp-driver-action .rp-driver-picked:hover {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.rp-step2-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.rp-step2-nav .btn-primary[disabled] {
  background: var(--color-border);
  cursor: not-allowed;
}

/* Kalender-Panel */
.rp-calendar-panel { padding-bottom: 8px; }
.rp-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.rp-calendar-controls {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.rp-view-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.rp-view-btn {
  padding: 5px 10px;
  border: none;
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: var(--font-size-sm);
}
.rp-view-btn.is-active {
  background: var(--color-brand-primary-soft);
  color: var(--color-brand-primary);
  font-weight: var(--font-weight-semibold);
}
.rp-view-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
.rp-cal-mount {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.rp-cal-mount .gdv-root { padding: 0; }
.rp-cal-placeholder {
  padding: 30px 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-style: italic;
  background: var(--color-surface-muted);
}

.rp-link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-brand-primary);
  cursor: pointer;
  font-size: var(--font-size-sm);
  text-decoration: underline;
  text-underline-offset: 2px;
}


/* Individuelle Besetzung – erscheint ausschließlich bei Modulfreigabe bzw.
   als lesbare Historie. Vorhandene Einzelbesetzung behält ihr Layout. */
#vehicle-travel-title[hidden], #crew-editor[hidden], #crew-selection-context[hidden], #legacy-shift-settings[hidden], #crew-shift-note[hidden] { display: none !important; }
.rp-step2-list-wrap { min-width: 0; }
.rp-crew-heading, .rp-crew-top, .rp-crew-axis { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rp-crew-heading h3 { margin-bottom: 0; }
.rp-crew-heading > span, .rp-crew-top small, .rp-crew-note { color: var(--color-text-muted); font-size: var(--font-size-xs); }
.rp-crew-note { line-height: 1.6; margin: 9px 0; }
.rp-crew-card { border: 1px solid var(--color-border); border-left: 4px solid var(--color-border-strong, #cbd5e1); border-radius: var(--radius-md); padding: 14px; margin: 12px 0; background: var(--color-surface); }
.rp-crew-card.is-editing { border-color: var(--color-brand-primary); background: var(--color-brand-primary-soft); }
.rp-crew-top { align-items: start; margin-bottom: 12px; }
.rp-crew-top small, .rp-crew-top strong { display: block; }
.rp-crew-top strong { margin-top: 3px; }
.rp-crew-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.rp-crew-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.rp-crew-fields label { display: flex; flex-direction: column; gap: 5px; font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); min-width: 0; }
.rp-crew-fields input, .rp-crew-fields select { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text-default); padding: 8px 9px; font: inherit; font-weight: 400; }
.rp-crew-fields :is(input, select):focus-visible { outline: 2px solid var(--color-brand-primary); outline-offset: 2px; }
.rp-crew-buffers { margin-top: 12px; }
.rp-crew-buffers summary { cursor: pointer; color: var(--color-text-muted); font-size: var(--font-size-sm); padding: 4px 0; }
.rp-crew-buffers[open] .rp-crew-fields { margin-top: 8px; }
.rp-crew-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.rp-crew-presets button, .rp-crew-add { border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-default); border-radius: var(--radius-md); padding: 8px 12px; font-size: var(--font-size-sm); cursor: pointer; }
.rp-crew-presets button:hover, .rp-crew-add:hover { border-color: var(--color-brand-primary); color: var(--color-brand-primary); }
.rp-crew-add { width: 100%; border-style: dashed; color: var(--color-brand-primary); }
.rp-crew-handover { padding: 12px; border-radius: var(--radius-md); background: var(--color-surface-muted); margin: 14px 0; }
.rp-crew-handover > label { display: flex; align-items: center; gap: 7px; font-size: var(--font-size-sm); }
.rp-crew-handover .rp-crew-fields { margin-top: 10px; }
.rp-crew-context { margin: 7px 0 0; color: var(--color-brand-primary); font-size: var(--font-size-sm); line-height: 1.5; }
.rp-crew-availability { font-size: var(--font-size-xs); color: #166534; margin: 8px 0 0; }
.rp-crew-validation { font-size: var(--font-size-sm); color: #166534; padding: 10px 12px; border-radius: var(--radius-md); background: #f0fdf4; line-height: 1.6; margin-top: 12px; }
.rp-crew-validation.has-issue { background: #fffbeb; color: #92400e; }
.rp-crew-availability.has-issue { color: #b91c1c; }
.rp-crew-timeline { margin: 16px 0; }
.rp-crew-axis { font-size: var(--font-size-xs); color: var(--color-text-muted); margin-bottom: 8px; }
.rp-crew-timeline-row { display: grid; grid-template-columns: 65px minmax(0, 1fr); gap: 10px; align-items: center; margin: 7px 0; font-size: var(--font-size-xs); }
.rp-crew-track { height: 24px; border-radius: 4px; background: var(--color-surface-muted); position: relative; overflow: hidden; }
.rp-crew-bar { position: absolute; inset-block: 0; background: var(--color-brand-primary); color: var(--color-brand-primary-on); border-radius: 4px; display: flex; justify-content: center; align-items: center; overflow: hidden; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rp-crew-bar.is-second { background: #356d91; color: #fff; }
#crew-editor button:disabled, .rp-driver-action button:disabled { cursor: not-allowed; opacity: .65; }
#crew-editor input:disabled, #crew-editor select:disabled { opacity: .85; }
@media (max-width: 650px) {
  .rp-crew-fields { grid-template-columns: 1fr; }
  .rp-crew-top, .rp-crew-heading { align-items: start; flex-direction: column; }
  .rp-crew-actions { justify-content: flex-start; }
  .rp-step2-filters, .rp-calendar-controls { flex-wrap: wrap; }
}

#vehicle-travel-title { font-size: var(--font-size-sm); margin: 16px 0 10px; }
