/* ─── RESET & BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:        #B8960C;
  --gold-dark:   #8B6914;
  --gold-light:  #F5E9C0;
  --gold-pale:   #FAF5E4;
  --noir:        #0E0E0E;
  --gris-1:      #1C1C1C;
  --gris-2:      #2A2A2A;
  --gris-3:      #444;
  --gris-text:   #666;
  --gris-border: #E2DDD5;
  --gris-bg:     #F7F5F2;
  --blanc:       #FFFFFF;
  --success:     #2D6A4F;
  --success-bg:  #EAF5EE;
  --danger:      #8B2020;
  --danger-bg:   #FFF0F0;
  --sidebar-w:   240px;
  --radius:      6px;
  --radius-lg:   10px;
  --shadow:      0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
}

html, body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--noir);
  background: var(--gris-bg);
  -webkit-font-smoothing: antialiased;
}

/* ─── SCREENS ───────────────────────────────────────────────────────────────── */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

/* ─── ÉCRAN LOGIN ───────────────────────────────────────────────────────────── */
.login-bg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gris-bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(184,150,12,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(184,150,12,0.04) 0%, transparent 50%);
  padding: 2rem;
}

.login-card {
  background: var(--blanc);
  border: 1px solid var(--gris-border);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.brand-block { text-align: center; margin-bottom: 2.5rem; }

.brand-cabinet-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px; font-weight: 600; letter-spacing: 0.5px;
  color: var(--gold-dark); text-align: center; line-height: 1.35;
  margin-bottom: 0.75rem;
}

.brand-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 32px; font-weight: 500; letter-spacing: 0.5px;
  color: var(--noir);
  line-height: 1;
}
.brand-cabinet {
  font-size: 10px; font-weight: 500; letter-spacing: 3px;
  color: var(--gold-dark); margin-top: 6px;
  text-transform: uppercase;
}
.brand-sep {
  width: 32px; height: 1px;
  background: var(--gold);
  margin: 14px auto;
}
.brand-subtitle {
  font-size: 12px; color: var(--gris-text);
}

.login-form { display: flex; flex-direction: column; gap: 1rem; }

.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: 11px; font-weight: 500;
  color: var(--gris-3); letter-spacing: 0.3px;
  text-transform: uppercase;
}
.label-opt { font-weight: 400; color: var(--gris-text); text-transform: none; letter-spacing: 0; font-size: 11px; }

.field-input, .field-textarea, select.field-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gris-border);
  border-radius: var(--radius);
  font-size: 13px; font-family: 'Inter', sans-serif;
  color: var(--noir);
  background: var(--blanc);
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus, .field-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,150,12,0.10);
}
.field-textarea { height: 80px; resize: vertical; }

.login-error {
  font-size: 12px; color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius);
  padding: 8px 12px;
  display: none;
}
.login-error.visible { display: block; }

.login-note { font-size: 11px; color: var(--gris-text); text-align: center; margin-top: 4px; }

/* ─── BOUTONS ───────────────────────────────────────────────────────────────── */
.btn-gold {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--gold-dark); color: var(--blanc);
  border: none; border-radius: var(--radius);
  padding: 9px 20px; font-size: 13px; font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-gold:hover { background: #6d5110; }
.btn-gold:active { transform: scale(0.98); }
.btn-full { width: 100%; justify-content: center; padding: 11px 20px; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; color: var(--gris-3);
  border: 1px solid var(--gris-border); border-radius: var(--radius);
  padding: 8px 16px; font-size: 13px; font-family: 'Inter', sans-serif;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn-outline:hover { background: var(--gris-bg); border-color: var(--gris-3); }

.btn-logout {
  background: none; border: none; padding: 6px;
  color: var(--gris-text); cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
.btn-logout:hover { color: var(--danger); background: var(--danger-bg); }

.spinner {
  width: 16px; height: 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* ─── APP LAYOUT ────────────────────────────────────────────────────────────── */
#screen-app { flex-direction: row; }

/* ─── SIDEBAR ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--blanc);
  border-right: 1px solid var(--gris-border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--gris-border);
}
.sidebar-cabinet-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
  color: var(--gold-dark); line-height: 1.4;
}
.sidebar-appname {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px; font-weight: 500; color: var(--noir);
  line-height: 1.1;
}
.sidebar-cabinet {
  font-size: 8px; font-weight: 500; letter-spacing: 2px;
  color: var(--gold-dark); text-transform: uppercase;
}

.sidebar-nav {
  flex: 1; padding: 1rem 0.75rem;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px; color: var(--gris-3);
  background: none; border: none; cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.12s, color 0.12s;
  text-align: left;
}
.nav-item:hover { background: var(--gris-bg); color: var(--noir); }
.nav-item.active { background: var(--gold-pale); color: var(--gold-dark); font-weight: 500; }
.nav-item.active svg { stroke: var(--gold-dark); }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--gris-border);
  display: flex; align-items: center; gap: 8px;
}
.user-chip { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold-pale); color: var(--gold-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; flex-shrink: 0;
}
.user-info { min-width: 0; }
.user-name { font-size: 12px; font-weight: 500; color: var(--noir); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--gris-text); text-transform: capitalize; }

/* ─── MAIN CONTENT ──────────────────────────────────────────────────────────── */
.main-content {
  flex: 1; overflow-y: auto;
  padding: 2rem 2.5rem;
  position: relative;
}

.view { display: none; }
.view.active { display: block; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 2rem;
}
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-weight: 400; color: var(--noir);
}
.page-subtitle { font-size: 13px; color: var(--gris-text); margin-top: 2px; }

/* ─── DOC TYPE CARDS ────────────────────────────────────────────────────────── */
.doc-types-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.doc-type-card {
  background: var(--blanc);
  border: 1px solid var(--gris-border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.25rem;
  cursor: pointer;
  display: flex; align-items: center; gap: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.doc-type-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 16px rgba(184,150,12,0.12);
  transform: translateY(-1px);
}
.doc-type-card.disabled { cursor: default; }
.doc-type-card.disabled:hover { border-color: var(--gris-border); box-shadow: none; transform: none; }

.doc-type-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  background: var(--gold-pale);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--gold-dark);
}
.doc-type-info { flex: 1; }
.doc-type-name { font-size: 14px; font-weight: 500; color: var(--noir); margin-bottom: 3px; }
.doc-type-desc { font-size: 12px; color: var(--gris-text); line-height: 1.4; }
.doc-type-arrow { font-size: 16px; color: var(--gris-text); transition: color 0.15s; }
.doc-type-card:hover .doc-type-arrow { color: var(--gold-dark); }

.badge-soon {
  font-size: 10px; font-weight: 500; letter-spacing: 0.5px;
  background: var(--gris-bg); color: var(--gris-text);
  border: 1px solid var(--gris-border); border-radius: 99px;
  padding: 3px 10px; white-space: nowrap;
}

/* ─── WIZARD ────────────────────────────────────────────────────────────────── */
.wizard-steps {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 2rem;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--gris-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: var(--gris-text);
  background: var(--blanc);
  transition: all 0.2s;
}
.step-label { font-size: 12px; color: var(--gris-text); transition: color 0.2s; }
.wizard-step.active .step-num {
  background: var(--gold-dark); color: var(--blanc);
  border-color: var(--gold-dark);
}
.wizard-step.active .step-label { color: var(--noir); font-weight: 500; }
.wizard-step.done .step-num {
  background: var(--success-bg); color: var(--success);
  border-color: var(--success);
}
.wizard-connector {
  flex: 1; height: 1px; background: var(--gris-border); margin: 0 12px;
}

.wizard-page { display: none; }
.wizard-page.active { display: block; }

.section-block {
  background: var(--blanc); border: 1px solid var(--gris-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}
.section-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.8px;
  color: var(--gris-3); text-transform: uppercase; margin-bottom: 1rem;
}

.radio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radio-card input[type=radio] { display: none; }
.radio-card-body {
  border: 1px solid var(--gris-border); border-radius: var(--radius);
  padding: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--gris-3);
  transition: border-color 0.15s, background 0.15s;
  background: var(--blanc);
}
.radio-card-body:hover { border-color: var(--gold); background: var(--gold-pale); color: var(--gold-dark); }
.radio-card input:checked + .radio-card-body {
  border-color: var(--gold-dark); background: var(--gold-pale);
  color: var(--gold-dark); font-weight: 500;
}
.radio-card input:checked + .radio-card-body svg { stroke: var(--gold-dark); }

.avocat-list { display: flex; flex-direction: column; gap: 6px; }
.avocat-item input[type=radio] { display: none; }
.avocat-item-body {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--gris-border); cursor: pointer;
  font-size: 13px; color: var(--gris-3);
  transition: border-color 0.15s, background 0.15s;
  background: var(--blanc);
}
.avocat-item-body:hover { border-color: var(--gold); background: var(--gold-pale); color: var(--gold-dark); }
.avocat-item input:checked + .avocat-item-body {
  border-color: var(--gold-dark); background: var(--gold-pale);
  color: var(--gold-dark); font-weight: 500;
}
.avocat-disabled { pointer-events: none; }
.avocat-disabled .avocat-item-body {
  opacity: 0.4; cursor: not-allowed;
  background: var(--gris-bg);
}
.avocat-disabled .avocat-avatar { background: var(--gris-border); color: var(--gris-text); }
.avocat-soon {
  margin-left: auto; font-size: 10px; font-weight: 500;
  color: var(--gris-text); background: var(--gris-bg);
  border: 1px solid var(--gris-border); border-radius: 99px;
  padding: 2px 8px; white-space: nowrap;
}

.avocat-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold-light); color: var(--gold-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
  font-family: 'Cormorant Garamond', serif;
}

.wizard-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1.5rem;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full-width { grid-column: span 2; }

/* ─── DROP ZONE ──────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--gris-border);
  border-radius: var(--radius-lg);
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone.dragover { border-color: var(--gold); background: var(--gold-pale); }
.drop-zone-inner {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px;
  padding: 2rem 1rem; text-align: center;
}
.drop-icon { color: var(--gold-dark); opacity: 0.7; }
.drop-text { font-size: 13px; font-weight: 500; color: var(--gris-3); }
.drop-subtext { font-size: 11px; color: var(--gris-text); }

.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--gris-bg);
  border-radius: var(--radius);
}
.file-item-icon { color: var(--gold-dark); }
.file-item-num  { font-size: 12px; font-weight: 600; color: var(--gold-dark); margin-right: 4px; }
.file-item-name { flex: 1; font-size: 12px; color: var(--noir); }
.file-item-size { font-size: 11px; color: var(--gris-text); }
.file-item-del {
  background: none; border: none; cursor: pointer;
  color: var(--gris-text); padding: 2px 4px; border-radius: 3px;
  font-size: 16px; line-height: 1;
  transition: color 0.12s;
}
.file-item-del:hover { color: var(--danger); }

/* ─── RÉSULTAT ──────────────────────────────────────────────────────────────── */
.result-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.result-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--success-bg); color: var(--success);
  font-size: 12px; font-weight: 500;
  padding: 6px 12px; border-radius: 99px;
}
.result-actions { display: flex; gap: 8px; }

.result-notice {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--gold-pale); border: 1px solid var(--gold-light);
  border-radius: var(--radius); padding: 10px 14px;
  font-size: 12px; color: var(--gold-dark); margin-bottom: 1rem;
  line-height: 1.5;
}

.result-preview {
  background: var(--blanc); border: 1px solid var(--gris-border);
  border-radius: var(--radius-lg); padding: 2rem 2.5rem;
  font-size: 13px; line-height: 1.8; color: var(--noir);
  white-space: pre-wrap; word-break: break-word;
  max-height: 500px; overflow-y: auto;
  font-family: 'Cormorant Garamond', serif; font-size: 15px;
}

/* ─── GENERATING OVERLAY ─────────────────────────────────────────────────────── */
.generating-overlay {
  position: absolute; inset: 0;
  background: rgba(247,245,242,0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; border-radius: var(--radius-lg);
}
.generating-card {
  background: var(--blanc); border: 1px solid var(--gris-border);
  border-radius: var(--radius-lg); padding: 2.5rem 3rem;
  text-align: center; box-shadow: var(--shadow-md);
}
.generating-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--gold-light);
  border-top-color: var(--gold-dark);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
.generating-title { font-size: 15px; font-weight: 500; color: var(--noir); margin-bottom: 4px; }
.generating-sub { font-size: 12px; color: var(--gris-text); }

/* ─── HISTORIQUE ────────────────────────────────────────────────────────────── */
.histo-empty {
  text-align: center; padding: 3rem 1rem;
  color: var(--gris-text); font-size: 13px;
}
.histo-empty svg { display: block; margin: 0 auto 1rem; opacity: 0.3; }
.histo-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.histo-table th {
  background: var(--gris-bg); padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  color: var(--gris-3); text-transform: uppercase;
  border-bottom: 1px solid var(--gris-border);
}
.histo-table td { padding: 12px 14px; border-bottom: 1px solid var(--gris-border); color: var(--noir); vertical-align: middle; }
.histo-table tr:last-child td { border-bottom: none; }
.histo-table tr:hover td { background: var(--gris-bg); }
.histo-type-badge {
  font-size: 11px; font-weight: 500; padding: 3px 10px;
  border-radius: 99px; white-space: nowrap;
}
.badge-cra      { background: #e8f4fd; color: #1a6fa8; }
.badge-cre      { background: #f0e6fa; color: #6b35a8; }
.badge-comm     { background: #fff3e0; color: #a85e1a; }
.badge-bord     { background: #e8f5e9; color: #2d7a3a; }

/* ─── SOUS-WIZARD CR AUDIENCE ───────────────────────────────────────────────── */
.sub-steps {
  display: flex; align-items: center; margin-bottom: 1.5rem;
  overflow-x: auto; padding-bottom: 4px;
}
.sub-step-item {
  display: flex; align-items: center; gap: 7px;
  white-space: nowrap; flex-shrink: 0;
}
.sub-step-num {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--gris-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: var(--gris-text);
  background: var(--blanc); transition: all 0.2s; flex-shrink: 0;
}
.sub-step-lbl { font-size: 12px; color: var(--gris-text); transition: color 0.2s; }
.sub-step-item.active .sub-step-num { background: var(--gold-dark); color: var(--blanc); border-color: var(--gold-dark); }
.sub-step-item.active .sub-step-lbl { color: var(--noir); font-weight: 500; }
.sub-step-item.done .sub-step-num { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.sub-step-conn { flex: 1; min-width: 20px; height: 1px; background: var(--gris-border); margin: 0 8px; }

.cra-step { display: none; }
.cra-step.active { display: block; }

.upload-mini { margin-top: 4px; }

/* ─── ADMIN TABLE ───────────────────────────────────────────────────────────── */
.table-wrap { background: var(--blanc); border: 1px solid var(--gris-border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.5rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--gris-bg); padding: 10px 14px;
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  color: var(--gris-3); text-transform: uppercase;
  border-bottom: 1px solid var(--gris-border);
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--gris-border); color: var(--noir); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gris-bg); }
.role-badge { font-size: 10px; padding: 2px 8px; border-radius: 99px; font-weight: 500; }
.role-admin { background: var(--gold-pale); color: var(--gold-dark); }
.role-collaborateur { background: var(--gris-bg); color: var(--gris-3); border: 1px solid var(--gris-border); }

.add-user-form { background: var(--blanc); border: 1px solid var(--gris-border); border-radius: var(--radius-lg); padding: 1.5rem; }

/* ─── DASHBOARD CATÉGORIES ──────────────────────────────────────────────────── */
.cat-grid {
  display: flex; flex-direction: column; gap: 12px;
}
.cat-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--blanc); border: 1px solid var(--gris-border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.cat-card:hover { border-color: var(--gold); box-shadow: 0 2px 12px rgba(180,148,72,.12); }
.cat-icon { flex-shrink: 0; color: var(--gold-dark); }
.cat-info { flex: 1; }
.cat-name { font-size: 15px; font-weight: 600; color: var(--gris-1); margin-bottom: 3px; }
.cat-desc { font-size: 12px; color: var(--gris-text); }
.cat-arrow { font-size: 18px; color: var(--gris-3); flex-shrink: 0; }

.subtype-list { display: flex; flex-direction: column; gap: 8px; }
.subtype-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--blanc); border: 1px solid var(--gris-border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.subtype-card:hover { border-color: var(--gold); box-shadow: 0 2px 8px rgba(180,148,72,.1); }
.subtype-info { flex: 1; }
.subtype-name { font-size: 14px; font-weight: 600; color: var(--gris-1); margin-bottom: 2px; }
.subtype-desc { font-size: 12px; color: var(--gris-text); }

.selected-type-display {
  display: flex; align-items: center; gap: 12px;
  background: var(--gold-pale); border: 1px solid var(--gold);
  border-radius: var(--radius); padding: 14px 18px;
  font-size: 14px; font-weight: 600; color: var(--gris-1);
}
.selected-type-display svg { flex-shrink: 0; stroke: var(--gold-dark); }
.selected-type-display span { flex: 1; }
.btn-change-type {
  background: none; border: 1px solid var(--gold); border-radius: var(--radius);
  padding: 5px 12px; font-size: 12px; color: var(--gold-dark); cursor: pointer;
  font-family: 'Inter', sans-serif; font-weight: 500; white-space: nowrap;
  transition: background 0.15s;
}
.btn-change-type:hover { background: var(--gold-pale); }

.domain-card { gap: 14px; }
.domain-icon { font-size: 24px; flex-shrink: 0; }

.btn-back {
  background: none; border: 1px solid var(--gris-border); border-radius: var(--radius);
  padding: 6px 12px; font-size: 18px; cursor: pointer; color: var(--gris-text);
  transition: border-color 0.15s; line-height: 1;
}
.btn-back:hover { border-color: var(--gold); color: var(--gold-dark); }

/* ─── ASSISTANT NEO ──────────────────────────────────────────────────────────── */
#neo-widget {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}

#neo-toggle {
  display: flex; align-items: center; gap: 8px;
  background: var(--gold-dark); color: #fff;
  border: none; border-radius: 99px;
  padding: 12px 20px 12px 16px;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 16px rgba(140,110,50,.35);
  transition: background 0.15s, transform 0.15s;
  position: relative;
}
#neo-toggle:hover { background: #a07820; transform: translateY(-1px); }
#neo-toggle svg { stroke: #fff; }

.neo-badge {
  position: absolute; top: -4px; right: -4px;
  background: #e53e3e; color: #fff; border-radius: 99px;
  font-size: 10px; font-weight: 700; min-width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.neo-panel {
  width: 360px; height: 520px;
  background: var(--blanc); border: 1px solid var(--gris-border);
  border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,.14);
  display: flex; flex-direction: column; overflow: hidden;
}
.neo-panel.hidden { display: none; }

.neo-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--gris-border);
  background: var(--blanc);
}
.neo-header-info { display: flex; align-items: center; gap: 10px; }
.neo-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gold-dark); color: #fff;
  font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.neo-name { font-size: 14px; font-weight: 600; color: var(--gris-1); }
.neo-status { font-size: 11px; color: var(--gris-text); }

.neo-action-btn {
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--gris-text); border-radius: 6px; transition: background 0.12s;
}
.neo-action-btn:hover { background: var(--gris-bg); color: var(--gris-1); }

.neo-messages {
  flex: 1; overflow-y: auto; padding: 16px; display: flex;
  flex-direction: column; gap: 10px;
}
.neo-msg { display: flex; }
.neo-msg-user { justify-content: flex-end; }
.neo-msg-assistant { justify-content: flex-start; }

.neo-bubble {
  max-width: 82%; padding: 10px 14px;
  border-radius: 14px; font-size: 13px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.neo-msg-user .neo-bubble {
  background: var(--gold-dark); color: #fff;
  border-bottom-right-radius: 4px;
}
.neo-msg-assistant .neo-bubble {
  background: var(--gris-bg); color: var(--gris-1);
  border-bottom-left-radius: 4px;
}
.neo-bubble-typing { opacity: 0.6; font-style: italic; }

.neo-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 14px; border-top: 1px solid var(--gris-border);
}
.neo-input {
  flex: 1; border: 1px solid var(--gris-border); border-radius: 10px;
  padding: 9px 12px; font-size: 13px; font-family: 'Inter', sans-serif;
  resize: none; outline: none; line-height: 1.4; max-height: 120px;
  transition: border-color 0.15s; color: var(--gris-1); background: var(--blanc);
}
.neo-input:focus { border-color: var(--gold); }
.neo-send {
  background: var(--gold-dark); border: none; border-radius: 10px;
  width: 38px; height: 38px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.neo-send:hover { background: #a07820; }
.neo-send svg { stroke: #fff; }
.neo-send:disabled { background: var(--gris-border); cursor: not-allowed; }
.neo-send:disabled svg { stroke: var(--gris-text); }

/* ─── MOBILE BOTTOM NAV ─────────────────────────────────────────────────────── */
.mobile-bottom-nav { display: none; }

/* ─── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Masquer la sidebar, afficher la barre du bas */
  .sidebar { display: none; }

  .mobile-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--blanc);
    border-top: 1px solid var(--gris-border);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mob-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    gap: 3px; padding: 10px 4px 8px;
    background: none; border: none; cursor: pointer;
    font-size: 10px; color: var(--gris-text);
    font-family: 'Inter', sans-serif; font-weight: 500;
    transition: color 0.15s;
  }
  .mob-nav-item.active { color: var(--gold-dark); }
  .mob-nav-item.active svg { stroke: var(--gold-dark); }

  /* Main content plein écran avec espace pour la barre du bas */
  #screen-app { flex-direction: column; }
  .main-content {
    padding: 1rem 1rem 80px;
    min-height: 100vh;
  }

  /* En-tête des pages */
  .page-header { margin-bottom: 1.25rem; }
  .page-title { font-size: 22px; }

  /* Grilles → 1 colonne */
  .doc-types-grid { grid-template-columns: 1fr; gap: 10px; }
  .radio-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full-width { grid-column: span 1; }

  /* Grille destinataire → 1 colonne */
  #block-destinataire > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }

  /* Wizard steps : texte réduit */
  .step-label { font-size: 10px; }
  .wizard-connector { margin: 0 6px; }

  /* Sections */
  .section-block { padding: 1rem; }

  /* Boutons résultat → colonne */
  .result-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .result-actions { flex-wrap: wrap; gap: 8px; }
  .result-actions .btn-gold,
  .result-actions .btn-outline { flex: 1; min-width: 140px; justify-content: center; }

  /* Aperçu document */
  .result-preview { padding: 1rem; font-size: 13px; max-height: 300px; }

  /* Overlay génération */
  .generating-card { padding: 2rem 1.5rem; }

  /* Envoi email */
  #view-nouveau .section-block > div[style*="flex"] {
    flex-direction: column !important;
  }

  /* Doc type cards : icône plus petite */
  .doc-type-icon { width: 40px; height: 40px; }
  .doc-type-name { font-size: 13px; }
  .doc-type-desc { font-size: 11px; }

  /* Login */
  .login-card { padding: 2rem 1.25rem; }

  /* Historique table → cards */
  .histo-table thead { display: none; }
  .histo-table, .histo-table tbody, .histo-table tr, .histo-table td { display: block; width: 100%; }
  .histo-table tr { background: var(--blanc); border: 1px solid var(--gris-border); border-radius: var(--radius); margin-bottom: 8px; padding: 10px 12px; }
  .histo-table td { border: none; padding: 4px 0; font-size: 12px; }
  .histo-table td::before { content: attr(data-label); font-weight: 600; font-size: 10px; color: var(--gris-text); text-transform: uppercase; display: block; margin-bottom: 2px; }
  .histo-table tr:hover td { background: transparent; }

  /* Admin table */
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { background: var(--blanc); border: 1px solid var(--gris-border); border-radius: var(--radius); margin-bottom: 8px; padding: 10px 12px; }
  .data-table td { border: none; padding: 3px 0; font-size: 12px; }
}
