/* Styles generaux, themes et structure STID Neo */
:root{color-scheme:light;--bg:#f5f7fb;--surface:#fff;--text:#142133;--muted:#64748b;--line:#dae3ee;--accent:#2364db;--accent-soft:#eaf1ff;--shadow:0 12px 38px rgba(18,32,53,.06)}html[data-theme="dark"]{color-scheme:dark;--bg:#111824;--surface:#1c2635;--text:#e9eef8;--muted:#9baec5;--line:#344255;--accent:#8ab4ff;--accent-soft:#243756;--shadow:0 12px 40px rgba(0,0,0,.18)}*{box-sizing:border-box}html{min-height:100%;background:var(--bg)}body{min-height:100vh;margin:0;background:var(--bg);color:var(--text);font:16px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif}a{color:var(--accent)}.site-header{border-bottom:1px solid var(--line);background:var(--surface)}.wrap{width:min(1120px,calc(100% - 40px));margin:auto}.header-inner{min-height:76px;display:flex;align-items:center;gap:24px;flex-wrap:wrap}.brand{text-decoration:none;color:var(--text);font-weight:800;font-size:1.15rem;letter-spacing:-.03em}.brand span{color:var(--accent)}.nav{display:flex;gap:6px;align-items:center;flex:1;flex-wrap:wrap}.nav a{padding:8px 13px;text-decoration:none;border-radius:10px;color:var(--muted);font-weight:600;font-size:.9rem}.nav a:hover,.nav a[aria-current="page"]{background:var(--accent-soft);color:var(--accent)}.theme-button{border:1px solid var(--line);background:var(--surface);border-radius:10px;padding:9px 13px;color:var(--text);cursor:pointer;font:inherit}.theme-button:hover{background:var(--accent-soft)}main{padding:62px 0 92px}.eyebrow{font-size:.78rem;font-weight:800;letter-spacing:.14em;text-transform:uppercase;color:var(--accent)}h1{font-size:clamp(2.15rem,5vw,4rem);line-height:1.12;letter-spacing:-.055em;margin:12px 0 20px;color:var(--text)}h2{font-size:1.45rem;letter-spacing:-.035em;margin:0 0 10px;color:var(--text)}p{color:var(--muted);margin:0 0 18px}.lead{font-size:1.13rem;max-width:700px}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(255px,1fr));gap:18px;margin-top:38px}.action{display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:10px;padding:10px 16px;background:var(--accent);color:var(--bg);text-decoration:none;font-weight:700}.action:hover{opacity:.9}.footer{border-top:1px solid var(--line);padding:22px 0;color:var(--muted);font-size:.85rem}.footer .wrap{display:flex;justify-content:space-between;flex-wrap:wrap;gap:12px}@media(max-width:650px){.header-inner{gap:10px;padding:14px 0}.brand{width:100%}.nav{order:3;width:100%}main{padding-top:38px}}

/* Specificites de l'application Neo */
.neo-year{color:var(--accent)}
body:has(.neo-year) .site-header{border-bottom:2px solid var(--accent)}
.neo-header{position:sticky;top:0;z-index:1000}
.neo-header-inner{display:flex;align-items:center;gap:16px}
.neo-actions{display:flex;align-items:center;gap:8px;margin-left:auto}
.neo-burger{display:none;width:42px;height:42px;padding:10px;border:1px solid var(--border, #8885);border-radius:8px;background:transparent;color:inherit;cursor:pointer;flex-direction:column;justify-content:center;gap:5px}
.neo-burger span{display:block;height:2px;width:100%;background:currentColor;border-radius:2px}
@media(max-width:700px){
  .neo-header-inner{position:relative;flex-wrap:nowrap;gap:8px}
  .neo-header-inner .brand{min-width:0;white-space:nowrap;font-size:clamp(14px,4vw,20px)}
  .neo-actions{flex-shrink:0}
  .neo-burger{display:flex}
  .neo-nav{display:none;position:absolute;top:100%;left:0;right:0;width:100%;padding:8px 12px 14px;flex-direction:column;align-items:stretch;gap:4px;background:var(--bg, var(--background, #fff));border:1px solid var(--border, #8885);border-radius:0 0 10px 10px;box-shadow:0 8px 20px #0002;z-index:1001}
  .neo-nav.is-open{display:flex}
  .neo-nav a{display:block;padding:12px;border-radius:8px}
}

/* Icones vectorielles du theme, sans emoji */
.theme-button{display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;padding:9px}
.neo-theme-icon{display:block;width:21px;height:21px}
html[data-theme="dark"] .neo-theme-sun,html[data-theme="light"] .neo-theme-moon{display:none}

/* Masquer la navigation sur la page de connexion */
.neo-nav[hidden],.neo-burger[hidden]{display:none!important}

/* Action de deconnexion dans la navigation */
.neo-nav-auth{display:flex;align-items:center;margin:0}
.neo-nav .neo-nav-link{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;font:inherit;font-weight:inherit;line-height:inherit;color:var(--text);background:transparent;border:0;border-radius:8px;padding:10px 12px;text-decoration:none;cursor:pointer}
.neo-nav .neo-nav-link:hover{background:var(--accent-soft);color:var(--accent)}
@media(max-width:700px){.neo-nav-auth,.neo-nav .neo-nav-link{width:100%}.neo-nav .neo-nav-link{justify-content:flex-start;text-align:left}}

/* Mise en page specifique de la connexion */
.neo-login{max-width:520px;margin:30px auto 55px}
.neo-login .neo-page-heading{text-align:center}
.neo-login .neo-box h2{margin:0 0 18px}
.neo-login .neo-fieldset{display:grid;gap:18px}
.neo-login .neo-form>.neo-btn{justify-self:stretch}
.neo-login-error{color:#b42330;border:1px solid #c53d48;border-radius:8px;padding:12px;background:rgba(197,61,72,.09)}
@media(max-width:650px){.neo-login{margin:12px auto 32px}.neo-login .neo-box{padding:18px}}

.neo-login-options{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px}
.neo-login-options a{font-size:.9rem}

/* Ecran de diagnostic */
.neo-error-wrap{max-width:900px;margin:7vh auto;padding:20px}
.neo-error-card{display:grid;gap:18px}
.neo-error-card .neo-page-title{margin:0}
.neo-error-card>.neo-btn{justify-self:start}
.neo-error-details{border:1px solid var(--line);border-radius:12px;padding:16px;background:var(--neo-fieldset-bg)}
.neo-error-details summary{cursor:pointer;font-weight:700}
.neo-error-details pre{overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;padding:14px;border-radius:8px;background:var(--surface);font-size:.85rem}

/* Erreur integree a la page, theme clair/sombre */
.neo-error-card{margin:22px 0 32px}
.neo-error-details{color:var(--text)}
.neo-error-details pre{color:var(--text);border:1px solid var(--line)}

/* Identite de l'utilisateur a droite du menu */
.neo-user-info{display:flex;flex-direction:column;align-items:flex-end;min-width:0;margin-left:auto;line-height:1.25}
.neo-user-name{font-size:.88rem;font-weight:650;color:var(--text);max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.neo-user-role{font-size:.72rem;color:var(--muted)}
@media(max-width:700px){.neo-user-info{margin-left:auto}.neo-user-name{max-width:120px;font-size:.78rem}.neo-user-role{font-size:.68rem}}

/* Selection du site autorise */
.neo-site-form{display:flex;align-items:center;gap:7px;margin:0;min-width:0}
.neo-site-label{font-size:.75rem;color:var(--muted)}
.neo-site-form select,.neo-site-static{max-width:175px;min-width:90px;padding:7px 9px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);font:inherit;font-size:.82rem}
@media(max-width:700px){.neo-site-label{display:none}.neo-site-form select{max-width:110px;min-width:70px}.neo-user-info{display:none}}

/* Choix de site : grille flex inspiree du STID historique */
.neo-site-link,.neo-site-static{display:inline-flex;align-items:center;gap:7px;max-width:180px;padding:7px 11px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);font-size:.84rem;text-decoration:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.neo-site-link:hover{border-color:var(--accent);background:var(--accent-soft);color:var(--accent)}
.neo-site-grid{gap:20px;margin:20px 0 30px}
.neo-site-tile-form{flex:1 1 calc(25% - 20px);min-width:190px;margin:0}
.neo-site-tile{position:relative;display:flex;align-items:center;justify-content:center;gap:9px;width:100%;min-height:118px;padding:20px 24px;border:2px solid var(--line);border-radius:12px;background:var(--neo-fieldset-bg);color:var(--text);font:inherit;font-size:1.12rem;cursor:pointer;box-shadow:var(--shadow);transition:transform .12s,border-color .12s,background .12s}
.neo-site-tile::before{content:"";position:absolute;top:0;left:0;right:0;height:6px;border-radius:10px 10px 0 0;background:var(--neo-site-accent,var(--accent))}
.neo-site-tile:hover{transform:translateY(-2px);border-color:var(--accent);background:var(--accent-soft)}
.neo-site-tile.is-active{border-color:#2463c9;box-shadow:0 0 0 2px #2463c933}
.neo-site-tile-name{font-weight:650;text-align:center}
.neo-site-flag{font-size:1rem}
.neo-site-active-mark{position:absolute;right:11px;top:12px;color:#2463c9;font-weight:800}
@media(max-width:850px){.neo-site-tile-form{flex-basis:calc(50% - 20px)}}
@media(max-width:500px){.neo-site-tile-form{flex-basis:100%}.neo-site-tile{min-height:86px}.neo-site-link{max-width:100px}}

/* Choix de langue */
.neo-language-link{display:inline-flex;align-items:center;gap:5px;padding:7px 9px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);text-decoration:none;font-size:.83rem}
.neo-language-link:hover{border-color:var(--accent);background:var(--accent-soft)}
.neo-language-grid{justify-content:center;gap:22px;margin:32px auto}
.neo-language-form{flex:0 1 170px;margin:0}
.neo-language-tile{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;width:100%;min-height:145px;padding:15px;border:2px solid var(--line);border-radius:12px;background:var(--neo-fieldset-bg);color:var(--text);font:inherit;font-size:1.1rem;cursor:pointer;box-shadow:var(--shadow)}
.neo-language-tile:hover{border-color:var(--accent);background:var(--accent-soft)}
.neo-language-tile.is-active{border-color:#2463c9}
.neo-language-flag{font-size:4.2rem;line-height:1.15}
.neo-language-check{position:absolute;top:9px;right:12px;color:#2463c9;font-weight:800}
.neo-language-time{display:flex;flex-direction:column;align-items:center;gap:4px;max-width:260px;margin:24px auto;text-align:center}
.neo-language-time time{font-size:1.7rem;font-weight:800}
.neo-language-note{text-align:center}
@media(max-width:540px){.neo-language-form{flex:1 1 120px}.neo-language-grid{gap:10px}.neo-language-flag{font-size:3rem}.neo-language-tile{min-height:120px}.neo-language-link span{display:none}}

/* Menu utilisateur et deconnexion */
.neo-user-menu{position:relative;min-width:0;margin-left:auto}
.neo-user-menu>summary{cursor:pointer;list-style:none;padding:5px 20px 5px 8px;position:relative}
.neo-user-menu>summary::-webkit-details-marker{display:none}
.neo-user-menu>summary::after{content:"⌄";position:absolute;right:5px;top:50%;transform:translateY(-50%);color:var(--muted)}
.neo-user-dropdown{position:absolute;right:0;top:calc(100% + 8px);z-index:100;min-width:170px;padding:6px;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow)}
.neo-user-dropdown form{margin:0}
.neo-user-logout{width:100%;text-align:left;padding:10px 12px;border:0;border-radius:7px;background:transparent;color:var(--text);font:inherit;cursor:pointer}
.neo-user-logout:hover{background:var(--accent-soft);color:var(--accent)}
@media(max-width:700px){.neo-user-menu{display:block}.neo-user-menu .neo-user-name{max-width:105px}}

/* Header compact et menu utilisateur visible au-dessus du contenu */
.neo-header-inner{min-height:48px;gap:10px;flex-wrap:nowrap}
.neo-header{overflow:visible}
.neo-user-menu{z-index:1200;flex-shrink:0}
.neo-user-menu>summary.neo-user-info{display:flex;flex-direction:row;align-items:center;gap:7px;min-height:34px;padding:4px 24px 4px 9px;line-height:1.1}
.neo-user-menu .neo-user-name{font-size:.8rem;max-width:190px}
.neo-user-menu .neo-user-role{font-size:.7rem;white-space:nowrap}
.neo-user-menu[open] .neo-user-dropdown{display:block;visibility:visible;z-index:1300}
.neo-user-dropdown{top:100%;box-shadow:0 12px 28px #0004}
.neo-site-link,.neo-site-static,.neo-language-link{padding:5px 8px;min-height:32px}
.neo-header .theme-button{width:34px;height:34px;padding:6px}
@media(max-width:700px){.neo-header-inner{min-height:48px;padding:5px 0}.neo-user-menu>summary.neo-user-info{display:flex;padding:4px 17px 4px 5px}.neo-user-menu .neo-user-role{display:none}.neo-user-menu .neo-user-name{max-width:100px}}

/* Regrouper utilisateur, site, langue et theme a droite */
.neo-header-inner>.neo-user-menu{margin-left:auto}
.neo-header-inner>.neo-actions{margin-left:0}
.neo-header-inner>.neo-site-link,.neo-header-inner>.neo-site-static,.neo-header-inner>.neo-language-link{flex-shrink:0}

/* Actions toujours alignees a droite, meme hors connexion */
.neo-header-inner>.neo-language-link{margin-left:auto}
.neo-header-inner>.neo-user-menu~.neo-language-link{margin-left:0}
.neo-header-inner>.neo-actions{margin-left:0;flex-shrink:0}
