/* ACTUARUS — composants réutilisables. */

/* ---------- Icônes ---------- */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: var(--text-md); font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--bg-surface); color: var(--fg-1);
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1), box-shadow var(--dur-1), color var(--dur-1);
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--btn-primary); color: var(--fg-on-brand); }
.btn-primary:hover:not([disabled]) { background: var(--btn-primary-hover); }
.btn-primary:active:not([disabled]) { background: var(--btn-primary-active); }
.btn-secondary { border-color: var(--border-1); background: var(--bg-surface); color: var(--fg-1); }
.btn-secondary:hover:not([disabled]) { border-color: var(--border-strong); background: var(--bg-surface-2); }
.btn-danger-outline { border-color: var(--red-100); color: var(--red-700); background: var(--bg-surface); }
.btn-danger-outline:hover:not([disabled]) { background: var(--red-50); border-color: var(--red-500); }
.btn-danger-outline:focus-visible { box-shadow: var(--shadow-focus-danger); }
.btn-danger { background: var(--red-500); color: #fff; }
.btn-danger:hover:not([disabled]) { background: var(--red-700); }
.btn-ghost { background: transparent; color: var(--fg-2); }
.btn-ghost:hover:not([disabled]) { background: var(--bg-surface-2); color: var(--fg-1); }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-sm); }
.btn-lg { min-height: 48px; padding: 0 var(--space-6); font-size: var(--text-lg); }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }
.btn[aria-busy="true"] { cursor: progress; }

.link-back {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: var(--fg-2); font-size: var(--text-md); background: none; border: 0; padding: 0;
}
.link-back:hover { color: var(--fg-1); text-decoration: none; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-label { font-size: var(--text-sm); font-weight: 500; color: var(--fg-2); }
.field-label .req { color: var(--red-700); margin-left: 2px; }
.field-hint { font-size: var(--text-sm); color: var(--fg-3); }
.field-error { font-size: var(--text-sm); color: var(--red-700); display: flex; gap: var(--space-1); align-items: flex-start; }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--border-1); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--fg-1);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.textarea { min-height: 110px; resize: vertical; line-height: var(--leading-normal); }
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--shadow-focus); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--red-500); }
.input[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus { box-shadow: var(--shadow-focus-danger); }
.input[readonly], .textarea[readonly] { background: var(--bg-surface-2); color: var(--fg-2); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 64px; }
.input-group .input-suffix { position: absolute; right: 12px; color: var(--fg-3); font-size: var(--text-sm); font-family: var(--font-mono); pointer-events: none; }
.input-group .input-prefix-icon { position: absolute; left: 12px; color: var(--fg-3); pointer-events: none; }
.input-group .input.has-prefix { padding-left: 38px; padding-right: 12px; }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* Contrôle segmenté (« Je suis acheteur / vendeur ») */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--bg-surface-2); flex-wrap: wrap; }
.segmented button {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: 34px; padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-xs); background: transparent; color: var(--fg-2); font-weight: 500;
}
.segmented button[aria-pressed="true"], .segmented button[aria-checked="true"] { background: var(--bg-surface); color: var(--fg-1); box-shadow: var(--shadow-1); }
.segmented button:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* Cartes d'options (méthode de paiement, décision d'arbitrage) */
.option-card {
  display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left;
  padding: var(--space-3) var(--space-4); border: 1px solid var(--border-1); border-radius: var(--radius-md);
  background: var(--bg-surface); color: var(--fg-1);
}
.option-card:hover:not([disabled]) { border-color: var(--border-strong); background: var(--bg-surface-2); }
.option-card[aria-checked="true"], .option-card[aria-pressed="true"] { border-color: var(--navy-500); box-shadow: var(--shadow-focus); }
.option-card:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.option-card .option-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-surface-2); color: var(--fg-2); flex: none; }
.option-card .option-title { font-weight: 600; }
.option-card .option-sub { font-size: var(--text-sm); color: var(--fg-3); }

/* ---------- Puces de filtre ---------- */
.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: 34px; padding: 0 var(--space-4);
  border: 1px solid var(--border-1); border-radius: var(--radius-pill); background: var(--bg-surface); color: var(--fg-2); font-size: var(--text-md);
}
.chip:hover { border-color: var(--border-strong); color: var(--fg-1); }
.chip[aria-pressed="true"] { background: var(--chip-active-bg); border-color: var(--chip-active-bg); color: var(--chip-active-fg); }
.chip .count { font-family: var(--font-mono); font-size: var(--text-xs); padding: 1px 7px; border-radius: var(--radius-pill); background: var(--bg-surface-2); color: var(--fg-2); }
.chip[aria-pressed="true"] .count { background: rgba(255, 255, 255, 0.2); color: inherit; }
.chip:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ---------- Badges de statut ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: var(--text-sm); font-weight: 500; white-space: nowrap; background: var(--slate-50); color: var(--slate-700);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-plain::before { display: none; }
.tone-neutral { background: var(--slate-50); color: var(--slate-700); }
.tone-info { background: var(--navy-50); color: var(--navy-600); }
.tone-warning { background: var(--amber-50); color: var(--amber-700); }
.tone-violet { background: var(--violet-50); color: var(--violet-700); }
.tone-danger { background: var(--red-50); color: var(--red-700); }
.tone-success { background: var(--teal-50); color: var(--teal-700); }
:root[data-theme="dark"] .tone-info { color: var(--navy-700); }

.ref-tag { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--fg-3); background: var(--bg-surface-2); border-radius: var(--radius-xs); padding: 2px 6px; white-space: nowrap; }
.count-pill { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; min-width: 20px; padding: 1px 6px; border-radius: var(--radius-pill); background: var(--navy-100); color: var(--navy-600); text-align: center; }
:root[data-theme="dark"] .count-pill { color: var(--navy-700); }

/* ---------- Avatar ---------- */
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--navy-100); color: var(--navy-600); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.02em;
}
:root[data-theme="dark"] .avatar { color: var(--navy-700); }
.avatar-md { width: 36px; height: 36px; font-size: var(--text-sm); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-md); }
.person { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
.person-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Cartes et panneaux ---------- */
.card { background: var(--bg-surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.card-body { padding: var(--space-6); }
.card-head { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-5) var(--space-6) 0; }
.card-head-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--bg-surface-2); color: var(--fg-2); flex: none; }
.card-title { font-size: var(--text-lg); font-weight: 600; }
.card-sub { font-size: var(--text-sm); color: var(--fg-3); }
@media (max-width: 640px) { .card-body { padding: var(--space-4); } .card-head { padding: var(--space-4) var(--space-4) 0; } }

/* Panneau d'étape teinté (garantie, litige, action attendue) */
.panel { border-radius: var(--radius-lg); border: 1px solid var(--border-2); background: var(--bg-surface); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-6); font-weight: 600; flex-wrap: wrap; }
.panel-head .row { gap: var(--space-2); }
.panel-body { padding: var(--space-5) var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.panel-violet { border-color: var(--violet-100); }
.panel-violet .panel-head { background: var(--violet-50); color: var(--violet-700); }
.panel-danger { border-color: var(--red-100); }
.panel-danger .panel-head { background: var(--red-50); color: var(--red-700); }
.panel-info { border-color: var(--navy-100); }
.panel-info .panel-head { background: var(--navy-50); color: var(--navy-600); }
:root[data-theme="dark"] .panel-info .panel-head { color: var(--navy-700); }
.panel-warning { border-color: var(--amber-50); }
.panel-warning .panel-head { background: var(--amber-50); color: var(--amber-700); }
.panel-success { border-color: var(--teal-50); }
.panel-success .panel-head { background: var(--teal-50); color: var(--teal-700); }
.panel-neutral .panel-head { background: var(--bg-surface-2); color: var(--fg-1); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 500; }
.status-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
@media (max-width: 640px) { .panel-head, .panel-body { padding-left: var(--space-4); padding-right: var(--space-4); } }

/* Compte à rebours (garantie) */
.countdown { display: grid; place-items: center; align-content: center; gap: var(--space-1); text-align: center; padding: var(--space-5) var(--space-6); border-radius: var(--radius-md); background: var(--violet-50); color: var(--violet-700); border: 1px solid var(--violet-100); min-width: 190px; min-height: 92px; }
.countdown-value { font-family: var(--font-mono); font-size: var(--text-amount-xl); font-weight: 500; letter-spacing: 0.02em; line-height: 1.1; white-space: nowrap; }
.countdown-label { font-size: var(--text-sm); color: var(--violet-600, var(--violet-700)); }

/* Liste clé / valeur */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-6); align-items: baseline; }
.kv dt { font-size: var(--text-sm); color: var(--fg-3); }
.kv dd { color: var(--fg-1); overflow-wrap: anywhere; }
.kv-boxed { padding: var(--space-4) var(--space-5); background: var(--bg-surface-2); border-radius: var(--radius-md); }
.kv-boxed.kv-right dd { text-align: right; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: var(--space-2); } .kv-boxed.kv-right dd { text-align: left; } }

/* Récapitulatif de montants */
.summary { background: var(--bg-surface-2); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.summary-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); }
.summary-row .label { font-weight: 500; }
.summary-row .sub { font-size: var(--text-sm); color: var(--fg-3); }
.summary-row .value { font-family: var(--font-mono); white-space: nowrap; }
.summary-row.secured .label, .summary-row.secured .value { color: var(--violet-700); }
.summary-total { border-top: 1px solid var(--border-1); padding-top: var(--space-3); }
.summary-total .label { font-weight: 600; }
.summary-total .value { font-size: var(--text-amount); }

/* Méta-informations d'en-tête de deal */
.meta-grid { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-10); }
.meta-item { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.meta-label { font-size: var(--text-sm); color: var(--fg-3); }
.meta-value { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-md); }

/* ---------- Tableau ---------- */
.table-wrap { background: var(--bg-surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.table th { text-align: left; font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--fg-3); padding: var(--space-3) var(--space-5); background: var(--bg-surface); border-bottom: 1px solid var(--border-2); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.table th button:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.table td { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-link { cursor: pointer; transition: background var(--dur-1); }
.table tbody tr.is-link:hover { background: var(--bg-surface-2); }
.table .cell-title { font-weight: 600; color: var(--fg-1); }
.table .cell-sub { font-size: var(--text-sm); color: var(--fg-3); margin-top: 2px; }
.table .cell-chevron { width: 40px; color: var(--fg-4); }
.cell-hint { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); white-space: nowrap; margin-top: 2px; }

/* Liste en cartes (mobile / tablette) */
.card-list { display: flex; flex-direction: column; gap: var(--space-3); }
.list-card { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--bg-surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg); color: inherit; box-shadow: var(--shadow-1); }
.list-card:hover { text-decoration: none; border-color: var(--border-strong); }
.list-card:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* ---------- Étapes (assistant) ---------- */
.stepper { display: flex; align-items: center; gap: var(--space-3); }
.stepper li { display: flex; align-items: center; gap: var(--space-3); flex: 1 1 0; min-width: 0; color: var(--fg-2); }
.stepper li:last-child { flex: 0 0 auto; }
.stepper li::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--border-1); min-width: 16px; }
.stepper li:last-child::after { display: none; }
.stepper .step-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 1px solid var(--border-1); background: var(--bg-surface); font-size: var(--text-sm); font-family: var(--font-mono); color: var(--fg-2); }
.stepper .step-label { white-space: nowrap; }
.stepper li[aria-current="step"] { color: var(--fg-1); font-weight: 600; }
.stepper li[aria-current="step"] .step-num { background: var(--btn-primary); border-color: var(--btn-primary); color: #fff; }
.stepper li.is-done .step-num { background: var(--teal-50); border-color: var(--teal-500); color: var(--teal-700); }
@media (max-width: 640px) { .stepper .step-label { display: none; } .stepper li[aria-current="step"] .step-label { display: inline; } }

/* Progression (chronologie verticale) */
.progress-list { display: flex; flex-direction: column; }
.progress-item { position: relative; display: grid; grid-template-columns: 24px 1fr auto; gap: var(--space-3); padding-bottom: var(--space-5); }
.progress-item:last-child { padding-bottom: 0; }
.progress-item::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--border-2); }
.progress-item:last-child::before { display: none; }
.progress-item.is-done::before { background: var(--teal-500); }
.progress-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-surface); border: 2px solid var(--border-1); color: #fff; }
.progress-item.is-done .progress-dot { background: var(--teal-500); border-color: var(--teal-500); }
.progress-item.is-current .progress-dot { border-color: var(--navy-500); box-shadow: var(--shadow-focus); }
.progress-item.is-danger .progress-dot { background: var(--red-500); border-color: var(--red-500); }
.progress-title { font-weight: 600; }
.progress-sub { font-size: var(--text-sm); color: var(--fg-3); }
.progress-date { font-size: var(--text-sm); color: var(--fg-3); white-space: nowrap; }

/* ---------- Alertes / encarts ---------- */
.callout { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4); border-radius: var(--radius-md); background: var(--navy-50); color: var(--fg-1); border: 1px solid var(--navy-100); font-size: var(--text-md); }
.callout .icon { color: var(--navy-500); margin-top: 2px; }
.callout-warning { background: var(--amber-50); border-color: var(--amber-50); }
.callout-warning .icon { color: var(--amber-700); }
.callout-danger { background: var(--red-50); border-color: var(--red-100); }
.callout-danger .icon { color: var(--red-700); }
.callout-success { background: var(--teal-50); border-color: var(--teal-50); }
.callout-success .icon { color: var(--teal-700); }
.callout-quote { border: 0; border-left: 3px solid var(--red-500); border-radius: var(--radius-xs); background: var(--bg-surface-2); }
.callout strong { font-weight: 600; }

.banner-inverse { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); background: var(--bg-inverse); color: var(--fg-inverse); font-size: var(--text-md); flex-wrap: wrap; }
.banner-inverse strong { font-weight: 600; }
.banner-inverse .text-muted { color: inherit; opacity: 0.7; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--border-2); overflow-x: auto; scrollbar-width: none; }
.tabs [role="tab"] { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-3) 2px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--fg-2); font-weight: 500; white-space: nowrap; }
.tabs [role="tab"][aria-selected="true"] { color: var(--navy-600); border-bottom-color: var(--navy-500); }
:root[data-theme="dark"] .tabs [role="tab"][aria-selected="true"] { color: var(--navy-700); }
.tabs [role="tab"]:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-xs); }

/* ---------- États : chargement, vide, erreur ---------- */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--bg-surface-2) 0%, var(--bg-surface-3) 50%, var(--bg-surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-line { height: 14px; }
.skeleton-block { height: 120px; }
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-12) var(--space-6); color: var(--fg-2); }
.state-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-surface-2); color: var(--fg-3); }
.state-title { font-weight: 600; color: var(--fg-1); font-size: var(--text-lg); }
.state.is-error .state-icon { background: var(--red-50); color: var(--red-700); }
.page-loading { display: grid; place-items: center; min-height: 50vh; color: var(--navy-500); }

/* ---------- Notifications (toasts) ---------- */
.toast-region { position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2); max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-3); animation: toast-in var(--dur-3) var(--ease-out); }
.toast .icon { margin-top: 2px; }
.toast-success .icon { color: var(--teal-500); }
.toast-error .icon { color: var(--red-500); }
.toast-info .icon { color: var(--navy-500); }
.toast-body { flex: 1; min-width: 0; font-size: var(--text-md); }
.toast-title { font-weight: 600; }
.toast-close { border: 0; background: none; color: var(--fg-3); padding: 2px; border-radius: var(--radius-xs); }
.toast-close:hover { color: var(--fg-1); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .toast-region { left: var(--space-4); right: var(--space-4); bottom: var(--space-4); max-width: none; } }

/* ---------- Fenêtre modale ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-overlay); background: var(--bg-overlay); display: grid; place-items: center; padding: var(--space-4); animation: fade-in var(--dur-2) var(--ease-out); }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--bg-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); display: flex; flex-direction: column; }
.modal-lg { width: min(720px, 100%); }
/* Signature électronique : document à signer dans une iframe, presque plein écran. */
.modal-signing { width: min(1040px, 100%); height: calc(100vh - 32px); }
.modal-signing .modal-body { flex: 1; min-height: 0; padding: 0 var(--space-4) var(--space-4); }
.signing-frame { flex: 1; width: 100%; min-height: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: #ffffff; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-6) var(--space-2); }
.modal-title { font-size: var(--text-xl); font-weight: 600; }
.modal-body { padding: var(--space-2) var(--space-6) var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-6) var(--space-5); flex-wrap: wrap; }
/* Panneau latéral (connexion d'un wallet) : à droite, pleine hauteur ; volet bas sur téléphone. */
.modal-backdrop:has(> .modal-drawer) { place-items: stretch end; padding: 0; }
.modal-drawer { width: min(420px, 100%); height: 100vh; max-height: 100vh; border-radius: var(--radius-lg) 0 0 var(--radius-lg); animation: drawer-in var(--dur-3) var(--ease-out); }
@keyframes drawer-in { from { transform: translateX(32px); } to { transform: none; } }
@keyframes sheet-in { from { transform: translateY(32px); } to { transform: none; } }
.wallet-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.wallet-option { width: 100%; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border-1); border-radius: var(--radius-md); background: var(--bg-surface); color: var(--fg-1); font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: border-color var(--dur-1), background var(--dur-1); }
.wallet-option:hover:not(:disabled) { border-color: var(--border-focus); background: var(--bg-surface-2); }
.wallet-option:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.wallet-option:disabled { opacity: .6; cursor: progress; }
.wallet-option img, .wallet-option-icon { width: 32px; height: 32px; flex: none; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--bg-surface-2); color: var(--fg-2); }
.wallet-option-name { flex: 1; font-weight: 600; }
.wallet-option-action { font-size: var(--text-sm); color: var(--navy-500); font-weight: 600; }
.wallet-address { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border: 1px solid var(--border-1); border-radius: var(--radius-md); background: var(--bg-surface-2); }
.wallet-address .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: var(--text-sm); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 640px) {
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal { width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-backdrop:has(> .modal-drawer) { place-items: end stretch; }
  .modal-drawer { height: auto; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; animation: sheet-in var(--dur-3) var(--ease-out); }
}

/* Menu déroulant */
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: var(--z-overlay); background: var(--bg-surface); border: 1px solid var(--border-2); border-radius: var(--radius-md); box-shadow: var(--shadow-2); padding: var(--space-1); }
.menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; padding: var(--space-2) var(--space-3); border: 0; background: none; border-radius: var(--radius-xs); color: var(--fg-1); text-align: left; font-size: var(--text-md); }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-surface-2); outline: none; text-decoration: none; }
.menu-item.is-danger { color: var(--red-700); }

/* Divers */
.divider { height: 1px; background: var(--border-2); border: 0; margin: 0; }
.dot-sep::before { content: "·"; margin: 0 6px; color: var(--fg-4); }
.notif-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red-500); border: 2px solid var(--bg-surface); }
.signature-pad { width: 100%; height: 180px; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); background: #ffffff; touch-action: none; cursor: crosshair; }
.rating-input { display: flex; align-items: center; gap: var(--space-3); }
.rating-input input[type="range"] { flex: 1; accent-color: var(--navy-500); }
.copy-field { display: flex; gap: var(--space-2); }
.copy-field .input { font-family: var(--font-mono); font-size: var(--text-sm); }

/* Case à cocher avec libellé (acceptation d'un contrat). */
.check-row { display: flex; gap: var(--space-3); align-items: flex-start; font-size: var(--text-sm); color: var(--fg-2); line-height: 1.5; cursor: pointer; }
.check-row input { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--navy-500); cursor: pointer; }

/* Période de garantie : durée proposée, ou durée personnalisée (nombre + unité). */
.guarantee-picker { display: flex; flex-direction: column; gap: var(--space-2); }
.guarantee-custom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(7rem, auto); gap: var(--space-2); }
.guarantee-custom[hidden] { display: none; }
