/* ---------- Scroll : c'est l'élément sous la souris qui défile ; barres masquées ---------- */
html, body, .layout-trombi > *, .config-layout > *, .dd-list, .entry-contacts-list, .modal, .pick-list, .listref-params, .entry-contacts-menu {
  scrollbar-width: none; /* Firefox */
}
*::-webkit-scrollbar { width: 0; height: 0; display: none; } /* Chrome/Safari/Edge : aucune barre */

/* page trombi / config : deux colonnes qui défilent chacune sous la souris */
main.container.split { height: calc(100vh - 64px); overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
.split .layout-trombi { flex: 1; min-height: 0; height: auto; overflow: hidden; align-items: stretch; }
.layout-trombi { display: grid; }
.layout-trombi > aside, .layout-trombi > section { min-height: 0; overflow-y: auto; }
/* configurateur : la page défile, l'aperçu reste visible */
.preview-panel { position: sticky; top: 84px; }
@media (max-width: 1000px) { .preview-panel { position: static; } }

main.split .form-panel, main.split .preview-panel { position: static; }
@media (max-width: 960px) {
  main.container.split { height: auto; overflow: visible; }
  .layout-trombi, .layout-trombi > * { overflow: visible; height: auto; }
}

/* ---------- Cases à cocher / radios : uniformes et esthétiques partout ---------- */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; margin: 0; flex: none;
  border: 1.5px solid #c5c9d6; border-radius: 6px; background: #fff;
  cursor: pointer; position: relative; transition: background .12s ease, border-color .12s ease;
}
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--primary); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--primary); border-color: var(--primary); }
input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 5.5px; top: 2.5px;
  width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
input[type="radio"] { border-radius: 50%; }
input[type="radio"]:checked::after {
  content: ''; position: absolute; inset: 4px; background: #fff; border-radius: 50%; transform: none; border: none; width: auto; height: auto;
}

:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-soft: #eef2ff;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 30px rgba(16, 24, 40, .07);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(1000px 500px at 85% -10%, rgba(139, 92, 246, .10), transparent),
    radial-gradient(800px 400px at -10% 0%, rgba(99, 102, 241, .10), transparent);
  color: var(--text);
  min-height: 100vh;
}

.ic { width: 18px; height: 18px; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); margin: 0; font-size: 14px; }

/* ---------- Barre supérieure ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 64px;
  display: flex; align-items: center; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; letter-spacing: -.01em;
  text-decoration: none; color: var(--text);
}
.brand .ic { width: 26px; height: 26px; color: var(--primary); }
.grad {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar-title { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 20px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  background: var(--primary-soft); color: #4f46e5;
  font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px;
  padding: 10px 16px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; background: var(--surface); color: var(--text);
  text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn .ic { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}
.btn.primary:hover { box-shadow: 0 10px 22px rgba(99, 102, 241, .45); }
.btn.ghost { background: var(--surface); border-color: var(--border); }
.btn.ghost:hover { border-color: #c7d2fe; background: #fafaff; }
.btn.block { width: 100%; justify-content: center; }
.btn.small { padding: 7px 12px; font-size: 13px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; border: none;
  background: transparent; color: var(--muted); cursor: pointer; transition: all .15s ease;
}
.icon-btn:hover { background: #f3f4f6; color: var(--text); }
.icon-btn.danger:hover { background: #fef2f2; color: var(--danger); }

/* ---------- Mise en page ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-head h1 { margin: 0 0 6px; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

.panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid rgba(229, 231, 235, .8);
  padding: 22px;
}
.panel h2 { margin: 0 0 16px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.panel h2 .ic { color: var(--primary); }

.empty {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 56px 24px; text-align: center; color: var(--muted);
  background: rgba(255, 255, 255, .5); font-size: 14px; line-height: 1.6;
}
.empty .ic { width: 34px; height: 34px; margin-bottom: 8px; color: #c7d2fe; }

/* ---------- Accueil ---------- */
.trombi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.trombi-card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid rgba(229, 231, 235, .8);
  cursor: pointer; transition: transform .18s ease, box-shadow .18s ease;
}
.trombi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.trombi-cover { height: 110px; position: relative; display: flex; align-items: flex-end; padding: 12px; }
.trombi-count {
  color: #fff; font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .22); backdrop-filter: blur(6px);
  padding: 5px 10px; border-radius: 999px;
}
.trombi-cover .icon-btn { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; background: rgba(255, 255, 255, .88); color: #374151; }
.trombi-cover .icon-btn:hover { background: #fff; color: var(--danger); }
.trombi-body { padding: 16px 18px 18px; }
.trombi-body h3 { margin: 0 0 4px; font-size: 17px; }

/* ---------- Page trombinoscope ---------- */
.layout-trombi { display: grid; grid-template-columns: 330px 1fr; gap: 24px; align-items: start; }
.form-panel { position: sticky; top: 84px; }

.form-field { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #374151; }
.input {
  direction: ltr; text-align: left; unicode-bidi: plaintext; /* jamais de saisie de droite à gauche */
  width: 100%; font: inherit; font-size: 14px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #fbfbfd; color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); background: #fff; }
textarea.input { resize: vertical; min-height: 70px; }
.input.slim { width: auto; padding: 7px 9px; font-size: 13px; }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

.photo-row { display: flex; align-items: center; gap: 12px; }
.photo-preview {
  width: 60px; height: 60px; border-radius: 50%; flex: none;
  border: 2px dashed #c7d2fe; background: #f8faff; color: #a5b4fc;
  display: grid; place-items: center; overflow: hidden;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-btn { cursor: pointer; }

.persons-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.grid-toolbar .input { width: 230px; }
.grid-toolbar .menu-wrap { position: relative; }
.grid-toolbar .add-menu { min-width: 300px; max-height: 50vh; overflow-y: auto; }
.grid-toolbar .filter-item { margin-bottom: 10px; }
.person-card {
  position: relative; background: var(--surface); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); border: 1px solid rgba(229, 231, 235, .8);
  transition: transform .18s ease, box-shadow .18s ease;
}
.person-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.person-card .del { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(255, 255, 255, .92); opacity: 0; }
.person-card .edit { position: absolute; top: 10px; right: 48px; z-index: 2; background: rgba(255, 255, 255, .92); opacity: 0; }
.person-card:hover .del, .person-card:hover .edit { opacity: 1; }
@media (hover: none) { .person-card .del, .person-card .edit { opacity: 1; } }
/* zone photo de taille FIXE (190px) : c'est le cadre qui définit la taille, jamais la photo */
.person-photo { height: 190px; overflow: hidden; background: linear-gradient(135deg, #eef2ff, #f5f3ff); display: grid; place-items: center; }
/* photo affichée ENTIER dans la zone fixe : jamais agrandie, réduite seulement si elle dépasse (pour rester entière) */
.person-photo img { width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; object-position: center; display: block; margin: auto; }
.avatar {
  width: 96px; height: 96px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 30px; font-weight: 800;
  box-shadow: 0 10px 24px rgba(79, 70, 229, .35);
}
.person-body { padding: 18px 20px 22px; }
.person-name { margin: 0 0 4px; font-size: 19px; line-height: 1.3; }
.pfield { margin-top: 12px; }
.pfield-label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px;
}
.pfield-value .line { display: block; white-space: pre-wrap; word-break: break-word; }
.plink { color: inherit; text-decoration: none; }
.plink:hover { text-decoration: underline; }

/* ---------- Page configuration ---------- */
.config-layout { display: grid; grid-template-columns: 1fr 400px; gap: 24px; align-items: stretch; }
.preview-col { min-height: 0; }
.preview-panel { position: sticky; top: 84px; }

.field-editor { border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fcfcfe; }
.fe-head { display: flex; align-items: center; gap: 10px; }
.fe-ic {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary); display: grid; place-items: center;
}
.fe-label { flex: 1; min-width: 0; font-weight: 600; }
.fe-type {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: #f3f4f6; padding: 4px 8px; border-radius: 999px; flex: none;
}
.field-editor { transition: border-color .15s ease, box-shadow .15s ease; }
.field-editor:hover { border-color: #c7d2fe; box-shadow: var(--shadow); }
.style-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 12px; padding: 9px 10px;
  background: #f8faff; border: 1px solid #eceefe; border-radius: 12px;
}
.style-sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; flex: none; }
.color-btn {
  position: relative; width: 32px; height: 32px; flex: none;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
  display: grid; place-items: center; cursor: pointer; overflow: hidden;
}
.color-btn:hover { border-color: #c7d2fe; box-shadow: var(--shadow); }
.color-hidden { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.glyph-a { position: relative; font-weight: 800; font-size: 15px; line-height: 1; color: #374151; }
.glyph-bar { position: absolute; bottom: 5px; left: 8px; right: 8px; height: 3px; border-radius: 2px; }
.glyph-bg {
  width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center;
  font-size: 12px; border: 1px dashed #c7d2fe;
}
.source-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.size-ctl { display: flex; align-items: center; gap: 5px; }
.bold-btn { font-weight: 800; font-size: 15px; border: 1px solid var(--border); }
.bold-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: #374151; cursor: pointer; }


.add-wrap { position: relative; margin-top: 8px; }
.add-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.add-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: none; background: none; padding: 10px; border-radius: 10px; cursor: pointer; font: inherit;
}
.add-item:hover { background: #f5f6ff; }
.add-ic { width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.add-item strong { display: block; font-size: 14px; }
.add-item small { color: var(--muted); font-size: 12px; }

/* ---------- Modale ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; padding: 20px;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px);
  display: grid; place-items: center;
}
.modal {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 26px;
  width: min(440px, 100%);
  max-height: 86vh; overflow-y: auto; /* la fenêtre elle-même défile, pas la page derrière */
}
body.no-scroll { overflow: hidden; }

/* ---------- Vrais menus déroulants avec recherche ---------- */
.dd { position: relative; }
.dd-btn {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  width: 100%; text-align: left; background: #fff; cursor: pointer;
}
.dd-btn:hover { border-color: #c7d2fe; }
.dd-caret .ic { width: 14px; height: 14px; color: var(--muted); }
.dd-menu {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0; width: 100%;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 8px;
}
.dd-list { max-height: 220px; overflow-y: auto; margin-top: 6px; }
.dd-opt { padding: 5px 8px; border-radius: 8px; }
.dd-opt:hover { background: #f5f6ff; }

.modal h2 { margin: 0 0 6px; font-size: 20px; }
.modal .input { margin: 14px 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .persons-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1000px) {
  .config-layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
}
@media (max-width: 960px) {
  .layout-trombi { grid-template-columns: 1fr; }
  .form-panel { position: static; }
}
@media (max-width: 680px) { .persons-grid { grid-template-columns: 1fr; } }

/* ---------- Filtres & tri ---------- */
.filter-bar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px; padding: 14px 16px;
}
.filters { display: flex; flex-wrap: wrap; gap: 12px; flex: 1; }
.filter-item { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; max-width: 220px; }
.filter-item label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.filter-right { display: flex; align-items: center; gap: 12px; }
.filter-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- Nom / Prénom côte à côte ---------- */
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name-row .form-field { margin-bottom: 14px; }
@media (max-width: 560px) { .name-row { grid-template-columns: 1fr; } }

/* ---------- Champs multi-valués (téléphone / email) ---------- */
.multi-rows { display: flex; flex-direction: column; gap: 8px; }
.multi-row { display: flex; align-items: center; gap: 8px; }
.multi-row .input { flex: 1; }
.multi-add { margin-top: 8px; }

/* ---------- Options d'un paramètre (configurateur) ---------- */
.field-editor { position: relative; }
.field-options {
  position: absolute; top: 46px; right: 12px; z-index: 30; width: 260px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px 14px;
}
.field-options .check { margin-top: 0; }

/* ---------- Erreur / succès de formulaire ---------- */
.form-error {
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}
.form-ok {
  background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}

/* ---------- Bannière e-mail de récupération (accueil connecté) ---------- */
.banner-mail { margin-bottom: 24px; display: flex; flex-direction: column; gap: 10px; }
.banner-text { font-size: 14px; color: #374151; line-height: 1.5; }
.banner-form { display: flex; gap: 8px; }
.banner-form .input { max-width: 280px; }

/* ---------- Encoche taille façon "traitement de texte" ---------- */
.size-stepper { display: flex; align-items: stretch; }
.size-input { width: 34px; text-align: center; border-radius: 10px 0 0 10px; padding: 8px 4px; font-size: 13px; }
.size-val { font-size: 11px; color: var(--muted); min-width: 30px; }
.tg-btn .ic, .align-btn .ic { width: 15px; height: 15px; }

/* ---------- Réordonnancement des paramètres (drag & drop + flèches) ---------- */
.fe-left { display: flex; flex-direction: column; align-items: center; gap: 1px; flex: none; }
.grip { color: #c3c8d4; cursor: grab; display: grid; place-items: center; }
.grip .ic { width: 14px; height: 14px; }
.icon-btn.mini { width: 22px; height: 18px; border-radius: 6px; }
.icon-btn.mini .ic { width: 12px; height: 12px; }
.field-editor.dragging { opacity: .45; }
.field-editor.drag-over-top { box-shadow: 0 -3px 0 0 var(--primary); }
.field-editor.drag-over-bottom { box-shadow: 0 3px 0 0 var(--primary); }

/* ---------- Page Gérer les listes ---------- */
.lists-tabs { max-width: 480px; margin-bottom: 22px; }
.list-name-input { max-width: 220px; font-weight: 700; }
.color-btn.mini { width: 28px; height: 28px; }
.color-btn.mini .glyph-bg { width: 16px; height: 16px; font-size: 10px; }
.list-fields { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 4px; }
.list-field-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.list-field-row .input { max-width: 240px; }
.list-item-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.list-item-row .item-name { max-width: 180px; font-weight: 600; }
.list-item-row .input.slim { max-width: 160px; }

/* ---------- Vue d'ensemble des listes (cliquer pour ouvrir) ---------- */
.list-card { cursor: pointer; }
.kind-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255, 255, 255, .88); color: #374151;
  font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
}
.list-color-dot {
  position: absolute; bottom: 12px; right: 12px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow);
}
/* ---------- Détail d'une liste perso : champs à valeurs (chips) ---------- */
.list-field-block { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; background: #fcfcfe; }
.list-values { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-soft); color: #4338ca;
  border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 13px; font-weight: 600;
}
.chip-x { border: none; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 50%; }
.chip-x:hover { background: rgba(0, 0, 0, .08); }
.value-add { display: inline-flex; gap: 6px; align-items: center; }
.value-add .input { max-width: 200px; }
.list-field-pick { margin-bottom: 8px; }
.list-field-pick-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.list-field-pick-values { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.listref-block { margin-top: 12px; }
.listref-title { color: var(--primary); }
.listref-entry { display: block; padding: 4px 10px; border-radius: 8px; margin-top: 6px; width: 100%; }
.entry-block .entry-text { flex: 1; min-width: 200px; font-weight: 600; }
.entry-options { position: absolute; z-index: 30; top: 44px; right: 12px; width: 280px; }
.entry-block { position: relative; }
.listref-contact { margin-top: 4px; }
.listref-contact .line { display: block; }

/* ---------- Page Contacts globale ---------- */
.dup-alert { position: relative; color: #d97706; width: 34px; }
.dup-alert:hover { background: #fef3c7; color: #b45309; }
.dup-count {
  position: absolute; top: -4px; right: -4px;
  background: #ef4444; color: #fff; font-size: 10px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 999px; display: grid; place-items: center; padding: 0 3px;
}
.person-row { cursor: pointer; }
.person-row:hover { background: #f8faff; }
.avatar.mini { width: 34px; height: 34px; font-size: 13px; flex: none; box-shadow: none; }
.avatar-img.mini { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.badge-row { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.groups-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.dup-panel h2 { color: #b45309; display: flex; align-items: center; gap: 8px; }
.dup-group { padding: 8px 0; border-top: 1px solid var(--border); }
.dup-group ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

/* ---------- Modales : choisir un contact / nouveau contact ---------- */
.pick-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 4px 8px; }
.pick-row { cursor: pointer; margin-top: 0; border-top: none; border-radius: 8px; padding: 8px 10px; }
.pick-row:hover { background: #f5f6ff; }
.pick-row input { flex: none; }
.contact-params { margin-top: 16px; border-top: 1px dashed var(--border); padding-top: 12px; }
.contact-params summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--primary); display: flex; align-items: center; gap: 6px; }
.cparams-list { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }

/* ---------- Popover ⚙ « Paramètres » d'une liste perso (configurateur) ---------- */
.listref-params { width: 460px; max-height: calc(100vh - 100px); overflow-y: auto; }
.listref-params .source-row { flex-wrap: wrap; }
.listref-params .dd { width: 100%; flex-basis: 100%; }
.listref-params .dd-menu { width: 100%; }
/* quand un menu déroulant est ouvert dedans, la fenêtre s'agrandit et ne coupe plus le menu */
.field-options.pop-open, .entry-contacts-menu.pop-open { max-height: none !important; overflow: visible !important; }
.dd-menu { z-index: 60; }

/* ---------- Menu contacts d'une entrée de liste (recherche + multi) ---------- */
.entry-contacts-menu { width: 320px; }
.entry-contacts-list { max-height: 190px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; }
.stepper-btns { display: flex; flex-direction: column; width: 20px; margin-left: -1px; }
.step-btn {
  flex: 1; border: 1px solid var(--border); background: #fbfbfd; color: var(--muted);
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.step-btn:first-child { border-radius: 0 10px 0 0; border-bottom: none; }
.step-btn:last-child { border-radius: 0 0 10px 0; }
.step-btn:hover { background: var(--primary-soft); color: var(--primary); }
.step-btn .ic { width: 12px; height: 12px; }

/* ---------- Page de présentation (déconnecté) ---------- */
.topbar-spacer { flex: 1; }
.btn.big { padding: 13px 22px; font-size: 15px; border-radius: 14px; }
.hero {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px;
  align-items: center; padding-top: 64px; padding-bottom: 48px;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-soft); color: #4f46e5;
  font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; margin-bottom: 18px;
}
.hero-badge .ic { width: 14px; height: 14px; }
.hero h1 { font-size: 46px; line-height: 1.08; letter-spacing: -.03em; margin: 0 0 18px; font-weight: 800; }
.hero-sub { font-size: 17px; color: var(--muted); line-height: 1.65; margin: 0 0 26px; max-width: 540px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-preview { display: grid; place-items: center; }
.hero-card { width: min(340px, 100%); transform: rotate(2deg); box-shadow: var(--shadow-lg); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding-bottom: 64px; }
.feature h3 { margin: 12px 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; border-top: 1px solid var(--border); }

/* ---------- Page de connexion / création de compte ---------- */
.auth-wrap { max-width: 430px; margin: 0 auto; padding: 56px 24px 80px; }
.auth-card h1 { margin: 0 0 8px; font-size: 22px; }
.auth-card > .muted { margin-bottom: 18px; display: block; }
.auth-tabs { display: flex; gap: 6px; background: #f3f4f6; padding: 5px; border-radius: 12px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; border: none; background: none; font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px; border-radius: 9px; cursor: pointer; color: var(--muted);
}
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.auth-alt { text-align: center; margin: 16px 0 0; font-size: 13px; }
.auth-alt a { color: var(--primary); font-weight: 600; }
.remember-check { margin: 2px 0 12px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero h1 { font-size: 36px; }
  .features { grid-template-columns: 1fr; }
}

/* ---------- Barre d'actions (haut à droite) ---------- */
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.menu-wrap { position: relative; }
/* menus ouverts vers le bas (Tri / Filtres / Exporter / Profil, situés à droite) : alignés sur le bord droit
   du bouton pour ne jamais être coupés par le bord droit de l'écran */
.add-menu.menu-down { top: calc(100% + 8px); bottom: auto; left: auto; right: 0; min-width: 320px; max-width: calc(100vw - 24px); }
/* icône profil tout à droite du topbar + son menu */
.profile-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.profile-menu { min-width: 300px; }
.profile-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.profile-head strong { display: block; font-size: 14px; }
.profile-head small { color: var(--muted); font-size: 12px; word-break: break-all; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.section-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em; margin: 26px 0 12px;
}
.badge-view { background: #fef3c7; color: #92400e; }
.trombi-rights {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255, 255, 255, .88); color: #374151;
  font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
}

/* ---------- Modale de partage ---------- */
.modal.wide { width: min(560px, 100%); }
.share-form-row { display: flex; gap: 8px; margin: 14px 0 10px; }
.share-form-row .input { flex: 1; }
.share-list-title {
  margin: 20px 0 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.share-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.share-mail { flex: 1; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Boutons de style (gras/italique/souligné + alignement) ---------- */
.tg-group, .align-group { display: flex; }
.tg-btn, .align-btn { border: 1px solid var(--border); width: 30px; height: 32px; font-size: 13px; border-radius: 0; font-weight: 800; }
.tg-btn:first-child { border-radius: 10px 0 0 10px; }
.tg-btn:last-child { border-radius: 0 10px 10px 0; }
.tg-btn + .tg-btn { border-left: none; }
.align-btn { width: 30px; }
.align-btn + .align-btn { border-left: none; }
.align-btn:first-child { border-radius: 10px 0 0 10px; }
.align-btn:last-child { border-radius: 0 10px 10px 0; }
.tg-btn.active, .align-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* L'export PDF est généré directement en fichier .pdf (assets/js/pdf.js) :
   plus de passage par la boîte d'impression du navigateur. */

/* ---------- Listes de contacts ---------- */
.contact-list-group { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: #fcfcfe; }
.contact-list-name { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.contact-list-name .ic { width: 14px; height: 14px; }
.contact-list-panel { margin-bottom: 20px; }
.contact-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.contact-list-head h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.contact-list-head h2 .ic { color: var(--primary); }
.contact-rows { display: flex; flex-direction: column; }
.contact-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.contact-row .contact-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-row .muted { font-size: 13px; }
.contact-add { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.contact-add .input { flex: 1; min-width: 110px; }

/* ---------- Taille de police : vraiment étroite (gagne sur .input/.input.slim) ---------- */
.style-bar .input.slim.size-input,
.input.slim.size-input { width: 34px !important; min-width: 34px; padding: 8px 2px; font-size: 13px; }
.size-ctl .size-val { min-width: 28px; font-size: 11px; }
.size-ctl .stepper-btns { width: 20px; }

/* ---------- Page Contacts : grille multi-colonnes + sélection ---------- */
.contacts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.contacts-grid .contact-row { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.contacts-grid .contact-who { font-weight: 600; }
.sel-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; }
.sel-bar .dd { min-width: 220px; }
.group-chip-link { cursor: pointer; }
.group-chip-link:hover { background: #e0e7ff; }

/* nom à gauche, prénom à droite dans le bloc contact d'une fiche */
.name-split { display: flex; justify-content: space-between; gap: 12px; }

/* ---------- Mode d'affichage Liste (accueil & listes) ---------- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg .tg-btn { border: 0; border-radius: 0; }
.trombi-listmode { columns: 3; column-gap: 14px; }
.trombi-li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 10px; break-inside: avoid;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 14px; }
.trombi-li:hover { border-color: var(--primary); }
.trombi-li .li-name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-dot { width: 14px; height: 14px; border-radius: 5px; flex: none; }
@media (max-width: 1100px) { .trombi-listmode { columns: 2; } }
@media (max-width: 700px) { .trombi-listmode { columns: 1; } }

/* ---------- étiquette Pro/Perso sur les numéros ---------- */
.phone-tag { width: auto; flex: none; }
.multi-row { align-items: center; }
.tag { display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 7px; border-radius: 999px; vertical-align: 1px; }
.tag-pro { background: #dbeafe; color: #1d4ed8; }
.tag-perso { background: #fef3c7; color: #b45309; }

/* poignée de drag & drop (seule zone draggable du configurateur) */
.grip { cursor: grab; touch-action: none; display: inline-flex; }
.field-editor.dragging { opacity: .6; }

/* bascule de mode d'affichage : gros boutons explicites */
.page-head { align-items: flex-start; }
.page-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.seg-view .tg-btn { padding: 9px 16px; font-size: 14px; font-weight: 800; display: inline-flex; align-items: center; gap: 7px; }
.seg-view .tg-btn .ic { width: 17px; height: 17px; }

/* dropdown Pro/Perso compact à droite du numéro */
.phone-tag-dd { flex: none; width: auto; }
.phone-tag-dd .dd { width: auto; }
.phone-tag-dd .dd-btn { width: auto; min-width: 86px; padding: 7px 10px; font-size: 13px; font-weight: 700; justify-content: space-between; }
