:root {
  --vert: #4f7f33;
  --vert-clair: #eaf2e3;
  --jaune: #f7ea4a;
  --texte: #1f2a1a;
  --gris: #6b7566;
  --bord: #d9dfd3;
  --fond: #f6f8f3;
  --rouge: #b3261e;
  --orange: #b45309;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--vert); }
header.top {
  background: #fff; border-bottom: 3px solid var(--jaune);
  display: flex; align-items: center; gap: 16px; padding: 10px 20px; flex-wrap: wrap;
}
header.top img { height: 44px; display: block; }
header.top nav { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
header.top nav a { text-decoration: none; font-weight: 600; padding: 4px 0; }
header.top .qui { color: var(--gris); font-size: 14px; }
header.top form { margin: 0; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 28px 0 10px; }
.sous { color: var(--gris); margin: 0 0 16px; }
.carte {
  background: #fff; border: 1px solid var(--bord); border-radius: 10px;
  padding: 16px; margin-bottom: 16px;
}
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; font-size: 15px; }
.flash.ok { background: #e3f3dc; border: 1px solid #b9dcab; }
.flash.error { background: #fbe5e3; border: 1px solid #efb7b2; color: #7a1a14; }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 9px 16px;
  border: 1px solid var(--vert); background: var(--vert); color: #fff; text-decoration: none;
  display: inline-block;
}
button.sec, .btn.sec { background: #fff; color: var(--vert); }
button.lien { background: none; border: none; color: var(--vert); padding: 4px 6px; text-decoration: underline; font-weight: 500; }
button.danger { background: #fff; color: var(--rouge); border-color: var(--rouge); }
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; }
input[type=text], input[type=password], input[type=time], input[type=number] {
  font: inherit; padding: 9px 10px; border: 1px solid var(--bord); border-radius: 8px;
  background: #fff; width: 100%;
}
input:focus { outline: 2px solid var(--jaune); border-color: var(--vert); }
input:disabled { background: #f0f1ee; color: #999; }
.login { max-width: 380px; margin: 40px auto; }
.login img { width: 220px; display: block; margin: 0 auto 16px; }

.navsemaine { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.navsemaine .titre { font-weight: 700; text-align: center; flex: 1; min-width: 200px; }
.navsemaine .btn { padding: 7px 12px; }
.navsemaine .vide { width: 90px; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--bord); }
th { font-size: 13px; color: var(--gris); font-weight: 600; background: #fafbf8; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; background: var(--vert-clair); border-top: 2px solid var(--vert); }
td.maj { background: #fff9d6; font-weight: 700; }
th.maj { background: #fff3a8; color: var(--texte); }
.scroll { overflow-x: auto; }

table.saisie td { vertical-align: middle; }
table.saisie input { min-width: 90px; }
table.saisie input.f-pause { min-width: 70px; max-width: 90px; }
table.saisie tr.futur td { opacity: .5; }
.day-total { font-weight: 700; text-align: right; white-space: nowrap; }
.day-total.warn { color: var(--orange); }

.resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.resume > div { background: var(--fond); border: 1px solid var(--bord); border-radius: 8px; padding: 10px 12px; }
.resume > div.maj { background: #fff9d6; border-color: #e6d86a; }
.resume .v { font-size: 22px; font-weight: 700; }
.resume .l { font-size: 13px; color: var(--gris); }
.regle { font-size: 13px; color: var(--gris); margin: 10px 0 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--vert-clair); color: var(--vert); font-weight: 600; }
.badge.off { background: #eee; color: #777; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline input { width: 150px; padding: 6px 8px; }

@media (max-width: 640px) {
  main { padding: 14px 10px 50px; }
  header.top { padding: 8px 12px; gap: 10px; }
  .navsemaine .titre { order: -1; flex-basis: 100%; }
  table.saisie, table.saisie tbody { display: block; }
  table.saisie thead { display: none; }
  table.saisie tr {
    display: grid; gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--bord);
    grid-template-columns: 1fr 1fr 78px;
    grid-template-areas: "jour jour total" "debut fin pause";
  }
  table.saisie td { display: block; padding: 0; border: none; min-width: 0; }
  table.saisie td.c-jour { grid-area: jour; font-weight: 700; align-self: center; }
  table.saisie td.c-total { grid-area: total; align-self: center; }
  table.saisie td.c-debut { grid-area: debut; }
  table.saisie td.c-fin { grid-area: fin; }
  table.saisie td.c-pause { grid-area: pause; }
  table.saisie td[data-l]::before { content: attr(data-l); display: block; font-size: 12px; color: var(--gris); }
  table.saisie input, table.saisie input.f-pause { min-width: 0; max-width: none; width: 100%; padding: 8px 6px; }
  .resume { grid-template-columns: 1fr 1fr; }
}
@media print {
  header.top, .actions, .navsemaine .btn, .noprint { display: none !important; }
  body { background: #fff; }
  .carte { border: none; padding: 0; }
}

.centre { text-align: center; }
.etroit { max-width: 420px; }
h2.sans-marge { margin-top: 0; }

input.invalide { border-color: var(--rouge); background: #fdeceb; }

/* --- journées automatiques, absences, sélecteurs --- */
select, input[type=date] {
  font: inherit; padding: 9px 10px; border: 1px solid var(--bord); border-radius: 8px;
  background: #fff; width: 100%; color: var(--texte);
}
select:focus, input[type=date]:focus { outline: 2px solid var(--jaune); border-color: var(--vert); }
select:disabled, input[type=date]:disabled { background: #f0f1ee; color: #999; }
form.inline input[type=date] { width: 150px; padding: 6px 8px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label.case { display: flex; gap: 8px; align-items: center; font-weight: 500; margin-top: 14px; }
label.case input { width: auto; }
.badge.auto-badge { background: #fff3a8; color: #6b5d00; }
.badge.abs-badge { background: #e7eefb; color: #254a8f; }
.badge.ferie-badge { background: #efe7fb; color: #5a2a91; }
table.saisie tr.auto td { background: #fffbe0; }
table.saisie tr.auto .day-total { color: #7a6a00; }
table.saisie tr.absence td { background: #eef3fc; }
table.saisie tr.ferie td { background: #f6f0fc; }
table.saisie tr.ferie.auto td { background: #fffbe0; }
table.saisie td.c-statut select { min-width: 150px; padding: 8px; }
.day-total { font-size: 14px; }

@media (max-width: 640px) {
  table.saisie tr.admin-row {
    grid-template-areas: "jour jour total" "statut statut statut" "debut fin pause";
  }
  table.saisie td.c-statut { grid-area: statut; }
  table.saisie td.c-statut select { min-width: 0; width: 100%; }
  .deux { grid-template-columns: 1fr; }
}

table.recap { font-size: 14px; }
table.recap th, table.recap td { padding: 8px 7px; }
table.recap td:first-child, table.recap td:nth-child(9) { white-space: nowrap; }

@media (max-width: 640px) {
  table.saisie tr.auto { background: #fffbe0; }
  table.saisie tr.absence { background: #eef3fc; }
  table.saisie tr.ferie { background: #f6f0fc; }
  table.saisie tr.auto td, table.saisie tr.absence td, table.saisie tr.ferie td { background: transparent; }
  table.saisie tr { padding-left: 4px; padding-right: 4px; }
}

.badge.lock-badge { background: #eceeea; color: #5b6657; }
table.saisie tr.futur .c-jour { opacity: 1; }
table.saisie tr.verrouille td { opacity: .85; }
