/* Barre de session â€” Ã©dition en ligne uniquement. */
:root {
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --topnav-h: 48px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.home.has-topnav { overflow: visible; }

body.has-topnav {
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  padding-bottom: var(--safe-bottom);
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--steel, #1c2126);
  color: #e8eef2;
  border-bottom: 2px solid var(--cgm, #2693d1);
  /* Hauteur fixe fine â€” pas de padding encoche (Ã©vite le gros bandeau au scroll) */
}
.topnav-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--topnav-h);
  height: var(--topnav-h);
  box-sizing: border-box;
  padding: 0 14px;
  max-width: 1280px;
  margin: 0 auto;
}
.topnav-brand {
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  font-weight: 750;
  font-size: 15px;
  letter-spacing: -.01em;
  white-space: nowrap;
  padding: 7px 12px;
  border-radius: 7px;
  flex-shrink: 0;
}
.topnav-brand:hover { background: rgba(255, 255, 255, .08); }
.topnav-brand.is-active {
  background: var(--cgm, #2693d1);
  color: #111;
}
.topnav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  margin-left: auto;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.topnav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: #e8eef2;
  border-radius: 1px;
  transition: transform .2s ease, opacity .2s ease;
}
.topnav.is-open .topnav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.topnav.is-open .topnav-toggle span:nth-child(2) { opacity: 0; }
.topnav.is-open .topnav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.topnav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.topnav-link {
  color: #c5ced6;
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 650;
}
.topnav-link:hover { background: rgba(38, 147, 209, .18); color: #fff; }
.topnav-link.is-active { background: var(--cgm, #2693d1); color: #111; }

.dropdown { position: relative; flex-shrink: 0; }
.dropdown > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: #fff;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 13px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover { background: rgba(255, 255, 255, .08); }
.dropdown-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: #fff;
  color: var(--ink, #2c3238);
  border: 1px solid var(--line, #d3dce3);
  border-radius: 10px;
  box-shadow: var(--shadow, 0 10px 28px rgba(28, 33, 38, .12));
  padding: 6px;
  z-index: 50;
}
.dropdown-panel a,
.dropdown-panel button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--steel, #1c2126);
  text-decoration: none;
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.dropdown-panel a:hover,
.dropdown-panel button:hover { background: var(--cgm-soft, #e8f5fc); }
.logout-form { margin: 0; }

body.has-topnav .side {
  top: var(--topnav-h);
  height: calc(100vh - var(--topnav-h));
  height: calc(100dvh - var(--topnav-h));
}

.auth-main { max-width: 480px; margin: 28px auto 40px; padding: 0 16px; }

/* iOS : Ã©vite le zoom auto sur focus des champs */
@supports (-webkit-touch-callout: none) {
  .auth-card input,
  .auth-card select,
  .auth-card textarea,
  .field input,
  .field select,
  .field textarea {
    font-size: 16px;
  }
}
.auth-main.wide { max-width: 1100px; }
.auth-card {
  background: #fff;
  border: 1px solid var(--line, #d3dce3);
  border-radius: 12px;
  box-shadow: var(--shadow, 0 10px 28px rgba(28, 33, 38, .08));
  padding: 22px;
}
.auth-card h1 { margin: 0 0 8px; font-size: 24px; color: var(--steel, #1c2126); }
.auth-card .lead { margin: 0 0 14px; color: var(--muted, #5b656e); }
.auth-card .field { margin-bottom: 12px; }
.auth-card .actions { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.auth-card .actions a { color: var(--cgm3, #1470a8); font-weight: 700; }
.banner-expired {
  background: #fffbeb;
  border: 1px solid #f5d08a;
  color: #7c4a03;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}
.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--cgm-soft, #e8f5fc);
  color: var(--cgm3, #1470a8);
  font-size: 12px;
  font-weight: 700;
}
/* Parametrage des acces — même langage que Accueil */
.settings-card {
  max-width: 100%;
  padding: 26px 24px 22px;
  background:
    radial-gradient(700px 280px at 100% -20%, rgba(38, 147, 209, .16), transparent 55%),
    linear-gradient(180deg, #e8eef3, #e2eaf1 55%, #dde6ee);
  border: 1px solid #c5d4de;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(28, 33, 38, .08);
}
.settings-card h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 850;
  letter-spacing: -.02em;
  color: var(--steel, #1c2126);
}
.settings-card .lead {
  margin: 0 0 18px;
  max-width: 54ch;
  line-height: 1.45;
  color: var(--muted, #5b656e);
}
.settings-cats {
  display: grid;
  gap: 12px;
  margin: 4px 0 10px;
}
.settings-panel {
  margin: 0;
  padding: 0;
  border: 1px solid #b7c9d6;
  border-radius: 14px;
  background: linear-gradient(180deg, #f2f6f9, #e8eef3);
  box-shadow: 0 6px 18px rgba(28, 33, 38, .05);
}
.settings-panel[open] {
  background: linear-gradient(180deg, #f7fafc, #eef4f8);
  border-color: #7eb8d8;
  box-shadow: 0 10px 26px rgba(20, 112, 168, .12);
}
.settings-panel > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  color: #4a5866;
  background: linear-gradient(180deg, rgba(28, 33, 38, .04), transparent);
  border-bottom: 1px solid transparent;
}
.settings-panel[open] > summary {
  border-bottom-color: #d3dce3;
  background: linear-gradient(90deg, rgba(38, 147, 209, .1), transparent 60%);
}
.settings-panel > summary::-webkit-details-marker,
.settings-panel > summary::marker {
  display: none;
  content: '';
  font-size: 0;
}
.settings-panel > summary .settings-chevron {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-right: 1.5px solid var(--cgm, #2693d1);
  border-bottom: 1.5px solid var(--cgm, #2693d1);
  transform: rotate(-45deg);
  transition: transform .2s ease;
  margin-top: -2px;
}
.settings-panel[open] > summary .settings-chevron {
  transform: rotate(45deg);
  margin-top: 0;
}
.settings-panel > summary:hover {
  color: var(--steel, #1c2126);
}
.settings-panel-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: inherit;
}
.settings-panel-meta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 650;
  color: #8a96a1;
  letter-spacing: 0;
  text-transform: none;
}
.settings-panel-body {
  padding: 14px 16px 16px;
  background: rgba(232, 245, 252, .35);
}
.settings-masters {
  margin: 0 0 12px;
  padding: 14px;
  background: #eef5f9;
  border: 1px solid #c5d4de;
  border-radius: 12px;
}
.settings-masters-label {
  display: block;
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #6b7785;
}
.settings-masters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.settings-master {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #b7c9d6;
  background: #e4edf4;
  font-size: 13px;
  font-weight: 700;
  color: #1c2126;
  cursor: pointer;
  line-height: 1.25;
}
.settings-master:hover { border-color: #7eb8d8; background: #d7eaf6; }
.settings-master input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  accent-color: #2693d1;
  flex: 0 0 auto;
}
.settings-table {
  margin: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #f4f8fb;
  border: 1px solid #b7c9d6;
  border-radius: 12px;
}
.settings-table table {
  width: 100%;
  min-width: 640px;
  margin: 0;
  border-collapse: collapse;
}
.settings-table th,
.settings-table td {
  text-align: center;
  padding: 14px 12px;
  border-bottom: 1px solid #e8eef3;
  vertical-align: middle;
}
.settings-table th:first-child,
.settings-table td:first-child {
  text-align: left;
  padding-left: 16px;
}
.settings-table thead th {
  background: #1c2126;
  color: #e8eef2;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 0;
  padding-top: 12px;
  padding-bottom: 12px;
}
.settings-table tbody th {
  font-weight: 750;
  color: #1c2126;
  font-size: 14px;
  background: #f4f8fb;
}
.settings-table tbody tr:nth-child(even) th,
.settings-table tbody tr:nth-child(even) td {
  background: #e8eef3;
}
.settings-table tbody tr:nth-child(odd) td {
  background: #f4f8fb;
}
.settings-table tbody tr:last-child th,
.settings-table tbody tr:last-child td {
  border-bottom: 0;
}
.settings-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0 auto;
  cursor: pointer;
  border-radius: 10px;
}
.settings-check:hover { background: #e8f5fc; }
.settings-check input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #2693d1;
  cursor: pointer;
}
.settings-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 4px;
}
.settings-panel[data-cat="cat0"] { border-left: 3px solid #2693d1; }
.settings-panel[data-cat="cat1"] { border-left: 3px solid #1b7a52; }
.settings-panel[data-cat="cat2"] { border-left: 3px solid #c26a12; }
.settings-panel[data-cat="cat3"] { border-left: 3px solid #6b7280; }

@media (max-width: 820px) {
  .settings-card { padding: 18px 4px 16px; }
  .settings-masters-grid { grid-template-columns: 1fr 1fr; }
  .settings-panel > summary { padding: 14px 14px; }
  .settings-panel-body { padding: 0 12px 12px; }
  .settings-table table { min-width: 560px; }
}
.table-actions { white-space: nowrap; }
.table-actions form { display: inline; margin: 0; }
.home-foot {
  text-align: center;
  padding-bottom: max(12px, var(--safe-bottom));
}

@media (max-width: 820px) {
  .topnav-toggle {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
  }
  .topnav-links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: var(--topnav-h);
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 10px 12px 14px;
    background: var(--steel, #1c2126);
    border-bottom: 2px solid var(--cgm, #2693d1);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .28);
  }
  .topnav.is-open .topnav-links { display: flex; }
  .topnav-link {
    padding: 14px 14px;
    font-size: 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .dropdown > summary {
    max-width: 120px;
    padding: 10px 12px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .dropdown-panel {
    position: fixed;
    left: max(12px, var(--safe-left));
    right: max(12px, var(--safe-right));
    top: calc(var(--topnav-h) + 8px);
    min-width: 0;
    width: auto;
  }
  body.has-topnav .side {
    position: static;
    height: auto;
  }
  .auth-main {
    margin-top: 18px;
    margin-bottom: calc(28px + var(--safe-bottom));
  }
}
