/* ============================================================
   SPITFIRE — feuille de style
   Portage direct de la maquette capacite_projets_wirquin_demo_v2.
   Tokens et composants repris à l'identique ; les écarts sont commentés.
   ============================================================ */

:root{
  --wirquin-red:#d71920;
  --red-dark:#a91016;
  --bg:#f5f7fb;
  --panel:#ffffff;
  --text:#222936;
  --muted:#687386;
  --line:#e5e9f2;
  --green:#25a56a;
  --orange:#f59e0b;
  --blue:#2878ff;
  --purple:#7c3aed;
  --danger:#dc2626;
  --shadow:0 14px 35px rgba(31,41,55,.08);
  --radius:22px;
}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--text)}
.app{display:flex;min-height:100vh}
aside{width:265px;background:#fff;border-right:1px solid var(--line);padding:22px 18px;position:fixed;inset:0 auto 0 0}
.brand{display:flex;align-items:center;gap:12px;margin-bottom:30px}
.brand-logo{width:48px;height:48px;background:var(--wirquin-red);border-radius:16px;display:grid;place-items:center;color:#fff;font-weight:900;letter-spacing:-1px;box-shadow:0 10px 20px rgba(215,25,32,.25);overflow:hidden}
/* Le logo est un carré à fond rouge : il remplit le conteneur, dont le
   border-radius le rogne. Le fond rouge ci-dessus reste visible le temps du
   chargement et sert de repli si l'image manque. */
.brand-logo img{width:100%;height:100%;object-fit:cover;display:block}
.brand-title{font-weight:800;font-size:18px;line-height:1.1}.brand-sub{font-size:12px;color:var(--muted);margin-top:2px}
.nav-title{font-size:11px;text-transform:uppercase;color:#9aa4b5;font-weight:800;letter-spacing:.08em;margin:20px 10px 10px}

/* Écart maquette : .nav button → .nav a. La navigation est serveur (un fichier
   PHP par page), donc de vrais liens : ouverture en nouvel onglet, clic milieu,
   lecteurs d'écran. Le kebab garde ses <button> (ce sont des submit). */
.nav a{width:100%;display:flex;align-items:center;gap:12px;border:0;background:transparent;color:#566174;font-weight:700;padding:13px 14px;border-radius:16px;cursor:pointer;text-align:left;margin:4px 0;font-size:14px;text-decoration:none}
.nav a:hover{background:#f3f5f9}
.nav a.active{background:linear-gradient(135deg,var(--wirquin-red),#ef4444);color:#fff;box-shadow:0 10px 18px rgba(215,25,32,.18)}
.ico{width:32px;height:32px;border-radius:12px;display:grid;place-items:center;background:#eef2ff;color:var(--blue);font-size:17px;flex:0 0 auto}
.active .ico{background:rgba(255,255,255,.22);color:#fff}

main{margin-left:265px;width:calc(100% - 265px);padding:24px 30px 42px}
header{min-height:78px;background:linear-gradient(135deg,var(--wirquin-red),var(--red-dark));border-radius:26px;display:flex;align-items:center;justify-content:space-between;padding:0 28px;color:white;box-shadow:var(--shadow);margin-bottom:26px;gap:16px}
header h1{font-size:24px;margin:0} header p{margin:3px 0 0;color:#ffd8d8;font-size:13px}
.user-pill{display:flex;align-items:center;gap:10px;background:rgba(255,255,255,.15);padding:9px 12px;border-radius:999px;flex:0 0 auto}
.avatar{width:36px;height:36px;border-radius:50%;background:white;color:var(--wirquin-red);display:grid;place-items:center;font-weight:900;flex:0 0 auto}
.user-pill a{color:#ffd8d8;text-decoration:none;font-size:12px}
.user-pill a:hover{color:#fff;text-decoration:underline}

.grid{display:grid;gap:18px}
.cards{grid-template-columns:repeat(4,minmax(160px,1fr));margin-bottom:20px}
/* Variantes de colonnage. En classes et non en style inline : un style inline
   battrait la media query et figerait 3 ou 4 colonnes sur mobile. */
.cards-3{grid-template-columns:repeat(3,minmax(160px,1fr))}
.card{background:var(--panel);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px;border:1px solid rgba(229,233,242,.75)}
.metric{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}
.metric .num{font-size:30px;font-weight:900;margin-top:8px}
.metric .lbl{color:var(--muted);font-weight:700;font-size:13px}
.round-icon{width:48px;height:48px;border-radius:17px;display:grid;place-items:center;color:white;font-size:22px;flex:0 0 auto}
.bg-blue{background:var(--blue)}.bg-green{background:var(--green)}.bg-orange{background:var(--orange)}.bg-purple{background:var(--purple)}.bg-red{background:var(--wirquin-red)}

/* Écart maquette : `.section{display:none}` supprimé. C'était le mécanisme de la
   SPA (une seule section visible à la fois). Ici une page = une section, toujours
   visible. Rétablir cette règle rendrait toutes les pages blanches. */
.section-head{display:flex;justify-content:space-between;align-items:center;margin:5px 0 18px;gap:16px;flex-wrap:wrap}
.section-head h2{margin:0;font-size:23px}
.section-head span{color:var(--muted);font-size:14px}
.btn{border:0;border-radius:14px;padding:11px 15px;font-weight:800;cursor:pointer;background:var(--wirquin-red);color:white;text-decoration:none;display:inline-block;font-size:14px;font-family:inherit}
.btn:hover{filter:brightness(.94)}
.btn.secondary{background:#eef2f7;color:#344054}
.btn.green{background:var(--green)}
.btn:disabled{opacity:.5;cursor:not-allowed;filter:none}

table{width:100%;border-collapse:separate;border-spacing:0 10px}
.table-card{background:#fff;border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;overflow:visible}
th{text-align:left;color:#7b8495;font-size:12px;text-transform:uppercase;letter-spacing:.04em;padding:0 14px 8px}
td{background:#f9fafc;padding:16px 14px;border-top:1px solid #eef1f6;border-bottom:1px solid #eef1f6;font-weight:650}
td:first-child{border-left:1px solid #eef1f6;border-radius:16px 0 0 16px}
td:last-child{border-right:1px solid #eef1f6;border-radius:0 16px 16px 0}
.tag{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:900}
.tag.red{background:#fee2e2;color:#b91c1c}.tag.green{background:#dcfce7;color:#15803d}.tag.orange{background:#ffedd5;color:#c2410c}.tag.blue{background:#dbeafe;color:#1d4ed8}.tag.gray{background:#e5e7eb;color:#374151}.tag.purple{background:#ede9fe;color:#6d28d9}

.progress{height:12px;background:#e8edf5;border-radius:999px;overflow:hidden;width:130px;flex:0 0 auto}
.progress div{height:100%;border-radius:999px}
.p-green{background:var(--green)}.p-orange{background:var(--orange)}.p-red{background:var(--danger)}

.form-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.field label{display:block;color:#687386;font-size:12px;font-weight:800;margin:0 0 7px}
.field input,.field select{width:100%;border:1px solid var(--line);border-radius:14px;padding:12px;background:#fbfcfe;font-weight:700;color:#303846;font-family:inherit;font-size:14px}
.field input:focus,.field select:focus{outline:2px solid var(--blue);outline-offset:1px}
.field input:disabled,.field select:disabled{background:#f1f3f7;color:#9aa4b5;cursor:not-allowed}
.field.full{grid-column:1/-1}
.field .hint{font-size:11px;color:var(--muted);font-weight:600;margin-top:6px}

.split{display:grid;grid-template-columns:1.1fr .9fr;gap:18px}
.mini-list{display:grid;gap:10px}
.mini{display:flex;justify-content:space-between;align-items:center;background:#f9fafc;border:1px solid #eef1f6;border-radius:17px;padding:13px 14px;gap:14px}
.name{font-weight:900}
.sub{font-size:12px;color:var(--muted);margin-top:3px}

.actions{position:relative;text-align:right}
.dots{border:0;background:transparent;font-size:22px;cursor:pointer;border-radius:10px;padding:3px 8px;font-family:inherit;line-height:1}
.menu{display:none;position:absolute;right:0;top:34px;background:#fff;border:1px solid var(--line);box-shadow:var(--shadow);border-radius:14px;min-width:145px;z-index:5;padding:6px}
.menu a,.menu button{display:block;width:100%;border:0;background:#fff;text-align:left;padding:10px;border-radius:10px;font-weight:800;cursor:pointer;text-decoration:none;color:var(--text);font-family:inherit;font-size:14px}
.menu a:hover,.menu button:hover{background:#f3f5f9}
.menu .del{color:var(--danger)}
.actions.open .menu{display:block}
.menu form{margin:0}

.toast{position:fixed;bottom:24px;right:24px;background:#111827;color:white;padding:13px 16px;border-radius:14px;box-shadow:var(--shadow);display:none;font-weight:700;max-width:420px;z-index:50}
.toast.show{display:block}
/* Écart maquette : le toast y est uniformément sombre. Une erreur ne doit pas
   ressembler à un succès. */
.toast.toast-success{background:#065f46}
.toast.toast-danger{background:#991b1b}
.toast.toast-warning{background:#92400e}
.toast.toast-info{background:#1e3a8a}

.muted{color:var(--muted)}
.right{text-align:right}
.nowrap{white-space:nowrap}
.th-sub{font-weight:600;color:var(--muted);font-size:11px}

/* ---------- Ajouts hors maquette ---------- */

/* Écran de login : la maquette n'en a pas (CDC §9 écran 1). */
.login-wrap{min-height:100vh;display:grid;place-items:center;padding:24px;background:var(--bg)}
.login-card{background:var(--panel);border-radius:var(--radius);box-shadow:var(--shadow);padding:34px;width:100%;max-width:410px}
.login-card .brand{justify-content:center;margin-bottom:26px}
.login-card .field{margin-bottom:14px}
.login-card .btn{width:100%;padding:13px}

/* Erreurs de validation : persistent dans la page, contrairement au toast. */
.form-errors{background:#fee2e2;border:1px solid #fecaca;color:#991b1b;border-radius:14px;padding:13px 15px;margin-bottom:16px;font-weight:700;font-size:14px}
.form-errors ul{margin:6px 0 0;padding-left:18px}
.form-errors li{margin:3px 0}

/* Sélecteur de semaine ISO (Charge/Capacité et Saisie temps). */
.week-nav{display:flex;align-items:center;gap:8px}
.week-nav .btn{padding:10px 13px}
.week-nav .week-label{font-weight:900;font-size:15px;min-width:96px;text-align:center}
.week-nav .week-range{color:var(--muted);font-size:12px;font-weight:700}

/* Barres du dashboard : réemploi de .progress, aucune librairie de graphiques.
   Colonne libellé en minmax(0,1fr) et non 1fr : en 1fr, sa largeur minimale est
   celle du texte, et un nom de projet long poussait la barre et la valeur hors
   de la carte (retour utilisateur « mise en page à revoir »). */
.bar-row{display:grid;grid-template-columns:minmax(0,1fr) 130px 62px;align-items:center;gap:12px;padding:9px 0}
.bar-row + .bar-row{border-top:1px solid #eef1f6}
.bar-row .bar-text{min-width:0}
.bar-row .bar-label{font-weight:800;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bar-row .bar-label a{color:var(--blue);text-decoration:none}
.bar-row .bar-label a:hover{text-decoration:underline}
.bar-row .bar-sub{font-size:11px;color:var(--muted);font-weight:600;margin-top:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bar-row .bar-value{font-weight:900;text-align:right;font-size:14px}
/* Variante empilée (cartes étroites, libellés longs) : le libellé occupe toute
   la largeur et peut passer à la ligne ; barre et valeur dessous, alignées
   d'une ligne à l'autre. */
.bar-row.stacked{grid-template-columns:minmax(0,1fr) auto;row-gap:8px}
.bar-row.stacked .bar-text{grid-column:1 / -1}
.bar-row.stacked .bar-label{white-space:normal;overflow-wrap:anywhere}
.bar-row.stacked .progress{width:100%}
.bar-row.stacked .bar-value{min-width:54px}
.chart-empty{color:var(--muted);font-size:13px;padding:14px 0;font-weight:600}

/* Ligne CRA verrouillée (CDC §6 : au-delà de 5 semaines). */
tr.locked td{background:#f1f3f7;color:#8a93a3}
.lock-note{color:var(--muted);font-size:13px;font-weight:700}

.negative{color:var(--danger);font-weight:900}

/* Zone de danger (Réinitialisation) : hors maquette. Le liseré rouge signale
   une action destructive avant même de lire le texte. */
.danger-zone{border:1px solid #fecaca}
.danger-zone .form-errors{margin-bottom:18px}
.danger-lead{margin:0 0 10px}
.reset-stats{list-style:none;padding:0;margin:0 0 20px;display:flex;flex-wrap:wrap;gap:10px 26px}
.reset-stats li{font-weight:700;color:var(--text)}
.reset-stats-n{font-weight:900;font-size:18px;margin-right:5px}
.danger-actions{display:flex;gap:10px;margin-top:16px}

/* Écran Membres : bloc « Créer un compte » (saisie membre + compte en une fois). */
.account-block{margin-top:20px;border-top:1px solid var(--line);padding-top:18px}
.account-toggle{display:flex;align-items:center;gap:9px;font-weight:800;cursor:pointer}
.account-toggle input{width:16px;height:16px}
.account-fields{margin-top:14px}
.account-existing a{font-weight:800}

/* Libellé d'un statut RD affiché à côté de son tag (retour utilisateur : les
   codes RD2/RD3… seuls ne disent rien à qui ne connaît pas les étapes). */
.status-label{font-size:12px;color:var(--muted);font-weight:700;margin-left:6px;white-space:nowrap}

/* Mes heures (membre projet) : pied de formulaire avec le total de la semaine. */
.my-hours-foot{display:flex;align-items:center;gap:14px;margin-top:14px;flex-wrap:wrap}
.my-hours-total{margin-left:auto;color:var(--muted);font-weight:700;font-size:14px}
.my-hours-total b{color:var(--text)}

/* Équipes projet : bloc « Nouvel intervenant » sous le formulaire d'affectation. */
.new-collab{margin-top:18px;border-top:1px solid var(--line);padding-top:16px}
.new-collab[hidden]{display:none}
.new-collab-title{font-weight:900;font-size:15px}
.new-collab > .hint{font-size:12px;color:var(--muted);font-weight:600;margin-top:4px}

footer.app-footer{margin-top:32px;color:var(--muted);font-size:12px;text-align:center;font-weight:600}

@media(max-width:1000px){
  aside{position:static;width:100%}
  .app{display:block}
  main{margin:0;width:100%;padding:16px}
  .cards,.cards-3{grid-template-columns:repeat(2,1fr)}
  .split{grid-template-columns:1fr}
  .form-grid{grid-template-columns:1fr 1fr}
  header{padding:20px;gap:14px;align-items:flex-start;flex-direction:column}
  .table-card{overflow-x:auto}
  .bar-row{grid-template-columns:minmax(0,1fr) 80px 54px}
}
