/* Account button and menu in the site header, account pages, admin "Comptes" page. */
.btn[data-cta]:not(.btn-light):not(.btn-outline) { background: var(--accent, #b4432c); border-color: var(--accent, #b4432c); color: #fff; }
.btn[data-cta]:not(.btn-light):not(.btn-outline):hover { background: var(--accent-deep, #93361f); border-color: var(--accent-deep, #93361f); color: #fff; }
.main-nav .nav-account { margin-left: 0; }
.account-menu { position: relative; margin-left: 0; }
.account-toggle { display: inline-flex; align-items: center; gap: 8px; padding-left: 6px; }
.account-initial { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 14px; font-weight: 700; }
.account-toggle:hover .account-initial { background: #fff; color: var(--navy); }
.account-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--accent, #b4432c); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }
.account-list { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 250px; display: grid; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 40px -18px rgba(16, 42, 60, .45); }
.account-list[hidden] { display: none; }
.account-list a, .account-out { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; }
.account-list a:hover, .account-out:hover { background: var(--paper); color: var(--navy); }
.account-list a.is-admin { font-weight: 500; }
.account-who { margin: 2px 12px 6px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.account-group { margin: 8px 12px 2px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.account-list form { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--line); }
.account-out { width: 100%; border: 0; background: none; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-align: left; }
@media (max-width: 960px) {
  .main-nav .nav-account, .account-menu { margin-left: 0; width: 100%; }
  .account-toggle { width: 100%; justify-content: center; }
  .account-list { position: static; margin-top: 8px; box-shadow: none; }
}
.account-notice > p:first-child { margin: 0; }
.account-notice-wrap { padding-top: clamp(28px, 4vw, 44px); }
.account-notice { padding: 18px 20px; border: 1px solid var(--line); border-left: 4px solid var(--accent, #b4432c); border-radius: 14px; background: var(--surface); }
.account-notice-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }

/* Account pages (/account/) */
.account-main { max-width: 860px; }
.account-box { margin-inline: auto; }
.admin input[type=email], .admin input[type=file] { width: 100%; min-height: 46px; border: 1px solid #bbc4c9; border-radius: var(--radius-sm); background: var(--surface); padding: 9px 12px; font-size: 16px; color: var(--ink); }
.account-check { display: flex !important; align-items: flex-start; gap: 10px; font-weight: 400 !important; color: var(--ink) !important; font-size: 15px !important; }
.account-check input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--navy); }
.account-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.account-info { background: #e9eff5; color: var(--navy); }
.account-register { display: grid; gap: 10px; justify-items: start; padding-top: 18px; border-top: 1px solid var(--line); }
.account-register p { margin: 0; }
.account-section { margin-bottom: 32px; }
.account-section h2 { font-size: 22px; margin: 24px 0 12px; }
.account-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.account-link { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 10px; background: var(--surface); color: var(--navy); font-weight: 600; text-decoration: none; }
.account-link:hover { border-color: var(--navy); }
.account-link.is-admin { border-left-color: var(--accent, #b4432c); }
.account-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.account-forms form { margin: 0; }
.account-lead { margin-bottom: 18px; }
.account-upload { margin-bottom: 24px; }
.account-files { list-style: none; margin: 0; padding: 0; border-top: 3px solid var(--navy); }
.account-files li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.account-files .title { font-weight: 600; color: var(--navy); overflow-wrap: anywhere; margin: 0; }
.account-files .meta { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.account-files form, .admin-list-links form { margin: 0; }

/* Admin "Comptes" page */
.users-section { margin-bottom: 36px; }
.users-section h2 { font-size: 26px; margin-bottom: 14px; }
.users-pending { margin-bottom: 16px; }
.users-pending .title { font: 600 19px/1.3 var(--serif); color: var(--navy); margin: 0; }
.users-pending .meta { font-size: 14px; color: var(--muted); margin: 4px 0 0; }
.users-message, .users-request { margin: 8px 0 0; padding: 10px 14px; background: var(--paper); border-radius: 8px; font-size: 15px; }
.users-request { margin-bottom: 18px; }
.users-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; }
.users-perms .admin-choice { font-size: 15px; font-weight: 500; color: var(--ink); }
.users-perms input[type=checkbox] { width: 20px; height: 20px; flex: none; accent-color: var(--navy); }
.users-perms .is-admin-perm { color: #7a3220; }
.users-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--muted); }
.users-presets .btn { min-height: 36px; padding: 0 14px; font-size: 14px; }
.users-form { margin-bottom: 32px; }
.users-files { margin-bottom: 32px; }
.users-files h2 { font-size: 24px; margin-bottom: 12px; }
.users-more { margin-bottom: 18px; }
.users-more summary { font-weight: 600; cursor: pointer; }
.users-danger { color: #8a2f1c; border-color: #8a2f1c; }
.users-danger:hover { background: #8a2f1c; color: #fff; }
.admin-card-alert { border-top-color: var(--accent, #b4432c); }

/* Admin "Modifier" link next to lesson questions (public/js/admin-edit.js): compact, top-right, never stretched by the flex title. */
.question h3 > .admin-edit-link { flex: none; align-self: flex-start; margin-left: auto; height: auto; padding: 1px 10px; font: 600 12px/1.6 system-ui, sans-serif; white-space: nowrap; }

/* Links to parts of the site the signed-in account cannot open (account.js). */
a.is-locked { opacity: .45; filter: grayscale(1); cursor: not-allowed; }
a.is-locked:hover { transform: none; }
/* Admin account page: the two forms of "Mot de passe et suppression" are spaced and the buttons keep their own width. */
.users-more > form + form { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.users-more form .btn { justify-self: start; }
.users-more summary + form { margin-top: 16px; }

/* Messages (/account/?action=messages): conversations on the left, the open conversation on the right. */
.account-main:has(.msg-layout) { max-width: 1100px; }
.account-messages-link { margin-bottom: 8px; }
.msg-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 24px; align-items: start; }
.msg-side h2, .msg-thread h2 { font-size: 20px; margin: 0 0 12px; }
.msg-list { list-style: none; margin: 0 0 24px; padding: 0; border-top: 3px solid var(--navy); }
.msg-list a { display: grid; gap: 2px; padding: 12px 10px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.msg-list a:hover, .msg-list a[aria-current] { background: var(--paper); }
.msg-list a[aria-current] { box-shadow: inset 4px 0 0 var(--accent, #b4432c); }
.msg-name { font-weight: 700; color: var(--navy); }
.msg-snippet { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-date { font-size: 12px; color: var(--muted); }
.msg-new h2 { font-size: 18px; }
.msg-thread { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.msg-back { display: none; margin: 0 0 10px; }
.msg-pick { margin: 0; }
.msg-items { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; max-height: 60vh; overflow-y: auto; }
.msg-item { display: grid; justify-items: start; }
.msg-item.is-mine { justify-items: end; }
.msg-bubble { max-width: min(80%, 560px); padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: var(--paper); color: var(--ink); overflow-wrap: anywhere; line-height: 1.5; }
.msg-item.is-mine .msg-bubble { border-radius: 14px 14px 4px 14px; background: var(--navy); color: #fff; }
.msg-meta { margin: 4px 2px 0; font-size: 12px; color: var(--muted); }
.msg-reply { display: grid; gap: 10px; justify-items: start; }
.msg-reply .admin-field { width: 100%; }
.admin textarea { width: 100%; }
@media (max-width: 760px) {
  .msg-layout { grid-template-columns: 1fr; }
  .msg-layout.has-thread .msg-side { display: none; }
  .msg-layout:not(.has-thread) .msg-thread { display: none; }
  .msg-back { display: block; }
  .msg-thread { padding: 14px; }
  .msg-bubble { max-width: 90%; }
}
/* Message attachments. */
.msg-files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.msg-files a { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .7); color: var(--navy); font-weight: 600; font-size: 14px; text-decoration: none; overflow-wrap: anywhere; }
.msg-item.is-mine .msg-files a { background: rgba(255, 255, 255, .14); color: #fff; }
.msg-files a:hover { text-decoration: underline; }
.msg-size { font-weight: 400; font-size: 12px; opacity: .8; }
.msg-layout input[type=file] { width: 100%; min-height: 46px; border: 1px solid #bbc4c9; border-radius: var(--radius-sm); background: var(--surface); padding: 9px 12px; font-size: 15px; }

/* Header drop-downs on short screens: the Lessons menu shows two columns and both menus
   scroll inside the window instead of running past its bottom edge. */
@media (min-width: 901px) {
  .site-header .nav-sub { width: min(540px, calc(100vw - 32px)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
  .site-header .nav-sub, .site-header .account-list { max-height: calc(100vh - var(--header-h, 68px) - 24px); overflow-y: auto; overscroll-behavior: contain; }
  .site-header .nav-sub a { padding: 9px 12px; }
  .site-header .account-list a, .site-header .account-out { padding-block: 7px; }
  .site-header .nav-group::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
}
@media (min-width: 961px) {
  .site-header .account-list { min-width: 280px; }
}

/* Account menu in two columns when it has an Admin section (Guigz 2026-11-12); stacked on phones. */
.account-col { display: grid; align-content: start; min-width: 0; }
.account-list--two .account-col > .account-group:first-child { margin-top: 2px; padding-top: 0; border-top: 0; }
.account-list--two .account-who, .account-list--two form { grid-column: 1 / -1; }
@media (min-width: 961px) {
  .site-header .account-list.account-list--two { grid-template-columns: 1fr 1fr; column-gap: 8px; width: 520px; max-width: calc(100vw - 32px); }
  .account-list--two .account-col--admin { border-left: 1px solid var(--line); padding-left: 8px; }
}
@media (max-width: 960px) {
  .account-list--two .account-col--admin > .account-group:first-child { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
}
