/* ---------- Listes de leads ---------- */

.lead-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #F0F0F2;
  transition: background .12s ease;
}
.lead-row:last-child { border-bottom: 0; }
.lead-row:hover { background: #FAFAFB; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: transparent; }
.dot.on { background: var(--blue); box-shadow: 0 0 0 3px rgba(36,99,235,.15); }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: var(--green-soft); color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.avatar-lg { width: 52px; height: 52px; font-size: 17px; border-radius: 16px; }

.lead-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lead-name { font-weight: 600; font-size: 14.5px; display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
.lead-name .tel-nom { white-space: nowrap; }
.unread .lead-name { font-weight: 750; }
.site-tag { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.lead-sub { font-size: 13px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lead-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.lead-time { font-size: 12px; color: var(--faint); }
.unread .lead-time { color: var(--blue); font-weight: 650; }
.lead-flags { display: flex; align-items: center; gap: 6px; }
.flag-photo { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--faint); }

.chip {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  border-radius: 99px; padding: 3px 10px; white-space: nowrap;
}

/* ---------- Filtres ---------- */

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; font-size: 13px; font-weight: 600; color: var(--soft);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 6px 14px;
}
.filter b { font-weight: 750; margin-left: 2px; }
.filter.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.site-head { display: flex; align-items: center; gap: 14px; }
.site-head .muted a { color: var(--soft); text-decoration: underline; }

/* ---------- Fiche lead ---------- */

.lead-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.lead-head h1 { font-size: 20px; }
.lead-head > div { flex: 1; min-width: 0; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.actions-sm { margin-bottom: 0; margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: 14px; font-weight: 650;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 18px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  box-shadow: 0 1px 2px rgba(23,24,24,.05);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(23,24,24,.08); }
.btn:active { transform: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-deep); }
.btn-wa { color: #128C4B; border-color: #BFE5CE; background: #F0FAF4; }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--border); color: var(--soft); }
.btn-danger { color: var(--danger); border-color: #EFCFCF; background: #FDF4F4; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } }
.facts .full { grid-column: 1 / -1; }
.facts dt { font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.facts dd { font-size: 14.5px; margin-top: 1px; }
.ellipsis dd, dd.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo {
  border: 0; padding: 0; cursor: zoom-in; border-radius: 10px; overflow: hidden;
  aspect-ratio: 4 / 3; background: var(--bg);
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.photo:hover img { transform: scale(1.04); }
/* Repli quand une photo iPhone (HEIC) n'a pas pu être convertie : lien lisible plutôt qu'un cadre vide */
.photo--brut {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer; text-align: center; font-size: 12px; font-weight: 600; line-height: 1.25;
  color: var(--muted, #6b7280); border: 1px dashed var(--line, #e5e7eb); text-decoration: none;
}
.photo--brut small { font-weight: 500; opacity: .8; }

.status-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn {
  border: 1.5px solid transparent; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 650; padding: 7px 14px;
  background: #F1F2F4; color: var(--soft);
}
.chip-btn:hover { border-color: var(--border); }
.chip-btn.on { background: var(--bg); color: var(--fg); border-color: var(--fg); }

.card-avis { border-color: #EBE3C9; background: #FFFDF5; }
.avis-msg {
  background: #fff; border: 1px dashed #E3D9B8; border-radius: 10px;
  padding: 12px 14px; font-size: 13.5px; margin-top: 10px; color: var(--soft);
}
.avis-sent {
  background: var(--green-soft); color: var(--green-deep);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; margin-bottom: 8px;
  display: inline-block;
}

.note { border-bottom: 1px solid #F0F0F2; padding: 10px 0; }
.note:last-of-type { border-bottom: 0; }
.note p { font-size: 14px; }
.note .muted { font-size: 12px; }
.note-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ---------- Formulaires ---------- */

.input {
  width: 100%; font: inherit; font-size: 14.5px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 13px; background: #fff; color: var(--ink);
  outline: none; resize: vertical;
}
.input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(14,124,86,.12); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 650; margin-bottom: 6px; color: var(--ink); }

/* ---------- Switch (19/09/2026, mode « ne pas déranger » téléphonie) ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch-row strong { font-size: 14.5px; }
.switch { position: relative; flex: none; width: 44px; height: 26px; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: background .15s; }
.switch-track::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--green); outline-offset: 2px; }

.form-error { color: var(--danger); font-size: 13.5px; margin-bottom: 10px; }

/* ---------- Connexion ---------- */

.login { min-height: 92vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow); padding: 38px 30px;
}
.login-mark { display: flex; justify-content: center; margin-bottom: 16px; }
.login-mark img { width: 56px; height: 56px; border-radius: 16px; display: block; box-shadow: 0 6px 16px rgba(14, 124, 86, .22); }
.login-card h1 { margin-bottom: 4px; }
.login-card .muted { margin-bottom: 22px; }
.login-card .input { margin-bottom: 12px; text-align: center; }

/* ---------- Réglages ---------- */

.sync-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.sync-table td { padding: 8px 0; border-bottom: 1px solid #F0F0F2; font-size: 14px; }
.sync-table tr:last-child td { border-bottom: 0; }
.sync-table td:last-child { text-align: right; }
.sync-ok { color: var(--green); font-weight: 600; font-size: 13px; }
.sync-err { color: var(--danger); font-weight: 600; font-size: 13px; }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20,22,24,.82);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.lightbox button {
  position: absolute; top: 14px; right: 18px;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; font-size: 22px; line-height: 1;
}

/* ---------- Écran Appels : numéro déjà connu + demande de photos (26/09/2026) ---------- */
.call-item { border-bottom: 1px solid #F0F0F2; }
.call-item:last-child { border-bottom: 0; }
.call-item .lead-row { border-bottom: 0; padding-bottom: 8px; }
.call-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 16px 12px 70px; }
.call-known { font-size: 13px; color: var(--green-deep); background: var(--green-soft); border-radius: 10px; padding: 6px 10px; min-width: 0; }
.call-new { font-size: 12.5px; color: var(--faint); }
.call-photos { width: 100%; }
.call-photos summary { list-style: none; display: inline-flex; cursor: pointer; }
.call-photos summary::-webkit-details-marker { display: none; }
.call-photos[open] summary { background: var(--green-soft); border-color: var(--green-soft); color: var(--green-deep); }
.msg-preview { margin: 10px 0; padding: 12px 14px; border-radius: 14px 14px 14px 4px; background: #F2F3F5; font-size: 14px; line-height: 1.45; color: var(--ink, #171818); }
.call-photos-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 420px) { .call-extra { padding-left: 16px; } }
.call-item .lead-name { flex-wrap: wrap; row-gap: 0; }
.call-num { white-space: nowrap; }

.call-vocal { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.call-vocal audio { flex: 1 1 200px; min-width: 0; height: 36px; }
