:root {
    --ink:#1b201a; --stone:#f4f3ee; --panel:#ffffff; --line:#e7e4da;
    --forest:#1e3a2c; --forest-2:#2c5140; --moss:#5f8c5a; --sage:#9fc194;
    --brand:#5eba47; --amber:#d99a3e; --clay:#c0503f; --muted:#767a6c;
    --shadow:0 1px 2px rgba(20,25,15,0.04),0 4px 14px rgba(20,25,15,0.05);
}
* { box-sizing:border-box; margin:0; padding:0; }
body { font-family:'Inter',sans-serif; background:var(--stone); color:var(--ink); -webkit-font-smoothing:antialiased; }

.layout { display:flex; min-height:100vh; }

/* SIDEBAR */
.sidebar { width:246px; background:linear-gradient(180deg,#1e3a2c,#152a1f); color:#dfe4d8; flex-shrink:0; padding:1.7rem 1.1rem; display:flex; flex-direction:column; }
.sidebar img.logo { width:150px; margin-bottom:1.6rem; }
.nav-group-label { font-size:0.62rem; text-transform:uppercase; letter-spacing:0.08em; color:#7c8471; margin:0.2rem 0.5rem 0.5rem; font-weight:700; }
.nav-item { display:flex; align-items:center; gap:0.65rem; padding:0.58rem 0.65rem; border-radius:8px; font-size:0.84rem; color:#c3cabb; margin-bottom:2px; font-weight:500; text-decoration:none; }
.nav-item.active { background:rgba(94,186,71,0.18); color:#fff; font-weight:600; border-left:3px solid var(--brand); padding-left:calc(0.65rem - 3px); }
.help-box { margin-top:auto; background:rgba(255,255,255,0.055); border-radius:10px; padding:1rem; font-size:0.76rem; }
.help-box .t { font-weight:700; color:#fff; margin-bottom:0.15rem; }
.help-box .d { color:#a9af9c; margin-bottom:0.6rem; }
.help-box .row { color:#c3cabb; margin-top:0.4rem; }
.sidebar-foot { font-size:0.66rem; color:#697061; margin-top:1rem; text-align:center; }

/* MAIN */
.main { flex:1; padding:1.8rem 2.3rem 3rem; max-width:1600px; }
.topbar { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:1.8rem; }
.topbar .greet { font-size:0.83rem; color:var(--muted); }
.topbar h1 { font-size:1.5rem; font-weight:700; margin:0.15rem 0 0.2rem; letter-spacing:-0.01em; }
.topbar .sub { font-size:0.86rem; color:var(--muted); }
.user-chip { display:flex; align-items:center; gap:0.55rem; }
.user-chip .av { width:34px; height:34px; border-radius:50%; background:var(--forest); color:#fff; display:flex; align-items:center; justify-content:center; font-size:0.78rem; font-weight:700; flex-shrink:0; }
.user-chip .name { font-size:0.82rem; font-weight:700; }
.user-chip .role { font-size:0.7rem; color:var(--muted); }
.btn-ghost-link { font-size:0.78rem; color:var(--muted); text-decoration:none; margin-top:0.3rem; display:inline-block; }

.card { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:1.3rem 1.4rem; box-shadow:var(--shadow); }
.panel-title { font-size:0.72rem; text-transform:uppercase; letter-spacing:0.05em; font-weight:700; color:#3c4536; margin-bottom:1rem; }

/* Auth */
.auth-wrap { display:flex; min-height:100vh; align-items:stretch; }
.auth-left { flex:1; background:linear-gradient(135deg,#234a35,#16311f); display:flex; flex-direction:column; justify-content:space-between; padding:3rem; }
.auth-left img { width:180px; }
.auth-tagline { color:#eef1e9; font-size:1.6rem; font-weight:600; max-width:360px; line-height:1.3; }
.auth-foot { color:#8b9280; font-size:0.72rem; }
.auth-right { flex:1; display:flex; align-items:center; justify-content:center; background:var(--panel); }
.auth-card { width:100%; max-width:360px; }
.auth-card h1 { font-size:1.5rem; margin-bottom:0.3rem; }
.auth-card .sub { color:var(--muted); font-size:0.9rem; margin-bottom:1.6rem; }
form { display:flex; flex-direction:column; }
label { font-size:0.72rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--muted); margin:0.85rem 0 0.32rem; font-weight:600; }
input, select { padding:0.6rem 0.75rem; border:1px solid var(--line); border-radius:7px; background:#fbfaf6; font-size:0.94rem; font-family:'Inter',sans-serif; color:var(--ink); }
input:focus, select:focus { outline:2px solid var(--brand); outline-offset:1px; }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:0.4rem; border:none; border-radius:7px; padding:0.65rem 1.1rem; font-size:0.87rem; font-weight:700; cursor:pointer; font-family:'Inter',sans-serif; }
.btn-primary { background:var(--forest); color:#fff; margin-top:1.4rem; }
.btn-primary:hover { background:var(--forest-2); }
.fine-print { font-size:0.8rem; color:var(--muted); margin-top:1.3rem; text-align:center; }
.fine-print a { color:var(--brand); text-decoration:none; font-weight:600; }

/* Documents */
.doc-list { display:flex; flex-direction:column; }
.doc-row { display:flex; align-items:center; gap:0.7rem; padding:0.75rem 0; border-bottom:1px solid var(--line); }
.doc-row:last-child { border-bottom:none; }
.doc-ic { width:30px; height:30px; border-radius:7px; background:var(--stone); display:flex; align-items:center; justify-content:center; flex-shrink:0; color:var(--forest); }
.doc-name { font-weight:600; font-size:0.92rem; }
.doc-meta { font-size:0.75rem; color:var(--muted); margin-top:0.1rem; }
.tag { display:inline-block; font-size:0.66rem; font-weight:700; padding:0.15rem 0.5rem; border-radius:20px; background:#eaf0e6; color:var(--forest-2); margin-right:0.4rem; }
.tag.certificat { background:#f3e8d9; color:var(--amber); }
.dl-btn { margin-left:auto; background:transparent; border:1px solid var(--forest); color:var(--forest); border-radius:6px; padding:0.4rem 0.85rem; font-size:0.8rem; font-weight:700; cursor:pointer; text-decoration:none; flex-shrink:0; }
.dl-btn:hover { background:var(--forest); color:#fff; }
.empty-state { text-align:center; padding:3rem 1rem; color:var(--muted); border:1px dashed var(--line); border-radius:10px; font-size:0.9rem; }

/* Admin */
.admin-grid { display:grid; grid-template-columns:1fr 1fr; gap:1.2rem; margin-bottom:1.2rem; }
@media (max-width:800px){ .admin-grid{grid-template-columns:1fr;} }
.admin-table { width:100%; border-collapse:collapse; font-size:0.85rem; }
.admin-table th { text-align:left; text-transform:uppercase; font-size:0.66rem; letter-spacing:0.05em; color:var(--muted); padding:0.5rem 0.4rem; border-bottom:1px solid var(--line); font-weight:700; }
.admin-table td { padding:0.6rem 0.4rem; border-bottom:1px solid var(--line); }
.btn-danger-small { background:transparent; color:var(--clay); border:1px solid var(--clay); border-radius:6px; padding:0.28rem 0.6rem; font-size:0.74rem; font-weight:700; cursor:pointer; }

/* Flash messages */
.flash-container { margin-bottom:1.2rem; }
.flash { font-size:0.86rem; padding:0.65rem 0.95rem; border-radius:8px; margin-bottom:0.5rem; font-weight:500; }
.flash-success { background:#e5f3de; color:#2f6b3f; border:1px solid var(--brand); }
.flash-error { background:#f5e6e4; color:var(--clay); border:1px solid var(--clay); }

/* KPIs & graphiques (données réelles) */
.kpi-grid { display:grid; grid-template-columns:1.3fr 1fr 1fr 1fr; gap:1rem; margin-bottom:1rem; }
@media (max-width:900px){ .kpi-grid{grid-template-columns:1fr 1fr;} }
.kpi-label { font-size:0.66rem; text-transform:uppercase; letter-spacing:0.05em; color:var(--muted); font-weight:700; margin-bottom:0.55rem; }
.kpi-value { font-size:1.5rem; font-weight:800; }
.kpi-unit { font-size:0.74rem; font-weight:500; color:var(--muted); }
.kpi-meta { font-size:0.74rem; color:var(--muted); margin-top:0.5rem; }
.card.kpi-dark { background:linear-gradient(135deg,#234a35,#16311f); color:#fff; border:none; }
.card.kpi-dark .kpi-label, .card.kpi-dark .kpi-unit, .card.kpi-dark .kpi-meta { color:#c3cabb; }

.row2col { display:grid; grid-template-columns:1fr 1fr 1fr 1fr; gap:1rem; margin-bottom:1rem; align-items:start; }
@media (max-width:1000px){ .row2col{grid-template-columns:1fr 1fr;} }

.donut-wrap { display:flex; align-items:center; gap:0.9rem; }
.donut { width:96px; height:96px; border-radius:50%; flex-shrink:0; display:flex; align-items:center; justify-content:center; }
.donut-hole { width:56px; height:56px; background:var(--panel); border-radius:50%; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.donut-hole .n { font-size:0.8rem; font-weight:800; }
.donut-hole .u { font-size:0.56rem; color:var(--muted); }
.legend { font-size:0.74rem; display:flex; flex-direction:column; gap:0.4rem; width:100%; }
.legend .lr { display:flex; align-items:center; justify-content:space-between; gap:0.5rem; }
.legend .left { display:flex; align-items:center; gap:0.4rem; }
.legend .sw { width:7px; height:7px; border-radius:2px; flex-shrink:0; }
.legend .pct { font-weight:800; }

.poste-list { display:flex; flex-direction:column; gap:0.5rem; }
.poste-row { display:flex; align-items:center; gap:0.6rem; font-size:0.78rem; }
.poste-label { width:130px; flex-shrink:0; }
.poste-track { flex:1; height:6px; background:var(--stone); border-radius:3px; overflow:hidden; }
.poste-fill { height:100%; background:var(--forest-2); border-radius:3px; }
.poste-pct { width:32px; text-align:right; font-weight:700; color:var(--muted); flex-shrink:0; }

.site-list { display:flex; flex-direction:column; gap:0.55rem; font-size:0.82rem; }
.site-row { display:flex; align-items:center; gap:0.6rem; }
.site-rank { width:18px; height:18px; border-radius:5px; background:var(--stone); font-size:0.66rem; font-weight:800; display:flex; align-items:center; justify-content:center; color:var(--forest); flex-shrink:0; }
.site-name { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.site-val { font-weight:800; flex-shrink:0; }

.cat-list { display:flex; flex-direction:column; gap:0.5rem; font-size:0.82rem; }
.cat-row { display:flex; justify-content:space-between; }
.cat-row .val { color:var(--muted); font-weight:700; }

.link-more { font-size:0.77rem; color:var(--brand); font-weight:700; margin-top:0.85rem; display:inline-block; text-decoration:none; }
.poste-abs { width:64px; text-align:right; font-size:0.72rem; color:var(--muted); flex-shrink:0; }

/* Objectifs */
.goal-item { display:flex; gap:0.8rem; padding:0.7rem 0; border-bottom:1px solid var(--line); }
.goal-item:last-child { border-bottom:none; padding-bottom:0; }
.goal-year-badge { width:38px; height:38px; border-radius:9px; background:var(--stone); display:flex; align-items:center; justify-content:center; font-size:0.66rem; font-weight:800; color:var(--forest); flex-shrink:0; }
.goal-body { flex:1; }
.goal-top { display:flex; justify-content:space-between; font-size:0.84rem; }
.goal-top .name { font-weight:600; }
.goal-top .target { color:var(--clay); font-weight:800; }
.goal-sub { font-size:0.71rem; color:var(--muted); margin:0.15rem 0 0.45rem; }
.progress-track { height:5px; background:var(--stone); border-radius:3px; overflow:hidden; }
.progress-fill { height:100%; background:var(--brand); border-radius:3px; }

/* Plan d'action */
.action-item { padding:0.62rem 0; border-bottom:1px solid var(--line); }
.action-item:last-child { border-bottom:none; padding-bottom:0; }
.action-top { display:flex; justify-content:space-between; align-items:center; font-size:0.83rem; margin-bottom:0.32rem; gap:0.5rem; }
.action-top .name { font-weight:600; }
.tag-status { font-size:0.63rem; font-weight:800; padding:0.18rem 0.55rem; border-radius:20px; flex-shrink:0; }
.tag-status.cours { background:#faf0dd; color:#a5731f; }
.tag-status.termine { background:#e2ede0; color:#2f6b3f; }
.tag-status.venir { background:#eeede8; color:#767a6c; }
.action-sub { font-size:0.71rem; color:var(--muted); margin-bottom:0.4rem; }
.action-progress { display:flex; align-items:center; gap:0.5rem; }
.action-progress .progress-track { flex:1; }
.action-progress .pct { font-size:0.71rem; font-weight:800; width:32px; text-align:right; }
