/* ══ FIX OVERFLOW GLOBAL — priorité maximale ══════════════ */
* { box-sizing: border-box; }

#analyze-layout,
.layout-analyze {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

/* ============================================
   COMPONENTS.CSS — Boutons, cards, modals, formulaires, highlights
   ============================================ */

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1.2rem; border-radius: var(--radius-md);
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  border: 1px solid transparent; white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
  color: var(--navy-900); border-color: var(--gold-400);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-300));
  box-shadow: 0 4px 16px rgba(201,168,76,0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255,255,255,0.06); color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.1); border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(224,92,92,0.1); color: var(--error); border-color: rgba(224,92,92,0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(224,92,92,0.2); }

.btn-ghost {
  background: transparent; color: var(--text-secondary); border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { color: var(--white); background: rgba(255,255,255,0.05); }

.btn-sm  { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-lg  { padding: 0.8rem 1.8rem; font-size: 0.95rem; }
.btn-icon { padding: 0.5rem; width: 36px; height: 36px; justify-content: center; }

/* ── Formulaires ─────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 0.4rem; letter-spacing: 0.02em;
}
.form-label .required { color: var(--gold-500); margin-left: 0.2rem; }

.form-control {
  width: 100%; padding: 0.65rem 0.9rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-md); color: var(--text-primary);
  font-family: var(--font-body); font-size: 0.875rem;
  transition: all var(--transition); outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }

.form-select { appearance: none; cursor: pointer; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7A99' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
}

.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.35rem; }
.form-error { font-size: 0.75rem; color: var(--error); margin-top: 0.35rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 500; }
.card-sm { padding: 1rem; border-radius: var(--radius-md); }

/* Card document / trame */
.doc-card {
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  cursor: pointer; transition: all var(--transition);
  position: relative; overflow: hidden;
}
.doc-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(to bottom, var(--gold-500), transparent);
  opacity: 0; transition: opacity var(--transition);
}
.doc-card:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.doc-card:hover::before { opacity: 1; }
.doc-card.selected { border-color: var(--gold-500); background: rgba(201,168,76,0.05); }
.doc-card.selected::before { opacity: 1; }

.doc-card-icon {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; margin-bottom: 0.75rem;
}
.doc-card-icon.pdf  { background: rgba(224,92,92,0.15); }
.doc-card-icon.docx { background: rgba(92,155,224,0.15); }
.doc-card-icon.doc  { background: rgba(92,155,224,0.15); }

.doc-card-name {
  font-size: 0.875rem; font-weight: 500; margin-bottom: 0.3rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
  flex: 1;
}

/* Flex row dans doc-card ne doit pas déborder */
.doc-card > div:first-child {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.doc-card-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ── Zone upload drag & drop ─────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg); padding: 3rem 2rem;
  text-align: center; cursor: pointer;
  transition: all var(--transition);
  background: rgba(255,255,255,0.01);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--gold-500);
  background: rgba(201,168,76,0.04);
}
.upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.upload-zone h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.upload-zone p  { font-size: 0.8rem; color: var(--text-muted); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(6,13,26,0.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--navy-700);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 640px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.25s ease;
}
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1100px; }

.modal-header {
  padding: 1.5rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: 1.15rem; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.3rem; padding: 0.2rem;
  transition: color var(--transition); line-height: 1;
}
.modal-close:hover { color: var(--white); }

.modal-body { padding: 1.5rem 1.75rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 0.75rem;
  flex-shrink: 0;
}

/* ── Stats cards (Dashboard home) ───────────────────────────*/
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.gold   { background: rgba(201,168,76,0.15); }
.stat-icon.blue   { background: rgba(92,155,224,0.15); }
.stat-icon.green  { background: rgba(76,175,133,0.15); }
.stat-icon.purple { background: rgba(156,92,224,0.15); }
.stat-value { font-size: 1.6rem; font-family: var(--font-display); font-weight: 600; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ── Viewer document avec highlights ────────────────────────*/
.doc-viewer {
  background: var(--navy-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem; line-height: 1.8;
  font-size: 0.9rem; color: var(--text-secondary);
  max-height: 500px; overflow-y: auto;
}
.doc-viewer h1, .doc-viewer h2, .doc-viewer h3 {
  color: var(--white); margin: 1.2rem 0 0.6rem;
}
.doc-viewer p { margin-bottom: 0.75rem; }

/* Highlights fluo */
.highlight-yellow { background: var(--hl-yellow); border-radius: 2px; padding: 0 2px; cursor: pointer; }
.highlight-orange { background: var(--hl-orange); border-radius: 2px; padding: 0 2px; cursor: pointer; }
.highlight-green  { background: var(--hl-green);  border-radius: 2px; padding: 0 2px; cursor: pointer; }
.highlight-blue   { background: var(--hl-blue);   border-radius: 2px; padding: 0 2px; cursor: pointer; }
.highlight-pink   { background: var(--hl-pink);   border-radius: 2px; padding: 0 2px; cursor: pointer; }

/* ── Key points liste ────────────────────────────────────── */
.key-point {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1rem 1.1rem;
  margin-bottom: 0.6rem; display: flex; gap: 0.9rem;
  animation: slideInLeft 0.3s ease both;
}
.key-point:nth-child(2) { animation-delay: 0.05s; }
.key-point:nth-child(3) { animation-delay: 0.10s; }
.key-point:nth-child(4) { animation-delay: 0.15s; }
.key-point:nth-child(5) { animation-delay: 0.20s; }

.kp-number {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; flex-shrink: 0;
  background: rgba(201,168,76,0.15); color: var(--gold-400);
  border: 1px solid rgba(201,168,76,0.25);
}
.kp-title   { font-size: 0.875rem; font-weight: 500; margin-bottom: 0.25rem; }
.kp-content { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.kp-importance { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; }
.kp-high    { color: var(--error); }
.kp-medium  { color: var(--warning); }
.kp-low     { color: var(--success); }

/* ── Missing info panel ──────────────────────────────────── */
.missing-item {
  background: rgba(232,166,76,0.06); border: 1px solid rgba(232,166,76,0.2);
  border-radius: var(--radius-md); padding: 0.85rem 1rem; margin-bottom: 0.5rem;
  display: flex; align-items: flex-start; gap: 0.75rem;
}
.missing-icon { color: var(--warning); font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.missing-field { font-size: 0.875rem; font-weight: 500; margin-bottom: 0.2rem; }
.missing-desc  { font-size: 0.78rem; color: var(--text-muted); }

/* ── Historique table ────────────────────────────────────── */
.history-table { width: 100%; border-collapse: collapse; }
.history-table th {
  text-align: left; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.history-table td {
  padding: 0.85rem 0.9rem; font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.history-table tr:hover td { background: rgba(255,255,255,0.02); }
.history-table .file-icon { font-size: 1.1rem; }

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar {
  width: 100%; height: 4px; background: var(--navy-500);
  border-radius: 2px; overflow: hidden; margin: 0.5rem 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-300));
  border-radius: 2px; transition: width 0.4s ease;
}

/* ── Stepper (wizard génération) ─────────────────────────── */
.stepper {
  display: flex; align-items: center; gap: 0; margin-bottom: 2rem;
}
.step {
  display: flex; align-items: center; flex: 1;
}
.step-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 600; flex-shrink: 0;
  border: 2px solid var(--border); color: var(--text-muted);
  background: var(--bg-surface); transition: all var(--transition);
  z-index: 1;
}
.step.active   .step-dot { border-color: var(--gold-500); color: var(--gold-500); background: rgba(201,168,76,0.1); }
.step.done     .step-dot { border-color: var(--success); color: var(--success); background: rgba(76,175,133,0.1); }
.step-line {
  flex: 1; height: 2px; background: var(--border); margin: 0 -1px;
}
.step.done ~ .step .step-line,
.step.done .step-line { background: var(--success); opacity: 0.4; }
.step-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.4rem; text-align: center; }
.step-wrap { display: flex; flex-direction: column; align-items: center; }


/* ============================================================
   CORRESPONDANCE — Styles module
   ============================================================ */

/* ── Zone de recherche initiale ─────────────────────────── */
.corr-search-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 3rem 2rem;
}
.corr-search-inner {
  text-align: center;
  max-width: 520px;
  width: 100%;
}
.corr-search-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 20px rgba(201,168,76,.4));
  animation: corr-float 3s ease-in-out infinite;
}
@keyframes corr-float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.corr-search-title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--white);
  margin: 0 0 .4rem;
}
.corr-search-sub {
  color: var(--gray-400);
  font-size: .9rem;
  margin: 0 0 1.5rem;
}
.corr-search-box { position: relative; }
.corr-search-input {
  width: 100%;
  padding: .75rem 1.1rem;
  border-radius: 12px;
  border: 1.5px solid var(--navy-500);
  background: var(--navy-800);
  color: var(--white);
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
  box-sizing: border-box;
}
.corr-search-input:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(201,168,76,.15);
}
.corr-autocomplete {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--navy-700);
  border: 1px solid var(--navy-500);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.corr-ac-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  cursor: pointer;
  transition: background .15s;
  font-size: .9rem;
}
.corr-ac-item:hover { background: var(--navy-600); }
.corr-ac-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold-400);
  color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.corr-ac-empty { padding: 1rem; color: var(--gray-500); font-size: .85rem; text-align: center; }

/* ── Header client sélectionné ──────────────────────────── */
.corr-client-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: .9rem 1.2rem;
  background: var(--navy-800);
  border-radius: var(--radius-md);
  border: 1px solid var(--navy-600);
  flex-wrap: wrap;
}
.corr-client-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--gold-400);
  color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
  flex-shrink: 0;
}
.corr-client-name { font-weight: 700; font-size: 1rem; color: var(--white); }
.corr-client-meta { font-size: .78rem; color: var(--gray-400); margin-top: .1rem; }

/* ── Grille des 4 cards ─────────────────────────────────── */
.corr-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
  margin-bottom: 2.5rem;
  padding: .25rem;
}
@media (max-width: 800px) { .corr-cards-grid { grid-template-columns: 1fr; } }

.corr-card {
  position: relative;
  background: linear-gradient(145deg, var(--navy-800) 0%, var(--navy-750, #131b27) 100%);
  border: 1.5px solid var(--navy-600);
  border-radius: 20px;
  padding: 2.2rem 2rem 1.8rem;
  cursor: pointer;
  overflow: hidden;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1),
              border-color .22s,
              box-shadow .28s;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.corr-card:hover {
  transform: scale(1.035) translateY(-3px);
  border-color: var(--gold-400);
  box-shadow: 0 0 0 1px var(--gold-400),
              0 16px 40px rgba(0,0,0,.45),
              0 0 30px rgba(201,168,76,.12);
}
.corr-card-glow {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(201,168,76,.18) 0%, transparent 70%);
  transition: opacity .28s;
  pointer-events: none;
}
.corr-card:hover .corr-card-glow { opacity: 1; }

.corr-card-icon {
  position: relative;
  color: var(--gold-400);
  margin-bottom: .4rem;
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(201,168,76,.1);
  border-radius: 14px;
  border: 1px solid rgba(201,168,76,.2);
  transition: background .28s;
}
.corr-card:hover .corr-card-icon { background: rgba(201,168,76,.18); }
.corr-card-badge {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px;
  background: var(--gold-400); color: var(--navy-900);
  border-radius: 50%; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.corr-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  font-family: var(--font-display);
  letter-spacing: .01em;
}
.corr-card-sub {
  font-size: .8rem;
  color: var(--gray-400);
  line-height: 1.4;
  flex: 1;
}
.corr-card-arrow {
  font-size: 1.1rem;
  color: var(--gold-400);
  margin-top: .4rem;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .22s, transform .22s;
}
.corr-card:hover .corr-card-arrow { opacity: 1; transform: translateX(0); }

/* ── Overlay + Modal ────────────────────────────────────── */
.corr-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 200;
  backdrop-filter: blur(3px);
}
.corr-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  width: min(700px, calc(100vw - 2rem));
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(201,168,76,.2);
}
.corr-modal-wide {
  width: min(960px, calc(100vw - 2rem));
  max-height: 94vh;
}
.corr-modal-enter {
  animation: corr-modal-pop .35s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes corr-modal-pop {
  from { transform: translate(-50%, -46%) scale(.92); opacity: 0; }
  to   { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}
.corr-modal-inner {
  background: var(--navy-800);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(201,168,76,.15);
}
.corr-modal-header {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(90deg, rgba(var(--accent-rgb, 201,168,76),.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--navy-600);
  position: relative;
  --accent: var(--gold-400);
}
.corr-modal-icon { font-size: 2rem; flex-shrink: 0; }
.corr-modal-header h3 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; color: var(--white); }
.corr-modal-header p  { margin: .15rem 0 0; font-size: .78rem; color: var(--gray-400); }
.corr-modal-close {
  margin-left: auto;
  background: none; border: none;
  color: var(--gray-400); font-size: 1.1rem;
  cursor: pointer; padding: .3rem .5rem;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.corr-modal-close:hover { background: var(--navy-600); color: var(--white); }
.corr-modal-body {
  padding: 1.4rem 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
}

/* ── Éléments dans les modals ───────────────────────────── */
.corr-section-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--gold-400);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: -.25rem;
}
.corr-hint {
  font-size: .82rem;
  color: var(--gray-400);
  margin: 0;
  line-height: 1.5;
}
.corr-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--navy-600), transparent);
  margin: .25rem 0;
}
.corr-info-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: .5rem;
}
.corr-info-label { font-size: .82rem; color: var(--gray-400); }
.corr-count {
  font-size: .68rem; padding: .1rem .45rem; border-radius: 20px;
  background: var(--navy-600); color: var(--gray-300);
  margin-left: .35rem;
}

/* ── Boutons d'action ───────────────────────────────────── */
.corr-btn-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.corr-action-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: .88rem;
  font-weight: 600;
  transition: transform .18s, box-shadow .18s, opacity .18s;
  flex: 1;
  min-width: 160px;
  justify-content: center;
}
.corr-action-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.corr-action-btn:active { transform: translateY(0); }
.corr-btn-icon { font-size: 1.1rem; }
.corr-btn-gold    { background: var(--gold-400); color: var(--navy-900); }
.corr-btn-red     { background: rgba(229,57,53,.2); color: #e57373; border: 1px solid rgba(229,57,53,.3); }
.corr-btn-outline { background: var(--navy-700); color: var(--gray-300); border: 1px solid var(--navy-500); }
.corr-btn-upload  {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.2rem;
  border-radius: 8px;
  background: rgba(201,168,76,.15);
  color: var(--gold-400);
  border: 1px solid rgba(201,168,76,.3);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: background .18s;
}
.corr-btn-upload:hover { background: rgba(201,168,76,.25); }

/* ── Zone de dépôt ──────────────────────────────────────── */
.corr-drop-zone {
  border: 2px dashed var(--navy-500);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  transition: border-color .2s, background .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
}
.corr-drop-zone.corr-drop-over {
  border-color: var(--gold-400);
  background: rgba(201,168,76,.05);
}
.corr-drop-icon  { font-size: 2rem; opacity: .6; }
.corr-drop-text  { font-weight: 600; color: var(--gray-300); font-size: .9rem; }
.corr-drop-sub   { font-size: .78rem; color: var(--gray-500); }
.corr-drop-formats { font-size: .72rem; color: var(--gray-600); margin-top: .15rem; }
.corr-progress-wrap {
  width: 100%; height: 4px;
  background: var(--navy-600);
  border-radius: 4px;
  overflow: hidden;
  margin-top: .5rem;
}
.corr-progress-bar {
  height: 100%;
  background: var(--gold-400);
  width: 0;
  transition: width .4s ease;
  border-radius: 4px;
}

/* ── Liste fichiers ─────────────────────────────────────── */
.corr-file-list {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: .25rem;
}
.corr-file-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .6rem;
  border-radius: 8px;
  background: var(--navy-700);
  transition: background .15s;
  font-size: .82rem;
}
.corr-file-row:hover { background: var(--navy-600); }
.corr-file-icon { font-size: 1rem; flex-shrink: 0; }
.corr-file-name { flex: 1; color: var(--gray-300); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.corr-file-size { color: var(--gray-500); font-size: .72rem; flex-shrink: 0; white-space: nowrap; }
.corr-file-actions { display: flex; gap: .25rem; flex-shrink: 0; }
.corr-file-btn {
  padding: .2rem .4rem; border-radius: 5px;
  background: none; border: none;
  cursor: pointer; font-size: .85rem;
  text-decoration: none;
  transition: background .15s;
  color: var(--gray-300);
}
.corr-file-btn:hover  { background: var(--navy-500); }
.corr-file-del:hover  { background: rgba(220,80,80,.2); }
.corr-empty {
  text-align: center;
  padding: 1.2rem;
  color: var(--gray-600);
  font-size: .82rem;
  font-style: italic;
}

/* ── Pièces jointes (checkbox) ──────────────────────────── */
.corr-attach-scroll {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  padding: .25rem 0;
}
.corr-attach-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem .55rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: .83rem;
  color: var(--gray-300);
  transition: background .15s;
}
.corr-attach-item:hover { background: var(--navy-700); }
.corr-attach-chk { accent-color: var(--gold-400); width: 14px; height: 14px; flex-shrink: 0; }
.corr-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ── Bouton Dossier Client ──────────────────────────────── */
.client-folder-btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .65rem 1.8rem;
  border-radius: 40px;
  border: 1.5px solid rgba(201,168,76,.35);
  background: linear-gradient(135deg, rgba(201,168,76,.1) 0%, rgba(201,168,76,.04) 100%);
  color: var(--gold-400);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .03em;
  cursor: pointer;
  transition: all .25s cubic-bezier(.34,1.4,.64,1);
  position: relative;
  box-shadow: 0 2px 12px rgba(201,168,76,.1);
}
.client-folder-btn:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: var(--gold-400);
  background: linear-gradient(135deg, rgba(201,168,76,.18) 0%, rgba(201,168,76,.08) 100%);
  box-shadow: 0 6px 24px rgba(201,168,76,.2);
}
.client-folder-btn-icon { font-size: 1.2rem; }
.client-folder-btn-badge {
  background: var(--gold-400);
  color: var(--navy-900);
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
  display: none;
}
.client-folder-btn-badge:not(:empty) { display: inline-block; }

/* ── Modal Dossier Client ───────────────────────────────── */
.dossier-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 300;
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.dossier-modal {
  background: var(--navy-800);
  border-radius: 20px;
  border: 1px solid rgba(201,168,76,.2);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  width: min(700px, 100%);
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: dossier-pop .3s cubic-bezier(.34,1.5,.64,1) forwards;
}
@keyframes dossier-pop {
  from { transform: scale(.88) translateY(20px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}
.dossier-header {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--navy-600);
  background: linear-gradient(90deg, rgba(201,168,76,.07), transparent);
  flex-shrink: 0;
}
.dossier-header-icon { font-size: 1.6rem; }
.dossier-header h3 { margin: 0; font-family: var(--font-display); font-size: 1.1rem; color: var(--white); flex: 1; }
.dossier-header-sub { font-size: .75rem; color: var(--gray-400); }
.dossier-close {
  background: none; border: none; color: var(--gray-400);
  font-size: 1.1rem; cursor: pointer; padding: .3rem .5rem;
  border-radius: 6px; transition: background .15s, color .15s;
}
.dossier-close:hover { background: var(--navy-600); color: var(--white); }

.dossier-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Carousel des dossiers ───────────────────────────────── */
.dossier-carousel-wrap {
  padding: 1.2rem 1.5rem 1.4rem;
  border-bottom: 1px solid var(--navy-600);
  flex-shrink: 0;
  overflow: visible;
}
.dossier-carousel-label {
  font-size: .7rem; font-weight: 700; color: var(--gold-400);
  text-transform: uppercase; letter-spacing: .07em; margin-bottom: .9rem;
}
.dossier-carousel {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: visible;
  padding: .5rem .25rem 1rem;
  scroll-behavior: smooth;
}
.dossier-carousel::-webkit-scrollbar { height: 4px; }
.dossier-carousel::-webkit-scrollbar-track { background: var(--navy-700); border-radius: 4px; }
.dossier-carousel::-webkit-scrollbar-thumb { background: var(--navy-500); border-radius: 4px; }

.dossier-folder-card {
  flex-shrink: 0;
  width: 110px;
  text-align: center;
  cursor: pointer;
  position: relative;
}
.dossier-folder-card.active .dossier-folder-icon {
  border-color: var(--gold-400);
  background: rgba(201,168,76,.15);
  box-shadow: 0 0 0 2px rgba(201,168,76,.3);
}
.dossier-folder-card.active .dossier-folder-name { color: var(--gold-400); }

.dossier-folder-icon {
  width: 72px; height: 72px;
  margin: 0 auto .45rem;
  border-radius: 16px;
  border: 1.5px solid var(--navy-500);
  background: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  transition: all .22s cubic-bezier(.34,1.4,.64,1);
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.dossier-folder-card:hover .dossier-folder-icon {
  transform: translateY(-6px) scale(1.08);
  border-color: var(--gold-400);
  background: rgba(201,168,76,.12);
  box-shadow: 0 8px 24px rgba(201,168,76,.18);
}
.dossier-folder-count {
  position: absolute; top: -6px; right: -6px;
  background: var(--gold-400); color: var(--navy-900);
  font-size: .62rem; font-weight: 700;
  padding: .1rem .35rem; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.dossier-folder-name {
  font-size: .75rem; color: var(--gray-300); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0 .25rem;
  transition: color .15s;
}
.dossier-folder-actions {
  display: flex; gap: .2rem; justify-content: center; margin-top: .3rem;
  opacity: 0; transition: opacity .15s;
}
.dossier-folder-card:hover .dossier-folder-actions { opacity: 1; }
.dossier-folder-act-btn {
  background: var(--navy-700); border: 1px solid var(--navy-500);
  border-radius: 5px; padding: .1rem .3rem;
  font-size: .7rem; cursor: pointer; color: var(--gray-400);
  transition: background .15s, color .15s;
}
.dossier-folder-act-btn:hover { background: var(--navy-600); color: var(--white); }

.dossier-new-folder {
  flex-shrink: 0;
  width: 90px;
  text-align: center;
  cursor: pointer;
}
.dossier-new-folder-icon {
  width: 72px; height: 72px;
  margin: 0 auto .45rem;
  border-radius: 16px;
  border: 1.5px dashed var(--navy-500);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--gray-500);
  transition: all .2s;
}
.dossier-new-folder:hover .dossier-new-folder-icon {
  border-color: var(--gold-400); color: var(--gold-400);
  background: rgba(201,168,76,.06);
  transform: translateY(-2px);
}
.dossier-new-folder span { font-size: .72rem; color: var(--gray-500); }
.dossier-new-folder:hover span { color: var(--gold-400); }

/* ── Contenu du dossier ─────────────────────────────────── */
.dossier-content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem 1.5rem;
}
.dossier-content-empty {
  text-align: center; padding: 3rem 1rem;
  color: var(--gray-500); font-size: .85rem;
}
.dossier-content-empty .dossier-empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .5; }

.dossier-content-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .85rem; flex-wrap: wrap; gap: .5rem;
}
.dossier-content-title {
  font-size: .75rem; font-weight: 700; color: var(--gold-400);
  text-transform: uppercase; letter-spacing: .07em;
}
.dossier-upload-label {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .85rem;
  border-radius: 8px;
  background: rgba(201,168,76,.12);
  border: 1px solid rgba(201,168,76,.25);
  color: var(--gold-400); font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.dossier-upload-label:hover { background: rgba(201,168,76,.22); }

.dossier-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
}
.dossier-file-thumb {
  background: var(--navy-700);
  border: 1px solid var(--navy-600);
  border-radius: 12px;
  padding: .85rem .7rem .65rem;
  text-align: center;
  cursor: default;
  transition: border-color .18s, background .18s;
  position: relative;
  overflow: hidden;
}
.dossier-file-thumb:hover { border-color: rgba(201,168,76,.4); background: var(--navy-600); }
.dossier-file-thumb-icon { font-size: 2.2rem; margin-bottom: .35rem; display: block; }
.dossier-file-thumb-name {
  font-size: .72rem; color: var(--gray-300); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dossier-file-thumb-size { font-size: .65rem; color: var(--gray-500); margin-top: .1rem; }
.dossier-file-thumb-actions {
  position: absolute; inset: 0;
  background: rgba(13,17,23,.85);
  display: flex; align-items: center; justify-content: center;
  gap: .5rem;
  opacity: 0; transition: opacity .18s;
  border-radius: 12px;
}
.dossier-file-thumb:hover .dossier-file-thumb-actions { opacity: 1; }
.dossier-thumb-btn {
  background: var(--navy-700); border: 1px solid var(--navy-500);
  border-radius: 8px; padding: .35rem .55rem;
  font-size: .9rem; cursor: pointer; color: var(--white);
  text-decoration: none; transition: background .15s;
}
.dossier-thumb-btn:hover { background: var(--navy-500); }
.dossier-thumb-del:hover { background: rgba(220,80,80,.3); }

.dossier-drop-overlay {
  position: absolute; inset: 0;
  background: rgba(201,168,76,.1);
  border: 2px dashed var(--gold-400);
  border-radius: 12px;
  display: none; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700; color: var(--gold-400);
  z-index: 10;
}
.dossier-content-area.drag-active .dossier-drop-overlay { display: flex; }

/* ── Sélecteur de trame dans modal courrier ─────────────── */
.corr-trame-select-wrap {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.corr-trame-select {
  width: 100%;
  padding: .6rem .9rem;
  border-radius: 10px;
  border: 1.5px solid var(--navy-500);
  background: var(--navy-700);
  color: var(--white);
  font-size: .9rem;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c9a84c' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .85rem center;
  padding-right: 2.2rem;
}
.corr-trame-select:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(201,168,76,.15);
}
.corr-trame-select option { background: var(--navy-700); }

.corr-trame-preview {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .75rem;
  background: rgba(201,168,76,.08);
  border: 1px solid rgba(201,168,76,.2);
  border-radius: 8px;
  font-size: .8rem;
}
.corr-trame-preview.hidden { display: none; }
.corr-trame-tag {
  color: var(--gold-400);
  font-weight: 600;
}
.corr-trame-desc {
  color: var(--gray-400);
  font-style: italic;
}

/* ── Statut génération ──────────────────────────────────── */
.corr-gen-status {
  padding: .55rem .9rem;
  border-radius: 8px;
  font-size: .84rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .25rem;
}
.corr-gen-status.hidden { display: none; }
.corr-gen-loading {
  background: rgba(201,168,76,.1);
  border: 1px solid rgba(201,168,76,.2);
  color: var(--gold-400);
}
.corr-gen-success {
  background: rgba(76,175,133,.12);
  border: 1px solid rgba(76,175,133,.25);
  color: #4caf85;
}
.corr-gen-error {
  background: rgba(229,57,53,.1);
  border: 1px solid rgba(229,57,53,.2);
  color: #e57373;
}
.corr-gen-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(201,168,76,.3);
  border-top-color: var(--gold-400);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Boutons désactivés ─────────────────────────────────── */
.corr-action-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ══════════════════════════════════════════════════════════
   LAYOUTS ADAPTATIFS — Classes remplaçant les styles inline
   ══════════════════════════════════════════════════════════ */

/* Clients : liste + fiche */
.layout-clients-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* Analyse : deux colonnes */
.layout-analyze {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Deux colonnes génériques */
.layout-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Documents grid */
.layout-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* Templates grid */
.layout-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

/* Generate listes docs/trames */
.layout-gen-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  max-height: 380px;
  overflow-y: auto;
}

/* ══════════════════════════════════════════════════════════
   CORRECTIONS OVERFLOW GLOBAL
   ══════════════════════════════════════════════════════════ */
html, body {
  max-width: 100vw;
  overflow-x: hidden !important;
}

/* Empêcher tout débordement horizontal */
#dashboard-page, .main-content, .page-body, .page-header {
  max-width: 100%;
  box-sizing: border-box;
}

/* Tous les éléments ne doivent pas dépasser leur conteneur */
img, video, iframe, table {
  max-width: 100%;
}

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

  /* ── Sidebar cachée, header mobile visible ────────────── */
  .sidebar { display: none !important; }

  /* Header mobile toujours visible sur mobile */
  .mobile-header {
    display: flex !important;
    position: fixed !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    height: 56px !important;
    z-index: 100 !important;
  }

  .drawer-overlay {
    display: block !important;
    pointer-events: none; /* inactif par défaut */
  }
  .drawer-overlay.active {
    pointer-events: all; /* actif seulement quand le drawer est ouvert */
  }

  #dashboard-page {
    flex-direction: column !important;
    height: 100vh !important;
    overflow-x: hidden !important;
    width: 100vw !important;
  }
  .main-content {
    margin-top: 56px !important;
    height: calc(100vh - 56px) !important;
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }
  /* Empêcher tout élément de dépasser */
  .view, .page-body, .page-header, .card {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* ── Layouts principaux → 1 colonne ───────────────────── */
  .layout-clients-grid { grid-template-columns: 1fr !important; }
  /* ── Vue Analyser ────────────────────────────────────────── */
  .layout-analyze      { grid-template-columns: 1fr !important; }
  #analyze-layout      { grid-template-columns: 1fr !important; }

  /* Toute la vue analyser */
  #view-analyze        { overflow-x: hidden !important; max-width: 100vw !important; }

  /* Doc cards dans la liste analyser */
  #analyze-doc-list,
  #analyze-doc-list .doc-card,
  #analyze-doc-list > div,
  #analyze-doc-list button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* Analyse IA card */
  #analyze-action-card,
  #analyze-empty-state,
  #analyze-results {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* Titre du doc tronqué proprement */
  .doc-card-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Doc viewer */
  #doc-viewer-card,
  .doc-viewer {
    max-width: 100% !important;
    overflow-x: hidden !important;
    word-break: break-word !important;
  }

  /* Analyse IA card */
  #analyze-action-card {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Résultats analyse */
  #analyze-results {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
  #analyze-results * {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .layout-two-col      { grid-template-columns: 1fr !important; }
  .layout-docs-grid    { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important; }
  .layout-tpl-grid     { grid-template-columns: 1fr !important; }
  .layout-gen-list     { grid-template-columns: 1fr !important; max-height: 260px !important; }

  /* ── Stats grid → 2 colonnes ──────────────────────────── */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
  }

  /* ── Page header ──────────────────────────────────────── */
  .page-header {
    padding: 1rem !important;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .page-header h1 { font-size: 1.2rem !important; }
  .page-header > div:last-child { width: 100%; }

  /* ── Page body ────────────────────────────────────────── */
  .page-body {
    padding: 0.85rem !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* Layout analyze */
  .layout-analyze,
  #analyze-layout {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    grid-template-columns: 1fr !important;
  }

  /* ── Boutons header ───────────────────────────────────── */
  .page-header .btn { font-size: 0.8rem; padding: 0.45rem 0.75rem; }

  /* ── Cards ────────────────────────────────────────────── */
  .card { padding: 1rem !important; }

  /* ── Modals ───────────────────────────────────────────── */
  .modal-overlay { padding: 0 !important; align-items: flex-end !important; }
  .modal-content {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 90vh !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  }
  .modal-lg, .modal-xl {
    max-width: 100vw !important;
    width: 100vw !important;
  }

  /* ── Correspondance modals ────────────────────────────── */
  .corr-modal,
  .corr-modal-wide {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important; right: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: calc(100vh - 56px) !important;
    max-height: calc(100vh - 56px) !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
  }

  /* ── Formulaires ──────────────────────────────────────── */
  .form-row,
  .form-group-row { flex-direction: column !important; gap: 0.75rem !important; }
  .form-group { width: 100% !important; }

  /* ── Boutons actions ──────────────────────────────────── */
  .corr-btn-row { flex-direction: column !important; gap: 0.6rem !important; }
  .corr-action-btn { width: 100% !important; }

  /* ── Wizard generate ──────────────────────────────────── */
  .gen-wizard-steps {
    overflow-x: auto !important;
    padding-bottom: 0.5rem;
    gap: 0.5rem !important;
  }
  .gen-step-indicator { min-width: 60px; font-size: 0.7rem; }

  /* ── Tables scrollables ───────────────────────────────── */
  .history-table-wrap,
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .history-table { min-width: 500px; }

  /* ── Doc viewer ───────────────────────────────────────── */
  .doc-viewer { font-size: 0.85rem !important; }

  /* ── Input search ─────────────────────────────────────── */
  .form-control { font-size: 16px !important; } /* évite zoom iOS */

  /* ── Toasts ───────────────────────────────────────────── */
  #toast-container {
    bottom: 1rem !important;
    left: 0.75rem !important; right: 0.75rem !important;
    align-items: stretch !important;
  }
  .toast { min-width: unset !important; max-width: unset !important; width: 100%; }

  /* ── Dossier carousel ─────────────────────────────────── */
  .dossier-carousel-wrap { padding-bottom: 0.5rem; }

  /* ── Login ────────────────────────────────────────────── */
  .login-card { padding: 1.75rem 1.25rem; margin: 0.75rem; }
  .login-logo h1 { font-size: 1.5rem; }
}

/* ── Tablette 769-1024px ──────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .layout-clients-grid { grid-template-columns: 260px 1fr; }
  .page-body { padding: 1.25rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .layout-docs-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}
