/* ============================================================
   KYC Client — Stylesheet
   ============================================================ */

:root {
  --primary:        #1a237e;
  --primary-light:  #3949ab;
  --primary-pale:   #e8eaf6;
  --danger:         #e53935;
  --danger-hover:   #c62828;
  --bg:             #f0f2f5;
  --white:          #ffffff;
  --border:         #e0e0e0;
  --text:           #1a1a2e;
  --text-muted:     #6b7280;
  --label:          #9e9e9e;
  --sidebar-width:  190px;
  --navbar-height:  56px;
  --footer-height:  56px;
  --radius:         8px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
}

/* ─── Reset & base ─── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* ─── Navbar ─── */
.kyc-navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 1000;
  gap: 1.5rem;
}

.kyc-navbar .brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.kyc-navbar .brand span {
  color: var(--primary);
}

.kyc-navbar .nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.kyc-navbar .nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color .15s;
}

.kyc-navbar .nav-links a:hover { color: var(--primary); }

/* ─── Nav dropdown (sous-menus dans nav-links, même pattern que avatar) ─── */
.nav-links .nav-dropdown { position: relative; }

.nav-links .nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: .3rem;
  cursor: pointer;
  user-select: none;
}

.nav-links .nav-dropdown-toggle .nav-chevron {
  font-size: .6rem;
  transition: transform .2s;
  margin-top: 1px;
}

.nav-links .nav-dropdown.open .nav-chevron { transform: rotate(180deg); }

.nav-links .nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + .6rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  list-style: none;
  margin: 0;
  padding: .35rem 0;
  min-width: 170px;
  z-index: 2000;
  overflow: hidden;
}

.nav-links .nav-dropdown.open .nav-dropdown-menu { display: block; }

.nav-links .nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1rem;
  font-size: .85rem;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
  transition: background .12s, color .12s;
}

.nav-links .nav-dropdown-menu a i {
  font-size: .95rem;
  color: var(--text-muted);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.nav-links .nav-dropdown-menu a:hover { color: var(--primary); background: var(--primary-pale); }
.nav-links .nav-dropdown-menu a:hover i { color: var(--primary); }
.nav-links .nav-dropdown-menu a.active-sub { color: var(--primary); font-weight: 600; }
.nav-links .nav-dropdown-menu a.active-sub i { color: var(--primary); }

.kyc-navbar .nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kyc-navbar .btn-draft-nav {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: .25rem .5rem;
  border-radius: 4px;
  transition: color .15s, background .15s;
}

.kyc-navbar .btn-draft-nav:hover {
  color: var(--primary);
  background: var(--primary-pale);
}

.kyc-navbar .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── Sidebar ─── */
.kyc-sidebar {
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  bottom: var(--footer-height);
  width: var(--sidebar-width);
  background: var(--white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 900;
  padding: 1.25rem 0 1rem;
}

.sidebar-header {
  padding: 0 1rem 1.25rem;
}

.sidebar-header .section-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--primary);
  text-transform: uppercase;
}

.sidebar-header .section-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: .15rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

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

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.825rem;
  border-radius: 6px;
  margin: 0 .5rem;
  transition: background .15s, color .15s;
}

.sidebar-nav li a i {
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-nav li a:hover {
  background: var(--primary-pale);
  color: var(--primary);
}

.sidebar-nav li a.active {
  background: var(--primary);
  color: var(--white);
  font-weight: 500;
}

/* ─── Main content ─── */
.kyc-main {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  margin-bottom: var(--footer-height);
  padding: 2rem 2.5rem 2rem 2.5rem;
  min-height: calc(100vh - var(--navbar-height) - var(--footer-height));
  max-width: 900px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .35rem;
}

.page-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.875rem;
}

/* ─── Section blocks ─── */
.form-section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 .35rem;
}

.section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

/* ─── Cards (form containers) ─── */
.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

/* ─── Form elements ─── */
.field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--label);
  text-transform: uppercase;
  margin-bottom: .35rem;
}

.form-control,
.form-select {
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.875rem;
  color: var(--text);
  padding: .45rem .75rem;
  width: 100%;
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(57,73,171,.12);
  outline: none;
}

.form-control::placeholder { color: #bdbdbd; }

/* row gap inside cards */
.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.cols-1 { grid-template-columns: 1fr; }

/* ─── Radio type-client ─── */
.type-selector {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.type-option {
  display: flex;
  align-items: center;
  gap: .45rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text);
}

.type-option input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ─── Yes/No toggle buttons ─── */
.yn-group {
  display: flex;
  gap: .5rem;
}

.yn-btn {
  padding: .35rem 1rem;
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: 5px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
  font-weight: 500;
}

.yn-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.yn-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-pale);
}

/* ─── Inline question row ─── */
.question-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.question-row .question-text {
  font-size: 0.875rem;
  color: var(--text);
}

.question-row .question-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

/* ─── Radio inline ─── */
.radio-group {
  display: flex;
  gap: 1.25rem;
  margin-top: .75rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ─── Checklist items ─── */
.checklist-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  cursor: pointer;
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item:hover { background: var(--bg); }

.checklist-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}

.checklist-item label {
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  margin: 0;
}

/* ─── Footer ─── */
.kyc-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--footer-height);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 1000;
}

.kyc-footer .footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.kyc-footer .footer-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .6rem;
}

/* ─── Menu d'export (pied de page) ─── */
/* Le bouton siège en bas de l'écran : le menu s'ouvre donc vers le haut. */
.export-dropdown { position: relative; display: inline-block; }
.export-menu {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + .4rem);
  min-width: 140px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  padding: .3rem;
  z-index: 900;
}
.export-dropdown.open .export-menu { display: block; }
/* En barre d'actions, en haut de page, le menu s'ouvre vers le bas. */
.export-dropdown.down .export-menu { top: calc(100% + .4rem); bottom: auto; }
.export-menu a {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .7rem;
  border-radius: 6px;
  font-size: .82rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.export-menu a:hover { background: var(--primary-pale); color: var(--primary); }

/* ─── Buttons ─── */
.btn-outline-secondary-kyc {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  border-radius: 5px;
  padding: .4rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
  text-decoration: none;
}

.btn-outline-secondary-kyc:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-primary-kyc {
  background: var(--primary);
  border: none;
  color: var(--white);
  border-radius: 5px;
  padding: .4rem 1.25rem;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  font-weight: 600;
}

.btn-primary-kyc:hover { background: var(--primary-light); }

/* ─── Textarea ─── */
textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* ─── Dynamic sections (hidden by default) ─── */
.conditional-section {
  display: none;
  margin-top: 1rem;
}

.conditional-section.visible {
  display: block;
}

/* ─── Avatar dropdown menu ─── */
.avatar-wrapper {
  position: relative;
}

.avatar {
  cursor: pointer;
  transition: opacity .15s;
}

.avatar:hover { opacity: .85; }

.avatar-dropdown {
  position: absolute;
  top: calc(100% + .6rem);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  min-width: 180px;
  z-index: 2000;
  display: none;
  overflow: hidden;
}

.avatar-dropdown.open { display: block; }

.dropdown-user {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.dropdown-user .du-name {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-user .du-role {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.dropdown-menu-list {
  list-style: none;
  margin: 0;
  padding: .35rem 0;
}

.dropdown-menu-list li a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1rem;
  font-size: .85rem;
  color: var(--text);
  text-decoration: none;
  transition: background .12s, color .12s;
}

.dropdown-menu-list li a i {
  font-size: .95rem;
  color: var(--text-muted);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.dropdown-menu-list li a:hover {
  background: var(--primary-pale);
  color: var(--primary);
}

.dropdown-menu-list li a:hover i { color: var(--primary); }

.dropdown-menu-list .separator {
  height: 1px;
  background: var(--border);
  margin: .35rem 0;
}

.dropdown-menu-list li.danger a { color: var(--danger); }
.dropdown-menu-list li.danger a i { color: var(--danger); }
.dropdown-menu-list li.danger a:hover { background: #ffebee; color: var(--danger); }

/* ─── Main without sidebar (list pages) ─── */
.kyc-main-full {
  margin-left: 0;
  margin-top: var(--navbar-height);
  margin-bottom: var(--footer-height);
  padding: 2rem 2.5rem;
  min-height: calc(100vh - var(--navbar-height) - var(--footer-height));
}

/* ─── Stat cards ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.stat-card .stat-icon.blue   { background: #e8eaf6; color: var(--primary); }
.stat-card .stat-icon.orange { background: #fff3e0; color: #e65100; }
.stat-card .stat-icon.green  { background: #e8f5e9; color: #2e7d32; }
.stat-card .stat-icon.red    { background: #ffebee; color: var(--danger); }

.stat-card .stat-body {}
.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* ─── Toolbar (search + filters) ─── */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 340px;
}

.search-box i {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: .95rem;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: .42rem .75rem .42rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.875rem;
  background: var(--white);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}

.search-box input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(57,73,171,.10);
  outline: none;
}

.search-box input::placeholder { color: #bdbdbd; }

.filter-select {
  padding: .42rem .75rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.875rem;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s;
}

.filter-select:focus {
  border-color: var(--primary-light);
  outline: none;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .6rem;
}

/* ─── Data table ─── */
.table-wrapper {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.kyc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.kyc-table thead {
  background: #fafafa;
  border-bottom: 1px solid var(--border);
}

.kyc-table thead th {
  padding: .7rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--label);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.kyc-table thead th i {
  font-size: .75rem;
  margin-left: .25rem;
  opacity: .45;
  transition: opacity .15s;
}

.kyc-table thead th:hover i { opacity: 1; }

.kyc-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.kyc-table tbody tr:last-child { border-bottom: none; }

.kyc-table tbody tr:hover { background: #fafbff; }

.kyc-table td {
  padding: .8rem 1rem;
  color: var(--text);
  vertical-align: middle;
}

.kyc-table td .cell-main {
  font-weight: 500;
  color: var(--text);
}

.kyc-table td .cell-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

/* Client type badge */
.badge-type {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-type.pp {
  background: #e8eaf6;
  color: var(--primary);
}

.badge-type.pm {
  background: #fff3e0;
  color: #e65100;
}

/* Status badge */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: .22rem .6rem;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-status.en-cours  { background: #e3f2fd; color: #0d47a1; }
.badge-status.valide    { background: #e8f5e9; color: #2e7d32; }
.badge-status.refuse    { background: #ffebee; color: var(--danger); }
.badge-status.brouillon { background: #f5f5f5; color: #616161; }

/* Risk badge */
.badge-risk {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 4px;
  white-space: nowrap;
}

.badge-risk.r1 { background: #e8f5e9; color: #2e7d32; }
.badge-risk.r2 { background: #fff3e0; color: #e65100; }
.badge-risk.r3 { background: #ffebee; color: var(--danger); }
.badge-risk.na { background: #f5f5f5; color: #9e9e9e; }

/* Row actions */
.row-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.btn-icon {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .95rem;
  transition: all .15s;
  text-decoration: none;
}

.btn-icon:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: var(--primary-pale);
}

.btn-icon.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: #ffebee;
}

/* ─── Pagination ─── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-info {}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.page-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: all .15s;
}

.page-btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

.page-btn:disabled {
  opacity: .4;
  cursor: default;
}

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  opacity: .3;
  display: block;
  margin-bottom: .75rem;
}

.empty-state p {
  margin: 0;
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════
   AUTH PAGES (signin, forgot-password)
   ═══════════════════════════════════════════════ */

.auth-body {
  min-height: 100vh;
  margin: 0;
  padding: 2rem 1rem;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

/* ─── Logo au-dessus de la carte ─── */
.auth-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
}

.auth-brand-icon {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.auth-brand-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.site-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
}

.site-logo-sm {
  height: 32px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* ─── Carte centrée ─── */
.auth-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 2px 24px rgba(0,0,0,.08);
  width: 100%;
  max-width: 490px;
  padding: 2.5rem 2.25rem 2rem;
}

/* ─── En-tête de carte (icône + titre + desc) ─── */
.auth-card-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-step-icon {
  width: 52px;
  height: 52px;
  background: var(--primary-pale);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.3rem;
  margin: 0 auto 1.1rem;
}

.auth-card-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .5rem;
}

.auth-card-header p {
  font-size: .875rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ─── Formulaire ─── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.auth-field .field-label { margin: 0; }

.auth-field .field-error {
  display: none;
  font-size: .78rem;
  color: var(--danger);
  margin-top: .15rem;
}
.auth-field .field-error.visible { display: flex; align-items: center; gap: .3rem; }
.auth-field .input-wrapper.has-error .form-control { border-color: var(--danger); }

/* Input avec icône à gauche */
.input-wrapper {
  position: relative;
}

.input-wrapper .input-icon {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.input-wrapper .form-control {
  padding-left: 2.4rem;
  border-radius: 8px;
}

/* Input mot de passe avec toggle */
.input-wrapper .toggle-password {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  transition: color .15s;
}

.input-wrapper .toggle-password:hover { color: var(--primary); }
.input-wrapper .form-control.has-toggle { padding-right: 2.4rem; }

/* ─── Toggle switch (afficher mot de passe) ─── */
.toggle-switch-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .875rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  transition: background .2s;
  cursor: pointer;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle-switch input:checked + .toggle-track { background: var(--primary); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(16px); }

/* ─── Bouton principal ─── */
.btn-auth {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  text-decoration: none;
  margin-top: .25rem;
}

.btn-auth:hover  { background: var(--primary-light); }
.btn-auth:active { transform: scale(.98); }

/* ─── Lien retour / secondaire ─── */
.auth-back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  margin-top: 1rem;
  font-size: .875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s;
}

.auth-back-link:hover { color: var(--primary); }

/* ─── Lien "mot de passe oublié" ─── */
.forgot-link {
  font-size: .85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}

.forgot-link:hover { color: var(--primary-light); text-decoration: underline; }

/* ─── Auth alert ─── */
.auth-alert {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: var(--danger);
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .25rem;
}

.auth-alert.hidden { display: none; }

/* ─── Success state (forgot-password) ─── */
.auth-success {
  display: none;
  text-align: center;
}

.auth-success .success-icon {
  width: 56px;
  height: 56px;
  background: var(--primary-pale);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.5rem;
  margin: 0 auto 1.1rem;
}

.auth-success h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .5rem;
}

.auth-success p {
  color: var(--text-muted);
  font-size: .875rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

/* ─── Spinner ─── */
@keyframes auth-spin { to { transform: rotate(360deg); } }

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
  flex-shrink: 0;
}

/* ─── Pages d'erreur ─── */
.error-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 3rem 2.5rem 2.5rem;
  width: 100%; max-width: 400px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}

.error-label {
  font-size: .82rem; font-weight: 500;
  color: var(--text-muted);
  letter-spacing: .04em; text-transform: uppercase;
}

.error-code {
  font-size: 6.5rem; font-weight: 800; line-height: 1;
  color: var(--primary);
  letter-spacing: -.04em;
}

.error-divider {
  width: 48px; height: 3px;
  background: var(--primary-pale);
  border-radius: 2px;
}

.error-message { font-size: .9rem; color: var(--text-muted); line-height: 1.5; }

.btn-home {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  margin-top: .75rem; width: 100%;
  padding: .7rem 1.25rem;
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  font-size: .9rem; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: background .15s;
}
.btn-home:hover { background: var(--primary-light); }

/* ─── Pagination ─── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: .8rem;
  color: var(--text-muted);
}

.pagination-nav {
  display: flex;
  align-items: center;
  gap: .3rem;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 .5rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}

.page-btn:hover { background: var(--primary-pale); color: var(--primary); border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); cursor: default; }
.page-btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ─── Responsive ─── */
/* ═══════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════ */

/* ─── Mobile nav menu (pages sans sidebar) ─── */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  z-index: 950;
  padding: .5rem 0;
}

.mobile-nav.open { display: block; }

.mobile-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1.25rem;
  font-size: .9rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}

.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover { background: var(--primary-pale); color: var(--primary); }
.mobile-nav a.active { color: var(--primary); font-weight: 600; }

.mobile-nav-section-label {
  padding: .5rem 1.25rem .25rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

/* ─── Hamburger (visible mobile only) ─── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background .15s;
}

.hamburger:hover { background: var(--primary-pale); }

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s, opacity .25s, width .25s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Sidebar overlay ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 850;
}

.sidebar-overlay.visible { display: block; }

/* ─── Table scroll wrapper ─── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ══════════════ TABLET  ≤ 1024px ══════════════ */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .kyc-table thead th:nth-child(4),
  .kyc-table td:nth-child(4) { display: none; }
}

/* ══════════════ MOBILE  ≤ 768px ══════════════ */
@media (max-width: 768px) {

  /* Variables */
  :root {
    --sidebar-width: 0px;
    --navbar-height: 52px;
    --footer-height: 60px;
  }

  /* ── Navbar ── */
  .hamburger { display: flex; }

  .kyc-navbar .nav-links { display: none; }

  .kyc-navbar .btn-draft-nav span,
  .kyc-navbar .btn-draft-nav .bi-floppy ~ * { display: none; }

  /* Shrink "Nouveau dossier" to icon only */
  .kyc-navbar .btn-primary-kyc .btn-label { display: none; }

  /* ── Sidebar ── */
  .kyc-sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 240px;
    z-index: 900;
  }

  .kyc-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.18);
  }

  /* ── Main ── */
  .kyc-main {
    margin-left: 0;
    padding: 1rem;
  }

  .kyc-main-full { padding: 1rem; }

  /* ── Page header ── */
  .page-header { margin-bottom: 1.25rem; }
  .page-header h1 { font-size: 1.3rem; }

  /* ── Forms ── */
  .form-grid.cols-4,
  .form-grid.cols-3,
  .form-grid.cols-2 { grid-template-columns: 1fr; }

  .question-row { flex-direction: column; align-items: flex-start; gap: .6rem; }

  /* ── Stats ── */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: .65rem; }
  .stat-card .stat-value { font-size: 1.25rem; }

  /* ── Toolbar ── */
  .list-toolbar { gap: .5rem; }
  .search-box { max-width: 100%; flex: 1 1 100%; }
  .filter-select { flex: 1; }
  .toolbar-right { width: 100%; justify-content: flex-end; }

  /* ── Table ── */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
  .kyc-table { min-width: 580px; }

  /* ── Sidebar form pages : footer buttons wrap ── */
  .kyc-footer .footer-actions a,
  .kyc-footer .footer-actions button { flex-shrink: 0; }

  .kyc-table thead th:nth-child(3),
  .kyc-table td:nth-child(3),
  .kyc-table thead th:nth-child(4),
  .kyc-table td:nth-child(4) { display: none; }

  /* ── Footer ── */
  .kyc-footer {
    height: auto;
    min-height: var(--footer-height);
    flex-wrap: wrap;
    gap: .5rem;
    padding: .65rem 1rem;
  }

  .kyc-footer .footer-copy { font-size: .7rem; }

  .kyc-footer .footer-actions { gap: .4rem; flex-wrap: wrap; }

  .footer-actions .btn-outline-secondary-kyc,
  .footer-actions .btn-primary-kyc {
    padding: .38rem .75rem;
    font-size: .8rem;
  }

  /* ── Pagination ── */
  .pagination-bar { flex-direction: column; gap: .5rem; align-items: center; padding: .65rem .75rem; }

  /* ── Dropdown ── */
  .avatar-dropdown { right: 0; min-width: 170px; }

  /* ── Profile two-col layout ── */
  .profile-grid { grid-template-columns: 1fr !important; }

  /* ── Agence grid ── */
  #agenceGrid { grid-template-columns: 1fr !important; }

  /* ── Auth ── */
  .auth-card { padding: 2rem 1.25rem 1.75rem; max-width: 100%; margin: 0 .75rem; }
  .auth-body { padding: 1.25rem .5rem; }
}

/* ══════════════ SMALL MOBILE  ≤ 480px ══════════════ */
@media (max-width: 480px) {

  .stat-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .stat-card { padding: .85rem 1rem; }
  .stat-card .stat-icon { width: 34px; height: 34px; font-size: .95rem; }
  .stat-card .stat-value { font-size: 1.1rem; }

  .kyc-footer .footer-copy { display: none; }

  .page-header h1 { font-size: 1.15rem; }

  .kyc-table { min-width: 520px; }

  /* Show only essential table columns */
  .kyc-table thead th:nth-child(5),
  .kyc-table td:nth-child(5) { display: none; }

  .auth-card { padding: 1.75rem 1rem 1.5rem; }

  #agenceGrid { grid-template-columns: 1fr !important; }
}

/* ─── Shared list helpers ─── */
.btn-danger-kyc {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; background: var(--danger); color: #fff;
  border: none; border-radius: 8px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.btn-danger-kyc:hover { background: #b71c1c; }

#deleteOverlay[style*="flex"],
#createOverlay[style*="flex"] { display: flex !important; }

.priority-badge, .status-badge {
  padding: .2rem .6rem; border-radius: 4px; font-size: .75rem; font-weight: 600; display: inline-block;
}
.priority-low { background: #e8f5e9; color: #2e7d32; }
.priority-medium { background: #fff8e1; color: #f57f17; }
.priority-high { background: #fff3e0; color: #e65100; }
.priority-critical { background: #ffebee; color: #c62828; }
/* Le cycle d'une alerte : Alerte → Analyse → Décision. La couleur suit
   l'attente qu'elle appelle — à prendre, en cours, en suspens, tranchée. */
.status-nouvelle { background: #fff3e0; color: #e65100; }
.status-en_analyse { background: #e3f2fd; color: #1565c0; }
.status-en_attente_info { background: #f3e5f5; color: #6a1b9a; }
.status-cloturee { background: #f5f5f5; color: #616161; }

/* ─── Select2 ─── */
.select2-container--default .select2-selection--single {
  height:38px; border-color:var(--border); border-radius:6px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height:36px; padding-left:.75rem; font-size:.85rem;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height:36px;
}
.select2-dropdown { border-color:var(--border); font-size:.85rem; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color:var(--primary);
}
.select2-container--default .select2-search--dropdown .select2-search__field {
  border-color:var(--border); outline:none; font-size:.85rem;
}
.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color:var(--primary);
}

/* ─── Form card overrides (compact 32px) ─── */
.form-card .form-control {
  height: 32px;
  padding: .35rem .75rem;
  box-sizing: border-box;
}
.form-card textarea.form-control {
  height: auto;
}
.form-card .select2-container {
  height: 32px !important;
}
.form-card .select2-container .select2-selection--single {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 5px;
}
.form-card .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 30px;
  padding-left: 12px;
}
.form-card .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 30px;
}
.form-card .form-control.is-invalid,
.form-card .select2-container.is-invalid .select2-selection--single {
  border-color: var(--danger) !important;
}

/* ─── Field error ─── */
.field-error {
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-top: .25rem;
  font-size: .78rem;
  color: var(--danger);
}
.field-error i {
  font-size: .78rem;
}

/* ─── Auth alert variants ─── */
.auth-alert.error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  color: var(--danger);
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.5rem;
}
.auth-alert.success {
  background: #e8f5e9;
  border: 1px solid #c8e6c9;
  color: #2e7d32;
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SÉLECTEUR D'APPLICATIONS
   Reprend le motif des cartes des pages de liste (cf. list-agence) :
   barre d'accent colorée, icône, badge d'état, puis pied séparé.
   ═══════════════════════════════════════════════════════════════════════════ */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.app-card {
  position: relative;
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.app-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 6px 18px rgba(26, 35, 126, .12);
  transform: translateY(-2px);
}
.app-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.app-card-accent {
  display: block;
  height: 6px;
}

.app-card-inner {
  padding: 1.25rem;
}

.app-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .85rem;
}

.app-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.app-card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.app-card-desc {
  font-size: .8rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* Aperçu des sections de l'application */
.app-card-modules {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .85rem;
}
.app-module-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .5rem;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: .72rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.app-module-chip i { font-size: .7rem; }
.app-module-chip.more { font-weight: 600; color: var(--primary); }

.app-card-foot {
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.app-card-meta {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.app-card-open {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--primary);
  transition: gap .15s ease;
}
.app-card:hover .app-card-open { gap: .6rem; }

@media (max-width: 768px) {
  .app-grid { grid-template-columns: 1fr; }
}
