:root {
  --navy: #1f2a44;
  --accent: #2e5c8a;
  --grey: #6b7280;
  --light: #edf1f6;
  --border: #e2e6ed;
  --red: #b42318;
  --green: #15803d;
  --amber: #b45309;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  margin: 0;
  background: #f7f8fa;
  color: #1a1a1a;
  line-height: 1.5;
  font-size: 14px;
}
header.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, #223354 100%);
  color: white;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
header.topbar a { color: white; text-decoration: none; font-weight: 600; }
header.topbar form { margin: 0; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-logo { height: 22px; width: auto; display: block; }
.topbar-brand-divider { width: 1px; height: 18px; background: rgba(255,255,255,0.25); }
.topbar-brand-label { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.82); letter-spacing: 0.01em; }
header.topbar button {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
header.topbar button:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.6); }
.topbar-org-select {
  display: inline-block;
  width: auto;
  margin-top: 0;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.4);
  background: var(--navy);
  color: white;
  font-size: 13px;
  transition: border-color 0.15s ease;
}
.topbar-org-select:hover { border-color: rgba(255,255,255,0.7); }
.topbar-org-select:focus { box-shadow: none; border-color: rgba(255,255,255,0.7); }
main { max-width: 1080px; margin: 24px auto; padding: 0 20px; }
.card {
  background: white;
  border-radius: 12px;
  padding: 22px 26px;
  box-shadow: 0 1px 2px rgba(16,24,40,0.04), 0 4px 12px rgba(16,24,40,0.06);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  transition: box-shadow 0.15s ease;
}
h1 { color: var(--navy); font-size: 22px; margin: 0 0 4px 0; letter-spacing: -0.01em; }
h2 { color: var(--accent); font-size: 16px; margin: 0 0 14px 0; font-weight: 700; }
p { line-height: 1.55; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--light); font-size: 13.5px; vertical-align: top; }
th { color: var(--grey); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: #fafbfc; }
/* IDs et hash dans une cellule de tableau : jamais de retour à la ligne
   caractère par caractère (word-break: break-all hérité de .mono) — l'ID
   passe en défilement horizontal du tableau plutôt que d'être haché. */
td.mono, th.mono { white-space: nowrap; word-break: normal; }
a.row-link { color: var(--navy); text-decoration: none; font-weight: 500; }
a.row-link:hover { text-decoration: underline; }
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-proceed { background: #dcfce7; color: var(--green); }
.badge-edd { background: #fef3c7; color: var(--amber); }
.badge-escalate { background: #fee2e2; color: var(--red); }
.badge-decline { background: #fee2e2; color: var(--red); }
.badge-pending { background: #fef3c7; color: var(--amber); }
.badge-neutral { background: #e5e7eb; color: var(--grey); }
.search-box {
  padding: 8px 12px;
  margin-top: 0;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  width: 280px;
  font-size: 14px;
}
input, select, textarea {
  font-family: inherit;
}
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  display: block;
  width: 100%;
  padding: 9px 12px;
  margin-top: 6px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  color: #1a1a1a;
  background: white;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,92,138,0.14);
}
button, a.row-link, .badge { cursor: pointer; }

/* Formulaires — grille de champs + label unifié, pour éviter les inputs
   bruts (bords carrés, espacement au pixel près en inline style). */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
}
.form-grid label,
form > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 14px;
}
.form-grid label { margin-bottom: 0; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 400;
  color: #1a1a1a;
  margin-bottom: 10px;
}
.checkbox-row input[type="checkbox"] { width: auto; margin: 0; }

/* Bascule manuel / lien d'invitation — choix explicite en tête du formulaire d'onboarding. */
.mode-toggle {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}
.mode-toggle-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--grey);
  cursor: pointer;
  background: #fafbfc;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.mode-toggle-option input[type="radio"] { width: auto; margin: 0; accent-color: var(--accent); }
.mode-toggle-option.active {
  border-color: var(--accent);
  background: #eff6ff;
  color: var(--navy);
}
.banner-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 18px;
}
.banner-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a5f;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 18px;
}
.banner-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #78350f;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 18px;
}
.form-hint { font-size: 12px; font-weight: 400; color: var(--grey); }

.ubo-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  background: #fafbfc;
  position: relative;
}
.ubo-block .pep-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  font-size: 13.5px;
  font-weight: 500;
  color: #1a1a1a;
}
.ubo-block .pep-check input[type="checkbox"] { width: auto; margin: 0; }
.ubo-remove {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.btn-dashed {
  background: none;
  border: 1.5px dashed var(--accent);
  color: var(--accent);
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.btn-dashed:hover { background: rgba(46,92,138,0.07); }

/* Groupe d'action compact — select + note + bouton fondus en un seul
   contrôle au lieu de plusieurs éléments HTML bruts côte à côte. Réutilisé
   pour toutes les mini-actions inline du dashboard (statut document,
   résolution de hit, décision STR/SAR...). */
.action-group {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.action-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46,92,138,0.14);
}
.action-group select,
.action-group input[type="text"],
.action-group textarea {
  display: block;
  width: auto;
  margin-top: 0;
  border: none;
  border-radius: 0;
  outline: none;
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  background: transparent;
}
.action-group select:focus,
.action-group input[type="text"]:focus,
.action-group textarea:focus {
  box-shadow: none;
}
.action-group select {
  border-right: 1px solid var(--border);
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
  max-width: 170px;
  flex-shrink: 0;
}
.action-group input[type="text"] {
  width: 130px;
  color: #1a1a1a;
  border-right: 1px solid var(--border);
}
.action-group input[type="text"]::placeholder,
.action-group textarea::placeholder { color: #9ca3af; }
.action-group button {
  border: none;
  background: var(--light);
  color: var(--navy);
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.action-group button:hover { background: var(--navy); color: white; }

/* Variante pleine largeur — le champ (textarea le plus souvent) absorbe
   l'espace restant au lieu d'une largeur fixe (réponse questionnaire,
   justification STR/SAR). */
.action-group-wide {
  display: flex;
  width: 100%;
}
.action-group-wide textarea,
.action-group-wide input[type="text"] {
  flex: 1;
  resize: vertical;
  border-right: 1px solid var(--border);
}
.login-logo { height: 30px; display: block; margin-bottom: 14px; }
.portal-logo { height: 24px; display: block; margin-bottom: 18px; }
.login-wrap {
  max-width: 360px;
  margin: 80px auto;
}
.login-wrap .card {
  padding: 32px 28px;
}
.login-wrap input {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}
.login-wrap button {
  width: 100%;
  padding: 10px;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease;
}
.login-wrap button:hover { background: #16213a; }
.error { color: var(--red); font-size: 13px; margin-bottom: 12px; }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12px; color: var(--grey); word-break: break-all; }
.integrity-ok { color: var(--green); }
.integrity-bad { color: var(--red); font-weight: 700; }
.audit-line { font-family: "SF Mono", Consolas, monospace; font-size: 12px; padding: 4px 0; border-bottom: 1px dotted #eee; line-height: 1.5; }

.status-panel { border-radius: 10px; padding: 16px 20px; margin-bottom: 18px; border-left: 5px solid; box-shadow: 0 1px 3px rgba(16,24,40,0.06); }
.status-panel-title { margin: 0 0 8px 0; font-weight: 700; font-size: 15px; }
.status-panel-line { margin: 0; font-size: 13px; }
.status-panel-list { margin: 0; padding-left: 0; list-style: none; }
.status-panel-list li { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; font-size: 13px; }
.status-panel-list a { color: inherit; font-weight: 600; text-decoration: underline; }
.status-panel.state-blocked { background: #fef2f2; border-color: var(--red); color: #7f1d1d; }
.status-panel.state-decision { background: #eff6ff; border-color: var(--accent); color: #1e3a5f; }
.status-panel.state-ok { background: #f0fdf4; border-color: var(--green); color: #14532d; }
.status-panel.state-closed { background: var(--light); border-color: var(--navy); color: var(--navy); }
.status-panel.state-followup { background: #fef3c7; border-color: var(--amber); color: #78350f; }

/* Fix 10 — Cartes d'actions correctives (remédiation) */
.remediation-section { margin-top: 16px; border-top: 1px solid rgba(0,0,0,0.1); padding-top: 12px; }
.remediation-section-title { margin: 0 0 10px 0; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.7; }
.remediation-card { background: rgba(255,255,255,0.72); border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.remediation-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.remediation-card-icon { font-size: 16px; }
.remediation-card-action { font-size: 14px; }
.remediation-card-reason { margin: 0 0 8px 0; font-size: 12px; opacity: 0.85; white-space: pre-line; }
.remediation-card-docs { margin-bottom: 8px; font-size: 12px; }
.remediation-card-docs-title { font-weight: 600; }
.remediation-card-docs ul { margin: 4px 0 0 0; padding-left: 16px; }
.remediation-card-docs li { padding: 1px 0; }
.remediation-card-persons { font-size: 12px; margin-bottom: 8px; opacity: 0.85; }
.remediation-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.remediation-severity-high .remediation-card-action { color: var(--red, #b91c1c); }
.remediation-severity-medium .remediation-card-action { color: var(--amber, #92400e); }
.remediation-severity-low .remediation-card-action { color: var(--navy, #1e3a5f); }
.remediation-prefill-banner { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; color: #1e3a5f; }

/* Boutons unifiés — évite les CTA à styles inline divergents d'une vue à l'autre. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background: var(--navy);
  color: white;
  box-shadow: 0 1px 2px rgba(16,24,40,0.08);
}
.btn-primary:hover { background: #16213a; }
.btn-outline {
  background: white;
  color: var(--navy);
  border-color: var(--navy);
}
.btn-outline:hover { background: var(--light); }
