:root{
  --primary:#1f4e79;
  --primary-2:#4f81bd;
  --bg:#f5f7fa;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --border:#e5e7eb;
  --shadow:0 .75rem 1.75rem rgba(31,78,121,.09);
  --radius:18px;
}

*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
a{color:var(--primary)}

.app-shell{min-height:100vh;display:flex}
.app-sidebar{
  width:280px;position:fixed;inset:0 auto 0 0;background:#142235;color:white;z-index:1000;
  display:flex;flex-direction:column;padding:1.25rem;
  box-shadow:1rem 0 2rem rgba(0,0,0,.10)
}
.sidebar-brand{display:flex;align-items:center;gap:.8rem;margin-bottom:2rem}
.brand-mark,.login-logo{
  width:48px;height:48px;border-radius:16px;background:linear-gradient(135deg,var(--primary-2),#9cc3e6);
  display:flex;align-items:center;justify-content:center;font-weight:900;font-size:1.4rem;color:white
}
.brand-title{font-weight:800;font-size:1.05rem}
.brand-subtitle{font-size:.8rem;color:#b9c7d8}
.sidebar-nav{display:grid;gap:.35rem}
.sidebar-link{
  color:#dbe7f5;text-decoration:none;padding:.75rem .85rem;border-radius:14px;display:flex;gap:.7rem;align-items:center;
  transition:background .15s ease, color .15s ease, transform .15s ease
}
.sidebar-link:hover{background:rgba(255,255,255,.10);color:white;transform:translateX(2px)}
.sidebar-footer{margin-top:auto;border-top:1px solid rgba(255,255,255,.12);padding-top:1rem}
.user-mini{display:flex;gap:.7rem;align-items:center;margin-bottom:.8rem}
.user-mini-avatar{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:white;color:var(--primary);font-weight:800}
.user-mini-name{font-size:.82rem;word-break:break-all}
.user-mini-role{font-size:.74rem;color:#b9c7d8}
.sidebar-logout{display:block;text-align:center;color:white;text-decoration:none;border:1px solid rgba(255,255,255,.25);border-radius:12px;padding:.55rem}
.sidebar-logout:hover{background:rgba(255,255,255,.10)}

.app-main{margin-left:280px;min-height:100vh;width:calc(100% - 280px)}
.topbar{
  height:72px;background:rgba(255,255,255,.88);backdrop-filter:blur(10px);border-bottom:1px solid var(--border);
  display:flex;align-items:center;gap:1rem;padding:0 2rem;position:sticky;top:0;z-index:900
}
.menu-toggle{display:none;border:0;background:var(--primary);color:white;border-radius:12px;padding:.45rem .7rem;font-size:1.15rem}
.topbar-title{font-weight:800}
.topbar-subtitle{font-size:.85rem;color:var(--muted)}
.content-wrap{padding:2rem;max-width:1500px;margin:0 auto}
.app-alert{border-radius:14px;border:0;box-shadow:var(--shadow)}

.page-heading{
  display:flex;justify-content:space-between;align-items:center;gap:1rem;margin-bottom:1.5rem
}
.page-heading h1{font-weight:850;margin:0;color:#111827}
.page-heading p{margin:.25rem 0 0;color:var(--muted)}

.app-card,.metric-card,.person-card,.profile-card{
  background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)
}
.app-card{padding:1.25rem}
.form-card{max-width:1050px}
.metric-card{padding:1.25rem;display:flex;align-items:center;gap:1rem;height:100%}
.metric-icon{width:56px;height:56px;border-radius:16px;background:#e8f1fb;display:flex;align-items:center;justify-content:center;font-size:1.5rem}
.metric-number{font-size:2rem;font-weight:850;color:var(--primary)}
.metric-label{color:var(--muted)}
.clean-list{padding-left:1.2rem;color:var(--muted)}
.clean-list li{margin-bottom:.45rem}

.app-input{border-radius:12px;border-color:#d7dde5;padding:.65rem .85rem}
.app-input:focus{border-color:var(--primary-2);box-shadow:0 0 0 .2rem rgba(79,129,189,.18)}
.app-btn-primary{background:var(--primary);border-color:var(--primary);color:white;border-radius:12px;padding:.6rem 1rem;font-weight:700}
.app-btn-primary:hover{background:#173b5c;border-color:#173b5c;color:white}
.app-btn-outline{border:1px solid #c9d6e4;color:var(--primary);background:white;border-radius:12px;padding:.6rem 1rem;font-weight:700}
.app-btn-outline:hover{background:#e8f1fb;color:var(--primary)}
.app-btn-light{border:1px solid #edf1f5;background:#f8fafc;border-radius:12px;color:#334155}

.search-card{padding:1rem}
.person-card{overflow:hidden;height:100%;transition:transform .15s ease, box-shadow .15s ease}
.person-card:hover{transform:translateY(-3px);box-shadow:0 1rem 2rem rgba(31,78,121,.14)}
.person-photo-wrap{height:210px;background:#edf2f7}
.person-photo{width:100%;height:100%;object-fit:cover}
.person-body{padding:1rem}
.person-body h2{font-size:1.1rem;margin:0 0 .25rem;font-weight:800}
.person-position{color:var(--muted);min-height:1.3rem}
.person-tags{display:flex;gap:.35rem;flex-wrap:wrap;margin:.6rem 0}
.person-tags span{font-size:.75rem;padding:.2rem .5rem;border-radius:999px;background:#edf4fb;color:var(--primary)}
.person-email{font-size:.82rem;text-decoration:none;word-break:break-all}
.person-actions{display:flex;gap:.4rem;margin-top:.9rem}

.profile-card{text-align:center;padding:1.25rem}
.profile-photo{width:180px;height:180px;border-radius:50%;object-fit:cover;background:#edf2f7;border:6px solid white;box-shadow:var(--shadow);margin-bottom:1rem}
.profile-card h2{font-weight:850;margin:0}
.profile-card p{color:var(--muted)}
.status-pill{display:inline-block;border-radius:999px;padding:.3rem .75rem;font-size:.85rem;font-weight:800}
.status-pill.is-active{background:#d1e7dd;color:#0f5132}
.status-pill.is-muted{background:#e9ecef;color:#495057}
.info-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}
.info-grid div{padding:1rem;border:1px solid var(--border);border-radius:14px;background:#fbfcfe}
.info-grid span{display:block;font-size:.8rem;color:var(--muted);margin-bottom:.2rem}
.info-grid strong{font-weight:750}
.action-bar{display:flex;gap:.5rem;flex-wrap:wrap}

.table{--bs-table-bg:transparent}
.table-responsive,.admin-table-wrap{background:white;border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:1rem}
.admin-list-link{border-radius:12px!important;margin-bottom:.4rem;border:1px solid var(--border)!important}

/* Login */
.login-page{min-height:calc(100vh - 160px);display:flex;align-items:center;justify-content:center}
.login-card{width:min(440px,100%);background:white;border:1px solid var(--border);border-radius:26px;box-shadow:var(--shadow);padding:2rem}
.login-card h1{font-weight:850;margin-top:1rem}
.login-separator{display:flex;align-items:center;margin:1.2rem 0;color:var(--muted)}
.login-separator::before,.login-separator::after{content:"";height:1px;background:var(--border);flex:1}
.login-separator span{padding:0 .8rem}

/* Organigrammes */
.org-hero{
  display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:1.6rem;color:white;border-radius:1.25rem;
  background:linear-gradient(135deg,#1f4e79,#4f81bd);box-shadow:var(--shadow)
}
.org-hero h1{margin:0;font-weight:850}
.org-toolbar{display:flex;justify-content:space-between;gap:1rem;align-items:center;padding:.9rem 1rem;border:1px solid var(--border);border-radius:1rem;background:white}
.org-legend{display:flex;gap:.8rem;align-items:center;color:var(--muted);font-size:.9rem}
.org-dot{display:inline-block;width:.75rem;height:.75rem;border-radius:50%;background:var(--primary);margin-right:.35rem}
.org-service-icon{width:48px;height:48px;border-radius:14px;display:flex;align-items:center;justify-content:center;font-weight:850;background:#e8f1fb;color:var(--primary);margin-bottom:.8rem}
.org-department-card{transition:transform .15s ease, box-shadow .15s ease;border-radius:var(--radius);box-shadow:var(--shadow)}
.org-department-card:hover{transform:translateY(-2px);box-shadow:0 1rem 2rem rgba(31,78,121,.14)}
.org-wrapper{overflow:auto;padding:2rem;border:1px solid var(--border);border-radius:1.25rem;background:radial-gradient(circle at top left, rgba(79,129,189,.13), transparent 30%),linear-gradient(180deg,#ffffff,#f8f9fa)}
.org-wrapper-full{min-height:560px}
.org-tree,.org-tree ul{padding-top:28px;position:relative;list-style:none;margin:0;text-align:center}
.org-tree ul{display:flex;justify-content:center;gap:24px}
.org-tree li{display:inline-block;vertical-align:top;text-align:center;position:relative;padding:28px 10px 0 10px}
.org-tree li::before,.org-tree li::after{content:'';position:absolute;top:0;right:50%;border-top:2px solid #c7ced6;width:50%;height:28px}
.org-tree li::after{right:auto;left:50%;border-left:2px solid #c7ced6}
.org-tree li:only-child::after,.org-tree li:only-child::before{display:none}
.org-tree li:only-child{padding-top:0}
.org-tree li:first-child::before,.org-tree li:last-child::after{border:0 none}
.org-tree li:last-child::before{border-right:2px solid #c7ced6;border-radius:0 12px 0 0}
.org-tree li:first-child::after{border-radius:12px 0 0 0}
.org-tree ul::before{content:'';position:absolute;top:0;left:50%;border-left:2px solid #c7ced6;width:0;height:28px}
.org-card{display:flex;gap:.85rem;align-items:center;min-width:285px;max-width:340px;background:white;border:1px solid var(--border);border-radius:1.1rem;padding:.9rem;text-align:left;box-shadow:0 .45rem 1rem rgba(31,78,121,.08);transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease}
.org-card:hover{transform:translateY(-3px);box-shadow:0 .8rem 1.6rem rgba(31,78,121,.14);border-color:#b8c7d9}
.full-org-card{border-left:5px solid var(--primary)}
.org-photo,.org-avatar{width:64px;height:64px;border-radius:50%;object-fit:cover;background:#e9ecef;flex:0 0 64px}
.org-avatar{display:flex;align-items:center;justify-content:center;font-weight:850;color:var(--primary);border:2px solid white;box-shadow:0 0 0 2px #dee2e6}
.org-name{display:block;font-weight:850;color:#111827;text-decoration:none;line-height:1.15}
.org-name:hover{text-decoration:underline}
.org-position{font-size:.92rem;color:#495057;margin-top:.15rem}
.org-meta{display:flex;flex-wrap:wrap;gap:.35rem;margin-top:.35rem}
.org-meta span{display:inline-block;padding:.15rem .45rem;border-radius:999px;background:#edf4fb;color:var(--primary);font-size:.75rem}
.org-email{display:block;margin-top:.35rem;font-size:.78rem;color:#6c757d;word-break:break-all;text-decoration:none}
.org-email:hover{text-decoration:underline}

.trombi-photo{height:220px;object-fit:cover;background:#f2f2f2}
.trombi-detail-photo{height:360px;object-fit:cover;background:#f2f2f2}

@media (max-width: 992px){
  .app-sidebar{transform:translateX(-100%);transition:transform .2s ease}
  body.sidebar-open .app-sidebar{transform:translateX(0)}
  .app-main{margin-left:0;width:100%}
  .menu-toggle{display:inline-block}
  .content-wrap{padding:1rem}
  .page-heading,.org-hero,.org-toolbar{display:block}
  .page-heading .btn,.org-hero .btn{margin-top:.5rem}
}
@media (max-width: 768px){
  .info-grid{grid-template-columns:1fr}
  .org-tree,.org-tree ul{display:block;text-align:left;padding-top:0}
  .org-tree li{display:block;padding:0 0 .8rem 0}
  .org-tree li::before,.org-tree li::after,.org-tree ul::before{display:none}
  .org-card{max-width:none;min-width:0}
}

.sidebar-link.is-active{background:rgba(255,255,255,.16);color:white;font-weight:800}

/* Dashboard graphs V6 */
.chart-card{height:100%}
.chart-header{display:flex;justify-content:space-between;gap:1rem;align-items:flex-start;margin-bottom:1rem}
.chart-header h2{font-size:1.1rem;font-weight:850;margin:0}
.chart-header p{margin:.2rem 0 0;color:var(--muted);font-size:.9rem}
.bar-chart{display:grid;gap:.75rem}
.bar-row{display:grid;grid-template-columns:150px 1fr 42px;gap:.75rem;align-items:center}
.bar-label{font-size:.88rem;color:#374151;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bar-track{height:13px;background:#edf2f7;border-radius:999px;overflow:hidden}
.bar-fill{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--primary),var(--primary-2))}
.site-fill{background:linear-gradient(90deg,#198754,#75b798)}
.role-fill{background:linear-gradient(90deg,#6f42c1,#b197fc)}
.bar-value{text-align:right;font-weight:800;color:#111827}
.compact-bars .bar-row{grid-template-columns:135px 1fr 38px}
.donut-wrap{display:flex;align-items:center;gap:1.5rem;justify-content:center;min-height:260px}
.donut{
  width:190px;height:190px;border-radius:50%;
  background:conic-gradient(
    #1f4e79 0 calc(var(--active) * 1%),
    #adb5bd calc(var(--active) * 1%) calc((var(--active) + var(--archived)) * 1%),
    #dc3545 calc((var(--active) + var(--archived)) * 1%) 100%
  );
  display:flex;align-items:center;justify-content:center;position:relative;box-shadow:var(--shadow)
}
.donut::after{content:"";position:absolute;width:128px;height:128px;background:white;border-radius:50%}
.donut-center{position:relative;z-index:1;text-align:center}
.donut-center strong{display:block;font-size:2rem;color:var(--primary)}
.donut-center span{font-size:.85rem;color:var(--muted)}
.donut-legend{display:grid;gap:.55rem}
.donut-legend div{display:flex;gap:.5rem;align-items:center;justify-content:space-between;min-width:150px}
.legend-dot{width:12px;height:12px;border-radius:50%;display:inline-block}
.legend-dot.active{background:#1f4e79}
.legend-dot.archived{background:#adb5bd}
.legend-dot.disabled{background:#dc3545}
.activity-chart{height:190px;display:flex;align-items:end;gap:.55rem;border-bottom:1px solid var(--border);padding-top:1rem}
.activity-col{flex:1;display:flex;flex-direction:column;align-items:center;gap:.4rem}
.activity-bar{width:100%;max-width:30px;border-radius:8px 8px 0 0;background:linear-gradient(180deg,var(--primary-2),var(--primary));min-height:8px}
.activity-label{font-size:.72rem;color:var(--muted);transform:rotate(-35deg);white-space:nowrap;height:28px}
.completion-list{display:grid;gap:1.1rem}
.completion-item>div:first-child{display:flex;justify-content:space-between;margin-bottom:.35rem}
.completion-item strong{font-weight:800}
.completion-item span{color:var(--muted)}
.completion-track{height:12px;background:#edf2f7;border-radius:999px;overflow:hidden}
.completion-track div{height:100%;border-radius:999px;background:linear-gradient(90deg,#0d6efd,#9ec5fe)}
@media (max-width:768px){
  .bar-row,.compact-bars .bar-row{grid-template-columns:1fr 42px}
  .bar-label{grid-column:1 / -1}
  .donut-wrap{display:grid}
}

/* Collaborateurs : choix 2/3/4/5 cartes par ligne */
.cards-density{
  display:flex;
  gap:.25rem;
  padding:.25rem;
  background:white;
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
}
.density-btn{
  border:0;
  background:transparent;
  color:var(--primary);
  font-weight:800;
  border-radius:10px;
  padding:.45rem .65rem;
  min-width:38px;
}
.density-btn:hover,
.density-btn.is-active{
  background:var(--primary);
  color:white;
}
.people-grid{
  display:grid;
  grid-template-columns:repeat(var(--cards-per-row, 4), minmax(0, 1fr));
  gap:1rem;
}
.person-grid-item{min-width:0}
@media (max-width: 1400px){
  .people-grid{grid-template-columns:repeat(min(var(--cards-per-row, 4), 4), minmax(0, 1fr))}
}
@media (max-width: 1100px){
  .people-grid{grid-template-columns:repeat(3, minmax(0, 1fr))}
}
@media (max-width: 820px){
  .people-grid{grid-template-columns:repeat(2, minmax(0, 1fr))}
}
@media (max-width: 560px){
  .people-grid{grid-template-columns:1fr}
  .cards-density{width:100%;justify-content:space-between}
}

/* Logo menu + login */
.sidebar-logo{
  width:54px;
  height:54px;
  object-fit:contain;
  border-radius:16px;
  background:white;
  padding:5px;
  box-shadow:0 .5rem 1rem rgba(0,0,0,.14);
  flex:0 0 54px;
}
.login-page-branded{
  min-height:calc(100vh - 160px);
  position:relative;
}
.login-page-branded::before{
  content:"";
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 20% 20%, rgba(79,129,189,.16), transparent 28%),
    radial-gradient(circle at 80% 30%, rgba(20,184,166,.12), transparent 26%);
  pointer-events:none;
}
.login-card-branded{
  position:relative;
  overflow:hidden;
}
.login-card-branded::before{
  content:"";
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:8px;
  background:linear-gradient(90deg,var(--primary),var(--primary-2),#14b8a6);
}
.login-logo-wrap{
  display:flex;
  justify-content:center;
  margin-bottom:1rem;
}
.login-brand-logo{
  width:150px;
  height:150px;
  object-fit:contain;
  border-radius:28px;
  background:white;
  padding:.4rem;
  box-shadow:var(--shadow);
}
.login-card-branded h1{
  text-align:center;
}
.login-card-branded > p{
  text-align:center;
  margin-bottom:1.5rem;
}
.login-footer-note{
  text-align:center;
  margin-top:1.25rem;
  font-size:.85rem;
  color:var(--muted);
}
@media (max-width: 560px){
  .login-brand-logo{
    width:120px;
    height:120px;
  }
}

/* Login sans menu */
body.auth-page .app-sidebar,
body.auth-page .topbar{
  display:none;
}
body.auth-page .app-main{
  margin-left:0;
  width:100%;
}
body.auth-page .content-wrap{
  max-width:none;
  padding:0;
}
body.auth-page .login-page{
  min-height:100vh;
}

/* Admin amélioré */
.admin-hero{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  padding:1.6rem;
  border-radius:24px;
  color:white;
  background:
    radial-gradient(circle at 85% 20%, rgba(20,184,166,.35), transparent 25%),
    linear-gradient(135deg,#142235,#1f4e79);
  box-shadow:var(--shadow);
  margin-bottom:1.5rem;
}
.admin-hero .eyebrow{
  text-transform:uppercase;
  letter-spacing:.12em;
  font-size:.75rem;
  color:#b9d8ff;
  font-weight:800;
}
.admin-hero h1{
  margin:.15rem 0;
  font-weight:900;
}
.admin-hero p{
  margin:0;
  color:#dbeafe;
}
.admin-hero-actions{
  display:flex;
  gap:.5rem;
  flex-wrap:wrap;
}
.admin-kpi-card{
  background:white;
  border:1px solid var(--border);
  border-radius:20px;
  box-shadow:var(--shadow);
  padding:1rem;
  display:flex;
  align-items:center;
  gap:.9rem;
  height:100%;
}
.admin-kpi-icon{
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:15px;
  background:#edf4fb;
  font-size:1.35rem;
}
.admin-kpi-card strong{
  display:block;
  font-size:1.8rem;
  color:var(--primary);
  line-height:1;
}
.admin-kpi-card small{
  color:var(--muted);
}
.section-title{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:1rem;
  margin-bottom:1rem;
}
.section-title h2{
  margin:0;
  font-size:1.15rem;
  font-weight:900;
}
.section-title p{
  margin:.2rem 0 0;
  color:var(--muted);
  font-size:.9rem;
}
.admin-module-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:1rem;
}
.admin-module-card{
  display:grid;
  grid-template-columns:54px 1fr auto;
  align-items:center;
  gap:.9rem;
  padding:1rem;
  border:1px solid var(--border);
  border-radius:18px;
  background:#fbfcfe;
  color:inherit;
  text-decoration:none;
  transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.admin-module-card:hover{
  transform:translateY(-2px);
  border-color:#b8c7d9;
  box-shadow:0 .75rem 1.5rem rgba(31,78,121,.10);
}
.admin-module-card .module-icon{
  width:54px;
  height:54px;
  border-radius:17px;
  background:#e8f1fb;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.45rem;
}
.admin-module-card h3{
  margin:0;
  font-size:1rem;
  font-weight:900;
}
.admin-module-card p{
  margin:.15rem 0 0;
  color:var(--muted);
  font-size:.85rem;
}
.admin-module-card>span{
  color:var(--primary);
  font-weight:900;
}
.admin-alert-list{
  display:grid;
  gap:.8rem;
}
.admin-alert-item{
  display:grid;
  grid-template-columns:50px 1fr;
  gap:.8rem;
  align-items:center;
  padding:1rem;
  border-radius:18px;
  text-decoration:none;
  border:1px solid var(--border);
  color:inherit;
}
.admin-alert-item span{
  width:50px;
  height:50px;
  border-radius:15px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:white;
  font-size:1.4rem;
}
.admin-alert-item strong{
  display:block;
  font-size:1.4rem;
  line-height:1;
}
.admin-alert-item small{
  color:var(--muted);
}
.admin-alert-item.is-warning{
  background:#fff8e6;
  border-color:#ffe2a8;
}
.admin-alert-item.is-ok{
  background:#edf9f1;
  border-color:#c7ecd3;
}
.admin-mini-bars{
  display:grid;
  gap:.8rem;
}
.admin-mini-bar span{
  color:#374151;
}
.mini-track{
  height:10px;
  background:#edf2f7;
  border-radius:999px;
  overflow:hidden;
  margin-top:.35rem;
}
.mini-track div{
  height:100%;
  background:linear-gradient(90deg,var(--primary),var(--primary-2));
  border-radius:999px;
}
.admin-timeline{
  display:grid;
  gap:.9rem;
}
.timeline-item{
  display:grid;
  grid-template-columns:18px 1fr;
  gap:.7rem;
}
.timeline-dot{
  width:12px;
  height:12px;
  border-radius:50%;
  background:var(--primary-2);
  margin-top:.35rem;
  box-shadow:0 0 0 4px #e8f1fb;
}
.timeline-item strong{
  font-weight:900;
}
.timeline-item span{
  color:var(--muted);
  font-size:.82rem;
  margin-left:.4rem;
}
.timeline-item p{
  margin:.15rem 0 0;
  color:var(--muted);
  font-size:.88rem;
}
.admin-table-shell{
  background:white;
  border:1px solid var(--border);
  border-radius:20px;
  box-shadow:var(--shadow);
  padding:1rem;
}
.admin-table thead th{
  color:var(--muted);
  font-size:.78rem;
  text-transform:uppercase;
  letter-spacing:.04em;
  border-bottom:1px solid var(--border);
}
.admin-table tbody td{
  padding:.9rem .6rem;
}
@media (max-width: 900px){
  .admin-hero{display:block}
  .admin-hero-actions{margin-top:1rem}
  .admin-module-grid{grid-template-columns:1fr}
}

/* Hero uniforme global */
.app-hero,
.admin-hero,
.org-hero{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  padding:1.6rem;
  margin-bottom:1.5rem;
  border-radius:24px;
  color:white;
  background:
    radial-gradient(circle at 88% 18%, rgba(20,184,166,.34), transparent 25%),
    linear-gradient(135deg,#142235,#1f4e79);
  box-shadow:var(--shadow);
}
.app-hero .eyebrow,
.admin-hero .eyebrow,
.org-hero .eyebrow{
  text-transform:uppercase;
  letter-spacing:.12em;
  font-size:.75rem;
  color:#b9d8ff;
  font-weight:800;
}
.app-hero h1,
.admin-hero h1,
.org-hero h1{
  margin:.15rem 0;
  font-weight:900;
  color:white;
}
.app-hero p,
.admin-hero p,
.org-hero p{
  margin:0;
  color:#dbeafe;
}
.app-hero-actions,
.admin-hero-actions{
  display:flex;
  gap:.5rem;
  flex-wrap:wrap;
}
.app-hero .btn,
.admin-hero .btn,
.org-hero .btn{
  border-radius:12px;
  font-weight:800;
}
.app-hero + .page-heading{
  margin-top:0;
}
@media (max-width: 900px){
  .app-hero,
  .admin-hero,
  .org-hero{
    display:block;
  }
  .app-hero-actions,
  .admin-hero-actions,
  .org-hero .d-flex{
    margin-top:1rem;
  }
}
/* UI cleanup forms */
.form-card{
  max-width:none;
}
.collaborator-form{
  padding:0;
  overflow:hidden;
}
.form-section{
  padding:1.4rem 1.4rem .8rem;
  border-bottom:1px solid var(--border);
}
.form-section-title{
  margin-bottom:1rem;
}
.form-section-title h2{
  margin:0;
  font-size:1.1rem;
  font-weight:900;
  color:#111827;
}
.form-section-title p{
  margin:.2rem 0 0;
  color:var(--muted);
  font-size:.9rem;
}
.form-actions{
  display:flex;
  justify-content:flex-end;
  gap:.7rem;
  padding:1.2rem 1.4rem;
  background:#fbfcfe;
}
.role-check-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:.7rem;
}
.role-check{
  display:flex;
  gap:.55rem;
  align-items:center;
  padding:.75rem;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fbfcfe;
  cursor:pointer;
}
.role-check span{
  font-weight:700;
}
.role-check input{
  width:18px;
  height:18px;
}
.app-hero .app-hero{
  display:none!important;
}
.app-hero > p{
  display:none!important;
}

/* Photo fiche collaborateur */
.profile-card-photo{
  overflow:hidden;
}
.profile-photo-frame{
  margin:-1.25rem -1.25rem 1.1rem;
  background:linear-gradient(135deg,#e8f1fb,#f8fafc);
  padding:1.4rem;
}
.profile-photo-large{
  width:100%;
  aspect-ratio:1 / 1;
  object-fit:cover;
  border-radius:24px;
  background:#edf2f7;
  border:6px solid white;
  box-shadow:var(--shadow);
}
.profile-tags{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:.35rem;
  margin:.8rem 0;
}
.profile-tags span{
  display:inline-block;
  padding:.25rem .6rem;
  border-radius:999px;
  background:#edf4fb;
  color:var(--primary);
  font-size:.8rem;
  font-weight:700;
}
.edit-photo-preview{
  display:flex;
  align-items:center;
  gap:1rem;
  padding:1rem;
  border:1px solid var(--border);
  border-radius:18px;
  background:#fbfcfe;
}
.edit-photo-preview img{
  width:96px;
  height:96px;
  object-fit:cover;
  border-radius:18px;
  background:#edf2f7;
}
@media (max-width: 560px){
  .edit-photo-preview{
    display:block;
  }
  .edit-photo-preview img{
    margin-bottom:.8rem;
  }
}
/* Correctif layout fiche collaborateur */
.profile-card-photo{
  padding:0!important;
  overflow:hidden;
  position:relative;
  z-index:1;
}
.profile-card-photo .profile-card-body{
  padding:1.25rem;
}
.profile-photo-frame{
  margin:0!important;
  padding:1rem!important;
  background:linear-gradient(135deg,#e8f1fb,#f8fafc);
}
.profile-photo-large{
  display:block;
  width:100%;
  height:auto;
  max-height:420px;
  aspect-ratio:4 / 3;
  object-fit:cover;
  border-radius:20px;
  background:#edf2f7;
  border:0;
  box-shadow:none;
}
.fiche-info-card{
  position:relative;
  z-index:2;
}
@media (min-width: 992px){
  .fiche-info-card{
    margin-left:0;
  }
}
@media (max-width: 991px){
  .profile-photo-large{
    max-height:360px;
  }
}

/* Organigramme V2 - visuel amélioré */
.org-helpbar{display:flex;justify-content:space-between;align-items:center;gap:1rem;background:#fff;border:1px solid var(--border);border-radius:18px;padding:.9rem 1rem;margin-bottom:1rem;box-shadow:0 .35rem 1rem rgba(31,78,121,.05)}
.org-helpbar-legend{display:flex;align-items:center;gap:1rem;color:var(--muted);white-space:nowrap}
.org-helpbar-legend i{display:inline-block;width:.75rem;height:.75rem;border-radius:50%;background:var(--primary);margin-right:.35rem}
.org-helpbar-legend b{display:inline-flex;width:22px;height:22px;align-items:center;justify-content:center;border-radius:999px;background:var(--primary);color:#fff;font-size:.75rem;margin-right:.3rem}
.org-board{position:relative;min-height:620px;overflow:auto;border:1px solid var(--border);border-radius:24px;background:radial-gradient(circle at 12% 8%, rgba(79,129,189,.11), transparent 24%),linear-gradient(180deg,#ffffff,#f8fbff);box-shadow:var(--shadow)}
.org-board-inner{min-width:1200px;padding:3rem 3rem 4rem}
.org-tree-v2,.org-tree-v2 ul{list-style:none;margin:0;padding:0;text-align:center;position:relative}
.org-tree-v2{display:flex;justify-content:center;gap:2rem;align-items:flex-start}
.org-tree-v2 ul{display:flex;justify-content:center;gap:2rem;padding-top:3rem}
.org-tree-v2 li{position:relative;display:flex;flex-direction:column;align-items:center;padding:0}
.org-tree-v2 li::before,.org-tree-v2 li::after,.org-tree-v2 ul::before{content:"";position:absolute;background:#cbd5e1}
.org-tree-v2 ul::before{top:1.45rem;left:50%;width:2px;height:1.55rem}
.org-tree-v2 ul>li::before{top:-1.55rem;left:50%;width:2px;height:1.55rem}
.org-tree-v2 ul>li::after{top:-1.55rem;height:2px;left:calc(-50% - 1rem);right:calc(50% - 1rem)}
.org-tree-v2 ul>li:first-child::after{left:50%}
.org-tree-v2 ul>li:last-child::after{right:50%}
.org-tree-v2 ul>li:only-child::after{display:none}
.org-node-card{position:relative;width:310px;min-height:112px;display:grid;grid-template-columns:68px 1fr;gap:.85rem;align-items:center;text-align:left;padding:1rem;background:rgba(255,255,255,.96);border:1px solid #dbe3ee;border-left:5px solid var(--primary);border-radius:18px;box-shadow:0 .75rem 1.6rem rgba(31,78,121,.10);transition:transform .15s ease, box-shadow .15s ease, border-color .15s ease}
.org-node-card:hover{transform:translateY(-3px);box-shadow:0 1rem 2.2rem rgba(31,78,121,.16);border-color:#b9cbe0}
.org-node-avatar,.org-node-initials{width:62px;height:62px;border-radius:50%;display:flex;align-items:center;justify-content:center;object-fit:cover;background:#edf2f7;border:2px solid #fff;box-shadow:0 0 0 2px #d9e2ec;color:var(--primary);font-weight:900}
.org-node-avatar-link{text-decoration:none}
.org-node-name{display:block;color:#0f172a;font-weight:900;line-height:1.12;text-decoration:none}
.org-node-name:hover{text-decoration:underline}
.org-node-position{color:#334155;font-size:.9rem;margin-top:.15rem}
.org-node-meta{display:flex;gap:.35rem;flex-wrap:wrap;margin-top:.35rem}
.org-node-meta span{padding:.15rem .48rem;border-radius:999px;background:#e8f1fb;color:var(--primary);font-size:.74rem;font-weight:700}
.org-node-email{display:block;margin-top:.35rem;color:#64748b;text-decoration:none;font-size:.76rem;word-break:break-all}
.org-node-team{position:absolute;top:-10px;right:-10px;width:28px;height:28px;display:flex;align-items:center;justify-content:center;border-radius:50%;background:var(--primary);color:white;font-weight:900;font-size:.78rem;box-shadow:0 .45rem .9rem rgba(31,78,121,.24)}
@media (max-width:900px){.org-helpbar{display:block}.org-helpbar-legend{margin-top:.7rem;flex-wrap:wrap}.org-board{min-height:500px}.org-board-inner{min-width:760px;padding:2rem}.org-node-card{width:270px}}

/* Organigramme Treant-like V3 */
.org-toolbar-v3{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:1rem;
  background:white;
  border:1px solid var(--border);
  border-radius:18px;
  padding:.85rem;
  margin-bottom:1rem;
  box-shadow:0 .35rem 1rem rgba(31,78,121,.05);
}
.org-search{
  flex:1;
  display:flex;
  align-items:center;
  gap:.55rem;
  border:1px solid var(--border);
  border-radius:14px;
  padding:.55rem .8rem;
  background:#fbfcfe;
}
.org-search input{
  width:100%;
  border:0;
  outline:0;
  background:transparent;
}
.org-actions-v3{
  display:flex;
  gap:.5rem;
}
.org-treant-board{
  height:680px;
  overflow:auto;
  border:1px solid var(--border);
  border-radius:24px;
  background:
    radial-gradient(circle at 10% 10%, rgba(79,129,189,.10), transparent 24%),
    linear-gradient(180deg,#fff,#f8fbff);
  box-shadow:var(--shadow);
}
#orgTreant{
  position:relative;
  min-width:100%;
  min-height:100%;
}
.treant-stage{
  position:relative;
}
.treant-lines{
  position:absolute;
  left:0;
  top:0;
  pointer-events:none;
}
.treant-node{
  position:absolute;
}
.treant-card{
  position:relative;
  display:grid;
  grid-template-columns:70px 1fr;
  gap:.9rem;
  align-items:center;
  min-height:112px;
  padding:1rem;
  background:white;
  border:1px solid #dbe3ee;
  border-left:5px solid var(--primary);
  border-radius:18px;
  box-shadow:0 .75rem 1.6rem rgba(31,78,121,.10);
  transition:transform .15s ease, opacity .15s ease, box-shadow .15s ease;
}
.treant-card:hover{
  transform:translateY(-3px);
  box-shadow:0 1rem 2.2rem rgba(31,78,121,.16);
}
.treant-avatar,.treant-avatar.initials{
  width:62px;
  height:62px;
  border-radius:50%;
  object-fit:cover;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#edf2f7;
  border:2px solid white;
  box-shadow:0 0 0 2px #d9e2ec;
  color:var(--primary);
  font-weight:900;
}
.treant-avatar-link{text-decoration:none}
.treant-name{
  display:block;
  color:#0f172a;
  font-weight:900;
  line-height:1.12;
  text-decoration:none;
}
.treant-title{
  color:#334155;
  font-size:.9rem;
  margin-top:.15rem;
}
.treant-tags{
  display:flex;
  gap:.35rem;
  flex-wrap:wrap;
  margin-top:.35rem;
}
.treant-tags span{
  padding:.15rem .48rem;
  border-radius:999px;
  background:#e8f1fb;
  color:var(--primary);
  font-size:.74rem;
  font-weight:700;
}
.treant-email{
  margin-top:.35rem;
  color:#64748b;
  font-size:.76rem;
  word-break:break-all;
}
.treant-team{
  position:absolute;
  top:-10px;
  right:-10px;
  width:28px;
  height:28px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  background:var(--primary);
  color:white;
  font-weight:900;
  font-size:.78rem;
  box-shadow:0 .45rem .9rem rgba(31,78,121,.24);
}
.treant-card.is-dimmed{opacity:.22}
.treant-card.is-match{
  border-color:#14b8a6;
  box-shadow:0 0 0 3px rgba(20,184,166,.18),0 1rem 2rem rgba(31,78,121,.15);
}
body.org-compact .treant-card{
  grid-template-columns:54px 1fr;
  min-height:92px;
  padding:.75rem;
}
body.org-compact .treant-avatar,
body.org-compact .treant-avatar.initials{
  width:48px;
  height:48px;
}
body.org-compact .treant-email{
  display:none;
}
@media (max-width:900px){
  .org-toolbar-v3{display:block}
  .org-actions-v3{margin-top:.7rem}
  .org-treant-board{height:560px}
}

/* Exports et impression */
.print-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:1rem;
  background:white;
  border:1px solid var(--border);
  border-radius:20px;
  padding:1rem;
  margin-bottom:1rem;
  box-shadow:var(--shadow);
}
.print-toolbar h1{
  margin:0;
  font-weight:900;
}
.print-toolbar p{
  margin:.2rem 0 0;
  color:var(--muted);
}
.print-filters{
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
  align-items:center;
}
.print-filters select{
  min-width:190px;
}
.print-cover{
  display:flex;
  align-items:center;
  gap:1rem;
  background:white;
  border:1px solid var(--border);
  border-radius:20px;
  padding:1.2rem;
  margin-bottom:1rem;
}
.print-cover img{
  width:72px;
  height:72px;
  object-fit:contain;
}
.print-cover h1{
  margin:0;
  font-weight:900;
}
.print-cover p{
  margin:.2rem 0 0;
  color:var(--muted);
}
.print-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:1rem;
}
.print-person-card{
  background:white;
  border:1px solid var(--border);
  border-radius:18px;
  padding:.85rem;
  display:grid;
  grid-template-columns:76px 1fr;
  gap:.75rem;
  align-items:center;
  page-break-inside:avoid;
}
.print-person-card img{
  width:76px;
  height:76px;
  border-radius:16px;
  object-fit:cover;
  background:#edf2f7;
}
.print-person-card h2{
  font-size:1rem;
  font-weight:900;
  margin:0;
}
.print-person-card p{
  margin:.15rem 0;
  color:#334155;
  font-size:.86rem;
}
.print-person-card span{
  display:block;
  color:var(--primary);
  font-size:.78rem;
  font-weight:700;
}
.print-person-card small{
  display:block;
  color:var(--muted);
  font-size:.72rem;
  word-break:break-all;
}
@media print{
  @page{
    size:A3 landscape;
    margin:10mm;
  }
  body{
    background:white!important;
  }
  .no-print,
  .app-sidebar,
  .topbar,
  .app-hero-actions,
  .org-toolbar-v3,
  .sidebar-footer{
    display:none!important;
  }
  .app-main{
    margin-left:0!important;
    width:100%!important;
  }
  .content-wrap{
    padding:0!important;
    max-width:none!important;
  }
  .app-hero{
    box-shadow:none!important;
    margin-bottom:8mm!important;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
  .org-treant-board{
    height:auto!important;
    min-height:auto!important;
    overflow:visible!important;
    border:0!important;
    box-shadow:none!important;
  }
  #orgTreant{
    overflow:visible!important;
  }
  .treant-stage{
    transform:scale(.72);
    transform-origin:top left;
  }
  .treant-card,
  .print-person-card{
    page-break-inside:avoid;
  }
  .print-toolbar{
    display:none!important;
  }
  .print-cover{
    box-shadow:none!important;
    border:0!important;
    padding:0 0 6mm!important;
  }
  .print-grid{
    grid-template-columns:repeat(4,1fr);
    gap:6mm;
  }
}
@media (max-width: 900px){
  .print-toolbar{
    display:block;
  }
  .print-filters{
    margin-top:1rem;
  }
  .print-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}
@media (max-width: 560px){
  .print-grid{
    grid-template-columns:1fr;
  }
}
