[hidden] { display: none !important; }
:root {
  --bg: #f4f6fb; --card: #fff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --primary: #14532d; --primary-2: #15803d; --danger: #dc2626; --ok: #16a34a; --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.inline { display: inline; }

/* Barre du haut */
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px; background: #166534; color: #fff; position: sticky; top: 0; z-index: 10; }
.brand { color: #fff; font-weight: 800; font-size: 18px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.logo { background: #fff; color: var(--primary); font-weight: 800; padding: 1px 8px; border-radius: 5px; font-size: 13px; letter-spacing: .03em; }
.login-card .logo { background: var(--primary); color: #fff; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { color: #dcfce7; padding: 8px 12px; border-radius: 8px; }
.topbar nav a:hover, .topbar nav a.active { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .right a, .topbar .btn-link { color: #dcfce7; }
.who small { background: rgba(255,255,255,.15); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.bell { position: relative; display: flex; color: #fff !important; }
.badge-count { position: absolute; top: -6px; right: -9px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 5px; min-width: 18px; text-align: center; }
.btn-link { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }

.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card.narrow { max-width: 640px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.layout-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.span2 { grid-column: span 2; }

/* Formulaires */
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #334155; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; margin: 12px 0; }
.inline-label { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; color: var(--text); width: 100%; }
input[type=checkbox] { width: auto; }
.row input, .row select { width: auto; }
.filters .row input[type=search] { flex: 1; min-width: 220px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #86efac; border-color: var(--primary-2); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; color: var(--text); cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; }
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn.primary { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn.primary:hover { background: var(--primary); }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.full { width: 100%; justify-content: center; margin-top: 8px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: #eff6ff; border: 1px solid #bfdbfe; }
.flash.success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* Statuts */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); border: 1px solid color-mix(in srgb, var(--c) 30%, white); }
.statut-select { width: auto; padding: 4px 8px; font-size: 12px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 10%, white); border-color: color-mix(in srgb, var(--c) 35%, white); border-radius: 999px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { flex-direction: row; align-items: center; gap: 6px; cursor: pointer; padding: 4px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 35%, white); color: var(--c); font-weight: 600; background: #fff; }
.chip input { display: none; }
.chip b { background: color-mix(in srgb, var(--c) 14%, white); padding: 0 6px; border-radius: 8px; font-size: 11px; }
.chip.on { background: var(--c); color: #fff; }
.chip.on b { background: rgba(255,255,255,.25); }

/* Tableaux */
.table-wrap { overflow-x: auto; padding: 0; }
.table-wrap h2 { padding: 18px 18px 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
.table tbody tr:hover { background: #f8fafc; }
.table td input { min-width: 120px; padding: 6px 8px; }
.table td input[type=checkbox] { min-width: 0; }
.sort { color: inherit; }
.sort.on { color: var(--primary-2); }
.w1 { width: 1px; }
.late { color: var(--danger); font-weight: 600; }
tr.muted td { opacity: .6; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #f0fdf4; border-color: #bbf7d0; }
.bulk select { width: auto; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; }

/* Fiche */
.fiche { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0 0 18px; }
.fiche dt { color: var(--muted); }
.fiche dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 14px 0 0; }
.timeline li { padding: 10px 0; border-top: 1px solid var(--line); }
.timeline .meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.timeline .txt { white-space: pre-wrap; }
.timeline.compact li { padding: 6px 0; }
.note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

/* Tableau de bord */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.kpi span { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi b { font-size: 30px; line-height: 1.2; margin-top: 4px; }
.kpi small { color: var(--muted); }
.kpi.accent b { color: var(--ok); }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 50px; gap: 10px; align-items: center; color: var(--text); }
.bar-row:hover { text-decoration: none; background: #f8fafc; }
.bar { height: 14px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.bar-row .val { text-align: right; font-weight: 600; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pill { background: #dcfce7; color: #166534; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.notifs li { justify-content: space-between; }
.notifs li.unread { background: #eff6ff; margin: 0 -18px; padding: 10px 18px; font-weight: 500; }

/* Connexion */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #14532d, #16a34a); }
.login-card { width: 360px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { color: var(--primary); }

/* Toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: #0f172a; color: #fff !important; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 380px; text-decoration: none !important; }

@media (max-width: 1000px) {
  .layout-2, .grid4 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; }
  .container { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
}

/* --- v2 : rôles, documents, tâches --- */
.nav-count { background: #f59e0b; color: #111; border-radius: 8px; padding: 0 6px; font-size: 11px; font-weight: 700; margin-left: 2px; }
.role-badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: #f1f5f9; color: #334155; white-space: nowrap; }
.role-badge.superadmin { background: #fef3c7; color: #92400e; }
.role-badge.admin { background: #dbeafe; color: #1e40af; }
tr.role-superadmin, tr.role-admin { background: #fafcff; }
.pole { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: #ecfeff; color: #155e75; }
.sep { width: 1px; height: 24px; background: #bfdbfe; margin: 0 4px; }
.nowrap { white-space: nowrap; }
.flash.block { display: block; text-decoration: none; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-head h2 { margin: 0; }

.dots { display: inline-flex; gap: 3px; align-items: center; text-decoration: none !important; }
.doc-dot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-size: 11px; font-weight: 700; color: #fff; }
.doc-dot.facture_elec { background: #eab308; }
.doc-dot.facture_gaz { background: #0284c7; }
.doc-dot.comparateur { background: #0891b2; }
.doc-dot.contrat { background: #16a34a; }
.doc-dot.autre { background: #64748b; }
.doc-dot.off { background: #f1f5f9; color: #cbd5e1; }
.warn { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--danger); color: #fff; font-size: 12px; font-weight: 800; }

.upload { display: grid; grid-template-columns: 200px 1fr auto; gap: 8px; align-items: center; padding: 12px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px; margin-bottom: 14px; }
.upload input[type=file] { padding: 6px; background: #fff; }
.doc-groups { display: flex; flex-direction: column; gap: 10px; }
.doc-group { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.doc-group.empty { background: #fcfcfd; }
.doc-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.doc { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 0 0 28px; }
.doc a { word-break: break-all; }
.btn.ghost.danger { color: var(--danger); }

.tache-form { display: grid; grid-template-columns: 1fr 210px auto auto; gap: 8px; align-items: center; }
.tache-form select { width: auto; }
.taches { list-style: none; padding: 0; margin: 12px 0 0; }
.taches li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.taches li .grow { flex: 1; }
.taches li.done .t-titre { text-decoration: line-through; color: var(--muted); }
.taches li.late .t-titre { color: var(--danger); font-weight: 600; }
.check-btn { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #94a3b8; background: #fff; cursor: pointer; color: #fff; font-weight: 800; line-height: 1; padding: 0; margin-top: 1px; }
.check-btn:hover { border-color: var(--ok); }
.taches li.done .check-btn { background: var(--ok); border-color: var(--ok); }
@media (max-width: 1000px) {
  .upload, .tache-form { grid-template-columns: 1fr; }
}

/* --- espaces par pôle (2AAZ) --- */
.topbar nav a.pole-tab { border: 1px solid rgba(255,255,255,.35); }
.topbar nav a.pole-tab.active { background: #fff; color: #166534; font-weight: 600; }
.espace { margin-bottom: 14px; }
.espace h1 { margin-bottom: 10px; }
.subtabs { display: flex; gap: 6px; }
.subtabs a { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500; }
.subtabs a.on { background: #166534; border-color: #166534; color: #fff; }
.subtabs a:hover { text-decoration: none; }
a { color: #15803d; }
.sort.on { color: #15803d; }
.pole { margin-right: 6px; }
.sep { background: #bbf7d0; }

.docs-creation { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 6px; }
.doc-input { padding: 10px 12px; border: 1px dashed #cbd5e1; border-radius: 8px; background: #f8fafc; }
.doc-input > span { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.doc-input input[type=file] { background: #fff; padding: 6px; }
@media (max-width: 1000px) { .docs-creation { grid-template-columns: 1fr; } }

/* --- logo 2AAZ énergie --- */
.brand { gap: 10px; }
.brand-icon { width: 38px; height: 38px; border-radius: 10px; background: #fff; padding: 2px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-txt b { font-weight: 500; }
.brand-txt small { font-size: 11px; font-weight: 400; opacity: .8; }
.brand:hover { text-decoration: none; }
.login-logo { width: 190px; margin: 0 auto 4px; display: block; }
.login-card h1 { margin: 0; font-size: 20px; }

/* --- bouton Aujourd'hui --- */
.today-btn { background: #fff; color: #166534; border: 0; border-radius: 999px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.today-btn span { background: #f59e0b; color: #111; border-radius: 10px; padding: 0 7px; margin-left: 4px; font-size: 12px; }
.today-btn.vide span { background: #e2e8f0; color: #64748b; }

/* --- pop-ups --- */
body.modal-ouverte { overflow: hidden; }
.modal-fond { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: 85vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.modal-head img { width: 48px; height: 48px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head p { margin: 2px 0 0; }
.modal-x { margin-left: auto; border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); align-self: flex-start; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal-actions.centre { justify-content: center; }
.resume-liste { list-style: none; padding: 0; margin: 0; }
.resume-liste li { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.resume-liste li.passe { opacity: .55; }
.r-heure { font-weight: 800; font-size: 16px; color: #166534; }
.r-quoi a { font-weight: 600; }
.r-quoi small { display: block; color: var(--muted); }
.modal-fond.alerte .modal { text-align: center; border-top: 6px solid #f59e0b; }
.alerte-icone { font-size: 44px; animation: sonne 1s ease-in-out 3; }
@keyframes sonne { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-15deg); } 75% { transform: rotate(15deg); } }
.modal-fond.alerte h3 { margin: 6px 0; font-size: 20px; }
.alerte-quoi { font-size: 17px; font-weight: 600; margin: 4px 0; }
@media (max-width: 1000px) { .today-btn { padding: 4px 8px; } .brand-txt small { display: none; } }
