/* ==========================================================================
   SignGouv Haïti — feuille de style unique de l'habillage
   Remplace les ~1 000 lignes de CSS en ligne (!important) dispersées dans
   layouts/application, layouts/_head_tags, templates_dashboard, etc.
   Toutes les classes sont préfixées « sg- » pour ne jamais entrer en
   conflit avec Tailwind / DaisyUI de DocuSeal.
   Correctif 1.3.1 : thème aux couleurs nationales (bleu #00209F, rouge #D21034).
   ========================================================================== */

:root {
  --ht-blue: #00209F;       /* bleu du drapeau national */
  --ht-red: #D21034;        /* rouge du drapeau national */
  --sg-navy: #00209F;
  --sg-blue: #00209F;
  --sg-red: #D21034;
  --sg-ink: #1E293B;
  --sg-muted: #5A6472;
  --sg-line: #E2E8F0;
  --sg-bg: #F7F8FA;
  --sg-side: #F1F3F6;
  --sg-white: #FFFFFF;
  --sg-header-h: 96px;
  --sg-side-w: 260px;
  --sg-radius: 8px;
}

body.sg-app { background: var(--sg-bg); color: var(--sg-ink); margin: 0; }

/* ---------- En-tête : logo | phrase | institution + déconnexion ---------- */
.sg-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--sg-header-h);
  background: var(--sg-white);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  padding: 0 24px;
}
.sg-header::after {               /* filet bleu et rouge sous l'en-tête */
  content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 5px;
  background: linear-gradient(90deg, var(--ht-blue) 0 50%, var(--ht-red) 50% 100%);
}
.sg-header__left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sg-header__logo img { height: 76px; width: auto; display: block; }  /* logo officiel, agrandi (correctif 1.4.1) */
.sg-header__center {
  text-align: center; font-size: 25px; font-weight: 700; letter-spacing: .3px; line-height: 1.25;
  color: var(--ht-blue); text-wrap: balance;
}
.sg-header__center::after {        /* court filet rouge sous la phrase */
  content: ""; display: block; width: 72px; height: 3px; margin: 8px auto 0; border-radius: 2px; background: var(--ht-red);
}
.sg-header__right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
.sg-header__org { text-align: right; line-height: 1.2; min-width: 0; }
.sg-header__org strong { display: block; font-size: 16px; color: var(--sg-ink); font-weight: 700; max-width: 300px; }
.sg-header__org span { font-size: 14px; color: var(--sg-muted); }
.sg-avatar {
  width: 46px; height: 46px; border-radius: 50%; font-size: 17px;
  background: var(--ht-blue); color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.sg-menu { min-width: 220px; background: #fff; color: var(--sg-ink); border: 1px solid var(--sg-line); }
.sg-menu a { color: var(--sg-ink); }
.sg-logout-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; white-space: nowrap;
  border: 1px solid var(--ht-red); border-radius: var(--sg-radius); background: #fff;
  color: var(--ht-red); font-weight: 600; font-size: 15px; text-decoration: none;
}
.sg-logout-btn:hover { background: var(--ht-red); color: #fff; }
.sg-logout-btn svg { width: 18px; height: 18px; }

/* ---------- Structure ---------- */
.sg-shell { display: flex; min-height: calc(100vh - var(--sg-header-h)); }
.sg-sidebar {
  width: var(--sg-side-w); flex: 0 0 var(--sg-side-w);
  background: var(--ht-blue); color: #fff; padding: 20px 16px;
  position: sticky; top: var(--sg-header-h); align-self: flex-start;
  height: calc(100vh - var(--sg-header-h)); overflow-y: auto; box-sizing: border-box;
}
.sg-main { flex: 1; min-width: 0; padding: 32px 40px 80px; box-sizing: border-box; }
.sg-main__inner { max-width: 1240px; margin: 0 auto; }

/* ---------- Menu latéral (bleu national, élément actif blanc avec liseré rouge) ---------- */
.sg-nav { list-style: none; margin: 0; padding: 0; }
.sg-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--sg-radius);
  color: #fff; text-decoration: none; font-size: 15px;
}
.sg-nav a:hover { background: rgba(255,255,255,.12); }
.sg-nav a.is-active { background: var(--sg-white); color: var(--ht-blue); font-weight: 600; box-shadow: inset 4px 0 0 var(--ht-red); }
.sg-nav svg { width: 20px; height: 20px; flex: 0 0 20px; color: #C9D3FF; }
.sg-nav a.is-active svg { color: var(--ht-blue); }
.sg-nav .sg-sub { list-style: none; margin: 2px 0 8px 22px; padding: 0 0 0 14px; border-left: 1px solid rgba(255,255,255,.35); }
.sg-nav .sg-sub a { font-size: 14px; color: #DCE3FF; padding: 8px 12px; }
.sg-nav .sg-sub a.is-active { color: var(--ht-blue); }
.sg-nav .sg-count {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: var(--ht-red); color: #fff; border-radius: 999px; padding: 1px 8px;
}
.sg-nav__title { margin: 18px 14px 6px; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #AFC0FF; }

/* ---------- Titres ---------- */
.sg-h1 { font-size: 24px; font-weight: 700; margin: 0 0 20px; color: var(--ht-blue); }
.sg-h2 { font-size: 20px; font-weight: 600; margin: 32px 0 16px; color: var(--ht-blue); }

/* ---------- Cartes « Commencer un document » ---------- */
.sg-start { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 400px)); gap: 24px; }
.sg-start__card {
  display: flex; align-items: center; gap: 16px;
  background: var(--sg-white); border: 1px solid var(--sg-line); border-radius: var(--sg-radius);
  padding: 26px 24px; cursor: pointer; text-decoration: none; color: inherit;
}
.sg-start__card:hover { border-color: var(--ht-red); box-shadow: 0 2px 8px rgba(0,32,159,.10); }
.sg-start__card svg { width: 28px; height: 28px; color: var(--ht-blue); flex: 0 0 28px; }
.sg-start__card strong { display: block; font-size: 17px; font-weight: 600; }
.sg-start__card span { display: block; font-size: 15px; color: var(--sg-muted); margin-top: 2px; }

/* ---------- Indicateurs ---------- */
.sg-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 8px; }
.sg-kpi {
  background: var(--sg-white); border: 1px solid var(--sg-line); border-top: 4px solid var(--ht-blue);
  border-radius: var(--sg-radius); padding: 18px 20px; text-decoration: none; color: inherit; display: block;
}
.sg-kpi:hover { border-color: var(--sg-blue); }
.sg-kpi__label { font-size: 13px; color: var(--sg-muted); }
.sg-kpi__value { font-size: 30px; font-weight: 700; margin-top: 4px; }
.sg-kpi--alert { border-top-color: var(--ht-red); }
.sg-kpi--alert .sg-kpi__value { color: var(--ht-red); }

/* ---------- Tableau des documents ---------- */
.sg-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 32px 0 16px; }
.sg-toolbar .sg-h2 { margin: 0; }
.sg-search { position: relative; width: 420px; max-width: 100%; }
.sg-search input {
  width: 100%; box-sizing: border-box; height: 42px; padding: 0 40px 0 14px;
  border: 1px solid #CBD2DC; border-radius: var(--sg-radius); font-size: 15px; background: #fff;
}
.sg-search svg { position: absolute; right: 12px; top: 11px; width: 20px; height: 20px; color: var(--sg-muted); }
.sg-table-wrap { background: var(--sg-white); border: 1px solid var(--sg-line); border-radius: var(--sg-radius); overflow-x: auto; }
.sg-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.sg-table th {
  text-align: left; font-weight: 600; font-size: 14px; color: var(--ht-blue); background: #F2F5FF;
  padding: 14px 18px; border-bottom: 1px solid var(--sg-line); white-space: nowrap;
}
.sg-table td { padding: 14px 18px; border-bottom: 1px solid #EEF1F5; vertical-align: middle; }
.sg-table tr:last-child td { border-bottom: 0; }
.sg-table tr:hover td { background: #FAFBFC; }
.sg-doc { display: flex; align-items: center; gap: 12px; color: var(--sg-ink); text-decoration: none; }
.sg-doc svg { width: 26px; height: 30px; color: var(--sg-muted); flex: 0 0 26px; }
.sg-doc:hover span { text-decoration: underline; }
.sg-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; font-size: 12px; font-weight: 700;
  background: #DCE7F7; color: var(--sg-navy); margin-right: -6px; border: 2px solid #fff;
}
.sg-empty { padding: 40px; text-align: center; color: var(--sg-muted); }

/* Statuts : une couleur = une signification, partout */
.sg-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sg-status--a_signer   { background: #DCE4FF; color: #00209F; }   /* action de l'utilisateur */
.sg-status--en_attente { background: #FFF1D6; color: #8A5300; }   /* attend les autres */
.sg-status--signe      { background: #DDF3E4; color: #1B6B3A; }   /* terminé */
.sg-status--refuse,
.sg-status--expire     { background: #FBE0E1; color: #9B1C22; }   /* échec */
.sg-status--brouillon  { background: #ECEEF1; color: #4A5568; }

/* Boutons */
.sg-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: var(--sg-radius); font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.sg-btn--primary { background: var(--sg-navy); color: #fff; }
.sg-btn--ghost { background: #fff; color: var(--sg-navy); border-color: #CBD2DC; }

/* Pied de page (mentions + attribution AGPL obligatoire) */
.sg-footer { border-top: 1px solid var(--sg-line); margin-top: 48px; padding-top: 16px; font-size: 12px; color: var(--sg-muted); display: flex; flex-wrap: wrap; gap: 6px 18px; }
.sg-footer a { color: var(--sg-muted); }

/* ---------- Mobile ---------- */
@media (max-width: 1300px) {
  .sg-header__center { font-size: 21px; }
}
@media (max-width: 900px) {
  .sg-header { grid-template-columns: 1fr auto; padding: 0 12px; }
  .sg-header__center { display: none; }
  .sg-sidebar { display: none; }
  .sg-sidebar.is-open { display: block; position: fixed; left: 0; top: var(--sg-header-h); z-index: 60; box-shadow: 4px 0 16px rgba(0,0,0,.2); }
  .sg-burger { display: inline-flex !important; }
  .sg-main { padding: 20px 16px 80px; }
  .sg-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sg-header__org { display: none; }
  .sg-header__logo img { height: 52px; }
  :root { --sg-header-h: 72px; }
  .sg-logout-btn span { display: none; }
  .sg-logout-btn { padding: 0 10px; }
  .sg-search { width: 100%; }
  .sg-toolbar { flex-direction: column; align-items: stretch; }
  .sg-table .sg-hide-sm { display: none; }
}
.sg-burger { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.sg-burger svg { width: 26px; height: 26px; color: var(--sg-ink); }

/* ---------- Compatibilité : anciennes pages encore enveloppées dans .ihsi-dashboard-layout
   (submissions_dashboard/index, templates/show). Le menu est rendu par le layout ;
   on neutralise l'ancienne mise en page jusqu'au nettoyage de ces vues (guide § 9). ---------- */
.sg-main .ihsi-dashboard-layout { display: block !important; min-height: 0 !important; background: transparent !important; }
.sg-main .ihsi-dashboard-content { padding: 0 !important; }
.sg-main .ihsi-dashboard-sidebar { display: none !important; }

/* ---------- Niveau de signature ---------- */
.sg-level { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.sg-level--simple    { color: #334155; border-color: #CBD2DC; background: #F8FAFC; }
.sg-level--avancee   { color: #0D2B5C; border-color: #0D2B5C; background: #EEF3FB; }
.sg-level--qualifiee { color: #5B21B6; border-color: #7C3AED; background: #F5F3FF; }
.sg-select { height: 34px; border: 1px solid #CBD2DC; border-radius: 6px; padding: 0 8px; font-size: 13px; background: #fff; }

/* ---------- Boutons DocuSeal : pas de majuscules forcées (« Téléverser », pas « TÉLÉVERSER ») ---------- */
.sg-app .btn, .sg-app .base-button { text-transform: none; }

/* ---------- Page de connexion aux couleurs nationales ---------- */
.sg-login-bg {
  min-height: calc(100vh - var(--sg-header-h) - 5px);
  background: linear-gradient(180deg, var(--ht-blue) 0 50%, var(--ht-red) 50% 100%);
  display: flex; align-items: center; justify-content: center; padding: 40px 16px; box-sizing: border-box;
}
.sg-login-card {
  background: #fff; border-radius: 16px; padding: 44px 56px; width: 100%; max-width: 580px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); box-sizing: border-box;
}
.sg-login-card__head { text-align: center; margin-bottom: 20px; }
.sg-login-card__head img { width: 124px; height: auto; display: block; margin: 0 auto; }  /* Tailwind rend les images en bloc : centrage explicite */
.sg-login-card__head h1 { color: var(--ht-blue); font-size: 28px; font-weight: 700; margin: 16px 0 8px; }
.sg-login-card__head p { color: var(--sg-muted); font-size: 16px; margin: 0; }
.sg-login-card .base-input { height: 50px; font-size: 16px; }
.sg-login-card .label { font-size: 15px; }
.sg-login-card .base-button { height: 52px; font-size: 16px; }
@media (max-width: 640px) { .sg-login-card { padding: 28px 20px; } }
.sg-login-card .base-button { width: 100%; background: var(--ht-blue); border-color: var(--ht-blue); color: #fff; }
.sg-login-links { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--sg-line); text-align: center; font-size: 14px; }
.sg-login-links a { color: var(--ht-blue); }
.sg-login-note { margin-top: 10px; font-size: 13px; color: var(--sg-muted); }
.sg-login-lang { margin-top: 12px; font-size: 13px; color: var(--sg-muted); }
.sg-login-lang a { color: var(--sg-muted); text-decoration: none; }
.sg-login-lang a.is-active { color: var(--ht-blue); font-weight: 700; }

/* ---------- Correctif 1.4 : classification, habilitations, registre ---------- */
.sg-class { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; border: 1px solid; white-space: nowrap; }
.sg-class--normal       { color: #334155; border-color: #CBD2DC; background: #F8FAFC; }
.sg-class--financier    { color: #8A5300; border-color: #E0A43A; background: #FFF6E5; }
.sg-class--confidentiel { color: #9B1C22; border-color: var(--ht-red); background: #FDECEE; }
.sg-select--financier    { border-color: #E0A43A; background: #FFF6E5; }
.sg-select--confidentiel { border-color: var(--ht-red); background: #FDECEE; }
.sg-note-classified { display: flex; align-items: center; gap: 8px; margin: -4px 0 16px; padding: 10px 14px; border-radius: var(--sg-radius); background: #FDECEE; color: #7A1A1F; font-size: 14px; }
.sg-note-classified svg { width: 18px; height: 18px; flex: 0 0 18px; }
.sg-lead { color: #334155; font-size: 15px; line-height: 1.55; max-width: 900px; margin: -8px 0 24px; }
.sg-muted { color: var(--sg-muted); font-size: 14px; }
.sg-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.sg-panel { background: #fff; border: 1px solid var(--sg-line); border-top: 4px solid var(--ht-blue); border-radius: var(--sg-radius); padding: 18px 20px; }
.sg-panel__title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 17px; font-weight: 700; color: var(--ht-blue); }
.sg-panel__title svg { width: 20px; height: 20px; }
.sg-panel p { margin: 0 0 10px; }
.sg-hab-list { list-style: none; margin: 0 0 14px; padding: 0; }
.sg-hab-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #EEF1F5; }
.sg-form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sg-input { height: 34px; border: 1px solid #CBD2DC; border-radius: 6px; padding: 0 10px; font-size: 13px; background: #fff; }
.sg-btn--sm { height: 34px; padding: 0 12px; font-size: 13px; }
.sg-filters { display: flex; gap: 8px; margin: 0 0 16px; }
.sg-filters a { padding: 6px 14px; border-radius: 999px; border: 1px solid #CBD2DC; color: var(--sg-ink); text-decoration: none; font-size: 14px; background: #fff; }
.sg-filters a.is-active { background: var(--ht-blue); border-color: var(--ht-blue); color: #fff; }

/* ---------- Correctif 1.4.1 : panneau « Aide » (modèles) ---------- */
.sg-aide-btn { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: var(--sg-radius);
  border: 1px solid var(--ht-blue); background: #fff; color: var(--ht-blue); font-weight: 600; font-size: 14px; cursor: pointer; }
.sg-aide-btn:hover { background: #EEF2FF; }
.sg-aide-btn svg { width: 18px; height: 18px; }
.sg-aide-btn--float { position: fixed; right: 20px; bottom: 20px; z-index: 1000; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.sg-aide { position: fixed; top: var(--sg-header-h); right: 0; bottom: 0; width: 420px; max-width: 100vw; z-index: 1001;
  background: #fff; border-left: 4px solid var(--ht-blue); box-shadow: -8px 0 24px rgba(0,0,0,.15);
  transform: translateX(105%); transition: transform .2s ease; display: flex; flex-direction: column; }
.sg-aide.is-open { transform: none; }
.sg-aide__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--sg-line); color: var(--ht-blue); font-size: 17px; }
.sg-aide__close { background: none; border: 0; cursor: pointer; color: var(--sg-muted); padding: 4px; }
.sg-aide__close svg { width: 22px; height: 22px; }
.sg-aide__body { padding: 16px 20px 40px; overflow-y: auto; font-size: 14px; line-height: 1.55; color: #334155; }
.sg-aide__body h3 { margin: 18px 0 6px; font-size: 15px; color: var(--ht-blue); }
.sg-aide__body p { margin: 0 0 8px; }
.sg-aide__body ul { margin: 0 0 8px; padding-left: 18px; }
.sg-aide__key { background: #F2F5FF; border-radius: 8px; padding: 10px 12px 10px 28px !important; }
.sg-aide__ex { margin-top: 18px; padding: 12px 14px; border-left: 4px solid var(--ht-red); background: #FDF2F3; border-radius: 6px; }

/* ---------- Correctif 1.5 : assistant de création de modèle ---------- */
.sg-steps { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 24px; }
.sg-steps__item { display: inline-flex; align-items: center; gap: 8px; color: var(--sg-muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.sg-steps__num { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #CBD2DC; background: #fff; font-size: 13px; }
.sg-steps__item.is-current { color: var(--ht-blue); }
.sg-steps__item.is-current .sg-steps__num { border-color: var(--ht-blue); background: var(--ht-blue); color: #fff; }
.sg-steps__item.is-done { color: var(--sg-ink); }
.sg-steps__item.is-done .sg-steps__num { border-color: #1B6B3A; background: #DDF3E4; color: #1B6B3A; }
a.sg-steps__item:hover { color: var(--ht-blue); }
.sg-steps__sep { width: 36px; height: 2px; background: #CBD2DC; }
.sg-steps-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--sg-line); }
.sg-steps-bar .sg-steps { margin: 0; }
.sg-steps-bar__hint { flex: 1; min-width: 220px; color: var(--sg-muted); font-size: 13px; }
.sg-wiz { max-width: 960px; margin: 0 auto; }
.sg-wiz__drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
  min-height: 380px; padding: 40px 24px; border: 2px dashed #9FB0D9; border-radius: 16px; cursor: pointer;
  background: repeating-linear-gradient(135deg, #F7F9FF 0 18px, #EFF3FD 18px 36px); }
.sg-wiz__drop:hover, .sg-wiz__drop.is-over { border-color: var(--ht-blue); background: #EEF2FF; }
.sg-wiz__drop.is-busy { opacity: .7; pointer-events: none; }
.sg-wiz__drop strong { font-size: 22px; color: var(--sg-ink); }
.sg-wiz__drop-icon svg { width: 72px; height: 72px; color: var(--ht-blue); }
.sg-wiz__or { color: var(--sg-muted); }
.sg-wiz__loading { display: inline-flex; align-items: center; gap: 8px; color: var(--ht-blue); font-weight: 600; }
.sg-wiz__loading[hidden] { display: none; }
.sg-wiz__loading svg { width: 20px; height: 20px; }
.sg-wiz__actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--sg-line); }
.sg-wiz__me { display: flex; align-items: center; gap: 10px; width: 100%; padding: 16px 18px; margin-bottom: 16px;
  border: 1px solid var(--sg-line); border-radius: 10px; background: #fff; color: var(--ht-blue); font-size: 17px; font-weight: 600; cursor: pointer; text-align: left; }
.sg-wiz__me svg { width: 22px; height: 22px; }
.sg-wiz__me:hover { border-color: var(--ht-blue); }
.sg-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sg-parties { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.sg-party { display: flex; gap: 14px; background: #fff; border: 1px solid var(--sg-line); border-left: 5px solid var(--ht-blue); border-radius: 10px; padding: 16px 18px; }
.sg-party.is-copy { border-left-color: #8A93A3; }
.sg-party.is-me { border-left-color: var(--ht-red); }
.sg-party__order { flex: 0 0 auto; min-width: 34px; height: 34px; border-radius: 17px; padding: 0 8px; background: #EEF2FF; color: var(--ht-blue);
  font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.sg-party.is-copy .sg-party__order { background: #ECEEF1; color: #4A5568; font-size: 12px; }
.sg-party__main { flex: 1; min-width: 0; }
.sg-party__row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.sg-party__field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 220px; margin-bottom: 12px; }
.sg-party__field > span { font-size: 14px; font-weight: 600; color: var(--sg-ink); }
.sg-party__field--role { flex: 0 0 220px; min-width: 180px; }
.sg-party__field .sg-input, .sg-party__field .sg-select { height: 44px; font-size: 15px; width: 100%; box-sizing: border-box; }
.sg-party__tools { display: flex; gap: 6px; margin-bottom: 12px; }
.sg-icon-btn { width: 40px; height: 44px; border: 1px solid #CBD2DC; border-radius: 8px; background: #fff; cursor: pointer; font-size: 16px; color: var(--sg-ink); }
.sg-icon-btn svg { width: 18px; height: 18px; }
.sg-icon-btn--danger { color: var(--ht-red); }
.sg-party__me { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #334155; margin: 0 0 8px; }
.sg-party.is-copy .sg-party__me, .sg-party.is-copy [data-sg-show-email] { display: none; }
.sg-link-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 0; color: var(--ht-blue); font-weight: 600; font-size: 14px; cursor: pointer; }
.sg-link-btn svg { width: 16px; height: 16px; }
.sg-party__email { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.sg-party__email[hidden] { display: none; }
.sg-party.is-copy .sg-party__email { display: flex; }
.sg-party__email > span { font-size: 13px; font-weight: 600; color: var(--sg-muted); }
.sg-party__email-copy { display: none; }
.sg-party.is-copy .sg-party__email-copy { display: inline; }
.sg-party.is-copy .sg-party__email-sign { display: none; }
.sg-party.is-me .sg-party__email, .sg-party.is-me [data-sg-show-email] { display: none; }
.sg-party__email .sg-input { height: 42px; font-size: 15px; max-width: 460px; }
.sg-input--wide { width: 100%; height: 44px; font-size: 15px; box-sizing: border-box; }
.sg-textarea { width: 100%; height: auto; min-height: 200px; padding: 12px; font-size: 15px; line-height: 1.5; box-sizing: border-box; font-family: inherit; }
@media (max-width: 700px) { .sg-party__field--role { flex: 1 1 100%; } .sg-steps__sep { width: 14px; } }
.sg-btn svg { width: 18px; height: 18px; flex: 0 0 18px; }

.sg-aide--plain { top: 0; }  /* éditeur de modèle : pas d'en-tête (correctif 1.4.2) */

/* Messages de l'application (correctif 1.5.2) : sous l'en-tête, au-dessus de tout, texte lisible. */
.sg-flash { position: fixed; left: 0; right: 0; top: calc(var(--sg-header-h) + 40px); z-index: 1100; display: flex; justify-content: center; padding: 0 16px; pointer-events: none; }
.sg-flash__box { pointer-events: auto; display: flex; align-items: flex-start; gap: 12px; max-width: 680px; width: 100%; background: #fff; color: #1f2937; border: 1px solid #d1d5db; border-left: 6px solid #0D2B5C; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 14px 16px; font-size: 16px; line-height: 1.45; }
.sg-flash--error .sg-flash__box { border-left-color: #C1272D; background: #FEF2F2; }
.sg-flash__icon { flex: 0 0 24px; width: 24px; height: 24px; margin-top: 1px; }
.sg-flash--error .sg-flash__icon { stroke: #C1272D; }
.sg-flash--info .sg-flash__icon { stroke: #0D2B5C; }
.sg-flash__text { flex: 1 1 auto; font-weight: 600; }
.sg-flash__close { flex: 0 0 auto; cursor: pointer; font-size: 24px; line-height: 1; color: #6b7280; padding: 0 4px; }
.sg-flash__close:hover { color: #111827; }
.sg-flash--plain { top: 16px; }  /* éditeur de modèle : pas d’en-tête */

/* Page publique de vérification /verify (correctif 2.0) */
.sg-verif { max-width: 860px; margin: 32px auto 48px; padding: 0 16px; color: #1E293B; }
.sg-verif h1 { font-size: 28px; color: #0D2B5C; margin: 0 0 10px; font-weight: 700; }
.sg-verif h2 { font-size: 19px; color: #0D2B5C; margin: 24px 0 8px; font-weight: 700; }
.sg-verif__intro { font-size: 15px; line-height: 1.6; margin: 0 0 20px; }
.sg-verif__forms { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sg-verif__box { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; padding: 18px; }
.sg-verif__box .sg-btn { align-self: flex-start; }
.sg-verif__res { margin: 24px 0 12px; padding: 14px 16px; border-radius: 10px; font-size: 15px; line-height: 1.5; border-left: 6px solid; }
.sg-verif__res--ok { background: #ECFDF3; border-color: #1B6B3A; }
.sg-verif__res--ko { background: #FEF2F2; border-color: #C1272D; }
.sg-verif__res--warn { background: #FFF7E6; border-color: #B45309; }
.sg-verif__table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.sg-verif__table th, .sg-verif__table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #E2E8F0; vertical-align: top; }
.sg-verif__table th { width: 34%; color: #475569; font-weight: 600; }
.sg-verif__note { margin-top: 28px; font-size: 12.5px; color: #64748B; line-height: 1.5; }
@media (max-width: 700px) { .sg-verif__forms { grid-template-columns: 1fr; } }
