/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary: #1a3a6b;
  --primary-light: #2563a8;
  --accent: #e63946;
  --bg-light: #f8f9fc;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

/* ── Global ────────────────────────────────────────────────── */
body {
  background: var(--bg-light);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ────────────────────────────────────────────────── */
.bg-primary-custom {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%) !important;
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 2.5rem;
  margin-bottom: 2rem;
}
.hero-section .badge-ref {
  background: rgba(255,255,255,.2);
  font-size: .7rem;
  border-radius: 20px;
  padding: .3rem .75rem;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card { border: none; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header-colored {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1rem 1.5rem;
}

/* ── Form ──────────────────────────────────────────────────── */
.form-section {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary-light);
}
.form-section-title {
  font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--primary); margin-bottom: 1rem;
}
.form-check-card {
  border: 2px solid #e9ecef; border-radius: 8px;
  padding: .5rem .75rem;
  transition: border-color .15s, background .15s; cursor: pointer;
}
.form-check-card:hover, .form-check-card.selected {
  border-color: var(--primary-light); background: #eef4fb;
}

/* ── Risque cards ──────────────────────────────────────────── */
.risque-card { border-radius: var(--radius); border: none; box-shadow: var(--shadow); transition: transform .15s; overflow: hidden; }
.risque-card:hover { transform: translateY(-2px); }
.risque-card .niveau-band { height: 5px; }
.risque-card.niveau-Inacceptable .niveau-band { background: #dc3545; }
.risque-card.niveau-Élevé .niveau-band         { background: #fd7e14; }
.risque-card.niveau-Modéré .niveau-band         { background: #0dcaf0; }
.risque-card.niveau-Faible .niveau-band         { background: #198754; }

.score-bar { height: 6px; border-radius: 3px; background: #dee2e6; overflow: hidden; }
.score-bar-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width .5s ease;
}

/* ── Stats ─────────────────────────────────────────────────── */
.stat-card { border-radius: var(--radius); text-align: center; padding: 1.25rem; color: white; box-shadow: var(--shadow); }
.stat-card.inacceptable { background: linear-gradient(135deg,#dc3545,#b02a37); }
.stat-card.eleve        { background: linear-gradient(135deg,#fd7e14,#dc6c02); }
.stat-card.modere       { background: linear-gradient(135deg,#0dcaf0,#0aa2c0); }
.stat-card.faible       { background: linear-gradient(135deg,#198754,#146c43); }

/* ── Domaine ───────────────────────────────────────────────── */
.domaine-pill { font-size: .7rem; padding: .2rem .55rem; border-radius: 12px; background: #e9ecef; color: var(--primary); font-weight: 600; }

/* ── Mesures ───────────────────────────────────────────────── */
.mesures-block { background: #f8f9fc; border-radius: 8px; padding: 1rem 1.25rem; }
.mesures-block ol { padding-left: 1.2rem; margin: 0; }
.mesures-block li { margin-bottom: .35rem; font-size: .88rem; }

/* ── RACI table ────────────────────────────────────────────── */
.raci-cell {
  display: inline-block; width: 26px; height: 26px; line-height: 26px;
  border-radius: 6px; font-weight: 700; font-size: .8rem; text-align: center;
}
.raci-r { background: #dc3545; color: white; }
.raci-a { background: #1a3a6b; color: white; }
.raci-c { background: #fd7e14; color: white; }
.raci-i { background: #dee2e6; color: #495057; }

.raci-legend span { display: inline-block; width: 22px; height: 22px; line-height: 22px; border-radius: 5px; font-weight: 700; font-size: .75rem; text-align: center; }

/* ── Propriétaire badge ────────────────────────────────────── */
.proprietaire-card {
  border-radius: 8px; padding: .75rem 1rem;
  background: white; box-shadow: var(--shadow);
  border-left: 4px solid var(--primary-light);
}

/* ── Table admin ───────────────────────────────────────────── */
.table th { background: var(--primary); color: white; font-weight: 500; font-size: .85rem; }
.table-hover tbody tr:hover { background: #eef4fb; }

/* ── Filter bar ────────────────────────────────────────────── */
.filter-bar { background: white; border-radius: var(--radius); padding: .75rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }

/* ── Footer ────────────────────────────────────────────────── */
.footer-custom { background: white; border-top: 1px solid #dee2e6; margin-top: auto; }

/* ── Vue propriétaire — ligne exclue ──────────────────────── */
.proprio-row-exclu {
  opacity: .55;
  background: #fff5f5 !important;
}
.proprio-row-exclu .proprio-risk-nom {
  text-decoration: line-through;
  color: #6c757d;
}

/* ── Risque exclu (carte) ──────────────────────────────────── */
.risque-exclu {
  opacity: .5;
  filter: grayscale(.6);
}
.risque-exclu .risque-nom {
  text-decoration: line-through;
  color: #6c757d;
}
.exclusion-zone {
  border-top: 1px dashed #dee2e6;
  background: #fafafa;
  transition: background .2s;
}
.exclusion-zone.exclu-active {
  background: #fff5f5;
  border-top: 2px solid #dc3545;
}
/* Textarea invalide */
.justif-text.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 .2rem rgba(220,53,69,.15);
}
.invalid-feedback { font-size: .8rem; }

/* ── Tri de colonnes ───────────────────────────────────────── */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { background: rgba(255,255,255,.15) !important; }
th.sortable .sort-icon { font-size: .7rem; vertical-align: middle; margin-left: 4px; }

/* ── Synthèse / chart ──────────────────────────────────────── */
.stat-exclus { font-size: .75rem; opacity: .85; }
#syntheseBlock .stat-card { transition: opacity .3s; }
#syntheseBlock .stat-card.dimmed { opacity: .45; }

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .navbar, .footer-custom, .no-print { display: none !important; }
  .risque-card { page-break-inside: avoid; break-inside: avoid; }
  .risque-exclu { display: none !important; }
  /* Forcer le camembert à s'imprimer */
  #syntheseBlock canvas { max-height: 220px !important; }
  body { background: white; }
}

/* ── Accordion ─────────────────────────────────────────────── */
.accordion-button:not(.collapsed) { background: #eef4fb; color: var(--primary); }
