/* Group MiCh — feuille de style de l'application de gestion */
:root {
  --green-900: #0a3220;
  --green-800: #0c3b26;
  --green-700: #0f5132;
  --green-600: #166b43;
  --green-100: #e6f0ea;
  --green-50: #f1f7f3;
  --gold: #c8a24a;
  --gold-soft: #f3e9d0;
  --bg: #f4f6f4;
  --card: #ffffff;
  --line: #e2e7e2;
  --line-strong: #cfd7cf;
  --text: #1e2a24;
  --muted: #6b7a70;
  --danger: #b3352c;
  --danger-bg: #fbeceb;
  --warn: #9a6b12;
  --warn-bg: #fdf4e0;
  --info: #1f5f8b;
  --info-bg: #e9f2f8;
  --ok: #17694a;
  --ok-bg: #e6f3ec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 40, 28, .05), 0 8px 24px rgba(18, 40, 28, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--green-700); text-decoration: none; }
button { font-family: inherit; }
::selection { background: var(--gold-soft); }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ */
/* Connexion                                                          */
/* ------------------------------------------------------------------ */
.login-body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 10% 10%, #145c3b 0%, #0a3220 55%, #071f14 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px;
}
.login-wrap {
  display: grid; grid-template-columns: 1.05fr .95fr;
  width: min(1040px, 100%); min-height: 600px;
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.login-brand {
  background: linear-gradient(160deg, var(--green-700) 0%, var(--green-900) 100%);
  color: #fff; padding: 46px 44px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.login-brand::after {
  content: ""; position: absolute; right: -120px; bottom: -140px;
  width: 320px; height: 320px; border: 1px solid rgba(200, 162, 74, .35);
  border-radius: 50%;
}
.login-brand::before {
  content: ""; position: absolute; right: -40px; top: -90px;
  width: 220px; height: 220px; border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
}
.brand-mark {
  width: 54px; height: 54px; border: 1.5px solid var(--gold); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, "Times New Roman", serif; font-size: 20px; letter-spacing: .5px;
  border-radius: 4px; margin-bottom: 22px;
}
.brand-mark.small { width: 40px; height: 40px; font-size: 15px; margin: 0; }
.login-brand h1 { font-size: 30px; font-weight: 600; letter-spacing: .4px; }
.brand-sub { color: #c9d9cf; font-size: 14px; margin-top: 4px; }
.brand-lines { margin-top: 44px; display: flex; flex-direction: column; gap: 16px; }
.brand-lines div { border-left: 1px solid rgba(200, 162, 74, .55); padding-left: 14px; }
.brand-lines span { display: block; font-size: 14.5px; font-weight: 600; }
.brand-lines small { display: block; color: #b9cdc2; font-size: 12px; margin-top: 2px; }
.brand-foot { margin-top: auto; padding-top: 32px; color: #a9c1b4; font-size: 11.5px; line-height: 1.6; max-width: 360px; }
.login-panel { padding: 56px 52px; display: flex; flex-direction: column; }
.login-panel h2 { font-size: 24px; color: var(--green-800); }
.login-hint { color: var(--muted); margin: 6px 0 22px; font-size: 13px; }
.login-panel label { display: block; font-size: 12px; font-weight: 600; color: #42504a; margin: 14px 0 6px; }
.login-panel input {
  width: 100%; height: 42px; padding: 0 12px; font-size: 14px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fbfcfb; color: var(--text);
}
.login-panel input:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(22, 107, 67, .12); background: #fff; }
.btn-block { width: 100%; margin-top: 24px; height: 44px; justify-content: center; }
.login-help { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-help p + p { margin-top: 10px; }
.login-copy { margin-top: auto; padding-top: 24px; color: #98a49c; font-size: 11px; }
.alert { padding: 11px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 6px; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #f2cfcb; }

/* ------------------------------------------------------------------ */
/* Structure générale                                                 */
/* ------------------------------------------------------------------ */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; flex: 0 0 252px; background: linear-gradient(180deg, var(--green-800) 0%, var(--green-900) 100%);
  color: #d8e5dd; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 16px 18px 14px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand strong { display: block; font-size: 13px; letter-spacing: .12em; color: #fff; }
.sidebar-brand span { display: block; font-size: 11px; color: #9fb8a8; margin-top: 2px; }
.nav { padding: 8px 9px 12px; flex: 1; overflow-y: auto; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 4px; }
.nav-group { margin-top: 9px; }
.nav-group:first-child { margin-top: 4px; }
.nav-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: .13em;
  color: #8fac9b; padding: 0 12px 4px; font-weight: 600;
}
.nav-link {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: transparent; border: 0; color: #d3e2d9; font-size: 13px;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; line-height: 1.25; font-size: 12.5px;
  border-left: 2px solid transparent;
}
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .12); color: #fff; border-left-color: var(--gold); font-weight: 600; }
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(200, 162, 74, .8); flex: 0 0 5px; }
.nav-link.active .nav-dot { background: var(--gold); }
.sidebar-foot { padding: 11px 16px 13px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sb-user { display: flex; align-items: center; gap: 10px; }
.sb-user strong { display: block; font-size: 12.5px; color: #fff; font-weight: 600; }
.sb-user small { display: block; font-size: 10.5px; color: #9fb8a8; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--gold-soft); color: var(--green-800);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex: 0 0 32px;
}
.sb-logout { display: block; margin-top: 8px; font-size: 11.5px; color: #a9c1b4; }
.sb-logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.crumb { display: flex; flex-direction: column; line-height: 1.15; }
.crumb span { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.crumb strong { font-size: 15px; color: var(--green-800); font-weight: 600; }
.spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: #5a675f; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; flex: 0 0 36px;
}
.icon-btn:hover { background: var(--green-50); color: var(--green-700); border-color: var(--line); }
.icon-btn svg, .btn svg, .nav-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.user-chip {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--line);
  background: #fff; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer;
}
.user-chip:hover { border-color: var(--line-strong); }
.user-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-meta strong { font-size: 12px; color: var(--text); }
.user-meta small { font-size: 10px; color: var(--muted); }
#menuBtn { display: none; }

.content { padding: 26px 28px 48px; width: 100%; max-width: 1480px; margin: 0 auto; }
.loading { padding: 80px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------------ */
/* Pages, cartes, boutons                                             */
/* ------------------------------------------------------------------ */
.page-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 600; color: var(--green-900); letter-spacing: -.01em; }
.page-head .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; max-width: 780px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.banner {
  flex-wrap: wrap;
  background: linear-gradient(90deg, var(--green-700), var(--green-600)); color: #fff;
  border-radius: var(--radius); padding: 14px 18px; display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px; box-shadow: var(--shadow); font-size: 13px;
}
.banner strong { color: var(--gold-soft); }
.banner .btn { margin-left: auto; flex: 0 0 auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 14px; font-weight: 600; color: var(--green-900); }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; color: #33403a;
  font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #b9c4bb; background: #fbfcfb; }
.btn-primary { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-600); border-color: var(--green-600); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #231a05; }
.btn-gold:hover { filter: brightness(.96); background: var(--gold); }
.btn-danger { color: var(--danger); border-color: #eccfcb; background: #fff; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 11.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------------ */
/* Indicateurs                                                        */
/* ------------------------------------------------------------------ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--green-600); opacity: .8; }
.kpi.gold::before { background: var(--gold); }
.kpi.danger::before { background: var(--danger); }
.kpi.warn::before { background: var(--warn); }
.kpi .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 27px; font-weight: 650; color: var(--green-900); margin-top: 6px; letter-spacing: -.02em; }
.kpi .value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 5px; }
.kpi .foot { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.kpi .foot .up { color: var(--ok); font-weight: 600; }
.kpi .foot .down { color: var(--danger); font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-top: 16px; }
.dash-grid.equal { grid-template-columns: 1fr 1fr; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-col .bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, #2f8a5d, var(--green-700)); border-radius: 5px 5px 0 0; min-height: 3px; position: relative; }
.bar-col .bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; }
.bar-col small { font-size: 10.5px; color: var(--muted); }
.bar-col .bar.gold { background: linear-gradient(180deg, #d9bb78, var(--gold)); }

.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank { display: grid; grid-template-columns: 1fr 46px; gap: 6px 10px; align-items: center; font-size: 12px; }
.rank .name { color: #3b4842; }
.rank .val { text-align: right; color: var(--muted); font-size: 11.5px; }
.rank .track { grid-column: 1 / -1; height: 6px; background: var(--green-50); border-radius: 4px; overflow: hidden; }
.rank .fill { height: 100%; background: var(--green-600); border-radius: 4px; }
.rank .fill.gold { background: var(--gold); }

.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px;
  font-size: 12.5px; line-height: 1.45; border: 1px solid transparent; cursor: pointer; text-align: left; background: none;
}
.alert-item:hover { filter: brightness(.98); }
.alert-item.danger { background: var(--danger-bg); border-color: #f2d5d2; color: #7e2620; }
.alert-item.warn { background: var(--warn-bg); border-color: #f0e0bb; color: #6d4d0d; }
.alert-item.info { background: var(--info-bg); border-color: #d5e6f2; color: #1c4f72; }
.alert-item svg { flex: 0 0 16px; margin-top: 1px; }
.alert-item strong { font-weight: 600; }

.activity { display: flex; flex-direction: column; }
.activity-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 8px; padding: 9px 2px; border-bottom: 1px dashed var(--line); font-size: 12px; }
.activity-row:last-child { border-bottom: 0; }
.activity-row .who { color: var(--green-700); font-weight: 600; }
.activity-row .what { color: #46534b; }
.activity-row time { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.empty { color: var(--muted); font-size: 12.5px; padding: 18px 4px; text-align: center; }

/* ------------------------------------------------------------------ */
/* Tableaux                                                           */
/* ------------------------------------------------------------------ */
.table-tools { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: #8a978f; fill: none; stroke-width: 1.8; }
.search input { width: 100%; height: 34px; padding: 0 10px 0 32px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 12.5px; background: #fbfcfb; }
.search input:focus { outline: none; border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(22, 107, 67, .1); }
.tool-count { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--green-50);
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.filters select, .filters input { height: 32px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 8px; font-size: 12px; background: #fff; color: var(--text); }
.filters .filter-actions { display: flex; align-items: flex-end; }

.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid th {
  text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: #6d7c72; background: #f8faf8; font-weight: 650; padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
table.grid td { padding: 9px 11px; border-bottom: 1px solid #eef1ee; vertical-align: top; color: #2c3833; }
table.grid th.col-actions { position: sticky; right: 0; background: #f8faf8; z-index: 3; }
table.grid td.col-actions { position: sticky; right: 0; background: #fff; z-index: 2; box-shadow: -7px 0 9px -7px rgba(10, 40, 24, .18); }
table.grid tbody tr:hover { background: #fafcfa; }
table.grid tbody tr:hover td.col-actions { background: #fafcfa; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid td.nowrap { white-space: nowrap; }
table.grid .muted { color: var(--muted); }
table.grid .strong { font-weight: 600; color: var(--green-900); }
table.grid .clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-actions { width: 92px; min-width: 92px; text-align: right; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 1px; opacity: .55; justify-content: flex-end; width: 100%; }
tr:hover .row-actions { opacity: 1; }
.row-actions button { width: 26px; height: 26px; padding: 0; border: 1px solid transparent; background: transparent; border-radius: 6px; color: #5d6b62; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.row-actions button:hover { background: var(--green-50); border-color: var(--line); color: var(--green-700); }
.row-actions button.danger:hover { background: var(--danger-bg); border-color: #f0d4d1; color: var(--danger); }
.row-actions svg { width: 14px; height: 14px; }

.pager { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.pager .pages { margin-left: auto; display: flex; gap: 5px; align-items: center; }
.pager button { min-width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: #fff; font-size: 11.5px; cursor: pointer; color: #3c4a42; }
.pager button.active { background: var(--green-700); border-color: var(--green-700); color: #fff; font-weight: 600; }
.pager button:disabled { opacity: .45; cursor: default; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  background: #eef2ef; color: #47564d; border: 1px solid #e2e8e3;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: #cfe7da; }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: #f1d3d0; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0e2c0; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: #d6e7f3; }
.badge.gold { background: var(--gold-soft); color: #7a5c11; border-color: #ead9ad; }

/* ------------------------------------------------------------------ */
/* Onglets                                                            */
/* ------------------------------------------------------------------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 16px; flex-wrap: wrap; }
.tab {
  padding: 11px 14px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--green-700); }
.tab.active { color: var(--green-700); border-bottom-color: var(--green-600); }
.tabbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tabbar .tab-pill {
  border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; height: 32px;
  padding: 0 14px; font-size: 12px; font-weight: 600; color: #49574e; cursor: pointer;
}
.tabbar .tab-pill.active { background: var(--green-700); border-color: var(--green-700); color: #fff; }

/* ------------------------------------------------------------------ */
/* Présences                                                          */
/* ------------------------------------------------------------------ */
.presence-summary { display: flex; gap: 22px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ps-item { display: flex; flex-direction: column; }
.ps-item .v { font-size: 20px; font-weight: 650; color: var(--green-900); }
.ps-item .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ps-item.ok .v { color: var(--ok); }
.ps-item.danger .v { color: var(--danger); }
.ps-item.warn .v { color: var(--warn); }
.presence-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.presence-controls input[type=date], .presence-controls select {
  height: 34px; border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 9px; font-size: 12.5px; background: #fff;
}
.presence-controls .spacer { flex: 1; }
.status-select { height: 28px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 11.5px; padding: 0 4px; background: #fff; }
.status-select.p-P { border-color: #b9dfca; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.status-select.p-A { border-color: #efcfcc; background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.status-select.p-C { border-color: #e9dcb8; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.status-select.p-M { border-color: #d4e5f1; background: var(--info-bg); color: var(--info); font-weight: 600; }
.time-input { width: 74px; height: 28px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 11.5px; padding: 0 5px; }
.obs-input { width: 100%; min-width: 140px; height: 28px; border: 1px solid var(--line-strong); border-radius: 6px; font-size: 11.5px; padding: 0 7px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); padding: 10px 18px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* ------------------------------------------------------------------ */
/* Formulaires et fenêtres                                            */
/* ------------------------------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(12, 30, 20, .55); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 40px 20px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 14px; width: min(720px, 100%); box-shadow: 0 30px 70px rgba(0, 0, 0, .3);
  animation: pop .16s ease-out;
}
.modal.narrow { width: min(520px, 100%); }
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; color: var(--green-900); font-weight: 600; }
.modal-head p { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 18px 22px 8px; max-height: calc(100vh - 240px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11px; font-weight: 600; color: #48564d; text-transform: uppercase; letter-spacing: .05em; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 38px; border: 1px solid var(--line-strong); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit; background: #fbfcfb; color: var(--text);
}
.field textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--green-600); background: #fff; box-shadow: 0 0 0 3px rgba(22, 107, 67, .1);
}
.field .help { font-size: 10.5px; color: var(--muted); }
.field input[readonly] { background: #f1f4f1; color: var(--muted); }
.field input[type=file] { padding: 8px 10px; border-style: dashed; background: #fff; font-size: 12px; cursor: pointer; }
.form-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f2d2cf; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; margin-bottom: 14px; display: none; }
.form-section { grid-column: 1 / -1; border-top: 1px solid var(--line); margin: 4px 0 -2px; padding-top: 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--green-700); }
.upload-zone { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 18px; text-align: center; background: var(--green-50); font-size: 12px; color: var(--muted); }
.upload-zone input { margin-top: 8px; font-size: 12px; }

/* ------------------------------------------------------------------ */
/* Rapports, sauvegardes                                              */
/* ------------------------------------------------------------------ */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.report-card { display: flex; flex-direction: column; }
.report-card .card-body { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.report-card p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; max-height: 230px; overflow-y: auto; padding: 4px 2px; }
.check-list label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #3c4a42; }
.check-list input { accent-color: var(--green-700); }
.report-card .btn { align-self: flex-start; }
.report-card .mt-auto { margin-top: auto; }
.file-name { font-size: 11.5px; color: var(--muted); }
.import-report { margin-top: 14px; font-size: 12px; }
.import-report table { width: 100%; border-collapse: collapse; }
.import-report th, .import-report td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.import-report .errors { color: var(--danger); font-size: 11px; max-width: 380px; }
.backup-list { display: flex; flex-direction: column; }
.backup-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid #eef1ee; font-size: 12.5px; }
.backup-row:last-child { border-bottom: 0; }
.backup-row .name { font-family: Consolas, monospace; font-size: 12px; }
.backup-row .meta { color: var(--muted); font-size: 11.5px; margin-left: auto; }
.backup-row a { font-size: 11.5px; font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Toasts                                                             */
/* ------------------------------------------------------------------ */
.toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: #163024; color: #fff; padding: 11px 15px; border-radius: 9px; font-size: 12.5px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25); border-left: 3px solid var(--gold);
  max-width: 380px; animation: pop .18s ease-out;
}
.toast.error { border-left-color: #e06a5f; background: #40201d; }
.toast.ok { border-left-color: #57b98a; }

/* Fils de discussion Auditorat */
.thread { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; }
.thread-msg { padding: 10px 12px; border-radius: 9px; background: var(--green-50); border: 1px solid var(--line); }
.thread-msg.dir { background: var(--info-bg); border-color: #d6e7f3; }
.thread-msg.aud { background: var(--warn-bg); border-color: #f0e2c0; }
.thread-msg .th-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; margin-bottom: 5px; }
.thread-msg .th-head time { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.thread-msg .th-body { font-size: 13px; line-height: 1.55; color: #2f3c35; }
.thread-instruction { background: var(--green-50); border: 1px solid var(--line); border-radius: 9px; padding: 12px 14px; font-size: 13px; line-height: 1.6; }

/* ------------------------------------------------------------------ */
/* Impression                                                         */
/* ------------------------------------------------------------------ */
@media print {
  .sidebar, .topbar, .page-actions, .table-tools, .pager, .filters, .no-print, .toasts, .modal-overlay { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .content { padding: 0; max-width: none; }
  table.grid th.col-actions, table.grid td.col-actions { position: static; box-shadow: none; }
  .card { border: 1px solid #999; box-shadow: none; }
  table.grid th { background: #eee !important; color: #000; }
  table.grid th, table.grid td { border-color: #bbb; padding: 5px 6px; }
  .badge { border: 1px solid #999; }
  a { color: #000; }
  .print-title { display: block !important; margin-bottom: 10px; }
  .print-title h1 { font-size: 16px; }
  .print-title p { font-size: 10px; color: #444; }
}
.print-title { display: none; }

/* ------------------------------------------------------------------ */
/* Adaptation                                                         */
/* ------------------------------------------------------------------ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid, .dash-grid.equal { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .login-wrap { grid-template-columns: 1fr; min-height: 0; }
  .login-brand { padding: 32px 30px; }
  .brand-lines { margin-top: 22px; flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .brand-foot { display: none; }
  .login-panel { padding: 34px 30px; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 50px rgba(0, 0, 0, .4); }
  .sidebar.open { transform: none; }
  #menuBtn { display: inline-flex; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 0 14px; }
  .user-meta { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .check-list { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 19px; }
  .page-actions { margin-left: 0; width: 100%; }
}
@media (max-width: 620px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .login-panel { padding: 26px 20px; }
  .login-brand { padding: 24px 20px; }
  .login-brand h1 { font-size: 24px; }
  .modal-overlay { padding: 12px; }
  .modal-body { max-height: calc(100vh - 190px); }
  .report-grid { grid-template-columns: 1fr; }
}
