/* ════════════════════════════════════════════════════════════
   THÈME SOMBRE SUPER-ADMIN (Trigo) — wrapper .sa-shell
   Re-thème les pages Sociétés / Clients / Projets en sombre
   (cohérent avec la vue Retrofit). Scopé : n'affecte que .sa-shell.
   ════════════════════════════════════════════════════════════ */
.sa-shell{
  --sa-bleu:#0D1A2D; --sa-profond:#091322; --sa-panel:#11203699; --sa-trait:#27405E;
  --sa-trace:#6E9CD2; --sa-acier:#8FA6C2; --sa-papier:#EDF3FB;
  --sa-ambre:#F0A63C; --sa-ambre-vif:#FFC15E; --sa-vert:#79C99E; --sa-rouge:#FF7A68;
  position:relative; min-height:100vh;
  margin:calc(-1 * var(--space-6,24px)) calc(-1 * var(--space-6,24px)) 0;
  padding:0 0 70px;
  background:linear-gradient(180deg,var(--sa-profond) 0%,var(--sa-bleu) 18%,var(--sa-bleu) 82%,var(--sa-profond) 100%);
  color:var(--sa-papier); font-family:'IBM Plex Mono',monospace;
}
.sa-shell .saclients{max-width:1280px;margin:0 auto;padding:42px 28px 0}
.sa-shell::before{
  content:"";position:absolute;inset:0;pointer-events:none;z-index:0;
  background:linear-gradient(var(--sa-trait) 1px,transparent 1px) 0 0/100% 56px,
            linear-gradient(90deg,var(--sa-trait) 1px,transparent 1px) 0 0/56px 100%;
  opacity:.12;
  -webkit-mask-image:radial-gradient(ellipse 90% 80% at 50% 20%,#000 30%,transparent 100%);
  mask-image:radial-gradient(ellipse 90% 80% at 50% 20%,#000 30%,transparent 100%);
}
.sa-shell > *{position:relative;z-index:1}

/* ── titres / hero ── */
.sa-shell .saclients__title,
.sa-shell .page-title,
.sa-shell .projects__hero-text h2{font-family:'Bricolage Grotesque',sans-serif;font-weight:800;color:var(--sa-papier);letter-spacing:-.01em}
.sa-shell .saclients__subtitle,
.sa-shell .page-subtitle,
.sa-shell .projects__hero-text p{color:var(--sa-acier)}

/* ── barre recherche / filtres ── */
.sa-shell .saclients__search{background:var(--sa-panel);box-shadow:none;border:1px solid var(--sa-trait);color:var(--sa-acier);backdrop-filter:blur(6px)}
.sa-shell .saclients__search input{color:var(--sa-papier)}
.sa-shell .saclients__search input::placeholder{color:var(--sa-trace)}
.sa-shell .saclients__select,
.sa-shell .projects__filters select,
.sa-shell .projects__search-input{background:var(--sa-panel);box-shadow:none;border:1px solid var(--sa-trait);color:var(--sa-acier)}
.sa-shell .saclients__select option,
.sa-shell .projects__filters select option{background:var(--sa-bleu);color:var(--sa-papier)}
.sa-shell .projects__search{background:var(--sa-panel);box-shadow:none;border:1px solid var(--sa-trait)}
.sa-shell .projects__search-icon{color:var(--sa-acier)}

/* ── boutons ── */
.sa-shell .btn--primary{background:linear-gradient(135deg,var(--sa-ambre),#d98a1c);color:#0D1A2D;border:none;box-shadow:none}
.sa-shell .btn--primary:hover{filter:brightness(1.06)}
.sa-shell .btn--ghost,.sa-shell .btn--secondary{background:var(--sa-panel);border:1px solid var(--sa-trait);color:var(--sa-acier)}
.sa-shell .btn--ghost:hover,.sa-shell .btn--secondary:hover{border-color:var(--sa-ambre);color:var(--sa-ambre-vif)}

/* ── CARDS Clients / Sociétés ── */
.sa-shell .saclient-card{background:var(--sa-panel);border:1px solid var(--sa-trait);box-shadow:none;backdrop-filter:blur(6px);transition:border-color .2s ease,transform .2s ease}
.sa-shell .saclient-card:hover{border-color:var(--sa-acier);transform:translateY(-2px)}
.sa-shell .saclient-card__avatar{background:linear-gradient(135deg,var(--sa-ambre),#b9701a);color:#0D1A2D;box-shadow:none}
.sa-shell .saclient-card__name{color:var(--sa-papier);font-family:'Bricolage Grotesque',sans-serif}
.sa-shell .saclient-card__code{color:var(--sa-acier)}
.sa-shell .saclient-card__row{color:var(--sa-acier)}
.sa-shell .saclient-card__row svg{color:var(--sa-trace)}
.sa-shell .saclient-card__badge{background:rgba(110,156,210,.12);color:var(--sa-acier);box-shadow:none;border:1px solid var(--sa-trait)}
.sa-shell .saclient-card__badge--shared{background:rgba(121,201,158,.12);color:var(--sa-vert);border-color:rgba(121,201,158,.4)}
.sa-shell .saclient-card__badge--solo{color:var(--sa-acier)}
.sa-shell .saclient-card__badge--off{background:rgba(255,122,104,.12);color:var(--sa-rouge);border-color:rgba(255,122,104,.4)}
.sa-shell .saclient-card__admin{background:var(--sa-panel);border:1px solid var(--sa-trait);color:var(--sa-ambre-vif);box-shadow:none}
.sa-shell .saclient-card__admin:hover{border-color:var(--sa-ambre)}
.sa-shell .saclients__empty{color:var(--sa-acier)}

/* ── onglets dans le panneau (Effectifs) ── */
.sa-shell .sa-panel-tab{color:var(--sa-acier)}
.sa-shell .sa-panel-tab.is-active{color:var(--sa-ambre-vif);border-bottom-color:var(--sa-ambre)}
.sa-shell .sa-eff-emp,.sa-shell .sa-presta-card{background:var(--sa-panel);box-shadow:none;border:1px solid var(--sa-trait)}
.sa-shell .sa-eff-name{color:var(--sa-papier)}
.sa-shell .sa-eff-chip{background:rgba(110,156,210,.12);color:var(--sa-acier)}

/* ── CARDS Projets (liste super-admin) ── */
.sa-shell .projects__hero{background:var(--sa-panel);border:1px solid var(--sa-trait);box-shadow:none}
.sa-shell .projects__hero-stat-value{color:var(--sa-ambre-vif)}
.sa-shell .projects__hero-stat-label{color:var(--sa-acier)}
.sa-shell .project-card{background:var(--sa-panel);border:1px solid var(--sa-trait);box-shadow:none;backdrop-filter:blur(6px)}
.sa-shell .project-card:hover{border-color:var(--sa-acier)}
.sa-shell .project-card__title{color:var(--sa-papier);font-family:'Bricolage Grotesque',sans-serif}
.sa-shell .project-card__meta{color:var(--sa-acier)}
.sa-shell .project-card__meta-dot{background:var(--sa-trait)}
.sa-shell .project-card__progress-bar{background:var(--sa-trait)}
.sa-shell .project-card__progress-text{color:var(--sa-papier)}
.sa-shell .project-card__date{color:var(--sa-acier)}
.sa-shell .project-card__edit-btn,.sa-shell .project-card__portal-btn{background:var(--sa-panel);border:1px solid var(--sa-trait);color:var(--sa-acier);box-shadow:none}
.sa-shell .project-card__edit-btn:hover,.sa-shell .project-card__portal-btn:hover{border-color:var(--sa-ambre);color:var(--sa-ambre-vif)}

/* tables eventuelles */
.sa-shell .table,.sa-shell .table-container{background:var(--sa-panel);color:var(--sa-papier);border-color:var(--sa-trait)}
.sa-shell .table th{color:var(--sa-acier);border-color:var(--sa-trait)}
.sa-shell .table td{border-color:var(--sa-trait)}

/* ════════════════════════════════════════════════════════════
   THÈME SOMBRE GLOBAL SUPER-ADMIN — surcharge des variables CSS
   (re-thème fond, sidebar, topbar, panneaux, client-portal, etc.)
   ════════════════════════════════════════════════════════════ */
body.sa-theme{
  --color-bg-app:#0D1A2D; --color-bg-primary:#11203a; --color-bg-secondary:#0f1d33; --color-bg-tertiary:#0c1830;
  --color-bg-sidebar:#0b1525; --color-bg-topbar:rgba(11,21,37,.9);
  --color-bg-hover:rgba(255,255,255,.05); --color-bg-active:rgba(255,255,255,.08); --color-bg-selected:rgba(240,166,60,.14);
  --color-surface:#11203a; --color-surface-raised:#13233f; --color-surface-overlay:#16263d;
  --color-surface-input:#0e1c33; --color-surface-input-hover:#13233f; --color-surface-sunken:#0a1426; --color-surface-disabled:#0e1c33;
  --color-text-primary:#EDF3FB; --color-text-secondary:#A9BBD4; --color-text-tertiary:#8FA6C2;
  --color-text-placeholder:#5f7d99; --color-text-disabled:#46607a; --color-text-link:#FFC15E; --color-text-on-accent:#0D1A2D; --color-text-inverse:#0D1A2D;
  --color-border:rgba(110,156,210,.18); --color-border-light:rgba(110,156,210,.10); --color-border-strong:rgba(110,156,210,.30);
  --color-border-input:rgba(110,156,210,.20); --color-border-input-hover:rgba(240,166,60,.5); --color-border-focus:#F0A63C;
  --neu-shadow-dark:rgba(0,0,0,.45); --neu-shadow-light:rgba(255,255,255,.03);
  --color-accent:#F0A63C; --color-accent-hover:#FFC15E; --color-accent-active:#d98a1c;
  --color-accent-subtle:rgba(240,166,60,.10); --color-accent-muted:rgba(240,166,60,.18);
  background:var(--color-bg-app);
}
/* fond global + zones */
body.sa-theme .app-layout,
body.sa-theme .main-content,
body.sa-theme .content-area,
body.sa-theme .page-container{background:var(--color-bg-app)}
/* sidebar / topbar : bordures discrètes sombres */
body.sa-theme .sidebar,
body.sa-theme .topbar{border-color:var(--color-border)}
/* panneaux glissants (formulaires) */
body.sa-theme .sliding-panel__content{background:var(--color-bg-primary);border-left:1px solid var(--color-border)}
body.sa-theme .sliding-panel__header{border-color:var(--color-border)}
/* la vue retrofit (.rtf) garde son fond propre — neutralise le double fond */
body.sa-theme .rtf{margin-top:0}

/* ── corrections de contraste sous body.sa-theme ── */
/* en-tetes phase/metro de la matrice (texte #1a4480 -> clair) */
html[data-theme="dark"] body.sa-theme .pdetail__matrix-phase td,
html[data-theme="dark"] body.sa-theme .pdetail__matrix-mhead{color:var(--color-text-primary)}
/* badges de step (textes fonces -> clairs) */
body.sa-theme .step-badge--success{color:#9be3b8}
body.sa-theme .step-badge--warning{color:#f5d4a8}
body.sa-theme .step-badge--error{color:#f5a8a8}
body.sa-theme .step-badge--info{color:#9cc0ec}
/* onglets du detail projet */
html[data-theme="dark"] body.sa-theme .pdetail__tab.is-active{color:var(--color-accent);border-bottom-color:var(--color-accent)}

/* ── portail client en sombre : surfaces NEUTRES uniquement (statuts colorés conservés) ── */
html[data-theme="dark"] body.sa-theme .cp-planning__sun,
html[data-theme="dark"] body.sa-theme .cp-planning__cell--weekend-empty,
html[data-theme="dark"] body.sa-theme .cp-planning__cell--sun-bg{background:rgba(255,255,255,.035)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell-inner[style*="#f1f5f9"],
html[data-theme="dark"] body.sa-theme .cp-planning__cell-inner[style*="#f8fafc"]{background:rgba(255,255,255,.04)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__day-count--empty{background:rgba(255,255,255,.05)!important;color:var(--color-text-tertiary)!important}
html[data-theme="dark"] body.sa-theme .cp-week-pill--soft{background:rgba(255,255,255,.05)!important;color:var(--color-text-secondary)!important;border-color:var(--color-border)!important}
html[data-theme="dark"] body.sa-theme .cp-hab-card__type-badge{color:var(--color-text-primary)!important}

/* ── APLATIR : aucun relief / ombre neumorphique en super-admin ── */
body.sa-theme{
  --neu-raised:none; --neu-raised-sm:none; --neu-raised-lg:none;
  --neu-inset:none; --neu-inset-sm:none; --neu-flat:none; --neu-pressed:none;
  --shadow-xs:none; --shadow-sm:none; --shadow-md:none; --shadow-lg:none; --shadow-xl:none;
  --neu-shadow-dark:transparent; --neu-shadow-light:transparent;
}
/* aplatir aussi les ombres codees en dur sur les surfaces principales (super-admin) */
body.sa-theme .btn, body.sa-theme button, body.sa-theme input, body.sa-theme select, body.sa-theme textarea,
body.sa-theme .saclient-card, body.sa-theme .project-card, body.sa-theme .projects__hero,
body.sa-theme .kpi, body.sa-theme .sidebar, body.sa-theme .topbar,
body.sa-theme .sliding-panel__content, body.sa-theme [class*="-card"]{box-shadow:none !important}

/* ════ AUCUNE OMBRE NULLE PART EN SUPER-ADMIN (box-shadow + text-shadow) ════ */
body.sa-theme *,
body.sa-theme *::before,
body.sa-theme *::after{ box-shadow:none !important; text-shadow:none !important; }

/* ════ Formulaires des panneaux super-admin : fins, arrondis, soignés ════ */
body.sa-theme .sliding-panel__title{font-family:'Bricolage Grotesque',sans-serif;font-weight:800;letter-spacing:-.01em;color:var(--color-text-primary)}
body.sa-theme .sliding-panel__body{padding-top:4px}
body.sa-theme .form-group{margin-bottom:14px}
body.sa-theme .form-label{display:block;font-size:8.5px;letter-spacing:.2em;text-transform:uppercase;color:#8FA6C2;margin-bottom:7px;font-weight:600}
body.sa-theme .form-input,
body.sa-theme input.form-input,
body.sa-theme select.form-input,
body.sa-theme textarea.form-input{
  background:rgba(13,26,45,.55)!important;
  border:1px solid rgba(110,156,210,.20)!important;
  border-radius:11px!important;
  padding:11px 14px!important;
  color:#EDF3FB!important;
  font-size:14px;
  transition:border-color .2s ease, background .2s ease;
}
body.sa-theme .form-input::placeholder{color:#5f7d99}
body.sa-theme .form-input:hover{border-color:rgba(110,156,210,.34)!important}
body.sa-theme .form-input:focus{border-color:#F0A63C!important;background:rgba(13,26,45,.78)!important;outline:none}
body.sa-theme select.form-input option{background:#0D1A2D;color:#EDF3FB}
body.sa-theme .btn--full{border-radius:11px}
/* divers libellés de section dans les panneaux */
body.sa-theme .sliding-panel__body [style*="font-weight:600"]{color:var(--color-text-primary)}

/* ════ Portail client — onglet Équipe : en-têtes de poste adaptés au sombre ════ */
html[data-theme="dark"] body.sa-theme .cp-equipe__group-header{
  background:rgba(255,255,255,.05)!important;
  border:1px solid rgba(110,156,210,.16);
}
html[data-theme="dark"] body.sa-theme .cp-equipe__group-title{color:var(--color-text-primary)!important}
html[data-theme="dark"] body.sa-theme .cp-equipe__avatar-fallback{filter:saturate(.55) brightness(.92)}

/* ════ Portail client — PolyCompétence : cases & bordures adaptées au sombre ════ */
html[data-theme="dark"] body.sa-theme #cp-content [style*="background:#dcfce7"]{background:rgba(96,190,140,.16)!important;color:#8fe3b0!important}
html[data-theme="dark"] body.sa-theme #cp-content [style*="background:#fee2e2"]{background:rgba(240,120,110,.15)!important;color:#f2a39b!important}
html[data-theme="dark"] body.sa-theme #cp-content [style*="color:#16a34a"]{color:#8fe3b0!important}
html[data-theme="dark"] body.sa-theme #cp-content [style*="color:#dc2626"]{color:#f2a39b!important}
html[data-theme="dark"] body.sa-theme #cp-content [style*="solid #fff"]{border-color:rgba(110,156,210,.15)!important}
html[data-theme="dark"] body.sa-theme #cp-content [style*="background:#e2e8f0"]{background:rgba(110,156,210,.18)!important;color:#cdddf0!important}

/* ════ Portail — variables d'accent manquantes (sinon couleurs claires non adaptées) ════ */
body.sa-theme{ --color-primary:#6E9CD2; --color-success:#79C99E; --color-warning:#F0A63C; --color-error:#E0584A; }

/* ════ Portail — onglet Pointages : grille planning adaptée au thème sombre ════ */
html[data-theme="dark"] body.sa-theme .cp-planning__cell--normal .cp-planning__cell-inner{background:rgba(96,190,140,.18)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--night .cp-planning__cell-inner{background:rgba(20,28,46,.9)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--sunday .cp-planning__cell-inner{background:rgba(110,156,210,.12)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--saturday .cp-planning__cell-inner{background:rgba(240,166,60,.16)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--weekend-empty{background:rgba(255,255,255,.03)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--sun-bg,
html[data-theme="dark"] body.sa-theme .cp-planning__sun{background:rgba(110,156,210,.08)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--sat-bg,
html[data-theme="dark"] body.sa-theme .cp-planning__sat{background:rgba(240,166,60,.08)!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--normal .cp-planning__hours{color:#9be3b8!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--saturday .cp-planning__hours{color:#f0b968!important}
html[data-theme="dark"] body.sa-theme .cp-planning__cell--sunday .cp-planning__hours,
html[data-theme="dark"] body.sa-theme .cp-planning__sun .cp-planning__day-num,
html[data-theme="dark"] body.sa-theme .cp-planning__sun .cp-planning__day-name{color:#9fb4d0!important}
html[data-theme="dark"] body.sa-theme .cp-planning__sat .cp-planning__day-num{color:#f0b968!important}
html[data-theme="dark"] body.sa-theme .cp-planning__day-count{background:rgba(110,156,210,.22)!important;color:#bcd3ef!important}
html[data-theme="dark"] body.sa-theme .cp-planning__day-count--empty{background:rgba(255,255,255,.06)!important;color:#7d93af!important}
html[data-theme="dark"] body.sa-theme .cp-planning__total-badge--night{background:rgba(126,200,220,.16)!important;color:#bfe6f1!important}
html[data-theme="dark"] body.sa-theme .cp-planning__total-badge--sunday{background:rgba(240,166,60,.16)!important;color:#f0b968!important}

/* ════ Portail — week-pills (validation hebdo) ════ */
html[data-theme="dark"] body.sa-theme .cp-week-pill--ok{background:rgba(96,190,140,.12)!important;border-color:rgba(96,190,140,.5)!important}
html[data-theme="dark"] body.sa-theme .cp-week-pill--ko{background:rgba(240,166,60,.12)!important;border-color:rgba(240,166,60,.55)!important}
html[data-theme="dark"] body.sa-theme .cp-week-pill--soft{background:rgba(255,255,255,.04)!important;border-color:rgba(110,156,210,.3)!important}
html[data-theme="dark"] body.sa-theme .cp-week-pill__status{color:#86e0aa!important}
html[data-theme="dark"] body.sa-theme .cp-week-pill__status--ko{color:#f0b968!important}
html[data-theme="dark"] body.sa-theme .cp-week-pill__status--pending{color:#9fb4d0!important}

/* ════ Portail — badges statut & pills habilitations (clairs -> teintes sombres) ════ */
html[data-theme="dark"] body.sa-theme .cp-badge--valid,html[data-theme="dark"] body.sa-theme .cp-badge--validated,
html[data-theme="dark"] body.sa-theme .cp-hab-card__status-pill--valid{background:rgba(96,190,140,.16)!important;color:#8fe3b0!important}
html[data-theme="dark"] body.sa-theme .cp-badge--expiring_soon,html[data-theme="dark"] body.sa-theme .cp-badge--open,
html[data-theme="dark"] body.sa-theme .cp-hab-card__status-pill--expiring_soon{background:rgba(240,166,60,.16)!important;color:#f0b968!important}
html[data-theme="dark"] body.sa-theme .cp-badge--expired,
html[data-theme="dark"] body.sa-theme .cp-hab-card__status-pill--expired{background:rgba(240,120,110,.16)!important;color:#f2a39b!important}
html[data-theme="dark"] body.sa-theme .cp-badge--closed{background:rgba(110,156,210,.16)!important;color:#a9c6ea!important}
html[data-theme="dark"] body.sa-theme .cp-hab-card__status-pill--revoked{background:rgba(255,255,255,.06)!important;color:#9fb4d0!important}

/* ════ Portail — liseré discret au-dessus des sous-totaux (au lieu du gros trait blanc) ════ */
html[data-theme="dark"] body.sa-theme .cp-planning__footer td{border-top:1px solid rgba(110,156,210,.22)!important}

/* ════════════════ THÈME CLAIR SUPER-ADMIN (raffiné) — actif quand data-theme=light ════════════════ */
html[data-theme="light"] body.sa-theme{
  --color-bg-app:#EDF1F8; --color-bg-primary:#FFFFFF; --color-bg-secondary:#F4F7FC; --color-bg-tertiary:#E9EFF7;
  --color-bg-sidebar:#FFFFFF; --color-bg-topbar:rgba(255,255,255,.88);
  --color-bg-hover:rgba(28,55,98,.05); --color-bg-active:rgba(28,55,98,.08); --color-bg-selected:rgba(240,166,60,.16);
  --color-surface:#FFFFFF; --color-surface-raised:#FFFFFF; --color-surface-overlay:#FFFFFF;
  --color-surface-input:#FFFFFF; --color-surface-input-hover:#F4F7FC; --color-surface-sunken:#EDF1F8; --color-surface-disabled:#EEF2F8;
  --color-text-primary:#17273D; --color-text-secondary:#46607A; --color-text-tertiary:#6B819B;
  --color-text-placeholder:#9AAAC0; --color-text-disabled:#AEBCCF; --color-text-link:#C8861E; --color-text-on-accent:#16263B; --color-text-inverse:#FFFFFF;
  --color-border:rgba(28,55,98,.12); --color-border-light:rgba(28,55,98,.07); --color-border-strong:rgba(28,55,98,.20);
  --color-border-input:rgba(28,55,98,.16); --color-border-input-hover:rgba(240,166,60,.55); --color-border-focus:#E0931E;
  --color-accent:#E0931E; --color-accent-hover:#C8861E; --color-accent-active:#B5740F;
  --color-accent-subtle:rgba(240,166,60,.12); --color-accent-muted:rgba(240,166,60,.2);
  --color-primary:#3E6FA8; --color-success:#2E9266; --color-warning:#C8861E; --color-error:#C53D2F;
  background:var(--color-bg-app);
}
html[data-theme="light"] body.sa-theme .sidebar{border-right:1px solid var(--color-border)}
html[data-theme="light"] body.sa-theme .topbar{border-bottom:1px solid var(--color-border);backdrop-filter:blur(8px)}
/* Formulaires des panneaux — version claire */
html[data-theme="light"] body.sa-theme .form-label{color:#6B819B}
html[data-theme="light"] body.sa-theme .form-input,
html[data-theme="light"] body.sa-theme input.form-input,
html[data-theme="light"] body.sa-theme select.form-input,
html[data-theme="light"] body.sa-theme textarea.form-input{background:#FFFFFF!important;border-color:rgba(28,55,98,.16)!important;color:#17273D!important}
html[data-theme="light"] body.sa-theme .form-input::placeholder{color:#9AAAC0}
html[data-theme="light"] body.sa-theme .form-input:hover{border-color:rgba(28,55,98,.30)!important}
html[data-theme="light"] body.sa-theme .form-input:focus{border-color:#E0931E!important;background:#FFFFFF!important}
html[data-theme="light"] body.sa-theme select.form-input option{background:#FFFFFF;color:#17273D}
