@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Loading screen ────────────────────────────────────────────── */
#app-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: #0b0f1a;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .4s ease, visibility .4s ease;
}
#app-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.loader-logo {
  width: 72px; height: 72px; border-radius: 20px;
  background: #2563eb;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: #fff;
  box-shadow: 0 0 40px rgba(37,99,235,.5);
  animation: loader-pulse 1.6s ease-in-out infinite;
}
@keyframes loader-pulse {
  0%,100% { box-shadow: 0 0 30px rgba(37,99,235,.4); }
  50%      { box-shadow: 0 0 60px rgba(37,99,235,.8); }
}
.loader-name { font-family: 'Inter', sans-serif; font-size: 22px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.loader-bar {
  width: 180px; height: 3px; background: rgba(255,255,255,.1); border-radius: 99px; overflow: hidden;
}
.loader-bar-fill {
  height: 100%; background: #2563eb; border-radius: 99px;
  animation: loader-fill 1.8s ease-in-out infinite;
}
@keyframes loader-fill {
  0%   { width: 0%;   margin-left: 0; }
  50%  { width: 70%;  margin-left: 15%; }
  100% { width: 0%;   margin-left: 100%; }
}
.loader-text { font-size: 12px; color: rgba(255,255,255,.4); letter-spacing: .3px; }

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

:root {
  --primary: #2563eb;
  --primary-light: #eff6ff;
  --primary-dark: #1d4ed8;
  --surface: #ffffff;
  --surface2: #f8faff;
  --surface3: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --rail-bg: #0b0f1a;
  --sidebar-bg: #111827;
  --sidebar-text: rgba(255,255,255,.65);
  --sidebar-text-active: #ffffff;
  --green: #10b981; --green-bg: #ecfdf5; --green-text: #065f46;
  --amber: #f59e0b; --amber-bg: #fffbeb; --amber-text: #92400e;
  --red: #ef4444; --red-bg: #fef2f2; --red-text: #991b1b;
  --blue: #3b82f6; --blue-bg: #eff6ff; --blue-text: #1e40af;
  --purple: #8b5cf6; --purple-bg: #f5f3ff; --purple-text: #5b21b6;
  --rail-w: 68px;
  --sidebar-w: 230px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--surface2);
  color: var(--text-1);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-user-select: none;
  user-select: none;
}

input, textarea, [contenteditable] {
  -webkit-user-select: text;
  user-select: text;
}

#app { display: flex; height: 100vh; }

.app-rail {
  width: var(--rail-w);
  background: #0b0f1a;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding: 0;
  z-index: 10;
}

.rail-logo {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
}
.rail-logo-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
}
.rail-logo-icon i { font-size: 22px; color: #fff; }

.rail-modules {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 0 8px;
  flex: 1;
}

.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 52px;
  height: 56px;
  border-radius: 12px;
  cursor: pointer;
  color: #4a5568;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: all 0.15s;
  position: relative;
}
.rail-item i { font-size: 20px; }
.rail-item:hover:not(.soon) { background: rgba(255,255,255,0.07); color: #cbd5e1; }
.rail-item.active { background: rgba(37,99,235,0.2); color: #93c5fd; }
.rail-item.active i { color: #a5b4fc; }

.rail-item.soon { cursor: default; opacity: 0.4; }
.rail-item.soon:hover { background: rgba(255,255,255,0.04); color: #4a5568; }

.rail-soon-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #64748b;
}

.rail-bottom {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.rail-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #1e293b;
  border: 1px solid #334155;
  display: flex; align-items: center; justify-content: center;
  color: #64748b;
  font-size: 16px;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.15s;
}
.rail-avatar:hover { border-color: #2563eb; color: #93c5fd; }

.sidebar {
  width: var(--sidebar-w);
  background: #111827;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid rgba(255,255,255,0.04);
  transition: width 0.18s ease;
  overflow: hidden;
}
.sidebar.hidden { display: none; }

.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .sidebar-module-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer {
  display: none;
}
.sidebar.collapsed .sidebar-module-header { justify-content: center; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 0.55rem; }
.sidebar.collapsed .sidebar-toggle-btn i { transform: rotate(180deg); }

.sidebar-module-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 6px;
}
.sidebar-module-text { flex: 1; min-width: 0; }
.sidebar-toggle-btn {
  background: none; border: none; color: #6b7280; cursor: pointer;
  width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.08); color: #d1d5db; }
.sidebar-toggle-btn i { font-size: 15px; transition: transform 0.18s ease; }
.module-icon-sm {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(37,99,235,0.2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.module-icon-sm i { font-size: 17px; color: #a5b4fc; }
.module-name { font-size: 13px; font-weight: 700; color: #e2e8f0; }
.module-version { font-size: 10px; color: #475569; margin-top: 1px; }

.sidebar-section { padding: 0 0.6rem; margin-bottom: 4px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.65rem 0.6rem 0.3rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0.55rem 0.7rem;
  color: #9ca3af;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.nav-link i { font-size: 17px; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,0.05); color: #d1d5db; }
.nav-link.active { background: rgba(37,99,235,0.18); color: #a5b4fc; }
.nav-link.active i { color: #93c5fd; }

.nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.07);
  color: #6b7280;
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 600;
}
.nav-link.active .nav-badge { background: rgba(37,99,235,0.3); color: #a5b4fc; }

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.05);
  padding: 6px 0.6rem 0;
}
.sidebar-footer { padding: 6px 0.7rem 1rem; font-size: 11px; color: #374151; display:none; }

.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.75rem;
  padding-right: 160px; /* espace pour les boutons natifs Windows */
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  -webkit-app-region: drag;
}
.topbar * { -webkit-app-region: no-drag; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-module-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 20px;
}
.topbar-module-badge i { font-size: 14px; }
.topbar-sep { color: var(--text-3); font-size: 16px; }
.topbar-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.page-body { flex: 1; overflow-y: auto; padding: 1.5rem 1.75rem; }

.page { display: none; }
.page.active { display: block; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0.48rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all 0.13s;
  font-family: inherit; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface3); }
.btn-ghost { background: none; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface3); }
.btn-danger { background: var(--red-bg); color: var(--red-text); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 12px; }
.btn i { font-size: 15px; }

.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.stat-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 19px; margin-bottom: 0.85rem; }
.c-blue .stat-icon  { background: var(--blue-bg);   color: var(--blue); }
.c-green .stat-icon { background: var(--green-bg);  color: var(--green); }
.c-purple .stat-icon{ background: var(--purple-bg); color: var(--purple); }
.c-amber .stat-icon { background: var(--amber-bg);  color: var(--amber); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-1); }
.stat-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

.dashboard-grid { display: grid; grid-template-columns: 1fr 290px; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.card-header { padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13px; font-weight: 600; }

.activity-item {
  display: flex; align-items: center; gap: 11px;
  padding: 0.7rem 1.1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer; transition: background 0.1s;
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--surface2); }
.activity-dot { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.dot-facture  { background: var(--blue-bg);   color: var(--blue); }
.dot-proforma { background: var(--green-bg);  color: var(--green); }
.dot-bon      { background: var(--amber-bg);  color: var(--amber); }
.activity-info { flex: 1; min-width: 0; }
.activity-info strong { display: block; font-size: 13px; font-weight: 500; }
.activity-info span { font-size: 11.5px; color: var(--text-3); }
.activity-amount { font-size: 13px; font-weight: 600; text-align: right; }
.activity-date { font-size: 11px; color: var(--text-3); }

.quick-actions { display: flex; flex-direction: column; gap: 7px; padding: 0.9rem; }
.quick-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-1); transition: all 0.13s; font-family: inherit;
}
.quick-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.quick-btn i { font-size: 17px; }
.qb-blue i { color: var(--blue); }
.qb-green i { color: var(--green); }
.qb-amber i { color: var(--amber); }
.qb-purple i { color: var(--purple); }

.search-row { display: flex; gap: 10px; margin-bottom: 1.1rem; align-items: center; }
.client-type-filter { display: flex; gap: 6px; }
.ctf-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.ctf-btn:hover { background: var(--hover); color: var(--text); }
.ctf-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.search-input-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 0.85rem; flex: 1;
}
.search-input-wrap i { color: var(--text-3); font-size: 15px; }
.search-input-wrap input { border: none; outline: none; font-size: 13px; padding: 0.52rem 0; flex: 1; background: none; color: var(--text-1); font-family: inherit; }

.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }
.client-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem;
  cursor: pointer; transition: all 0.15s;
}
.client-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.client-avatar { width: 42px; height: 42px; border-radius: 11px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; }
.client-name { font-size: 14px; font-weight: 600; margin: 10px 0 2px; }
.client-company { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.client-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.meta-tag { font-size: 11px; background: var(--surface3); color: var(--text-2); padding: 2px 7px; border-radius: 20px; display: flex; align-items: center; gap: 3px; }
.meta-tag i { font-size: 11px; }
.client-stats-row { display: flex; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-light); }
.cstat { text-align: center; flex: 1; }
.cstat-val { font-size: 14px; font-weight: 700; display: block; }
.cstat-lbl { font-size: 10.5px; color: var(--text-3); }

.profs-grid { grid-template-columns: repeat(auto-fill, minmax(195px,1fr)); gap: 10px; }
.prof-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; cursor: pointer; transition: all 0.15s; }
.prof-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.prof-card-actions { position: absolute; top: 7px; right: 7px; display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.prof-card:hover .prof-card-actions { opacity: 1; }
.prof-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.prof-card-head .client-avatar { width: 34px; height: 34px; font-size: 13px; border-radius: 9px; }
.prof-card-head .client-name { margin: 0; font-size: 13px; }
.prof-card-head .client-company { margin: 0; font-size: 11px; }
.prof-card-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.prof-cats-empty { font-size: 11.5px; color: var(--text-3); }
.prof-card .fcat-chip { font-size: 10.5px; padding: 3px 8px; }

.data-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--surface3); padding: 0.65rem 1rem; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border-light); cursor: pointer; transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
tbody td { padding: 0.8rem 1rem; font-size: 13px; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 500; }
.badge-facture  { background: var(--blue-bg);   color: var(--blue-text); }
.badge-proforma { background: var(--green-bg);  color: var(--green-text); }
.badge-bon      { background: var(--amber-bg);  color: var(--amber-text); }
.badge-paid     { background: var(--green-bg);  color: var(--green-text); }
.badge-pending  { background: var(--amber-bg);  color: var(--amber-text); }
.badge-draft    { background: var(--surface3);  color: var(--text-2); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-paid    { background: var(--green); }
.dot-pending { background: var(--amber); }
.dot-draft   { background: var(--text-3); }

.detail-header { display: flex; align-items: center; gap: 10px; margin-bottom: 1.25rem; flex-wrap: wrap; }
.detail-header h1 { font-size: 17px; font-weight: 700; flex: 1; }
.detail-actions { display: flex; gap: 7px; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(155px,1fr)); gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1.25rem; }
.info-field label { font-size: 10.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; display: block; margin-bottom: 3px; }
.info-field span { font-size: 13px; font-weight: 500; }

.doc-status-bar { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.65rem 1rem; margin-bottom: 1.25rem; font-size: 12.5px; flex-wrap: wrap; }
.status-item { display: flex; align-items: center; gap: 5px; color: var(--text-2); }
.status-item i { font-size: 15px; color: var(--text-3); }
.status-item strong { font-weight: 600; color: var(--text-1); }

.doc-preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.25rem; max-width: 800px; }
.doc-blue-strip { height: 4px; background: var(--primary); border-radius: 4px; margin-bottom: 1.75rem; }
.doc-preview-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 2rem; }
.doc-type-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--primary); margin-bottom: 5px; }
.doc-preview-title { font-size: 26px; font-weight: 800; color: var(--text-1); }
.doc-preview-num { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.doc-meta-block { text-align: right; font-size: 11.5px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.doc-meta-block .doc-date { color: var(--text-2); }
.doc-meta-block .doc-due { font-size: 10.5px; color: var(--text-3); }
.doc-company-logo { max-width: 120px; max-height: 50px; object-fit: contain; margin-bottom: 8px; display: block; }
.doc-party-ids { margin-top: 4px; font-size: 10px; color: var(--text-3); line-height: 1.4; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-bottom: 1.1rem; }
.doc-party label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-3); display: block; margin-bottom: 4px; }
.doc-party strong { font-size: 11px; font-weight: 400; display: inline; margin-bottom: 2px; }
.doc-party p { font-size: 10px; font-weight: 400; color: var(--text-2); line-height: 1.4; margin: 0; display: block; white-space: nowrap; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
.doc-table thead tr { border-bottom: 2px solid var(--primary-light); }
.doc-table th { padding: 0.6rem 0.7rem; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
.doc-table td { padding: 0.75rem 0.7rem; font-size: 13px; border-bottom: 1px solid var(--border-light); }
.doc-table .t-right { text-align: right; }
.doc-table tbody tr:last-child td { border-bottom: none; }
.doc-table tfoot { border-top: 2px solid var(--border); }
.doc-table tfoot td { padding: 0.55rem 0.7rem; font-size: 13px; }
.doc-table tfoot tr.grand td { font-size: 15px; font-weight: 700; color: var(--primary); }
.doc-footer { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: flex-end; }
.doc-notes { font-size: 12px; color: var(--text-3); max-width: 60%; line-height: 1.6; }
.stamp-label { font-size: 11px; color: var(--text-3); margin-bottom: 6px; }
.stamp-box { width: 110px; height: 55px; border: 1px dashed var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-3); }
.doc-stamp-img { max-width: 220px; max-height: 160px; object-fit: contain; display: block; }

/* ── Print split button ─────────────────────────────────────── */
.print-split { position: relative; display: flex; }
.print-split-main { border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important; border-right: none !important; }
.print-split-arrow { border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; padding: 0 10px !important; min-width: 0; }
.print-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  min-width: 220px; z-index: 200; overflow: hidden;
}
.print-dropdown.open { display: block; }
.print-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; font-size: 13.5px; cursor: pointer; color: var(--text);
  transition: background .12s;
}
.print-opt:hover { background: var(--hover); }
.print-opt i { color: var(--text-muted); }

/* ── Stamp preview in settings ──────────────────────────────── */
.stamp-preview { background: repeating-conic-gradient(#f0f0f0 0% 25%, white 0% 50%) 0 0 / 12px 12px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.55); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(3px); }
.modal-overlay.hidden { display: none; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 560px; max-width: 95vw; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(0,0,0,0.2); }
.modal-header { display: flex; align-items: center; gap: 11px; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-icon { width: 35px; height: 35px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 18px; background: var(--primary-light); color: var(--primary); flex-shrink: 0; }
.modal-header h2 { font-size: 14px; font-weight: 600; flex: 1; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 19px; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--surface3); color: var(--text-1); }
.modal-body { padding: 1.4rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 0.9rem 1.4rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

.form-group { margin-bottom: 0.9rem; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: 10px 16px; padding: 8px 0; }
.checkbox-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.checkbox-item input { cursor: pointer; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; outline: none; transition: border-color 0.13s, box-shadow 0.13s; font-family: inherit; background: var(--surface); color: var(--text-1); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-group textarea { resize: vertical; min-height: 75px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-divider { height: 1px; background: var(--border-light); margin: 0.85rem 0; }

.items-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 7px; }
.items-header { display: grid; grid-template-columns: 3fr 1fr 1.2fr 32px; background: var(--surface3); }
.items-header span { padding: 0.38rem 0.7rem; font-size: 10.5px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
.item-row { display: grid; grid-template-columns: 3fr 1fr 1.2fr 32px; border-top: 1px solid var(--border-light); }
.item-row input { border: none; border-radius: 0; padding: 0.5rem 0.7rem; font-size: 12.5px; background: transparent; }
.item-row input:focus { box-shadow: inset 0 0 0 2px var(--primary); outline: none; }
.item-row input + input { border-left: 1px solid var(--border-light); }
.item-del { display: flex; align-items: center; justify-content: center; background: none; border: none; border-left: 1px solid var(--border-light); cursor: pointer; color: var(--text-3); font-size: 15px; padding: 0; }
.item-del:hover { color: var(--red); background: var(--red-bg); }
.add-line-btn { width: 100%; padding: 0.45rem; background: none; border: 1px dashed var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 12.5px; color: var(--text-3); font-family: inherit; display: flex; align-items: center; justify-content: center; gap: 5px; transition: all 0.13s; }
.add-line-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.totals-block { margin-top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.total-line { display: flex; gap: 2.5rem; font-size: 12.5px; }
.total-line.grand { font-size: 14px; font-weight: 700; border-top: 2px solid var(--border); padding-top: 7px; margin-top: 3px; color: var(--primary); }

.empty-state { text-align: center; padding: 3.5rem 2rem; }
.empty-state i { font-size: 48px; color: var(--text-3); display: block; margin-bottom: 0.85rem; }
.empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.empty-state p { font-size: 13px; color: var(--text-3); margin-bottom: 1.1rem; }

.loading-row { display: flex; align-items: center; justify-content: center; padding: 2rem; color: var(--text-3); font-size: 20px; }

.client-info-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.1rem; display: flex; gap: 2rem; align-items: flex-start; }
.cic-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.cic-avatar { width: 54px; height: 54px; border-radius: 14px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; }
.cic-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.cic-company { font-size: 12px; color: var(--text-3); }
.cic-fields { display: flex; flex-wrap: wrap; gap: 10px 2rem; flex: 1; }
.cic-field { display: flex; align-items: flex-start; gap: 7px; }
.cic-field > i { font-size: 15px; color: var(--text-3); margin-top: 2px; flex-shrink: 0; }
.cic-field-label { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.4px; }
.cic-field-val { font-size: 13px; font-weight: 500; }

.client-kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 1.1rem; }
.kpi-card { border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 5px; border: 1px solid var(--border); }
.kpi-card i { font-size: 20px; margin-bottom: 2px; }
.kpi-val { font-size: 20px; font-weight: 700; }
.kpi-lbl { font-size: 11.5px; font-weight: 500; opacity: 0.75; }
.kpi-blue   { background: var(--blue-bg);   color: var(--blue-text);   border-color: #bfdbfe; }
.kpi-indigo { background: var(--primary-light); color: var(--primary-dark); border-color: #bfdbfe; }
.kpi-teal   { background: var(--green-bg);  color: var(--green-text);  border-color: #a7f3d0; }
.kpi-amber  { background: var(--amber-bg);  color: var(--amber-text);  border-color: #fde68a; }
.kpi-red    { background: var(--red-bg);    color: var(--red-text);    border-color: #fecaca; }

.new-doc-bar { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1.1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.new-doc-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 5px; margin-right: 4px; }
.new-doc-label i { font-size: 15px; color: var(--primary); }
.ndoc-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.45rem 0.9rem; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; cursor: pointer; border: 1.5px solid transparent; font-family: inherit; transition: all 0.13s; }
.ndoc-facture  { background: var(--blue-bg);   color: var(--blue-text);   border-color: #bfdbfe; }
.ndoc-proforma { background: var(--green-bg);  color: var(--green-text);  border-color: #a7f3d0; }
.ndoc-bon      { background: var(--amber-bg);  color: var(--amber-text);  border-color: #fde68a; }
.ndoc-facture:hover  { background: #dbeafe; }
.ndoc-proforma:hover { background: #d1fae5; }
.ndoc-bon:hover      { background: #fef3c7; }
.ndoc-btn i { font-size: 15px; }

/* Split button BC : générer | importer */
.ndoc-split { display: inline-flex; border-radius: var(--radius-sm); overflow: hidden; }
.ndoc-split-main { border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important; border-right: none !important; }
.ndoc-split-upload {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  padding: 0.45rem 0.65rem !important;
  border-left: 1px solid #f59e0b !important;
  cursor: pointer;
}
.ndoc-split-upload:hover { background: #fef3c7; }

/* Badge fichier importé */
.badge-uploaded { display: inline-flex; align-items: center; color: var(--text-3); font-size: 11px; margin-left: 4px; }
.badge-uploaded i { font-size: 12px; }

/* Prévisualisation fichier importé */
.uploaded-file-preview {
  display: flex; align-items: flex-start; justify-content: center;
  background: var(--surface2); border-radius: var(--radius); padding: 1rem;
  min-height: 500px;
}
.uploaded-pdf {
  width: 100%; height: 70vh; border: none; border-radius: 8px;
}
.uploaded-img {
  max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.1);
}

.docs-tabs { display: flex; gap: 3px; margin-bottom: 10px; background: var(--surface3); padding: 3px; border-radius: var(--radius-sm); width: fit-content; }
.dtab { padding: 0.35rem 0.85rem; border-radius: 6px; border: none; background: none; font-size: 12.5px; font-weight: 500; color: var(--text-3); cursor: pointer; font-family: inherit; display: flex; align-items: center; gap: 4px; transition: all 0.13s; white-space: nowrap; }
.dtab i { font-size: 13px; }
.dtab:hover { color: var(--text-1); }
.dtab.active { background: var(--surface); color: var(--text-1); box-shadow: 0 1px 3px rgba(0,0,0,.07); }

.settings-layout { display: grid; grid-template-columns: 190px 1fr; gap: 1.25rem; align-items: start; }
.settings-sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.settings-nav-item { display: flex; align-items: center; gap: 8px; padding: 0.7rem 0.9rem; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; border-left: 3px solid transparent; transition: all 0.13s; }
.settings-nav-item i { font-size: 16px; }
.settings-nav-item:hover { background: var(--surface2); color: var(--text-1); }
.settings-nav-item.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); }
.settings-tab { display: none; }
.settings-tab.active { display: block; }
.settings-section-title { font-size: 16px; font-weight: 700; margin-bottom: 5px; display: flex; align-items: center; gap: 7px; }
.settings-section-title i { font-size: 19px; color: var(--primary); }
.settings-desc { font-size: 12.5px; color: var(--text-3); margin-bottom: 1.1rem; }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 0.9rem; }
.settings-card-header { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.9rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border-light); }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 0.4rem; }

/* ── Logo upload ─────────────────────────────────────────────── */
/* ── Client type toggle ──────────────────────────────────────── */
.client-type-toggle {
  display: flex; gap: 8px; margin-bottom: 16px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px;
}
.ctype-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  background: transparent; transition: all .15s;
}
.ctype-btn:hover { background: var(--surface); color: var(--text-1); }
.ctype-btn.active { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.ctype-btn i { font-size: 15px; }
.form-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-3); margin-bottom: 8px;
}

/* Badge type dans la fiche client */
.badge-client-type {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
}
.badge-client-type.ent  { background: var(--primary-light); color: var(--primary); }
.badge-client-type.part { background: var(--surface3);      color: var(--text-2); }

.logo-upload-row { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-light); }
.logo-preview {
  width: 110px; height: 70px; border-radius: var(--radius-sm);
  border: 2px dashed var(--border);
  background: var(--surface2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-3); font-size: 11px; flex-shrink: 0;
  overflow: hidden; transition: border-color .2s;
}
.logo-preview i { font-size: 22px; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-preview.has-logo { border-style: solid; border-color: var(--border); }
.logo-upload-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-upload {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: background .15s;
}
.btn-upload:hover { background: var(--primary-dark); }
.btn-remove-logo {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-sm);
  background: var(--red-bg); color: var(--red-text); font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid #fecaca; transition: background .15s;
}
.btn-remove-logo:hover { background: #fee2e2; }
.logo-hint { font-size: 11.5px; color: var(--text-3); }

.module-overlay {
  position: fixed; inset: 0;
  background: #0b0f1a;
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  flex-direction: column;
}
.module-overlay.hidden { display: none; }
.module-overlay-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.module-overlay-icon {
  width: 80px; height: 80px;
  border-radius: 24px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: #4a5568;
  margin-bottom: 1.5rem;
}
.module-overlay-title { font-size: 28px; font-weight: 800; color: #e2e8f0; margin-bottom: 8px; }
.module-overlay-sub { font-size: 14px; color: #4a5568; margin-bottom: 1.5rem; }
.module-overlay-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #64748b;
  font-size: 12px; font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
}
.module-overlay-badge i { font-size: 14px; }

.save-toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: #0f172a; color: #fff; padding: 0.7rem 1.1rem; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px; z-index: 9999; opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
.save-toast.show { opacity: 1; transform: translateY(0); }
.save-toast i { color: #4ade80; font-size: 17px; }

section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.section-title { font-size: 13.5px; font-weight: 600; }

.stats-module-header { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:1.5rem; }
.stats-module-title { font-size:20px; font-weight:800; display:flex; align-items:center; gap:10px; }
.stats-module-title i { font-size:22px; color:var(--primary); }
.stats-module-sub { font-size:13px; color:var(--text-3); margin-top:4px; }

.stats-period-select { padding:0.45rem 0.85rem; border:1px solid var(--border); border-radius:var(--radius-sm); font-size:13px; font-family:inherit; background:var(--surface); color:var(--text-1); outline:none; cursor:pointer; }
.stats-period-select:focus { border-color:var(--primary); }

.kpi-section-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.8px; color:var(--text-3); margin:1.25rem 0 0.6rem; }

.kpi-grid-4 { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }

.kpi-big-card {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:1rem 1.1rem;
  position:relative;
  overflow:hidden;
  transition:box-shadow 0.15s;
}
.kpi-big-card:hover { box-shadow:var(--shadow-md); }
.kpi-big-top { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:0.75rem; }
.kpi-big-icon { width:36px; height:36px; border-radius:9px; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.kpi-trend { display:inline-flex; align-items:center; gap:3px; font-size:11.5px; font-weight:600; padding:2px 7px; border-radius:20px; }
.kpi-trend.up   { background:#ecfdf5; color:#065f46; }
.kpi-trend.down { background:#fef2f2; color:#991b1b; }
.kpi-trend.flat { background:var(--surface3); color:var(--text-3); }
.kpi-trend i { font-size:13px; }
.kpi-big-value { font-size:22px; font-weight:800; color:var(--text-1); line-height:1.1; margin-bottom:3px; }
.kpi-big-label { font-size:11.5px; color:var(--text-3); font-weight:500; }
.kpi-big-sub { font-size:11px; color:var(--text-3); margin-top:6px; padding-top:6px; border-top:1px solid var(--border-light); }

.kpi-big-card.accent-blue   { border-left:3px solid var(--blue); }
.kpi-big-card.accent-green  { border-left:3px solid var(--green); }
.kpi-big-card.accent-purple { border-left:3px solid var(--purple); }
.kpi-big-card.accent-amber  { border-left:3px solid var(--amber); }
.kpi-big-card.accent-red    { border-left:3px solid var(--red); }
.kpi-big-card.accent-teal   { border-left:3px solid #14b8a6; }
.kpi-big-card.accent-indigo { border-left:3px solid var(--primary); }
.kpi-big-card.accent-pink   { border-left:3px solid #ec4899; }

.accent-blue   .kpi-big-icon { background:var(--blue-bg);   color:var(--blue); }
.accent-green  .kpi-big-icon { background:var(--green-bg);  color:var(--green); }
.accent-purple .kpi-big-icon { background:var(--purple-bg); color:var(--purple); }
.accent-amber  .kpi-big-icon { background:var(--amber-bg);  color:var(--amber); }
.accent-red    .kpi-big-icon { background:var(--red-bg);    color:var(--red); }
.accent-teal   .kpi-big-icon { background:#f0fdfa; color:#14b8a6; }
.accent-indigo .kpi-big-icon { background:var(--primary-light); color:var(--primary); }
.accent-pink   .kpi-big-icon { background:#fdf2f8; color:#ec4899; }

.stats-charts-grid { display:grid; grid-template-columns:1fr 260px 260px; gap:14px; margin-top:1.5rem; }
.stats-bottom-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:14px; }

.chart-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.chart-card.chart-lg { }
.chart-card-header { display:flex; align-items:center; justify-content:space-between; padding:0.85rem 1.1rem; border-bottom:1px solid var(--border-light); }
.chart-card-title { font-size:13px; font-weight:600; display:flex; align-items:center; gap:7px; }
.chart-card-title i { font-size:15px; color:var(--primary); }
.chart-card-sub { font-size:12px; color:var(--text-3); }
.chart-wrap { padding:1rem; position:relative; height:240px; }
.chart-wrap-sm { height:200px; }

.unpaid-row { display:flex; align-items:center; gap:10px; padding:0.65rem 1rem; border-bottom:1px solid var(--border-light); cursor:pointer; transition:background 0.1s; font-size:13px; }
.unpaid-row:last-child { border-bottom:none; }
.unpaid-row:hover { background:var(--surface2); }
.unpaid-dot { width:8px; height:8px; border-radius:50%; background:var(--amber); flex-shrink:0; }
.unpaid-dot.overdue { background:var(--red); }
.unpaid-info { flex:1; min-width:0; }
.unpaid-info strong { display:block; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.unpaid-info span { font-size:11.5px; color:var(--text-3); }
.unpaid-amount { font-weight:700; color:var(--amber-text); }
.unpaid-amount.overdue { color:var(--red-text); }
.rep-ca-row { display:flex; align-items:center; gap:12px; padding:10px 16px; border-bottom:1px solid var(--border-light); font-size:13px; }
.rep-ca-row:last-child { border-bottom:none; }
.rep-ca-rank { width:28px; text-align:center; font-size:16px; flex-shrink:0; font-weight:700; color:var(--text-3); }
.rep-ca-info { flex:1; min-width:0; }
.rep-ca-name { font-weight:600; margin-bottom:5px; color:var(--text-1); }
.rep-ca-bar-wrap { height:6px; background:var(--border-light); border-radius:3px; overflow:hidden; }
.rep-ca-bar { height:100%; background:linear-gradient(90deg,#2563eb,#6366f1); border-radius:3px; transition:width 0.4s ease; }
.rep-ca-nums { display:flex; flex-direction:column; align-items:flex-end; gap:2px; flex-shrink:0; }
.rep-ca-amount { font-weight:700; color:var(--blue-text,#2563eb); font-size:14px; }
.rep-ca-docs { font-size:11px; color:var(--text-3); }

.stats-empty { text-align:center; padding:2rem; color:var(--text-3); font-size:13px; }
.stats-empty i { font-size:36px; display:block; margin-bottom:8px; }

/* ── Pending invoices ─────────────────────────────────────────── */
.nav-badge-warn { background:var(--amber-bg,#fef3c7); color:var(--amber-text,#d97706) !important; }
.pi-table-header,.pi-row { display:grid; grid-template-columns:130px 1fr 160px 140px 160px 28px; align-items:center; gap:12px; padding:10px 16px; }
.pi-table-header { font-size:11px; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:.05em; border-bottom:2px solid var(--border-light); }
.pi-table { border:1px solid var(--border-light); border-radius:12px; overflow:hidden; }
.pi-row { border-bottom:1px solid var(--border-light); cursor:pointer; transition:background .1s; background:var(--surface); }
.pi-row:last-child { border-bottom:none; }
.pi-row:hover { background:var(--surface2); }
.pi-row-overdue { background:rgba(239,68,68,.03); }
.pi-row-overdue:hover { background:rgba(239,68,68,.07); }
.pi-number { font-size:13px; font-weight:700; color:var(--text-1); }
.pi-date { font-size:11px; color:var(--text-3); margin-top:2px; }
.pi-client-name { font-size:13px; font-weight:600; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pi-client-sub { font-size:11px; color:var(--text-3); margin-top:1px; }
.pi-progress-bar { height:5px; background:var(--border-light); border-radius:3px; overflow:hidden; margin-bottom:4px; }
.pi-progress-fill { height:100%; background:linear-gradient(90deg,#10b981,#34d399); border-radius:3px; transition:width .3s; }
.pi-progress-label { font-size:10.5px; color:var(--text-3); }
.pi-remaining { font-size:14px; font-weight:800; color:var(--amber-text,#d97706); }
.pi-remaining-overdue { color:var(--red-text,#ef4444); }
.pi-status-badge { margin-top:3px; }
.pi-overdue-badge { display:inline-flex; align-items:center; gap:4px; background:var(--red-bg); color:var(--red-text); font-size:11.5px; font-weight:700; padding:4px 8px; border-radius:6px; }
.pi-overdue-badge i { font-size:11px; }
.pi-due-badge { font-size:12px; font-weight:600; color:var(--text-2); }
.pi-nodue-badge { font-size:11.5px; color:var(--text-3); font-style:italic; }
.pi-chevron { color:var(--text-3); font-size:14px; }
.badge-partial { background:var(--amber-bg,#fef3c7); color:var(--amber-text,#d97706); }

/* ── Groupes timeline ─────────────────────────────────────────── */
.tl-wrap { background:var(--surface); border:1px solid var(--border-light); border-radius:10px; overflow:hidden; margin-bottom:20px; }
.tl-controls { display:flex; align-items:center; gap:8px; padding:8px 14px; }
.tl-nav { background:none; border:none; border-radius:6px; width:26px; height:26px; display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--text-3); font-size:13px; transition:background .1s; }
.tl-nav:hover { background:var(--surface2); }
.tl-year { font-size:13px; font-weight:700; color:var(--text-1); min-width:36px; text-align:center; }
.tl-subtitle { font-size:11.5px; color:var(--text-3); }
.tl-gantt { display:flex; flex-direction:column; border-top:1px solid var(--border-light); }
.tl-gantt-hd { display:grid; grid-template-columns:180px 1fr; border-bottom:1px solid var(--border-light); }
.tl-gantt-hd-left { border-right:1px solid var(--border-light); }
.tl-gantt-hd-right { position:relative; height:26px; overflow:hidden; }
.tl-mcol { position:absolute; top:0; bottom:0; border-left:1px solid var(--border-light); display:flex; align-items:center; padding-left:5px; }
.tl-mcol:first-child { border-left:none; }
.tl-mlabel { font-size:9px; font-weight:600; color:var(--text-3); white-space:nowrap; pointer-events:none; letter-spacing:.02em; }
.tl-row { display:grid; grid-template-columns:180px 1fr; cursor:pointer; border-bottom:1px solid var(--border-light); }
.tl-row:last-child { border-bottom:none; }
.tl-row:hover .tl-row-label, .tl-row:hover .tl-row-track { background:var(--surface2); }
.tl-row-label { border-right:1px solid var(--border-light); display:flex; align-items:center; gap:7px; padding:6px 12px; min-width:0; overflow:hidden; }
.tl-row-dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.tl-row-name { font-size:11.5px; font-weight:500; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tl-row-track { position:relative; height:32px; overflow:hidden; }
.tl-track-bg-line { position:absolute; top:0; bottom:0; width:1px; background:var(--border-light); pointer-events:none; opacity:.5; }
.tl-bar { position:absolute; top:50%; transform:translateY(-50%); height:14px; border-radius:3px; display:flex; align-items:center; padding:0 5px; overflow:hidden; min-width:3px; opacity:.8; transition:opacity .1s, height .1s; }
.tl-row:hover .tl-bar { opacity:1; height:18px; }
.tl-bar-name { font-size:9px; font-weight:600; color:#fff; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tl-today-line { position:absolute; top:0; bottom:0; width:1.5px; background:rgba(239,68,68,.6); z-index:3; pointer-events:none; }
.tl-today-pin { position:absolute; top:0; left:50%; transform:translateX(-50%); background:#ef4444; color:#fff; font-size:8px; font-weight:700; padding:1px 3px; border-radius:2px; white-space:nowrap; line-height:1.4; }
.tl-empty { padding:20px; text-align:center; font-size:12px; color:var(--text-3); }

/* ── Groupes list ─────────────────────────────────────────────── */
.gm-block { margin-bottom:28px; }
.gm-label { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.gm-label-text { font-size:10.5px; font-weight:700; color:var(--text-3); letter-spacing:.06em; text-transform:uppercase; white-space:nowrap; }
.gm-label-now .gm-label-text { color:var(--text-2); }
.gm-label-line { flex:1; height:1px; background:var(--border-light); }
.gm-label-count { font-size:11px; color:var(--text-3); }
.gm-list { display:flex; flex-direction:column; gap:5px; border:1px solid var(--border-light); border-radius:10px; overflow:hidden; background:var(--surface); }
.gc-card { display:grid; grid-template-columns:16px 1fr auto auto; align-items:center; gap:12px; padding:12px 14px; cursor:pointer; transition:background .12s; border-bottom:1px solid var(--border-light); }
.gm-list .gc-card { border-radius:0; gap:12px; }
.gm-list .gc-card:last-child { border-bottom:none; }
.gc-card:hover { background:var(--surface2); }
.gc-card:hover .gc-del-btn { opacity:1; }
.gc-dot { width:8px; height:8px; border-radius:50%; justify-self:center; flex-shrink:0; }
.gc-main { min-width:0; display:flex; flex-direction:column; gap:2px; }
.gc-name { font-size:13px; font-weight:600; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gc-sub { font-size:11.5px; color:var(--text-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gc-status { font-size:11px; font-weight:500; flex-shrink:0; white-space:nowrap; padding:2px 8px; border-radius:20px; }
.gc-status-active   { color:#15803d; background:#dcfce7; }
.gc-status-upcoming { color:#1d4ed8; background:#dbeafe; }
.gc-status-ended    { color:var(--text-3); background:var(--surface2); }
.gc-status-nodate   { color:var(--text-3); background:var(--surface2); }
.gc-del-btn { background:none; border:none; padding:4px 5px; color:var(--text-3); cursor:pointer; opacity:0; transition:opacity .15s, color .1s; font-size:13px; flex-shrink:0; border-radius:5px; display:flex; align-items:center; }
.gc-del-btn:hover { color:#ef4444; background:rgba(239,68,68,.08); }

/* ── Groupe detail ────────────────────────────────────────────── */
.gd-hero { display:flex; align-items:center; justify-content:space-between; gap:20px; background:var(--surface); border:1px solid var(--border-light); border-radius:12px; padding:20px 24px; margin-bottom:16px; flex-wrap:wrap; }
.gd-hero-title { font-size:22px; font-weight:800; color:var(--text-1); }
.gd-hero-stats { display:flex; align-items:center; gap:0; background:var(--surface2); border:1px solid var(--border-light); border-radius:10px; overflow:hidden; }
.gd-stat { display:flex; flex-direction:column; align-items:center; padding:12px 22px; }
.gd-stat-val { font-size:22px; font-weight:800; color:var(--text-1); line-height:1; }
.gd-stat-lbl { font-size:10.5px; color:var(--text-3); margin-top:3px; font-weight:500; }
.gd-stat-div { width:1px; background:var(--border-light); align-self:stretch; }
.gd-info-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:10px; margin-bottom:20px; }
.gd-info-card { display:flex; align-items:flex-start; gap:12px; background:var(--surface); border:1px solid var(--border-light); border-radius:10px; padding:14px; cursor:default; transition:box-shadow .12s; }
.gd-info-card[onclick]:hover { box-shadow:0 2px 10px rgba(0,0,0,.07); }
.gd-info-icon { width:34px; height:34px; border-radius:8px; background:var(--surface2); color:var(--text-2); display:flex; align-items:center; justify-content:center; font-size:15px; flex-shrink:0; }
.gd-info-body { min-width:0; }
.gd-info-label { font-size:10.5px; font-weight:700; color:var(--text-3); text-transform:uppercase; letter-spacing:.04em; }
.gd-info-val { font-size:13.5px; font-weight:600; color:var(--text-1); margin-top:2px; }
.gd-info-sub { font-size:11px; color:var(--text-3); margin-top:2px; }
.gd-members-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.gd-members-title { font-size:14px; font-weight:700; color:var(--text-1); display:flex; align-items:center; gap:8px; }
.gd-members-count { background:var(--surface2); color:var(--text-3); font-size:11px; font-weight:600; padding:2px 8px; border-radius:20px; }
.gd-member-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); gap:10px; }
.gd-member-card { position:relative; background:var(--surface); border:1px solid var(--border-light); border-radius:12px; padding:16px 12px 12px; display:flex; flex-direction:column; align-items:center; text-align:center; cursor:pointer; transition:box-shadow .12s, transform .12s; }
.gd-member-card:hover { box-shadow:0 4px 14px rgba(0,0,0,.08); transform:translateY(-2px); }
.gd-member-del { position:absolute; top:6px; right:6px; background:none; border:none; color:var(--text-3); cursor:pointer; width:20px; height:20px; border-radius:4px; display:flex; align-items:center; justify-content:center; font-size:11px; transition:background .1s, color .1s; }
.gd-member-del:hover { background:var(--red-bg); color:var(--red-text); }
.gd-member-av { width:48px; height:48px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:16px; font-weight:700; margin-bottom:8px; }
.gd-member-name { font-size:12.5px; font-weight:700; color:var(--text-1); line-height:1.3; }
.gd-member-sub { font-size:10.5px; color:var(--text-3); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; }
.badge-student { background:#e0e7ff; color:#4f46e5; }
.badge-kid     { background:#fce7f3; color:#db2777; }
.badge { display:inline-block; font-size:10.5px; font-weight:600; padding:2px 7px; border-radius:20px; }

/* ── PDF / Print mode ────────────────────────────────────────── */
/* ── Dark mode ───────────────────────────────────────────────── */
[data-theme="dark"] {
  --surface:       #1e2330;
  --surface2:      #161b27;
  --surface3:      #252d3d;
  --border:        #2d3748;
  --border-light:  #2d3748;
  --text-1:        #f1f5f9;
  --text-2:        #94a3b8;
  --text-3:        #4b5563;
  --green-bg:      #052e16; --green-text: #4ade80;
  --amber-bg:      #1c1500; --amber-text: #fbbf24;
  --red-bg:        #1f0808; --red-text:   #f87171;
  --blue-bg:       #0c1a35; --blue-text:  #60a5fa;
  --purple-bg:     #1a0d2e; --purple-text:#c084fc;
  --shadow-md:     0 4px 16px rgba(0,0,0,.4);
}
[data-theme="dark"] body { background: var(--surface2); }
[data-theme="dark"] .topbar  { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .doc-preview { background: var(--surface); }
[data-theme="dark"] .modal-box   { background: var(--surface); }
[data-theme="dark"] .settings-card { background: var(--surface); }
[data-theme="dark"] .client-card   { background: var(--surface); }
[data-theme="dark"] .stat-card     { background: var(--surface); }
[data-theme="dark"] .kpi-big-card  { background: var(--surface); }
[data-theme="dark"] .data-table-wrap table thead { background: var(--surface3); }
[data-theme="dark"] .data-table-wrap table tbody tr:hover { background: var(--surface3); }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface3);
  border-color: var(--border);
  color: var(--text-1);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--text-3); }
[data-theme="dark"] .items-table-wrap     { background: var(--surface3); }
[data-theme="dark"] .item-row input       { background: var(--surface2); }
[data-theme="dark"] .logo-preview         { background: var(--surface3); }
[data-theme="dark"] .client-type-toggle   { background: var(--surface3); border-color: var(--border); }
[data-theme="dark"] .ctype-btn:hover      { background: var(--surface2); }
[data-theme="dark"] .theme-mode-preview.light-preview { filter: brightness(.7); }

/* ── Theme settings UI ───────────────────────────────────────── */
.theme-mode-row { display: flex; gap: 16px; }
.theme-mode-card {
  flex: 1; border: 2px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color .2s, box-shadow .2s;
}
.theme-mode-card:hover { border-color: var(--primary); }
.theme-mode-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.theme-mode-preview {
  height: 80px; display: flex; gap: 4px; padding: 8px;
}
.light-preview { background: #f8faff; }
.dark-preview  { background: #161b27; }
.tmp-rail    { width: 18px; border-radius: 4px; background: #0b0f1a; }
.tmp-sidebar { width: 32px; border-radius: 4px; }
.light-preview .tmp-sidebar { background: #111827; }
.dark-preview  .tmp-sidebar { background: #1e2330; }
.tmp-content { flex: 1; border-radius: 4px; }
.light-preview .tmp-content { background: #ffffff; }
.dark-preview  .tmp-content { background: #1e2330; }
.theme-mode-label {
  padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--text-2);
  display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border);
  background: var(--surface);
}
.theme-mode-card.active .theme-mode-label { color: var(--primary); }

.theme-colors-grid {
  display: grid; grid-template-columns: repeat(9, 1fr); gap: 8px; margin-bottom: 16px;
}
.tcolor-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: none; border: 2px solid transparent; border-radius: var(--radius-sm);
  padding: 8px 4px; cursor: pointer; transition: border-color .15s;
}
.tcolor-btn:hover { border-color: var(--border); }
.tcolor-btn.active { border-color: var(--primary); }
.tcolor-btn span { width: 28px; height: 28px; border-radius: 50%; display: block; }
.tcolor-btn small { font-size: 10px; color: var(--text-2); }
.tcolor-btn.active small { color: var(--primary); font-weight: 600; }

.theme-custom-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 12px; border-top: 1px solid var(--border-light);
}
input[type="color"] {
  width: 36px; height: 36px; border-radius: 8px; border: 2px solid var(--border);
  padding: 2px; cursor: pointer; background: none;
}

/* ── Language selector ──────────────────────────────────────────── */
.lang-btn-row {
  display: flex; gap: 10px; padding: 4px 0;
}
.lang-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--surface2);
  color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all .15s;
}
.lang-btn:hover { border-color: var(--primary); color: var(--text-1); }
.lang-btn.active {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary); font-weight: 600;
}
.lang-flag { font-size: 18px; line-height: 1; }

/* ── RTL support ─────────────────────────────────────────────────── */
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .app-rail { border-right: none; border-left: 1px solid rgba(255,255,255,.06); }
[dir="rtl"] .nav-badge { margin-left: 0; margin-right: auto; }
[dir="rtl"] .cic-field { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .detail-header { flex-direction: row-reverse; }
[dir="rtl"] .topbar-left { flex-direction: row-reverse; }
[dir="rtl"] .kpi-big-top { flex-direction: row-reverse; }
[dir="rtl"] .activity-item { flex-direction: row-reverse; }
[dir="rtl"] .doc-parties { flex-direction: row-reverse; }
[dir="rtl"] .doc-party label { text-align: right; }
[dir="rtl"] .doc-party p { text-align: right; }
[dir="rtl"] .doc-party-ids { text-align: right; }
[dir="rtl"] .doc-status-bar { flex-direction: row-reverse; }
[dir="rtl"] .doc-status-bar > div:last-child { margin-left: 0; margin-right: auto; }
[dir="rtl"] .client-type-toggle { flex-direction: row-reverse; }
[dir="rtl"] .new-doc-bar { flex-direction: row-reverse; flex-wrap: wrap; }
[dir="rtl"] .client-stats-row { flex-direction: row-reverse; }
[dir="rtl"] .settings-layout { flex-direction: row-reverse; }
[dir="rtl"] .settings-nav-item { flex-direction: row-reverse; justify-content: flex-end; gap: 10px; }
[dir="rtl"] .form-row { flex-direction: row-reverse; }
[dir="rtl"] .quick-actions { flex-direction: row-reverse; flex-wrap: wrap; }
[dir="rtl"] .modal-header { flex-direction: row-reverse; }
[dir="rtl"] .modal-footer { flex-direction: row-reverse; }
[dir="rtl"] .data-table-wrap table { direction: rtl; }
[dir="rtl"] .topbar-actions { margin-right: auto; margin-left: 0; }
[dir="rtl"] .doc-preview { direction: rtl; text-align: right; }
[dir="rtl"] .doc-table th, [dir="rtl"] .doc-table td { text-align: right; }
[dir="rtl"] .doc-table .t-right { text-align: left; }
[dir="rtl"] .doc-footer { flex-direction: row-reverse; }

@media print {
  #app-loader,
  .app-rail, .sidebar, .topbar,
  .detail-header, .doc-status-bar,
  #topbar-actions { display: none !important; }

  .doc-preview .badge,
  .doc-preview .status-dot,
  .doc-meta-block .badge { display: none !important; }

  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  html, body { height: auto; overflow: visible; background: #fff; margin: 0; }
  #app        { display: block; height: auto; }
  .main-area  { display: block; overflow: visible; width: 100%; }
  .page-body  { padding: 0; overflow: visible; }

  .page       { display: none !important; }
  #page-document-detail { display: block !important; }

  .doc-preview {
    border: none; border-radius: 0; box-shadow: none;
    max-width: 100%; margin: 0; padding: 1.5cm 1.8cm;
  }
}

.rb-task-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 13px; }
.rb-task-del { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; }
.rb-task-del:hover { color: var(--red); }

/* ── Suivi & Recouvrement client ────────────────────────────────────────── */
.recovery-add-row { display: flex; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.recovery-add-row input, .recovery-add-row select { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 12.5px; }
.recovery-add-row input[placeholder] { flex: 1; min-width: 180px; }
.recovery-log { list-style: none; margin: 0; padding: 0; }
.recovery-log-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.recovery-log-item:last-child { border-bottom: none; }
.recovery-log-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.recovery-log-body { flex: 1; }
.recovery-log-top { font-size: 13px; }
.recovery-log-note { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* ── Projets client ──────────────────────────────────────────────────────── */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.project-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.project-card-name { font-size: 14px; font-weight: 600; }
.project-card-ref { font-size: 11.5px; color: var(--text-3); margin-bottom: 8px; display: flex; align-items: center; gap: 4px; }
.project-card-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; flex-wrap: wrap; }
.project-card-meta i { margin-right: 3px; }
.project-card-dates { font-size: 11.5px; color: var(--text-3); }

/* ── Page Détail Projet ──────────────────────────────────────────────────── */
.project-hero { background: linear-gradient(135deg, var(--primary-light), var(--surface) 70%); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.1rem; }
.project-hero-top { display: flex; align-items: flex-start; gap: 14px; }
.project-hero-icon { width: 50px; height: 50px; border-radius: 14px; background: var(--surface); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.project-hero-main { flex: 1; min-width: 0; }
.project-hero-name { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.project-hero-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.phero-tag { font-size: 11.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: 100px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 4px; }
.project-hero-amount { text-align: right; flex-shrink: 0; }
.phero-amount-val { font-size: 19px; font-weight: 700; color: var(--primary); }
.phero-amount-lbl { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.project-hero-bottom { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-light); }
.phero-stat { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.phero-stat strong { color: var(--text-1); }
.phero-stat.phero-late { color: var(--red); }
.phero-stat.phero-desc { flex-basis: 100%; color: var(--text-3); }

.ptab-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-left: 4px; vertical-align: middle; }

.proj-doc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.proj-doc-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pchip { font-size: 12px; padding: 6px 12px; border-radius: 100px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; transition: background .15s; }
.pchip:hover { background: var(--surface2); }
.pchip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.proj-doc-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.proj-due-row { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; flex-wrap: wrap; }

/* ── Dashboard École ─────────────────────────────────────────────────────── */
.dash-marketing-row { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.dash-marketing-input { display: flex; gap: 8px; align-items: center; }
.dash-marketing-input input { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 12.5px; width: 160px; }

/* ── Catalogue de formations ─────────────────────────────────────────────── */
.fsched-group { margin-bottom: 28px; }
.fsched-group-header { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; color: var(--text); }
.fsched-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--fs-color); flex-shrink: 0; }
.fsched-sub { font-size: 12.5px; font-weight: 400; color: var(--text-2); }
.fsched-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--fs-color); background: color-mix(in srgb, var(--fs-color) 14%, transparent); padding: 2px 10px; border-radius: 100px; }
.fsched-grid { margin: 0; }
.fsched-empty { grid-column: 1/-1; padding: 1.25rem; text-align: center; color: var(--text-2); font-size: 13px; border: 1px dashed var(--border); border-radius: 10px; }
.fcat-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1rem; flex-wrap: wrap; }
.fcat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.fcat-chip-wrap { display: inline-flex; align-items: center; gap: 2px; }
.fcat-chip { font-size: 12.5px; padding: 7px 13px; border-radius: 100px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .15s; }
.fcat-chip:hover { background: var(--surface2); }
.fcat-chip.active { color: #fff; border-color: transparent; }
.fcat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fcat-chip-edit, .fcat-chip-del { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; font-size: 12px; }
.fcat-chip-edit:hover { color: var(--primary); }
.fcat-chip-del:hover { color: var(--red); }
.fcat-card { position: relative; }
.fcat-card-del { position: absolute; top: 10px; right: 10px; }

/* ── Profils profs ───────────────────────────────────────────────────────── */
.form-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

/* ── Dropdown multi-sélection ────────────────────────────────────────────── */
.msel { position: relative; }
.msel-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 13px; color: var(--text-1); cursor: pointer;
}
.msel-trigger:hover { border-color: var(--primary); }
.msel-trigger i { font-size: 14px; color: var(--text-3); }
.msel-panel {
  display: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  max-height: 220px; overflow-y: auto; z-index: 2000;
}
.msel-panel.open { display: block; }
.msel-option {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; font-size: 13px; cursor: pointer; color: var(--text-1);
  transition: background .12s;
}
.msel-option:hover { background: var(--surface2); }
.msel-option input { width: auto; flex: none; padding: 0; border: none; cursor: pointer; }

/* ── Filtre par catégorie (chips) ────────────────────────────────────────── */
.cat-filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.1rem; }
.cf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 100px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 12.5px; cursor: pointer;
  white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
}
.cf-chip:hover { background: var(--hover); color: var(--text); }
.cf-chip.active {
  background: var(--cf-color, var(--primary)); color: #fff; border-color: var(--cf-color, var(--primary));
}
.cf-chip.active .fcat-dot { background: #fff !important; }

.msel-options-static { display: flex; flex-direction: column; max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.msel-options-static .msel-option { padding: 9px 12px; }
.msel-options-static .msel-option input { width: auto; flex: none; padding: 0; border: none; }

.new-student-inline-bar { margin-top: 10px; }

/* ── Toggle vue grille/tableau ────────────────────────────────────────────── */
.view-toggle { display: flex; gap: 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; background: var(--surface); }
.vt-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 15px; transition: background .15s, color .15s; }
.vt-btn:hover { background: var(--hover); color: var(--text); }
.vt-btn.active { background: var(--primary); color: #fff; }
.dt-name { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.dt-avatar { width: 28px; height: 28px; font-size: 11px; }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pagination-row { display: flex; align-items: center; gap: 6px; margin-top: 1.1rem; }
.pg-btn {
  display: flex; align-items: center; justify-content: center; min-width: 32px; height: 32px;
  padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface);
  color: var(--text-muted); font-size: 12.5px; cursor: pointer; transition: background .15s, color .15s;
}
.pg-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.pg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pg-ellipsis { color: var(--text-3); padding: 0 2px; font-size: 12.5px; }
.pg-total { margin-left: auto; font-size: 12px; color: var(--text-3); }

/* ── Drawer de filtres ────────────────────────────────────────────────────── */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.35); z-index: 1000; }
.drawer-overlay.hidden { display: none; }
.filter-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 360px; max-width: 90vw;
  background: var(--surface); box-shadow: var(--shadow-md); display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .25s ease;
}
.filter-drawer.open { transform: translateX(0); }
.filter-drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--border); }
.filter-drawer-header h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0; }
.filter-drawer-body { flex: 1; overflow-y: auto; padding: 1.2rem 1.4rem; }
.filter-drawer-footer { display: flex; gap: 10px; padding: 1.1rem 1.4rem; border-top: 1px solid var(--border); }
.filter-drawer-footer .btn { flex: 1; justify-content: center; }
.filter-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px;
  margin-left: 6px; padding: 0 4px; border-radius: 100px; background: var(--primary); color: #fff;
  font-size: 10.5px; font-weight: 700;
}
.filter-badge.hidden { display: none; }

/* ── Paliers Sales (paramètres) ──────────────────────────────────────────── */
.tiers-settings-list { display: flex; flex-direction: column; gap: 8px; }
.tier-settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.tsr-info { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tsr-info i { color: var(--primary); }
.tsr-arrow { color: var(--text-3); }
.tsr-prime { font-weight: 700; color: var(--primary); }
.tsr-actions { display: flex; gap: 4px; }

/* ── Hackerspace (espaces, classes, créneaux) ────────────────────────────── */
.hs-tab-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 1.2rem 0 1.2rem; }
.hs-tab-btn { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border: none; background: none; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; }
.hs-tab-btn:hover { color: var(--text-1); }
.hs-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.hs-status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.hs-status-dot.free { background: var(--green); }
.hs-status-dot.busy { background: var(--red); }
.hs-issue-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; margin-bottom: 10px; }
.hs-issue-card.resolved { opacity: 0.65; }
.hs-issue-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hs-issue-title { font-size: 13.5px; font-weight: 600; }
.hs-issue-status { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; }
.hs-issue-status.is-open { background: rgba(239,68,68,.12); color: var(--red); }
.hs-issue-status.is-resolved { background: rgba(34,197,94,.12); color: var(--green); }
.hs-issue-actions { margin-left: auto; display: flex; gap: 2px; }
.hs-issue-actions button { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; }
.hs-issue-actions button:hover { color: var(--primary); }
.hs-issue-desc { font-size: 12.5px; color: var(--text-2); margin-top: 6px; }
.hs-issue-date { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* ── IA — moteur de planification ─────────────────────────────────────────── */
.ia-card-body { padding: 1.1rem 1.2rem; }
.ia-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 900px) { .ia-grid-2 { grid-template-columns: 1fr; } }
.ai-settings-bar { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.ai-settings-bar .form-group { margin: 0; min-width: 160px; }
.ai-reco-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; }
.ai-reco-card { background: var(--surface2); border-top: 3px solid var(--ai-color); border-radius: var(--radius); padding: 16px; text-align: center; }
.ai-reco-count { font-size: 28px; font-weight: 800; color: var(--ai-color); }
.ai-reco-label { font-size: 12.5px; font-weight: 600; margin-top: 4px; }
.ai-reco-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.ia-occ-ring { width: 130px; height: 130px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: conic-gradient(var(--blue) calc(var(--occ)*1%), var(--surface3) 0); position: relative; }
.ia-occ-ring::before { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.ia-occ-ring-val { position: relative; font-size: 24px; font-weight: 800; }
.ia-sim-kpi { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.ia-sim-kpi:last-child { border-bottom: none; }
.ia-sim-kpi-lbl { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.ia-sim-kpi-val { font-size: 17px; font-weight: 700; }
.ia-details { background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 0; overflow: hidden; }
.ia-details summary { cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; list-style: none; }
.ia-details summary::-webkit-details-marker { display: none; }
.ia-details summary::after { content: '\25BE'; margin-left: auto; color: var(--text-3); }
.ia-details[open] summary::after { content: '\25B4'; }
.ia-details-body { padding: 0 18px 18px; border-top: 1px solid var(--border-light); padding-top: 14px; }

.ia-slot-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 1.1rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--border-light); }
.ia-slot-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ia-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.ia-legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.ia-legend-dot.is-busy-real { background: var(--blue); }
.ia-legend-dot.is-busy-new { background: var(--green); }
.ia-legend-dot.is-free { background: var(--surface2); border: 1px solid var(--border-light); }
.ia-legend-dot.is-disabled { background: var(--surface3); opacity: .6; }

.ia-room-card { margin-bottom: 1.4rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--border-light); }
.ia-room-card:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.ia-room-name-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ia-room-name { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ia-room-name i { color: var(--text-3); font-size: 15px; }
.ia-room-occ-badge { font-size: 11px; font-weight: 700; border-radius: 20px; padding: 3px 10px; }
.ai-room-grid { display: grid; grid-template-columns: 64px repeat(7, minmax(50px,1fr)); gap: 4px; }
.ai-room-grid-cell { display: flex; align-items: center; justify-content: center; font-size: 10px; padding: 6px 2px; border-radius: 6px; text-align: center; min-height: 32px; }
.ai-room-grid-corner { background: none; }
.ai-room-grid-head { font-weight: 700; color: var(--text-3); text-transform: uppercase; font-size: 9.5px; }
.ai-room-grid-rowlabel { font-weight: 600; color: var(--text-2); justify-content: flex-start; font-size: 10px; }
.ai-room-grid-slot { background: var(--surface2); border: 1px solid var(--border-light); transition: transform .1s; }
.ai-room-grid-slot:hover { transform: scale(1.08); }
.ai-room-grid-slot.is-busy-real { background: rgba(59,130,246,.16); border-color: rgba(59,130,246,.35); }
.ai-room-grid-slot.is-busy-new { background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.35); }
.ai-room-grid-slot.is-disabled { background: var(--surface3); opacity: .4; }

.ia-room-bars { display: flex; flex-direction: column; gap: 10px; }
.ia-room-bar-row { display: grid; grid-template-columns: 140px 1fr 44px; align-items: center; gap: 12px; }
.ia-room-bar-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.ia-room-bar-label i { color: var(--text-3); }
.ia-room-bar-track { height: 10px; background: var(--surface3); border-radius: 6px; overflow: hidden; }
.ia-room-bar-fill { height: 100%; border-radius: 6px; transition: width .2s; }
.ia-room-bar-val { font-size: 12px; font-weight: 700; text-align: right; }

.hs-view-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.hs-view-btn { background: var(--surface); border: none; border-right: 1px solid var(--border); padding: 7px 10px; color: var(--text-3); cursor: pointer; transition: all .15s; }
.hs-view-btn:last-child { border-right: none; }
.hs-view-btn:hover { color: var(--text-1); }
.hs-view-btn.active { background: var(--primary-light); color: var(--primary); }

.hs-floorplan { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin-top: 14px; }
.hs-floorplan.hidden { display: none; }
.hs-rooms-row.hidden { display: none; }
.hs-floor-box {
  width: 170px; border-radius: 14px; border: 2px solid var(--green);
  background: rgba(34,197,94,.08); cursor: pointer; transition: all .15s;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 12px;
}
.hs-floor-box.busy { border-color: var(--red); background: rgba(239,68,68,.08); }
.hs-floor-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.hs-floor-box-top { flex: 1; display: flex; align-items: flex-start; justify-content: flex-end; }
.hs-floor-cap { font-size: 10.5px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); padding: 1px 7px; border-radius: 20px; }
.hs-floor-box-name { font-size: 13px; font-weight: 600; color: var(--text-1); text-align: center; }
.hs-rooms-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.hs-room-chip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s; }
.hs-room-chip:hover { border-color: var(--primary); }
.hs-room-chip.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.hs-room-cap { font-size: 11px; color: var(--text-3); background: var(--surface3); padding: 1px 7px; border-radius: 20px; }
.hs-room-chip.active .hs-room-cap { background: rgba(255,255,255,0.5); }
.hs-room-actions { display: flex; gap: 2px; margin-left: 2px; }
.hs-room-actions button { background: none; border: none; color: inherit; opacity: .6; cursor: pointer; padding: 2px; font-size: 12px; }
.hs-room-actions button:hover { opacity: 1; }

.hsweek-grid { display: grid; grid-template-columns: repeat(7, minmax(140px,1fr)); gap: 10px; overflow-x: auto; margin-top: 10px; }
.hsweek-day { background: var(--surface2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; min-height: 160px; }
.hsweek-day-header { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 8px; }
.hsweek-day-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.hsweek-day-empty { font-size: 11.5px; color: var(--text-3); text-align: center; padding: 8px 0; }
.hsweek-slot { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; padding: 6px 8px; cursor: pointer; transition: all .15s; }
.hsweek-slot:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.hsweek-slot-time { font-size: 10.5px; font-weight: 700; color: var(--primary); }
.hsweek-slot-title { font-size: 12px; color: var(--text-1); margin-top: 1px; }
.hsweek-day-add { margin-top: 8px; background: none; border: 1px dashed var(--border); border-radius: 8px; padding: 5px; color: var(--text-3); cursor: pointer; transition: all .15s; }
.hsweek-day-add:hover { border-color: var(--primary); color: var(--primary); }

/* ── Kanban (Leads par catégorie) ─────────────────────────────────────────── */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; align-items: flex-start; }
.kanban-col { flex: 1 0 260px; min-width: 260px; background: var(--surface2); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kanban-col-header {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-size: 13px; font-weight: 700;
  color: var(--text); border-bottom: 1px solid var(--border);
}
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--kc-color); flex: none; }
.kanban-col-count { margin-left: auto; background: var(--surface3); color: var(--text-3); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 100px; }
.kanban-col-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.kanban-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.kanban-col-empty { text-align: center; font-size: 12px; color: var(--text-3); padding: 1.2rem 0; }

/* ── Dialogue de confirmation ─────────────────────────────────────────────── */
.confirm-modal { width: 420px; }
.confirm-modal .modal-icon { background: var(--amber-bg, #fef3c7); color: var(--amber, #d97706); }
#confirm-message { font-size: 13.5px; color: var(--text-2); line-height: 1.5; margin: 0; }

/* ── Profil commercial (Sales) ────────────────────────────────────────────── */
.rep-chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-bottom: 1.4rem; }
.days-off-row { display: flex; flex-wrap: wrap; gap: 8px; }
.day-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 100px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: 12.5px; cursor: pointer;
}
.day-chip input { width: auto; flex: none; padding: 0; border: none; cursor: pointer; }
.day-chip.off { background: var(--red-bg); color: var(--red-text); border-color: #fecaca; font-weight: 600; cursor: default; }

/* ── Badge genre (étudiants) ──────────────────────────────────────────────── */
.gender-badge { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; vertical-align: middle; }
.gender-badge.homme { background: var(--blue-bg); color: var(--blue-text); }
.gender-badge.femme { background: #fce7f3; color: #db2777; }

/* ── Connexions applications (paramètres) ────────────────────────────────── */
.integration-status { margin-left: 8px; font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 100px; text-transform: uppercase; letter-spacing: .3px; }
.integration-status.active { background: var(--green-bg); color: var(--green-text); }
.integration-status.inactive { background: var(--surface3); color: var(--text-3); }
.ti-spin { animation: ti-spin-anim 0.8s linear infinite; display: inline-block; }
@keyframes ti-spin-anim { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Champs HubSpot importés (base clients École) ────────────────────────── */
.hubspot-fields-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.hf-row { display: flex; gap: 10px; padding: 7px 12px; font-size: 12px; border-bottom: 1px solid var(--border-light); }
.hf-row:last-child { border-bottom: none; }
.hf-key { color: var(--text-3); flex: 0 0 160px; font-family: monospace; }
.hf-val { color: var(--text); word-break: break-word; }
/* ── Tableau base de données client (École) ──────────────────────────────── */
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 600; border: 1px solid; }
.status-dot2 { width: 6px; height: 6px; border-radius: 50%; flex: none; }

/* ── Login screen ─────────────────────────────────────────────── */
#login-screen { position:fixed; inset:0; background:var(--surface2,#f4f5f7); display:flex; align-items:center; justify-content:center; z-index:9999; }
#login-screen.hidden { display:none; }
#app-shell.hidden { display:none; }
.login-card { background:var(--surface,#fff); border:1px solid var(--border-light,#e5e7eb); border-radius:16px; padding:40px 36px; width:100%; max-width:380px; box-shadow:0 8px 40px rgba(0,0,0,.08); text-align:center; }
.login-logo { width:56px; height:56px; border-radius:14px; background:var(--primary,#6366f1); color:#fff; display:flex; align-items:center; justify-content:center; font-size:26px; margin:0 auto 14px; }
.login-title { font-size:22px; font-weight:800; color:var(--text-1,#111); }
.login-subtitle { font-size:13px; color:var(--text-3,#9ca3af); margin-top:4px; }
.login-error { font-size:12.5px; color:#ef4444; min-height:18px; text-align:left; }

/* ── Sidebar user zone ────────────────────────────────────────── */
.sidebar-user { display:flex; align-items:center; gap:9px; padding:10px 12px; border-top:1px solid rgba(255,255,255,0.06); margin-top:4px; }
.sidebar-user-av { width:30px; height:30px; border-radius:50%; background:rgba(99,102,241,0.2); color:#a5b4fc; display:flex; align-items:center; justify-content:center; font-size:13px; flex-shrink:0; }
.sidebar-user-info { flex:1; min-width:0; }
.sidebar-user-name-text { font-size:12px; font-weight:600; color:#e2e8f0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-user-role-text { font-size:10.5px; color:#6b7280; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-logout-btn { background:none; border:none; color:#4b5563; cursor:pointer; padding:4px; border-radius:6px; display:flex; align-items:center; font-size:15px; flex-shrink:0; transition:color .1s, background .1s; }
.sidebar-logout-btn:hover { color:#ef4444; background:rgba(239,68,68,.08); }

/* ── Users management page ────────────────────────────────────── */
.users-list { display:flex; flex-direction:column; gap:0; border:1px solid var(--border-light,#e5e7eb); border-radius:10px; overflow:hidden; background:var(--surface,#fff); }
.user-row { display:flex; align-items:center; gap:12px; padding:13px 16px; border-bottom:1px solid var(--border-light,#e5e7eb); transition:background .1s; }
.user-row:last-child { border-bottom:none; }
.user-row:hover { background:var(--surface2,#f9fafb); }
.user-av { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex-shrink:0; }
.user-info { flex:1; min-width:0; }
.user-name { font-size:13.5px; font-weight:600; color:var(--text-1,#111); }
.user-username { font-size:11.5px; color:var(--text-3,#9ca3af); margin-top:1px; }
.user-role-badge { font-size:11px; font-weight:600; padding:3px 10px; border-radius:20px; white-space:nowrap; flex-shrink:0; }
.user-actions { display:flex; gap:4px; flex-shrink:0; }
.text-red { color:#ef4444 !important; }
.perm-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; background:var(--surface2,#f9fafb); padding:10px; border-radius:8px; border:1px solid var(--border-light,#e5e7eb); }
.perm-check { display:flex; align-items:center; gap:6px; font-size:12.5px; color:var(--text-2,#374151); cursor:pointer; padding:3px 0; }
.perm-check input { accent-color:var(--primary,#6366f1); width:14px; height:14px; cursor:pointer; }

/* Logs */
/* ── Logs page ───────────────────────────────────────────────────────────── */
.logs-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:18px; }
.logs-clear-btn { flex-shrink:0; color:#ef4444 !important; border:1px solid #fecaca !important; background:#fff !important; border-radius:8px !important; }
.logs-clear-btn:hover { background:#fef2f2 !important; border-color:#ef4444 !important; }

/* Stats cards */
.logs-stats { display:grid; grid-template-columns:repeat(5,1fr); gap:10px; margin-bottom:16px; }
@media (max-width:1100px) { .logs-stats { grid-template-columns:repeat(3,1fr); } }
.logs-stat-card { display:flex; align-items:center; gap:11px; background:var(--surface,#fff); border:1px solid var(--border,#e5e7eb); border-radius:12px; padding:13px 14px; }
.logs-stat-icon { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:17px; flex-shrink:0; }
.ls-indigo .logs-stat-icon { background:#eef2ff; color:#6366f1; }
.ls-green  .logs-stat-icon { background:#dcfce7; color:#16a34a; }
.ls-blue   .logs-stat-icon { background:#dbeafe; color:#2563eb; }
.ls-amber  .logs-stat-icon { background:#fef3c7; color:#d97706; }
.ls-red    .logs-stat-icon { background:#fee2e2; color:#dc2626; }
.logs-stat-val { font-size:18px; font-weight:800; color:var(--text-1,#111); line-height:1.1; }
.logs-stat-label { font-size:11px; color:var(--text-3,#6b7280); margin-top:2px; white-space:nowrap; }

/* Toolbar: search + chips */
.logs-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.logs-search-wrap { position:relative; flex:1; min-width:200px; max-width:280px; }
.logs-search-wrap i { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--text-3,#9ca3af); font-size:15px; pointer-events:none; }
.logs-search-wrap input { width:100%; height:38px; padding:0 12px 0 36px; border:1px solid var(--border,#e5e7eb); border-radius:10px; font-size:13px; background:var(--surface,#fff); color:var(--text-1,#111); outline:none; box-sizing:border-box; transition:border-color .15s, box-shadow .15s; }
.logs-search-wrap input:focus { border-color:var(--primary,#6366f1); box-shadow:0 0 0 3px rgba(99,102,241,.12); }
.logs-chips { display:flex; gap:6px; flex-wrap:wrap; }
.logs-chip { display:inline-flex; align-items:center; gap:5px; height:34px; padding:0 13px; border:1px solid var(--border,#e5e7eb); border-radius:99px; background:var(--surface,#fff); color:var(--text-2,#4b5563); font-size:12.5px; font-weight:600; cursor:pointer; transition:all .13s; }
.logs-chip i { font-size:14px; }
.logs-chip:hover { border-color:#c7d2fe; color:var(--primary,#6366f1); }
.logs-chip.active { background:var(--primary,#6366f1); border-color:var(--primary,#6366f1); color:#fff; }

/* Day groups + rows */
.logs-day-label { font-size:11.5px; font-weight:700; color:var(--text-3,#6b7280); text-transform:uppercase; letter-spacing:.5px; margin:18px 2px 8px; }
.logs-day-label:first-child { margin-top:0; }
.logs-table-wrap { border:1px solid var(--border,#e5e7eb); border-radius:14px; overflow:hidden; background:var(--surface,#fff); }
.logs-row { display:flex; align-items:center; gap:12px; padding:11px 16px; border-bottom:1px solid var(--border-light,#f3f4f6); transition:background .1s; }
.logs-row:last-child { border-bottom:none; }
.logs-row:hover { background:var(--surface2,#f9fafb); }
.logs-row-time { font-size:11.5px; color:var(--text-3,#9ca3af); font-variant-numeric:tabular-nums; width:38px; flex-shrink:0; }
.log-av { width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg,#e0e7ff,#c7d2fe); color:#4f46e5; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; flex-shrink:0; }
.logs-row-main { flex:1; min-width:0; }
.logs-row-top { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.log-uname { font-size:13px; font-weight:600; color:var(--text-1,#111); }
.logs-row-details { font-size:12px; color:var(--text-3,#6b7280); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.log-ip { font-size:10.5px; color:var(--text-3,#9ca3af); font-family:monospace; flex-shrink:0; }
.log-badge { display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:600; padding:2.5px 9px; border-radius:20px; white-space:nowrap; }
.log-badge i { font-size:12px; }
.log-login  { background:#dcfce7; color:#16a34a; }
.log-logout { background:#f1f5f9; color:#475569; }
.log-create { background:#dbeafe; color:#2563eb; }
.log-edit   { background:#fef3c7; color:#b45309; }
.log-delete { background:#fee2e2; color:#dc2626; }

/* Empty / loading */
.logs-empty-state { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:3.5rem 1rem; color:var(--text-3,#9ca3af); gap:10px; border:1px dashed var(--border,#e5e7eb); border-radius:14px; }
.logs-empty-state i { font-size:34px; opacity:.4; }
.logs-empty-state p { font-size:13px; margin:0; }
.logs-spin { animation:logs-rotate 1s linear infinite; }
@keyframes logs-rotate { to { transform:rotate(360deg); } }

/* Pagination */
.logs-pagination { display:flex; gap:5px; justify-content:center; align-items:center; margin-top:16px; flex-wrap:wrap; }
.logs-pg-btn { min-width:34px; height:34px; padding:0 6px; display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--border,#e5e7eb); border-radius:9px; background:var(--surface,#fff); color:var(--text-2,#4b5563); font-size:12.5px; font-weight:600; cursor:pointer; transition:all .13s; }
.logs-pg-btn:hover:not(:disabled) { border-color:#c7d2fe; color:var(--primary,#6366f1); }
.logs-pg-btn.active { background:var(--primary,#6366f1); border-color:var(--primary,#6366f1); color:#fff; }
.logs-pg-btn:disabled { opacity:.4; cursor:default; }
.logs-pg-dots { color:var(--text-3,#9ca3af); font-size:13px; padding:0 3px; }

/* ── Dépenses page ───────────────────────────────────────────────────────── */
.dep-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:16px; }
@media (max-width:1000px) { .dep-stats { grid-template-columns:repeat(2,1fr); } }
.dep-toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.dep-search-wrap { position:relative; flex:1; min-width:200px; max-width:300px; }
.dep-search-wrap i { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:var(--text-3,#9ca3af); font-size:15px; pointer-events:none; }
.dep-search-wrap input { width:100%; height:38px; padding:0 12px 0 36px; border:1px solid var(--border,#e5e7eb); border-radius:10px; font-size:13px; background:var(--surface,#fff); color:var(--text-1,#111); outline:none; box-sizing:border-box; transition:border-color .15s, box-shadow .15s; }
.dep-search-wrap input:focus { border-color:var(--primary,#6366f1); box-shadow:0 0 0 3px rgba(99,102,241,.12); }
.dep-select { height:38px; padding:0 12px; border:1px solid var(--border,#e5e7eb); border-radius:10px; font-size:13px; background:var(--surface,#fff); color:var(--text-1,#111); outline:none; min-width:160px; cursor:pointer; transition:border-color .15s, box-shadow .15s; }
.dep-select:focus { border-color:var(--primary,#6366f1); box-shadow:0 0 0 3px rgba(99,102,241,.12); }
.dep-row { display:flex; align-items:center; gap:13px; padding:12px 16px; border-bottom:1px solid var(--border-light,#f3f4f6); transition:background .1s; }
.dep-row:last-child { border-bottom:none; }
.dep-row:hover { background:var(--surface2,#f9fafb); }
.dep-row-icon { width:38px; height:38px; border-radius:11px; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; }
.dep-row-main { flex:1; min-width:0; }
.dep-row-label { font-size:13.5px; font-weight:600; color:var(--text-1,#111); }
.dep-row-sub { font-size:12px; color:var(--text-3,#6b7280); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dep-row-amount { font-size:14px; font-weight:800; color:var(--text-1,#111); white-space:nowrap; font-variant-numeric:tabular-nums; }
.dep-row-actions { display:flex; gap:2px; flex-shrink:0; }

/* ── Annulations & rattrapages (fiche groupe) ────────────────────────────── */
.gse-list { display:flex; flex-direction:column; gap:0; border:1px solid var(--border,#e5e7eb); border-radius:14px; overflow:hidden; background:var(--surface,#fff); }
.gse-row { display:flex; align-items:flex-start; gap:12px; padding:13px 16px; border-bottom:1px solid var(--border-light,#f3f4f6); }
.gse-row:last-child { border-bottom:none; }
.gse-icon { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:17px; flex-shrink:0; margin-top:2px; }
.gse-cancel  { background:#fee2e2; color:#dc2626; }
.gse-absence { background:#fef3c7; color:#d97706; }
.gse-main { flex:1; min-width:0; }
.gse-title { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.gse-date { font-size:12.5px; color:var(--text-2,#4b5563); font-weight:600; }
.gse-note { font-size:12.5px; color:var(--text-3,#6b7280); margin-top:3px; }
.gse-makeup { display:flex; align-items:center; gap:6px; font-size:12.5px; color:#059669; margin-top:6px; flex-wrap:wrap; }
.gse-makeup i { font-size:14px; }
.gse-nomakeup { color:#d97706; }
.gse-makeup-link { color:var(--primary,#6366f1); cursor:pointer; font-weight:600; margin-left:4px; }
.gse-makeup-link:hover { text-decoration:underline; }
