/* ═══════════════════════════════════════════════════════════════════════════
   HERA Generator — Charte graphique inspirée de groupe-hera.com
   ═══════════════════════════════════════════════════════════════════════════ */

/* @import MUST be at the top of the stylesheet (before any other rule).
   Poppins = police de la charte HERA (présentations commerciales). */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ══ Charte HERA — Bleu nuit & Or ══════════════════════════════════════════
     Palette reprise des présentations commerciales (bleu nuit dominant #0B2558,
     or #C9963A, neutres froids). Les variables gardent leurs noms historiques
     (--hera-red = couleur PRIMAIRE) pour compatibilité : leur valeur est
     désormais le bleu nuit HERA. Le vrai rouge de marque reste --hera-brand-red. */
  --hera-navy:       #0B2558;    /* bleu nuit dominant */
  --hera-navy-2:     #2B4A6F;    /* bleu medium */
  --hera-navy-3:     #284E86;    /* bleu clair (liens/info) */
  --hera-navy-tint:  #EEF3FA;    /* fond bleuté très léger */

  --hera-red:        #0B2558;    /* = PRIMAIRE (bleu nuit) */
  --hera-red-dark:   #071A3F;    /* dégradés / hover foncé */
  --hera-red-light:  #2B4A6F;
  --hera-red-soft:   #EEF3FA;    /* highlight de fond léger (bleuté) */
  --hera-gold:       #C9963A;
  --hera-gold-light: #E4C97A;
  --hera-gold-dark:  #6B5A2E;
  --hera-gold-soft:  #FBF3DD;
  --hera-brand-red:  #AA3433;    /* rouge HERA conservé (logo / marque) */

  /* ── Neutres (froids) ── */
  --white:      #ffffff;
  --bg:         #F4F7FB;
  --bg-soft:    #E7EBF1;
  --bg-card:    #ffffff;
  --border:     #DCE4EF;
  --border-soft:#EEF3FA;
  --text:       #1B2C44;
  --text-soft:  #2C3543;
  --text-muted: #5C6675;

  /* ── Statuts ── */
  --success:  #1a8a4a;
  --error:    #c0392b;
  --info:     #284E86;

  /* ── Tokens UI ── */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(11,37,88,.06);
  --shadow:    0 2px 12px rgba(11,37,88,.08);
  --shadow-md: 0 6px 22px rgba(11,37,88,.12);
  --shadow-lg: 0 16px 46px rgba(11,37,88,.20);
  --shadow-red:0 5px 18px rgba(11,37,88,.26);   /* "glow" primaire = bleu nuit */
  --transition: .2s cubic-bezier(.4,0,.2,1);

  /* ── Polices ── */
  --font-base:    'Poppins', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Poppins', 'Inter', 'Segoe UI', sans-serif;
}

body {
  font-family: var(--font-base);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% -8%, rgba(201,150,58,.07), transparent 42%),
    radial-gradient(circle at 96% 108%, rgba(11,37,88,.06), transparent 44%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ═══ HEADER (banner) ════════════════════════════════════════════════════════ */
header {
  background: var(--white);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(11,37,88,.06);
  border-bottom: 4px solid var(--hera-gold);
}
header::after {
  content: ''; display: block; height: 1px;
  background: linear-gradient(90deg, transparent, var(--hera-red) 30%, var(--hera-red) 70%, transparent);
  opacity: .15;
}
.header-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 0 32px;
  height: 100px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 22px; }
.logo-img {
  height: 78px; width: auto; display: block;
  transition: transform var(--transition);
}
.logo:hover .logo-img { transform: scale(1.02); }
.logo-sep {
  color: var(--border); font-size: 36px; margin: 0 4px; font-weight: 200;
  user-select: none;
}
.logo-title {
  color: var(--hera-red); font-size: 15px; font-weight: 700;
  letter-spacing: 3.5px; text-transform: uppercase;
  font-family: var(--font-display);
  position: relative; padding-bottom: 4px;
}
.logo-title::after {
  content:''; position: absolute; bottom: 0; left: 0;
  width: 30px; height: 2px; background: var(--hera-gold);
}

.header-actions { display: flex; gap: 10px; align-items: center; }

.btn-icon {
  background: var(--white); border: 1.5px solid var(--border); cursor: pointer;
  color: var(--hera-red); font-size: 20px;
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
  padding: 0;
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  transition: var(--transition);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
}
.btn-icon > * { display: block; line-height: 1; }
.btn-icon:hover {
  background: var(--hera-red); color: var(--white);
  border-color: var(--hera-red);
  transform: scale(1.08);
  box-shadow: var(--shadow-red);
}
/* Nudge fin pour les emojis qui ne sont pas centrés visuellement dans leur glyph-box */
#btnCampagne    { font-size: 18px; padding-top: 1px; }
#btnEmailConfig { font-size: 18px; }
#btnSettings:hover { transform: rotate(60deg) scale(1.05); }

/* ═══ MAIN ═══════════════════════════════════════════════════════════════════ */
main {
  max-width: 1180px; margin: 0 auto;
  padding: 36px 32px 80px;
}

/* ═══ Cards ═════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 22px;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 22px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.card-header::after {
  content:''; position: absolute; bottom: -1px; left: 0;
  width: 60px; height: 2px; background: var(--hera-gold);
}
.card-header h2 {
  font-size: 18px; font-weight: 700; letter-spacing: -.2px;
  color: var(--hera-red); display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
}
.badge {
  background: linear-gradient(135deg, var(--hera-red), var(--hera-red-dark));
  color: var(--white);
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  padding: 5px 14px; border-radius: 20px;
  text-transform: uppercase;
  box-shadow: var(--shadow-red);
}

/* ═══ Société sub-card ══════════════════════════════════════════════════════ */
.societe-card {
  background: linear-gradient(135deg, var(--white) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-left: 5px solid var(--hera-gold);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  transition: var(--transition);
  animation: slideInUp .3s ease;
}
.societe-card:hover {
  border-left-color: var(--hera-red);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.societe-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
  padding-bottom: 14px; border-bottom: 1px dashed var(--border);
}
.societe-num {
  background: linear-gradient(135deg, var(--hera-red), var(--hera-red-dark));
  color: var(--white);
  font-size: 12px; font-weight: 700; letter-spacing: .8px;
  padding: 5px 14px; border-radius: 16px;
  text-transform: uppercase;
  font-family: var(--font-display);
  box-shadow: var(--shadow-red);
}
.societe-actions { display: flex; align-items: center; gap: 10px; }
.societe-actions .fld-siren {
  width: 180px; font-weight: 700; letter-spacing: 3px; text-align: center;
  font-size: 14px;
}
.societe-body { display: flex; flex-direction: column; gap: 16px; }

/* ═══ Forms ═════════════════════════════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span2 { grid-column: span 2; }
label {
  font-size: 11.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
  display: block;
}

input, select, textarea {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 14px; color: var(--text);
  background: var(--white);
  transition: var(--transition);
  width: 100%;
  font-family: inherit;
}
input:hover, select:hover { border-color: #C3CFE0; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--hera-gold);
  box-shadow: 0 0 0 3px rgba(201,150,58,.18);
}
input::placeholder { color: #9AA6B8; }
input[type="text"]:not(:placeholder-shown):valid,
input[type="email"]:not(:placeholder-shown):valid {
  background-color: #F8FAFD;
}

/* ═══ Fieldsets ═════════════════════════════════════════════════════════════ */
.form-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px 16px;
  background: var(--white);
  position: relative;
}
.form-fieldset::before {
  content: ''; position: absolute; top: -1px; left: 14px; right: 14px;
  height: 2px; background: linear-gradient(90deg, var(--hera-gold-light), var(--hera-gold), transparent);
}
.form-fieldset legend {
  padding: 2px 12px; font-size: 12px; font-weight: 700;
  color: var(--hera-red); text-transform: uppercase; letter-spacing: 1px;
  font-family: var(--font-display);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Honoraires : grille auto-fit pour bien gérer les labels longs */
.form-grid-honoraires {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 14px;
}
.form-grid-honoraires label {
  font-size: 11px; line-height: 1.3; min-height: 28px;
  display: flex; align-items: flex-end;
}

.input-pct { position: relative; }
.input-pct input { padding-right: 30px; text-align: right; font-weight: 600; }
.input-pct span {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  pointer-events: none;
}

/* ═══ Buttons ═══════════════════════════════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--hera-red), var(--hera-red-dark));
  color: var(--white);
  border: none; border-radius: var(--radius-sm);
  padding: 11px 24px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  white-space: nowrap;
  letter-spacing: .3px;
  box-shadow: var(--shadow-red);
  position: relative; overflow: hidden;
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.2), transparent);
  opacity: 0; transition: var(--transition);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(11,37,88,.4); }
.btn-primary:hover::after { opacity: 1; }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--white); color: var(--hera-red);
  border: 1.5px solid var(--hera-red); border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  letter-spacing: .2px;
}
.btn-secondary:hover {
  background: var(--hera-red); color: var(--white);
  box-shadow: var(--shadow-red);
  transform: translateY(-1px);
}

.btn-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 18px;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-close:hover { background: var(--hera-red-soft); color: var(--hera-red); transform: rotate(90deg); }

.mt { margin-top: 14px; }

/* ═══ Document Buttons ══════════════════════════════════════════════════════ */
.doc-section {
  margin-bottom: 26px; padding-bottom: 4px;
}
.doc-section:last-child { margin-bottom: 0; }
.doc-section h3 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--hera-red);
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
  font-family: var(--font-display);
  display: flex; align-items: center; gap: 8px;
}
.doc-section h3::before {
  content:''; display: inline-block; width: 4px; height: 14px;
  background: var(--hera-gold); border-radius: 2px;
}
.doc-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.doc-block {
  background: linear-gradient(135deg, var(--white) 0%, var(--bg) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
  transition: var(--transition);
}
.doc-block:hover {
  border-color: var(--hera-gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.doc-label {
  font-size: 14px; font-weight: 700; color: var(--hera-red);
  font-family: var(--font-display);
}
.doc-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-doc {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--white);
  color: var(--hera-red); font-size: 12.5px; font-weight: 600;
  padding: 7px 14px; cursor: pointer; transition: var(--transition);
  letter-spacing: .2px;
}
.btn-doc:hover {
  background: var(--hera-red); color: var(--white);
  border-color: var(--hera-red);
  transform: translateY(-1px);
  box-shadow: var(--shadow-red);
}
.btn-doc.btn-mail {
  background: var(--hera-red-soft); color: var(--hera-red); border-color: #C3CFE0;
}
.btn-doc.btn-mail:hover {
  background: var(--hera-red); color: var(--white); border-color: var(--hera-red);
}
.btn-doc.btn-folder {
  background: var(--hera-gold-soft); color: var(--hera-gold-dark); border-color: #f0d090;
}
.btn-doc.btn-folder:hover {
  background: var(--hera-gold); color: var(--white); border-color: var(--hera-gold);
}
.btn-doc.loading { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn-doc.done {
  background: #e6f7ee; color: var(--success); border-color: #a0d8b4;
  animation: pulse-success .5s ease;
}
@keyframes pulse-success {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.btn-remove {
  background: none; border: 1.5px solid transparent; cursor: pointer;
  color: var(--error); font-size: 18px;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-remove:hover {
  background: #fee; border-color: var(--error);
  transform: rotate(90deg);
}

/* ═══ Status messages ═══════════════════════════════════════════════════════ */
.status-msg {
  margin-top: 12px; font-size: 13px; min-height: 22px;
  color: var(--text-muted);
  font-weight: 500;
}
.status-msg.ok  { color: var(--success); }
.status-msg.err { color: var(--error); }

/* ═══ Settings Panel ════════════════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0; background: rgba(11,37,88,.55);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
  backdrop-filter: blur(3px);
}
.overlay.open { opacity: 1; pointer-events: all; }

.settings-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 540px; background: var(--white);
  z-index: 300; box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.settings-panel.open { transform: translateX(0); }

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 28px; border-bottom: 4px solid var(--hera-gold);
  background: linear-gradient(135deg, var(--hera-red), var(--hera-red-dark));
}
.settings-header h2 {
  color: var(--white); font-size: 17px; letter-spacing: 1px;
  font-family: var(--font-display); text-transform: uppercase; font-weight: 700;
}
.settings-header .btn-close { color: rgba(255,255,255,.85); }
.settings-header .btn-close:hover { background: rgba(255,255,255,.18); color: var(--white); }

.settings-body {
  flex: 1; overflow-y: auto; padding: 26px;
  display: flex; flex-direction: column; gap: 14px;
}
.settings-body label {
  display: block; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); margin-bottom: 4px; margin-top: 6px;
}
.settings-body h3 {
  font-size: 13px; font-weight: 700; color: var(--hera-red);
  margin-top: 18px; padding-bottom: 8px;
  border-bottom: 2px solid var(--hera-gold);
  font-family: var(--font-display); letter-spacing: 1px;
  text-transform: uppercase;
}
.settings-body .template-row {
  display: grid; grid-template-columns: 160px 1fr; gap: 10px; align-items: center;
}
.settings-body .template-row span {
  font-size: 12px; font-weight: 600; color: var(--text-soft);
}

.settings-footer {
  padding: 18px 26px; border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ═══ Toast ═════════════════════════════════════════════════════════════════ */
#toastContainer {
  position: fixed; bottom: 28px; right: 28px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 999;
}
.toast {
  min-width: 280px; max-width: 420px;
  background: linear-gradient(135deg, var(--hera-red), var(--hera-red-dark));
  color: var(--white);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: flex-start; gap: 12px;
  animation: slideIn .3s cubic-bezier(.4,0,.2,1);
  border-left: 4px solid var(--hera-gold);
}
.toast.success { background: linear-gradient(135deg, #1a8a4a, #146e3c); border-left-color: #2ecc71; }
.toast.error   { background: linear-gradient(135deg, #b03030, #8b1a1a); border-left-color: #e74c3c; }
.toast.info    { background: linear-gradient(135deg, var(--hera-red-dark), #6e1f23); border-left-color: var(--hera-gold); }
.toast .toast-icon { font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.toast .toast-text { flex: 1; line-height: 1.45; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ═══ Spinner ═══════════════════════════════════════════════════════════════ */
.spinner-overlay {
  position: fixed; inset: 0; background: rgba(11,37,88,.55);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.spinner-box {
  background: var(--white); border-radius: var(--radius-lg);
  padding: 36px 48px; text-align: center;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--hera-gold);
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  min-width: 280px;
}
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--hera-red);
  border-right-color: var(--hera-gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner-box p {
  font-weight: 600; color: var(--hera-red); font-size: 14.5px;
  font-family: var(--font-display); letter-spacing: .5px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ Diagnostic table (Ringover) ═══════════════════════════════════════════ */
.diag-table {
  width: 100%; border-collapse: collapse; margin-top: 12px;
  font-size: 12.5px; font-family: 'Inter', sans-serif;
}
.diag-table th {
  text-align: left; padding: 8px 10px;
  background: var(--hera-red); color: #fff;
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
}
.diag-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.diag-table td code {
  font-family: 'Consolas', monospace;
  font-size: 11.5px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--text);
  word-break: break-all;
  display: inline-block;
  max-width: 380px;
}
.diag-table tr.ok td { background: #e6f7ee; }
.diag-table tr.err-auth td { background: #fdf3f3; }
.diag-table tr.err-other td { background: #fffbf0; }
.diag-table tr.token-invalid td {
  background: #fff4e0;
  border-left: 3px solid var(--hera-gold);
}
.diag-flag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .5px;
  background: var(--hera-gold);
  color: #fff;
  text-transform: uppercase;
}
.status-pill.token-invalid { background: var(--hera-gold); color: #fff; }
.status-pill {
  display: inline-block;
  padding: 2px 9px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
  font-family: 'Consolas', monospace;
}
.status-pill.ok { background: var(--success); color: #fff; }
.status-pill.err-auth { background: var(--error); color: #fff; }
.status-pill.err-other { background: var(--hera-gold-dark); color: #fff; }
.auth-tag {
  background: var(--hera-gold-soft);
  color: var(--hera-gold-dark);
  border: 1px solid #f0d090;
  padding: 1px 8px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ═══ Responsive ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .header-inner { padding: 0 20px; height: 80px; }
  .logo-img { height: 60px; }
  .logo-sep, .logo-title { display: none; }
  main { padding: 24px 16px 60px; }
  .card { padding: 20px; }
  .societe-card { padding: 16px 18px; }
  .societe-head { flex-direction: column; align-items: stretch; }
  .societe-actions { flex-wrap: wrap; }
  .societe-actions .fld-siren { width: 100%; }
}
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-group.span2 { grid-column: span 1; }
  .settings-panel { width: 100%; }
  .doc-row { grid-template-columns: 1fr; }
  #toastContainer { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

/* ═══ Widget Profil Utilisateur ═══════════════════════════════════════════ */
.user-profile-widget {
  position: relative;
  margin-left: 10px;
  /* Profil, mot de passe et déconnexion côte à côte : empilés, les deux
     derniers débordaient du bandeau. */
  display: flex;
  align-items: center;
  gap: 6px;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  color: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  font-family: inherit;
}
.user-chip:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}
.user-chip .user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  background: var(--hera-gold, #C9963A);
  border-radius: 50%;
  font-size: 14px;
  color: white;
}
.user-chip .user-name {
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip .user-edit-icon {
  font-size: 11px;
  opacity: 0.6;
}
.user-chip.unset .user-name {
  font-style: italic;
  opacity: 0.85;
}

.user-popup {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  border: 1px solid #DCE4EF;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}
.user-popup.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.user-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #EEF3FA;
  color: var(--text, #1B2C44);
}
.user-popup-header strong {
  font-size: 14px;
  font-weight: 700;
}
.user-popup-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #5C6675;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  border-radius: 4px;
}
.user-popup-close:hover { background: #EEF3FA; color: var(--hera-red, #0B2558); }

.user-popup-body {
  padding: 16px 18px;
}
.user-popup-body label {
  display: block;
  margin-bottom: 12px;
  color: var(--text, #1B2C44);
}
.user-popup-body label span {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #5C6675;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.user-popup-body input {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid #DCE4EF;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text, #1B2C44);
  background: white;
  transition: border-color 0.15s ease;
}
.user-popup-body input:focus {
  outline: none;
  border-color: var(--hera-red, #0B2558);
  box-shadow: 0 0 0 3px rgba(11,37,88,0.12);
}
.user-popup-hint {
  font-size: 12px;
  color: #5C6675;
  margin-top: 4px;
  font-style: italic;
}
.user-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #EEF3FA;
  background: #F4F7FB;
  border-radius: 0 0 12px 12px;
}

/* ═══ Polish premium — charte bleu nuit & or ═════════════════════════════════ */
/* Sélection de texte aux couleurs de la marque */
::selection { background: rgba(11,37,88,.14); color: var(--hera-navy); }

/* Barres de défilement fines et sobres (WebKit) */
* { scrollbar-width: thin; scrollbar-color: #C3CFE0 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #C3CFE0; border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--hera-navy-2); background-clip: padding-box; }

/* Retour visuel plus net à l'appui des boutons */
.btn-primary:active, .btn-secondary:active, .btn-doc:active { transform: translateY(0) scale(.985); }

/* Focus accessible homogène (navigation clavier) */
a:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--hera-navy-2);
  outline-offset: 2px;
}

/* Aide et millésime dans les libellés du formulaire société */
.lab-aide{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;
  border-radius:50%;background:var(--hera-navy-tint,#EEF3FA);color:var(--hera-navy,#0B2558);
  font-size:9.5px;font-weight:800;cursor:help;margin-left:4px;vertical-align:middle}
.lab-annee{font-weight:500;color:#5C6675;font-size:10.5px}

/* Civilité pas encore choisie. Aucun registre ne publie le genre d'un
   mandataire : le champ attend une décision, et l'accord de tout l'acte
   — habilité(e), soussigné(e) — en dépend. */
select.fld-attente {
  border-color: var(--gold, #c9a227);
  background: #fffaf0;
  box-shadow: 0 0 0 2px rgba(201, 162, 39, .18);
}
