:root {
  /* Palette du fichier : couleurs écrites en dur remplacées par ces variables (mêmes valeurs). */
  --c-gray-43: #667;
  --c-gray-7: #111;
  --c-green-40: #2e9d5f;
  --c-red-41: #b3261e;
  --c-red-47: #c62828;
  --c-white: #fff;
}
.fiche-dialog {
  padding: 0;
  width: calc(100% - 20px);
  max-width: 580px;
  max-height: 92dvh;
  overflow: hidden;
}
.fiche-dialog[open] {
  display: flex;
  flex-direction: column;
}
.fiche-dialog > .booking-dialog-top {
  padding: 12px 16px;
  border-bottom: 1px solid var(--theme-border);
  flex: none;
}
.fiche-dialog .booking-dialog-top button {
  background: transparent;
  color: var(--theme-text);
  border: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
}
.fiche-content {
  padding: 12px 16px;
  overflow: auto;
  min-height: 0;
}
.fiche-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  margin: 0 0 14px;
}
.fiche-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--theme-text);
  font-size: 14px;
  padding: 8px;
}
.fiche-tabs button[aria-selected='true'] {
  background: var(--theme-accent);
  color: var(--theme-on-accent);
}
.fiche-form {
  display: grid;
  gap: 12px;
}
.fiche-form label {
  font-size: 14px;
  margin: 0;
  min-width: 0;
}
.fiche-form input,
.fiche-form select {
  width: 100%;
  min-width: 0;
  font-size: 16px;
  min-height: 44px;
  padding: 9px 10px;
}
.fiche-form small {
  display: block;
  font-size: 12px;
  color: var(--theme-muted);
}
.fiche-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
/* Recette finale (V200i) : en taille téléphone, un champ ne déborde plus de sa colonne (« Prénom » du nouveau chauffeur). */
.fiche-pair > label > input,
.fiche-pair > label > select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.fiche-lookup {
  display: flex;
  align-items: center;
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  overflow: hidden;
}
.fiche-lookup input {
  border: 0;
  flex: 1;
  background: var(--theme-input);
}
.fiche-lookup button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--theme-accent);
  padding: 8px;
}
.fiche-error {
  color: #db4242;
  font-size: 14px;
  margin: 4px 16px 12px;
  overflow-wrap: anywhere;
}
.fiche-error:empty,
#v156-plate-status:empty,
#fiche-fuel-warning:empty {
  display: none;
}
.fiche-text-action {
  background: transparent !important;
  color: var(--theme-accent) !important;
  border: 0 !important;
  min-height: 44px;
  padding: 8px 0 !important;
  font-size: 14px !important;
}
.fiche-note {
  font-size: 12px;
  margin-bottom: 10px;
}
.document-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 54px;
  padding: 6px 0;
  border-bottom: 1px solid var(--theme-border);
}
.document-line > .vtc-icon {
  width: 19px;
  height: 19px;
  color: var(--theme-accent);
  flex: none;
}
.document-name {
  background: transparent !important;
  border: 0 !important;
  color: var(--theme-text) !important;
  font-size: 14px !important;
  min-height: 44px;
  padding: 4px 0 !important;
  text-align: left;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.document-action {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--theme-accent);
  border-radius: 9px;
  color: var(--theme-accent);
  cursor: pointer;
  margin: 0 !important;
}
.document-action input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  opacity: 0;
  padding: 0 !important;
}
.document-action:focus-within {
  outline: 2px solid var(--theme-focus);
}
.document-action:has(input:disabled) {
  opacity: 0.4;
}
.document-state {
  width: 16px;
  flex: none;
  color: var(--theme-accent);
  font-size: 16px;
  text-align: center;
}
.document-date {
  align-items: end;
  margin: 8px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--theme-border);
}
.document-date label {
  min-width: 0;
  font-size: 14px;
}
.document-date input {
  width: 100%;
  min-height: 44px;
}
.document-date button {
  min-height: 44px;
  padding: 8px;
}
.fiche-form .booking-check {
  display: flex;
  align-items: center;
  gap: 12px;
}
.fiche-form .booking-check input {
  width: 22px;
  min-height: 22px;
  height: 22px;
  margin-left: auto;
}
.fiche-content [hidden] {
  display: none !important;
}
.fiche-save {
  width: 100%;
  min-height: 48px;
}
.fiche-content h4 {
  margin: 16px 0 6px;
}
#category-label-form {
  display: grid;
  gap: 12px;
}
#category-label-fields {
  display: grid;
  gap: 12px;
}
#category-label-fields label {
  display: grid;
  font-size: 14px;
}
#category-label-fields input {
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  background: var(--theme-input);
  color: var(--theme-text);
  font: inherit;
}
#category-label-form > button {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--theme-accent);
  color: var(--theme-on-accent);
}
@media (max-width: 350px) {
  .fiche-content {
    padding: 10px;
  }
  .fiche-dialog {
    width: calc(100% - 12px);
  }
  .document-line {
    gap: 4px;
  }
  .document-name {
    font-size: 13px !important;
  }
  .document-date button span {
    display: none;
  }
}
/* Lot 31 – dates de validité enregistrées automatiquement */
.document-date {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.date-state {
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--c-gray-43);
}
.date-state.ok {
  color: #1b7a3e;
  font-weight: 600;
}
.date-state.err {
  color: var(--c-red-41);
  font-weight: 600;
}
.document-date label {
  flex: none;
}

.vehicle-colors {
  border: 0;
  padding: 0;
  margin: 0.4rem 0;
}
.vehicle-colors legend {
  font-weight: 600;
  padding: 0 0 0.3rem;
}
.vehicle-colors .vc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.vehicle-colors .vc-row button.vc {
  appearance: none;
  -webkit-appearance: none;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(128, 128, 128, 0.55);
  padding: 0;
  margin: 0;
  cursor: pointer;
  position: relative;
  box-shadow: none;
}
.vehicle-colors .vc-row button.vc[aria-checked='true'] {
  outline: 3px solid var(--theme-primary, #0b5fff);
  outline-offset: 2px;
}
.vehicle-colors .vc-row button.vc[aria-checked='true']::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--c-white);
  text-shadow: 0 0 3px #000;
}
.vehicle-colors .vc-row button.vc-blanc {
  background: var(--c-white);
}
.vehicle-colors .vc-row button.vc-noir {
  background: var(--c-gray-7);
}
.vehicle-colors .vc-row button.vc-grisclair {
  background: #c9ccd1;
}
.vehicle-colors .vc-row button.vc-grisfonce {
  background: #5b5f66;
}
.vehicle-colors .vc-row button.vc-argent {
  background: linear-gradient(135deg, #f2f3f5, #a9adb4);
}
.vehicle-colors .vc-row button.vc-bleu {
  background: #1e56c8;
}
.vehicle-colors .vc-row button.vc-rouge {
  background: var(--c-red-47);
}
.vehicle-colors .vc-row button.vc-vert {
  background: #2e7d4f;
}
.vehicle-colors .vc-row button.vc-beige {
  background: #d8c3a0;
}
.vehicle-colors .vc-row button.vc-marron {
  background: #6d4a2f;
}
.vehicle-colors .vc-row button.vc-jaune {
  background: #f2c200;
}
.vehicle-colors .vc-row button.vc-orange {
  background: #ef7d00;
}
.vc-name {
  margin: 0.3rem 0 0;
}

/* V201a : fenêtre « Dispatch automatique » — contenu avec marges et défilement, interrupteur aligné, bouton Enregistrer toujours visible. */
.ad-dialog > .fiche-content {
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.ad-dialog .ad-switch {
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ad-dialog .ad-switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 48px;
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: #b9bfc8;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.ad-dialog .ad-switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-white);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.ad-dialog .ad-switch input:checked {
  background: var(--c-green-40);
}
.ad-dialog .ad-switch input:checked::after {
  transform: translateX(20px);
}
.ad-dialog .ad-switch:has(input:checked) {
  border-color: var(--c-green-40);
}
@media (prefers-reduced-motion: reduce) {
  .ad-dialog .ad-switch input,
  .ad-dialog .ad-switch input::after {
    transition: none;
  }
}
.ad-dialog .ad-foot {
  flex: none;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--theme-border);
  background: var(--theme-surface);
}
.ad-dialog .ad-foot .fiche-error:empty {
  display: none;
}
