/* TIMAH ACADEMY — identité visuelle officielle verrouillée
   Blanc dominant, bleu structurel, rouge pour les actions fortes.
   Cette feuille remplace visuellement les anciennes palettes sans toucher à la logique métier. */
:root{
  --timah-blue:#123fd4;
  --timah-blue-strong:#072fbe;
  --timah-blue-deep:#061f7a;
  --timah-red:#ef0f35;
  --timah-red-strong:#d9082b;
  --timah-bg:#f5f8fd;
  --timah-panel:#ffffff;
  --timah-panel-2:#f9fbff;
  --timah-soft:#edf3ff;
  --timah-soft-2:#e5edff;
  --timah-text:#101a3d;
  --timah-muted:#65708a;
  --timah-line:#dfe6f2;
  --timah-line-strong:#cbd7e9;
  --timah-success:#15803d;
  --timah-warning:#b45309;
  --timah-shadow:0 18px 46px rgba(16,42,110,.09);
  --timah-shadow-soft:0 10px 28px rgba(16,42,110,.06);
  --timah-radius:18px;
  color-scheme:light;
}
html[data-theme='dark']{
  --timah-bg:#080d1a;
  --timah-panel:#111a2c;
  --timah-panel-2:#0d1525;
  --timah-soft:#182641;
  --timah-soft-2:#203252;
  --timah-text:#f7f9ff;
  --timah-muted:#aeb9cf;
  --timah-line:rgba(198,211,239,.18);
  --timah-line-strong:rgba(198,211,239,.30);
  --timah-shadow:0 22px 54px rgba(0,0,0,.34);
  --timah-shadow-soft:0 12px 30px rgba(0,0,0,.24);
  color-scheme:dark;
}

*{box-sizing:border-box}
html,body{max-width:100%;overflow-x:hidden}
html{background:var(--timah-bg)!important;color-scheme:light}
html[data-theme='dark']{color-scheme:dark}
body{margin:0;background:var(--timah-bg)!important;color:var(--timah-text)!important;font-family:Inter,"Segoe UI",system-ui,-apple-system,Arial,sans-serif!important;transition:background .22s ease,color .22s ease}
body,button,input,textarea,select{font:inherit}
a{text-decoration:none}
img,video,iframe{max-width:100%}

/* Neutralisation des anciens fonds et dégradés */
.admin-shell,.admin-main,.admin-content,.student-app,.student-main,.student-content,.teacher-shell,.teacher-main,.teacher-subpage-main,.resp-shell,.resp-page,.public-main,.auth-page,.page-wrapper,.content-wrapper{
  background:var(--timah-bg)!important;
  color:var(--timah-text)!important;
}
.admin-main::before,.student-main::before,.teacher-main::before,.resp-page::before,.content-wrapper::before{display:none!important}

/* Barres supérieures */
.admin-topbar,.student-topbar,.teacher-topbar,.resp-navbar,.site-header,.public-header,.portal-header,.page-header{
  background:color-mix(in srgb,var(--timah-panel) 96%,transparent)!important;
  color:var(--timah-text)!important;
  border-color:var(--timah-line)!important;
  box-shadow:0 8px 30px rgba(15,35,90,.05)!important;
  backdrop-filter:blur(18px)!important;
}
html[data-theme='dark'] .admin-topbar,
html[data-theme='dark'] .student-topbar,
html[data-theme='dark'] .teacher-topbar,
html[data-theme='dark'] .resp-navbar,
html[data-theme='dark'] .site-header,
html[data-theme='dark'] .public-header{
  background:rgba(8,13,26,.94)!important;
  box-shadow:0 12px 34px rgba(0,0,0,.26)!important;
}

/* Sidebars : claires en mode clair, bleu nuit propre en mode sombre */
.admin-sidebar,.student-sidebar,.teacher-sidebar{
  background:var(--timah-panel)!important;
  color:var(--timah-text)!important;
  border-color:var(--timah-line)!important;
  box-shadow:8px 0 30px rgba(15,35,90,.04)!important;
}
html[data-theme='dark'] .admin-sidebar,
html[data-theme='dark'] .student-sidebar,
html[data-theme='dark'] .teacher-sidebar{
  background:linear-gradient(180deg,#091327 0%,#0d1b35 58%,#102447 100%)!important;
  color:#f7f9ff!important;
  border-color:rgba(198,211,239,.14)!important;
}
.admin-sidebar__top,.admin-sidebar__bottom,.student-sidebar__top,.student-sidebar__bottom{background:transparent!important;border-color:var(--timah-line)!important}
.admin-brand,.brand,.resp-brand{color:var(--timah-text)!important}

/* Navigation */
.admin-nav,.student-nav,.teacher-nav,.resp-nav{background:transparent!important}
.admin-link,.student-link,.student-link--button,.resp-nav__item,.teacher-link,.nav-link,.admin-nav-group summary{
  color:var(--timah-muted)!important;
  border:1px solid transparent!important;
  border-radius:14px!important;
  background:transparent!important;
  box-shadow:none!important;
  transition:.18s ease!important;
}
html[data-theme='dark'] .admin-link,
html[data-theme='dark'] .student-link,
html[data-theme='dark'] .student-link--button,
html[data-theme='dark'] .resp-nav__item,
html[data-theme='dark'] .teacher-link,
html[data-theme='dark'] .nav-link,
html[data-theme='dark'] .admin-nav-group summary{color:#c6d1e8!important}
.admin-link:hover,.student-link:hover,.student-link--button:hover,.resp-nav__item:hover,.teacher-link:hover,.nav-link:hover,.admin-nav-group summary:hover{
  background:var(--timah-soft)!important;
  color:var(--timah-blue)!important;
  border-color:var(--timah-line)!important;
}
.admin-link.is-active,.student-link.is-active,.resp-nav__item.is-active,.teacher-link.is-active,.nav-link.is-active,.admin-link--dashboard.is-active{
  background:linear-gradient(135deg,var(--timah-blue),var(--timah-blue-strong))!important;
  color:#fff!important;
  border-color:transparent!important;
  box-shadow:0 14px 28px -18px rgba(18,63,212,.82)!important;
}
.admin-link.is-active *,.student-link.is-active *,.resp-nav__item.is-active *{color:#fff!important}
.admin-nav-group{
  background:transparent!important;
  border:1px solid transparent!important;
  border-radius:16px!important;
  box-shadow:none!important;
}
.admin-nav-group[open]{background:var(--timah-panel-2)!important;border-color:var(--timah-line)!important}
html[data-theme='dark'] .admin-nav-group[open]{background:rgba(255,255,255,.045)!important}
.admin-nav-group__links{background:transparent!important}
.admin-link__icon,.student-link__icon,.resp-icon{background:var(--timah-soft)!important;color:var(--timah-blue)!important;border-radius:10px!important}
.admin-link.is-active .admin-link__icon,.student-link.is-active .student-link__icon{background:rgba(255,255,255,.18)!important;color:#fff!important}

/* En-têtes de page */
.admin-topbar h1,.teacher-subpage-header h1,.student-page-title,.resp-page h1,.page-title{color:var(--timah-text)!important;letter-spacing:-.025em!important}
.admin-breadcrumb,.admin-breadcrumb a,.eyebrow,.section-kicker{color:var(--timah-blue)!important;font-weight:850!important}
.admin-topbar p,.teacher-subpage-header p,.page-subtitle{color:var(--timah-muted)!important}

/* Cartes et surfaces */
.card,.panel,.box,.section,.admin-panel,.admin-section,.admin-list-panel,.admin-summary-card,.admin-stat-card,.admin-collapse-box,.teacher-card,.teacher-panel,.teacher-section,.student-card,.td-card,.td-panel,.auth-card,.resp-card,.resp-panel,.command-domain,.command-metric,.command-feed,.faq-item,.step,.audience-card,.admin-homepage-card,.admin-form-card,.admin-userbox,.resp-user,.invoice-card,.subscription-card,.message-card,.course-card{
  background:var(--timah-panel)!important;
  color:var(--timah-text)!important;
  border:1px solid var(--timah-line)!important;
  border-radius:var(--timah-radius)!important;
  box-shadow:var(--timah-shadow-soft)!important;
}
.card:hover,.admin-summary-card:hover,.admin-stat-card:hover,.teacher-card:hover,.student-card:hover,.td-card:hover,.course-card:hover{border-color:color-mix(in srgb,var(--timah-blue) 30%,var(--timah-line))!important;box-shadow:var(--timah-shadow)!important}
.card h1,.card h2,.card h3,.panel h1,.panel h2,.panel h3,.admin-panel h1,.admin-panel h2,.admin-panel h3,.teacher-card h1,.teacher-card h2,.teacher-card h3,.student-card h1,.student-card h2,.student-card h3,.command-domain h2,.command-domain h3{color:var(--timah-text)!important}
p,small,.muted,.admin-muted,.teacher-muted,.student-muted,.help-text,.description{color:var(--timah-muted)!important}

/* Dashboard administrateur */
.command-hero,.admin-dashboard-hero,.dashboard-hero{
  background:linear-gradient(135deg,#ffffff 0%,#f3f7ff 66%,#fff2f5 100%)!important;
  color:var(--timah-text)!important;
  border:1px solid var(--timah-line)!important;
  box-shadow:var(--timah-shadow)!important;
}
html[data-theme='dark'] .command-hero,
html[data-theme='dark'] .admin-dashboard-hero,
html[data-theme='dark'] .dashboard-hero{
  background:linear-gradient(135deg,#111a2c 0%,#14254a 72%,#2b1423 100%)!important;
}
.command-hero h1,.dashboard-hero h1{color:var(--timah-text)!important}
.command-domain,.command-metric,.command-feed{box-shadow:none!important}
.command-priority,.priority-panel,.admin-priority{
  background:color-mix(in srgb,var(--timah-red) 5%,var(--timah-panel))!important;
  border-color:color-mix(in srgb,var(--timah-red) 28%,var(--timah-line))!important;
  color:var(--timah-text)!important;
}

/* Formulaires */
input:not([type='checkbox']):not([type='radio']),textarea,select{
  background:var(--timah-panel)!important;
  color:var(--timah-text)!important;
  border:1px solid var(--timah-line-strong)!important;
  border-radius:12px!important;
  box-shadow:none!important;
}
input:not([type='checkbox']):not([type='radio']){min-height:44px}
textarea{min-height:110px}
input:focus,textarea:focus,select:focus{outline:none!important;border-color:var(--timah-blue)!important;box-shadow:0 0 0 4px color-mix(in srgb,var(--timah-blue) 14%,transparent)!important}
input::placeholder,textarea::placeholder{color:color-mix(in srgb,var(--timah-muted) 72%,transparent)!important}
label,.form-label{color:var(--timah-text)!important;font-weight:750!important}
fieldset{border-color:var(--timah-line)!important}

/* Boutons */
.btn,.button,.topbar-btn,.teacher-back-link,.admin-btn,.resp-action,.theme-toggle,.theme-btn,button[type='submit']{
  border-radius:12px!important;
  font-weight:800!important;
  transition:.18s ease!important;
  box-shadow:none!important;
}
.btn--primary,.btn.primary,.btn-primary,.topbar-btn--primary,.teacher-btn--primary,.admin-btn--primary,.resp-action--primary,button[type='submit']:not(.btn--danger):not(.btn-danger):not(.admin-logout):not(.student-logout){
  background:linear-gradient(135deg,var(--timah-blue),var(--timah-blue-strong))!important;
  border-color:transparent!important;
  color:#fff!important;
  box-shadow:0 14px 28px -18px rgba(18,63,212,.82)!important;
}
.btn--danger,.btn.danger,.btn-danger,.danger,.delete,.student-logout,.admin-logout{
  background:linear-gradient(135deg,var(--timah-red),var(--timah-red-strong))!important;
  border-color:transparent!important;
  color:#fff!important;
}
.btn--ghost,.btn.ghost,.btn-secondary,.topbar-btn,.teacher-back-link,.theme-toggle,.theme-btn{
  background:var(--timah-panel)!important;
  border:1px solid var(--timah-line-strong)!important;
  color:var(--timah-blue)!important;
}
a[href*='create'].btn--primary,a[href*='register'].btn--primary,.cta-primary,.command-actions a:first-child{
  background:linear-gradient(135deg,var(--timah-red),var(--timah-red-strong))!important;
  border-color:transparent!important;
  color:#fff!important;
}
.btn:hover,.button:hover,.topbar-btn:hover,.teacher-back-link:hover,.theme-toggle:hover,.theme-btn:hover,button[type='submit']:hover{transform:translateY(-1px)!important;filter:saturate(1.05)}

/* Tableaux */
.table-responsive,.table-wrap,.admin-table-wrap{max-width:100%;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
table,.table{width:100%;border-collapse:separate!important;border-spacing:0!important;background:var(--timah-panel)!important;color:var(--timah-text)!important;border:1px solid var(--timah-line)!important;border-radius:16px!important;overflow:hidden!important}
thead,thead tr,thead th{background:var(--timah-soft)!important;color:var(--timah-blue)!important;font-weight:900!important}
th,td{border-color:var(--timah-line)!important}
tbody tr{background:var(--timah-panel)!important}
tbody tr:hover{background:color-mix(in srgb,var(--timah-soft) 58%,transparent)!important}

/* Alertes et badges */
.admin-alert,.teacher-alert,.alert{border-radius:14px!important;border:1px solid var(--timah-line)!important}
.admin-alert--success,.teacher-alert--success,.alert--success{background:rgba(22,163,74,.10)!important;border-color:rgba(22,163,74,.24)!important;color:var(--timah-success)!important}
.admin-alert--warning,.teacher-alert--warning,.alert--warning{background:rgba(245,158,11,.10)!important;border-color:rgba(245,158,11,.26)!important;color:var(--timah-warning)!important}
.admin-alert--error,.teacher-alert--error,.alert--error{background:rgba(239,15,53,.10)!important;border-color:rgba(239,15,53,.24)!important;color:var(--timah-red)!important}
.badge,.chip,.pill{border-radius:999px!important}

/* Logos et profils */
.brand__mark,.admin-brand-mark,.resp-brand__logo,.teacher-brand__logo{
  background:linear-gradient(145deg,var(--timah-blue),var(--timah-blue-strong))!important;
  color:#fff!important;
  box-shadow:0 12px 28px -18px rgba(18,63,212,.82)!important;
}
.resp-user__avatar{background:var(--timah-blue)!important;color:#fff!important;border-color:transparent!important}
.admin-userbox,.student-userbox,.teacher-userbox,.resp-user{color:var(--timah-text)!important}

/* Recherche et accordéons */
.admin-nav-search{background:var(--timah-panel-2)!important;border:1px solid var(--timah-line)!important;border-radius:14px!important}
.admin-nav-search input{background:transparent!important;border:0!important;box-shadow:none!important;min-height:40px!important}
details,details summary{color:var(--timah-text)!important}

/* Un seul bouton de thème visible */
.student-sidebar [data-theme-toggle]{display:none!important}
.student-topbar [data-theme-toggle]{display:inline-flex!important}
.timah-global-theme-toggle{display:none!important}

/* Mobile */
@media(max-width:1180px){
  .admin-content,.student-content,.resp-page,.teacher-subpage-main{padding:18px!important}
  .admin-topbar,.student-topbar,.resp-navbar,.teacher-topbar{gap:10px!important}
  .admin-topbar__actions,.topbar-right,.resp-user{flex-wrap:wrap!important}
}
@media(max-width:900px){
  body{overflow-x:hidden!important}
  .admin-sidebar,.student-sidebar,.teacher-sidebar{box-shadow:18px 0 40px rgba(0,0,0,.16)!important}
  .admin-content,.student-content,.resp-page,.teacher-subpage-main{max-width:100%!important}
  table,.table{display:block!important;max-width:100%!important;overflow-x:auto!important;white-space:nowrap!important}
}
@media(max-width:760px){
  .card,.panel,.admin-panel,.teacher-card,.student-card,.resp-card{border-radius:14px!important}
  .btn,.button,.topbar-btn,.teacher-back-link,button[type='submit']{min-height:44px!important;max-width:100%!important}
  .admin-content,.student-content,.resp-page,.teacher-subpage-main{padding:12px!important}
  .resp-navbar{align-items:flex-start!important}
  .resp-user{width:100%!important}
  .admin-topbar__actions{width:100%!important}
  .admin-topbar__actions .btn{flex:1 1 auto!important}
}

/* Impression et éditeurs */
@media print{html,body{background:#fff!important;color:#000!important}.theme-toggle,.theme-btn,[data-theme-toggle]{display:none!important}}
.tox,.ck-editor,.ql-container,.onlyoffice-container,.document-viewer,.pdf-viewer{color:initial}
