/* ==========================================================================
   Fluent 2 — thème du bureau d'expertise automobile
   Fond blanc, typographie Segoe UI, jetons Fluent (Microsoft).
   Ce fichier stylise l'ensemble de l'interface ; aucune dépendance externe.
   ========================================================================== */

:root {
  /* Palette neutre Fluent */
  --f-white: #ffffff;
  --f-bg: #ffffff;
  --f-bg-2: #faf9f8;
  --f-bg-3: #f3f2f1;
  --f-border: #e1dfdd;
  --f-border-strong: #d2d0ce;
  --f-text: #242424;
  --f-text-2: #605e5c;
  --f-text-3: #8a8886;

  /* Couleur de marque Fluent */
  --f-brand: #0f6cbd;
  --f-brand-hover: #115ea3;
  --f-brand-pressed: #0c3b5e;
  --f-brand-soft: #eff6fc;
  --f-brand-soft-2: #deecf9;

  /* États */
  --f-success: #107c10;
  --f-success-soft: #dff6dd;
  --f-warning: #835c00;
  --f-warning-soft: #fff4ce;
  --f-danger: #a4262c;
  --f-danger-soft: #eef1f6;
  --f-info: #0f6cbd;
  --f-info-soft: #eff6fc;

  /* Élévation */
  --f-shadow-2: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --f-shadow-4: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --f-shadow-8: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --f-shadow-16: 0 25px 50px -12px rgba(0, 0, 0, 0.1);

  /* Rayons */
  --f-radius-s: 8px;
  --f-radius-m: 12px;
  --f-radius-l: 16px;
  --f-radius-xl: 24px;

  /* Typographie */
  --f-font: 'Segoe UI', 'Segoe UI Web (West European)', -apple-system,
    BlinkMacSystemFont, Roboto, 'Helvetica Neue', system-ui, sans-serif;

  /* Compat : anciens jetons Material utilisés par le JS (mappés Fluent) */
  --md-primary: var(--f-brand);
  --md-on-primary: #ffffff;
  --md-primary-container: var(--f-brand-soft);
  --md-on-primary-container: var(--f-brand);
  --md-surface: var(--f-white);
  --md-surface-container: var(--f-bg-2);
  --md-surface-container-high: var(--f-bg-3);
  --md-secondary-container: var(--f-bg-2);
  --md-on-secondary-container: var(--f-text);
  --md-on-surface: var(--f-text);
  --md-on-surface-variant: var(--f-text-2);
  --md-outline: var(--f-border);
  --md-error: var(--f-danger);
  --md-error-container: var(--f-danger-soft);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--f-bg);
  color: var(--f-text);
  font-family: var(--f-font);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--f-brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  color: var(--f-text);
}

/* Accessibilité : anneau de focus Fluent */
:focus-visible {
  outline: 2px solid var(--f-text);
  outline-offset: 1px;
  border-radius: var(--f-radius-s);
}

/* ---------------- Typographie utilitaire ---------------- */
.title {
  font-size: 16px;
  font-weight: 600;
}
.sub {
  font-size: 12px;
  color: var(--f-text-2);
}
.muted {
  color: var(--f-text-2);
}
.small {
  font-size: 12px;
}
.bold {
  font-weight: 600;
}
.mono {
  font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace;
  letter-spacing: 0.5px;
}
.t-center {
  text-align: center;
}
.grow {
  flex: 1;
  min-width: 0;
}
.spacer {
  flex: 1;
  min-width: 0;
}
.mt {
  margin-top: 16px;
}
.mt-s {
  margin-top: 8px;
}
.mb {
  margin-bottom: 16px;
}
.col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.grid {
  display: grid;
  gap: 12px;
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 720px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}
.divider {
  height: 1px;
  background: var(--f-border);
  margin: 12px 0;
}
.desktop-only {
  display: inline-flex !important;
}
.mobile-only {
  display: none !important;
}
@media (max-width: 860px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: inline-flex !important;
  }
}

/* ---------------- Boutons Fluent ---------------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--f-radius-s);
  background: var(--f-white);
  color: var(--f-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease, color 0.1s ease;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}
.btn:hover {
  background: var(--f-bg-3);
}
.btn:active {
  background: var(--f-border);
}
.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-filled {
  background: var(--f-brand);
  color: #fff;
  border-color: var(--f-brand);
}
.btn-filled:hover {
  background: var(--f-brand-hover);
}
.btn-filled:active {
  background: var(--f-brand-pressed);
}
.btn-outlined,
.btn-outline {
  background: transparent;
  border-color: var(--f-border-strong);
  color: var(--f-text);
}
.btn-outlined:hover,
.btn-outline:hover {
  background: var(--f-bg-3);
}
.btn-tonal {
  background: var(--f-brand-soft);
  color: var(--f-brand);
  border-color: transparent;
}
.btn-tonal:hover {
  background: var(--f-brand-soft-2);
}
.btn-text {
  background: transparent;
  border-color: transparent;
  color: var(--f-brand);
  padding: 0 8px;
}
.btn-text:hover {
  background: var(--f-brand-soft);
}
.btn-error {
  background: var(--f-danger);
  color: #fff;
  border-color: var(--f-danger);
}
.btn-error:hover {
  background: #8e1f24;
}
.btn-error-outline {
  background: transparent;
  color: var(--f-danger);
  border-color: var(--f-danger);
}
.btn-error-outline:hover {
  background: var(--f-danger-soft);
}
.btn-sm {
  min-height: 26px;
  padding: 0 8px;
  font-size: 12px;
}
.btn-block {
  width: 100%;
}

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--f-radius-s);
  background: transparent;
  color: var(--f-text);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--f-bg-3);
}
.icon-btn:active {
  background: var(--f-border);
}

/* Icônes SVG Fluent (couleur héritée) */
.ficon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}
.ficon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn .ficon,
.icon-btn .ficon {
  width: 16px;
  height: 16px;
}

/* ---------------- Champs de formulaire ---------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field > label,
.field-label-inline {
  font-size: 13px;
  font-weight: 600;
  color: var(--f-text);
}
.field input,
.field select,
.field textarea,
.sel-input,
input.sel-input,
select.sel-input,
textarea.sel-input {
  width: 100%;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--f-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--f-radius-s);
  background: var(--f-white);
  color: var(--f-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
}
.field textarea,
textarea.sel-input,
.field textarea.big {
  min-height: 84px;
  resize: vertical;
  padding: 8px 10px;
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.sel-input:focus {
  outline: none;
  border-color: var(--f-brand);
  border-bottom-color: var(--f-brand);
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--f-text-3);
}
.hint {
  font-size: 12px;
  color: var(--f-text-2);
}
.field input[type='file'] {
  padding: 6px;
  border-bottom-width: 1px;
}
.sel-input.is-empty {
  border-color: var(--f-danger);
  border-bottom-color: var(--f-danger);
}
.list-item .is-danger {
  color: var(--f-danger);
  font-weight: 600;
}

/* ---------------- Cartes ---------------- */
.card {
  background: var(--f-white);
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-l);
  box-shadow: var(--f-shadow-2);
  padding: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}
.box {
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-m);
  background: var(--f-bg-2);
  padding: 12px;
}
.section {
  margin-bottom: 20px;
}
.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--f-text-2);
  margin: 8px 0;
}

/* ---------------- Stat cards ---------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--f-white);
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-l);
  box-shadow: var(--f-shadow-2);
  padding: 16px;
  cursor: pointer;
}
.stat-card:hover {
  box-shadow: var(--f-shadow-4);
}
.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--f-radius-m);
  background: var(--f-brand-soft);
  color: var(--f-brand);
}
.stat-value {
  font-size: 22px;
  font-weight: 600;
  line-height: 24px;
}
.stat-label {
  font-size: 12px;
  color: var(--f-text-2);
}

/* ---------------- Chips / statuts ---------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  height: auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--f-bg-3);
  color: var(--f-text);
  font-size: 12px;
  font-weight: 600;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.st-nouveau {
  background: var(--f-info-soft);
  color: var(--f-info);
}
.st-en_traitement {
  background: var(--f-warning-soft);
  color: var(--f-warning);
}
.st-en_attente_validation {
  background: var(--f-brand-soft-2);
  color: var(--f-brand-pressed);
}
.st-retourne {
  background: var(--f-danger-soft);
  color: var(--f-danger);
}
.st-valide {
  background: var(--f-success-soft);
  color: var(--f-success);
}
.st-archive {
  background: var(--f-bg-3);
  color: var(--f-text-2);
}
.vin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--f-radius-s);
  font-size: 12px;
  font-weight: 600;
}
.vin-source {
  font-size: 11px;
  color: var(--f-text-2);
}

/* ---------------- Listes ---------------- */
.list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-l);
  overflow: hidden;
  background: var(--f-white);
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--f-border);
  background: var(--f-white);
}
.list-item:last-child {
  border-bottom: none;
}
.list-item.clickable {
  cursor: pointer;
}
.list-item.clickable:hover {
  background: var(--f-bg-2);
}

/* ---------------- Tableaux ---------------- */
.table-wrap {
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-l);
  overflow-x: auto;
  background: var(--f-white);
}
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table-wrap thead th {
  text-align: left;
  font-weight: 600;
  color: var(--f-text-2);
  background: var(--f-bg-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--f-border);
  white-space: nowrap;
}
.table-wrap tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--f-border);
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td {
  border-bottom: none;
}
.table-wrap tbody tr:hover {
  background: var(--f-bg-2);
}
.table-mobile {
  display: none;
}
@media (max-width: 720px) {
  .table-desktop {
    display: none !important;
  }
  .table-mobile {
    display: block;
  }
}

/* ---------------- Spinner / états ---------------- */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--f-border);
  border-top-color: var(--f-brand);
  border-radius: 50%;
  animation: f-spin 0.8s linear infinite;
  margin: 0 auto;
}
.spinner.inline-block {
  display: inline-block;
  width: 16px;
  height: 16px;
}
@keyframes f-spin {
  to {
    transform: rotate(360deg);
  }
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 16px;
  color: var(--f-text-2);
  text-align: center;
}
.empty-state .ficon {
  width: 32px;
  height: 32px;
  color: var(--f-text-3);
}

/* ---------------- Timeline / audit ---------------- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tl-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
}
.connector {
  width: 2px;
  background: var(--f-border);
}
.bubble {
  background: var(--f-bg-2);
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-m);
  padding: 8px 12px;
}

/* ---------------- Stepper / checklist ---------------- */
.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--f-bg-3);
  color: var(--f-text-2);
  font-size: 12px;
  font-weight: 600;
}
.step.done {
  background: var(--f-success-soft);
  color: var(--f-success);
}
.step.active {
  background: var(--f-brand);
  color: #fff;
}
.checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.checklist .check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
}
.checklist .check.ok {
  color: var(--f-success);
}
.checklist .check.warn {
  color: var(--f-warning);
}
.checklist-progress {
  width: 100%;
}
.progress {
  height: 4px;
  background: var(--f-bg-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--f-brand);
}

/* ---------------- Grille photos ---------------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.photo-card,
.photo-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-l);
  background: var(--f-white);
  overflow: hidden;
  box-shadow: var(--f-shadow-2);
}
.photo-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 150px;
  padding: 16px;
  border: 1px dashed var(--f-border-strong);
  border-radius: var(--f-radius-m);
  background: var(--f-bg-2);
  color: var(--f-text-2);
  cursor: pointer;
  text-align: center;
}
.photo-drop:hover {
  background: var(--f-brand-soft);
  border-color: var(--f-brand);
}
.photo-tile img,
.thumb img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}
.thumb {
  overflow: hidden;
  border-radius: var(--f-radius-m);
}
.photo-card .data {
  padding: 8px 10px;
}
.src {
  font-size: 11px;
  color: var(--f-text-2);
}

/* ---------------- Skeleton ---------------- */
.skeleton {
  background: linear-gradient(90deg, #f3f2f1 25%, #eaeaea 37%, #f3f2f1 63%);
  background-size: 400% 100%;
  animation: f-sk 1.4s ease infinite;
  border-radius: var(--f-radius-s);
  height: 16px;
}
@keyframes f-sk {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* ---------------- Bannières ---------------- */
.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--f-radius-m);
  border: 1px solid var(--f-border);
  background: var(--f-bg-2);
  font-size: 13px;
}
.banner.info {
  background: var(--f-info-soft);
  border-color: var(--f-brand-soft-2);
  color: var(--f-brand-pressed);
}
.banner.ok {
  background: var(--f-success-soft);
  border-color: #a7e3a3;
  color: #0b5a0b;
}
.banner.warn {
  background: var(--f-warning-soft);
  border-color: #f2d999;
  color: var(--f-warning);
}
.banner.error,
.banner.anomaly {
  background: var(--f-danger-soft);
  border-color: var(--f-border-strong);
  color: var(--f-danger);
}

/* ==========================================================================
   Layout applicatif
   ========================================================================== */
.layout {
  display: flex;
  min-height: 100vh;
  background: var(--f-bg);
}

/* Rail de navigation (bureau) */
.nav-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 68px;
  padding: 12px 8px;
  background: var(--f-white);
  border-right: 1px solid var(--f-border);
  position: sticky;
  top: 0;
  height: 100vh;
}
.nav-rail .rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 8px 4px;
  border: none;
  border-radius: var(--f-radius-m);
  background: transparent;
  color: var(--f-text-2);
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  position: relative;
}
.nav-rail .rail-item:hover {
  background: var(--f-bg-3);
}
.nav-rail .rail-item.active {
  background: var(--f-brand-soft);
  color: var(--f-brand);
  font-weight: 600;
}
.nav-rail .rail-item .ficon {
  width: 22px;
  height: 22px;
}
.rail-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border: none;
  border-radius: var(--f-radius-l);
  background: var(--f-brand);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--f-shadow-4);
}
.rail-fab:hover {
  background: var(--f-brand-hover);
}
.rail-spacer {
  flex: 1;
}
.nav-rail .rail-item.badge::after {
  content: attr(data-count);
  position: absolute;
  top: 4px;
  right: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--f-danger);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.top-app-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 16px;
  background: var(--f-white);
  border-bottom: 1px solid var(--f-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-app-bar .title {
  font-size: 17px;
  font-weight: 600;
}
.main-content {
  flex: 1;
  padding: 20px;
  max-width: 1160px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 860px) {
  .main-content {
    padding: 16px;
  }
}

/* Barre et tiroir (mobile) */
.nav-bar,
.drawer {
  display: none;
}
@media (max-width: 860px) {
  .nav-rail {
    display: none;
  }
  .nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    background: var(--f-white);
    border-top: 1px solid var(--f-border);
    z-index: 30;
    justify-content: center;
  }
  /* Le nombre d'onglets depend du role : on encapsule chaque moitie dans un
     conteneur flex:1 pour que le FAB "Nouvelle expertise" reste exactement au
     centre de la barre, quel que soit le nombre d'onglets a gauche/droite. */
  .navbar-side {
    display: flex;
    align-items: center;
    flex: 1 1 0;
    min-width: 0;
  }
  .navbar-center {
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .navbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border: none;
    background: transparent;
    color: var(--f-text-2);
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 2px;
    flex: 1 1 0;
    min-width: 0;
  }
  .navbar-item > span:last-child {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .navbar-item.active {
    color: var(--f-brand);
  }
  .navbar-item .pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 24px;
    border-radius: 999px;
  }
  .navbar-item.active .pill {
    background: var(--f-brand-soft);
  }
  .navbar-item .ficon {
    width: 20px;
    height: 20px;
  }
  .navbar-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 999px;
    background: var(--f-brand);
    color: #fff;
    cursor: pointer;
  }
  .drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
  }
  .drawer.open {
    pointer-events: auto;
  }
  .drawer .scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.16s ease;
  }
  .drawer.open .scrim {
    opacity: 1;
  }
  .drawer .panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    background: var(--f-white);
    border-right: 1px solid var(--f-border);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    overflow-y: auto;
  }
  .drawer.open .panel {
    transform: none;
  }
  .drawer .head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px 16px;
  }
  .drawer .brand {
    font-weight: 600;
  }
  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--f-text);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
  }
  .nav-item:hover,
  .nav-item.active {
    background: var(--f-bg-3);
  }
  .main-content {
    padding-bottom: 72px;
  }
}

/* ---------------- Dialogue / feuille ---------------- */
.dialog-scrim,
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 16px;
}
.dialog {
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow: auto;
  background: var(--f-white);
  border-radius: var(--f-radius-xl);
  box-shadow: var(--f-shadow-16);
  padding: 20px;
  animation: f-pop 0.12s ease;
}
@keyframes f-pop {
  from {
    transform: scale(0.97);
    opacity: 0;
  }
}
.dialog.danger {
  border-top: 4px solid var(--f-danger);
}
.d-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}
.d-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.d-text {
  color: var(--f-text-2);
  font-size: 14px;
}
.d-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.sheet-scrim {
  align-items: flex-end;
  padding: 0;
}
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: auto;
  background: var(--f-white);
  border-radius: var(--f-radius-xl) var(--f-radius-xl) 0 0;
  box-shadow: var(--f-shadow-16);
  padding: 16px 20px 24px;
  margin: 0 auto;
}
.sheet .handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--f-border-strong);
  margin: 0 auto 16px;
}

/* ---------------- Snackbar ---------------- */
#snackbar-root {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 560px;
  pointer-events: none;
}
.snackbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--f-radius-l);
  background: #242424;
  color: #fff;
  font-size: 14px;
  box-shadow: var(--f-shadow-16);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}
.snackbar.error {
  background: var(--f-danger);
}
.snackbar .action {
  appearance: none;
  border: none;
  background: transparent;
  color: #8ec8ff;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* ---------------- Page de connexion ---------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--f-white);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--f-white);
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-xl);
  box-shadow: var(--f-shadow-8);
  padding: 32px 28px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.login-brand .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--f-radius-l);
  background: var(--f-brand);
  color: #fff;
}
.l-title {
  font-size: 20px;
  font-weight: 600;
}
.l-sub {
  font-size: 12px;
  color: var(--f-text-2);
}

/* ---------------- Divers ---------------- */
.segmented {
  display: inline-flex;
  border: 1px solid var(--f-border-strong);
  border-radius: var(--f-radius-s);
  overflow: hidden;
}
.segment,
.stab {
  appearance: none;
  border: none;
  background: var(--f-white);
  color: var(--f-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  border-right: 1px solid var(--f-border);
}
.segment:last-child,
.stab:last-child {
  border-right: none;
}
.segment.selected,
.stab.selected {
  background: var(--f-brand-soft);
  color: var(--f-brand);
}
.val {
  font-weight: 600;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
}
.avatar-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--f-brand-soft);
  color: var(--f-brand);
  font-size: 12px;
  font-weight: 600;
}

/* ======================================================================
   Filet 2.0 — Design refresh
   Échelle, espacement, cohérence. Ajouté après le thème de base.
   ====================================================================== */

:root {
  /* Échelle d'espacement (pas de 4px) */
  --f-s1: 4px;
  --f-s2: 8px;
  --f-s3: 12px;
  --f-s4: 16px;
  --f-s5: 20px;
  --f-s6: 24px;
  --f-s7: 32px;
  --f-s8: 40px;
  /* Échelle typographique réduite */
  --f-fs-xs: 12px;
  --f-fs-sm: 13px;
  --f-fs-md: 14px;
  --f-fs-lg: 16px;
  --f-fs-xl: 20px;
  --f-fs-xxl: 28px;
}

/* ---------- Rythme d'espacement ---------- */
.grid { gap: var(--f-s4); }
.stat-grid { gap: var(--f-s4); }
.row, .row-between { gap: var(--f-s3); }
.col { gap: var(--f-s4); }

.section {
  display: flex;
  align-items: center;
  gap: var(--f-s3);
  margin: var(--f-s7) 0 var(--f-s4);
}
.section h2 {
  flex: 1;
  font-size: var(--f-fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section .sub { color: var(--f-text-2); font-size: var(--f-fs-sm); }

/* ---------- Cartes : bordure OU ombre, jamais les deux ---------- */
.card {
  padding: var(--f-s4);
  border: 1px solid var(--f-border);
  box-shadow: none;
}
.card.outlined { background: var(--f-bg-2); }
.card.clickable { cursor: pointer; transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease; }
.card.clickable:hover { border-color: var(--f-brand); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); transform: translateY(-1px); }
.card.clickable .card-title { margin-bottom: 0; }

/* ---------- Cartes statistiques (mise en page verticale) ---------- */
.stat-card {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--f-s2);
  border: 1px solid var(--f-border);
  box-shadow: none;
  min-width: 0;
}
.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--f-radius-s);
  background: var(--f-bg-3);
  color: var(--f-text-2);
}
.stat-card .stat-value {
  font-size: var(--f-fs-xxl);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.stat-card .stat-label {
  font-size: var(--f-fs-sm);
  line-height: 1.35;
  min-height: 34px;
}
.stat-card.today { background: var(--f-brand-soft); border-color: var(--f-brand-soft-2); }
.stat-card.today .stat-icon { background: var(--f-white); color: var(--f-brand); }
.stat-card.today .stat-label { color: var(--f-brand-pressed); }
.stat-card.pending { background: var(--f-warning-soft); border-color: #f2d999; }
.stat-card.pending .stat-icon { background: var(--f-white); color: var(--f-warning); }
.stat-card.pending .stat-value,
.stat-card.pending .stat-label { color: var(--f-warning); }
.stat-card.returned { background: var(--f-danger-soft); border-color: var(--f-border-strong); }
.stat-card.returned .stat-icon { background: var(--f-white); color: var(--f-danger); }
.stat-card.returned .stat-value,
.stat-card.returned .stat-label { color: var(--f-danger); }
.stat-card.valid { background: var(--f-success-soft); border-color: #a7e3a3; }
.stat-card.valid .stat-icon { background: var(--f-white); color: var(--f-success); }
.stat-card.valid .stat-value,
.stat-card.valid .stat-label { color: #0b5a0b; }

/* ---------- Chips/filtres cliquables ---------- */
.chip { cursor: pointer; border: 1px solid transparent; transition: background 0.12s ease, border-color 0.12s ease; }
.chip:hover { background: var(--f-brand-soft); color: var(--f-brand); }
.chip.selected { background: var(--f-brand); color: #fff; }
.chip.selected:hover { background: var(--f-brand-hover); }
.status-chip { border: 1px solid transparent; }

/* ---------- Cases à cocher (liste de contrôle) ---------- */
.checklist .check input[type='checkbox'] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--f-brand);
}
.checklist .check .box { display: none; }
.stab { background: transparent; border: none; padding: 0; min-width: 0; }
.stab.ok { color: var(--f-success); }
.stab.warn { color: var(--f-warning); }

/* ---------- Progression : prend en charge <div class="bar"> ---------- */
.progress .bar { display: block; height: 100%; border-radius: 999px; background: var(--f-brand); }

/* ---------- Lignes de listes riches ---------- */
.l-title { font-weight: 600; font-size: var(--f-fs-md); }
.l-sub { font-size: var(--f-fs-xs); color: var(--f-text-2); }
.l-actions { margin-left: auto; display: flex; flex-direction: row; align-items: center; gap: var(--f-s1); flex-shrink: 0; }
.list-item { gap: var(--f-s3); }

/* ---------- Photos : vignettes carrées ---------- */
.photo-grid { gap: var(--f-s3); }
img.thumb {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 0;
}
.photo-tile { border: 1px solid var(--f-border); box-shadow: none; }
.photo-tile { aspect-ratio: 1 / 1; }
.photo-tile img, .photo-tile .thumb img { height: 100%; }
.photo-tile .badge {
  position: absolute;
  left: var(--f-s2);
  bottom: var(--f-s2);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(36, 36, 36, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Bandeau VIN + historique (chronologie) ---------- */
.vin-badge {
  display: flex;
  align-items: center;
  gap: var(--f-s3);
  padding: var(--f-s3) var(--f-s4);
  border-radius: var(--f-radius-m);
  font-weight: 600;
  font-size: var(--f-fs-md);
}
.vin-badge.ok { background: var(--f-success-soft); color: #0b5a0b; border: 1px solid #a7e3a3; }
.vin-badge.warn { background: var(--f-warning-soft); color: var(--f-warning); border: 1px solid #f2d999; }
.vin-badge.info { background: var(--f-brand-soft); color: var(--f-brand-pressed); border: 1px solid var(--f-brand-soft-2); }

.timeline { position: relative; padding-left: var(--f-s5); }
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--f-border);
  border-radius: 2px;
}
.tl-item { position: relative; padding: 6px 0; }
.tl-item::before {
  content: '';
  position: absolute;
  left: calc(var(--f-s5) * -1 + 4px);
  top: 14px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--f-brand);
}
.tl-item .t-title { font-size: var(--f-fs-sm); font-weight: 600; }
.tl-item .t-sub { font-size: var(--f-fs-xs); color: var(--f-text-2); }

/* ---------- Sources du VIN (lignes bordées) ---------- */
.vin-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--f-s3);
  padding: 10px 12px;
  border: 1px solid var(--f-border);
  border-radius: var(--f-radius-m);
  background: var(--f-bg-2);
}
.vin-source .src { display: flex; align-items: center; gap: var(--f-s2); font-weight: 600; font-size: var(--f-fs-sm); }
.vin-source .val { font-weight: 600; font-size: var(--f-fs-sm); font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace; }

/* ---------- Tables : plus d'air + actions alignées ---------- */
.table-wrap tbody td { padding: 12px 14px; }
.table-wrap tbody tr { transition: background 0.1s ease; }
.table-wrap td.row { gap: var(--f-s1); white-space: nowrap; }

/* ---------- Tête de dossier (chips/labels regroupés) ---------- */
.ficon { flex-shrink: 0; }
.muted .ficon, .small .ficon { vertical-align: -3px; }

/* ---------- Légers raffinements de confort visuel ---------- */
.card-title { margin-bottom: 0; }
.card { display: flex; flex-direction: column; gap: var(--f-s3); }
.card > .mt, .card > .mt-s { margin-top: 0; }
.dialog { max-width: 520px; }
.banner { line-height: 1.4; }
.banner .ficon { margin-top: 1px; }

/* ---------- Compacts sur mobile ---------- */
@media (max-width: 860px) {
  .stat-card .stat-label { min-height: 0; }
  .main-content { padding: var(--f-s4) var(--f-s4) 96px; }
}

/* ==========================================================================
   Revue de dossier — ajustements de taille uniquement (pas de changement de design)
   ========================================================================== */
.review .section { margin: 16px 0 8px; }

.review .list.review-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 28px;
}
.review .list.review-2col .list-item { padding: 8px 12px; }
@media (max-width: 760px) {
  .review .list.review-2col { grid-template-columns: 1fr; }
}

@media (max-width: 599px) {
  .review .list-item {
    flex-wrap: wrap;
    gap: 8px;
  }
  .review .list-item > span:first-child {
    min-width: 120px !important;
  }
  .review .list-item .grow.bold {
    flex: 1 1 calc(100% - 120px);
    min-width: 0;
    overflow-x: auto;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: break-all;
  }
  .review .grid.grid-2 {
    grid-template-columns: 1fr;
  }
  .review .photo-grid.tight {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }
}

.review .photo-grid.tight {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.review .photo-grid.tight .photo-tile { aspect-ratio: 1 / 1; }
.review .photo-grid.tight .photo-tile img {
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   Assistants Expertise — responsive (agencements et tailles uniquement)
   ========================================================================== */
@media (max-width: 860px) {
  #wizard-root .stepper {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  #wizard-root .stepper::-webkit-scrollbar { display: none; }
  #wizard-root .step { flex: 0 0 auto; white-space: nowrap; padding: 4px 12px; }
  /* Précédent / Suivant toujours accessibles au-dessus de la barre mobile */
  #wizard-root .row-between.mt {
    position: sticky;
    bottom: 64px;
    z-index: 15;
    flex-wrap: wrap;
    background: var(--f-white);
    border: 1px solid var(--f-border);
    border-radius: var(--f-radius-l);
    box-shadow: var(--f-shadow-4);
    padding: 8px 12px;
    margin-top: var(--f-s4);
  }
}

@media (max-width: 720px) {
  #wizard-root .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #wizard-root img.thumb,
  #wizard-root .thumb img { height: 120px; }
  #wizard-root .photo-card .row-between,
  #wizard-root .card > .row-between,
  #wizard-root .row-between.mt { flex-wrap: wrap; }
  #wizard-root .list-item { flex-wrap: wrap; }
  #wizard-root .list-item .mono,
  #wizard-root .list-item .grow { min-width: 0; word-break: break-word; }
  #wizard-root .field .row-between { flex-wrap: wrap; gap: 4px; }
}

/* ==========================================================================
   Responsive — corrections de mise en page (containers, débordements,
   coupures de contenu) sur toutes les tailles.
   ========================================================================== */

@media (max-width: 860px) {
  /* Snackbar : remonter au-dessus de la barre de navigation mobile */
  #snackbar-root {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
  }
  /* Barre de navigation : tenir compte de l'encoche des téléphones */
  .nav-bar {
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .banner {
    align-items: flex-start;
  }
}

@media (max-width: 860px) {
  /* Source du VIN (carte grise / VIN frappé / plaque) : la valeur passe en
     pleine largeur (sur sa propre ligne) pour afficher les 17 caractères
     et pouvoir les modifier sur téléphone/tablette. */
  .list-item.vin-row {
    flex-wrap: wrap;
  }
  .list-item.vin-row .sel-input.mono.grow,
  .list-item.vin-row .mono.val.grow {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 720px) {
  /* Onglets Admin : défilement horizontal au lieu du débordement */
  .segmented {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .segmented .segment {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Lignes de liste : autoriser le passage à la ligne et la coupure des valeurs longues */
  .list-item {
    flex-wrap: wrap;
  }
  .list-item > .grow,
  .list-item .grow,
  .mono-val {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Lectures VIN : valeur mono longue, coupée proprement */
  .vin-source {
    flex-wrap: wrap;
  }
  .vin-source .src {
    min-width: 0;
  }
  .vin-source .val {
    min-width: 0;
    word-break: break-all;
  }

  /* Bandeau VIN : ne jamais déborder de la carte */
  .vin-badge {
    flex-wrap: wrap;
  }
  .vin-badge > span {
    min-width: 0;
    word-break: break-word;
  }

  /* En-têtes de section avec bouton d'action : passer à la ligne si besoin */
  .section {
    flex-wrap: wrap;
  }

  /* Cartes statistiques : colonnes moins larges sur mobile */
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (max-width: 599px) {
  /* Réduire les marges/paddings sur mobile */
  .main-content {
    padding-left: 12px;
    padding-right: 12px;
  }
  .login-page {
    padding: 16px 12px;
  }
  .login-card {
    padding: 24px 16px;
  }
  .dialog {
    padding: 16px;
  }
  .top-app-bar {
    padding: 0 8px;
  }
  .top-app-bar .title {
    font-size: 15px;
  }
  .field .row-between {
    flex-wrap: wrap;
    gap: 4px;
  }
}

@media (max-width: 420px) {
  /* Grille photos de l'assistant : une seule colonne sur petits téléphones */
  #wizard-root .photo-grid {
    grid-template-columns: 1fr;
  }
}



/* Payment page styles */
.stat-card { display:flex; flex-direction:column; align-items:flex-start; gap:6px; padding:18px 20px; }
.stat-icon { font-size:28px; color:var(--md-primary,#0f6cbd); opacity:.85; }
.stat-value { font-size:22px; font-weight:700; line-height:1.1; color:var(--f-text); }
.stat-label { font-size:12px; color:var(--f-text-3); font-weight:500; text-transform:uppercase; letter-spacing:.04em; }
.stat-paid .stat-value { color:var(--f-success,#107c10); }
.stat-unpaid .stat-value { color:var(--f-danger,#a4262c); }
.t-right { text-align:right; }
.t-center { text-align:center; }
#expertise-payment-card, #payment-card { border-left:4px solid var(--md-primary,#0f6cbd); }
