/* ============================================================
   BTP FINCOOP 1.8.2 — FEUILLE DE STYLE PRINCIPALE
   Couleurs centralisées (PALETTE BLEUE), structure claire.
   ============================================================ */

/* ============================================================
   1. VARIABLES & RESET
   ============================================================ */
:root {
  --ink: #24364b;
  --heading: #102a43;
  --muted: #5f7084;
  --line: #dfe6ee;
  --canvas: #f4f7fb;
  --navy: #063970;
  --navy2: #124e88;
  
  /* Couleur 1 : Bleu (Action principale) */
  --accent: #2563eb;           
  --accent-hover: #1d4ed8;     
  --accent-soft: #eff6ff;      
  --accent-border: #bfdbfe;    
  
  /* Couleur 3 : Vert émeraude (Action secondaire / Suivi) - NOUVEAU */
  --success: #10b981;          
  --success-hover: #059669;    
  --success-soft: #ecfdf5;     
  --success-border: #a7f3d0;   

  --shadow: 0 6px 22px rgba(16, 42, 67, .05);
}


* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font: 15px Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font: inherit;
  line-height: 1.4;
}


/* ============================================================
   2. STRUCTURE GÉNÉRALE (App Shell, Sidebar, Topbar)
   ============================================================ */
.app-shell {
  min-height: 100vh;
  display: flex;
}

/* --- Sidebar --- */
.sidebar {
  width: 245px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 25px 16px 18px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: var(--accent);
  font-size: 20px;
  font-weight: 800;
}

.brand strong, .brand small,
.sidebar-footer strong, .sidebar-footer small { display: block; }

.brand strong { font-size: 16px; }
.brand small { margin-top: 3px; color: #c8d9ed; font-size: 12px; }

.sidebar-label,
.eyebrow,
.section-kicker {
  color: #bdd0e6;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .12em;
}

.sidebar-label { padding: 0 11px 12px; }

.side-nav { display: grid; gap: 5px; }

.side-link {
  display: flex;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 9px;
  color: #e1ebf7;
  font-size: 14px;
}

.side-link:hover,
.side-link.active {
  color: #fff;
  background: var(--navy2);
}

.side-link.active {
  background: var(--navy2);
  box-shadow: inset 4px 0 var(--accent);
  font-weight: 700;
}

.side-link.active .nav-icon { color: #fff; }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid #ffffff18;
  padding: 18px 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer strong { font-size: 12px; }
.sidebar-footer small { margin-top: 3px; color: #bdd0e6; font-size: 11px; }

.footer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #52c99d;
}

/* --- Zone principale --- */
.main-area { flex: 1; min-width: 0; }

.topbar {
  height: 78px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
}

.eyebrow { color: var(--muted); font-size: 10px; }
.topbar-title { margin-top: 4px; font-weight: 700; }

.user-menu { display: flex; gap: 10px; align-items: center; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}

.user-info strong, .user-info small { display: block; }
.user-info strong { font-size: 13px; }
.user-info small { color: var(--muted); font-size: 11px; }

/* --- Contenu --- */
.content {
  max-width: 1440px;
  margin: auto;
  padding: 32px 34px 50px;
}


/* ============================================================
   3. TYPOGRAPHIE & EN-TÊTES DE PAGE
   ============================================================ */
h1, h2, h3, h4, .topbar-title { color: var(--heading); }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 23px;
}

.page-heading h1,
.login-card h1 {
  margin: 7px 0 5px;
  font-size: clamp(22px, 2vw, 28px);
  letter-spacing: -.035em;
}

.page-heading h1 { font-size: clamp(24px, 2vw, 30px); }

.section-kicker { color: var(--accent-hover); }
.page-heading p { margin: 0; font-size: 14px; }
.muted { color: var(--muted); }

/* ============================================================
   4. BOUTONS
   ============================================================ */
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

/* --- PRIMAIRE : Bleu (ex: Ouvrir le Gantt, WBS) --- */
.button-primary { 
  background: var(--accent); 
  color: #fff; 
}
.button-primary:hover { 
  background: var(--accent-hover); 
}

/* --- SECONDAIRE : Blanc (ex: Retour, Modifier) --- */
.button-secondary {
  background: #fff;
  border-color: var(--line);
  color: #536174;
}
.button-secondary:hover {
  background: #edf3f9;
  border-color: #bdcde0;
  color: var(--heading);
}

/* --- NOUVEAU : SUCCESS (Vert émeraude) (ex: Rapports, Finance) --- */
.button-success { 
  background: var(--success); 
  color: #fff; 
  border-color: var(--success);
}
.button-success:hover { 
  background: var(--success-hover); 
  border-color: var(--success-hover);
}

/* --- QUiet : Fantôme (ex: Annuler) --- */
.button-quiet { 
  background: transparent; 
  color: #59687a; 
}
.button-quiet:hover { 
  background: #edf3f9; 
  color: var(--heading); 
}

/* ============================================================
   5. CARTES STATISTIQUES & PANNEAUX
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card, .panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 112px;
  padding: 17px 18px;
  border-top: 3px solid #d8e4f2;
}

.stat-label {
  display: block;
  color: #758296;
  font-size: 12px;
  font-weight: 600;
}

.stat-card strong {
  display: block;
  margin-top: 9px;
  font-size: 25px;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.stat-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.stat-label, .table-sub, .field-help { color: var(--muted); }

.panel { overflow: hidden; }

.panel-heading { padding: 18px 20px; }
.panel-heading h2 { margin: 0; font-size: 15px; }
.panel-heading p { margin: 5px 0 0; font-size: 12px; }

.panel-heading h2, .report-heading h2 { font-size: 16px; }


/* ============================================================
   6. TABLEAUX
   ============================================================ */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th {
  padding: 11px 17px;
  text-align: left;
  color: var(--muted);
  background: #fafbfc;
  border-block: 1px solid #edf0f3;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

td {
  padding: 14px 17px;
  border-bottom: 1px solid #f0f2f5;
  color: #536174;
  font-size: 12px;
}

.table-wrap tbody tr:hover { background: #f7faff; }

.project-name { display: block; color: #24374d; font-weight: 700; }
.table-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.text-link { color: #2563eb; font-weight: 700; }
.text-link:hover,
.breadcrumb a:hover,
.add-boq:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* ============================================================
   7. BADGES DE STATUT
   ============================================================ */
.status-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  background: #f0f2f5;
  color: #657184;
}

/* Projets */
.status-en_cours { color: #138065; background: #e2f5ef; }
.status-planifie { color: #4c69a2; background: #eaf0fb; }
.status-suspendu { color: #1d4ed8; background: #eff6ff; }
.status-cloture { color: #657184; background: #eef0f3; }
.status-annule { color: #ad4b4b; background: #ffeded; }

/* Achats */
.status-soumise,
.status-validee,
.status-partiellement_commande { color: #7856a3; background: #f0eafe; }
.status-rejetee,
.status-annule { color: #ad4b4b; background: #ffeded; }
.status-brouillon { color: #657184; background: #eef0f3; }
.status-emis { color: #27649f; background: #e8f2fc; }
.status-commande,
.status-recu,
.status-cloture { color: #138065; background: #e2f5ef; }

/* Exécution */
.status-soumis { color: #7856a3; background: #f0eafe; }
.status-valide { color: #138065; background: #e2f5ef; }
.status-rejete { color: #ad4b4b; background: #ffeded; }

/* Finance */
.status-partiellement_payee { color: #7856a3; background: #f0eafe; }
.status-payee { color: #138065; background: #e2f5ef; }
.status-annulee { color: #ad4b4b; background: #ffeded; }
.status-enregistre { color: #27649f; background: #e8f2fc; }
.status-partiellement_commandee { color: #7856a3; background: #f0eafe; }


/* ============================================================
   8. ÉTATS VIDES & MESSAGES
   ============================================================ */
.empty-state {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  text-align: center;
}

.empty-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: #eff6ff;
  color: var(--accent-hover);
  font-size: 22px;
}

.empty-state h3 { margin: 14px 0 5px; }
.empty-state p { margin: 0 0 15px; font-size: 13px; }

.messages { margin-bottom: 17px; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.alert-success { background: #e7f6ef; color: #167252; }
.alert-error, .alert-danger { background: #fff0ee; color: #a14439; }
.alert-warning { background: #f2edfa; color: #61408c; }


/* ============================================================
   9. FIL D'ARIANE & DÉTAILS PROJET
   ============================================================ */
.breadcrumb {
  display: flex;
  gap: 9px;
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 12px;
}

.breadcrumb a { color: #2563eb; font-weight: 700; }

.detail-stats { margin-bottom: 18px; }
.stat-amount { font-size: 20px !important; }
.stat-date { font-size: 19px !important; }

.two-column {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
}

.coming-soon {
  display: flex;
  gap: 13px;
  margin: 2px 20px 22px;
  padding: 16px;
  border: 1px dashed #dfe5eb;
  border-radius: 9px;
  background: #fafbfd;
}

.coming-soon strong { font-size: 13px; }
.coming-soon p { margin: 6px 0 0; font-size: 12px; line-height: 1.6; }
.coming-icon { color: var(--accent-hover); font-size: 22px; }

.description-block { padding: 0 21px 20px; font-size: 13px; line-height: 1.7; }
.description-block p { margin: 7px 0; }

.timeline {
  padding: 0 21px 20px;
  display: grid;
  gap: 16px;
}

.timeline-item { display: flex; gap: 11px; }

.timeline-dot {
  margin-top: 3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-item strong, .timeline-item small { display: block; }
.timeline-item strong { font-size: 12px; }
.timeline-item small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.empty-inline { padding: 0 21px 22px; font-size: 12px; }


/* ============================================================
   10. FORMULAIRES
   ============================================================ */
.form-panel { max-width: 900px; padding: 23px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}

.field { min-width: 0; }
.field-full { grid-column: 1 / -1; }

.field label {
  display: block;
  margin-bottom: 7px;
  color: #45546a;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #dfe4ea;
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
}

.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--navy); }

.field textarea { min-height: 90px; }

.field-error { display: block; margin-top: 5px; color: #a14439; font-size: 11px; }

.form-actions { display: flex; justify-content: flex-end; gap: 9px; }
.form-errors { color: #a14439; }
.form-errors { padding: 12px 15px; color: #a14439; background: #fff3f1; font-size: 12px; }

.field input[type=file]::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* --- Connexion --- */
.login-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 160px);
}

.login-card {
  width: min(100%, 420px);
  padding: 30px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.login-card h1 { font-size: 24px; }
.login-card p { font-size: 13px; margin: 0 0 21px; }
.form-stack { display: grid; gap: 15px; }


/* ============================================================
   11. PLANNING / WBS
   ============================================================ */
.planning-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 17px;
  padding: 18px 21px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.planning-link-card strong { font-size: 14px; }
.planning-link-card p { margin: 5px 0 0; font-size: 12px; }

.plan-panel { margin-bottom: 18px; }

.plan-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 19px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.plan-toolbar > div:first-child { display: flex; align-items: center; gap: 10px; }
.plan-toolbar strong { font-size: 13px; }
.toolbar-actions { display: flex; align-items: center; gap: 14px; }

.wbs-tree { padding: 12px 18px 21px; }

.wbs-phase {
  border: 1px solid #e8edf2;
  border-radius: 10px;
  margin: 10px 0;
  overflow: hidden;
}

.wbs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
}

.wbs-head > div:first-child {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 9px;
  align-items: center;
}

.phase-head { background: #f5f8fb; }
.phase-head strong { font-size: 14px; }
.lot-head { background: #fbfcfd; border-top: 1px solid #eef1f4; }

.wbs-code {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 5px;
  background: #eaf0f7;
  color: #526b85;
  font: 700 9px ui-monospace, monospace;
}

.wbs-head small { grid-column: 2; color: var(--muted); font-size: 11px; }
.wbs-lot { margin-left: 17px; border-left: 2px solid #e1e8ef; }

.wbs-task {
  padding: 13px 15px 13px 18px;
  margin-left: 18px;
  border-top: 1px solid #edf0f3;
}

.task-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.task-title strong { font-size: 13px; }
.task-title small { color: var(--muted); font-size: 11px; }
.task-title .text-link { margin-left: auto; font-size: 11px; }

.boq-wrap {
  overflow-x: auto;
  margin-top: 11px;
  border: 1px solid #edf0f3;
  border-radius: 7px;
}

.boq-table { font-size: 11px; }
.boq-table th { padding: 8px 10px; }
.boq-table td { padding: 9px 10px; font-size: 11px; }

.boq-empty, .nested-empty { margin: 11px 0 0; color: var(--muted); font-size: 11px; }

.add-boq {
  display: inline-block;
  margin-top: 10px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
}

.version-history { margin-top: 17px; }
.version-list { display: grid; }

.version-list > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid #f0f2f5;
  font-size: 12px;
}

.version-list small { margin-left: auto; color: var(--muted); font-size: 11px; }


/* ============================================================
   12. ACHATS / APPROVISIONNEMENTS
   ============================================================ */
.budget-warning { margin-bottom: 14px; }

.module-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 17px;
}

.module-links .planning-link-card { margin: 0; min-width: 0; }

.purchase-panel { margin-bottom: 17px; }
.compact-empty { min-height: 175px; }

.purchase-note {
  padding: 17px 20px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.65;
}

.purchase-note p { margin: 7px 0; }
.purchase-note small { color: var(--muted); font-size: 11px; }

.add-request-line {
  padding: 17px 20px;
  border-top: 1px solid var(--line);
  background: #fcfdfe;
}

.add-request-line .form-grid {
  grid-template-columns: 1.4fr .55fr 1fr;
  align-items: end;
}

.add-request-line .field-full { grid-column: auto; }
.add-request-line .form-actions { justify-content: flex-start; }

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: #b54e42;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0 18px;
  padding: 14px 18px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
}

.decision-form {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
}

.decision-form .toolbar-actions { justify-content: flex-end; }

.cancel-panel {
  margin: 14px 0 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.cancel-panel summary {
  padding: 15px 18px;
  color: #a14439;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.cancel-panel[open] summary { border-bottom: 1px solid var(--line); }

.procurement-form { margin-bottom: 18px; }
.procurement-form .form-grid { margin-top: 13px; }
.supplier-create { max-width: none; }

.order-entry-table { min-width: 940px; }

.order-entry-table input,
.order-entry-table select {
  min-width: 112px;
  min-height: 36px;
  padding: 7px;
  border: 1px solid #dfe4ea;
  border-radius: 6px;
  font-size: 12px;
}

.order-entry-table select { min-width: 240px; }
.order-entry-table td { vertical-align: top; }

.order-entry-table tfoot th,
.boq-table tfoot th {
  padding: 12px 17px;
  background: #fafbfc;
  border-top: 1px solid var(--line);
  text-align: right;
  color: #43536a;
  font-size: 12px;
}

.compact-stat { font-size: 17px !important; line-height: 1.25; }
.danger-note { border-color: #f4c9c4; background: #fff7f6; }


/* ============================================================
   13. EXÉCUTION
   ============================================================ */
.execution-panel { margin-bottom: 17px; }

.execution-actions form {
  display: grid;
  gap: 6px;
  min-width: 230px;
}

.execution-actions input {
  min-width: 210px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid #dfe4ea;
  border-radius: 6px;
  font-size: 11px;
}

.execution-actions .button { width: 100%; }

.execution-note, .execution-form-note { font-size: 12px; line-height: 1.6; }
.execution-note { margin: 4px 2px 0; }
.execution-form-note { margin: 0 0 18px; }

.field-help { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }


/* ============================================================
   14. STOCK / DÉPÔT
   ============================================================ */
.depot-setup {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 17px 20px;
}

.depot-setup strong { font-size: 13px; }
.depot-setup p { margin: 5px 0 0; font-size: 12px; }

.stock-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stock-action {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.stock-action:hover { border-color: #93c5fd; }
.stock-action strong { font-size: 12px; }
.stock-action small { color: var(--muted); font-size: 11px; line-height: 1.5; }

.stock-panel { margin-bottom: 16px; }
.stock-columns { margin-bottom: 0; }
.stock-list { display: grid; }

.stock-list > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 19px;
  border-top: 1px solid #f0f2f5;
  color: var(--ink);
  text-decoration: none;
}

.stock-list > a:hover { background: #fafbfc; }
.stock-list strong, .stock-list small { display: block; }
.stock-list strong { font-size: 12px; }
.stock-list small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.stock-note { font-size: 11px; line-height: 1.6; margin: 4px 0 17px; }
.stock-form { padding: 0 19px 18px; }
.stock-receipt-head { margin: 0 0 14px; padding-top: 16px; }

.receipt-entry-table { min-width: 920px; }

.receipt-entry-table input,
.receipt-entry-table select {
  width: 100%;
  min-width: 105px;
  min-height: 35px;
  padding: 6px 8px;
  border: 1px solid #dfe4ea;
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
}

.receipt-entry-table textarea {
  width: 100%;
  min-width: 150px;
  min-height: 50px;
  padding: 7px;
  border: 1px solid #dfe4ea;
  border-radius: 6px;
  font-size: 11px;
}

.receipt-entry-table td { vertical-align: top; }
.receipt-entry-table td:first-child { min-width: 220px; }
.receipt-entry-table .table-sub { max-width: 250px; white-space: normal; }

.stock-submit { padding-top: 15px; }
.stock-transfer-reason { padding: 17px 0; }

.stock-transfer-reason textarea {
  width: 100%;
  min-height: 85px;
  padding: 9px 11px;
  border: 1px solid #dfe4ea;
  border-radius: 7px;
  font-size: 13px;
}

.transfer-entry-table { min-width: 580px; }
.transfer-entry-table select { min-width: 300px; }
.transfer-entry-table input { max-width: 190px; }

.stock-period-form { padding: 17px 20px; }

.stock-period-form .form-grid {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.stock-period-form .form-actions { justify-content: flex-start; }

.stock-stats { margin: 0 0 17px; }
.stock-stats .stat-card { min-width: 0; }
.stock-stats .stat-card strong { font-size: 19px; }

.stock-filter-panel { margin-bottom: 16px; }


/* ============================================================
   15. FINANCE
   ============================================================ */
.finance-panel { margin-bottom: 17px; }
.finance-stats .stat-card strong { font-size: 20px; }

.finance-inline-action {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px;
}

.finance-alert { margin: 14px 18px; }
.finance-form { display: grid; gap: 16px; }
.finance-header-form { padding: 0 20px 20px; }

.finance-entry-table { min-width: 980px; }
.finance-entry-table td { vertical-align: top; }
.finance-entry-table td:first-child { min-width: 195px; white-space: normal; }

.finance-entry-table input,
.finance-entry-table select {
  min-width: 95px;
  min-height: 34px;
  padding: 6px 7px;
  border: 1px solid #dfe4ea;
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
}

.finance-entry-table input[name$="motif_ecart"] { min-width: 175px; }
.finance-entry-table input[name$="intitule_taxe"] { min-width: 72px; width: 72px; }

.tax-inputs {
  display: grid;
  grid-template-columns: 72px 74px;
  gap: 4px;
}

.retention-entry-table { min-width: 480px; }

.retention-entry-table input,
.retention-entry-table select { min-width: 145px; }

.retention-entry-table input { max-width: 130px; }

.finance-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.finance-actions { padding-bottom: 2px; }

.finance-two-column { align-items: start; }
.finance-two-column .panel { min-width: 0; }

.finance-action-bar { align-items: center; }
.finance-action-bar form { margin-left: auto; }

.payment-panel { margin-top: 17px; }

.payment-form {
  padding: 18px 20px;
  border-top: 1px solid var(--line);
  background: #fcfdfe;
}

.payment-form h3 { margin: 0 0 13px; font-size: 13px; }

.payment-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 12px;
}

.finance-footer-meta { margin-top: 14px; font-size: 11px; }
.inline-reverse { min-width: 130px; }

.inline-reverse summary {
  color: #a14439;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.inline-reverse form { display: grid; gap: 5px; padding: 8px 0; }

.inline-reverse input {
  min-width: 160px;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid #dfe4ea;
  border-radius: 5px;
  font-size: 11px;
}

.finance-form-panel { max-width: 650px; }


/* ============================================================
   16. RAPPORTS
   ============================================================ */
.report-stats { margin-bottom: 14px; }
.report-money { font-size: 19px !important; line-height: 1.3; }
.report-access-note { margin: 0 0 18px; }

.report-budget-panel,
.report-panel,
.report-alert-panel { margin-bottom: 17px; }

.report-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.report-heading h2 { margin: 0; font-size: 15px; }
.report-heading p { margin: 5px 0 0; font-size: 12px; }

.report-budget-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  padding: 0 20px 16px;
}

.report-budget-summary > div {
  padding: 12px;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #fbfcfd;
}

.report-budget-summary span,
.report-budget-summary strong { display: block; }

.report-budget-summary span { color: var(--muted); font-size: 11px; }
.report-budget-summary strong { margin-top: 6px; font-size: 14px; }

.report-meter-wrap { padding: 5px 20px 18px; }

.report-meter-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: #59687a;
  font-size: 11px;
}

.report-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 9px;
  background: #edf0f3;
}

.report-meter span {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: 9px;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.report-meter-wrap > small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.report-footnote { padding: 0 20px 16px; font-size: 11px; line-height: 1.6; }

.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 17px;
  padding: 13px 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.report-toolbar strong, .report-toolbar small { display: block; }
.report-toolbar strong { font-size: 13px; }
.report-toolbar small { margin-top: 4px; color: var(--muted); font-size: 11px; }

.report-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.report-alert-list { display: grid; }

.report-alert {
  display: flex;
  gap: 13px;
  padding: 14px 19px;
  border-top: 1px solid #f0f2f5;
}

.report-alert > span {
  min-width: 100px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.report-alert strong { font-size: 12px; }
.report-alert p { margin: 4px 0 0; color: #738094; font-size: 11px; line-height: 1.55; }

.report-alert-danger { background: #fff9f8; }
.report-alert-danger strong { color: #a14439; }
.report-alert-warning { background: #eff6ff; }
.report-alert-warning strong { color: #1d4ed8; }
.report-alert-info strong { color: #385d86; }

.report-physical-panel { margin-bottom: 17px; }


/* ============================================================
   17. GRAPHIQUES (Rapports)
   ============================================================ */
.report-budget-chart { margin-bottom: 17px; }

.report-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.report-chart-card { min-width: 0; margin-bottom: 17px; }

.report-chart-list {
  display: grid;
  gap: 17px;
  padding: 15px 20px 20px;
}

.report-chart-row { display: grid; gap: 7px; min-width: 0; }

.report-chart-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  color: #607084;
  font-size: 11px;
}

.report-chart-label strong {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #35465a;
  font-size: 11px;
}

.report-chart-label strong .wbs-code { flex-shrink: 0; }
.report-chart-label > span { flex-shrink: 0; text-align: right; }

.report-chart-track {
  position: relative;
  height: 11px;
  overflow: hidden;
  border-radius: 10px;
  background: #eef1f4;
}

.report-chart-track > span {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: 10px;
  background: linear-gradient(90deg, #7b9bc9, #4e75af);
}

.report-chart-bar-planned { background: linear-gradient(90deg, #8ca7cc, #5679af) !important; }
.report-chart-bar-ordered { background: linear-gradient(90deg, #b7a0dc, #8868b7) !important; }
.report-chart-bar-invoiced { background: linear-gradient(90deg, #60a5fa, #2563eb) !important; }
.report-chart-bar-paid { background: linear-gradient(90deg, #74c4a5, #29946f) !important; }
.report-chart-bar-exposure { background: linear-gradient(90deg, #e99b91, #cf6254) !important; }

.report-chart-progress-track > span { background: linear-gradient(90deg, #8bcab2, #29946f); }
.report-chart-consumption-track > span { background: linear-gradient(90deg, #86c9b0, #329777); }
.report-chart-row-overrun .report-chart-consumption-track > span { background: linear-gradient(90deg, #e99b91, #d66558); }

.report-chart-limit {
  position: absolute;
  top: -2px;
  right: 0;
  height: 15px;
  border-right: 2px dashed #46566b;
}

.report-chart-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.report-chart-legend i {
  width: 13px;
  height: 10px;
  border-right: 2px dashed #46566b;
}

/* Graphique dépenses */
.report-expense-chart { margin-bottom: 17px; }

.report-expense-track {
  height: 18px;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, #f5f7fa 0, #f5f7fa calc(25% - 1px), #e2e7ee calc(25% - 1px), #e2e7ee 25%);
}

.report-expense-track > span { height: 100%; border-radius: 3px; }

.report-chart-bar-expense-material { background: #4477d3 !important; }
.report-chart-bar-expense-labor { background: #2563eb !important; }
.report-chart-bar-expense-rental { background: #36a879 !important; }
.report-chart-bar-expense-fuel { background: #52629f !important; }
.report-chart-bar-expense-equipment { background: #8b6cc8 !important; }
.report-chart-bar-expense-service { background: #36a7bc !important; }
.report-chart-bar-expense-other { background: #8995a5 !important; }

.report-expense-row {
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(0, 1fr);
  align-items: center;
  gap: 13px;
}

.report-expense-row > strong {
  color: #607084;
  text-align: right;
  font-size: 11px;
}

.report-expense-bar-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.report-expense-value { color: #607084; font-size: 11px; white-space: nowrap; }


/* ============================================================
   18. CASHFLOW
   ============================================================ */
.cashflow-filter-panel,
.cashflow-panel { margin-bottom: 16px; }

.cashflow-filter-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 13px;
  padding: 0 20px 18px;
}

.cashflow-filter-form input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #dfe4ea;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.cashflow-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cashflow-form-error { grid-column: 1 / -1; margin: 0; }

.cashflow-stats { margin-bottom: 16px; }
.cashflow-stats .stat-card strong { font-size: 20px; }

.cashflow-chart { display: grid; gap: 11px; padding: 16px 20px 18px; }

.cashflow-chart-row {
  display: grid;
  grid-template-columns: 105px minmax(80px, 1fr) 125px;
  align-items: center;
  gap: 13px;
  color: #46566b;
  font-size: 11px;
}

.cashflow-chart-row > strong { font-size: 11px; }

.cashflow-track {
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  background: #eef1f4;
}

.cashflow-track > span {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, #8bcab2, #29946f);
}

.cashflow-chart-amount {
  text-align: right;
  color: #35465a;
  font-weight: 700;
  white-space: nowrap;
}

.cashflow-chart-amount small { color: var(--muted); font-weight: 500; }
.cashflow-overdue { color: #ad4b4b; font-weight: 700; }

.cashflow-panel tfoot th {
  color: #34465d;
  background: #f2f5f8;
  text-transform: none;
  letter-spacing: 0;
}

.cashflow-method-note {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #e1e8ed;
  border-radius: 9px;
  background: #f8fafb;
  color: #68778a;
  font-size: 12px;
  line-height: 1.6;
}

.cashflow-method-note strong { color: #35465a; }


/* ============================================================
   19. GANTT
   ============================================================ */
.gantt-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.gantt-shortcut:not(.planning-link-card) {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 14px;
}

.gantt-panel { margin-bottom: 15px; }

.gantt-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  color: #748094;
  font-size: 11px;
}

.gantt-legend span { display: flex; align-items: center; gap: 7px; }

.gantt-legend i {
  display: inline-block;
  width: 17px;
  height: 8px;
  border-radius: 5px;
}

.gantt-legend-plan { background: #e5e7eb; }
.gantt-legend-progress { background: #2563eb; }
.gantt-legend-today { width: 2px !important; height: 14px !important; background: #cf6254; }

.gantt-scroll { overflow-x: auto; }
.gantt-chart { min-width: 1020px; }

.gantt-head, .gantt-row {
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(680px, 1fr);
}

.gantt-head {
  background: #fafbfc;
  border-bottom: 1px solid #e9edf1;
}

.gantt-label-head {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.gantt-axis {
  position: relative;
  height: 46px;
  border-left: 1px solid #e9edf1;
}

.gantt-axis-label {
  position: absolute;
  top: 7px;
  transform: translateX(5px);
  color: #6e7b8d;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.gantt-today-label {
  position: absolute;
  top: 25px;
  transform: translateX(5px);
  color: #bd5248;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.gantt-row {
  min-height: 65px;
  border-bottom: 1px solid #f0f2f5;
}

.gantt-task-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 9px 18px;
}

.gantt-task-label strong { font-size: 11px; white-space: normal; }
.gantt-task-label small { color: var(--muted); font-size: 10px; white-space: normal; }

.gantt-track {
  position: relative;
  min-height: 65px;
  border-left: 1px solid #e9edf1;
  background: #fff;
}

.gantt-gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #eff2f5;
}

.gantt-today-line {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #cf6254;
  opacity: .8;
}

.gantt-bar {
  position: absolute;
  z-index: 1;
  top: 22px;
  height: 21px;
  min-width: 3px;
  overflow: hidden;
  border-radius: 7px;
  background: #e5e7eb;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.gantt-progress {
  display: block;
  height: 100%;
  border-radius: 7px;
  background: #2563eb;
}

.gantt-bar-late {
  background: #f8d9d5;
  box-shadow: inset 0 0 0 1px #edbbb4;
}

.gantt-bar-late .gantt-progress { background: #d66558; }

.gantt-bar-caption {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 7px;
  color: #334155;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.gantt-note { margin: 0 0 17px; font-size: 11px; line-height: 1.6; }

/* Gantt : statuts lisibles et palette demandée */
.gantt-row { min-height: 78px; }
.gantt-track { min-height: 78px; }
.gantt-task-label { gap: 3px; }
.gantt-task-label small { line-height: 1.35; }

.gantt-bar {
  top: 29px;
  height: 18px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08), 0 2px 5px rgba(15, 23, 42, .08);
}

.gantt-progress { border-radius: 9px; transition: width .25s ease; }

.gantt-bar--planned {
  background: linear-gradient(90deg, #e5e7eb, #d1d5db);
  box-shadow: inset 0 0 0 1px #c7cdd5, 0 2px 5px rgba(15, 23, 42, .06);
}

.gantt-bar--planned .gantt-progress { background: #9ca3af; }

.gantt-bar--progress {
  background: linear-gradient(90deg, #dbeafe, #bfdbfe);
  box-shadow: inset 0 0 0 1px #a9c8f1, 0 2px 6px rgba(37, 99, 235, .12);
}

.gantt-bar--progress .gantt-progress { background: linear-gradient(90deg, #60a5fa, #2563eb); }

.gantt-bar--late {
  background: linear-gradient(90deg, #fee2e2, #fecaca);
  box-shadow: inset 0 0 0 1px #f4aaaa, 0 2px 6px rgba(220, 38, 38, .12);
}

.gantt-bar--late .gantt-progress { background: linear-gradient(90deg, #f87171, #dc2626); }

.gantt-bar--done {
  background: linear-gradient(90deg, #dcfce7, #bbf7d0);
  box-shadow: inset 0 0 0 1px #9de7b3, 0 2px 6px rgba(22, 163, 74, .12);
}

.gantt-bar--done .gantt-progress { background: linear-gradient(90deg, #4ade80, #16a34a); }

.gantt-status {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
}

.gantt-status--planned { color: #596273; background: #f1f3f5; border-color: #d8dde3; }
.gantt-status--progress { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.gantt-status--late { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.gantt-status--done { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }

.gantt-legend { flex-wrap: wrap; gap: 12px 20px; }
.gantt-legend-planned { background: #9ca3af; }
.gantt-legend-progress { background: #3b82f6; }
.gantt-legend-late { background: #dc2626; }
.gantt-legend-done { background: #16a34a; }
.gantt-legend-today { width: 2px !important; height: 14px !important; background: #334155; }
.gantt-today-line { background: #334155; }
.gantt-today-label { color: #334155; }


/* ============================================================
   20. ALERTES / PARAMÈTRES D'ALERTES
   ============================================================ */
.alert-settings-panel { max-width: 900px; padding-bottom: 19px; }
.alert-settings-panel > .panel-heading { padding-bottom: 4px; }

.alert-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 12px 20px 20px;
}

.alert-setting-toggle { grid-column: 1 / -1; }

.alert-setting-toggle label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #45546a;
  font-size: 12px;
}

.alert-setting-toggle input { margin-top: 2px; }
.alert-setting-toggle strong, .alert-setting-toggle small { display: block; }
.alert-setting-toggle strong { font-size: 12px; }
.alert-setting-toggle small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.alert-settings-note {
  margin: 0 20px 18px;
  padding: 14px 15px;
  border: 1px solid #e9edf1;
  border-radius: 8px;
  background: #fafbfc;
  font-size: 12px;
}

.alert-settings-note p { margin: 5px 0 0; color: #748094; font-size: 11px; line-height: 1.6; }
.alert-settings-actions { padding: 0 20px; }
.gantt-shortcut.planning-link-card { margin-bottom: 14px; }


/* ============================================================
   21. ÉQUIPE PROJET & NOTIFICATIONS
   ============================================================ */
.member-card { position: relative; min-width: 0; }
.member-card-summary { display: block; cursor: pointer; list-style: none; }
.member-card-summary::-webkit-details-marker { display: none; }

.member-card[open] .member-card-summary {
  border-color: #c7d2e0;
  box-shadow: 0 8px 24px #12243a18;
}

.member-list-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  width: min(440px, calc(100vw - 34px));
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px #0f172a24;
}

.member-list-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 3px 10px;
  color: #334155;
  font-size: 13px;
}

.member-list-title span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
}

.member-list { max-height: 330px; overflow: auto; }

.member-list-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 10px 3px;
  border-top: 1px solid #eef1f5;
}

.member-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf4ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
}

.member-list-row strong, .member-list-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-list-row strong { color: #334155; font-size: 11px; }
.member-list-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.member-role {
  max-width: 145px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #526174;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.member-manage-link {
  display: block;
  margin-top: 9px;
  padding-top: 10px;
  border-top: 1px solid #eef1f5;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
}

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

.notification-menu > summary {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  list-style: none;
  cursor: pointer;
  border: 1px solid #e7ebf0;
  border-radius: 10px;
  background: #fff;
  color: #526174;
}

.notification-menu > summary::-webkit-details-marker { display: none; }
.notification-bell { font-size: 21px; line-height: 1; }

.notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 99px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.notification-dropdown {
  position: absolute;
  z-index: 50;
  top: 44px;
  right: 0;
  width: min(360px, calc(100vw - 28px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 48px #0f172a24;
}

.notification-dropdown-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid #eef1f5;
  color: #334155;
  font-size: 12px;
}

.notification-dropdown-head a { color: #2563eb; font-size: 11px; font-weight: 700; }

.notification-item {
  display: block;
  padding: 10px;
  border-radius: 8px;
}

.notification-item:hover,
.notification-item.is-unread { background: #f5f8fc; }

.notification-item strong, .notification-item small { display: block; }
.notification-item strong { color: #334155; font-size: 11px; }
.notification-item small { margin-top: 4px; color: #8290a2; font-size: 10px; line-height: 1.45; }

.notification-empty { padding: 12px; color: #8290a2; font-size: 11px; }

.notification-center { padding: 0 18px; }

.notification-center-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 4px;
  border-bottom: 1px solid #eef1f5;
}

.notification-center-row:last-child { border-bottom: 0; }

.notification-center-row.is-unread {
  background: linear-gradient(90deg, #eff6ff, transparent 75%);
}

.notification-type-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: #3b82f6;
}

.notification-type-success { background: #16a34a; }
.notification-type-warning { background: #dc2626; }

.notification-center-content { flex: 1; min-width: 0; }
.notification-center-content strong { color: #334155; font-size: 12px; }
.notification-center-content p { margin: 4px 0; color: #64748b; font-size: 11px; }
.notification-center-content small { color: var(--muted); font-size: 10px; }

.notification-center-empty {
  padding: 54px 20px;
  text-align: center;
  color: #64748b;
}

.notification-center-empty > span { display: block; margin-bottom: 10px; font-size: 25px; }
.notification-center-empty strong { color: #334155; font-size: 14px; }
.notification-center-empty p { font-size: 12px; }


/* ============================================================
   22. NAVIGATION PAR PROJET & DOCUMENTS
   ============================================================ */
.sidebar-project {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #ffffff18;
}

.sidebar-project-name {
  padding: 0 11px 12px;
  color: #c8d9ed;
  font-size: 11px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-nav-project {
  max-height: calc(100vh - 330px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #52677c transparent;
}

.side-nav-project .side-link { padding-block: 9px; font-size: 12px; }

.side-nav-project .nav-icon {
  width: 15px;
  flex: none;
  text-align: center;
  color: #c8d9ed;
}

.document-permission-note {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #dbe7f3;
  border-radius: 10px;
  background: linear-gradient(110deg, #f1f7fd, #fff);
  color: #47617d;
}

.document-permission-note > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: #dcecff;
  color: #2763a5;
  font-weight: 800;
}

.document-permission-note p { margin: 2px 0; font-size: 12px; line-height: 1.55; }

.document-list-panel { overflow: visible; }

.document-list-panel > .panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.document-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(200px, 1fr) auto;
  align-items: center;
  gap: 15px;
  padding: 17px 20px;
  border-top: 1px solid #edf0f3;
}

.document-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 48px;
  border: 1px solid #f5c8c2;
  border-radius: 8px;
  background: #fff3f1;
  color: #c34339;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}

.document-main { min-width: 0; }

.document-title-line {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.document-title-line > strong { color: #26384e; font-size: 13px; }

.document-category {
  padding: 4px 8px;
  border-radius: 999px;
  background: #f0f4f8;
  color: #63748a;
  font-size: 10px;
  font-weight: 700;
}

.document-main p { margin: 5px 0; color: #65758a; font-size: 11px; }
.document-main > small { color: var(--muted); font-size: 10px; }

.document-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 410px;
}

.document-actions .text-link { font-size: 11px; }

.document-waiting { color: #1d4ed8; font-size: 10px; font-weight: 700; }
.document-approval-form { grid-column: 2 / -1; justify-self: end; }
.text-danger { color: #b44343; }

.document-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 42px 18px;
  color: #8290a2;
  text-align: center;
}

.document-empty > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 11px;
  border-radius: 13px;
  background: #f1f5f9;
  color: #73849b;
  font-size: 20px;
}

.document-empty strong { color: #3b4c61; font-size: 13px; }
.document-empty p { margin: 6px 0 0; font-size: 11px; }

.document-form-panel { max-width: 900px; padding: 22px; }
.document-form-panel .form-grid { padding: 0; }

.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.module-links .module-documents {
  border-color: #d7e4f0;
  background: linear-gradient(120deg, #fff, #f6faff);
}

.document-version-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 700;
}

.document-history {
  grid-column: 2 / -1;
  border-top: 1px solid #edf0f3;
  padding-top: 9px;
}

.document-history > summary {
  color: #52647b;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.document-history > summary::-webkit-details-marker { display: none; }
.document-history > summary:after { content: '＋'; float: right; color: #8290a2; }
.document-history[open] > summary:after { content: '−'; }

.document-history-list {
  display: grid;
  margin-top: 7px;
  padding: 5px 10px;
  border-radius: 8px;
  background: #f8fafc;
}

.document-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #e9eef3;
}

.document-history-row:last-child { border-bottom: 0; }
.document-history-row strong, .document-history-row small { display: block; }
.document-history-row strong { color: #45566b; font-size: 11px; }
.document-history-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.document-history-row .document-actions { max-width: none; }
.document-auth-history { margin-top: 0; }


/* ============================================================
   23. GRAPHIQUES JS & CONTRATS
   ============================================================ */
.report-js-chart {
  position: relative;
  height: 280px;
  padding: 12px 18px 18px;
}

.report-js-chart.report-js-chart-short { height: 240px; }

.report-js-chart canvas { width: 100% !important; height: 100% !important; }

.report-chart-fallback.is-enhanced { display: none; }

.report-chart-help { padding: 0 20px 16px; color: var(--muted); font-size: 10px; }

.contract-expiry {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 700;
}

.contract-expiry-late { background: #fff0ee; color: #a14439; }


/* ============================================================
   24. COURRIERS
   ============================================================ */
.courrier-panel { margin-bottom: 18px; }

.courrier-filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
}

.courrier-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  padding: 17px;
  font-size: 12px;
  color: var(--muted);
}

.courrier-subject { white-space: normal; max-width: 350px; margin-top: 5px; }

.courrier-late {
  display: block;
  font-size: 11px;
  color: #c54e42;
  font-weight: 700;
  margin-top: 4px;
}

.courrier-filter-note { padding: 0 18px 12px; color: #1d4ed8; font-size: 12px; }

.courrier-document {
  padding: 10px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.courrier-document .gantt-actions { justify-content: flex-start; margin-top: 7px; }

.courrier-audit {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.courrier-audit summary { cursor: pointer; font-weight: 600; font-size: 12px; }

.courrier-audit-value { white-space: normal; overflow-wrap: anywhere; }

.courrier-form input[type=checkbox] { width: 16px; min-height: 16px; }

.courrier-form #id_documents label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 400;
}

.courrier-form #id_documents input { flex: none; }

/* Identité : cases à cocher et boutons radio aux couleurs de la charte */
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }


/* ============================================================
   25. MEDIA QUERIES (Responsive)
   ============================================================ */

/* --- 1000px --- */
@media (max-width: 1000px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .report-budget-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* --- 900px --- */
@media (max-width: 900px) {
  .module-links { grid-template-columns: 1fr; }
  .add-request-line .form-grid { grid-template-columns: 1fr; }
  .add-request-line .field-full { grid-column: 1 / -1; }
  .action-bar { align-items: flex-start; flex-direction: column; }
  .finance-two-column { grid-template-columns: 1fr; }
  .finance-action-bar { align-items: flex-start; }
  .finance-action-bar form { margin-left: 0; }
  .cashflow-filter-form { grid-template-columns: 1fr 1fr; }
  .cashflow-filter-actions { grid-column: 1 / -1; }
  .cashflow-chart-row { grid-template-columns: 94px minmax(70px, 1fr) 110px; }
  .courrier-filters { grid-template-columns: 1fr 1fr; }
  .courrier-filters > .field:first-child { grid-column: 1 / -1; }
}

/* --- 950px --- */
@media (max-width: 950px) {
  .stock-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-period-form .form-grid { grid-template-columns: 1fr 1fr; }
  .stock-period-form .form-actions { grid-column: 1 / -1; }
}

/* --- 740px --- */
@media (max-width: 740px) {
  /* App shell */
  .app-shell { display: block; }
  .sidebar { width: 100%; padding: 13px 16px; }
  .brand { padding: 0 4px 12px; }
  .sidebar-label, .sidebar-footer { display: none; }
  .side-nav { display: flex; overflow-x: auto; }
  .side-link { white-space: nowrap; padding: 9px; }
  .topbar { height: 64px; padding: 0 16px; }
  .eyebrow { display: none; }
  .content { padding: 23px 16px 35px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .two-column { grid-template-columns: 1fr; }
  .user-info { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }

  /* Planning */
  .planning-link-card { align-items: flex-start; flex-direction: column; }
  .plan-toolbar { align-items: flex-start; flex-direction: column; }
  .wbs-tree { padding: 8px; }
  .wbs-lot { margin-left: 9px; }
  .wbs-task { margin-left: 7px; padding-left: 10px; }
  .version-list > div { flex-wrap: wrap; }
  .version-list small { width: 100%; margin-left: 0; }

  /* Achats */
  .toolbar-actions { flex-wrap: wrap; }
  .purchase-panel .panel-heading { padding: 15px; }
  .decision-form { padding: 15px; }
  .order-entry-table { min-width: 880px; }

  /* Stock */
  .depot-setup { align-items: flex-start; flex-direction: column; }
  .stock-actions { grid-template-columns: 1fr 1fr; }
  .stock-form { padding: 0 12px 15px; }
  .stock-period-form { padding: 14px; }
  .stock-period-form .form-grid { grid-template-columns: 1fr; }
  .stock-period-form .form-actions { grid-column: auto; }
  .stock-stats { grid-template-columns: 1fr 1fr; }
  .stock-list > a { align-items: flex-start; }
  .stock-list .status-badge { white-space: nowrap; }

  /* Finance */
  .finance-header-form { padding: 0 14px 16px; }
  .payment-form { padding: 15px; }
  .payment-form-footer { align-items: flex-start; flex-direction: column; }
  .finance-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Rapports */
  .report-heading, .report-toolbar { align-items: flex-start; flex-direction: column; }
  .report-budget-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline: 14px; }
  .report-meter-wrap { padding-inline: 14px; }
  .report-footnote { padding-inline: 14px; }
  .report-columns { grid-template-columns: 1fr; }
  .report-alert { padding-inline: 14px; }
  .report-alert > span { min-width: 82px; }
  .report-charts-grid { grid-template-columns: 1fr; }
  .report-chart-list { padding: 14px; }
  .report-chart-label { align-items: flex-start; }
  .report-chart-label strong { flex-wrap: wrap; }
  .report-expense-row { grid-template-columns: minmax(78px, 100px) minmax(0, 1fr); gap: 8px; }
  .report-expense-bar-area { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .report-expense-value { text-align: right; font-size: 10px; }
  .report-js-chart { height: 250px; padding-inline: 12px; }

  /* Cashflow */
  .cashflow-page-heading { align-items: flex-start; flex-direction: column; }
  .cashflow-filter-form { grid-template-columns: 1fr; padding-inline: 14px; }
  .cashflow-filter-actions { grid-column: auto; align-items: stretch; flex-direction: column; }
  .cashflow-filter-actions .button { width: 100%; }
  .cashflow-chart { padding-inline: 14px; }
  .cashflow-chart-row { grid-template-columns: 82px minmax(40px, 1fr) 105px; gap: 8px; font-size: 10px; }
  .cashflow-chart-row > strong { font-size: 10px; }
  .cashflow-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Gantt */
  .gantt-actions { justify-content: flex-start; }
  .gantt-legend { align-items: flex-start; flex-direction: column; gap: 9px; padding: 13px 15px; }
  .gantt-task-label { padding-inline: 12px; }

  /* Alertes */
  .alert-settings-grid { grid-template-columns: 1fr; padding: 10px 14px 17px; }
  .alert-settings-note { margin-inline: 14px; }
  .alert-settings-actions { padding-inline: 14px; }
  .alert-settings-panel .alert-setting-toggle { grid-column: auto; }

  /* Équipe / Notifications */
  .member-list-panel { left: 0; right: auto; }
  .notification-center { padding: 0 12px; }
  .notification-center-row { gap: 8px; }
  .notification-center-row > .button { padding: 0 8px; }

  /* Documents */
  .sidebar-project { margin-top: 10px; padding-top: 10px; }
  .sidebar-project-name { display: none; }
  .side-nav-project { max-height: none; }
  .document-row { grid-template-columns: 36px minmax(0, 1fr); gap: 11px; padding: 14px; }
  .document-icon { width: 35px; height: 41px; }
  .document-actions { grid-column: 2; justify-content: flex-start; max-width: none; }
  .document-approval-form { grid-column: 2; justify-self: start; }
  .document-form-panel { padding: 15px; }
  .document-history { grid-column: 1 / -1; }
  .document-history-row { align-items: flex-start; flex-direction: column; }
  .document-history-row .document-actions { justify-content: flex-start; }
}

/* --- 470px --- */
@media (max-width: 470px) {
  .stat-card { padding: 13px; min-height: 100px; }
  .stat-card strong { font-size: 21px; }
  .form-panel { padding: 16px; }
  .login-card { padding: 24px 19px; }
  .stock-actions, .stock-stats { grid-template-columns: 1fr; }
  .stock-list > a { flex-direction: column; }
  .report-budget-summary { grid-template-columns: 1fr 1fr; }
  .report-alert { gap: 8px; }
  .report-alert > span { min-width: 69px; font-size: 10px; }
  .courrier-filters { grid-template-columns: 1fr; }
  .courrier-filters > .field:first-child { grid-column: auto; }
}