/* ==========================================================================
   REDA — Espace membres
   ========================================================================== */
body.app { overflow: hidden; height: 100vh; height: 100dvh; }
.shell { display: grid; grid-template-columns: 264px 1fr; height: 100vh; height: 100dvh; }

/* ---------- Barre latérale ---------- */
.sidebar { background: var(--navy); color: #C3CCE0; display: flex; flex-direction: column; min-height: 0; z-index: 40; }
.sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem; color: #fff !important; text-decoration: none !important; }
.sidebar .brand-logo { width: 40px; height: 40px; border-radius: 11px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.sidebar .brand-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.sidebar .brand b { font-size: 1.15rem; letter-spacing: -.02em; display: block; line-height: 1; }
.sidebar .brand small { font-size: .68rem; color: #8B96B0; }
.side-nav { flex: 1; overflow-y: auto; padding: .4rem .75rem 1rem; scrollbar-width: thin; scrollbar-color: #24304A transparent; }
.side-group { margin-top: 1.1rem; }
.side-group > span { display: block; padding: 0 .7rem .4rem; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #66718C; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .58rem .75rem; border-radius: 10px; color: #C3CCE0 !important; font-weight: 600; font-size: .9rem; text-decoration: none !important; position: relative; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff !important; }
.side-link.active { background: color-mix(in srgb, var(--brand) 22%, transparent); color: #fff !important; }
.side-link.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.side-link .icon { width: 19px; height: 19px; opacity: .9; }
.side-link .count { margin-left: auto; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 800; border-radius: 999px; padding: .1em .5em; min-width: 20px; text-align: center; }
.side-foot { padding: .9rem; border-top: 1px solid rgba(255, 255, 255, .07); }
.side-user { display: flex; align-items: center; gap: .7rem; padding: .5rem; border-radius: 12px; color: #fff !important; text-decoration: none !important; }
.side-user:hover { background: rgba(255, 255, 255, .06); }
.side-user .who { min-width: 0; }
.side-user .who b { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who span { font-size: .74rem; color: #8B96B0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ---------- Zone principale ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: 64px; flex: none; display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.search-trigger { display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--muted); width: min(420px, 100%); cursor: pointer; font-size: .9rem; }
.search-trigger .label-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger kbd { white-space: nowrap; margin-left: auto; font-family: inherit; font-size: .72rem; border: 1px solid var(--border); border-radius: 6px; padding: .05em .45em; background: var(--surface); }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .64rem; font-weight: 800; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--surface); }
.content { flex: 1; overflow-y: auto; min-height: 0; }
.page { padding: 1.75rem; max-width: 1360px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.6rem; margin: 0 0 .2rem; }
.page-head p { color: var(--muted); margin: 0; }
.mobile-only { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(7, 12, 23, .5); z-index: 35; }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 0 1rem; }
  .search-trigger kbd, .search-trigger .label-text { display: none; }
  .search-trigger { width: auto; }
  .page { padding: 1.1rem; }
}

/* ---------- Panneau de notifications ---------- */
.dropdown { position: absolute; top: calc(100% + 8px); right: 0; width: min(380px, calc(100vw - 2rem)); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; animation: pop .15s; }
.dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1rem; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); color: inherit !important; text-decoration: none !important; cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--brand-50) 70%, transparent); }
.notif .ic { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--brand-50); color: var(--link); }
.notif b { font-size: .87rem; display: block; }
.notif p { font-size: .8rem; color: var(--text-2); margin: .1rem 0; }

/* ---------- Palette de recherche ---------- */
.cmdk { width: min(620px, 100%); align-self: start; margin-top: 10vh; }
.cmdk input { border: 0; font-size: 1.05rem; padding: 1.1rem 1.2rem; width: 100%; background: transparent; outline: none; border-bottom: 1px solid var(--border); }
.cmdk-results { max-height: 50vh; overflow-y: auto; padding: .5rem; }
.cmdk-item { display: flex; align-items: center; gap: .8rem; padding: .7rem .8rem; border-radius: 10px; color: inherit !important; text-decoration: none !important; }
.cmdk-item:hover, .cmdk-item.sel { background: var(--surface-2); }
.cmdk-item .type { margin-left: auto; font-size: .72rem; color: var(--muted); font-weight: 700; }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: radial-gradient(120% 120% at 0 0, #19C2FF, var(--brand) 40%, var(--brand-700)); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); max-width: 16ch; }
.auth-side ul { list-style: none; padding: 0; display: grid; gap: .8rem; }
.auth-side li { display: flex; gap: .7rem; align-items: center; font-weight: 600; }
.auth-form { display: grid; place-items: center; padding: 2rem; background: var(--bg); }
.auth-card { width: min(420px, 100%); }
.demo-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.demo-accounts button { text-align: left; font-size: .78rem; padding: .5rem .6rem; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.demo-accounts button:hover { border-color: var(--brand); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------- Tableau de bord ---------- */
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1100px) { .grid-main, .grid-side { grid-template-columns: minmax(0, 1fr); } }
.welcome { border-radius: 20px; padding: 1.6rem 1.8rem; background: radial-gradient(120% 160% at 100% 0, #19C2FF, var(--brand) 40%, var(--brand-700)); color: #fff; display: flex; justify-content: space-between; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.welcome h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
.welcome p { margin: 0; opacity: .9; }
.welcome .btn { background: rgba(255, 255, 255, .18); color: #fff !important; }
.welcome .btn:hover { background: rgba(255, 255, 255, .28); }
.todo { display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem; border-radius: 12px; background: var(--surface-2); color: inherit !important; text-decoration: none !important; font-weight: 600; font-size: .9rem; }
.todo:hover { background: var(--brand-50); }
.todo.urgent { background: var(--warn-bg); color: var(--warn) !important; }
.list-item { display: flex; align-items: center; gap: .85rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); color: inherit !important; text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); }
.mini-date { width: 46px; flex: none; text-align: center; border-radius: 10px; background: var(--brand-50); color: var(--link); padding: .3rem 0; line-height: 1.1; }
.mini-date b { display: block; font-size: 1.15rem; }
.mini-date span { font-size: .66rem; font-weight: 800; text-transform: uppercase; }
.axis-row { display: grid; grid-template-columns: 26px 1fr 52px; gap: .7rem; align-items: center; padding: .5rem 0; font-size: .88rem; }
.axis-row .n { font-weight: 800; color: var(--muted); font-size: .8rem; }
.axis-row .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-2) 0); display: grid; place-items: center; flex: none; }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 1.5rem; display: block; line-height: 1; }
.ring span { font-size: .7rem; color: var(--muted); }

/* ---------- Messagerie ---------- */
.chat { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 64px); height: calc(100dvh - 64px); }
.chat-side { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; gap: .5rem; align-items: center; }
.chat-list { overflow-y: auto; flex: 1; padding: .5rem; }
.chat-list h6 { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: .9rem .6rem .4rem; }
.chan { display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem; border-radius: 10px; cursor: pointer; color: inherit !important; text-decoration: none !important; }
.chan:hover { background: var(--surface-2); }
.chan.active { background: var(--brand-50); }
.chan .hash { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.chan .name { font-weight: 700; font-size: .88rem; }
.chan .last { font-size: .77rem; color: var(--muted); }
.chan.unread .name { color: var(--text); }
.chan .count { margin-left: auto; background: var(--brand); color: #fff; font-size: .68rem; font-weight: 800; border-radius: 999px; padding: .1em .5em; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-head { padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: .75rem; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: .15rem; }
.msg { display: flex; gap: .7rem; padding: .3rem .5rem; border-radius: 10px; position: relative; }
.msg:hover { background: var(--surface); }
.msg.cont { padding-top: 0; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg .body { min-width: 0; flex: 1; }
.msg .who { font-weight: 700; font-size: .88rem; }
.msg .when { font-size: .72rem; color: var(--muted); margin-left: .4rem; font-weight: 500; }
.msg .text { font-size: .93rem; white-space: pre-wrap; word-wrap: break-word; }
.msg .text .mention { background: var(--brand-50); color: var(--link); border-radius: 4px; padding: 0 .2em; font-weight: 700; }
.msg .deleted { font-style: italic; color: var(--muted); font-size: .85rem; }
.msg .actions { position: absolute; right: .5rem; top: -.6rem; display: none; gap: .2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .15rem; box-shadow: var(--shadow-sm); }
.msg:hover .actions { display: flex; }
.attachment { display: inline-flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-top: .3rem; font-size: .85rem; color: inherit !important; text-decoration: none !important; }
.attachment img { max-width: 260px; max-height: 200px; border-radius: 8px; }
.day-sep { text-align: center; font-size: .74rem; color: var(--muted); font-weight: 700; margin: 1rem 0 .5rem; display: flex; align-items: center; gap: .8rem; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.composer { padding: .8rem 1.25rem 1rem; background: var(--bg); }
.composer-box { display: flex; align-items: flex-end; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: .45rem; }
.composer-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.composer textarea { flex: 1; border: 0; resize: none; background: transparent; outline: none; padding: .45rem .5rem; max-height: 160px; min-height: 24px; line-height: 1.45; }
.typing { font-size: .76rem; color: var(--muted); height: 1.2rem; padding: 0 1.4rem; }
.emoji-pop { position: absolute; bottom: 100%; left: 0; margin-bottom: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .5rem; display: grid; grid-template-columns: repeat(8, 1fr); gap: .2rem; box-shadow: var(--shadow); z-index: 5; }
.emoji-pop button { border: 0; background: none; font-size: 1.25rem; cursor: pointer; border-radius: 6px; padding: .2rem; }
.emoji-pop button:hover { background: var(--surface-2); }
@media (max-width: 860px) {
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat.has-active .chat-side { display: none; }
  .chat:not(.has-active) .chat-main { display: none; }
}

/* ---------- Documents ---------- */
.drop-zone { border: 2px dashed var(--border); border-radius: 16px; padding: 1.4rem; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.drop-zone.over { border-color: var(--brand); background: var(--brand-50); color: var(--link); }
.file-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: .64rem; font-weight: 900; color: #fff; letter-spacing: .02em; }
.folder-card { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; color: inherit !important; text-decoration: none !important; }
.folder-card:hover { border-color: var(--brand); }
.folder-card .icon { width: 28px; height: 28px; color: var(--brand); }
.breadcrumb { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-weight: 700; font-size: .92rem; }
.breadcrumb a { color: var(--muted); }

/* ---------- Kanban / Projets ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col { background: var(--surface-2); border-radius: 16px; padding: .75rem; min-height: 200px; }
.kanban-col h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); display: flex; justify-content: space-between; margin: .2rem .3rem .8rem; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .85rem; margin-bottom: .6rem; cursor: pointer; color: inherit !important; display: block; text-decoration: none !important; }
.kanban-card:hover { box-shadow: var(--shadow); }
.stepper { display: flex; gap: .3rem; }
.stepper i { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); }
.stepper i.on { background: var(--brand); }

/* ---------- Formation ---------- */
.module { display: flex; gap: .9rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); align-items: flex-start; }
.module:last-child { border-bottom: 0; }
.module .tick { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; cursor: pointer; background: var(--surface); color: transparent; }
.module .tick.done { background: var(--good); border-color: var(--good); color: #fff; }
.module .tick:disabled { cursor: default; }
.module.locked { opacity: .6; }

/* ---------- Certificat imprimable ---------- */
.certificate { background: #fff; color: #0B1220; aspect-ratio: 1.414; max-width: 900px; margin: 0 auto; border-radius: 6px; padding: 3.2rem; position: relative; box-shadow: var(--shadow-lg); border: 14px solid #00AEEF; outline: 2px solid #0B1220; outline-offset: -24px; display: flex; flex-direction: column; align-items: center; text-align: center; justify-content: space-between; }
.certificate h2 { font-size: 2.4rem; letter-spacing: .12em; margin: .6rem 0 0; }
.certificate .name { font-size: 2.2rem; font-weight: 800; border-bottom: 2px solid #00AEEF; padding: 0 2rem .4rem; margin: .4rem 0 1rem; }
.certificate .foot { display: flex; justify-content: space-between; width: 100%; align-items: flex-end; font-size: .85rem; }
.certificate .seal { width: 92px; height: 92px; border-radius: 50%; background: #00AEEF; color: #fff; display: grid; place-items: center; font-weight: 900; transform: rotate(-12deg); }
@media print {
  body.app { overflow: visible; height: auto; }
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .shell { display: block; height: auto; }
  .content { overflow: visible; }
  .certificate { box-shadow: none; margin: 0; }
  @page { size: A4 landscape; margin: 0; }
}

/* ---------- Rôles ---------- */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .4rem .9rem; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.status-dot { display: inline-flex; align-items: center; gap: .4em; font-size: .82rem; font-weight: 600; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Profil ---------- */
.profile-cover { height: 130px; border-radius: 18px 18px 0 0; background: radial-gradient(120% 160% at 100% 0, #19C2FF, var(--brand) 40%, var(--brand-700)); }
.profile-head { display: flex; gap: 1.25rem; align-items: flex-end; padding: 0 1.5rem 1.25rem; margin-top: -52px; flex-wrap: wrap; }
.profile-head .avatar { border: 4px solid var(--surface); }
.member-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem; padding: 1.4rem 1rem; color: inherit !important; text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
.member-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.member-card .roles { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: center; }
.id-card { border-radius: 18px; padding: 1.3rem; color: #fff; background: linear-gradient(135deg, var(--navy), #1B2B4D); position: relative; overflow: hidden; }
.id-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 40%, transparent); }
.id-card .logo { width: 44px; height: 44px; background: #fff; border-radius: 10px; padding: 3px; }

/* Toasts en haut à droite pour ne pas masquer la zone de saisie du chat */
body.app .toasts { top: 76px; bottom: auto; }
