/* ==========================================================================
   Suivi-Tâches — système de design
   Une seule feuille de style, au-dessus de Bootstrap 5 (grille, formulaires,
   fenêtres modales). Aucun style n'est écrit dans les pages : la politique de
   sécurité du contenu l'interdit.
   ========================================================================== */

/* ---- Jetons ------------------------------------------------------------- */
:root {
  --brand: #0b6b4f;
  --brand-strong: #08543e;
  --brand-soft: #e7f2ee;
  --accent: #e0a100;

  --ink: #17212b;
  --ink-soft: #3d4a57;
  --muted: #66737f;
  --line: #e2e7ec;
  --line-strong: #cfd6dd;
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --surface-sunken: #f8fafb;

  --nav: #11202d;
  --nav-raised: #1a2d3d;
  --nav-ink: #c5d0da;
  --nav-muted: #7f90a0;

  --info: #1c64c4;
  --info-soft: #e8f0fb;
  --success: #0b6b4f;
  --success-soft: #e7f2ee;
  --warning: #9a6200;
  --warning-soft: #fdf3dc;
  --danger: #b3261e;
  --danger-soft: #fbeae8;
  --neutral: #55626e;
  --neutral-soft: #edf0f3;
  --review: #5b3fa8;
  --review-soft: #efeafa;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(23, 33, 43, 0.05), 0 1px 3px rgba(23, 33, 43, 0.06);
  --shadow-raised: 0 8px 24px rgba(23, 33, 43, 0.12);
  --sidebar-width: 256px;
  --topbar-height: 60px;

  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-font-size: 0.9375rem;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-link-color-rgb: 11, 107, 79;
  --bs-link-hover-color-rgb: 8, 84, 62;
  --bs-primary: var(--brand);
  --bs-primary-rgb: 11, 107, 79;
  --bs-secondary-color: var(--muted);
}

/* ---- Base --------------------------------------------------------------- */
body { -webkit-font-smoothing: antialiased; }

h1, h2, h3, h4, h5, h6 {
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -0.01em;
}

a { text-underline-offset: 2px; }

svg.feather, .btn svg, .app-nav-link svg, .panel-title svg {
  flex-shrink: 0;
  vertical-align: -0.16em;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 2000;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
}

.skip-link:focus { top: 12px; color: #fff; }

/* ---- Structure : barre latérale, bandeau, contenu ------------------------ */
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  background: var(--nav);
  color: var(--nav-ink);
  transition: transform 0.2s ease;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-height);
  flex-shrink: 0;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: #fff;
  text-decoration: none;
}

.app-brand:hover { color: #fff; }

.app-brand img {
  max-height: 32px;
  max-width: 110px;
  object-fit: contain;
}

.app-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
}

.app-brand-name {
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.15;
}

.app-brand-name small {
  display: block;
  color: var(--nav-muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.app-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 20px;
}

.app-nav-heading {
  margin: 18px 10px 6px;
  color: var(--nav-muted);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 2px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--nav-ink);
  font-size: 0.9rem;
  text-decoration: none;
}

.app-nav-link svg { width: 17px; height: 17px; opacity: 0.8; }
.app-nav-link:hover { background: var(--nav-raised); color: #fff; }

.app-nav-link.active {
  background: var(--nav-raised);
  color: #fff;
  font-weight: 600;
}

.app-nav-link.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.app-nav-link.active svg { opacity: 1; }

.app-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.8rem;
}

.app-sidebar-user strong { display: block; color: #fff; font-weight: 600; }

.app-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.2s ease;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-height);
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.app-topbar .breadcrumb {
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 0.86rem;
  white-space: nowrap;
  --bs-breadcrumb-divider-color: var(--line-strong);
  --bs-breadcrumb-item-active-color: var(--ink);
}

.app-topbar .breadcrumb a { color: var(--muted); text-decoration: none; }
.app-topbar .breadcrumb a:hover { color: var(--brand); }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-soft);
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--surface-sunken);
  color: var(--ink);
}

.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.88rem;
}

.user-menu-toggle:hover,
.user-menu-toggle[aria-expanded="true"] {
  border-color: var(--line);
  background: var(--surface-sunken);
}

.dropdown-menu {
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-border-radius: var(--radius);
  --bs-dropdown-font-size: 0.88rem;
  --bs-dropdown-link-active-bg: var(--brand);
  box-shadow: var(--shadow-raised);
}

.dropdown-item { display: flex; align-items: center; gap: 9px; }
.dropdown-item svg { width: 15px; height: 15px; color: var(--muted); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar-nav { background: var(--nav-raised); color: #fff; }

.app-content {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.app-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

.app-backdrop { display: none; }
body.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .app-main { margin-left: 0; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-raised); }
  .app-main { margin-left: 0; }
  body.sidebar-open .app-sidebar { transform: none; }

  body.sidebar-open .app-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1030;
    display: block;
    background: rgba(17, 32, 45, 0.45);
  }

  .app-content { padding: 16px; }
  .app-topbar { padding: 0 12px; }
  .user-menu-name { display: none; }
}

/* ---- En-tête de page ----------------------------------------------------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.page-title { margin: 0; font-size: 1.4rem; }
.page-subtitle { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }

.page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.page-actions form { display: inline-flex; }

/* ---- Panneaux ------------------------------------------------------------ */
.panel, .card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel { margin-bottom: 20px; }

.panel-header, .card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 0.98rem;
}

.panel-title svg { width: 17px; height: 17px; color: var(--muted); }
.panel-body { padding: 18px; }

.panel-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface-sunken);
}

.empty-state { padding: 36px 18px; color: var(--muted); text-align: center; }

.empty-state svg {
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 8px;
  color: var(--line-strong);
}

/* ---- Boutons ------------------------------------------------------------- */
.btn {
  --bs-btn-font-size: 0.875rem;
  --bs-btn-font-weight: 550;
  --bs-btn-border-radius: var(--radius-sm);
  --bs-btn-padding-x: 0.85rem;
  --bs-btn-padding-y: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

.btn-sm {
  --bs-btn-font-size: 0.82rem;
  --bs-btn-padding-x: 0.65rem;
  --bs-btn-padding-y: 0.3rem;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary, .btn-success {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-strong);
  --bs-btn-hover-border-color: var(--brand-strong);
  --bs-btn-active-bg: var(--brand-strong);
  --bs-btn-active-border-color: var(--brand-strong);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
}

.btn-outline-primary, .btn-outline-success {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--brand-soft);
  --bs-btn-hover-color: var(--brand-strong);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-soft);
  --bs-btn-active-color: var(--brand-strong);
  --bs-btn-active-border-color: var(--brand);
}

.btn-outline-secondary, .btn-outline-info, .btn-outline-warning, .btn-secondary, .btn-light {
  --bs-btn-color: var(--ink-soft);
  --bs-btn-bg: var(--surface);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--surface-sunken);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-border-color: var(--muted);
  --bs-btn-active-bg: var(--neutral-soft);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-border-color: var(--muted);
}

.btn-danger {
  --bs-btn-bg: var(--danger);
  --bs-btn-border-color: var(--danger);
  --bs-btn-hover-bg: #93201a;
  --bs-btn-hover-border-color: #93201a;
}

.btn-outline-danger {
  --bs-btn-color: var(--danger);
  --bs-btn-border-color: var(--line-strong);
  --bs-btn-hover-bg: var(--danger-soft);
  --bs-btn-hover-color: var(--danger);
  --bs-btn-hover-border-color: var(--danger);
}

.row-actions { display: inline-flex; gap: 4px; white-space: nowrap; }
.row-actions form { display: inline-flex; }

.row-actions .btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.row-actions .btn:hover {
  border-color: var(--line);
  background: var(--surface-sunken);
  color: var(--ink);
}

.row-actions .btn-danger-ghost:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---- Formulaires --------------------------------------------------------- */
.form-control, .form-select {
  border-color: var(--line-strong);
  background-color: var(--surface);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 107, 79, 0.15);
}

.form-check-input:checked { border-color: var(--brand); background-color: var(--brand); }

.form-label {
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.form-text { color: var(--muted); font-size: 0.8rem; }

.asteriskField, .form-label .text-danger {
  margin-left: 2px;
  color: var(--danger);
  font-size: inherit;
  font-weight: 700;
}

select[multiple] { min-height: 11rem; }
textarea.form-control { min-height: 6rem; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.form-intro {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid #cfe1f7;
  border-radius: var(--radius);
  background: var(--info-soft);
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.form-intro p:last-child, .form-intro ul:last-child { margin-bottom: 0; }

.form-intro code, .rich-text code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(23, 33, 43, 0.07);
  color: var(--ink);
  font-size: 0.85em;
}

.search-bar { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 8px; }
.search-field { position: relative; flex: 1 1 240px; max-width: 420px; }

.search-field svg {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-field .form-control { padding-left: 34px; }

/* ---- Tableaux ------------------------------------------------------------ */
.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--surface-sunken);
  --bs-table-border-color: var(--line);
  margin-bottom: 0;
  font-size: 0.89rem;
}

.table > thead > tr > th {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-sunken);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table > thead > tr > th a { color: inherit; text-decoration: none; }
.table > thead > tr > th.asc a::after { content: " ↑"; }
.table > thead > tr > th.desc a::after { content: " ↓"; }
.table > tbody > tr > td { padding: 11px 16px; vertical-align: middle; }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table-container { overflow-x: auto; }
.table td.index_number, .table th.index_number { width: 1%; color: var(--muted); }
.table td.action_column, .table th.action_column { width: 1%; text-align: right; }

.cell-title { color: var(--ink); font-weight: 600; text-decoration: none; }
a.cell-title:hover { color: var(--brand); text-decoration: underline; }
.cell-muted { color: var(--muted); font-size: 0.82rem; }
.cell-late { color: var(--danger); font-weight: 600; }

.pagination {
  --bs-pagination-color: var(--ink-soft);
  --bs-pagination-border-color: var(--line);
  --bs-pagination-hover-color: var(--brand);
  --bs-pagination-hover-bg: var(--brand-soft);
  --bs-pagination-active-bg: var(--brand);
  --bs-pagination-active-border-color: var(--brand);
  --bs-pagination-font-size: 0.85rem;
  justify-content: center;
  margin: 0;
  padding: 14px;
  border-top: 1px solid var(--line);
}

/* ---- Pastilles d'état ---------------------------------------------------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--neutral-soft);
  color: var(--neutral);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-to_validate { background: var(--warning-soft); color: var(--warning); }
.status-ongoing { background: var(--info-soft); color: var(--info); }
.status-completed, .status-active { background: var(--success-soft); color: var(--success); }
.status-late, .status-inactive { background: var(--danger-soft); color: var(--danger); }
.status-to_review { background: var(--review-soft); color: var(--review); }
.status-suspended, .status-archived { background: var(--neutral-soft); color: var(--neutral); }
.status-plain::before { display: none; }

/* ---- Avancement ---------------------------------------------------------- */
progress.task-progress {
  width: 90px;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--neutral-soft);
  vertical-align: middle;
  appearance: none;
}

progress.task-progress::-webkit-progress-bar { border-radius: 999px; background: var(--neutral-soft); }
progress.task-progress::-webkit-progress-value { border-radius: 999px; background: var(--brand); }
progress.task-progress::-moz-progress-bar { border-radius: 999px; background: var(--brand); }
progress.task-progress-wide { width: 100%; height: 9px; }

.progress-value {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

/* ---- Indicateurs du tableau de bord -------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

a.kpi:hover { border-color: var(--line-strong); box-shadow: var(--shadow-raised); color: var(--ink); }

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius);
  background: var(--neutral-soft);
  color: var(--neutral);
}

.kpi-icon svg { width: 20px; height: 20px; }

.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-label { color: var(--muted); font-size: 0.83rem; }
.kpi-warning .kpi-icon { background: var(--warning-soft); color: var(--warning); }
.kpi-info .kpi-icon { background: var(--info-soft); color: var(--info); }
.kpi-success .kpi-icon { background: var(--success-soft); color: var(--success); }
.kpi-danger .kpi-icon { background: var(--danger-soft); color: var(--danger); }
.kpi-review .kpi-icon { background: var(--review-soft); color: var(--review); }
.kpi-stack { flex-direction: column; align-items: flex-start; gap: 2px; }
.kpi-hint { color: var(--muted); font-size: 0.8rem; }
.kpi-value.is-bad { color: var(--danger); }

/* ---- Onglets ------------------------------------------------------------- */
.nav-tabs { gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); }

.nav-tabs .nav-link {
  margin-bottom: -1px;
  padding: 12px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-tabs .nav-link:hover { color: var(--ink); }

.nav-tabs .nav-link.active {
  border-bottom-color: var(--brand);
  background: transparent;
  color: var(--brand-strong);
}

/* ---- Fiches -------------------------------------------------------------- */
.detail-list { margin: 0; }

.detail-list > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-list > div:first-child { padding-top: 0; }
.detail-list > div:last-child { border-bottom: 0; padding-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 0.86rem; font-weight: 500; }
.detail-list dd { margin: 0; color: var(--ink); font-weight: 550; text-align: right; }

.rich-text { color: var(--ink-soft); line-height: 1.6; overflow-wrap: anywhere; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text h1, .rich-text h2, .rich-text h3 { margin-top: 1em; font-size: 1.05rem; }
.rich-text > :first-child { margin-top: 0; }

.rich-text blockquote {
  margin: 0 0 1rem;
  padding: 4px 14px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}

.timeline { margin: 0; padding: 0; list-style: none; }
.timeline > li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline > li:first-child { padding-top: 0; }
.timeline > li:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline-meta { color: var(--muted); font-size: 0.8rem; }

.reminder-list { margin: 0; padding: 0; list-style: none; }

.reminder-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.reminder-item:last-child { border-bottom: 0; }
.reminder-item > svg { flex-shrink: 0; width: 17px; height: 17px; margin-top: 3px; color: var(--muted); }
.reminder-item.is-due > svg { color: var(--accent); }
.reminder-item.is-done { color: var(--muted); }
.reminder-item.is-done > svg { color: var(--success); }
.reminder-body { flex: 1; min-width: 0; }
.reminder-body > a { display: block; text-decoration: none; }
.reminder-note { margin-top: 4px; color: var(--ink-soft); font-size: 0.88rem; }
.reminder-done > summary { list-style: none; }
.preset-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 16px; }

.calendar-legend { display: flex; gap: 14px; color: var(--muted); font-size: 0.82rem; }
.calendar-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.legend-reminder::before { background: var(--brand); }
.legend-deadline::before { background: var(--danger); }
#calendar .event-deadline { background: var(--danger); border-color: var(--danger); }
#calendar .event-done { opacity: 0.55; }

/* ---- Messages ------------------------------------------------------------ */
.alert {
  --bs-alert-border-radius: var(--radius);
  --bs-alert-padding-y: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
}

.alert > svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }
.alert-success { --bs-alert-bg: var(--success-soft); --bs-alert-border-color: #c4dfd5; --bs-alert-color: var(--brand-strong); }
.alert-info { --bs-alert-bg: var(--info-soft); --bs-alert-border-color: #cfe1f7; --bs-alert-color: #174f99; }
.alert-warning { --bs-alert-bg: var(--warning-soft); --bs-alert-border-color: #f1ddab; --bs-alert-color: #7a4e00; }
.alert-danger { --bs-alert-bg: var(--danger-soft); --bs-alert-border-color: #f0c9c5; --bs-alert-color: #8c1d17; }
.alert .btn-close { position: static; margin-left: auto; padding: 0.3rem; }

/* ---- Pages d'accès (connexion, activation, erreurs) ----------------------- */
.auth-page {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  min-height: 100vh;
  background: var(--surface);
}

.auth-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 48px;
  background: linear-gradient(160deg, #0d7a5a 0%, #0b6b4f 45%, #0a3f33 100%);
  color: #fff;
}

.auth-aside img {
  max-width: 220px;
  max-height: 64px;
  object-fit: contain;
  object-position: left;
}

.auth-aside h1 { margin: 0 0 12px; color: #fff; font-size: 2rem; }

.auth-aside p {
  max-width: 34ch;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.02rem;
  line-height: 1.55;
}

.auth-flag { display: flex; width: 72px; height: 5px; overflow: hidden; border-radius: 3px; }
.auth-flag span { flex: 1; }
.auth-flag span:nth-child(1) { background: #d7372f; }
.auth-flag span:nth-child(2) { background: var(--accent); }
.auth-flag span:nth-child(3) { background: #7fd1b3; }

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { margin: 0 0 6px; font-size: 1.5rem; }
.auth-card .auth-lead { margin-bottom: 26px; color: var(--muted); }
.auth-card .btn-primary { width: 100%; margin-top: 6px; padding-block: 0.6rem; }
.auth-links { margin-top: 20px; font-size: 0.88rem; text-align: center; }

.error-code {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 4rem;
  font-weight: 750;
  line-height: 1;
}

@media (max-width: 899.98px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { gap: 24px; padding: 28px 24px; }
  .auth-aside h1 { font-size: 1.5rem; }
}

/* ---- Calendrier des rappels ---------------------------------------------- */
#calendar {
  --fc-border-color: var(--line);
  --fc-today-bg-color: var(--brand-soft);
  --fc-event-bg-color: var(--brand);
  --fc-event-border-color: var(--brand);
  --fc-button-bg-color: var(--surface);
  --fc-button-border-color: var(--line-strong);
  --fc-button-text-color: var(--ink-soft);
  --fc-button-hover-bg-color: var(--surface-sunken);
  --fc-button-hover-border-color: var(--muted);
  --fc-button-active-bg-color: var(--brand);
  --fc-button-active-border-color: var(--brand);
  font-size: 0.88rem;
}

#calendar .fc-toolbar-title { font-size: 1.05rem; }
#calendar .fc-button { box-shadow: none; font-size: 0.82rem; text-transform: none; }
#calendar .fc-button-active { color: #fff; }
#calendar .fc-col-header-cell-cushion, #calendar .fc-daygrid-day-number { color: var(--ink-soft); text-decoration: none; }

/* ---- Impression ---------------------------------------------------------- */
@media print {
  .app-sidebar, .app-topbar, .app-footer, .page-actions, .row-actions, .report-filters { display: none; }
  .app-main { margin-left: 0; }
  .panel, .kpi { box-shadow: none; break-inside: avoid; }
}

/* ---- Divers --------------------------------------------------------------- */
.table > tbody > tr > td[colspan] { padding: 28px 16px; color: var(--muted); text-align: center; }
.asteriskField { font-size: 0.9em; }
details > summary { cursor: pointer; }

/* ---- Droits : cases à cocher par niveau de sensibilité ---------------------- */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }

.check-item, .check-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.check-item:hover, .check-card:hover { background: var(--surface-sunken); }
.check-card { border-color: var(--line); }
.check-item:has(input:checked), .check-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.check-item .form-check-input, .check-card .form-check-input { flex-shrink: 0; margin-top: 3px; }

.permission-level { border-left: 4px solid var(--line-strong); }
.permission-level-consultation { border-left-color: var(--success); }
.permission-level-contribution { border-left-color: var(--info); }
.permission-level-pilotage, .permission-level-referentiels { border-left-color: var(--accent); }
.permission-level-comptes { border-left-color: var(--danger); }
.permission-level .panel-title { flex-wrap: wrap; }
.sensitivity-consultation { background: var(--success-soft); color: var(--success); }
.sensitivity-contribution { background: var(--info-soft); color: var(--info); }
.sensitivity-pilotage, .sensitivity-referentiels { background: var(--warning-soft); color: var(--warning); }
.sensitivity-comptes { background: var(--danger-soft); color: var(--danger); }

/* ---- Notifications ------------------------------------------------------- */
.notification-toggle { position: relative; }

.notification-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.notification-menu { width: min(360px, calc(100vw - 32px)); padding: 0; overflow: hidden; }

.notification-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.notification-menu-header .btn-link { padding: 0; font-size: 0.8rem; text-decoration: none; }

.notification-menu-footer {
  display: block;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.notification-empty { margin: 0; padding: 22px 14px; color: var(--muted); text-align: center; }
.notification-list { margin: 0; padding: 0; list-style: none; }
.notification-menu .notification-list { max-height: 360px; overflow-y: auto; }
.notification-list li + li { border-top: 1px solid var(--line); }

.notification-item {
  display: flex;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.notification-item:hover { background: var(--surface-sunken); }
.notification-item svg { flex-shrink: 0; width: 17px; height: 17px; margin-top: 2px; color: var(--muted); }
.notification-item strong { display: block; font-weight: 500; font-size: 0.87rem; }
.notification-item small { color: var(--muted); font-size: 0.76rem; }
.is-unread .notification-item { background: var(--brand-soft); }
.is-unread .notification-item strong { font-weight: 650; }
.is-alert .notification-item svg { color: var(--danger); }
.notification-list-page .notification-item { padding: 14px 18px; }

/* ---- Tâches : contrôle, organisation, documents ---------------------------- */
.panel-review { border-color: var(--review); }
.panel-review .panel-title { color: var(--review); }
.review-actions { display: grid; gap: 14px; }
.review-refuse { display: grid; gap: 8px; max-width: 560px; }
.review-refuse .btn { justify-self: start; }

.link-group-title { margin: 12px 0 4px; color: var(--muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.link-group-title:first-child { margin-top: 0; }
.task-links { margin: 0; padding: 0; list-style: none; }
.task-links li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 0; }

.file-list { margin: 0; padding: 0; list-style: none; }
.file-list > li { padding: 12px 18px; }
.file-list > li + li { border-top: 1px solid var(--line); }
.file-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; }
.file-name svg { width: 16px; height: 16px; }
.file-history { margin-top: 6px; font-size: 0.85rem; }
.file-history ul { margin: 6px 0 0; padding-left: 18px; }

/* ---- Rapports ------------------------------------------------------------- */
.report-filters { margin-bottom: 18px; }
.report-table td.depth-1 { padding-left: 34px; }
.report-table td.depth-2 { padding-left: 52px; }
.report-table td.depth-3, .report-table td.depth-4 { padding-left: 70px; }
.report-table td.depth-0 { font-weight: 600; }

/* ---- Sécurité du compte --------------------------------------------------- */
.two-factor-setup { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.qr-code { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.two-factor-setup > div { flex: 1 1 320px; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.secret { font-size: 0.95rem; letter-spacing: 0.04em; word-break: break-all; }

.backup-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.backup-codes code {
  display: block;
  padding: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.95rem;
  text-align: center;
}

.plain-list { margin: 0; padding: 12px 18px 12px 34px; }

/* ---- Double authentification ---------------------------------------------- */
.method-list { display: grid; gap: 10px; margin: 4px 0 16px; }
.method-list dt { font-weight: 600; }
.method-list dd { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }
.auth-resend { margin-top: 10px; }
.auth-resend .btn-link { padding: 0; text-decoration: none; }

/* ---- Paramètres généraux ------------------------------------------------ */
.setting-preview { display: grid; gap: 16px; }
.setting-preview-label { margin-bottom: 6px; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.brand-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--nav);
  color: #fff;
}
.brand-preview img { max-height: 32px; max-width: 110px; object-fit: contain; }
.tab-preview {
  padding: 8px 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.tab-preview-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.tab-preview-tab img { width: 16px; height: 16px; flex-shrink: 0; object-fit: contain; }
.tab-preview-tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setting-image-label { font-weight: 600; }
.setting-image-use { margin-bottom: 8px; color: var(--muted); font-size: 0.82rem; }
.setting-image .photo-frame { height: 132px; }
.setting-image .photo-frame img { max-height: 104px; }
.form-section { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-section + .form-section { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
legend.form-section-title { float: none; width: auto; margin: 0 0 2px; font-size: 1rem; font-weight: 650; }
.form-section-help { margin-bottom: 14px; color: var(--muted); font-size: 0.86rem; }

.photo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}
.photo-frame img { display: block; max-width: 100%; max-height: 260px; object-fit: contain; }
.photo-empty { padding: 28px 12px; color: var(--muted); font-size: 0.85rem; text-align: center; }
.photo-empty svg { display: block; width: 26px; height: 26px; margin: 0 auto 6px; color: var(--line-strong); }

/* ---- Avatar par défaut, page de connexion (paramètres généraux) --------- */
.avatar-img { padding: 0; object-fit: cover; background: var(--surface); }
.auth-aside { position: relative; overflow: hidden; isolation: isolate; }
.auth-aside .auth-background {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  object-fit: cover;
  opacity: 0.28;
}
.auth-aside .auth-organization {
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.auth-support { margin: 22px 0 0; color: var(--muted); font-size: 0.86rem; text-align: center; }
.policy-table td, .policy-table th { white-space: nowrap; }
.policy-table td:first-child { white-space: normal; }

/* ---- Couleurs de la plateforme (paramètres généraux, voir /theme.css) ---- */
.swatch { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--line); border-radius: 4px; vertical-align: -2px; }
.swatch-brand { background: var(--brand); }
.swatch-accent { background: var(--accent); }
.swatch-nav { background: var(--nav); }
.form-control-color { width: 4rem; height: 2.4rem; padding: 0.3rem; }
