/* ============================================================
   Code & Compétences — Espace Formation
   Style.css v2.1 — Interface professionnelle + correctifs mobile
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --primary:      #1B4332;
  --primary-l:    #2D6A4F;
  --primary-ll:   #40916C;
  --accent:       #52B788;
  --accent-l:     #95D5B2;
  --gold:         #B5883A;
  --gold-l:       #D4A853;
  --bg:           #F5F4F0;
  --bg-card:      #FFFFFF;
  --bg-nav:       #162D24;
  --border:       #E2DDD6;
  --border-l:     #EDE9E3;
  --text:         #18171A;
  --text-2:       #3D3B40;
  --muted:        #7A7875;
  --danger:       #DC2626;
  --danger-bg:    #FEF2F2;
  --success:      #16A34A;
  --success-bg:   #F0FDF4;
  --warning:      #D97706;
  --warning-bg:   #FFFBEB;
  --info:         #2563EB;
  --info-bg:      #EFF6FF;
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.1), 0 4px 12px rgba(0,0,0,.06);
  --font:         'Inter', 'Segoe UI', Arial, sans-serif;
  --nav-h:        64px;
  --sidebar-w:    240px;
  --transition:   .18s ease;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 15px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6;
       -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--primary-l); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── NAVIGATION ───────────────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 200;
  background: var(--bg-nav);
  height: var(--nav-h);
  box-shadow: 0 1px 0 rgba(255,255,255,.05), 0 4px 20px rgba(0,0,0,.25);
}
.topnav-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 1.5rem;
  height: 100%; display: flex; align-items: center; gap: 0;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  color: #fff; text-decoration: none; flex-shrink: 0;
  padding-right: 1.5rem; border-right: 1px solid rgba(255,255,255,.1);
  margin-right: 1rem;
}
.brand:hover { text-decoration: none; opacity: .9; }
.brand-icon { font-size: 1.4rem; color: var(--accent); }
.brand-name { font-weight: 800; font-size: .95rem; color: #fff; letter-spacing: -.3px; }
.brand-sub {
  font-size: .68rem; color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.08); padding: 2px 8px; border-radius: 20px;
  font-weight: 500; letter-spacing: .02em;
}

.nav-links { display: flex; list-style: none; gap: 2px; flex: 1; }
.nav-links li a {
  display: flex; align-items: center; gap: .35rem;
  color: rgba(255,255,255,.65); padding: .45rem .875rem;
  border-radius: var(--radius-sm); font-size: .825rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-links li a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-links li a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.nav-links .sep { color: rgba(255,255,255,.15); padding: 0 .25rem; }
.btn-admin {
  background: linear-gradient(135deg, var(--gold), var(--gold-l)) !important;
  color: #fff !important; font-weight: 600 !important;
}
.btn-admin:hover { opacity: .9; }

.badge-dot {
  display: inline-flex; align-items: center; justify-content: center;
  background: #EF4444; color: #fff; border-radius: 50%;
  width: 17px; height: 17px; font-size: .65rem; font-weight: 700; margin-left: 3px;
  box-shadow: 0 0 0 2px rgba(239,68,68,.25);
}

.nav-user { display: flex; align-items: center; gap: .5rem; margin-left: auto; padding-left: 1rem; }
.user-name {
  color: rgba(255,255,255,.8); font-size: .825rem; font-weight: 500;
  display: flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem; border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.user-name:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.user-name.active { background: rgba(255,255,255,.14); color: #fff; }
.btn-logout {
  color: rgba(255,255,255,.55); font-size: .775rem; font-weight: 500;
  border: 1px solid rgba(255,255,255,.15); padding: .35rem .75rem;
  border-radius: var(--radius-sm); transition: all var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }

/* ── LAYOUT PRINCIPAL ─────────────────────────────────────── */
.main-content { min-height: calc(100vh - var(--nav-h) - 52px); }
.container { max-width: 1300px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── FOOTER ───────────────────────────────────────────────── */
.footer {
  background: var(--bg-nav); color: rgba(255,255,255,.4);
  font-size: .775rem; padding: .875rem 1.5rem;
}
.footer-inner { max-width: 1300px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.footer a { color: rgba(255,255,255,.6); }
.footer a:hover { color: var(--accent); }

/* ── PAGE HEADER ──────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem; padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--primary); letter-spacing: -.4px; }
.page-header p { color: var(--muted); margin-top: .2rem; font-size: .875rem; }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-l);
  margin-bottom: 1.25rem; overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
/* Card contenant un <select> : le dropdown ne doit pas être clippé */
.card-select { overflow: visible; }
.card-select > .card-header { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.card-select > .card-body { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-l);
  background: linear-gradient(to bottom, #FDFCFB, var(--bg-card));
}
.card-header h2 { font-size: .95rem; font-weight: 700; color: var(--primary); }
.card-link { font-size: .8rem; color: var(--primary-ll); font-weight: 500; }
.card-link:hover { color: var(--primary); }
.card-body { padding: 1.5rem; }

/* ── STATS GRID ───────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1rem; margin-bottom: 1.75rem;
}
.stats-grid-5 { grid-template-columns: repeat(5, 1fr); }
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-l);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(to right, var(--primary-l), var(--accent));
}
.stat-card.stat-alert::before { background: linear-gradient(to right, var(--danger), #F87171); }
.stat-card.stat-alert { border-color: #FECACA; }
.stat-card.stat-primary::before { background: linear-gradient(to right, var(--primary-ll), var(--accent)); }
.stat-card.stat-primary { border-color: var(--accent-l); }
.stat-icon { font-size: 1.6rem; margin-bottom: .5rem; }
.stat-value { font-size: 2.25rem; font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -1px; }
.stat-label { font-size: .775rem; color: var(--muted); margin-top: .3rem; font-weight: 500; }
.stat-link { display: inline-block; font-size: .775rem; color: var(--primary-ll); margin-top: .5rem; font-weight: 600; }
.stat-link:hover { color: var(--primary); }

/* ── DASHBOARD GRID ───────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

/* ── FORMATION ITEMS ──────────────────────────────────────── */
.formation-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 0; border-bottom: 1px solid var(--border-l); gap: 1rem;
}
.formation-item:last-child { border-bottom: none; }
.formation-info { display: flex; flex-direction: column; gap: .2rem; }
.formation-info strong { font-size: .9rem; font-weight: 600; color: var(--text); }

/* ── SESSION ITEMS ────────────────────────────────────────── */
.session-item { display: flex; align-items: center; gap: 1rem; padding: .875rem 0; border-bottom: 1px solid var(--border-l); }
.session-item:last-child { border-bottom: none; }
.session-date {
  text-align: center; background: var(--primary); color: #fff;
  border-radius: var(--radius-sm); padding: .5rem .75rem; min-width: 52px;
  box-shadow: var(--shadow-sm);
}
.date-day { display: block; font-size: 1.4rem; font-weight: 800; line-height: 1; }
.date-month { display: block; font-size: .62rem; text-transform: uppercase; opacity: .75; font-weight: 600; letter-spacing: .06em; }
.session-info { display: flex; flex-direction: column; gap: .15rem; }
.session-info strong { font-size: .875rem; font-weight: 600; }

/* ── SESSION CARDS (émargement) ───────────────────────────── */
.session-card { margin-bottom: 1rem; }
.session-card.signed { border-left: 4px solid var(--success); }
.session-card.to-sign { border-left: 4px solid var(--warning); }
.session-card.upcoming { border-left: 4px solid var(--border); opacity: .75; }
.session-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.5rem; }
.session-title { font-weight: 700; font-size: .95rem; color: var(--primary); }
.session-meta { font-size: .825rem; margin-top: .3rem; color: var(--muted); }
.signature-zone { padding: 1.25rem 1.5rem; border-top: 1px solid var(--border-l); background: #FDFCFB; }
.sig-instructions { font-size: .825rem; color: var(--muted); margin-bottom: .875rem; }
.sig-canvas {
  border: 2px dashed var(--border); border-radius: var(--radius);
  background: #fff; cursor: crosshair; width: 100%; max-width: 600px;
  display: block; touch-action: none; transition: border-color var(--transition);
}
.sig-canvas:active { border-color: var(--primary-l); }
.sig-actions { display: flex; gap: .5rem; margin-top: .875rem; }

/* ── DOCUMENT ITEMS ───────────────────────────────────────── */
.doc-item { display: flex; align-items: center; gap: .875rem; padding: .625rem 0; border-bottom: 1px solid var(--border-l); }
.doc-item:last-child { border-bottom: none; }
.doc-type { font-size: .8rem; min-width: 140px; }
.doc-name { flex: 1; font-size: .875rem; font-weight: 500; }
.doc-name:hover { color: var(--primary); }
.doc-size { font-size: .775rem; }
.pdf-viewer-wrap { height: 600px; padding: 0; }
.pdf-viewer { width: 100%; height: 100%; border: none; }

/* ── MESSAGES ─────────────────────────────────────────────── */
.messages-list { border-top: 1px solid var(--border-l); }
.message-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-l);
  transition: background var(--transition); cursor: pointer;
}
.message-row:hover { background: var(--bg); text-decoration: none; }
.msg-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-l), var(--accent));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem; flex-shrink: 0; letter-spacing: -.5px;
}
.msg-content { flex: 1; min-width: 0; }
.msg-header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .2rem; }
.msg-header strong { font-size: .875rem; font-weight: 600; }
.msg-preview { font-size: .825rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.msg-count { background: var(--primary); color: #fff; border-radius: 20px; padding: .2rem .55rem; font-size: .725rem; font-weight: 700; }

.message-bubble { max-width: 78%; margin-bottom: 1rem; }
.bubble-me { margin-left: auto; }
.bubble-other { margin-right: auto; }
.bubble-meta { font-size: .775rem; color: var(--muted); margin-bottom: .3rem; display: flex; align-items: center; gap: .4rem; }
.bubble-content {
  padding: .875rem 1.125rem; border-radius: var(--radius-lg);
  background: var(--bg); border: 1px solid var(--border-l);
  font-size: .875rem; line-height: 1.6;
}
.bubble-me .bubble-content {
  background: linear-gradient(135deg, var(--primary), var(--primary-l));
  color: #fff; border-color: transparent;
}
.reply-form { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border-l); }
.collapse { display: none; }
.collapse.open { display: block; }

/* ── SATISFACTION ─────────────────────────────────────────── */
.sat-section { margin-bottom: 2rem; }
.sat-section h3 { font-size: .95rem; color: var(--primary); font-weight: 700; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--accent-l); }
.sat-grid-header { display: grid; grid-template-columns: 1fr repeat(5, 52px); gap: .5rem; padding: .5rem 0; font-size: .775rem; font-weight: 700; color: var(--muted); }
.sat-row { display: grid; grid-template-columns: 1fr repeat(5, 52px); gap: .5rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--border-l); }
.sat-row label { font-size: .85rem; }
.rating-label { text-align: center; }
.rating-stars { display: contents; }
.star-label { display: flex; justify-content: center; cursor: pointer; }
.star-label input { position: absolute; opacity: 0; width: 0; height: 0; }
.star { font-size: 1.75rem; color: var(--border); transition: color var(--transition), transform var(--transition); }
.star-label:hover .star { transform: scale(1.1); }
.star-active, .star-label:hover .star { color: var(--gold); }
.star-label input:checked ~ .star { color: var(--gold); }

/* ── ADMIN MENU ───────────────────────────────────────────── */
.admin-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.75rem; }
.admin-card {
  background: var(--bg-card); border: 1px solid var(--border-l); border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: .4rem;
  transition: all var(--transition); box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.admin-card::after {
  content: '→'; position: absolute; right: 1.25rem; top: 50%; transform: translateY(-50%);
  color: var(--border); font-size: 1.25rem; transition: all var(--transition);
}
.admin-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent-l); text-decoration: none; }
.admin-card:hover::after { color: var(--primary-ll); right: 1rem; }
.admin-card-alert { border-color: #FECACA; background: var(--danger-bg); }
.admin-icon { font-size: 1.75rem; margin-bottom: .25rem; }
.admin-title { font-weight: 700; color: var(--primary); font-size: .95rem; }
.admin-desc { font-size: .775rem; color: var(--muted); line-height: 1.4; }

/* ── ACTIONS RAPIDES ──────────────────────────────────────── */
.card-actions .card-body { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 1.125rem; border: 1.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg); transition: all var(--transition); font-size: .825rem;
  color: var(--text); font-weight: 500; text-align: center;
}
.action-btn:hover {
  background: var(--primary); color: #fff; text-decoration: none;
  border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm);
}
.action-btn span:first-child { font-size: 1.5rem; }

/* ── TABLEAUX ─────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.table th {
  background: var(--bg); color: var(--muted); font-weight: 700;
  padding: .75rem 1rem; text-align: left;
  border-bottom: 2px solid var(--border); font-size: .775rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--border-l); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover td { background: #FAFAF8; }
.table-sm th, .table-sm td { padding: .55rem .875rem; }
.row-disabled { opacity: .45; }
.td-actions { display: flex; gap: .35rem; white-space: nowrap; flex-wrap: wrap; }
.text-center { text-align: center; }

/* ── FORMULAIRES ──────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.form-group label { font-weight: 600; font-size: .825rem; color: var(--text-2); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: .6rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .875rem; font-family: var(--font); background: #fff; color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary-ll);
  box-shadow: 0 0 0 3px rgba(64,145,108,.12);
}
.form-group input:disabled,
.form-group input[disabled] {
  background: var(--bg); color: var(--muted); cursor: not-allowed;
}
.form-group textarea { resize: vertical; min-height: 88px; }
.form-hint { font-size: .775rem; color: var(--muted); }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.form-group-full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: .5rem; padding-top: .75rem; border-top: 1px solid var(--border-l); }

/* ── BOUTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .575rem 1.125rem; border-radius: var(--radius-sm); border: 1.5px solid transparent;
  cursor: pointer; font-size: .85rem; font-weight: 600; font-family: var(--font);
  transition: all var(--transition); text-decoration: none; white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary-l), var(--primary));
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(27,67,50,.25);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--primary), #122E22); box-shadow: 0 4px 16px rgba(27,67,50,.3); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--primary-l); border-color: var(--primary-l); }
.btn-outline:hover { background: var(--primary-l); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; box-shadow: 0 2px 8px rgba(220,38,38,.2); }
.btn-danger:hover { background: #B91C1C; transform: translateY(-1px); }
.btn-success { background: var(--success); color: #fff; border-color: transparent; }
.btn-success:hover { background: #15803D; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-l)); color: #fff; border-color: transparent; }
.btn-sm { padding: .4rem .825rem; font-size: .8rem; }
.btn-xs { padding: .275rem .625rem; font-size: .75rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .75rem 1.625rem; font-size: .95rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: .2rem .65rem;
  border-radius: 20px; font-size: .725rem; font-weight: 700;
  background: var(--bg); color: var(--muted); border: 1px solid var(--border);
  letter-spacing: .02em;
}
.badge-success { background: var(--success-bg); color: #166534; border-color: #86EFAC; }
.badge-danger  { background: var(--danger-bg);  color: #991B1B; border-color: #FCA5A5; }
.badge-warning { background: var(--warning-bg); color: #92400E; border-color: #FCD34D; }
.badge-primary { background: var(--info-bg);    color: #1E40AF; border-color: #93C5FD; }
.badge-info    { background: #F0F9FF;            color: #075985; border-color: #7DD3FC; }

/* ── ALERTES ──────────────────────────────────────────────── */
.alert {
  padding: .875rem 1.125rem; border-radius: var(--radius); margin-bottom: 1.25rem;
  font-size: .875rem; border: 1.5px solid transparent; display: flex; gap: .5rem; align-items: flex-start;
}
.alert-success { background: var(--success-bg); border-color: #86EFAC; color: #166534; }
.alert-error   { background: var(--danger-bg);  border-color: #FCA5A5; color: #991B1B; }
.alert-warning { background: var(--warning-bg); border-color: #FCD34D; color: #92400E; }
.alert-info    { background: var(--info-bg);    border-color: #93C5FD; color: #1E40AF; }

/* ── LOGIN PAGE ───────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: linear-gradient(145deg, #0F2419 0%, #1B4332 50%, #162D24 100%);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(64,145,108,.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(181,136,58,.08) 0%, transparent 50%);
}
.login-wrap { width: 100%; max-width: 420px; padding: 1.5rem; position: relative; }
.login-card {
  background: #fff; border-radius: var(--radius-lg); padding: 2.75rem;
  box-shadow: 0 25px 80px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.05);
}
.login-logo { text-align: center; margin-bottom: 2.25rem; }
.login-logo .brand-icon { font-size: 2.75rem; display: block; margin-bottom: .75rem; color: var(--primary); }
.login-logo h1 { font-size: 1.25rem; color: var(--primary); font-weight: 800; margin-bottom: .25rem; letter-spacing: -.4px; }
.login-logo p { color: var(--muted); font-size: .825rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-footer { display: flex; justify-content: center; gap: 1rem; margin-top: 1.5rem; font-size: .775rem; color: var(--muted); }
.login-footer a { color: var(--muted); }
.login-footer a:hover { color: var(--primary); }

/* ── UTILITAIRES ──────────────────────────────────────────── */
.text-muted { color: var(--muted); font-size: .825rem; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.empty-state { color: var(--muted); font-style: italic; text-align: center; padding: 1.25rem 0; font-size: .875rem; }
.empty-state-large { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty-state-large span { font-size: 3rem; display: block; margin-bottom: 1rem; opacity: .6; }
.empty-state-large p { font-size: .925rem; line-height: 1.6; }

.doc-gen-card {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-l);
}
.doc-gen-card:last-child { border-bottom: none; }
.doc-gen-card .doc-gen-titre {
  font-size: .95rem; font-weight: 800; color: var(--primary); line-height: 1.3;
  min-width: 0; overflow-wrap: anywhere;
}
.doc-gen-card .doc-gen-btns { display: flex; align-items: center; justify-content: flex-end; gap: .45rem; flex-wrap: wrap; }
.doc-gen-card .doc-gen-btns .btn { min-height: 34px; }

/* Score bars (satisfaction) */
.score-bar-wrap { flex: 1; background: var(--border-l); border-radius: 20px; height: 8px; overflow: hidden; min-width: 80px; }
.score-bar { height: 100%; background: linear-gradient(to right, var(--success), var(--accent)); border-radius: 20px; transition: width .5s ease; }

/* ── HAMBURGER BUTTON ─────────────────────────────────────── */
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 8px;
  margin-left: auto; border-radius: 6px; transition: background var(--transition);
}
.nav-toggle:hover { background: rgba(255,255,255,.12); }
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: rgba(255,255,255,.85); border-radius: 2px;
  transition: all .25s;
}

/* ── MENU MOBILE PANEL ────────────────────────────────────── */
/* CORRECTIF v2.1 : visibility au lieu de display:none pour permettre la transition */
.nav-mobile-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 299; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s, visibility .25s;
}
.nav-mobile-overlay.open { opacity: 1; visibility: visible; pointer-events: auto; }

.nav-mobile-panel {
  position: fixed; top: 0; right: -100%; width: min(320px, 85vw);
  height: 100dvh; background: var(--bg-nav); z-index: 300;
  transition: right .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; overflow-y: auto;
}
.nav-mobile-panel.open { right: 0; }

.nav-mobile-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.125rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.1);
  color: #fff; font-weight: 700; font-size: .95rem;
}
.nav-mobile-close {
  background: none; border: none; color: rgba(255,255,255,.7);
  font-size: 1.25rem; cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.nav-mobile-close:hover { background: rgba(255,255,255,.12); color: #fff; }

.nav-mobile-user {
  padding: .875rem 1.25rem; color: var(--accent-l);
  font-size: .825rem; border-bottom: 1px solid rgba(255,255,255,.08);
}

.nav-mobile-links { display: flex; flex-direction: column; flex: 1; padding: .5rem 0; }
.nav-mobile-links a {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1.25rem; color: rgba(255,255,255,.75);
  font-size: .9rem; font-weight: 500; text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.05);
  transition: background var(--transition), color var(--transition);
}
.nav-mobile-links a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-mobile-logout {
  margin-top: auto; color: #FCA5A5 !important;
  border-top: 1px solid rgba(255,255,255,.1) !important;
}

/* ── NAV BAR MOBILE BASSE (stagiaires) ───────────────────── */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-nav); z-index: 100;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  display: flex; justify-content: space-around; align-items: center; padding: .25rem 0;
}
.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .5rem .75rem; color: rgba(255,255,255,.55); text-decoration: none;
  font-size: .6rem; font-weight: 600; border-radius: 8px; min-width: 52px;
  text-align: center; transition: color var(--transition);
  position: relative;
}
.bottom-nav-item .bnav-icon { font-size: 1.3rem; line-height: 1; }
.bottom-nav-item.active, .bottom-nav-item:hover { color: var(--accent-l); text-decoration: none; }
.bottom-nav-item .bnav-badge {
  position: absolute; top: 4px; right: 8px;
  background: #EF4444; color: #fff; border-radius: 50%;
  width: 16px; height: 16px; font-size: .6rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1100px) {
  .admin-menu { grid-template-columns: repeat(3, 1fr); }
  .stats-grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  /* Nav */
  .nav-links { display: none !important; }
  .nav-user .user-name { display: none; }
  .nav-toggle { display: flex; }
  .topnav-inner { gap: .5rem; }
  .brand-sub { display: none; }

  /* Layout */
  .stats-grid, .stats-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-menu { grid-template-columns: 1fr 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .sat-row, .sat-grid-header { grid-template-columns: 1fr repeat(5, 40px); }
  .container { padding: 1rem; }
  .page-header { flex-direction: column; gap: .75rem; }
  .page-header h1 { font-size: 1.25rem; }
}

@media (max-width: 600px) {
  /* Nav basse stagiaires */
  .bottom-nav { display: block; }
  .main-content { padding-bottom: 70px; }

  /* Stats */
  .stats-grid, .stats-grid-5 { grid-template-columns: repeat(2, 1fr); gap: .625rem; }
  .stat-value { font-size: 1.6rem; }
  .stat-card { padding: 1rem; }

  /* Cards */
  .card-body { padding: 1rem; }
  .card-header { padding: .875rem 1rem; }
  .admin-menu { grid-template-columns: 1fr; }
  .card-actions .card-body { grid-template-columns: 1fr 1fr; }

  /* Login */
  .login-card { padding: 1.5rem 1.25rem; border-radius: var(--radius-lg); }
  .login-wrap { padding: 1rem; }

  /* Tables → scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { font-size: .8rem; min-width: 520px; }
  .table th, .table td { padding: .6rem .75rem; }

  /* Session cards */
  .session-card-header { flex-direction: column; gap: .625rem; padding: 1rem; }
  .signature-zone { padding: 1rem; }
  .sig-canvas { height: 120px; }

  /* Messages */
  .message-bubble { max-width: 92%; }
  .msg-header { flex-direction: column; align-items: flex-start; gap: .1rem; }

  /* Formation items */
  .formation-item { flex-direction: column; align-items: flex-start; gap: .375rem; }

  /* Satisfaction */
  .sat-row, .sat-grid-header { grid-template-columns: 1fr repeat(5, 34px); gap: .25rem; font-size: .75rem; }
  .star { font-size: 1.4rem; }

  /* Actions rapides */
  .action-btn { padding: .875rem .5rem; font-size: .775rem; }
  .action-btn span:first-child { font-size: 1.3rem; }

  /* Boutons */
  .btn { padding: .55rem .875rem; font-size: .825rem; }
  .td-actions { gap: .25rem; }
  .td-actions .btn { padding: .3rem .5rem; font-size: .725rem; }

  /* Page header */
  .page-header h1 { font-size: 1.15rem; }
  .page-header { margin-bottom: 1.25rem; padding-bottom: .875rem; }

  /* Profil */
  .profile-grid { grid-template-columns: 1fr; }

  /* Dashboard session date */
  .session-date { min-width: 44px; padding: .375rem .5rem; }
  .date-day { font-size: 1.1rem; }

  /* Stats grid : colonnes plus compactes */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .stat-card { padding: .875rem; }
}

@media (max-width: 380px) {
  /* Très petits écrans */
  .stats-grid, .stats-grid-5 { grid-template-columns: 1fr; }
  .card-actions .card-body { grid-template-columns: 1fr; }
  .nav-mobile-panel { width: 92vw; }
}


/* ============================================================
   Correctif UX formateur — menu lisible et non rogné
   ============================================================ */
.topnav { overflow: visible; }
.topnav-inner { min-width: 0; gap: .5rem; }
.role-formateur .brand { padding-right: .8rem; margin-right: .35rem; max-width: 245px; min-width: 185px; }
.role-formateur .brand-name { font-size: .86rem; }
.role-formateur .brand-sub { font-size: .62rem; padding: 1px 6px; }
.role-formateur .nav-links { min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; padding-bottom: 2px; }
.role-formateur .nav-links li a { padding: .42rem .58rem; font-size: .76rem; gap: .22rem; }
.role-formateur .nav-user { padding-left: .35rem; gap: .35rem; flex-shrink: 0; }
.role-formateur .user-name { max-width: 115px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .35rem .55rem; }
.role-formateur .btn-logout { padding: .34rem .55rem; font-size: .72rem; }

@media (max-width: 1320px) {
  .role-formateur .brand-sub { display: none; }
  .role-formateur .brand { min-width: 150px; max-width: 180px; }
  .role-formateur .nav-links li a { padding-left: .48rem; padding-right: .48rem; font-size: .72rem; }
}

@media (max-width: 1100px) {
  .role-formateur .nav-links, .role-formateur .nav-user { display: none; }
  .role-formateur .nav-toggle { display: flex; }
}

/* Signature convention */
.convention-sign-panel { margin-top: 1.25rem; padding: 1rem; border: 1px solid var(--border-l); border-radius: var(--radius); background: #FDFCFB; }
.convention-signed { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .75rem; border-radius: 999px; background: #DCFCE7; color: #166534; font-weight: 700; font-size: .82rem; }

/* ============================================================
   Évaluations Qualiopi
   ============================================================ */
.eval-form {
  display: block;
}
.eval-question-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}
.eval-question-number {
  font-size: .78rem;
  color: var(--muted, #64748b);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .35rem;
}
.eval-question-card h3 {
  margin: 0 0 .75rem;
  font-size: 1.05rem;
  color: var(--primary, #1B4332);
}
.eval-choice {
  display: block;
  padding: .7rem .85rem;
  margin: .45rem 0;
  border: 1.5px solid var(--border, #e5e7eb);
  border-radius: 10px;
  cursor: pointer;
  background: #fafafa;
}
.eval-choice:hover {
  border-color: var(--primary, #2D6A4F);
  background: #f0fdf4;
}
.eval-choice input {
  margin-right: .5rem;
}
.eval-scale {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}
.eval-scale label {
  cursor: pointer;
}
.eval-scale input {
  display: none;
}
.eval-scale span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border, #e5e7eb);
  background: #fff;
  font-weight: 800;
}
.eval-scale input:checked + span {
  background: var(--primary, #2D6A4F);
  color: #fff;
  border-color: var(--primary, #2D6A4F);
}
.eval-question-admin {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: .75rem;
  background: #fbfbfa;
}
.eval-question-admin ul {
  margin: .5rem 0;
}
@media (max-width: 900px) {
  .topnav-inner {
    align-items: flex-start;
  }
  .role-formateur .nav-links {
    flex-wrap: wrap;
    row-gap: .35rem;
  }
}

/* ============================================================
   Sprint UX Mobile Android — Code & Compétences
   Objectif : 360–412 px, mobile first, pas de débordement.
   ============================================================ */
html, body { max-width: 100%; overflow-x: hidden; }
body { touch-action: manipulation; }
.main-content { padding-bottom: 1.5rem; }
.role-stagiaire .main-content { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
.container { width: 100%; max-width: 1180px; }
.text-muted, .doc-name, .formation-info, .session-info, .detail-value { overflow-wrap: anywhere; word-break: normal; }

/* Header compact et non rogné */
.topnav { min-height: 58px; height: auto; }
.topnav-inner { min-height: 58px; width: 100%; max-width: 100%; padding: 0 .9rem; }
.brand { min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { margin-left: auto; flex-shrink: 0; }
.nav-user { min-width: 0; }
.btn-logout { flex-shrink: 0; }

/* Menu utilisateur mobile : seul le panneau contient Déconnexion pour éviter la coupe à droite */
@media (max-width: 900px) {
  .topnav-inner { padding: 0 .75rem; min-height: 56px; }
  .brand { border-right: 0; margin-right: 0; padding-right: .4rem; max-width: calc(100vw - 112px); }
  .brand-name { font-size: .86rem; }
  .brand-icon { font-size: 1.1rem; }
  .nav-user { display: none !important; }
  .btn-logout { display: none; }
  .nav-toggle { display: flex !important; width: 42px; height: 42px; align-items: center; justify-content: center; }
  .nav-mobile-panel { width: min(340px, 90vw); }
}

/* Formulaires : marge basse pour menu fixe Android */
form, .card, .card-body { min-width: 0; }
.form-actions { flex-wrap: wrap; gap: .6rem; padding-bottom: .25rem; }
.role-stagiaire .form-actions { margin-bottom: 86px; }
.form-actions .btn { min-height: 42px; }
input, select, textarea, button { max-width: 100%; }

/* Boutons et actions : jamais coupés */
.btn { max-width: 100%; white-space: normal; text-align: center; justify-content: center; }
.td-actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.td-actions .btn, .card-header .btn { white-space: normal; }

/* Documents : cartes lisibles, noms métiers, actions visibles */
.doc-item {
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--border-l);
  border-radius: 12px;
  padding: .8rem;
  margin-bottom: .65rem;
  box-shadow: var(--shadow-sm);
}
.doc-type { min-width: 0; font-weight: 700; color: var(--primary); }
.doc-name { min-width: 0; line-height: 1.35; }
.doc-size { flex-shrink: 0; }
.pdf-viewer-wrap { height: min(62vh, 560px); }

/* Actions rapides plus compactes */
.card-actions .card-body { gap: .6rem; }
.action-btn { min-height: 86px; padding: .8rem .65rem; border-radius: 14px; }
.action-btn span:first-child { font-size: 1.35rem; line-height: 1; }

/* Progression Qualiopi / dossier */
.progress-panel {
  background: linear-gradient(180deg, #fff, #fbfaf7);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin: 1rem 0;
}
.progress-panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; margin-bottom: .7rem; }
.progress-title { font-weight: 800; color: var(--primary); }
.progress-score { text-align: right; font-weight: 800; color: var(--primary); font-size: 1.25rem; }
.progress-score small { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.progress-bar { height: 9px; background: #E5E7EB; border-radius: 999px; overflow: hidden; margin: .65rem 0 .8rem; }
.progress-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-l), var(--accent)); border-radius: inherit; }
.progress-steps { display: flex; flex-wrap: wrap; gap: .4rem; }
.progress-step { display: inline-flex; align-items: center; gap: .3rem; padding: .32rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; border: 1px solid var(--border); background: #fff; color: var(--muted); }
.progress-step.done { background: var(--success-bg); color: #166534; border-color: #86EFAC; }
.progress-step.todo { background: var(--warning-bg); color: #92400E; border-color: #FCD34D; }

/* Responsive des tableaux en cartes */
@media (max-width: 700px) {
  .container { padding: .8rem .7rem; }
  .page-header { gap: .65rem; margin-bottom: 1rem; }
  .page-header h1 { font-size: 1.12rem; line-height: 1.25; }
  .page-header .btn { width: 100%; }
  .card { border-radius: 15px; margin-bottom: 1rem; }
  .card-header { flex-direction: column; align-items: stretch; gap: .7rem; padding: .9rem; }
  .card-header h2 { line-height: 1.3; }
  .card-header > div { max-width: 100%; }
  .card-body { padding: .9rem; }

  .table-wrap { overflow: visible; }
  table.mobile-card-table { min-width: 0 !important; border-collapse: separate; border-spacing: 0 .75rem; }
  table.mobile-card-table thead { display: none; }
  table.mobile-card-table, table.mobile-card-table tbody, table.mobile-card-table tr, table.mobile-card-table td { display: block; width: 100%; }
  table.mobile-card-table tr {
    background: #fff;
    border: 1px solid var(--border-l);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    padding: .75rem;
    margin: .75rem .75rem;
  }
  table.mobile-card-table td {
    border: 0;
    padding: .45rem 0;
    display: grid;
    grid-template-columns: minmax(92px, 34%) 1fr;
    gap: .65rem;
    align-items: start;
    overflow-wrap: anywhere;
  }
  table.mobile-card-table td::before {
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  table.mobile-card-table td:empty { display: none; }
  table.mobile-card-table tfoot { display: block; padding: .75rem; }
  table.mobile-card-table tfoot tr, table.mobile-card-table tfoot td { display: block; width: 100%; }

  .detail-grid { grid-template-columns: 1fr !important; gap: .75rem !important; }
  .detail-block { background: #fff; border: 1px solid var(--border-l); border-radius: 10px; padding: .7rem; }
  .progress-panel { padding: .85rem; }
  .progress-panel-header { flex-direction: row; }
  .progress-steps { gap: .35rem; }
  .progress-step { font-size: .68rem; padding: .28rem .45rem; }

  .pdf-viewer-wrap { height: 260px; }
  .pdf-viewer { min-height: 260px; }
  .doc-item { display: grid; grid-template-columns: 1fr; gap: .35rem; }
  .doc-type, .doc-size { font-size: .78rem; }
  .doc-name { font-size: .9rem; }

  .stats-grid, .stats-grid-5, .stats-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { min-height: 118px; }
  .stat-icon { font-size: 1.25rem; margin-bottom: .35rem; }
  .stat-value { font-size: 1.55rem; }
  .stat-label { font-size: .72rem; }

  .session-item { align-items: flex-start; background:#fff; border:1px solid var(--border-l); border-radius:12px; padding:.75rem; margin-bottom:.55rem; }
  .session-info { min-width:0; }
  .session-info strong { overflow-wrap:anywhere; }

  .sat-row, .sat-grid-header { grid-template-columns: 1fr; }
  .rating-stars { display: flex; flex-wrap: wrap; gap: .35rem; }
}

@media (max-width: 412px) {
  .container { padding-left: .6rem; padding-right: .6rem; }
  .brand-name { max-width: 165px; }
  .bottom-nav-item { min-width: 0; flex: 1; padding: .45rem .25rem; font-size: .56rem; }
  .bottom-nav-item .bnav-icon { font-size: 1.1rem; }
  .stats-grid, .stats-grid-5, .stats-grid-3 { gap: .5rem; }
  .card-actions .card-body { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 360px) {
  .brand-name { max-width: 145px; }
  .stats-grid, .stats-grid-5, .stats-grid-3 { grid-template-columns: 1fr; }
  .card-actions .card-body { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  body.role-stagiaire { padding-bottom: 74px; }
  .bottom-nav-item {
    line-height: 1.12;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .eval-scale {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .4rem;
  }
  .eval-scale label span {
    min-width: 0;
    width: 100%;
  }
  .eval-choice {
    width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .pdf-viewer-wrap {
    height: min(68dvh, 620px);
  }
}

/* ── Corrections Mobile Android 360–412 px ────────────────── */
@media (max-width: 600px) {
  /* Barre basse : 5 items, pas de coupure */
  .bottom-nav-inner { padding: .15rem 0; }
  .bottom-nav-item { min-width: 0; flex: 1 1 0; padding: .4rem .15rem; font-size: .55rem; }
  .bottom-nav-item .bnav-icon { font-size: 1.15rem; }

  /* Boutons Ouvrir / Télécharger toujours visibles */
  .td-actions { flex-wrap: wrap; gap: .3rem; }
  .td-actions .btn-xs { font-size: .7rem; padding: .3rem .5rem; white-space: nowrap; }

  /* En-têtes de carte : pas de débordement */
  .card-header { flex-wrap: wrap; gap: .45rem; }
  .card-header h2 { font-size: .9rem; }

  /* Formulaires : marge basse pour que submit ne soit pas masqué par barre basse */
  .form-actions { padding-bottom: 1.25rem; }

  /* Tableaux documents : affichage carte */
  .table-wrap table thead { display: none; }
  .table-wrap table, .table-wrap table tbody,
  .table-wrap table tr, .table-wrap table td { display: block; width: 100%; }
  .table-wrap table tr {
    border: 1px solid var(--border-l);
    border-radius: var(--radius);
    margin-bottom: .6rem;
    padding: .6rem;
    background: #fff;
  }
  .table-wrap table td { border: none; padding: .2rem 0; font-size: .85rem; }
  .table-wrap table td:empty { display: none; }
  .table-wrap table .td-actions { margin-top: .35rem; }

  /* Stats grid : 2 colonnes max sur mobile */
  .stats-grid[style*="grid-template-columns:repeat(5"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* =====================================================
   MOBILE RESPONSIVE TABLES — classe .table-mc
   Transforme n'importe quel tableau en cartes mobiles.
   Usage : ajouter class="table table-mc" sur <table>
   Ajouter data-label="..." sur chaque <td> (sauf td-actions)
   ===================================================== */
@media (max-width: 700px) {
  .table-mc { min-width: 0 !important; }
  .table-mc thead { display: none; }
  .table-mc tbody tr {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-l);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(15,23,42,.06);
  }
  .table-mc td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .875rem;
    border: none;
    border-bottom: 1px solid var(--border-l);
    font-size: .85rem;
    min-height: 36px;
    flex-wrap: wrap;
  }
  .table-mc td:last-child { border-bottom: none; }
  .table-mc td[data-label]::before {
    content: attr(data-label);
    font-size: .72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    min-width: 88px;
    flex-shrink: 0;
    align-self: flex-start;
    padding-top: 2px;
  }
  .table-mc td.td-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .65rem .875rem;
    background: #fafaf8;
    border-bottom: none;
    justify-content: flex-start;
  }
  .table-mc td.td-actions::before { display: none !important; }
  .table-mc td.td-actions .btn { min-height: 34px; font-size: .8rem; }
  .table-mc td.td-actions form { display: inline-flex; }

  /* Désactiver le scroll horizontal sur les tableaux responsifs */
  .table-wrap:has(.table-mc) { overflow-x: visible; }

  /* ---- Évaluations stagiaire : grouper par formation ---- */
  .eval-group-title {
    font-size: .8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: .5rem .875rem;
    background: var(--bg, #f8f7f4);
    border-radius: var(--radius) var(--radius) 0 0;
    margin-top: .875rem;
    border: 1px solid var(--border-l);
    border-bottom: none;
  }
  .eval-mobile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-l);
    border-top: none;
    padding: .75rem .875rem;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
  }
  .eval-mobile-card + .eval-mobile-card { border-top: 1px solid var(--border-l); }
  .eval-mobile-card:last-of-type { border-radius: 0 0 var(--radius) var(--radius); margin-bottom: .75rem; }
  .eval-mobile-card .eval-titre { font-size: .88rem; font-weight: 600; color: var(--primary); }
  .eval-mobile-card .eval-session { font-size: .78rem; color: var(--muted); }
  .eval-mobile-card .eval-foot { display: flex; align-items: center; gap: .5rem; margin-top: .3rem; flex-wrap: wrap; }
  .badge-xs { font-size: .7rem; padding: .2rem .5rem; border-radius: 999px; font-weight: 700; }
  .badge-xs.badge-warning { background: #FEF3C7; color: #92400E; }
  .badge-xs.badge-success { background: #D1FAE5; color: #065F46; }

  /* ---- Documents stagiaire ---- */
  .doc-mobile-row {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    padding: .75rem .875rem;
    border-bottom: 1px solid var(--border-l);
  }
  .doc-mobile-row:last-child { border-bottom: none; }
  .doc-mobile-row .doc-meta { font-size: .85rem; font-weight: 600; color: var(--primary); }
  .doc-mobile-row .doc-date { font-size: .75rem; color: var(--muted); }
  .doc-mobile-row .doc-btns { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .2rem; }
  .doc-mobile-row .doc-btns .btn { min-height: 34px; flex: 1; text-align: center; }

  /* ---- Documents générés (auto) ---- */
  .doc-gen-card {
    padding: .75rem .875rem;
    border-bottom: 1px solid var(--border-l);
  }
  .doc-gen-card:last-child { border-bottom: none; }
  .doc-gen-card .doc-gen-titre { font-size: .88rem; font-weight: 700; color: var(--primary); margin-bottom: .5rem; }
  .doc-gen-card .doc-gen-btns { display: flex; flex-wrap: wrap; gap: .375rem; }
  .doc-gen-card .doc-gen-btns .btn { min-height: 34px; }

  /* ---- Dashboard : Documents récents ---- */
  .doc-recent-item {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--border-l);
  }
  .doc-recent-item:last-child { border-bottom: none; }
  .doc-recent-item .doc-recent-meta { display: flex; align-items: center; gap: .5rem; }
  .doc-recent-item .doc-recent-btns { display: flex; gap: .4rem; }
  .doc-recent-item .doc-recent-btns .btn { flex: 1; text-align: center; min-height: 36px; }
}

/* Utilitaires d'affichage conditionnel */
.hide-mobile { display: block; }
.show-mobile { display: none; }
@media (max-width: 700px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
}


/* =====================================================
   CORRECTIONS MOBILE — v2
   ===================================================== */

/* ---- 1. table-mc : grille label / valeur propre ---- */
/* Le label (::before) prend 110px, la valeur prend le reste */
@media (max-width: 700px) {
  .table-mc td[data-label] {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: start;
    gap: .5rem;
    flex-wrap: nowrap; /* pas de wrap sur le td lui-même */
  }
  .table-mc td[data-label]::before {
    min-width: unset;
    padding-top: 2px;
    line-height: 1.4;
    word-break: break-word;
  }
  /* Valeur : on autorise le retour à la ligne */
  .table-mc td[data-label] > *,
  .table-mc td[data-label] strong,
  .table-mc td[data-label] span {
    word-break: break-word;
    min-width: 0;
  }

  /* ---- 2. Session-modèles : formulaire "Copier depuis une autre formation" ---- */
  .copy-form { flex-direction: column !important; align-items: stretch !important; gap: .5rem !important; }
  .copy-form .form-group { min-width: 0 !important; width: 100% !important; }
  .copy-form select { width: 100%; }
  .copy-form .btn { width: 100%; justify-content: center; }

  /* ---- 3. Conteneur bas de page ---- */
  .container { padding-bottom: 2rem; }

  /* ---- 4. Qualiopi — score aligné dans la carte ---- */
  .table-mc .qua-score {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: nowrap;
  }
  .table-mc .qua-score .progress-bar {
    flex: 1;
    min-width: 50px;
    max-width: 100px;
    margin: 0;
  }
  .table-mc .qua-score strong {
    white-space: nowrap;
    font-size: .82rem;
    color: var(--primary);
  }
  .qua-badge-col { text-align: center; justify-content: center; }

  /* ---- 5. Formations : boutons td-actions qui débordent ---- */
  .table-mc td.td-actions { gap: .3rem; }
  .table-mc td.td-actions .btn { white-space: nowrap; flex-shrink: 0; }

  /* ---- 6. Select dropdown dans card overflow:hidden ---- */
  .card-select { overflow: visible !important; }
}

@media (max-width: 900px) {
  .table-mc td.qua-badge-col::before { min-width: 70px; }
}

/* =====================================================
   Parcours mobile TOSA DigComp
   ===================================================== */
.continue-training-card { grid-column: 1 / -1; border-left: 4px solid var(--primary-l); }
.student-next-step {
  display: grid; grid-template-columns: 1fr minmax(220px, 300px); gap: 1rem; align-items: center;
  background: linear-gradient(135deg, #1B4332, #2D6A4F 58%, #B5883A);
  color: #fff; border-radius: 18px; padding: 1.35rem; margin-bottom: 1.5rem;
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.12);
}
.student-next-step.is-ready { background: linear-gradient(135deg, #173B2D, #25634B); }
.student-next-step-kicker {
  display: inline-flex; width: max-content; padding: .22rem .58rem; border-radius: 999px;
  background: rgba(255,255,255,.16); color: #fff; font-size: .7rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .45rem;
}
.student-next-step h2 { font-size: 1.45rem; line-height: 1.2; letter-spacing: 0; margin-bottom: .35rem; }
.student-next-step p { color: rgba(255,255,255,.82); max-width: 720px; }
.student-next-step-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.student-next-step-meta span {
  display: inline-flex; padding: .25rem .55rem; border-radius: 999px;
  background: rgba(255,255,255,.12); font-size: .78rem; font-weight: 700;
}
.student-next-step-actions { display: grid; gap: .55rem; }
.student-next-step .btn-outline { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.72); }
.student-next-step .btn-outline:hover { background: #fff; color: var(--primary); }
.continue-training-main {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .85rem;
}
.continue-training-main > div:first-child { display: flex; flex-direction: column; gap: .18rem; min-width: 0; }
.continue-training-main strong { color: var(--primary); font-size: 1rem; }
.continue-training-percent { font-size: 1.6rem; font-weight: 800; color: var(--primary); line-height: 1; }
.continue-training-progress { margin-bottom: 1rem; }

.parcours-shell { max-width: 760px; }
.parcours-header { align-items: center; }
.parcours-hero {
  background: linear-gradient(135deg, #163428, #245B48 54%, #72582A);
  color: #fff; border-radius: 18px; padding: 1.35rem; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; margin-bottom: 1rem;
}
.parcours-hero h2 { font-size: 1.32rem; line-height: 1.25; margin: .25rem 0 .35rem; letter-spacing: 0; }
.parcours-hero p { color: rgba(255,255,255,.78); font-size: .9rem; }
.parcours-kicker {
  display: inline-flex; width: max-content; align-items: center; padding: .22rem .55rem;
  border-radius: 999px; background: rgba(255,255,255,.14); color: inherit;
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
}
.parcours-score { text-align: right; min-width: 92px; }
.parcours-score strong { display: block; font-size: 2rem; line-height: 1; }
.parcours-score span { display: block; color: rgba(255,255,255,.72); font-size: .72rem; margin-top: .35rem; }
.parcours-main-progress { height: 11px; margin-bottom: 1rem; }

.parcours-actions { display: grid; grid-template-columns: 1fr .65fr; gap: .65rem; margin-bottom: 1rem; }
.parcours-actions form { display: flex; }
.parcours-actions form .btn { width: 100%; }

.parcours-module-list { display: grid; gap: .8rem; }
.parcours-module-card, .progression-module, .lesson-card, .quiz-card, .signature-module-card, .progression-summary {
  background: #fff; border: 1px solid var(--border-l); border-radius: 16px; box-shadow: var(--shadow-sm);
}
.parcours-module-card { padding: 1rem; }
.parcours-module-card.is-complete { border-color: #A7F3D0; }
.module-card-top { display: grid; grid-template-columns: 38px 1fr; gap: .85rem; align-items: start; margin-bottom: .8rem; }
.module-number {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border-radius: 12px; background: #EAF6EF; color: var(--primary); font-weight: 800;
}
.module-card-top h3, .progression-module h2 { font-size: .98rem; color: var(--primary); line-height: 1.25; }
.module-card-top p, .progression-module p { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.module-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-top: .75rem; font-size: .82rem; color: var(--muted); }

.lesson-topbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .8rem; color: var(--muted); font-weight: 700; font-size: .8rem; }
.lesson-card { padding: 1.25rem; margin-bottom: 1rem; }
.lesson-meta { color: var(--gold); font-weight: 800; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .45rem; }
.lesson-card h1, .quiz-card h1, .signature-module-card h1 { color: var(--primary); font-size: 1.45rem; line-height: 1.18; letter-spacing: 0; margin-bottom: 1rem; }
.lesson-text { font-size: 1.05rem; color: var(--text-2); line-height: 1.75; }
.lesson-detail { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-l); color: var(--text-2); }
.lesson-image { border-radius: 14px; margin-bottom: 1rem; width: 100%; max-height: 260px; object-fit: cover; }
.lesson-video-wrapper { width: 100%; border-radius: 14px; margin-bottom: 1rem; overflow: hidden; background: #000; -webkit-transform: translateZ(0); transform: translateZ(0); }
.lesson-video { width: 100%; max-width: 100%; height: auto; display: block; -webkit-transform: translateZ(0); transform: translateZ(0); }
.lesson-action-dock { position: sticky; bottom: 78px; z-index: 20; }

.quiz-card { padding: 1.25rem; }
.quiz-card .parcours-kicker, .signature-module-card .parcours-kicker, .progression-summary .parcours-kicker {
  background: #EEF2FF; color: #3730A3; margin-bottom: .7rem;
}
.quiz-options { display: grid; gap: .65rem; margin: 1rem 0 1.25rem; }
.quiz-option {
  display: flex; align-items: center; gap: .85rem;
  border: 2px solid var(--border); border-radius: 14px; padding: .9rem 1rem;
  cursor: pointer; background: #FDFCFB;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background .15s;
}
/* Radio natif masqué — remplacé par cercle CSS */
.quiz-option input[type="radio"] {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; min-width: 22px;
  border: 2px solid var(--border); border-radius: 50%;
  background: #fff; cursor: pointer; position: relative;
  transition: border-color .15s, background .15s;
  margin: 0;
}
.quiz-option input[type="radio"]::after {
  content: ''; position: absolute;
  top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0);
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary-l);
  transition: transform .15s ease;
}
.quiz-option input[type="radio"]:checked {
  border-color: var(--primary-l); background: #EDF7F1;
}
.quiz-option input[type="radio"]:checked::after { transform: translate(-50%,-50%) scale(1); }
.quiz-option.is-selected { border-color: var(--primary-l); background: #EDF7F1; }
.quiz-option.is-selected input[type="radio"] { border-color: var(--primary-l); background: #EDF7F1; }
.quiz-option.is-selected input[type="radio"]::after { transform: translate(-50%,-50%) scale(1); }
.quiz-option span { font-weight: 600; color: var(--text-2); font-size: 1rem; line-height: 1.4; }

.progression-summary { padding: 1.15rem; margin-bottom: 1rem; }
.progression-summary strong { display: block; font-size: 2.4rem; color: var(--primary); line-height: 1; }
.progression-summary p { color: var(--muted); margin: .25rem 0 .9rem; }
.progression-meta { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: 1rem; }
.progression-meta div { background: #F8F7F3; border-radius: 12px; padding: .75rem; }
.progression-meta dt { color: var(--muted); font-size: .68rem; text-transform: uppercase; font-weight: 800; letter-spacing: .06em; }
.progression-meta dd { color: var(--text-2); font-weight: 700; margin-top: .15rem; }
.progression-module { display: flex; align-items: center; justify-content: space-between; gap: .9rem; padding: .95rem; }

.signature-module-card { padding: 1.25rem; }
.signature-module-card p { color: var(--muted); margin-bottom: 1rem; }
.module-signature-zone { padding: 0; border-top: 0; background: transparent; }
.signature-module-shell .sig-canvas { max-width: none; height: 180px; }

@media (max-width: 700px) {
  .student-next-step { grid-template-columns: 1fr; padding: 1rem; border-radius: 15px; }
  .student-next-step h2 { font-size: 1.22rem; }
  .student-next-step-actions { grid-template-columns: 1fr; }
  .continue-training-main { align-items: center; }
  .continue-training-card .card-body { padding: 1rem; }
  .parcours-shell { padding-left: .75rem; padding-right: .75rem; }
  .parcours-header { flex-direction: column; align-items: stretch; }
  .parcours-hero { grid-template-columns: 1fr; border-radius: 16px; padding: 1.05rem; }
  .parcours-score { text-align: left; display: flex; align-items: baseline; gap: .6rem; }
  .parcours-score span { margin-top: 0; }
  .parcours-actions { grid-template-columns: 1fr; }
  .lesson-card h1, .quiz-card h1, .signature-module-card h1 { font-size: 1.25rem; }
  .lesson-text { font-size: 1rem; }
  .lesson-action-dock { bottom: 74px; }
  .progression-module { flex-direction: column; align-items: stretch; }
  .progression-module .btn, .progression-module .badge { width: 100%; justify-content: center; text-align: center; }
  .progression-meta { grid-template-columns: 1fr; }
  .sig-actions { display: grid; grid-template-columns: 1fr; }
}

/* =====================================================
   Evaluations stagiaire - champs et cartes responsive
   ===================================================== */
.evaluations-page { max-width: 1180px; }
.evaluations-page > .card { overflow: visible; }
.evaluations-page .eval-form { display: grid; gap: 1rem; }
.evaluations-page .eval-question-card {
  margin-bottom: 0;
  border-color: var(--border-l);
  border-radius: 12px;
  padding: 1.2rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .035);
}
.evaluations-page .eval-question-card h3 {
  line-height: 1.35;
  margin-bottom: .9rem;
  overflow-wrap: anywhere;
}
.evaluations-page .eval-choice {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
}
.evaluations-page .eval-choice input {
  margin: .15rem 0 0;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--primary);
}
.eval-textarea {
  display: block;
  width: 100%;
  min-height: 132px;
  resize: vertical;
  padding: .85rem .95rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #FDFCFB;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.eval-textarea::placeholder { color: #8B8A86; }
.eval-textarea:focus {
  border-color: var(--primary-l);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, .12);
}
.evaluations-page .eval-form .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  gap: .7rem;
  align-items: center;
  padding: 1rem 0 0;
  border-top: 1px solid var(--border-l);
  background: linear-gradient(180deg, rgba(255,255,255,.78), #fff 35%);
}

@media (max-width: 700px) {
  .evaluations-page {
    padding-left: .75rem;
    padding-right: .75rem;
  }
  .evaluations-page .page-header {
    margin-bottom: .85rem;
  }
  .evaluations-page .card-header {
    align-items: stretch;
    gap: .75rem;
  }
  .evaluations-page .card-header .btn {
    width: 100%;
    justify-content: center;
  }
  .evaluations-page .card-body {
    padding: .85rem;
  }
  .evaluations-page .eval-question-card {
    padding: .95rem;
    border-radius: 10px;
  }
  .evaluations-page .eval-question-card h3 {
    font-size: .98rem;
  }
  .eval-textarea {
    min-height: 150px;
    font-size: 16px;
  }
  .evaluations-page .eval-scale {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .45rem;
  }
  .evaluations-page .eval-scale label,
  .evaluations-page .eval-scale span {
    width: 100%;
  }
  .evaluations-page .eval-form .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    padding: .75rem 0 env(safe-area-inset-bottom);
  }
  .evaluations-page .eval-form .form-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 46px;
  }
}
