/* Lead Desk — design doux type Shopify */

:root {
  --bg: #F6F6F7;
  --surface: #FFFFFF;
  --border: #E4E5E9;
  --ink: #1A1C1F;
  --soft: #6B7076;
  --faint: #9CA1A8;
  --green: #12181f;   /* encre SerruDesk */
  --green-deep: #000000;
  --green-soft: #FDF3D6;  /* laiton pale */
  --blue: #2463EB;
  --danger: #C43333;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(23,24,24,.06), 0 2px 8px rgba(23,24,24,.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
p a, dd a { color: var(--green); }
p a:hover, dd a:hover { text-decoration: underline; }

h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }

.muted { color: var(--soft); font-size: 13.5px; }

/* Animation en cascade */
.rise { animation: rise .5s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .rise { animation: none; } }

/* ---------- Topbar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: 860px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand-dot { width: 22px; height: 22px; border-radius: 7px; background: var(--green); position: relative; flex: none; }
.brand-dot::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.brand-badge {
  background: var(--blue); color: #fff; font-size: 11.5px; font-weight: 700;
  border-radius: 99px; padding: 1px 7px; margin-left: 2px;
}
.back {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; color: var(--soft); flex: none;
  border: 1px solid var(--border); background: var(--surface);
}
.back:hover { color: var(--ink); }
.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 12px; color: var(--faint); min-width: 0;
}
.search:focus-within { border-color: var(--green); background: #fff; }
.search input {
  border: 0; outline: 0; background: transparent; width: 100%;
  font: inherit; font-size: 14px; color: var(--ink);
}
.iconbtn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; color: var(--soft); flex: none;
}
.iconbtn:hover { background: var(--bg); color: var(--ink); }

/* ---------- Layout ---------- */

.wrap { max-width: 860px; margin: 0 auto; padding: 22px 16px 60px; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.section-title { margin: 26px 0 10px; font-size: 14px; color: var(--soft); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card-title { margin-bottom: 12px; }
.card.empty { text-align: center; padding: 36px 18px; }
.card.list { padding: 4px 0; }

.flash, .sync-note {
  background: var(--green-soft); color: var(--green-deep);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px;
}

.push-card {
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
  border-color: #CFE5DB; background: #F4FAF7;
}
.push-card .btn { flex: none; }

/* ---------- Accueil : cartes sites ---------- */

.grid-sites { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .grid-sites { grid-template-columns: 1fr; } }

.site-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; margin-bottom: 0;
  transition: transform .18s ease, box-shadow .18s ease;
}
.site-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(23,24,24,.09); }

.site-square {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; letter-spacing: .02em;
}
.mini-square {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 7px; font-size: 10.5px; font-weight: 800;
  vertical-align: -5px; margin-right: 2px;
}
.site-square.has-logo, .mini-square.has-logo {
  border: 1px solid var(--border);
  overflow: hidden;
}
.site-square.has-logo img, .mini-square.has-logo img {
  width: 100%; height: 100%; object-fit: contain; display: block; padding: 4px; box-sizing: border-box;
}
.mini-square.has-logo img { padding: 2px; }
.site-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.site-meta strong { font-size: 15px; }
.site-meta .muted { font-size: 12.5px; }
.site-stats { font-size: 12px; color: var(--faint); margin-top: 3px; }

.pastille {
  flex: none; min-width: 26px; height: 26px; padding: 0 8px;
  border-radius: 99px; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(36,99,235,.35);
}
.pastille-ok {
  flex: none; width: 26px; height: 26px; border-radius: 99px;
  background: var(--green-soft); color: var(--green);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 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; gap: 8px; align-items: baseline; }
.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); }

.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); }

.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 span { width: 46px; height: 46px; border-radius: 14px; background: var(--green); position: relative; display: block; }
.login-mark span::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: #fff; }
.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;
}

/* Comptes & accès */
.user-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 0;border-bottom:1px solid var(--line, #e7e9e4)}
.user-row:last-of-type{border-bottom:none}
.user-off{opacity:.55}
.user-id{flex:1;min-width:180px}
.user-id strong{display:block;font-size:14px}
.user-sites{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.site-check{display:inline-flex;align-items:center;gap:4px;font-size:13px;font-weight:600}
.user-sites select{padding:6px 8px;border:1px solid var(--line, #e7e9e4);border-radius:8px;font:inherit;font-size:13px}
.user-actions{display:flex;gap:6px;flex-wrap:wrap}

/* --- Statistiques & attribution (01/08/2026) --- */
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}
.stat-box{background:#F1F2F4;border-radius:12px;padding:14px 16px;display:flex;flex-direction:column;gap:3px}
.stat-n{font-size:26px;font-weight:750;letter-spacing:-.02em;line-height:1.1}
.stat-l{font-size:12.5px;color:var(--soft);line-height:1.35}
.bars{display:flex;align-items:flex-end;gap:6px;height:140px;padding-top:8px}
.bar-col{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:4px}
.bar{width:100%;max-width:26px;background:var(--green);border-radius:5px 5px 0 0;display:block}
.bar-v{font-size:11px;color:var(--soft);min-height:14px}
.bar-x{font-size:10.5px;color:var(--faint)}
.chips{display:flex;flex-wrap:wrap;gap:7px}
.assign-form{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
@media (prefers-color-scheme:dark){
  .stat-box{background:#1a2027}
  .bar{background:#f5c542}
}

.login-mark-sd{background:none!important;width:auto;height:auto;display:flex;justify-content:center;margin-bottom:10px}
.login-mark-sd span{display:none}
.login-card h1 strong{font-weight:800}
.login-card h1{font-weight:300;letter-spacing:-.02em}
