:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --text: #1b2433;
  --muted: #667089;
  --border: #e2e6ee;
  --brand: #16325c;
  --accent: #2f6fdf;
  --accent-soft: #e8f0fd;
  --ok: #1f9d55;
  --ok-soft: #e4f5eb;
  --warn: #c77700;
  --warn-soft: #fdf1dc;
  --danger: #d64545;
  --danger-soft: #fce8e8;
  --violet: #7c4ddb;
  --violet-soft: #efe9fc;
  --grey-soft: #eef1f5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 1rem; }
h3 { font-size: .98rem; margin: 0 0 .75rem; }
code { background: var(--grey-soft); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); font-weight: 400; }
.hot { color: var(--danger); font-weight: 600; }
.nowrap { white-space: nowrap; }
.note { color: var(--muted); font-size: .85rem; margin: .75rem 0 0; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem 0; margin: 0; }

/* Menu latéral */
:root { --sidebar-w: 248px; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  background: var(--brand); color: #fff; display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: inherit; font-size: 1.08rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { color: #8cc2ff; }
.logo { width: 30px; height: 30px; color: #8cc2ff; }
.sidebar > .brand { padding: 0 8px 18px; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,.1); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: .7rem; color: #c9d6ec; padding: .6rem .75rem; border-radius: 8px; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(140,194,255,.16); color: #fff; box-shadow: inset 3px 0 0 #8cc2ff; }
.icon { width: 19px; height: 19px; flex: 0 0 19px; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7f94b8; padding: 1.1rem .75rem .35rem; }
.nav-user { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-user form { margin: 0; }
.user-card { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 8px; color: #fff; font-size: .9rem; line-height: 1.25; }
.user-card:hover, .user-card.active { background: rgba(255,255,255,.07); text-decoration: none; }
.user-card small { display: block; color: #9fb2d3; font-size: .76rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #2f6fdf; display: grid; place-items: center; font-weight: 700; flex: 0 0 32px; }
.logout { display: flex; align-items: center; gap: .7rem; width: 100%; background: none; border: 0; color: #9fb2d3; font: inherit; font-size: .9rem; padding: .55rem .75rem; border-radius: 8px; cursor: pointer; text-align: left; }
.logout:hover { background: rgba(255,255,255,.07); color: #fff; }
.mobilebar { display: none; }
.sidebar-backdrop { display: none; }
.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.shell .container { flex: 1; width: 100%; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: flex-end; align-items: center; gap: .5rem;
  background: var(--brand); color: #fff; padding: 8px 24px;
}
.topbar form { margin: 0; }
.topbar-user { display: flex; align-items: center; gap: .6rem; padding: .3rem .6rem; border-radius: 8px; color: #fff; font-size: .9rem; line-height: 1.25; }
.topbar-user:hover, .topbar-user.active { background: rgba(255,255,255,.07); text-decoration: none; }
.topbar-user small { display: block; color: #9fb2d3; font-size: .76rem; }
.topbar-logout { display: flex; align-items: center; gap: .5rem; background: none; border: 1px solid rgba(255,255,255,.2); color: #c9d6ec; font: inherit; font-size: .88rem; padding: .4rem .75rem; border-radius: 8px; cursor: pointer; }
.topbar-logout:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.35); color: #fff; }
.notif { position: relative; }
.notif summary { list-style: none; position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; color: #c9d6ec; cursor: pointer; }
.notif summary::-webkit-details-marker { display: none; }
.notif summary:hover, .notif[open] summary { background: rgba(255,255,255,.07); color: #fff; }
.notif summary .icon { width: 21px; height: 21px; }
.notif-count { position: absolute; top: 2px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--brand); }
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 32px); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16,24,40,.18); overflow: hidden; z-index: 40; }
.notif-head { padding: .75rem 1rem; font-weight: 600; border-bottom: 1px solid var(--border); font-size: .92rem; }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.notif-list li + li { border-top: 1px solid var(--border); }
.notif-list a { display: block; padding: .65rem 1rem; color: var(--text); }
.notif-list a:hover { background: var(--grey-soft); text-decoration: none; }
.notif-title { display: block; font-size: .9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; color: var(--muted); font-size: .78rem; margin-top: .2rem; }
.notif-empty { margin: 0; padding: 1rem; color: var(--muted); font-size: .88rem; }
.notif-all { display: block; padding: .65rem 1rem; border-top: 1px solid var(--border); text-align: center; font-size: .86rem; font-weight: 500; }
.notif-all:hover { background: var(--accent-soft); text-decoration: none; }
.mobilebar-actions { display: flex; align-items: center; gap: .6rem; }
.mobilebar-actions .avatar { color: #fff; font-size: .9rem; }
.mobilebar-actions .avatar:hover { text-decoration: none; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.nav-toggle { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 8px; font-size: 1.1rem; padding: .2rem .6rem; cursor: pointer; }

.container { max-width: 1240px; margin: 0 auto; padding: 24px 16px 40px; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 24px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: .2rem 0 0; }
.crumbs { font-size: .9rem; margin-bottom: .35rem !important; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cartes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card.narrow, .narrow { max-width: 640px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 20px; min-width: 0; }

/* Indicateurs */
.kpis { display: grid; grid-template-columns: 1.6fr repeat(6, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; color: var(--text); border-top: 3px solid var(--border); }
a.kpi:hover { text-decoration: none; border-color: var(--accent); }
.kpi-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.85rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi-main { border-top-color: var(--brand); }
.kpi-main .progress { margin-top: .5rem; height: 8px; }
.kpi-en-cours { border-top-color: var(--accent); }
.kpi-a-venir { border-top-color: var(--violet); }
.kpi-bloquees, .kpi-en-retard { border-top-color: var(--danger); }
.kpi-bloquees .kpi-value, .kpi-en-retard .kpi-value { color: var(--danger); }

/* Copilote */
.copilot { background: linear-gradient(135deg, #f5f9ff 0%, #ffffff 60%); border-color: #cfe0fb; }
.copilot h2 { color: var(--brand); }
.copilot .spark { color: var(--accent); }
.copilot ul { margin: 0; padding-left: 1.2rem; }
.copilot li { margin: .3rem 0; }
.empty-setup { border-left: 4px solid var(--warn); }
.empty-setup p { color: var(--muted); }

/* Tableaux */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: .6rem .6rem; border-bottom: 1px solid var(--border); background: #fafbfd; vertical-align: bottom; }
.table td { padding: .6rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: #fafcff; }
.table tfoot td { font-weight: 700; background: #fafbfd; border-bottom: 0; }
.table-num td:not(:first-child), .table-num th:not(:first-child) { text-align: center; font-variant-numeric: tabular-nums; }
.cell-main { min-width: 240px; }
.cell-main small { display: block; color: var(--muted); }
.cell-main small.hot { color: var(--danger); font-weight: 500; }

/* Badges */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--grey-soft); color: var(--muted); }
.badge-en-cours { background: var(--accent-soft); color: var(--accent); }
.badge-a-venir { background: var(--violet-soft); color: var(--violet); }
.badge-bloquee, .badge-en-retard, .badge-rouge, .badge-haute { background: var(--danger-soft); color: var(--danger); }
.badge-terminee, .badge-dans-les-temps, .badge-vert { background: var(--ok-soft); color: var(--ok); }
.badge-echeance-proche, .badge-orange, .badge-moyenne { background: var(--warn-soft); color: var(--warn); }

.progress { display: inline-block; vertical-align: middle; width: 70px; height: 6px; background: var(--grey-soft); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.kpi .progress { width: 100%; }

.chart-box { position: relative; width: 100%; }

/* Boutons & formulaires */
.btn { display: inline-flex; align-items: center; gap: .35rem; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 8px; padding: .55rem 1rem; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(.95); text-decoration: none; }
.btn-sm { padding: .38rem .75rem; font-size: .84rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--grey-soft); filter: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger-ghost { background: var(--surface); color: var(--danger); border-color: #f2c4c4; }
.btn-danger-ghost:hover { background: var(--danger-soft); filter: none; }
.push-right { margin-left: auto; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: .92rem; color: var(--text); background: #fff; border: 1px solid #cfd5e1; border-radius: 8px; padding: .5rem .65rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--accent); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { background: #f7f8fa; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .86rem; font-weight: 600; margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.field-error { color: var(--danger); font-weight: 500; font-size: .82rem; }
label.check { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: .4rem; font-weight: 500; white-space: nowrap; margin: 0; }
.blocage-box { border: 1px dashed var(--border); border-radius: 10px; padding: 14px 14px 0; margin-bottom: 1rem; background: #fcfcfd; }
.is-bloquee .blocage-box { border: 1px solid #f2c4c4; background: #fff8f8; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: 14px; }
.filters input[type=search] { flex: 1 1 240px; width: auto; }
.filters select { width: auto; flex: 0 1 180px; }

.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form input[type=email], .inline-form input[type=password] { width: auto; flex: 1 1 180px; }
.inline-form select { width: auto; }
.add-form { padding-bottom: 1rem; margin-bottom: .5rem; border-bottom: 1px solid var(--border); }
.rows .row-form { padding: .55rem 0; border-bottom: 1px solid var(--border); }
.rows .row-form:last-child { border-bottom: 0; }
.row-form .grow { flex: 2 1 220px; }
.row-form .usage { font-size: .82rem; min-width: 70px; }
.row-form.is-inactive { opacity: .55; }
.w-order { width: 64px !important; flex: 0 0 64px; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { background: var(--surface); border: 1px solid var(--border); padding: .35rem .8rem; border-radius: 999px; font-size: .86rem; color: var(--text); }
.tabs a:hover { border-color: var(--accent); text-decoration: none; }
.tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.js-tabs .tab-panel:not(.active) { display: none; }
/* Calendrier */
.cal-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cal-head h2 { margin: 0 .5rem; min-width: 150px; text-align: center; }
.cal-legend { display: flex; gap: .35rem; flex-wrap: wrap; margin-left: auto; }
.cal-legend .cal-chip { font-size: .74rem; padding: .15rem .5rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal-dow { background: var(--grey-soft); color: var(--muted); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: .45rem .6rem; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 112px; padding: .35rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.is-weekend { background: #fafbfd; }
.cal-day.is-other { background: #f7f8fb; }
.cal-day.is-other .cal-date { color: #b3bac8; }
.cal-date { font-size: .82rem; font-weight: 600; color: var(--muted); padding: .1rem .25rem; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-day.is-today .cal-date { color: #fff; background: var(--accent); border-radius: 6px; align-self: flex-start; padding: .1rem .45rem; }
.cal-dow-m, .cal-month-m { display: none; }
.cal-chip { display: block; padding: .25rem .45rem; border-radius: 6px; font-size: .78rem; line-height: 1.25; color: var(--text); background: var(--grey-soft); border-left: 3px solid var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.cal-chip:hover { text-decoration: none; filter: brightness(.96); }
.cal-chip small { display: block; color: var(--muted); font-size: .7rem; overflow: hidden; text-overflow: ellipsis; }
.cal-legend .cal-chip { display: inline-block; }
.alerte-en-retard { background: var(--danger-soft); border-left-color: var(--danger); }
.alerte-bloquee { background: #fff; border: 1px dashed var(--danger); border-left: 3px solid var(--danger); }
.alerte-echeance-proche { background: var(--warn-soft); border-left-color: var(--warn); }
.alerte-dans-les-temps { background: var(--accent-soft); border-left-color: var(--accent); }
.alerte-terminee { background: var(--ok-soft); border-left-color: var(--ok); opacity: .75; text-decoration: line-through; text-decoration-color: rgba(31,157,85,.5); }

.steps { padding-left: 1.2rem; color: var(--muted); }
.steps li { margin-bottom: .4rem; }
.small-list { font-size: .86rem; color: var(--muted); max-height: 260px; overflow: auto; }

.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .92rem; background: var(--ok-soft); color: #13663a; border: 1px solid #bfe6cf; }
.flash-erreur { background: var(--danger-soft); color: #9b2c2c; border-color: #f2c4c4; }

/* Pages connexion / installation */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 0%, #24497f 0%, var(--brand) 55%, #0d1f3b 100%); }
.auth-box { width: 100%; max-width: 420px; margin: 0; padding: 28px; }
.brand-lg { color: var(--brand); font-size: 1.35rem; margin-bottom: .75rem; }
.brand-lg b { color: var(--accent); }
.brand-lg .logo { color: var(--accent); width: 36px; height: 36px; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .kpi-main { grid-column: span 4; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .mobilebar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; padding: 10px 16px; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .nav-open .sidebar { transform: none; }
  .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(13,31,59,.45); }
  .shell { margin-left: 0; }
  .topbar { display: none; }
  .cal-legend { margin-left: 0; width: 100%; }
  .cal-grid { display: block; border: 0; }
  .cal-dow, .cal-day.is-empty { display: none; }
  .cal-day { min-height: 0; border: 0; border-top: 1px solid var(--border); padding: .6rem 0; background: none !important; box-shadow: none !important; }
  .cal-dow-m, .cal-month-m { display: inline; font-weight: 400; }
  .cal-chip { white-space: normal; font-size: .86rem; padding: .4rem .6rem; }
  .notif-panel { position: fixed; top: 62px; left: 16px; right: 16px; width: auto; max-width: none; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi-main { grid-column: span 2; }
  .filters select { flex: 1 1 45%; }
  .card { padding: 16px; }
}

@media print {
  .sidebar, .mobilebar, .topbar, .actions, .filters, .footer, .tabs, .empty-setup { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .container { padding: 0; max-width: none; }
  .shell { margin: 0; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  a { color: inherit; }
}

/* ── Alertes sur les indicateurs (tableau de bord) ── */
.alertes-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.alertes-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.alertes-count { background: #fbe4e4; color: #b42318; border-radius: 999px; padding: 1px 9px; font-size: .85rem; }
.alerte { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border: 1px solid; border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; font-size: .92rem; }
.alerte-critique { border-color: #d92d20; background: #fef3f2; }
.alerte-attention { border-color: #dc6803; background: #fffaeb; }
.alerte.is-vue { opacity: .72; }
.alerte-titre { font-weight: 600; }
.alerte-critique .alerte-titre { color: #b42318; }
.alerte-attention .alerte-titre { color: #b54708; }
.alerte-msg { flex: 1; min-width: 220px; }
.alerte-lien { font-weight: 600; }
.alerte-date { font-size: .8rem; }
.alerte form { margin: 0; }
.alerte-close { background: none; border: 0; font-size: 1.2rem; line-height: 1; cursor: pointer; color: inherit; padding: 0 4px; }

/* ── Pagination de la liste des tâches ── */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pagination .muted { margin-right: auto; }

/* ── Badges de performance et de charge ── */
.badge-bon, .badge-vert { background: #dcfae6; color: #067647; }
.badge-surveiller, .badge-orange, .badge-charge-normale { background: #fef0c7; color: #b54708; }
.badge-insuffisant, .badge-rouge, .badge-charge-forte { background: #fee4e2; color: #b42318; }
.badge-charge-faible { background: #dcfae6; color: #067647; }
.badge-neutre { background: #f2f4f7; color: #475467; }
/* ══ Calendrier d'actions ══════════════════════════════════════════ */
.ac-head { align-items: flex-start; }
.ac-switch { display: inline-flex; background: #eef2f7; border-radius: 10px; padding: 3px; }
.ac-switch a { padding: 6px 14px; border-radius: 8px; color: #475467; text-decoration: none; font-weight: 600; font-size: .9rem; }
.ac-switch a.is-on { background: #fff; color: #1d2939; box-shadow: 0 1px 3px rgba(16,24,40,.12); }

.ac-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ac-kpi { background: #fff; border: 1px solid #e4e7ec; border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; border-top: 4px solid #2563eb; }
.ac-kpi span { font-size: .8rem; color: #667085; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.ac-kpi strong { font-size: 1.7rem; color: #101828; line-height: 1.1; }
.ac-kpi-retard { border-top-color: #d92d20; }
.ac-kpi-bloque { border-top-color: #dc6803; }
.ac-kpi-fin { border-top-color: #12b76a; }
.ac-kpi-sans { border-top-color: #98a2b3; }

.ac-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.ac-nav { display: flex; align-items: center; gap: 8px; }
.ac-nav h2 { margin: 0 8px; font-size: 1.25rem; min-width: 170px; text-align: center; }
.ac-btn { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid #d0d5dd; background: #fff; color: #344054; text-decoration: none; font-weight: 600; }
.ac-btn:hover { background: #f9fafb; }
.ac-btn-today { width: auto; }
.ac-filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ac-filtres select { border-radius: 9px; }

.ac-legende { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 4px 14px; font-size: .85rem; color: #475467; }
.ac-legende span { display: inline-flex; align-items: center; gap: 6px; }
.ac-legende i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.ac-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .ac-layout { grid-template-columns: 1fr; } }

.ac-grille { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.ac-dow { text-align: center; font-size: .75rem; font-weight: 700; color: #667085; text-transform: uppercase; padding: 6px 0; letter-spacing: .05em; }
.ac-jour { min-height: 108px; border: 1px solid #eaecf0; border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; background: #fff; transition: box-shadow .15s, border-color .15s, transform .15s; overflow: hidden; }
.ac-jour:hover { box-shadow: 0 6px 16px rgba(16,24,40,.08); border-color: #c7d2fe; transform: translateY(-1px); }
.ac-jour.is-week { background: #fafbfc; }
.ac-jour.is-autre { opacity: .45; }
.ac-jour.is-aujourdhui .ac-num { background: #2563eb; color: #fff; }
.ac-jour.is-selection { border-color: #2563eb; box-shadow: inset 0 0 0 1px #2563eb; }
.ac-num { align-self: flex-start; min-width: 26px; height: 26px; line-height: 26px; text-align: center; border-radius: 999px; font-weight: 700; font-size: .9rem; color: #344054; padding: 0 6px; }
.ac-puce { display: block; font-size: .72rem; line-height: 1.25; padding: 3px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 14%, #fff); border-left: 3px solid var(--c); color: #1d2939; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-puce.ac-retard { background: #fef3f2; }
.ac-puce.ac-bloque { background: #fffaeb; }
.ac-puce.ac-fin { opacity: .6; text-decoration: line-through; }
.ac-plus { font-size: .7rem; color: #667085; font-weight: 600; margin-top: auto; }

.ac-jour-panel { position: sticky; top: 16px; }
.ac-jour-date { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: #667085; font-weight: 700; }
.ac-jour-panel h2 { margin: 2px 0 12px; font-size: 1.15rem; }
.ac-carte { display: flex; flex-direction: column; gap: 6px; border: 1px solid #eaecf0; border-left: 4px solid var(--c); border-radius: 12px; padding: 12px; margin-bottom: 10px; text-decoration: none; color: inherit; background: #fff; }
.ac-carte:hover { box-shadow: 0 4px 14px rgba(16,24,40,.08); }
.ac-carte-titre { font-weight: 600; color: #101828; }
.ac-carte-meta { font-size: .8rem; color: #667085; }
.ac-carte-bas { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ac-carte-bas small { color: #667085; }
.ac-barre { flex: 1; min-width: 60px; height: 6px; background: #eaecf0; border-radius: 999px; overflow: hidden; }
.ac-barre span { display: block; height: 100%; background: #12b76a; border-radius: 999px; }

.ac-tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef2f6; color: #475467; }
.ac-tag.ac-retard { background: #fee4e2; color: #b42318; }
.ac-tag.ac-bloque { background: #fef0c7; color: #b54708; }
.ac-tag.ac-proche { background: #fef0c7; color: #b54708; }
.ac-tag.ac-ok { background: #dcfae6; color: #067647; }
.ac-tag.ac-fin { background: #e0e7ff; color: #3730a3; }

.ac-agenda { padding: 8px 18px; }
.ac-agenda-jour { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid #f2f4f7; }
.ac-agenda-jour:last-child { border-bottom: 0; }
.ac-agenda-jour.is-aujourdhui .ac-agenda-num { background: #2563eb; color: #fff; }
.ac-agenda-date { display: flex; align-items: center; gap: 10px; font-weight: 600; color: #344054; }
.ac-agenda-num { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #eef2f6; font-size: 1.1rem; font-weight: 800; }
.ac-agenda-date small { color: #667085; font-weight: 500; }
.ac-agenda-liste { display: flex; flex-direction: column; gap: 8px; }
.ac-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 14px; border-radius: 10px; border-left: 4px solid var(--c); background: #fff; border: 1px solid #eaecf0; border-left-width: 4px; text-decoration: none; color: inherit; }
.ac-ligne:hover { box-shadow: 0 4px 12px rgba(16,24,40,.07); }
.ac-ligne-titre { font-weight: 600; color: #101828; }
.ac-ligne-meta { grid-column: 1; font-size: .8rem; color: #667085; }
.ac-ligne .ac-tag { grid-row: 1 / span 2; grid-column: 2; }
.ac-ligne.ac-fin { opacity: .65; }
/* ══ Cadres et grilles : finitions ══════════════════════════════════ */
.card { position: relative; border-radius: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.04); transition: box-shadow .2s ease; }
.card > h2:first-child, .card > .card-title { margin-top: 0; }
.card h2 { font-size: 1.05rem; letter-spacing: -.01em; padding-left: 12px; border-left: 3px solid var(--brand); line-height: 1.3; margin: 0 0 14px; }
.card h2 .muted { font-weight: 400; font-size: .85rem; }
.card:hover { box-shadow: 0 2px 4px rgba(16,24,40,.06), 0 10px 26px rgba(16,24,40,.07); }
.copilot h2 { border-left: 0; padding-left: 0; }
.grid-2 { gap: 22px; }

/* Grilles : en-tête collant, rayures, survol net */
.table-wrap { border-radius: 12px; border: 1px solid var(--border); margin: 0; max-height: none; }
.table { font-size: .89rem; border-collapse: separate; border-spacing: 0; }
.table thead th { position: sticky; top: 0; z-index: 1; background: #f4f6fb; color: #475467; font-size: .71rem; padding: .7rem .75rem; border-bottom: 1px solid #d9dfeb; }
.table th:first-child, .table td:first-child { padding-left: 1rem; }
.table th:last-child, .table td:last-child { padding-right: 1rem; }
.table td { padding: .65rem .75rem; border-bottom: 1px solid #eef1f6; color: #1d2939; }
.table tbody tr:nth-child(even) { background: #fbfcfe; }
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { background: #eef4ff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { background: #f4f6fb; border-top: 2px solid #c7d2e6; color: #101828; }
.table a { color: var(--brand); font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table td.hot { background: var(--danger-soft); color: var(--danger); font-weight: 700; border-radius: 0; }
.table td.hot:not(:first-child) { text-align: center; }
.table-num td { font-variant-numeric: tabular-nums; }
.cell-main small { font-size: .78rem; line-height: 1.35; margin-top: 2px; }
.table .muted { color: #98a2b3; }

/* Pastilles de statut et de santé */
.badge { padding: .2rem .65rem; font-size: .74rem; letter-spacing: .01em; border: 1px solid transparent; }
.badge-rouge, .badge-orange, .badge-vert { font-weight: 700; padding-left: .7rem; }
.badge-rouge::before, .badge-orange::before, .badge-vert::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: middle; }
.badge-rouge { background: #fee4e2; color: #b42318; border-color: #fecdca; }
.badge-orange { background: #fef0c7; color: #b54708; border-color: #fedf89; }
.badge-vert { background: #dcfae6; color: #067647; border-color: #abefc6; }

/* KPI et barres de progression */
.kpi { border-radius: 16px; border-top-width: 4px; transition: transform .15s ease, box-shadow .15s ease; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,24,40,.09); }
.kpi-value { font-size: 1.9rem; }
.progress { height: 8px; background: #eaecf3; border-radius: 999px; overflow: hidden; }
.progress span { background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 999px; }

/* Synthèse et bandeaux */
.copilot { border-radius: 16px; border: 1px solid #cfe0fb; }
.copilot li { padding: .35rem 0 .35rem .15rem; border-bottom: 1px dashed #dbe6fa; }
.copilot li:last-child { border-bottom: 0; }
.note { background: #f8fafc; border: 1px solid #eef1f6; border-radius: 10px; padding: .6rem .8rem; margin-top: 12px; }
.empty { padding: 2rem 0; }
/* ── Identité : logo et couleur ── */
.logo-img { height: 34px; width: auto; max-width: 150px; object-fit: contain; display: block; }
.brand-lg .logo-img { height: 44px; }

/* ── Réattribution groupée ── */
th.ck, td.ck { width: 38px; text-align: center; padding-left: .5rem; padding-right: .5rem; }
td.ck input, th.ck input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.lot-barre { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding: 12px 16px; background: #1e293b; color: #e2e8f0; border-radius: 14px; box-shadow: 0 10px 30px rgba(15,23,42,.25); }
.lot-compte { font-size: .9rem; }
.lot-compte strong { color: #fff; }
.lot-cible { display: flex; align-items: center; gap: 8px; color: #e2e8f0; font-size: .88rem; margin: 0; }
.lot-cible select { min-width: 220px; border-radius: 9px; }
.lot-barre .btn[disabled] { opacity: .45; cursor: not-allowed; }
.lot-barre .btn { margin-left: auto; }
/* ══ Rapports ══ */
.rapports-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.rapport-carte { display: flex; flex-direction: column; gap: 8px; background: #fff; border: 1px solid #e4e7ec; border-radius: 16px; padding: 18px; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: transform .15s, box-shadow .15s; border-top: 4px solid var(--brand); }
.rapport-carte:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,24,40,.09); }
.rapport-carte.is-brouillon { border-top-color: #98a2b3; }
.rapport-entete { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rapport-entite { font-size: .8rem; color: #667085; }
.rapport-titre { font-size: 1.05rem; color: #101828; line-height: 1.3; }
.rapport-periode { font-size: .85rem; color: #475467; }
.rapport-pied { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: #667085; align-items: center; flex-wrap: wrap; }
.rapport-compteurs { display: inline-flex; gap: 10px; }
.badge-brouillon { background: #f2f4f7; color: #475467; }
.badge-publie { background: #dcfae6; color: #067647; }
.rapport-lecture { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .rapport-lecture { grid-template-columns: 1fr; } }
.rapport-corps { line-height: 1.65; color: #1d2939; white-space: normal; background: #fbfcfe; border: 1px solid #eef1f6; border-radius: 12px; padding: 14px 16px; }
.mt { margin-top: 22px; }
.rapport-avis { position: sticky; top: 16px; }
.rapport-formulaire { padding-bottom: 14px; border-bottom: 1px solid #eef1f6; margin-bottom: 14px; }
.rapport-formulaire label { margin-bottom: 10px; }
.fil { display: flex; flex-direction: column; gap: 12px; max-height: 70vh; overflow-y: auto; }
.fil-item { background: #fbfcfe; border: 1px solid #eef1f6; border-radius: 12px; padding: 10px 12px; }
.fil-item header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .9rem; }
.fil-item p { margin: 6px 0 2px; line-height: 1.5; white-space: normal; }
.avatar-mini { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--brand); color: #fff; font-size: .75rem; font-weight: 700; }
.avis { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.avis-favorable { background: #dcfae6; color: #067647; }
.avis-reserve { background: #fef0c7; color: #b54708; }
.avis-defavorable { background: #fee4e2; color: #b42318; }
.lien-discret { background: none; border: 0; color: #b42318; font-size: .8rem; cursor: pointer; padding: 0; margin-top: 4px; }
.rapport-edition .table td.ck { width: 44px; }
/* ── Éditeur de rapport (Quill) ── */
.editeur-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
.editeur-wrap .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--border); background: #f8fafc; }
.editeur-wrap .ql-container.ql-snow { border: 0; font-family: inherit; font-size: .95rem; }
.editeur-wrap .ql-editor { min-height: 280px; line-height: 1.6; color: #1d2939; }
.editeur-wrap .ql-editor h1, .editeur-wrap .ql-editor h2, .editeur-wrap .ql-editor h3 { line-height: 1.3; }
.rapport-corps.ql-editor { padding: 14px 16px; min-height: 0; }
.rapport-corps p, .rapport-corps ul, .rapport-corps ol { margin: .4em 0; }
.rapport-corps blockquote { border-left: 3px solid var(--brand); margin: .6em 0; padding: .2em .9em; color: #475467; background: #f8fafc; }
.rapport-corps pre { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; white-space: pre-wrap; }
.rapport-corps a { color: var(--brand); }
/* ══ Archives ══ */
.arch-annees { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.arch-annee { display: flex; flex-direction: column; align-items: flex-start; min-width: 120px; padding: 12px 16px; border-radius: 14px; background: #fff; border: 1px solid #e4e7ec; text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: transform .15s, box-shadow .15s; }
.arch-annee:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(16,24,40,.08); }
.arch-annee.is-on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.arch-annee-an { font-size: .8rem; color: #667085; font-weight: 700; letter-spacing: .04em; }
.arch-annee strong { font-size: 1.5rem; color: #101828; line-height: 1.2; }
.arch-annee small { color: #667085; }
.arch-filtres { padding: 14px 16px; }
.arch-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.arch-form label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: #475467; font-weight: 600; margin: 0; }
.arch-form select, .arch-form input { min-width: 150px; }
.arch-resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.arch-budget small { font-size: .8rem; color: #667085; font-weight: 500; }
.arch-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .arch-layout { grid-template-columns: 1fr; } }
.arch-titre { font-size: 1.05rem; margin: 0 0 10px; color: #101828; }
.arch-bloc { padding: 14px 18px; }
.arch-bloc-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.arch-bloc-titre { font-weight: 700; color: #101828; text-decoration: none; font-size: 1rem; }
.arch-bloc-titre:hover { color: var(--brand); }
.arch-groupe { border-top: 1px dashed #e4e7ec; padding-top: 8px; margin-top: 8px; }
.arch-groupe h3 { font-size: .9rem; margin: 0 0 4px; color: #344054; display: flex; align-items: center; gap: 8px; }
.arch-liste { list-style: none; margin: 0; padding: 0; }
.arch-liste li { padding: 4px 0 4px 16px; position: relative; font-size: .9rem; line-height: 1.4; }
.arch-liste li::before { content: "✓"; position: absolute; left: 0; color: #12b76a; font-weight: 700; }
.arch-liste a { color: #101828; font-weight: 600; text-decoration: none; }
.arch-liste a:hover { color: var(--brand); text-decoration: underline; }
.arch-ok { color: #067647; font-weight: 600; }
.arch-pastille { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; vertical-align: middle; }
/* ══ Barre du haut : messages et alertes ══ */
.notif .notif-panel { width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; }
.notif-action { display: inline; margin: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.notif-list li.is-nouveau a { background: #eef4ff; }
.notif-list li.is-nouveau .notif-title::before { content: "● "; color: #2563eb; font-size: .7em; vertical-align: middle; }
.notif-alertes li { display: flex; align-items: flex-start; gap: 6px; border-left: 3px solid transparent; padding-left: 6px; }
.notif-alertes li.notif-alerte-critique { border-left-color: #d92d20; }
.notif-alertes li.notif-alerte-attention { border-left-color: #dc6803; }
.notif-alertes li > a { flex: 1; min-width: 0; }
.notif-alertes li.is-vue { opacity: .6; }
.notif-alertes .alerte-close { font-size: 1.1rem; }