/* =======================================================================
   style.css — complément au design system CERTPEB (theme.css).
   Ne contient QUE ce que theme.css / Bootstrap ne couvrent pas :
   fenêtres modales du kit, bloc tarif, auto-complétion d'adresse,
   et quelques détails de carte (prix, facture, suivi).
   ======================================================================= */

/* L'attribut hidden doit toujours masquer (login, modales, sidebar…). */
[hidden] { display: none !important; }

/* La coque (theme.css) attend un parent flex : sidebar (sticky) + contenu (flex:1). */
#app { display: flex; min-height: 100vh; }

/* ---- Écran de connexion ---- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.login-screen .login-brand { text-align: center; margin-bottom: 6px; }
.login-screen h1 { color: var(--primary); margin: 0 0 4px; }

/* ---- Sidebar : marque texte (pas d'icône) ---- */
.brand-text { font-weight: 800; font-size: 18px; color: var(--primary); letter-spacing: -.01em; }

/* ---- Sidebar : qui est connecté (pastille initiales + nom + rôle) ---- */
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 8px; margin-bottom: 8px; border-top: 1px solid var(--border); }
.sidebar-user .user-avatar {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-user .user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sidebar-user .user-nom { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: var(--text-muted, #6b7280); }
.d-none-mobile { display: inline; }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; }
.center { text-align: center; }
.muted, .text-soft { color: var(--text-muted); }
.small { font-size: 12px; }

/* ---- Fenêtre d'aperçu d'une mission ---- */
.apercu-row { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--gris-clair, #f3f4f6); font-size: 13.5px; }
.apercu-k { flex: 0 0 110px; font-weight: 700; color: var(--text-muted); }
.apercu-lignes { width: 100%; border-collapse: collapse; margin: 14px 0 6px; font-size: 13px; }
.apercu-lignes th { text-align: left; font-size: 11px; text-transform: uppercase; color: var(--text-muted); border-bottom: 2px solid var(--border); padding: 6px 8px; }
.apercu-lignes td { padding: 7px 8px; border-bottom: 1px solid var(--gris-clair, #f3f4f6); }
.apercu-total { text-align: right; font-size: 15px; margin-top: 4px; }

/* ---- Pied de page du CRM (copyright) ---- */
.app-footer { margin-top: auto; text-align: center; padding: 22px 16px 26px; font-size: 12px; color: var(--text-soft); }

/* ---- Pastille de notifications (cloche topbar) ---- */
.notif-badge { position: absolute; top: 1px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; border-radius: 9px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }

/* ---- Barre d'icônes d'action sur les cartes ---- */
.card-toolbar { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-ic { flex: 1 1 0; min-width: 38px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 6px; cursor: pointer; color: var(--text-muted); font-size: 15px; line-height: 1; transition: var(--transition); }
.btn-ic:hover { background: var(--surface-alt); color: var(--text); border-color: var(--border-strong); }
.btn-ic:disabled { opacity: .4; cursor: not-allowed; }
.btn-ic.ic-on { color: #047857; border-color: var(--success); background: var(--success-light); }
.btn-ic.ic-green:hover { color: #047857; border-color: var(--success); background: var(--success-light); }
.btn-ic.ic-danger:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-light); }

/* ---- Table des collaborateurs ---- */
.collab-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.collab-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--border); }
.collab-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.collab-table tr:last-child td { border-bottom: 0; }
.collab-table .r { text-align: right; white-space: nowrap; }
.collab-table .btn-ic { flex: none; min-width: 34px; }

/* ---- Tableau de bord : liste des dernières missions ---- */
.recent-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.recent-row:last-child { border-bottom: 0; }
.recent-main { display: flex; flex-direction: column; min-width: 0; }
.recent-main .strong { font-weight: 600; }
.recent-main .text-muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---- Cadres de mission plus grands ---- */
.mission-cards-grid { grid-template-columns: repeat(auto-fill, minmax(375px, 1fr)); gap: 20px; }
.ods-card { padding: 24px 26px; }
.ods-card-client { font-size: 21px; }
.ods-card-meta { font-size: 14px; }
.ods-card-type, .ods-card-type.prix-pill { font-size: 13px; padding: 5px 12px; }
.suivi-label { font-size: 13px; }
@media (max-width: 600px) { .mission-cards-grid { grid-template-columns: 1fr; } }

/* ---- Onglets (En brouillon / En cours / Clôturé / Annulées) ---- */
.nav-tabs { border-bottom: 2px solid var(--border); gap: 2px; flex-wrap: wrap; }
.nav-tabs .nav-link { color: var(--text-muted); border: 0; border-bottom: 2px solid transparent; font-weight: 600; font-size: 13.5px; padding: 9px 14px; background: none; cursor: pointer; }
.nav-tabs .nav-link:hover { color: var(--text); }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: none; }
.onglet-count { color: var(--text-soft); font-weight: 600; font-size: 12px; }

/* ---- Détails des cartes non couverts par theme.css ---- */
.ods-card-date { color: var(--text-muted); font-size: 12.5px; font-weight: 500; }
.ods-card-type.prix-pill { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.ods-card-price { margin-top: 8px; font-weight: 700; color: var(--primary); font-size: 16px; }
.ods-card-price .htva-label { font-weight: 500; color: var(--text-muted); font-size: 12px; }
/* Le n° de facture garde la police du CRM (Inter) : en monospace il avait
   l'air d'un bout de code. tabular-nums = chiffres de largeur égale, donc
   les numéros restent alignés d'une carte à l'autre. */
.facture-ligne { margin-top: 11px; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; }
.facture-ligne .num-facture { font-weight: 700; letter-spacing: .01em; }
.facture-ligne.facture-vide { color: var(--text-soft); }
.facture-ligne .lien-inline { color: var(--primary); font-weight: 600; }
.facture-ligne:hover { opacity: .85; }
.suivi-grid { display: flex; flex-direction: column; gap: 5px; margin: 12px 0 6px; border-top: 1px dashed var(--border); padding-top: 10px; }
.suivi-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.suivi-row:hover { opacity: .82; }
.suivi-label { font-size: 12.5px; font-weight: 700; color: #374151; }
.suivi-pill { font-size: 11.5px; font-weight: 700; padding: 3px 11px; border-radius: 20px; white-space: nowrap; }

/* ---- Fenêtres modales (propres au kit, pas les modales Bootstrap) ---- */
.modal { position: fixed; inset: 0; background: rgba(10,26,61,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 1080; overflow-y: auto; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 26px; width: 540px; max-width: 100%; box-shadow: var(--shadow-lg); }
.modal-box h2 { margin: 0 0 16px; font-size: 20px; }
.modal-box h3 { font-size: 14px; margin: 16px 0 8px; color: var(--text-strong); }
.modal-box label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 12px; }
.modal-box .form-control, .modal-box .form-select { margin-top: 4px; }
.frow { display: flex; gap: 12px; }
.frow label { flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.check-paid { display: flex; align-items: center; gap: 8px; }
.check-paid input { width: auto; margin-top: 0; }
.add-type { display: flex; gap: 8px; margin: 14px 0; }
.add-type .form-control { flex: 1; }
.types-list { list-style: none; padding: 0; margin: 0; }
.types-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--gris-clair, #f3f4f6); }
.types-list button { background: none; border: 0; color: var(--danger); cursor: pointer; padding: 4px; }

/* ---- Tarif multi-lignes (prix HTVA + unités par type) ---- */
.types-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 10px; }
.type-check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin-bottom: 0; white-space: nowrap; }
.type-check input { width: auto; margin-top: 0; }
.lignes-tarif { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ligne-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ligne-row .l-label { flex: 1 1 150px; font-size: 13px; font-weight: 600; color: #374151; }
.ligne-row .l-price { max-width: 120px; margin-top: 0; }
.ligne-row .l-units { max-width: 80px; margin-top: 0; }
.ligne-row .l-x { font-size: 13px; color: var(--text-muted); }
.ligne-row .l-sub { min-width: 84px; text-align: right; font-weight: 700; font-size: 13px; }

/* ---- Plusieurs biens à expertiser ---- */
.addr-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.addr-row .ac-wrap { flex: 1; margin-bottom: 0; }
/* Boîte / étage / n° d'appartement : champ court à côté de l'adresse. */
.addr-row .m-boite { flex: 0 0 130px; }
@media (max-width: 640px) {
  .addr-row { flex-wrap: wrap; }
  .addr-row .ac-wrap { flex: 1 1 100%; }
  .addr-row .m-boite { flex: 1 1 auto; }
}
.addr-boite { font-size: 11px; font-weight: 700; color: #047857; background: var(--success-light); padding: 1px 7px; border-radius: 10px; white-space: nowrap; }
.btn-remove-addr { background: none; border: 0; color: var(--danger); cursor: pointer; padding: 9px; font-size: 14px; line-height: 1; border-radius: 8px; }
.btn-remove-addr:hover { background: var(--danger-light); }
.addr-plus { font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 1px 7px; border-radius: 10px; white-space: nowrap; }

/* ---- Auto-complétion d'adresse ---- */
.ac-wrap { position: relative; margin-bottom: 12px; }
.autocomplete { position: absolute; left: 0; right: 0; top: 100%; z-index: 1100; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; margin-top: 2px; }
.ac-item { padding: 9px 12px; font-size: 13.5px; cursor: pointer; border-bottom: 1px solid var(--gris-clair, #f3f4f6); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover { background: var(--primary-light); }

@media (max-width: 640px) {
  .d-none-mobile { display: none; }
  .frow { flex-direction: column; gap: 0; }
}
