:root {
  --bg: #e6eef5;
  --bg-soft: #f4f7fb;
  --card: #ffffff;
  --line: #1f3d57;
  --text: #12345a;
  --muted: #3d5570;
  --accent: #1a5fb4;
  --accent-2: #3ec6e8;
  --warn: #c47b12;
  --danger: #c0392b;
  --ok: #1d8a4a;
  --radius: 16px;
  --stroke: 2px;
  --shadow: none;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding: 16px 0 48px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 20px;
  border-bottom: var(--stroke) solid var(--line);
  margin-bottom: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 64px; height: 64px; object-fit: contain; display: block; }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name small { font-weight: 600; color: var(--muted); font-size: 12px; }
nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
nav a, nav .nav-drop > summary, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: var(--stroke) solid var(--line); background: #fff;
  color: var(--text); border-radius: 999px; padding: 8px 14px; font-size: 14px;
  cursor: pointer;
}
nav a.active, nav .nav-drop > summary.active, nav .nav-drop.is-current > summary, .btn.primary {
  background: var(--accent); color: #fff; border-color: #114a96; font-weight: 700;
}
nav .nav-drop {
  position: relative;
}
nav .nav-drop > summary {
  list-style: none;
  user-select: none;
}
nav .nav-drop > summary::-webkit-details-marker { display: none; }
nav .nav-drop > summary::after {
  content: "";
  width: 0.45em;
  height: 0.45em;
  margin-left: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
nav .nav-drop-menu {
  display: none;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  padding: 8px;
  margin-top: 6px;
  background: #fff;
  border: var(--stroke) solid var(--line);
  border-radius: 14px;
  z-index: 30;
}
nav .nav-drop[open] > .nav-drop-menu,
nav .nav-drop:hover > .nav-drop-menu,
nav .nav-drop:focus-within > .nav-drop-menu {
  display: flex;
}
@media (min-width: 761px) {
  nav .nav-drop-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
  }
}
nav .nav-drop-menu a {
  justify-content: flex-start;
  white-space: nowrap;
}
.btn.primary:hover { text-decoration: none; filter: brightness(1.05); }
.btn:hover { text-decoration: none; }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.module-nav { margin: 0 0 18px; }

.privacy-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 8px;
  padding: 6px 10px;
  border: var(--stroke) solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  font-size: 13px;
}
.privacy-bar p { margin: 0; }

.card.compact-form {
  padding: 12px 14px;
}
.compact-form h2 { margin: 10px 0 6px; }
.compact-form h2:first-child { margin-top: 0; }
.compact-form label { margin: 4px 0 2px; font-size: 12px; }
.compact-form input, .compact-form select, .compact-form textarea {
  padding: 6px 8px;
  font-size: 16px;
  border-radius: 8px;
}
.compact-form .row { gap: 8px; }
.compact-form .photo-row { gap: 10px; margin-bottom: 2px; align-items: flex-start; }
.compact-form .grow { flex: 1; min-width: 0; }
.compact-form .avatar { width: 64px; height: 64px; border-radius: 10px; }
.compact-form .small { margin: 4px 0 0; }
.compact-form .dl { gap: 4px 10px; font-size: 14px; }
.compact-form .compact-submit { margin-top: 10px; padding: 6px 12px; }

.card {
  background: var(--card);
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; }
@media (min-width: 760px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
}

h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin: 0 0 8px; color: var(--text); }
h2 { font-size: 1.05rem; margin: 0 0 14px; color: var(--accent); }
p { color: var(--muted); line-height: 1.5; }

.flash {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px;
  border: var(--stroke) solid;
}
.flash.ok { background: #e8f7ee; color: var(--ok); border-color: #7dbe93; }
.flash.error { background: #fdecea; color: var(--danger); border-color: #e08b84; }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: var(--stroke) solid var(--line); background: #fff; color: var(--text); font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
  pointer-events: auto;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.row { display: grid; gap: 12px; }
.row > * { min-width: 0; }
@media (min-width: 640px) {
  .row.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .row.three { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1fr); }
}

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700;
  background: #e6f7fc; color: var(--accent);
  border: var(--stroke) solid var(--line);
}
.badge.warn { background: #fff4e0; color: var(--warn); border-color: var(--warn); }
.badge.danger { background: #fdecea; color: var(--danger); border-color: var(--danger); }
.badge.blue { background: #e8f0fb; color: var(--accent); }
.badge.ok { background: #e8f7ee; color: var(--ok); border-color: var(--ok); }

.mandataire-picked { min-height: 1.2em; margin: 6px 0 0; font-weight: 600; }

.cert-expiry-date {
  display: inline-block;
  margin-left: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  vertical-align: middle;
}
.cert-expiry-date.valid { color: var(--ok); }
.cert-expiry-date.expired { color: var(--danger); }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 15px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: var(--stroke) solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.auth-box { width: min(440px, calc(100% - 32px)); margin: 4vh auto; }
.auth-logo { width: 120px; height: 120px; display: block; margin: 0 auto 16px; object-fit: contain; }
.access-warning {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: var(--stroke) solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}
.login-legal {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}
.tariff-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 16px;
  align-items: end;
  margin-bottom: 12px;
}
.tariff-taxable {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  white-space: nowrap;
}
.table-wrap { overflow-x: auto; }

.photo-row { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.avatar {
  width: 112px; height: 112px; object-fit: cover; border-radius: 18px;
  border: var(--stroke) solid var(--line); background: var(--bg-soft); flex-shrink: 0;
}
.avatar.placeholder {
  display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; padding: 8px;
}
.h3 { font-size: 0.95rem; margin: 12px 0 8px; }
input[readonly] { background: var(--bg-soft); color: var(--muted); }

.dialog {
  border: var(--stroke) solid var(--line); border-radius: 16px; padding: 0; width: min(420px, 92vw);
  box-shadow: var(--shadow);
}
.dialog.dialog-wide { width: min(560px, 94vw); }
.dialog::backdrop { background: rgba(18, 52, 90, 0.35); }
.dialog-body { padding: 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.portal-notice { margin: 0 0 16px; }
.portal-notice:last-of-type { margin-bottom: 0; }

.revue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.revue-card {
  background: var(--card);
  border: var(--stroke) solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.revue-cover, .revue-cover-preview {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--bg-soft);
  display: block;
}
.revue-cover.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  min-height: 220px;
}
.revue-cover-preview {
  max-width: 180px;
  margin-top: 8px;
  border-radius: 10px;
  border: var(--stroke) solid var(--line);
}
.revue-cover-thumb {
  width: 48px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: var(--stroke) solid var(--line);
  display: block;
}
.revue-card-body { padding: 12px 14px 16px; }
.revue-card-body h2 { margin: 4px 0 10px; font-size: 1rem; }
.revue-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }

html.embed-revues,
html.embed-revues body,
body.embed-revues {
  background: #fff !important;
  background-color: #fff !important;
}
html.embed-revues body,
body.embed-revues {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
html.embed-revues .wrap,
body.embed-revues .wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px 20px;
  background: #fff;
  box-sizing: border-box;
}
html.embed-revues .revue-grid,
body.embed-revues .revue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 240px));
  justify-content: center;
  justify-items: stretch;
  margin: 0 auto;
}
html.embed-revues .revue-card,
html.embed-revues .card,
body.embed-revues .revue-card,
body.embed-revues .card {
  background: #fff;
  width: 100%;
}
html.embed-revues .card,
body.embed-revues .card {
  margin: 0 auto;
  max-width: 36rem;
  text-align: center;
}
html.embed-revues .revue-cover,
html.embed-revues .revue-cover.placeholder,
body.embed-revues .revue-cover,
body.embed-revues .revue-cover.placeholder {
  background: #fff;
}
.embed-snippet {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  min-height: 5.5rem;
}
.doc-notes {
  white-space: pre-wrap;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-soft);
  border: var(--stroke) solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0 0;
  max-width: 360px;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
}
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px 12px;
}
.service-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 16px 0 8px;
}
.stat-card h2 { margin-top: 0; font-size: 1rem; }
.stat-number {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 8px 0 4px;
  line-height: 1.1;
}
.stat-number span { font-size: 1rem; font-weight: 600; color: var(--muted); }
.stat-sub { margin: 0; color: var(--muted); font-size: 14px; }

.training-module {
  border-top: var(--stroke) solid var(--line);
  padding: 14px 0 4px;
}
.training-module:first-of-type { border-top: 0; padding-top: 0; }
.training-module h3 { margin: 0 0 8px; }

.video-frame {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 10px;
  margin: 12px 0 4px;
  background: #000;
}
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.training-video {
  display: block;
  width: 100%;
  max-height: 70vh;
  margin: 12px 0 4px;
  border-radius: 10px;
  background: #000;
}

.discount-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.discount-image {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border: var(--stroke) solid var(--line);
  border-radius: 10px;
  display: block;
  margin-bottom: 12px;
  background: var(--bg-soft);
}

.control-no { width: 10rem; display: inline-block; min-width: 8rem; }
.invoice-control-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.invoice-control-form .btn { padding: 6px 10px; }
.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.list-head h2 { margin: 0; }
.invoice-toolbar {
  align-items: flex-start;
}
.invoice-toolbar .control-filters {
  margin: 0;
  justify-content: flex-start;
}
.status-filters {
  margin: 0;
  justify-content: flex-end;
  margin-left: auto;
}

.lang-switch {
  text-align: center;
  margin-top: 14px;
  font-size: 14px;
}
.lang-switch a { font-weight: 600; }

.stat-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}
.stat-example {
  font-size: 13px;
  padding: 6px 10px;
}

.billing-banner {
  border: var(--stroke) solid var(--warn);
  background: #fff8ec;
  padding: 12px 16px;
  margin: 0 0 16px;
  border-radius: var(--radius);
}
.billing-banner h2 { margin-top: 0; }
.card.billing-banner { margin-bottom: 16px; }

.status-banner {
  padding: 12px 16px;
  margin: 0 0 16px;
  border-radius: var(--radius);
  border: var(--stroke) solid var(--warn);
  background: #fff8ec;
}
.status-banner.danger {
  border-color: var(--danger);
  background: #fdecea;
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-top: 8px; }
  nav { justify-content: flex-end; }
  .brand-logo { width: 52px; height: 52px; }
  .compact-form .photo-row { flex-direction: column; }
}

body.escoumins-body {
  background: #111;
  color: #f4f4f4;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
html:has(body.escoumins-body) { height: 100%; overflow: hidden; }
.escoumins-flash {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: min(640px, calc(100% - 24px));
  margin: 0;
}
.escoumins-screen {
  display: grid;
  grid-template-columns: 200px minmax(280px, 380px) minmax(260px, 360px);
  width: min(1040px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 0 2px #333;
}
.escoumins-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  padding: 16px;
}
.escoumins-logo {
  width: 100%;
  max-height: 56vh;
  height: auto;
  object-fit: contain;
}
.escoumins-panel {
  background: #f7f7f7;
  color: var(--text);
  padding: 20px 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 0;
  border-left: var(--stroke) solid var(--line);
}
.escoumins-panel h1 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}
.escoumins-lead, .escoumins-who { margin: 0 0 10px; font-size: 13px; }
.escoumins-id, .escoumins-q { margin: 0; width: 100%; max-width: 340px; }
.escoumins-id label, .escoumins-q label { margin: 0; }
.escoumins-id input:not([type="radio"]) {
  margin: 2px 0 8px;
  padding: 6px 8px;
  text-align: center;
}
.escoumins-id-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.escoumins-q fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.escoumins-q-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 14px;
  margin: 0 0 12px;
  font-size: 15px;
}
.escoumins-q-row span { flex: 1 1 100%; font-weight: 600; }
.escoumins-q-row input { width: auto; margin: 0 4px 0 0; }
.escoumins-panel .btn { width: auto; margin: 8px auto 0; display: inline-flex; }
.escoumins-done { justify-content: center; grid-column: 2 / -1; }
body.escoumins-body a { color: var(--accent); }
@media (max-width: 900px) {
  body.escoumins-body { height: auto; overflow: auto; padding: 16px 0; }
  html:has(body.escoumins-body) { height: auto; overflow: auto; }
  .escoumins-screen {
    grid-template-columns: 1fr;
    width: min(440px, calc(100% - 24px));
    max-height: none;
  }
  .escoumins-brand { padding: 12px; }
  .escoumins-logo { max-height: 120px; width: auto; margin: 0 auto; display: block; }
  .escoumins-done { grid-column: auto; }
}

.survey-matrix {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
}
.survey-matrix col.survey-matrix-q { width: 34%; }
.survey-matrix thead th {
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.25;
}
.survey-matrix th[scope="row"] {
  text-align: left;
  white-space: normal;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--text);
  vertical-align: middle;
}
.survey-matrix td {
  text-align: center;
  vertical-align: middle;
}
.survey-choice {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  cursor: pointer;
}
.survey-choice input { width: auto; margin: 0 auto; display: block; }
.survey-choice-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.survey-fieldset {
  border: var(--stroke) solid var(--line);
  border-radius: 12px;
  padding: 12px 14px 8px;
  margin: 0 0 16px;
  text-align: center;
}
.survey-fieldset legend {
  font-weight: 700;
  color: var(--text);
  padding: 0 6px;
  text-align: center;
}
.survey-fieldset label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 6px 0;
  color: var(--text);
  font-size: 15px;
}
.survey-bar {
  height: 10px;
  background: #dfe7ef;
  border-radius: 999px;
  overflow: hidden;
  min-width: 80px;
}
.survey-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}
.survey-comment {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  background: var(--bg-soft);
}
.survey-comment p { margin: 6px 0 0; color: var(--text); }
.survey-comment-delete { margin: 8px 0 0; }
@media (max-width: 760px) {
  .survey-matrix { min-width: 0; }
  .survey-matrix thead { display: none; }
  .survey-matrix, .survey-matrix tbody, .survey-matrix tr, .survey-matrix th, .survey-matrix td {
    display: block;
    width: 100%;
  }
  .survey-matrix tr {
    margin-bottom: 14px;
    border: var(--stroke) solid var(--line);
    border-radius: 12px;
    padding: 8px 10px;
  }
  .survey-matrix th[scope="row"] {
    width: auto;
    border-bottom: 0;
    padding-bottom: 4px;
  }
  .survey-matrix td {
    display: flex;
    text-align: left;
    border-bottom: 0;
    padding: 4px 0;
  }
  .survey-choice {
    justify-content: flex-start;
    gap: 8px;
  }
  .survey-choice-label {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    overflow: visible;
  }
}

.email-source {
  overflow: auto;
  max-height: 28rem;
  padding: 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8f9fa;
  border: var(--stroke) solid var(--line);
  border-radius: 10px;
}

.email-html-editor {
  min-height: 28rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.email-preview {
  display: block;
  width: 100%;
  min-height: 32rem;
  border: var(--stroke) solid var(--line);
  border-radius: 10px;
  background: #f5f7fa;
}

/* Écrans VGA / XGA : les traits fins et les ombres disparaissent. */
@media (max-width: 1024px) {
  :root {
    --bg: #dde7f0;
    --line: #0f2a40;
    --stroke: 3px;
  }
}

html.embed-revues,
html.embed-revues body {
  background: #fff !important;
  background-color: #fff !important;
}
