/* ============================================================
   COMPONENTS.CSS — Diill Design System v5
   Tous les composants UI réutilisables
   Dépend de : tokens.css + base.css
   ============================================================ */

/* ============================================================
   CARTE ASSURANCE — Design B (icône + score ring + stats)
   ============================================================ */
.carte-assurance {
  background: var(--color-bg-card);
  border-radius: var(--radius-xl);
  border: 0.5px solid var(--color-border-default);
  overflow: hidden;
  transition: var(--transition-base);
  margin-bottom: var(--space-3);
}
.carte-assurance:hover {
  border-color: var(--color-border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Header : icone + info + ring */
.carte-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
  cursor: pointer;
}
.carte-type-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.carte-header-info { flex: 1; min-width: 0; }
.carte-nom {
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -.1px;
}
.carte-num-contrat {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: 1px;
  letter-spacing: .01em;
}
.carte-assureur-sub { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 1px; }

/* Score ring SVG */
.carte-score-ring {
  width: 44px; height: 44px;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.carte-score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.carte-score-letter { font-size: var(--text-base); font-weight: var(--fw-bold); line-height: 1; z-index: 1; }

/* Grille stats 3 colonnes */
.carte-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-3);
  cursor: pointer;
}
.carte-stat {
  background: var(--color-stat-bg);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-2);
  text-align: center;
}
.carte-stat-val {
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
  letter-spacing: -.2px;
  line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.carte-stat-label {
  font-size: .6rem;
  font-weight: var(--fw-bold);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 3px;
}

/* Tags */
.carte-tags {
  display: flex; gap: var(--space-1); flex-wrap: wrap;
  padding: 0 var(--space-4) var(--space-3);
  cursor: pointer;
}
.carte-tag {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.tag-default { background: var(--color-bg-sunken); color: var(--color-text-muted); border: 0.5px solid var(--color-border-default); }
.tag-green   { background: var(--color-success-dim); color: var(--color-brand-dark); }
.tag-amber   { background: var(--color-warning-dim); color: var(--color-warning); }
.tag-red     { background: var(--color-danger-dim);  color: var(--color-danger); }
.tag-blue    { background: var(--color-info-dim);    color: var(--color-info); }
.tag-purple  { background: var(--color-purple-dim);  color: var(--color-purple); }

/* Footer boutons */
.carte-footer {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-4);
  align-items: stretch;
}
.carte-footer-sep { display: none; }

.carte-footer-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  transition: var(--transition-base);
  border-radius: var(--radius-md);
  letter-spacing: -.05px;
}
.carte-footer-btn:active { transform: scale(.97); }

.carte-footer-btn-reneg {
  flex: 1;
  background: var(--color-brand);
  color: var(--color-text-on-brand);
}
.carte-footer-btn-reneg:hover { opacity: .88; }

.carte-footer-btn-offre {
  flex: 1;
  background: transparent;
  color: var(--color-brand);
  border: 1.5px solid var(--color-brand);
}
.carte-footer-btn-offre:hover { background: var(--color-brand-dim); }

.carte-footer-btn-acceptee {
  flex: 1;
  background: transparent;
  color: var(--color-brand);
  border: 1.5px solid rgba(0,200,150,.35);
}
.carte-footer-btn-acceptee:hover { background: var(--color-brand-dim); }

.carte-footer-btn-encours {
  flex: 1;
  background: transparent;
  color: var(--color-warning);
  border: 1.5px solid rgba(245,166,35,.35);
}
.carte-footer-btn-encours:hover { background: var(--color-warning-dim); }

.carte-footer-btn-voir {
  background: var(--color-bg-sunken);
  color: var(--color-text-primary);
  padding: var(--space-3) var(--space-4);
  flex: 0 0 auto;
  border: 0.5px solid var(--color-border-default);
}
.carte-footer-btn-voir:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-strong);
}

/* ── Scores (classes CSS dépendantes du JS SCORE_CONFIG) ── */
.carte-score-a { background: var(--score-a-bg); color: var(--score-a-text); }
.carte-score-b { background: var(--score-b-bg); color: var(--score-b-text); }
.carte-score-c { background: var(--score-c-bg); color: var(--score-c-text); }
.carte-score-d { background: var(--score-d-bg); color: var(--score-d-text); }
.carte-score-f { background: var(--score-f-bg); color: var(--score-f-text); }

/* ============================================================
   FILTRES & TRIS
   ============================================================ */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  border: 0.5px solid var(--color-border-default);
}
.filter-search {
  flex: 1;
  min-width: 140px;
  background: var(--color-bg-sunken);
  border: 0.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  outline: none;
  transition: var(--transition-base);
  font-family: var(--font-sans);
}
.filter-search::placeholder { color: var(--color-text-faint); }
.filter-search:focus { border-color: var(--color-brand-dark); box-shadow: 0 0 0 3px var(--color-brand-dim); }
.filter-sep { width: 1px; height: 20px; background: var(--color-border-default); flex-shrink: 0; }
.filter-chip {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 0.5px solid var(--color-border-strong);
  background: var(--color-bg-sunken);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
  font-family: var(--font-sans);
}
.filter-chip:hover { color: var(--color-text-primary); border-color: var(--color-border-strong); }
.filter-chip.actif { background: var(--color-brand-dark); color: var(--color-text-on-brand); border-color: var(--color-brand-dark); }
.filter-chip.actif-blue  { background: var(--color-info-dim);    color: var(--color-info);    border-color: rgba(77,158,255,.3); }
.filter-chip.actif-amber { background: var(--color-warning-dim); color: var(--color-warning); border-color: rgba(245,166,35,.3); }
.filter-sort {
  background: var(--color-bg-sunken);
  border: 0.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  outline: none;
  cursor: pointer;
  font-family: var(--font-sans);
}
.filter-sort option { background: var(--color-bg-card); }
.filter-sort:focus { border-color: var(--color-brand-dark); }
.filter-count { font-size: var(--text-xs); color: var(--color-text-faint); white-space: nowrap; }

/* Section labels */
.section-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: var(--space-4) 0 var(--space-2);
  display: flex; align-items: center; gap: var(--space-2);
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--color-border-default); }

/* ============================================================
   SECTION ALERTES
   ============================================================ */
.section-alertes {
  background: var(--color-danger-dim);
  border: 0.5px solid rgba(255,92,92,.2);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}
.section-alertes-titre {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--color-danger);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: var(--space-2);
  display: flex; align-items: center; gap: var(--space-2);
}

/* ============================================================
   BOTTOM SHEETS
   ============================================================ */
.sheet-overlay {
  position: fixed; inset: 0;
  background: var(--color-bg-overlay);
  z-index: var(--z-sheet);
  display: flex; align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
}
.sheet-overlay.visible { opacity: 1; visibility: visible; }

.sheet-container {
  background: var(--color-sheet-bg);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  max-height: 92vh;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.25,.72,.3,1);
  border: 0.5px solid var(--color-border-default);
  border-bottom: none;
}
.sheet-overlay.visible .sheet-container { transform: translateY(0); }

.sheet-handle-bar {
  width: 36px; height: 3px;
  background: var(--color-sheet-handle);
  border-radius: var(--radius-full);
  margin: var(--space-3) auto 0;
  flex-shrink: 0;
}

.sheet-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: var(--space-4) var(--space-6) var(--space-4);
  border-bottom: 0.5px solid var(--color-border-faint);
  flex-shrink: 0;
}
.sheet-header-info { flex: 1; min-width: 0; }
.sheet-nom { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--color-text-primary); margin: 0 0 var(--space-2); letter-spacing: -.2px; }
.sheet-badge {
  display: inline-flex; align-items: center;
  font-size: var(--text-xs); font-weight: var(--fw-bold);
  background: var(--color-success-dim); color: var(--color-brand-dark);
  padding: 2px var(--space-3); border-radius: var(--radius-full);
  text-transform: uppercase; letter-spacing: .06em;
}
.sheet-prix-mois { display: block; font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--color-brand); text-align: right; }
.sheet-prix-an   { display: block; font-size: var(--text-xs); color: var(--color-text-faint); text-align: right; margin-top: 2px; }
.sheet-header-droite { display: flex; align-items: flex-start; gap: var(--space-2); }

.sheet-body {
  flex: 1; overflow-y: auto;
  padding: var(--space-1) var(--space-6) var(--space-3);
  -webkit-overflow-scrolling: touch;
}
.sheet-body::-webkit-scrollbar { width: 3px; }
.sheet-body::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: var(--radius-full); }

.sheet-actions {
  display: flex; gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  border-top: 0.5px solid var(--color-border-faint);
  flex-shrink: 0;
  padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
}
.sheet-btn-modifier {
  flex: 1; background: var(--color-brand); color: var(--color-text-on-brand); border: none;
  padding: var(--space-3); border-radius: var(--radius-md); font-size: var(--text-base);
  font-weight: var(--fw-bold); cursor: pointer; font-family: var(--font-sans); transition: var(--transition-base);
}
.sheet-btn-modifier:hover { opacity: .88; }
.sheet-btn-supprimer {
  background: var(--color-danger-dim); color: var(--color-danger);
  border: 0.5px solid rgba(255,92,92,.25);
  padding: var(--space-3) var(--space-5); border-radius: var(--radius-md);
  font-size: var(--text-base); cursor: pointer; font-family: var(--font-sans); transition: var(--transition-base);
}
.sheet-btn-supprimer:hover { background: rgba(255,92,92,.2); }

/* ── Sheet tabs ── */
.sheet-tabs {
  display: flex;
  padding: var(--space-3) var(--space-4) 0;
  border-bottom: 0.5px solid var(--color-border-faint);
  flex-shrink: 0;
}
.sheet-tab {
  flex: 1; font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--color-text-faint);
  padding: var(--space-2) var(--space-1); text-align: center; background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer; font-family: var(--font-sans); transition: var(--transition-base);
}
.sheet-tab.actif { color: var(--color-brand); border-bottom-color: var(--color-brand); }
.sheet-tab:hover:not(.actif) { color: var(--color-text-secondary); }

/* ── Consultation champs ── */
.consult-section { margin: var(--space-4) 0; }
.consult-section-titre {
  font-size: var(--text-xs); font-weight: var(--fw-bold); color: var(--color-text-faint);
  text-transform: uppercase; letter-spacing: .08em;
  padding-bottom: var(--space-2); border-bottom: 0.5px solid var(--color-border-faint); margin-bottom: var(--space-2);
}
.consult-grille { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.consult-champ { background: var(--color-bg-sunken); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); display: flex; flex-direction: column; gap: 3px; }
.consult-champ-cle  { background: var(--color-success-dim); }
.consult-champ-vide { opacity: .45; }
.consult-champ-label { font-size: var(--text-xs); color: var(--color-text-faint); display: flex; align-items: center; gap: var(--space-1); }
.consult-badge-cle   { font-size: .6rem; background: var(--color-brand-dark); color: #fff; padding: 1px var(--space-1); border-radius: 4px; font-weight: var(--fw-bold); }
.consult-champ-val   { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--color-text-primary); }

/* ── Édition ── */
.edit-section { margin: var(--space-4) 0; }
.edit-section-titre {
  font-size: var(--text-xs); font-weight: var(--fw-bold); color: var(--color-brand);
  text-transform: uppercase; letter-spacing: .08em;
  padding-bottom: var(--space-2); border-bottom: 0.5px solid var(--color-success-dim); margin-bottom: var(--space-3);
}
.edit-grille { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.champ-edition { display: flex; flex-direction: column; gap: var(--space-1); }
.champ-edition label { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: var(--fw-semibold); }
.champ-edition input, .champ-edition select {
  padding: var(--space-2) var(--space-3); border: 1.5px solid var(--color-border-default);
  border-radius: var(--radius-sm); font-size: var(--text-base); outline: none;
  transition: var(--transition-base); background: var(--color-input-bg); color: var(--color-text-primary); font-family: var(--font-sans);
}
.champ-edition input:focus, .champ-edition select:focus { border-color: var(--color-brand); }
.champ-edition select option { background: var(--color-bg-card); }
.champ-edition-cle label { color: var(--color-brand-dark); }
.champ-edition-cle input, .champ-edition-cle select { border-color: rgba(0,200,150,.3); }
.edit-badge-cle { font-size: .6rem; background: var(--color-success-dim); color: var(--color-brand-dark); padding: 1px var(--space-1); border-radius: 4px; font-weight: var(--fw-bold); }
.champ-suffix   { font-size: var(--text-xs); color: var(--color-text-faint); font-weight: var(--fw-regular); margin-left: 3px; }
.champ-note     { font-size: var(--text-xs); color: var(--color-warning); line-height: 1.4; margin-top: var(--space-1); padding: var(--space-1) var(--space-2); background: var(--color-warning-dim); border-radius: var(--radius-sm); }
.gate-champ-note { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.4; margin-top: var(--space-1); padding: var(--space-1) var(--space-2); background: var(--color-bg-sunken); border-radius: var(--radius-sm); border-left: 2px solid var(--color-border-strong); }

/* ============================================================
   RENÉGOCIATION
   ============================================================ */
.reneg-intro  { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0 0 var(--space-3); line-height: 1.5; }
.reneg-motifs { display: flex; flex-direction: column; gap: var(--space-2); }
.motif-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  border: 1.5px solid var(--color-border-default);
  border-radius: var(--radius-md); cursor: pointer;
  transition: var(--transition-base);
}
.motif-item.sel { border-color: var(--color-brand-dark); background: var(--color-success-dim); }
.motif-icone { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.motif-texte { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.motif-label { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--color-text-primary); }
.motif-sous  { font-size: var(--text-xs); color: var(--color-text-faint); }
.motif-check { width: 20px; height: 20px; border-radius: var(--radius-full); border: 2px solid var(--color-border-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: var(--transition-base); }
.motif-item.sel .motif-check { background: var(--color-brand-dark); border-color: var(--color-brand-dark); }

/* ============================================================
   ONGLET AJOUTER
   ============================================================ */
.choix-label  { font-size: var(--text-sm); color: var(--color-text-muted); text-align: center; margin-bottom: var(--space-4); }
.choix-blocs  { display: flex; gap: var(--space-3); margin-bottom: var(--space-5); }
.choix-bloc {
  flex: 1; background: var(--color-bg-card);
  border: 1.5px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-2);
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-2); text-align: center; cursor: pointer;
  transition: var(--transition-base);
}
.choix-bloc:hover { border-color: var(--color-brand); box-shadow: 0 0 0 3px var(--color-brand-dim); }
.choix-icone  { width: 44px; height: 44px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; }
.choix-titre  { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--color-text-primary); }
.choix-sous   { font-size: var(--text-xs); color: var(--color-text-faint); line-height: 1.3; }
.choix-badge  { font-size: var(--text-xs); background: var(--color-warning-dim); color: var(--color-warning); padding: 2px var(--space-2); border-radius: var(--radius-full); font-weight: var(--fw-semibold); }
@media (max-width:480px) {
  .choix-blocs { flex-direction: column; }
  .choix-bloc  { flex-direction: row; text-align: left; padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  .choix-icone { flex-shrink: 0; }
}

.zone-upload { border: 2px dashed rgba(0,200,150,.3); border-radius: var(--radius-md); padding: var(--space-8) var(--space-4); text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); transition: var(--transition-base); }
.zone-upload:hover, .zone-upload.drag-over { background: var(--color-success-dim); border-color: var(--color-brand-dark); }
.upload-titre   { font-size: var(--text-base); font-weight: var(--fw-semibold); color: var(--color-info); }
.upload-sous    { font-size: var(--text-sm); color: var(--color-text-muted); }
.upload-formats { font-size: var(--text-xs); color: var(--color-text-faint); }
.btn-upload-fichier { background: var(--color-info); color: #fff; border: none; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--fw-semibold); cursor: pointer; font-family: var(--font-sans); }
.upload-apercu  { padding: var(--space-4) 0; }
.apercu-fichier { display: flex; align-items: center; gap: var(--space-3); background: var(--color-info-dim); border: 0.5px solid rgba(77,158,255,.2); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.apercu-fichier span { flex: 1; font-size: var(--text-sm); color: var(--color-info); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apercu-suppr { background: none; border: none; color: var(--color-text-faint); cursor: pointer; }
.apercu-suppr:hover { color: var(--color-danger); }
.apercu-info  { font-size: var(--text-sm); color: var(--color-brand-dark); margin-top: var(--space-3); }
.zone-camera  { border: 2px dashed rgba(245,166,35,.3); border-radius: var(--radius-md); padding: var(--space-8) var(--space-4); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.camera-titre { font-size: var(--text-base); font-weight: var(--fw-semibold); color: var(--color-warning); }
.camera-sous  { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 260px; }
#btn-activer-camera { background: var(--color-warning); color: #fff; border: none; padding: var(--space-2) var(--space-6); border-radius: var(--radius-md); font-size: var(--text-base); font-weight: var(--fw-bold); cursor: pointer; font-family: var(--font-sans); }
.camera-actions { display: flex; gap: var(--space-3); margin-top: var(--space-4); width: 100%; }
#btn-capturer, #btn-reprendre { flex: 1; background: var(--color-brand-dark); color: #fff; border: none; padding: var(--space-2); border-radius: var(--radius-md); font-size: var(--text-base); font-weight: var(--fw-bold); cursor: pointer; font-family: var(--font-sans); }
.btn-secondaire { flex: 1; background: var(--color-bg-sunken); color: var(--color-text-muted); border: 0.5px solid var(--color-border-default); padding: var(--space-2); border-radius: var(--radius-md); font-size: var(--text-base); cursor: pointer; font-family: var(--font-sans); }
.info-ocr { margin-top: var(--space-4); background: var(--color-warning-dim); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); font-size: var(--text-xs); color: var(--color-warning); text-align: center; }

/* ============================================================
   STATS (onglet)
   ============================================================ */
.stats-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-6); }
.stats-total-label   { font-size: var(--text-xs); font-weight: var(--fw-bold); color: var(--color-text-faint); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.stats-total-montant { font-size: var(--text-2xl); font-weight: var(--fw-bold); color: var(--color-brand); letter-spacing: -.5px; }
.stats-toggle { display: flex; background: var(--color-bg-sunken); border-radius: var(--radius-md); padding: 3px; gap: 3px; }
.stats-toggle-btn { padding: var(--space-1) var(--space-4); border: none; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--fw-semibold); cursor: pointer; background: transparent; color: var(--color-text-faint); transition: var(--transition-base); font-family: var(--font-sans); }
.stats-toggle-btn.actif { background: var(--color-bg-card); color: var(--color-text-primary); box-shadow: var(--shadow-sm); }

.camembert-wrapper { position: relative; display: flex; justify-content: center; margin-bottom: var(--space-6); }
.camembert-centre  { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; pointer-events: none; }
#centre-montant { display: block; font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--color-text-primary); line-height: 1.2; }
#centre-label   { display: block; font-size: var(--text-xs); color: var(--color-text-faint); margin-top: 2px; }

.legende-item   { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-2); border-radius: var(--radius-sm); transition: var(--transition-base); }
.legende-item:hover { background: var(--color-bg-sunken); }
.legende-dot    { width: 10px; height: 10px; border-radius: var(--radius-full); flex-shrink: 0; }
.legende-info   { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.legende-nom    { font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--color-text-primary); }
.legende-type   { font-size: var(--text-xs); color: var(--color-text-faint); text-transform: uppercase; letter-spacing: .05em; }
.legende-chiffres { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.legende-pct    { font-size: var(--text-base); font-weight: var(--fw-bold); }
.legende-montant { font-size: var(--text-xs); color: var(--color-text-faint); }

/* ============================================================
   PROFIL
   ============================================================ */
.profil-hero {
  background: linear-gradient(135deg, var(--color-header-bg), var(--color-brand-dark));
  padding: var(--space-4) var(--space-6) var(--space-5);
  display: flex; align-items: center; gap: var(--space-4); flex-shrink: 0;
}
.profil-avatar {
  width: 48px; height: 48px; border-radius: var(--radius-full);
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-md); font-weight: var(--fw-bold); color: #fff; flex-shrink: 0;
}
.profil-nom              { font-size: 15px; font-weight: var(--fw-bold); color: #fff; letter-spacing: -.1px; }
.profil-completion-label { font-size: 11px; color: rgba(255,255,255,.65); margin-top: 2px; }
.profil-barre-bg   { height: 3px; background: rgba(255,255,255,.15); border-radius: var(--radius-full); margin-top: var(--space-2); }
.profil-barre-fill { height: 3px; background: rgba(110,231,183,.85); border-radius: var(--radius-full); transition: width .5s ease; }

.profil-tabs { display: flex; border-bottom: 0.5px solid var(--color-border-faint); background: var(--color-sheet-bg); flex-shrink: 0; }
.profil-tab  {
  flex: 1; padding: var(--space-3) var(--space-2); background: none; border: none;
  border-bottom: 2px solid transparent; font-size: var(--text-sm); font-weight: var(--fw-semibold);
  color: var(--color-text-faint); cursor: pointer; font-family: var(--font-sans); transition: var(--transition-base);
}
.profil-tab:hover { color: var(--color-brand); }
.profil-tab.actif { color: var(--color-brand); border-bottom-color: var(--color-brand); }

.profil-bandeau-courtier {
  display: flex; align-items: flex-start; gap: var(--space-2);
  background: var(--color-warning-dim); border-bottom: 0.5px solid rgba(245,166,35,.2);
  padding: var(--space-3) var(--space-6); font-size: var(--text-xs); color: var(--color-warning); line-height: 1.4; flex-shrink: 0;
}
.profil-completion-onglet { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); padding-top: var(--space-3); border-top: 0.5px solid var(--color-border-faint); }
.profil-completion-onglet-barre { flex: 1; height: 5px; background: var(--color-bg-sunken); border-radius: var(--radius-full); overflow: hidden; }
.profil-completion-onglet span  { font-size: var(--text-xs); color: var(--color-text-faint); flex-shrink: 0; }

/* ============================================================
   GATE OVERLAY (Progressive disclosure)
   ============================================================ */
.gate-overlay {
  position: fixed; inset: 0; z-index: var(--z-gate);
  background: var(--color-bg-overlay);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.gate-overlay.visible { opacity: 1; visibility: visible; }
.gate-overlay.visible .gate-container { transform: translateY(0); }
.gate-container {
  background: var(--color-sheet-bg);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  border: 0.5px solid var(--color-border-default); border-bottom: none;
  padding: var(--space-6) var(--space-5) var(--space-10);
  width: 100%; max-width: 680px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.32,0,.67,0);
}
.gate-icon-wrap { text-align: center; margin-bottom: var(--space-3); }
.gate-titre  { font-size: var(--text-md); font-weight: var(--fw-bold); color: var(--color-text-primary); text-align: center; margin-bottom: var(--space-2); }
.gate-desc   { font-size: var(--text-sm); color: var(--color-text-muted); text-align: center; line-height: 1.55; margin-bottom: var(--space-4); }
.gate-progress { margin-bottom: var(--space-4); }
.gate-progress-header { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--color-text-faint); font-weight: var(--fw-semibold); margin-bottom: var(--space-1); }
.gate-progress-bg   { height: 4px; background: var(--color-bg-sunken); border-radius: var(--radius-full); overflow: hidden; }
.gate-progress-fill { height: 4px; background: var(--color-brand-dark); border-radius: var(--radius-full); transition: width .4s ease; }
.gate-champs-liste { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-5); }
.gate-champ { display: flex; flex-direction: column; gap: var(--space-1); }
.gate-label { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--color-text-secondary); }
.gate-input {
  width: 100%; padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--color-input-border); border-radius: var(--radius-sm);
  font-size: var(--text-base); outline: none; font-family: var(--font-sans);
  transition: var(--transition-base); background: var(--color-input-bg); color: var(--color-text-primary);
}
.gate-input:focus { border-color: var(--color-brand); box-shadow: 0 0 0 3px var(--color-brand-dim); }
.gate-input option { background: var(--color-bg-card); }
.gate-actions { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.gate-btn-confirmer {
  width: 100%; background: var(--color-brand); color: var(--color-text-on-brand);
  border: none; padding: var(--space-3); border-radius: var(--radius-md);
  font-size: var(--text-md); font-weight: var(--fw-bold); cursor: pointer;
  font-family: var(--font-sans); transition: var(--transition-base);
}
.gate-btn-confirmer:hover { opacity: .88; }
.gate-btn-annuler {
  width: 100%; background: none; color: var(--color-text-muted);
  border: 1.5px solid var(--color-border-default); padding: var(--space-3); border-radius: var(--radius-md);
  font-size: var(--text-base); font-weight: var(--fw-medium); cursor: pointer;
  font-family: var(--font-sans); transition: var(--transition-base);
}
.gate-btn-annuler:hover { border-color: var(--color-border-strong); color: var(--color-text-primary); }
.gate-note { font-size: var(--text-xs); color: var(--color-text-faint); text-align: center; display: flex; align-items: center; justify-content: center; gap: var(--space-1); line-height: 1.4; }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast {
  position: fixed;
  bottom: max(80px, calc(env(safe-area-inset-bottom) + 72px));
  left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--color-text-primary);
  color: var(--color-bg-page);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: var(--fw-semibold);
  white-space: nowrap;
  z-index: var(--z-toast);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.erreur  { background: var(--color-danger); color: #fff; }

/* ============================================================
   PATCH — Classes manquantes identifiées à l'audit
   ============================================================ */

/* ── Badges échéance (générés par app.js) ── */
.badge-echeance {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  margin-left: var(--space-1);
  vertical-align: middle;
}
.badge-expire  { background: var(--color-danger-dim);  color: var(--color-danger); }
.badge-urgent  { background: var(--color-danger-dim);  color: var(--color-danger); }
.badge-bientot { background: var(--color-warning-dim); color: var(--color-warning); }

/* ── champ-edition-cle (gate + sheets) ── */
.champ-edition-cle label {
  color: var(--color-brand);
}
.champ-edition-cle input,
.champ-edition-cle select {
  border-color: rgba(0,200,150,.3);
}
.champ-edition-cle input:focus,
.champ-edition-cle select:focus {
  border-color: var(--color-brand);
}

/* ── section-label-liste ── */
.section-label-liste {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: var(--space-4) 0 var(--space-2);
}

/* ── carte-ech (dans les cartes assurance) ── */
.carte-ech-urgent  { color: var(--color-danger); font-weight: var(--fw-bold); }
.carte-ech-bientot { color: var(--color-warning); }
.carte-meta-ech    { font-size: var(--text-xs); color: var(--color-text-faint); display: inline-flex; align-items: center; gap: 3px; }

/* ── Contrat card (dans panel courtier client) ── */
.contrat-card {
  background: var(--color-bg-sunken);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  border: 0.5px solid var(--color-border-faint);
  transition: var(--transition-base);
}
.contrat-card:hover { border-color: var(--color-border-default); }
.contrat-card-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: var(--space-1);
}
.contrat-nom { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--color-text-primary); }
.contrat-prix { font-size: var(--text-sm); font-weight: var(--fw-bold); color: var(--color-brand); white-space: nowrap; }
.contrat-details { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; }

/* ── Fiche client dans panel ── */
.fiche-section {
  margin-bottom: var(--space-4);
  background: var(--color-bg-sunken);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.fiche-s-header {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-card);
  border-bottom: 0.5px solid var(--color-border-faint);
}
.fiche-s-accent { width: 3px; height: 14px; border-radius: var(--radius-full); flex-shrink: 0; }
.fiche-s-titre  { font-size: var(--text-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .08em; }
.fiche-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-2) var(--space-3);
  border-bottom: 0.5px solid var(--color-border-faint);
  gap: var(--space-3);
}
.fiche-row:last-child { border-bottom: none; }
.fiche-label { font-size: var(--text-xs); color: var(--color-text-faint); flex-shrink: 0; }
.fiche-val   { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--color-text-primary); text-align: right; }
.manquant    { color: var(--color-text-faint); font-style: italic; }

/* ── Upload & camera ── */
.apercu-info  { font-size: var(--text-sm); color: var(--color-brand); margin-top: var(--space-3); }

/* ── Carte méta type/sep ── */
.carte-meta     { display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; margin-top: var(--space-1); }
.carte-meta-type { font-size: var(--text-xs); color: var(--color-text-faint); text-transform: uppercase; letter-spacing: .06em; font-weight: var(--fw-bold); }
.carte-meta-sep  { font-size: var(--text-xs); color: var(--color-border-strong); }

/* ── Loading state ── */
.loading {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--color-text-faint);
  font-size: var(--text-sm);
  line-height: 1.6;
}
