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

:root {
  --primary:      #4f46e5;
  --primary-dk:   #3730a3;
  --primary-lt:   #eef2ff;
  --primary-mid:  #c7d2fe;
  --sidebar-w:    220px;
  --topbar-h:     46px;
  --bg:           #f0f0f1;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --border-lt:    #f1f5f9;
  --text:         #0f172a;
  --text-2:       #475569;
  --text-3:       #94a3b8;
  --danger:       #ef4444;
  --danger-dk:    #dc2626;
  --success:      #10b981;
  --r:            10px;
  --r-sm:         7px;
  --sh:           0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --sh-md:        0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --sh-lg:        0 20px 40px rgba(0,0,0,.12);
  --sidebar-bg:        #faf7f2;
  --sidebar-bd:        rgba(0,0,0,.07);
  --sidebar-text:      #111827;
  --sidebar-fs:        .82rem;
  --highlight-color:   #2271b1;
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.5; font-size: 14px; -webkit-font-smoothing: antialiased;
}

.page { display: none !important; }
.page.active { display: flex !important; }

/* ═══════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════ */
#page-login {
  height: 100vh; align-items: center; justify-content: center;
  background: #0f172a; position: relative; overflow: auto;
}
#page-login::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 50%, rgba(79,70,229,.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 70%, rgba(99,102,241,.2) 0%, transparent 55%);
}
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 380px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px; padding: 2.5rem 2rem;
  backdrop-filter: blur(24px); box-shadow: 0 32px 64px rgba(0,0,0,.5);
}
.login-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 2.25rem; }
.login-brand-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; box-shadow: 0 4px 16px rgba(79,70,229,.5);
}
.login-brand-text h1 { font-size: 1.2rem; font-weight: 700; color: #f8fafc; }
.login-brand-text p  { font-size: .75rem; color: rgba(255,255,255,.45); margin-top: 1px; }
.login-card .field label { color: rgba(255,255,255,.7); font-size: .8rem; }
.login-card .field input {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15);
  color: #f1f5f9; border-radius: var(--r-sm);
}
.login-card .field input::placeholder { color: rgba(255,255,255,.3); }
.login-card .field input:focus {
  border-color: #818cf8; background: rgba(255,255,255,.11);
  outline: none; box-shadow: 0 0 0 3px rgba(129,140,248,.2);
}
.btn-login {
  width: 100%; margin-top: .25rem; padding: .7rem; border: none; border-radius: var(--r-sm);
  background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff;
  font-size: .9rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 16px rgba(79,70,229,.45); transition: all .2s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(79,70,229,.55); }

/* ═══════════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════════ */
#page-app { height: 100vh; flex-direction: row; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
  box-shadow: 1px 0 0 var(--sidebar-bd), 2px 0 8px rgba(0,0,0,.04);
}

.sidebar-header {
  padding: 1.1rem 1rem .9rem;
  border-bottom: 1px solid var(--sidebar-bd);
}
.sidebar-logo { display: flex; align-items: center; gap: .65rem; }
.sidebar-logo-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #818cf8, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; box-shadow: 0 2px 8px rgba(79,70,229,.5);
}
.sidebar-logo span  { font-size: .9rem; font-weight: 700; color: var(--sidebar-text); letter-spacing: -.01em; }
.sidebar-logo small { font-size: .62rem; color: color-mix(in srgb, var(--sidebar-text) 45%, var(--sidebar-bg)); display: block; }

.sidebar-user {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--sidebar-bd);
  display: flex; align-items: center; gap: .6rem;
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff;
}
.user-name { font-size: .8rem; font-weight: 600; color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .65rem; color: color-mix(in srgb, var(--sidebar-text) 45%, var(--sidebar-bg)); }

.sidebar-nav { flex: 1; padding: .5rem .6rem; }
.nav-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem; border-radius: 6px;
  border: none; background: none; width: 100%; text-align: left;
  color: color-mix(in srgb, var(--sidebar-text) 75%, var(--sidebar-bg)); font-size: var(--sidebar-fs); font-weight: 600;
  cursor: pointer; transition: all .15s; position: relative;
}
.nav-item:hover  { background: color-mix(in srgb, var(--sidebar-text) 9%, var(--sidebar-bg)); color: var(--sidebar-text); }

/* ── Surbrillance — style rempli (défaut, WordPress) */
.nav-item.active {
  background: var(--highlight-color); color: #ffffff;
  font-weight: 600; box-shadow: none; border-radius: 6px;
}

/* Variante flèche (style WordPress) */
.sidebar.hl-arrow .nav-item.active {
  border-radius: 6px 0 0 6px;
}
.sidebar.hl-arrow .nav-item.active::after {
  content: ''; position: absolute;
  right: 0; top: 50%; transform: translateY(-50%);
  width: 0; height: 0;
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
  border-right: 12px solid var(--bg);
  pointer-events: none; z-index: 2;
}

/* Variante pilule */
.sidebar.hl-pill .nav-item.active { border-radius: 99px; }

/* Variante bordure (style original) */
.sidebar.hl-border .nav-item.active {
  background: color-mix(in srgb, var(--highlight-color) 13%, var(--sidebar-bg));
  color: var(--highlight-color);
  box-shadow: inset 3px 0 0 var(--highlight-color);
  border-radius: 6px;
}
.nav-item-icon   { font-size: .88rem; width: 18px; text-align: center; flex-shrink: 0; }

.nav-badge {
  margin-left: auto; background: #ef4444; color: #fff;
  font-size: .6rem; font-weight: 700; padding: .1rem .35rem;
  border-radius: 99px; min-width: 18px; text-align: center;
}

.sidebar-footer { padding: .5rem .6rem .875rem; border-top: 1px solid var(--sidebar-bd); }
.btn-logout-side {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem; border-radius: 6px;
  border: none; background: none; width: 100%; text-align: left;
  color: color-mix(in srgb, var(--sidebar-text) 45%, var(--sidebar-bg)); font-size: .82rem; cursor: pointer;
  transition: all .15s; margin-top: .1rem;
}
.btn-logout-side:hover { background: rgba(239,68,68,.12); color: #ef4444; }

/* ── MAIN ─────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  background: var(--sidebar-bg); border-bottom: 1px solid var(--sidebar-bd);
  padding: .3rem 1.25rem; display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04); min-height: var(--topbar-h);
}
.topbar-left { display: flex; align-items: center; gap: .5rem; }
.topbar-title { font-size: .875rem; font-weight: 700; color: var(--sidebar-text); }
.topbar-dot   { color: color-mix(in srgb, var(--sidebar-text) 40%, var(--sidebar-bg)); font-weight: 300; font-size: .9rem; }
.topbar-sub   { font-size: .78rem; color: color-mix(in srgb, var(--sidebar-text) 40%, var(--sidebar-bg)); }

/* Barre de recherche + filtres */
.sticky-search {
  flex-shrink: 0; background: var(--bg);
  padding: .6rem 1.25rem; border-bottom: 1px solid var(--border-lt);
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}
.sticky-search .toolbar { margin-bottom: 0; }

.view-body { flex: 1; overflow: hidden; min-height: 0; padding: 1rem 1.25rem 1.5rem; display: flex; flex-direction: column; }

.view { display: none; }
.view.active { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* ── TOOLBAR ─────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.search-wrap { flex: 1; min-width: 200px; position: relative; }
.search-icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; font-size: .85rem; }
.search-box {
  width: 100%; padding: .5rem .8rem .5rem 2.2rem;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: .855rem; background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.search-box:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }

/* Filtres statut */
.status-filters { display: flex; gap: .25rem; }
.sf-btn {
  padding: .3rem .65rem; border-radius: 99px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: .75rem; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all .12s; font-family: inherit;
}
.sf-btn:hover { border-color: var(--primary-mid); color: var(--primary); }
.sf-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.sf-btn[data-statut="en_cours"].active  { background: #2563eb; border-color: #2563eb; }
.sf-btn[data-statut="en_attente"].active{ background: #d97706; border-color: #d97706; }
.sf-btn[data-statut="cloture"].active   { background: #6b7280; border-color: #6b7280; }

/* Scope toggle admin */
.scope-toggle { display: flex; border: 1.5px solid var(--border); border-radius: var(--r-sm); overflow: hidden; }
.scope-btn {
  padding: .3rem .7rem; border: none; background: none;
  font-size: .78rem; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: all .12s; font-family: inherit; white-space: nowrap;
}
.scope-btn:hover { background: var(--bg); }
.scope-btn.active { background: var(--primary-lt); color: var(--primary); }

.view-toggle { display: flex; border: 1.5px solid var(--border); border-radius: var(--r-sm); overflow: hidden; flex-shrink: 0; }
.view-toggle-btn { background: none; border: none; padding: .38rem .6rem; cursor: pointer; font-size: .9rem; color: var(--text-3); transition: all .15s; line-height: 1; }
.view-toggle-btn:hover  { background: var(--bg); color: var(--text); }
.view-toggle-btn.active { background: var(--primary-lt); color: var(--primary); }

/* ═══════════════════════════════════════════
   BADGES STATUT
═══════════════════════════════════════════ */
.statut-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .7rem; font-weight: 600; padding: .18rem .55rem;
  border-radius: 99px; white-space: nowrap;
}
.statut-en_cours  { background: #dbeafe; color: #1e40af; }
.statut-en_attente{ background: #fef3c7; color: #92400e; }
.statut-cloture   { background: #f1f5f9; color: #475569; }

/* ═══════════════════════════════════════════
   VUE LISTE
═══════════════════════════════════════════ */
#dossiers-list { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.dl-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; display: flex; flex-direction: column; flex: 1; min-height: 0; }

.dl-header {
  display: grid;
  grid-template-columns: 28px 2fr 1.1fr 1.1fr 90px 100px 90px 80px;
  gap: 0 .75rem; padding: .45rem 1rem;
  background: var(--bg); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.dl-rows-wrapper { flex: 1; overflow-y: auto; min-height: 0; }
.dl-header span {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .055em; color: var(--text-3);
  white-space: nowrap; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: .25rem;
}
.dl-header span:hover { color: var(--primary); }
.dl-header span.sort-active { color: var(--primary); }
.sort-arr { font-size: .6rem; opacity: .6; }

.dl-row {
  display: grid;
  grid-template-columns: 28px 2fr 1.1fr 1.1fr 90px 100px 90px 80px;
  gap: 0 .75rem; padding: .5rem 1rem;
  border-bottom: 1px solid var(--border-lt); align-items: center;
  transition: background .1s; cursor: pointer;
}
.dl-row:last-child { border-bottom: none; }
.dl-row:hover { background: #f8f9ff; }
.dl-row:hover .dl-actions { opacity: 1; pointer-events: auto; }

.dl-av {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.av-0{background:linear-gradient(135deg,#667eea,#764ba2);}
.av-1{background:linear-gradient(135deg,#4facfe,#00f2fe);color:#0f172a}
.av-2{background:linear-gradient(135deg,#43e97b,#38f9d7);color:#0f172a}
.av-3{background:linear-gradient(135deg,#fa709a,#fee140);}
.av-4{background:linear-gradient(135deg,#a18cd1,#fbc2eb);}
.av-5{background:linear-gradient(135deg,#f093fb,#f5576c);}
.av-6{background:linear-gradient(135deg,#4481eb,#04befe);}
.av-7{background:linear-gradient(135deg,#0ba360,#3cba92);}
.av-8{background:linear-gradient(135deg,#f7971e,#ffd200);color:#0f172a}
.av-9{background:linear-gradient(135deg,#ee0979,#ff6a00);}

.dl-nom-cell { min-width: 0; }
.dl-nom { font-size: .855rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: .4rem; }
.dl-sub { font-size: .72rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; display: flex; gap: .3rem; align-items: center; }

.chip { display: inline-flex; align-items: center; font-size: .63rem; font-weight: 600; padding: .1rem .38rem; border-radius: 4px; white-space: nowrap; }
.chip-siren { background: var(--primary-lt); color: var(--primary); }
.chip-forme { background: #f1f5f9; color: var(--text-2); }
.chip-naf   { background: #f0fdf4; color: #166534; }

.dl-cell { font-size: .815rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-cell.muted { color: var(--text-3); font-size: .78rem; }

.dl-comp { display: flex; align-items: center; gap: .4rem; }
.dl-mini-av {
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg,#06b6d4,#0891b2);
  color: #fff; font-size: .58rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.dl-actions { display: flex; gap: .2rem; justify-content: flex-end; opacity: 0; transition: opacity .12s; pointer-events: none; }

/* ═══════════════════════════════════════════
   VUE GRILLE
═══════════════════════════════════════════ */
.dossiers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .875rem; }
.dossier-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1.1rem; box-shadow: var(--sh); transition: all .2s; position: relative; overflow: hidden; cursor: pointer;
}
.dossier-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; opacity: 0; transition: opacity .2s; }
.dossier-card:hover { border-color: var(--primary-mid); box-shadow: var(--sh-md); transform: translateY(-2px); }
.dossier-card:hover::before { opacity: 1; background: linear-gradient(90deg, var(--primary), #06b6d4); }
.dossier-header { display: flex; align-items: flex-start; gap: .65rem; margin-bottom: .6rem; }
.dossier-avatar { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.dossier-nom { font-size: .875rem; font-weight: 600; }
.dossier-chips { display: flex; gap: .25rem; flex-wrap: wrap; margin-top: .25rem; }
.dossier-contact { font-size: .78rem; color: var(--text-2); display: flex; align-items: center; gap: .3rem; margin-bottom: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dossier-footer { display: flex; align-items: center; gap: .4rem; margin-top: .75rem; padding-top: .65rem; border-top: 1px solid var(--border-lt); }
.dossier-date { font-size: .7rem; color: var(--text-3); flex: 1; }
.dossier-tags { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: .3rem; }
.tag { font-size: .67rem; font-weight: 500; background: #f1f5f9; color: var(--text-2); border: 1px solid var(--border); padding: .12rem .42rem; border-radius: 4px; }

/* ═══════════════════════════════════════════
   PAGINATION
═══════════════════════════════════════════ */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem 1rem; border-top: 1px solid var(--border);
  background: var(--bg); border-radius: 0 0 var(--r) var(--r);
  flex-wrap: wrap; gap: .5rem; flex-shrink: 0;
}
.pagination-info { font-size: .78rem; color: var(--text-3); }
.pagination-info strong { color: var(--text-2); }
.pagination-controls { display: flex; align-items: center; gap: .25rem; }
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 .5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text-2);
  font-size: .8rem; font-weight: 500; cursor: pointer; transition: all .12s; font-family: inherit;
}
.pg-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-lt); }
.pg-btn:disabled { opacity: .35; cursor: default; }
.pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pg-ellipsis { font-size: .8rem; color: var(--text-3); padding: 0 .2rem; }
.page-size-select {
  border: 1px solid var(--border); border-radius: 6px;
  padding: .3rem .5rem; font-size: .78rem; color: var(--text-2);
  background: var(--surface); cursor: pointer; outline: none; font-family: inherit;
}
.page-size-select:focus { border-color: var(--primary); }

/* ═══════════════════════════════════════════
   STATS ADMIN
═══════════════════════════════════════════ */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: .875rem; margin-bottom: 1.25rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1rem 1.1rem; display: flex; align-items: center; gap: .875rem; box-shadow: var(--sh);
}
.stat-icon { width: 40px; height: 40px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.stat-icon.blue  { background: #eff6ff; }
.stat-icon.green { background: #f0fdf4; }
.stat-icon.red   { background: #fef2f2; }
.stat-num   { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .73rem; color: var(--text-3); margin-top: 2px; }

/* ═══════════════════════════════════════════
   TABLE ADMIN
═══════════════════════════════════════════ */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg); }
th { padding: .6rem 1.1rem; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); text-align: left; border-bottom: 1px solid var(--border); }
td { padding: .8rem 1.1rem; font-size: .855rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
.role-badge { display: inline-flex; align-items: center; gap: .25rem; font-size: .7rem; font-weight: 600; padding: .17rem .55rem; border-radius: 99px; }
.role-admin         { background: #fef3c7; color: #92400e; }
.role-collaborateur { background: #dbeafe; color: #1e40af; }

/* ── Gestion des dossiers (admin) — layout parent/enfant ── */
#tab-dossiers-admin, #tab-logs { padding: 0 !important; }
.gd-layout {
  display: flex; height: 100%; min-height: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--sh);
}
/* Panneau gauche */
.gd-left { width: 200px; flex-shrink: 0; border-right: 1px solid var(--border); overflow-y: auto; }
.gd-left-header {
  padding: .55rem .9rem; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-3);
  border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0;
}
.gd-owner-item {
  display: flex; align-items: center; justify-content: space-between; gap: .4rem;
  padding: .62rem .9rem; font-size: .82rem; cursor: pointer;
  border-bottom: 1px solid var(--border-lt);
}
.gd-owner-item:hover { background: var(--bg); }
.gd-owner-item.active {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary); font-weight: 600;
  border-left: 3px solid var(--primary); padding-left: calc(.9rem - 3px);
}
.gd-owner-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.gd-owner-count {
  font-size: .68rem; font-weight: 600; padding: .1rem .4rem; border-radius: 99px;
  white-space: nowrap; flex-shrink: 0; background: var(--border); color: var(--text-3);
}
.gd-owner-item.active .gd-owner-count { background: var(--primary); color: #fff; }
/* Panneau droit */
.gd-right { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: .875rem; gap: .7rem; overflow: hidden; }
.gd-toolbar { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.gd-count { font-size: .8rem; color: var(--text-3); white-space: nowrap; }
.gd-table-wrap { flex: 1; overflow-y: auto; }
.gd-table-wrap table { table-layout: fixed; }
.gd-table-wrap td, .gd-table-wrap th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
tr.gd-selected { background: #eef2ff !important; }

/* ═══════════════════════════════════════════
   ONGLETS ADMIN
═══════════════════════════════════════════ */
.admin-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0; padding: 0 1.25rem;
}
.admin-tab {
  padding: .65rem 1rem; font-size: .82rem; font-weight: 500;
  border: none; background: none; cursor: pointer; color: var(--text-3);
  border-bottom: 2px solid transparent; transition: all .15s;
  font-family: inherit; white-space: nowrap; margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text-2); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: flex; flex: 1; flex-direction: column; min-height: 0; }
/* onglets qui scrollent librement */
#tab-collaborateurs.active,
#tab-activite.active,
#tab-parametres.active { overflow-y: auto; }
/* onglet dossiers : ne scrolle pas — la gd-layout gère l'espace */
#tab-dossiers-admin.active, #tab-logs.active { overflow: hidden; padding: 0 !important; }
#view-admin .view-body { overflow: hidden; }

/* ═══════════════════════════════════════════
   JOURNAL D'ACTIVITÉ
═══════════════════════════════════════════ */
/* ── Logs dossiers ─────────────────────────────── */
.logs-toolbar { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; flex-shrink: 0; }
.logs-filters { display: flex; gap: .35rem; }
.log-filter-btn {
  padding: .3rem .75rem; border-radius: 99px; font-size: .75rem; font-weight: 600;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.log-filter-btn:hover { background: var(--bg); }
.log-filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.logs-status { font-size: .75rem; color: var(--text-3); }
.logs-list {
  flex: 1; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh);
}
.log-row {
  display: grid; grid-template-columns: 28px 90px 80px 1fr auto;
  align-items: center; gap: .75rem;
  padding: .55rem 1rem; border-bottom: 1px solid var(--border-lt);
  font-size: .8rem;
}
.log-row:last-child { border-bottom: none; }
.log-icon { width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: .75rem; }
.log-time { font-size: .72rem; color: var(--text-3); white-space: nowrap; }
.log-user { font-size: .75rem; font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-detail { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-siren { font-family: monospace; font-size: .72rem; color: var(--text-3); white-space: nowrap; }

.activity-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .875rem; }
.section-title { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.activity-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh); }
.activity-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .65rem 1rem; border-bottom: 1px solid var(--border-lt);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.act-create { background: #dcfce7; }
.act-update { background: #dbeafe; }
.act-delete { background: #fee2e2; }
.activity-body { flex: 1; min-width: 0; }
.activity-desc { font-size: .82rem; color: var(--text); }
.activity-meta { font-size: .72rem; color: var(--text-3); margin-top: 2px; }
.act-user { font-weight: 600; color: var(--text-2); }

/* ═══════════════════════════════════════════
   VOLET SOCIAL
═══════════════════════════════════════════ */
#view-social .dl-header,
#view-social .dl-row {
  grid-template-columns: 28px 2fr 1.1fr 1.3fr 1fr 1fr 88px 60px;
}
#social-list { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.social-filters {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem 1rem .45rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.filter-group { display: flex; gap: .3rem; flex-wrap: wrap; }
.filter-sep   { width: 1px; height: 18px; background: var(--border); align-self: center; }
.filter-pill {
  padding: .2rem .7rem;
  font-size: .76rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg);
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1.5;
}
.filter-pill:hover   { border-color: var(--primary); color: var(--primary); }
.filter-pill.active  { background: var(--primary); border-color: var(--primary); color: #fff; }
.cov-badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .74rem;
  font-weight: 600;
  white-space: nowrap;
}
.cov-cabinet { background: #dcfce7; color: #166534; }
.cov-client  { background: #dbeafe; color: #1d4ed8; }
.cov-none    { color: var(--text-3); }
.social-toolbar-count {
  margin-left: auto;
  font-size: .78rem;
  color: var(--text-3);
  white-space: nowrap;
  padding: .2rem .6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 99px;
}
.social-layout {
  display: flex; height: 100%; min-height: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--sh);
}

/* Panneau gauche dossiers */
.social-left { width: 230px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.social-left-search { padding: .6rem .75rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.social-left-search .search-box { border: none; background: transparent; outline: none; font-size: .82rem; width: 100%; }
#social-dossiers-list { flex: 1; overflow-y: auto; }

.social-dossier-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .6rem .85rem; font-size: .82rem; cursor: pointer;
  border-bottom: 1px solid var(--border-lt);
}
.social-dossier-item:hover { background: var(--bg); }
.social-dossier-item.active { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); font-weight: 600; border-left: 3px solid var(--primary); padding-left: calc(.85rem - 3px); }
.social-dossier-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.social-cred-dot { font-size: .6rem; line-height: 1; }
.social-cred-dot.has-cred { color: #16a34a; }
.social-cred-dot.no-cred  { color: var(--border); }

/* Panneau droit */
.social-right { flex: 1; min-width: 0; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.social-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text-3); gap: .75rem; }
.social-empty-icon { font-size: 2.5rem; }
.social-empty p { font-size: .9rem; }

.social-dossier-header { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); padding: .75rem 1rem; }
.social-dossier-header .sdh-nom { font-size: 1rem; font-weight: 700; color: var(--text); }
.social-dossier-header .sdh-meta { font-size: .78rem; color: var(--text-3); margin-top: 2px; }

.social-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .social-cards { grid-template-columns: 1fr; } }

.social-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.social-card-header { display: flex; align-items: flex-start; justify-content: space-between; padding: .85rem 1rem .6rem; border-bottom: 1px solid var(--border-lt); }
.social-card-title { font-size: .87rem; font-weight: 700; color: var(--text); }
.social-card-sub   { font-size: .72rem; color: var(--text-3); margin-top: 2px; }
.social-card-body  { padding: .85rem 1rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.social-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; margin-top: .25rem; }

/* Password toggle */
.pwd-wrap { display: flex; position: relative; }
.pwd-wrap .input-text { flex: 1; padding-right: 2.2rem; }
.btn-pwd-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: .85rem; color: var(--text-3); padding: 0; }

/* Champ générique */
.field { display: flex; flex-direction: column; gap: .25rem; }
.field label { font-size: .75rem; font-weight: 600; color: var(--text-2); }
.input-text { padding: .5rem .7rem; border: 1.5px solid var(--border); border-radius: var(--r-sm); font-size: .855rem; outline: none; font-family: inherit; color: var(--text); background: var(--surface); }
.input-text:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
textarea.input-text { resize: vertical; }
.field-msg { font-size: .75rem; flex: 1; }
.field-msg.ok  { color: var(--success); }
.field-msg.err { color: var(--danger);  }
.btn-screenshot { display: inline-block; margin-left: .35rem; font-size: .9rem; text-decoration: none; opacity: .85; }
.btn-screenshot:hover { opacity: 1; }

/* ═══════════════════════════════════════════
   PARAMÈTRES SCRAPE
═══════════════════════════════════════════ */
#tab-scrape.active { overflow: hidden; padding: 0 !important; }
.scrape-layout { display: flex; height: 100%; min-height: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--sh); }
#scrape-panel-client { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#scrape-panel-tasks   { flex: 1; min-height: 0; overflow-y: auto; }
#scrape-panel-cabinet { flex: 1; min-height: 0; overflow-y: auto; }
.settings-card-title { font-size: .9rem; font-weight: 700; margin-bottom: .2rem; }
.settings-card-desc  { font-size: .79rem; color: var(--text-3); margin-bottom: .9rem; }
.scrape-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.scrape-actions { display: flex; align-items: center; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }
.scrape-task-bar { display: flex; align-items: center; gap: .75rem; }
.scrape-sync-status { font-size: .8rem; color: var(--text-3); }
.scrape-sync-result { margin-top: .75rem; padding: .75rem 1rem; border-radius: var(--r-sm); font-size: .82rem; background: var(--bg); border: 1px solid var(--border); }
.scrape-sync-result.ok  { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.scrape-sync-result.warn{ background: #fefce8; border-color: #fde68a; color: #854d0e; }
.scrape-sync-result.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* ── Tâches scrape ── */
.task-card            { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1rem; margin-top: .75rem; background: var(--bg); }
.task-card-header     { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.task-card-info       { flex: 1; }
.task-card-name       { font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
.task-card-desc       { font-size: .78rem; color: var(--text-3); line-height: 1.4; }
.task-card-btns       { display: flex; gap: .5rem; flex-shrink: 0; align-items: center; }
.btn-sm               { padding: .25rem .75rem; font-size: .8rem; }
.btn-danger           { background: #dc2626; color: #fff; border: none; border-radius: var(--r-sm); cursor: pointer; font-weight: 500; }
.btn-danger:hover     { background: #b91c1c; }
.jobs-table           { width: 100%; font-size: .82rem; border-collapse: collapse; }
.jobs-table th        { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-3); font-weight: 600; padding: .45rem .6rem; text-align: left; border-bottom: 1px solid var(--border); }
.jobs-table td        { padding: .45rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.jobs-table tr:last-child td { border-bottom: none; }
.job-badge            { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.job-badge.running    { background: #eff6ff; color: #1d4ed8; }
.job-badge.done       { background: #f0fdf4; color: #166534; }
.job-badge.error      { background: #fef2f2; color: #991b1b; }
.job-badge.cancelled  { background: #f3f4f6; color: #6b7280; }

/* ═══════════════════════════════════════════
   PARAMÈTRES
═══════════════════════════════════════════ */
.settings-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1.25rem 1.5rem; box-shadow: var(--sh); max-width: 680px; margin-bottom: 1rem;
}
.settings-card:last-child { margin-bottom: 0; }
.settings-title { font-size: .9rem; font-weight: 700; margin-bottom: .35rem; }
.settings-desc  { font-size: .8rem; color: var(--text-3); margin-bottom: 1rem; }
.settings-row { display: flex; align-items: center; gap: .75rem; }
.settings-row label { font-size: .82rem; font-weight: 500; white-space: nowrap; }
.settings-input { width: 80px; padding: .45rem .6rem; border: 1.5px solid var(--border); border-radius: var(--r-sm); font-size: .855rem; outline: none; font-family: inherit; }
.settings-input:focus { border-color: var(--primary); }
.settings-ok  { color: var(--success); font-size: .8rem; margin-top: .5rem; }
.settings-err { color: var(--danger);  font-size: .8rem; margin-top: .5rem; }

/* ═══════════════════════════════════════════
   DRAWER DOSSIER
═══════════════════════════════════════════ */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15,23,42,.3); backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 301;
  width: 420px; max-width: 100vw;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,.12);
  animation: slideInRight .2s ease;
}
@keyframes slideInRight { from { transform: translateX(100%) } to { transform: translateX(0) } }

.drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 1rem 1.1rem .9rem; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.drawer-sub   { font-size: .75rem; color: var(--text-3); margin-top: 2px; }

.drawer-body { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; }

.drawer-statut-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .875rem; }

.drawer-section { margin-bottom: 1.1rem; }
.drawer-field { display: flex; gap: .5rem; margin-bottom: .4rem; align-items: flex-start; }
.df-label { font-size: .72rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; min-width: 110px; flex-shrink: 0; padding-top: .05rem; }
.df-val   { font-size: .82rem; color: var(--text); }

.drawer-notes-text { font-size: .82rem; color: var(--text-2); white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border-lt); border-radius: var(--r-sm); padding: .6rem .8rem; line-height: 1.6; }

/* Journal de notes dans le drawer */
.note-add-wrap { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .75rem; }
.note-input {
  width: 100%; padding: .55rem .8rem; border: 1.5px solid var(--border);
  border-radius: var(--r-sm); font-size: .82rem; outline: none; resize: vertical;
  font-family: inherit; transition: border-color .15s;
}
.note-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.btn-sm { padding: .35rem .85rem; font-size: .8rem; align-self: flex-end; }

.notes-list { display: flex; flex-direction: column; gap: .4rem; }
.note-item {
  background: var(--bg); border: 1px solid var(--border-lt);
  border-radius: var(--r-sm); padding: .55rem .75rem;
  position: relative;
}
.note-item:hover .note-delete { opacity: 1; }
.note-body   { font-size: .82rem; color: var(--text); white-space: pre-wrap; line-height: 1.5; }
.note-footer { display: flex; align-items: center; gap: .4rem; margin-top: .3rem; }
.note-author { font-size: .7rem; font-weight: 600; color: var(--primary); }
.note-date   { font-size: .68rem; color: var(--text-3); }
.note-delete {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: .78rem; opacity: 0; transition: opacity .12s;
  padding: .1rem .3rem; border-radius: 4px;
}
.note-delete:hover { color: var(--danger); }

.drawer-footer {
  padding: .75rem 1.1rem; border-top: 1px solid var(--border);
  display: flex; gap: .6rem; justify-content: flex-end; flex-shrink: 0;
  background: var(--surface);
}

/* ═══════════════════════════════════════════
   EMPTY
═══════════════════════════════════════════ */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 5rem 2rem; text-align: center; color: var(--text-3); }
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-2); margin-bottom: .35rem; }
.empty-state p  { font-size: .84rem; }

/* ═══════════════════════════════════════════
   BOUTONS
═══════════════════════════════════════════ */
.btn-primary {
  display: inline-flex; align-items: center; gap: .35rem;
  background: linear-gradient(135deg,#6366f1,#4f46e5); color: #fff;
  border: none; border-radius: var(--r-sm); padding: .55rem 1.05rem;
  font-size: .845rem; font-weight: 500; cursor: pointer; font-family: inherit;
  box-shadow: 0 2px 8px rgba(79,70,229,.3); transition: all .18s; white-space: nowrap;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(79,70,229,.4); }
.btn-secondary {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--surface); color: var(--text); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); padding: .53rem 1.05rem; font-size: .845rem;
  font-weight: 500; cursor: pointer; font-family: inherit; transition: all .15s;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--primary-mid); }
.btn-danger {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--danger); color: #fff; border: none; border-radius: var(--r-sm);
  padding: .55rem 1.05rem; font-size: .845rem; font-weight: 500; cursor: pointer; font-family: inherit; transition: all .15s;
}
.btn-danger:hover { background: var(--danger-dk); }
.btn-icon {
  display: inline-flex; align-items: center; gap: .25rem;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: .3rem .6rem; font-size: .775rem; color: var(--text-3);
  cursor: pointer; font-family: inherit; transition: all .12s; white-space: nowrap;
}
.btn-icon:hover { background: var(--bg); color: var(--text); border-color: var(--primary-mid); }
.btn-icon.edit:hover   { background: var(--primary-lt); color: var(--primary); border-color: var(--primary-mid); }
.btn-icon.delete:hover { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

/* ═══════════════════════════════════════════
   FORMS
═══════════════════════════════════════════ */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .79rem; font-weight: 500; margin-bottom: .3rem; color: var(--text); }
.field input, .field textarea, .field select {
  width: 100%; padding: .55rem .8rem;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: .855rem; outline: none; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.field textarea { resize: vertical; min-height: 72px; }
.req { color: var(--danger); }
.fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.field-divider { text-align: center; font-size: .72rem; color: var(--text-3); margin: .1rem 0 .75rem; }
.error-msg { color: #b91c1c; font-size: .79rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: 6px; padding: .45rem .7rem; margin-top: .4rem; }
/* ── Palette de couleur interface ─────────────── */
.color-palette      { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.text-color-palette { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.text-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: all .15s; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.text-swatch:hover  { transform: scale(1.15); }
.text-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.2); }
.settings-palette-label { font-size: .74rem; font-weight: 600; color: var(--text-2); margin-top: .75rem; margin-bottom: .15rem; display: block; }
.color-swatch {
  position: relative; width: 64px; height: 40px; border-radius: 7px;
  border: 2px solid transparent; cursor: pointer; overflow: hidden;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: .2rem; transition: all .13s;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.color-swatch:hover  { border-color: var(--primary-mid); transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.14); }
.color-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.18); }
.swatch-check {
  position: absolute; top: 3px; right: 4px;
  font-size: .66rem; font-weight: 700; color: var(--primary);
  display: none;
}
.color-swatch.active .swatch-check { display: block; }
.swatch-name {
  font-size: .52rem; color: #374151; font-weight: 500;
  background: rgba(255,255,255,.8); padding: .05rem .25rem;
  border-radius: 3px; white-space: nowrap; pointer-events: none;
}
.font-size-btns { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.fs-btn {
  padding: .35rem .85rem; border-radius: 6px; font-family: inherit; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2);
  font-weight: 500; transition: all .12s;
}
.fs-btn:hover  { border-color: var(--primary-mid); color: var(--primary); }
.fs-btn.active { background: var(--primary-lt); color: var(--primary); border-color: var(--primary-mid); font-weight: 600; }

.hl-color-palette { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.hl-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: all .15s; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.hl-swatch:hover  { transform: scale(1.18); }
.hl-swatch.active { border-color: #fff; box-shadow: 0 0 0 3px currentColor; outline: none; }

.hl-style-btns { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }
.hl-style-btn {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: .5rem .8rem; border-radius: 8px; border: 2px solid var(--border);
  background: var(--surface); cursor: pointer; font-family: inherit; transition: all .13s;
  min-width: 72px;
}
.hl-style-preview {
  width: 52px; height: 20px; border-radius: 4px; display: flex;
  align-items: center; padding: 0 6px; gap: 4px; flex-shrink: 0;
}
.hl-style-preview span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.7); flex-shrink: 0; }
.hl-style-preview em   { font-style: normal; font-size: .55rem; color: #fff; font-weight: 600; white-space: nowrap; }
.hl-style-btn .label { font-size: .7rem; color: var(--text-2); font-weight: 500; }
.hl-style-btn:hover  { border-color: var(--primary-mid); }
.hl-style-btn.active { border-color: var(--primary); background: var(--primary-lt); }
.hl-style-btn.active .label { color: var(--primary); font-weight: 600; }

.hidden { display: none !important; }

/* ═══════════════════════════════════════════
   MODALS
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 1rem; animation: fadeIn .15s ease;
}
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: translateY(0) } }
.modal {
  background: var(--surface); border-radius: 16px;
  padding: 1.75rem; width: 100%; max-width: 520px;
  box-shadow: var(--sh-lg); animation: slideUp .2s ease;
  border: 1px solid var(--border); max-height: 92vh; overflow-y: auto;
}
.modal-sm { max-width: 400px; }
.modal-import-box { max-width: 600px; }

/* ── Import ─────────────────────────────────────── */
.import-textarea {
  width: 100%; min-height: 180px; padding: .6rem .8rem;
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: .84rem; font-family: 'SF Mono', 'Consolas', monospace;
  outline: none; resize: vertical; color: var(--text); background: var(--surface);
  line-height: 1.6;
}
.import-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.import-hint { font-size: .76rem; color: var(--text-3); line-height: 1.7; margin-top: .5rem; }
.import-hint code { background: var(--border-lt); padding: .1rem .3rem; border-radius: 3px; font-family: monospace; }

.import-progress-wrap { padding: .5rem 0 1.5rem; }
.import-progress-bar {
  height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: .75rem;
}
#import-progress-fill {
  height: 100%; width: 0%; background: linear-gradient(90deg, #6366f1, #4f46e5);
  border-radius: 99px; transition: width .3s ease;
}
.import-progress-text { font-size: .84rem; color: var(--text-2); text-align: center; }

.import-summary {
  display: flex; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.import-stat {
  flex: 1; min-width: 80px; padding: .6rem .8rem; border-radius: var(--r-sm);
  text-align: center; border: 1px solid var(--border);
}
.import-stat .is-num  { font-size: 1.5rem; font-weight: 700; display: block; line-height: 1.2; }
.import-stat .is-lbl  { font-size: .68rem; color: var(--text-3); font-weight: 500; }
.import-stat.ok     { background: #f0fdf4; border-color: #bbf7d0; }
.import-stat.ok .is-num { color: #16a34a; }
.import-stat.skip   { background: #fefce8; border-color: #fde68a; }
.import-stat.skip .is-num { color: #ca8a04; }
.import-stat.error  { background: #fef2f2; border-color: #fecaca; }
.import-stat.error .is-num { color: #dc2626; }

.import-results-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.import-result-row {
  display: grid; grid-template-columns: 100px 1fr auto;
  align-items: center; gap: .75rem;
  padding: .45rem .75rem; border-bottom: 1px solid var(--border-lt);
  font-size: .8rem;
}
.import-result-row:last-child { border-bottom: none; }
.ir-siren { font-family: monospace; font-weight: 600; color: var(--text-2); }
.ir-nom   { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ir-badge { font-size: .68rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; white-space: nowrap; }
.ir-ok    { background: #dcfce7; color: #166534; }
.ir-api   { background: #dbeafe; color: #1e40af; }
.ir-skip  { background: #fef9c3; color: #854d0e; }
.ir-err   { background: #fee2e2; color: #991b1b; }
.modal-header { margin-bottom: 1.4rem; }
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-header p  { font-size: .79rem; color: var(--text-3); margin-top: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }

/* ═══════════════════════════════════════════
   SIREN / AUTOCOMPLETE
═══════════════════════════════════════════ */
.siren-input-wrap { position: relative; }
.siren-input-wrap input { padding-right: 150px; }
.siren-loader { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--text-3); }
.spinner { width: 13px; height: 13px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg) } }
.siren-badge { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 99px; white-space: nowrap; }
.siren-ok  { background: #dcfce7; color: #166534; }
.siren-nok { background: #fee2e2; color: #991b1b; }
.autocomplete-wrap { position: relative; }
.autocomplete-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1.5px solid var(--primary); border-radius: var(--r); box-shadow: var(--sh-md); z-index: 300; overflow: hidden; max-height: 300px; overflow-y: auto; }
.autocomplete-item { padding: .6rem .875rem; cursor: pointer; border-bottom: 1px solid var(--border-lt); transition: background .1s; }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--primary-lt); }
.ac-nom    { font-size: .855rem; font-weight: 600; }
.ac-detail { font-size: .73rem; color: var(--text-3); margin-top: 2px; display: flex; gap: .4rem; flex-wrap: wrap; }
.ac-siren  { font-weight: 700; color: var(--primary); }
.autocomplete-empty { padding: .7rem .875rem; font-size: .8rem; color: var(--text-3); text-align: center; }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .dossiers-grid { grid-template-columns: 1fr; }
  .dl-row, .dl-header { grid-template-columns: 28px 1fr 80px; }
  .fields-row { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .status-filters { display: none; }
}

