@font-face { font-family: 'Source Sans Pro'; src: url('fonts/SourceSansPro-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Source Sans Pro'; src: url('fonts/SourceSansPro-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Source Sans Pro'; src: url('fonts/SourceSansPro-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

/* Charte hatec.fr */
:root {
  --marine: #080e3e;
  --rose: #be2d7a;
  --rose-degrade: linear-gradient(135deg, #cd2a7c 0%, #953574 100%);
  --rose-fonce: #953574;
  --rose-clair: #fbe9f2;
  --bleu: var(--marine);          /* liens, accents */
  --bleu-fonce: #000527;
  --bleu-clair: #e9eaf3;
  --fond: #f6f6f6;
  --carte: #ffffff;
  --texte: #080e3e;
  --gris: #5f6275;
  --bord: #e3e3e3;
  --vert: #1f9e6e;                /* vert hatec #3ec893 foncé pour rester lisible */
  --vert-accent: #3ec893;
  --vert-clair: #e2f7ee;
  --orange: #d9602f;
  --orange-clair: #fff0e9;
  --rouge: #d42a2a;
  --rouge-clair: #fdeaea;
  --rayon: 6px;
  --ombre: 0 1px 3px rgba(8, 14, 62, .07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.45 'Source Sans Pro', "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
a { color: var(--rose); }
a:hover { color: var(--rose-fonce); }
h1 { font-size: 1.75rem; margin: .2em 0 .8em; font-weight: 700; }
h1::after { content: ""; display: block; width: 48px; height: 4px; background: var(--rose-degrade); border-radius: 2px; margin-top: 6px; }
h2 { font-size: 1.2rem; margin: 1.4em 0 .6em; font-weight: 700; }
.muted { color: var(--gris); }
.petit { font-size: .88em; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

/* En-tête : blanc avec logo, bandeau dégradé rose comme hatec.fr */
.entete {
  background: #fff; color: var(--marine); display: flex; align-items: center; gap: 16px;
  padding: 0 16px; min-height: 64px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
  border-bottom: 4px solid transparent; border-image: var(--rose-degrade) 1; box-shadow: 0 2px 8px rgba(8, 14, 62, .08);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--marine); font-weight: 700; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; }
.logo img { height: 34px; width: auto; display: block; }
.logo span { border-left: 2px solid var(--bord); padding-left: 8px; }
.menu { display: flex; gap: 2px; align-items: center; flex: 1; }
.menu a { color: var(--marine); text-decoration: none; padding: 8px 12px; border-radius: var(--rayon); white-space: nowrap; font-weight: 600; }
.menu a:hover { background: var(--rose-clair); color: var(--rose); }
.menu a.actif { background: var(--rose-degrade); color: #fff; }
.menu .sep { flex: 1; }
.burger { display: none; margin-left: auto; background: none; border: 0; color: var(--marine); font-size: 1.6rem; cursor: pointer; }
@media (max-width: 860px) {
  .burger { display: block; }
  .menu { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  .menu-ouvert .menu { display: flex; }
  .menu .sep { display: none; }
}

.contenu { max-width: 1200px; margin: 0 auto; padding: 18px 16px 60px; }

/* Cartes & grilles */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); margin-bottom: 16px; }
.grille { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.kpi { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 16px; text-decoration: none; color: inherit; box-shadow: var(--ombre); display: block; }
.kpi b { display: block; font-size: 1.9rem; line-height: 1.2; color: var(--marine); }
.kpi { border-top: 4px solid var(--marine); }
.kpi span { color: var(--gris); font-size: .9em; }
.kpi.alerte-kpi { border-top-color: var(--rose); }
.kpi.alerte-kpi b { color: var(--rose); }
.kpi.ok-kpi { border-top-color: var(--vert-accent); }
a.kpi:hover { box-shadow: 0 4px 14px rgba(8, 14, 62, .12); }

/* Formulaires */
label { display: block; font-weight: 600; font-size: .9em; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 8px; font: inherit; background: #fff; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rose-clair); border-color: var(--rose); }
.champs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ligne-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.ligne-form > * { flex: 1 1 160px; }
.ligne-form > .fixe { flex: 0 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--rayon); border: 0; background: var(--rose-degrade); color: #fff;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); color: #fff; }
.btn.sec { background: #fff; color: var(--marine); box-shadow: inset 0 0 0 1px var(--marine); }
.btn.sec:hover { background: var(--marine); color: #fff; filter: none; }
.btn.vert { background: var(--vert); }
.btn.orange { background: var(--orange); }
.btn.rouge { background: var(--rouge); }
.btn.petit { padding: 5px 11px; font-size: .88em; }
.btn:disabled { opacity: .5; cursor: default; }

/* Tableaux */
.tableau-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--carte); }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: top; }
th { font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: #fff; background: var(--marine); white-space: nowrap; font-weight: 600; }
tr:hover td { background: #fcf5f9; }
td.num, th.num { text-align: right; }

/* Résultats de recherche en cartes sur mobile */
@media (max-width: 720px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border: 1px solid var(--bord); border-radius: var(--rayon); margin-bottom: 10px; padding: 8px 10px; background: var(--carte); }
  table.responsive td { border: 0; padding: 3px 0; }
  table.responsive td[data-l]::before { content: attr(data-l) " : "; color: var(--gris); font-size: .85em; }
  table.responsive td.num { text-align: left; }
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .78em; font-weight: 700; background: var(--rose-clair); color: var(--rose); white-space: nowrap; }
.badge.orange { background: var(--orange-clair); color: var(--orange); }
.badge.vert { background: var(--vert-clair); color: var(--vert); }
.badge.rouge { background: var(--rouge-clair); color: var(--rouge); }
.badge.gris { background: #edf0f4; color: var(--gris); }
.emp { font-weight: 700; font-family: ui-monospace, Menlo, Consolas, monospace; background: #edf0f4; padding: 2px 7px; border-radius: 5px; }
.qte { font-weight: 700; font-size: 1.05em; }
.qte.zero { color: var(--rouge); }

.alerte { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alerte.succes { background: var(--vert-clair); border-color: #b7e2c6; color: #145c33; }
.alerte.erreur { background: var(--rouge-clair); border-color: #f3c0ba; color: #8a2419; }
.alerte.info { background: var(--bleu-clair); border-color: #cfd1e3; color: var(--marine); }
.alerte.attention { background: var(--orange-clair); border-color: #f4d3a3; color: #7a4300; }

.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.onglets a { padding: 8px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--bord); text-decoration: none; color: var(--texte); font-weight: 600; font-size: .92em; }
.onglets a.actif { background: var(--marine); border-color: var(--marine); color: #fff; }
.onglets a .badge { margin-left: 4px; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pagination a, .pagination span { padding: 6px 11px; border-radius: 6px; border: 1px solid var(--bord); background: #fff; text-decoration: none; }
.pagination span { background: var(--rose-degrade); color: #fff; border-color: transparent; }

/* Connexion */
.login { max-width: 360px; margin: 10vh auto; }
.login h1 { text-align: center; }

/* Doublons */
.groupe { border: 1px solid var(--bord); border-radius: var(--rayon); background: #fff; margin-bottom: 14px; overflow: hidden; }
.groupe-tete { padding: 10px 14px; background: var(--fond); border-left: 5px solid var(--rose); border-bottom: 1px solid var(--bord); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.groupe table { border: 0; }
.groupe-pied { padding: 10px 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--bord); }

/* Barre de progression */
.progression { height: 8px; background: #e6eaf0; border-radius: 10px; overflow: hidden; }
.progression > div { height: 100%; background: var(--vert-accent); }

/* ----- Inventaire mobile ----- */
.inv-emps { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.inv-emp { background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px; text-decoration: none; color: inherit; display: block; box-shadow: var(--ombre); }
.inv-emp .code { font-size: 1.3rem; font-weight: 800; font-family: ui-monospace, Menlo, Consolas, monospace; }
.inv-emp.termine { background: var(--vert-clair); border-color: #b7e2c6; }
.inv-emp.en_cours { background: var(--orange-clair); border-color: #f4d3a3; }
.inv-emp .qui { font-size: .8em; color: var(--gris); margin: 4px 0 6px; min-height: 1.2em; }

.inv-barre { position: sticky; top: 68px; z-index: 10; background: var(--fond); padding: 8px 0 10px; }
.inv-piece { background: #fff; border: 1px solid var(--bord); border-left: 5px solid var(--bord); border-radius: var(--rayon); padding: 12px; margin-bottom: 10px; box-shadow: var(--ombre); }
.inv-piece.ok { border-left-color: var(--vert); background: #f6fcf8; }
.inv-piece.ecart { border-left-color: var(--orange); background: #fffaf2; }
.inv-piece.absente { border-left-color: var(--rouge); background: #fff7f6; }
.inv-piece.nouvelle { border-left-color: var(--rose); }
.inv-piece .des { font-weight: 700; }
.inv-piece .refs { font-size: .85em; color: var(--gris); margin: 3px 0 8px; word-break: break-word; }
.inv-piece .refs b { color: var(--texte); font-weight: 600; }
.inv-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.inv-actions .btn { padding: 12px 6px; font-size: .95em; }
.inv-qte { display: none; margin-top: 10px; gap: 8px; align-items: center; }
.inv-qte.visible { display: flex; }
.inv-qte button.pm { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 8px; border: 1px solid var(--bord); background: #fff; cursor: pointer; }
.inv-qte input { width: 80px; text-align: center; font-size: 1.2rem; font-weight: 700; padding: 10px; }
.inv-etat { font-size: .85em; margin-top: 8px; }
.theo { float: right; text-align: center; background: #edf0f4; border-radius: 8px; padding: 4px 10px; margin-left: 8px; }
.theo b { display: block; font-size: 1.4rem; line-height: 1.1; }
.theo span { font-size: .7em; color: var(--gris); text-transform: uppercase; }
.bas-fixe { position: sticky; bottom: 0; background: var(--fond); padding: 10px 0; display: flex; gap: 8px; }
.bas-fixe .btn { flex: 1; padding: 14px; }
.login h1::after { margin: 6px auto 0; }
