:root {
    --teal:        #0d9488;
    --teal-dark:   #134e48;
    --teal-darker: #0c322e;
    --teal-mid:    #14b8a6;
    --teal-soft:   #7fd8cc;
    --teal-pale:   #e6f5f2;
    --teal-tint:   #f3faf8;

    --ink:    #14201e;
    --slate:  #5b6b68;
    --line:   #e4ece9;
    --line-2: #d6e2de;
    --bg:     #f6faf9;
    --white:  #ffffff;

    --radius:    12px;
    --bar-h:     40px;
    --radius-sm: 8px;
    --shadow:    0 1px 2px rgba(19, 78, 72, .06), 0 8px 24px rgba(19, 78, 72, .07);
    --shadow-sm: 0 1px 2px rgba(19, 78, 72, .08);
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

/* L'attribut hidden doit toujours l'emporter, même sur display:flex. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-dark); text-decoration: none; }
h1, h2, h3 { line-height: 1.15; margin: 0; }

/* ---------- Marque ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__icon { display: block; }
.brand__word {
    font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; color: var(--teal-dark);
}
.brand__word span { color: var(--teal); }
.brand--white .brand__word { color: #fff; }
.brand--white .brand__word span { color: var(--teal-soft); }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: 10px 16px; transition: transform .08s ease, background .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--teal); color: #fff; }
.btn--primary:hover { background: var(--teal-dark); }
.btn--ghost { background: transparent; color: var(--teal-dark); border-color: var(--line-2); }
.btn--ghost:hover { background: var(--teal-pale); }
.btn--lg { padding: 14px 24px; font-size: 1.02rem; }
.btn--sm { padding: 7px 12px; font-size: .9rem; }
.btn--block { width: 100%; }

/* ============================================================
   SITE VITRINE
   ============================================================ */
.site-nav {
    display: flex; align-items: center; justify-content: space-between;
    max-width: 1120px; margin: 0 auto; padding: 22px 24px;
}
.site-nav__links { display: flex; gap: 10px; align-items: center; }

.hero {
    max-width: 1120px; margin: 0 auto; padding: 48px 24px 24px;
    display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center;
}
.eyebrow {
    text-transform: uppercase; letter-spacing: .14em; font-size: .78rem;
    font-weight: 700; color: var(--teal); margin: 0 0 14px;
}
.hero h1 { font-size: 3.2rem; font-weight: 800; letter-spacing: -.03em; }
.hero h1 .accent { color: var(--teal); }
.lead { font-size: 1.18rem; color: var(--slate); line-height: 1.65; margin: 22px 0 30px; max-width: 30em; }
.lead strong { color: var(--ink); font-weight: 700; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* visuel : carte empilée façon logo */
.hero__visual { display: flex; justify-content: center; }
.stack-card {
    width: 100%; max-width: 360px; background: var(--white);
    border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
    padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.stack-card__head { padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.stack-row {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px;
    border-radius: 10px; font-weight: 600; font-size: .95rem; position: relative;
}
.stack-row--1 { background: var(--teal-soft); color: var(--teal-darker); }
.stack-row--2 { background: var(--teal-mid); color: #fff; }
.stack-row--3 { background: var(--teal); color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; opacity: .55; }
.dot--solid { opacity: 1; }
.tail {
    position: absolute; left: 16px; bottom: -7px; width: 14px; height: 14px;
    background: var(--teal); border-bottom-left-radius: 3px;
    clip-path: polygon(0 0, 0 100%, 100% 0);
}
.bubble {
    margin-top: 6px; padding: 11px 14px; border-radius: 14px; font-size: .94rem; line-height: 1.45; max-width: 86%;
}
.bubble--in { background: var(--teal-tint); border: 1px solid var(--line); color: var(--ink); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble--out { background: var(--teal-dark); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }

.features {
    max-width: 1120px; margin: 40px auto; padding: 24px;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.feature {
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 26px; box-shadow: var(--shadow-sm);
}
.feature h3 { font-size: 1.25rem; margin: 14px 0 8px; }
.feature p { color: var(--slate); line-height: 1.6; margin: 0; }
.feature__icon {
    width: 46px; height: 46px; border-radius: 12px; background: var(--teal-pale);
    display: grid; place-items: center; color: var(--teal-dark); font-size: 1.3rem;
}
.feature__icon--folder, .feature__icon--simple { font-size: 1.5rem; }

/* motif "couches" réutilisé */
.layers { display: inline-flex; flex-direction: column; gap: 3px; width: 22px; }
.layers i { height: 5px; border-radius: 3px; background: var(--teal); display: block; }
.layers i:nth-child(1) { background: var(--teal-soft); }
.layers i:nth-child(2) { background: var(--teal-mid); }
.layers i:nth-child(3) { width: 66%; }
.layers--lg { width: 40px; gap: 5px; }
.layers--lg i { height: 9px; }

.how { max-width: 880px; margin: 60px auto; padding: 0 24px; text-align: center; }
.how h2 { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 34px; }
.how__steps { list-style: none; padding: 0; margin: 0 0 34px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; text-align: left; }
.how__steps li { display: flex; gap: 14px; }
.how__num {
    flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--teal);
    color: #fff; font-weight: 700; display: grid; place-items: center;
}
.how__steps strong { display: block; margin-bottom: 4px; }
.how__steps p { margin: 0; color: var(--slate); font-size: .95rem; line-height: 1.5; }

.site-foot {
    border-top: 1px solid var(--line); margin-top: 40px; padding: 28px 24px;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    max-width: 1120px; margin-left: auto; margin-right: auto; color: var(--slate); font-size: .9rem;
}

/* ============================================================
   AUTHENTIFICATION
   ============================================================ */
body.auth { background: linear-gradient(160deg, var(--teal-tint), var(--bg) 55%); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 20px; }
.auth-card {
    width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--line);
    border-radius: 16px; box-shadow: var(--shadow); padding: 32px;
}
.auth-card h1 { font-size: 1.7rem; font-weight: 800; }
.auth-sub { color: var(--slate); margin: 6px 0 22px; }
.auth-alt { text-align: center; margin: 18px 0 0; color: var(--slate); font-size: .95rem; }
.auth-alt a { font-weight: 600; }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-weight: 600; font-size: .92rem; }
.field small { color: var(--slate); font-size: .82rem; }
input[type="text"], input[type="email"], input[type="password"], textarea {
    font: inherit; color: var(--ink); background: var(--white);
    border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 13px; width: 100%;
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-pale); }

.alert { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 18px; font-size: .92rem; }
.alert p { margin: 2px 0; }
.alert--error { background: #fdecec; color: #a23030; border: 1px solid #f5c6c6; }
.alert--info { background: var(--teal-pale); color: var(--teal-dark); border: 1px solid var(--teal-soft); }

/* ============================================================
   APPLICATION
   ============================================================ */
body.app { background: var(--bg); height: 100vh; overflow: hidden; }
.app-shell { height: 100vh; display: flex; flex-direction: column; }

.app-top {
    flex: none; display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 12px 20px; background: var(--white); border-bottom: 1px solid var(--line);
}
.app-top__user { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
.app-top__name { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28vw; }
.app-top__brand { flex: none; }
.nav-toggle {
    display: none; flex: none; width: 40px; height: 40px; border: 1px solid var(--line-2);
    background: var(--white); border-radius: 10px; font-size: 1.2rem; line-height: 1; cursor: pointer;
    color: var(--ink); align-items: center; justify-content: center;
}
.nav-toggle:hover { background: var(--teal-tint); }
.app-notice {
    flex: none; background: var(--teal-pale); color: var(--teal-dark);
    padding: 9px 20px; font-size: .9rem; font-weight: 600;
}

.avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: .95rem; flex: none;
}
.avatar--xs { width: 26px; height: 26px; font-size: .78rem; }

.panes { flex: 1; display: grid; grid-template-columns: var(--w-groups, 240px) var(--w-folders, 270px) 1fr; min-height: 0; }
.pane { position: relative; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--white); }

/* Poignée de redimensionnement (bord droit des volets Groupes et Dossiers) */
.pane-resizer {
    position: absolute; top: 0; right: -3px; bottom: 0; width: 7px; z-index: 15;
    cursor: col-resize; touch-action: none;
}
.pane-resizer::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px;
    background: transparent; transition: background .15s ease;
}
.pane-resizer:hover::after, .pane-resizer.is-dragging::after { background: var(--teal); width: 2px; left: 2px; }
body.is-resizing { cursor: col-resize; user-select: none; }
body.is-resizing iframe, body.is-resizing video { pointer-events: none; }
.pane--groups { background: var(--teal-tint); }
.pane--messages { border-right: none; background: var(--bg); position: relative; }
.pane__head { flex: none; padding: 16px 18px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pane__head-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.pane__head-main h2, .pane__head > h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane__head h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; }
.pane__head--msg { border-bottom: 1px solid var(--line); padding-bottom: 14px; background: var(--white); }
.pane__sub { color: var(--slate); font-size: .82rem; white-space: nowrap; }
.folder-ico { color: var(--teal); }

.head-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.head-actions form { display: inline; margin: 0; }
.icon-btn {
    display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
    border: 1px solid var(--line-2); background: var(--white); color: var(--teal-dark);
    font-size: .95rem; cursor: pointer; line-height: 1; padding: 0;
}
.icon-btn:hover { background: var(--teal-pale); }
.icon-btn--danger { color: #b3261e; }
.icon-btn--danger:hover { background: #fdecec; border-color: #f5c6c6; }

.edit-form { display: flex; align-items: center; gap: 6px; }
.edit-form input[type="text"] { flex: 1; padding: 8px 11px; }

.msg__edit { display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.msg__edit textarea { resize: vertical; font: inherit; }
.msg--mine .msg__edit textarea { color: var(--ink); }
.msg__edit-actions { display: flex; gap: 6px; }

.msg__actions { display: none; gap: 12px; margin-top: 6px; align-items: center; }
.msg:hover .msg__actions { display: flex; }
.msg__actions a, .msg__actions button {
    display: inline-flex; align-items: center; line-height: 1;
    background: none; border: none; padding: 0; margin: 0; font: inherit; font-size: .76rem; font-weight: 600;
    color: var(--slate); cursor: pointer; opacity: .85; vertical-align: middle;
}
.msg__actions form { display: inline-flex; align-items: center; margin: 0; padding: 0; }
.msg__actions a:hover, .msg__actions button:hover { color: var(--teal-dark); opacity: 1; }
.msg--mine .msg__actions a, .msg--mine .msg__actions button { color: rgba(255,255,255,.85); }
.msg--mine .msg__actions a:hover, .msg--mine .msg__actions button:hover { color: #fff; }
@media (hover: none) { .msg__actions { display: flex; } }

.list { flex: 1; overflow-y: auto; padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.list__row {
    display: flex; align-items: center; border-radius: 9px; transition: background .12s ease;
}
.list__row:hover { background: rgba(13, 148, 136, .08); }
.list__row.is-active { background: var(--teal); }
.list__row.is-active .list__item,
.list__row.is-active .list__label { color: #fff; }
.list__row.is-active .list__avatar { background: rgba(255,255,255,.25); color: #fff; }
.list__row.is-active .folder-ico { color: #fff; }
.list__item {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 10px;
    color: var(--ink); font-weight: 600; font-size: .94rem;
}
.list__avatar {
    width: 28px; height: 28px; border-radius: 8px; background: var(--teal-soft); color: var(--teal-darker);
    display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex: none;
}
.list__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.unread-dot {
    flex: none; width: 8px; height: 8px; border-radius: 50%; background: #e23b3b;
    margin-left: 2px; align-self: center;
}
.list__row.is-active .unread-dot { background: #fff; }
.msg__seen { position: relative; display: inline-flex; margin-top: 3px; cursor: default; }
.msg__seen-ico { font-size: .72rem; letter-spacing: -1px; opacity: .6; color: var(--teal-dark); }
.msg--mine .msg__seen-ico { color: #eafaf7; opacity: .9; }
.seen-pop {
    position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 40;
    min-width: 160px; max-width: 260px; padding: 8px 10px;
    background: var(--ink); color: #fff; border-radius: 10px; box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(2px); transition: opacity .12s ease, transform .12s ease;
    pointer-events: none; text-align: left; white-space: nowrap;
}
.msg--mine .seen-pop { left: auto; right: 0; }
.msg__seen:hover .seen-pop, .msg__seen:focus .seen-pop, .msg__seen:focus-within .seen-pop {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.seen-pop__title { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; opacity: .6; margin-bottom: 5px; }
.seen-pop__row { display: flex; justify-content: space-between; gap: 14px; font-size: .8rem; line-height: 1.7; }
.seen-pop__name { font-weight: 600; }
.seen-pop__time { opacity: .7; }
.list__item--folder { font-weight: 500; }

/* Actions par ligne (renommer / supprimer), toujours visibles */
.row-actions { display: flex; align-items: center; gap: 2px; flex: none; padding-right: 6px; }
.row-actions form { display: inline; margin: 0; }
.icon-btn--xs { width: 26px; height: 26px; font-size: .82rem; border-color: transparent; background: transparent; }
.list__row:hover .icon-btn--xs { border-color: var(--line-2); background: var(--white); }
.list__row.is-active .icon-btn--xs { color: #fff; }
.list__row.is-active .icon-btn--xs:hover { background: rgba(255,255,255,.18); }
.list__row.is-active .icon-btn--xs.icon-btn--danger { color: #ffe3e0; }

/* Renommage inline dans la ligne */
.row-edit { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; padding: 5px 6px; }
.row-edit input[type="text"] { flex: 1; min-width: 0; padding: 6px 9px; font-size: .9rem; }
.list__row.is-editing .list__item,
.list__row.is-editing .row-actions { display: none; }
.list__row.is-editing { background: rgba(13, 148, 136, .08); }

.pane__add {
    flex: none; display: flex; gap: 8px; align-items: center; padding: 12px;
    border-top: 1px solid var(--line);
}
.pane__add input { padding: 8px 11px; height: var(--bar-h); }

.members-menu { position: relative; }
.members-panel {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: 300px; max-width: 86vw;
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px;
}
.members-panel__head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.members-panel__head strong { font-size: .98rem; color: var(--ink); }
.members__list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.members__list li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.members__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tag { font-size: .7rem; background: var(--teal-pale); color: var(--teal-dark); padding: 2px 7px; border-radius: 20px; font-weight: 700; }
.members__add { display: flex; gap: 6px; }
.members__add input { padding: 8px 10px; font-size: .88rem; flex: 1; min-width: 0; }

/* Invitations en attente dans le panneau Membres */
.members-pending { border-top: 1px solid var(--line); padding-top: 10px; margin-bottom: 12px; }
.members-pending__title { margin: 0 0 8px; font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); }
.members__list--pending li .members__name { color: var(--slate); font-style: italic; }
.avatar--ghost { background: var(--line); color: var(--slate); }

/* fil de messages */
.stream { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 70%; }
.msg--mine { align-self: flex-end; flex-direction: row-reverse; }
.msg__bubble {
    background: var(--white); border: 1px solid var(--line); border-radius: 14px;
    padding: 9px 13px; box-shadow: var(--shadow-sm); border-bottom-left-radius: 4px;
}
.msg--mine .msg__bubble { background: var(--teal); border-color: var(--teal); color: #fff; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.msg__author { display: block; font-weight: 700; font-size: .82rem; color: var(--teal-dark); margin-bottom: 2px; }
.msg__body { margin: 0; line-height: 1.5; font-size: .96rem; word-wrap: break-word; }
.msg__time { display: block; font-size: .72rem; opacity: .6; margin-top: 4px; }

.composer {
    flex: none; display: flex; flex-direction: column; gap: 10px;
    padding: 12px 20px; border-top: 1px solid var(--line); background: var(--white);
}
.composer__row { display: flex; gap: 10px; align-items: flex-end; }
.composer__row > .btn { height: var(--bar-h); display: inline-flex; align-items: center; }
.composer textarea { resize: none; max-height: 260px; line-height: 1.5; flex: 1; padding: 8px 11px; min-height: var(--bar-h); height: var(--bar-h); }
.composer .icon-btn { width: var(--bar-h); height: var(--bar-h); font-size: 1.05rem; flex: none; cursor: pointer; }
.composer .icon-btn input[type="file"] { position: absolute; }

.composer__files { display: flex; flex-wrap: wrap; gap: 8px; }
.composer__chip {
    display: inline-flex; align-items: center; gap: 6px; max-width: 220px;
    background: var(--teal-pale); color: var(--teal-dark); border-radius: 20px;
    padding: 5px 12px; font-size: .82rem; font-weight: 600;
}
.composer__chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.poll-builder {
    border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px;
    display: flex; flex-direction: column; gap: 8px; background: var(--teal-tint);
}
.poll-builder__head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: .9rem; color: var(--teal-dark); }
.poll-builder__opts { display: flex; flex-direction: column; gap: 6px; }
.poll-builder__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.poll-builder__multi { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--slate); }

/* Pièces jointes affichées dans un message */
.att { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.att__img { display: block; max-width: 280px; }
.att__img img { width: 100%; border-radius: 10px; display: block; }
.att__video { max-width: 320px; width: 100%; border-radius: 10px; background: #000; }
.att__file {
    display: inline-flex; align-items: center; gap: 10px; background: rgba(13,148,136,.08);
    border-radius: 10px; padding: 9px 12px; color: var(--ink); max-width: 280px;
}
.msg--mine .att__file { background: rgba(255,255,255,.18); color: #fff; }
.att__file-ico { font-size: 1.2rem; }
.att__file-meta { display: flex; flex-direction: column; min-width: 0; }
.att__file-name { font-weight: 600; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att__file-size { font-size: .76rem; opacity: .7; }

/* Sondage affiché dans un message */
.poll { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; min-width: 260px; }
.poll__q { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: .95rem; }
.poll__form { display: flex; flex-direction: column; gap: 6px; }
.poll__opt {
    position: relative; display: flex; align-items: center; gap: 9px; padding: 9px 12px;
    border: 1px solid var(--line-2); border-radius: 9px; cursor: pointer; overflow: hidden; background: var(--white);
}
.poll__opt.is-mine { border-color: var(--teal); }
.poll__bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--teal-pale); z-index: 0; transition: width .3s ease; }
.poll__opt input, .poll__label, .poll__count { position: relative; z-index: 1; }
.poll__label { flex: 1; font-size: .9rem; color: var(--ink); }
.poll__count { font-size: .8rem; color: var(--slate); font-weight: 600; }
.poll__foot { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.poll__total { font-size: .8rem; color: var(--slate); }
.msg--mine .poll__label, .msg--mine .poll__count, .msg--mine .poll__total { color: #fff; }
.msg--mine .poll__opt { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); }
.msg--mine .poll__bar { background: rgba(255,255,255,.22); }

.empty { padding: 28px 18px; color: var(--slate); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty--sm { padding: 14px; font-size: .9rem; }
.empty--center { margin: auto; max-width: 30em; }

/* ---------- Apparition ---------- */
.reveal { opacity: 0; transform: translateY(12px); animation: rise .6s ease forwards; }
.reveal:nth-child(2) { animation-delay: .08s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2.4rem; }
    .features, .how__steps { grid-template-columns: 1fr; }
    body.app, .app-shell { height: auto; overflow: visible; }
    .panes { grid-template-columns: 1fr; }
    .pane { border-right: none; border-bottom: 1px solid var(--line); }
    .pane--groups .list, .pane--folders .list { max-height: 220px; }
    .stream { min-height: 320px; }
    .pane-resizer { display: none; }

    /* Barre du haut compacte pour éviter tout débordement sur mobile */
    .app-top { padding: 10px 12px; gap: 8px; position: relative; }
    .nav-toggle { display: inline-flex; }
    .app-top__brand svg, .app-top__brand img { max-height: 26px; width: auto; }

    /* Le cluster devient un menu déroulant ouvert par le bouton ☰ */
    .app-top__user {
        display: none; position: absolute; top: 100%; right: 0; left: 0; z-index: 50;
        flex-direction: column; align-items: stretch; gap: 12px;
        padding: 14px; background: var(--white); border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow);
    }
    .app-top__user.is-open { display: flex; }
    .app-top__name { display: none; }
    .app-top .btn--sm { padding: 9px 12px; text-align: center; }

    /* Langue : centrée et un peu aérée */
    .app-top__user .lang-switch { justify-content: center; gap: 16px; padding: 2px 0 6px; }

    /* Bouton et panneau Membres : pleine largeur, panneau en ligne (pas en survol) */
    .app-top__user .members-menu { width: 100%; }
    .app-top__user .members-menu > .btn { width: 100%; }
    .app-top__user .members-panel {
        position: static; width: 100%; max-width: none; margin-top: 8px;
        box-shadow: none; border: 1px solid var(--line);
    }
}

/* ============================================================
   ADMINISTRATION
   ============================================================ */
body.admin { background: var(--bg); }
.admin-wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px 48px; }
.admin-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px; margin: 0 -20px 24px; background: var(--white);
    border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.admin-bar--warn { background: #fff7e6; border-bottom-color: #f0d9a8; color: #8a5a00; font-weight: 600; font-size: .92rem; }
.admin-bar--warn a { color: #8a5a00; text-decoration: underline; }
.admin-notice { background: var(--teal-pale); color: var(--teal-dark); padding: 10px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-weight: 600; }
.admin-head { margin: 8px 0 24px; }
.admin-head h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; }
.admin-sub { color: var(--slate); margin: 6px 0 0; }
.admin-empty { color: var(--slate); padding: 16px; text-align: center; }
.admin-muted { color: var(--line-2); }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin-bottom: 36px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; box-shadow: var(--shadow-sm); }
.stat__num { display: block; font-size: 1.7rem; font-weight: 800; color: var(--teal-dark); letter-spacing: -.02em; }
.stat__lbl { display: block; font-size: .82rem; color: var(--slate); margin-top: 4px; }

.admin-section { margin-bottom: 36px; }
.admin-section h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 14px; }
.admin-table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { background: var(--teal-tint); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--slate); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table__email { color: var(--slate); }
.admin-table__actions { display: flex; gap: 12px; align-items: center; }
.admin-table__actions form { display: inline; margin: 0; }

.link-btn { background: none; border: none; padding: 0; font: inherit; font-size: .88rem; font-weight: 600; color: var(--teal-dark); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.link-btn--danger { color: #b3261e; }

.tag--admin { background: var(--teal); color: #fff; }

.admin-read { display: grid; grid-template-columns: 230px 1fr; gap: 20px; }
.admin-read__folders, .admin-read__messages { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.admin-read__folders h2, .admin-read__messages h2 { font-size: 1rem; margin-bottom: 12px; }
.stream--admin { max-height: 60vh; overflow-y: auto; padding: 4px; gap: 12px; }
.poll-read { margin-top: 8px; font-size: .9rem; color: var(--teal-dark); font-weight: 600; }
@media (max-width: 760px) { .admin-read { grid-template-columns: 1fr; } }

/* Zone de dépôt de fichiers (glisser-déposer) */
.dropzone-overlay {
    position: absolute; inset: 8px; z-index: 20;
    display: none; align-items: center; justify-content: center;
    background: rgba(13, 148, 136, .10); border: 2px dashed var(--teal);
    border-radius: var(--radius); backdrop-filter: blur(1px); pointer-events: none;
}
.dropzone-overlay.is-active { display: flex; }
.dropzone-overlay__inner {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    color: var(--teal-dark); font-weight: 700; font-size: 1.05rem;
    background: var(--white); padding: 22px 30px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.dropzone-overlay__ico { font-size: 2rem; }

/* Contrôles de modération dans la vue admin */
.admin-head--mod { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-folder-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.admin-folder-head h2 { margin: 0; }
.admin-mod-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-mod-actions form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.admin-rename input[type="text"] { width: 150px; padding: 7px 10px; font-size: .88rem; }
.btn.link-btn--danger { color: #b3261e; border-color: #f0c4c0; }
.btn.link-btn--danger:hover { background: #fdecec; }
.msg__actions--admin { display: flex; margin-top: 6px; }
.msg__actions--admin button { background: none; border: none; padding: 0; font: inherit; font-size: .76rem; font-weight: 600; color: #b3261e; cursor: pointer; }
.msg__actions--admin button:hover { text-decoration: underline; }

/* Sélecteur de langue (drapeaux) */
.lang-switch { display: inline-flex; align-items: center; gap: 10px; }
.lang-switch__opt {
    display: inline-flex; padding: 2px; border-radius: 5px; line-height: 0;
    opacity: .4; filter: grayscale(60%); transition: opacity .15s ease, filter .15s ease;
    border: 1px solid transparent;
}
.lang-switch__opt:hover { opacity: .85; filter: grayscale(0); }
.lang-switch__opt.is-active { opacity: 1; filter: grayscale(0); border-color: var(--line-2); background: var(--white); }
.lang-switch__opt svg { display: block; border-radius: 2px; }
.auth-lang { position: absolute; top: 20px; right: 20px; }
.auth-wrap { position: relative; }

/* Droits par dossier */
.tag--manager { background: #fff3e0; color: #a85b00; }
.tag--xs { font-size: .62rem; padding: 1px 5px; }
.member-role { display: inline; margin: 0; }
.link-btn { background: none; border: none; padding: 0; font: inherit; cursor: pointer; color: var(--teal-dark); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.link-btn--xs { font-size: .72rem; margin-left: auto; }
.access-panel {
    flex: none; padding: 16px 20px; border-bottom: 1px solid var(--line);
    background: var(--teal-tint); overflow-y: auto; max-height: 60%;
}
.access-panel h3 { margin: 0 0 10px; font-size: 1rem; }
.access-opt { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .92rem; cursor: pointer; }
.access-members { margin: 8px 0 12px; padding: 10px 12px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; }
.access-members.is-off { opacity: .45; pointer-events: none; }
.access-members__hint { margin: 0 0 8px; font-size: .78rem; color: var(--slate); }
.access-member { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: .9rem; cursor: pointer; }
.access-actions { display: flex; gap: 8px; }

/* Sélecteur de membres inscrits */
.add-existing { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.add-existing summary { cursor: pointer; font-size: .88rem; font-weight: 600; color: var(--teal-dark); }
.add-existing__list { max-height: 200px; overflow-y: auto; margin: 8px 0; display: flex; flex-direction: column; gap: 2px; }
.add-existing__row { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-radius: 7px; font-size: .82rem; line-height: 1.2; cursor: pointer; }
.add-existing__row .members__name { font-size: .82rem; }
.add-existing__row input[type="checkbox"] { flex: none; margin: 0; }
.add-existing__row .avatar--xs { width: 22px; height: 22px; font-size: .72rem; }
.add-existing__row:hover { background: var(--teal-tint); }
.btn--block { width: 100%; }

/* Icône d'information (propriétaire / gérants) */
.info-wrap { position: relative; flex: none; display: inline-flex; }
.info-badge {
    flex: none; width: 18px; height: 18px; margin-right: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid var(--line-2); background: var(--white);
    color: var(--slate); font-size: .68rem; font-weight: 700; font-style: italic;
    cursor: pointer; user-select: none;
}
.info-badge:hover, .info-badge:focus { border-color: var(--teal); color: var(--teal-dark); outline: none; }
.list__row.is-active .info-badge { background: rgba(255,255,255,.85); border-color: transparent; }
.info-pop {
    position: fixed; z-index: 60; width: 240px; padding: 12px 14px;
    background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
    font-size: .82rem; color: var(--ink); text-align: left; white-space: normal;
}
.info-pop[hidden] { display: none; }
.info-pop__line { padding: 2px 0; }
.info-pop__lbl { display: inline-block; min-width: 84px; color: var(--slate); font-weight: 600; }
.info-pop__link {
    display: inline-block; margin-top: 8px; font-weight: 700; color: var(--teal-dark);
}
.info-pop__link:hover { text-decoration: underline; }
.members-roles-hint { margin: 0 0 10px; font-size: .78rem; color: var(--slate); background: var(--teal-tint); padding: 8px 10px; border-radius: 8px; }

/* Répondre à un message précis */
.msg__quote {
    display: block; margin-bottom: 6px; padding: 6px 10px; border-left: 3px solid var(--teal);
    background: rgba(13,148,136,.07); border-radius: 6px; text-decoration: none; color: inherit;
    max-width: 100%;
}
.msg--mine .msg__quote { background: rgba(255,255,255,.18); border-left-color: rgba(255,255,255,.7); }
.msg__quote-author { display: block; font-size: .74rem; font-weight: 700; color: var(--teal-dark); }
.msg--mine .msg__quote-author { color: #fff; }
.msg__quote-text { display: block; font-size: .8rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg__reply { background: none; border: none; padding: 0; font: inherit; cursor: pointer; color: inherit; }
.msg__reply:hover { text-decoration: underline; }
.msg--flash .msg__bubble { animation: msgflash 1.6s ease; }
@keyframes msgflash {
    0%, 30% { box-shadow: 0 0 0 3px rgba(13,148,136,.45); }
    100% { box-shadow: 0 0 0 0 rgba(13,148,136,0); }
}
.reply-bar {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 8px;
    background: var(--teal-tint); border: 1px solid var(--line); border-radius: 10px;
}
.reply-bar[hidden] { display: none; }
.reply-bar__ico { flex: none; color: var(--teal-dark); font-size: 1.1rem; }
.reply-bar__content { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.reply-bar__label { font-size: .78rem; color: var(--slate); }
.reply-bar__text { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Bouton « descendre en bas » + pastille « nouveaux messages » */
.pane--messages { position: relative; }
.to-bottom {
    position: fixed; right: 24px; bottom: 92px; z-index: 40;
    width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-2);
    background: var(--white); color: var(--teal-dark); font-size: 1.25rem; line-height: 1;
    box-shadow: var(--shadow); cursor: pointer; display: none; align-items: center; justify-content: center;
}
.to-bottom.is-visible { display: inline-flex; }
.to-bottom:hover { background: var(--teal-tint); }
.new-msg-pill {
    position: fixed; left: 50%; transform: translateX(-50%); top: 72px; z-index: 45;
    border: none; border-radius: 999px; padding: 9px 18px; cursor: pointer;
    background: var(--teal); color: #fff; font-weight: 600; font-size: .85rem;
    box-shadow: var(--shadow); display: none;
}
.new-msg-pill.is-visible { display: inline-block; animation: pillIn .25s ease; }
@keyframes pillIn { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Votants par option de sondage */
.poll__voters { display: block; font-size: .72rem; color: var(--slate); margin-top: 2px; line-height: 1.3; }
.poll__voters:empty { display: none; }
.msg--mine .poll__voters { color: rgba(255,255,255,.85); }

/* Pièces jointes pliables */
.att-wrap { margin-top: 6px; }
.att-toggle {
    cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
    font-size: .8rem; font-weight: 600; color: var(--teal-dark); padding: 2px 0; user-select: none;
}
.msg--mine .att-toggle { color: #fff; }
.att-toggle::-webkit-details-marker { display: none; }
.att-toggle::before {
    content: '▶'; font-size: .7rem; display: inline-block; transition: transform .15s ease;
}
details[open] > .att-toggle::before { transform: rotate(90deg); }
.att-wrap > .att { margin-top: 6px; }

/* Boutons « tout replier / tout déplier » */
.pane__head--msg { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.att-allbar { display: flex; justify-content: flex-end; padding: 0 16px 6px; }
.att-allbtn {
    background: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 10px;
    font-size: .76rem; font-weight: 600; color: var(--slate); cursor: pointer;
}
.att-allbtn:hover { background: var(--teal-tint); color: var(--teal-dark); }

/* Vidéo : lien de téléchargement de secours */
.att__video-wrap { display: flex; flex-direction: column; gap: 4px; }
.att__video-dl { font-size: .76rem; color: var(--teal-dark); text-decoration: none; }
.att__video-dl:hover { text-decoration: underline; }
.msg--mine .att__video-dl { color: #fff; }
