/* CoproLien — styles */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --border: #e0e6e4;
  --text: #15201d;
  --muted: #5b6965;
  --primary: #0f766e;
  --primary-hover: #0c5f58;
  --primary-soft: #dff2ef;
  --on-primary: #ffffff;
  --accent: #d97706;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fdf2e1;
  --ok: #15803d;
  --ok-soft: #e4f4e8;
  --info: #0369a1;
  --info-soft: #e3f0f8;
  --violet: #6d28d9;
  --violet-soft: #efe9fc;
  --bubble: #ffffff;
  --bubble-mine: #0f766e;
  --bubble-mine-text: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 22, .06), 0 4px 14px rgba(16, 24, 22, .05);
  --shadow-lg: 0 10px 40px rgba(16, 24, 22, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 256px;
  --tabbar-h: 62px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1413; --surface: #161f1e; --surface-2: #1c2827; --border: #283634; --text: #e5eeec; --muted: #94a5a1;
    --primary: #2bb5a8; --primary-hover: #3fc9bc; --primary-soft: #133331; --on-primary: #04201d;
    --danger: #f87171; --danger-soft: #3a1b1b; --warn: #f59e0b; --warn-soft: #36290f; --ok: #4ade80; --ok-soft: #14301d;
    --info: #38bdf8; --info-soft: #102a3a; --violet: #a78bfa; --violet-soft: #251c3d;
    --bubble: #1f2c2b; --bubble-mine: #0f766e; --bubble-mine-text: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1413; --surface: #161f1e; --surface-2: #1c2827; --border: #283634; --text: #e5eeec; --muted: #94a5a1;
  --primary: #2bb5a8; --primary-hover: #3fc9bc; --primary-soft: #133331; --on-primary: #04201d;
  --danger: #f87171; --danger-soft: #3a1b1b; --warn: #f59e0b; --warn-soft: #36290f; --ok: #4ade80; --ok-soft: #14301d;
  --info: #38bdf8; --info-soft: #102a3a; --violet: #a78bfa; --violet-soft: #251c3d;
  --bubble: #1f2c2b; --bubble-mine: #0f766e; --bubble-mine-text: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }

/* ---------- Démarrage ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.boot-logo { width: 56px; height: 56px; border-radius: 16px; background: url(/icons/icon-192.png) center/cover; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- Boutons & champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600;
  font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.selected { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  cursor: pointer; color: var(--muted); position: relative; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-weight: 600; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; min-height: 90px; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.loc-fields { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 10px; }
.loc-fields .input::placeholder { text-transform: none; }
.loc-fields.compact { gap: 4px; grid-template-columns: 1fr 1.3fr .8fr; }
.loc-fields.compact .input { padding: 6px 6px; font-size: 13px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 14px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px;
  font-weight: 700; display: inline-grid; place-items: center; line-height: 1;
}
.icon-btn .count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; font-size: 10px; border: 2px solid var(--surface); }

/* ---------- Avatars ---------- */
.avatar {
  --size: 36px; width: var(--size); height: var(--size); border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  color: #fff; font-weight: 700; font-size: calc(var(--size) * .38); position: relative; user-select: none;
}
.avatar.online::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 9px; min-height: 9px;
  border-radius: 50%; background: #22c55e; border: 2px solid var(--surface);
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Structure ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border); display: flex;
  flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: url(/icons/icon-192.png) center/cover; flex: none; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
.brand-name { color: var(--primary); }
.brand-accent { color: #f59e0b; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; }
.nav-section { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.nav a .count { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); }
.me-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: var(--text); }
.me-card:hover { background: var(--surface-2); text-decoration: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 750; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .mobile-brand { display: none; }
.view { padding: 22px; max-width: 1100px; width: 100%; margin: 0 auto; flex: 1; }
.tabbar { display: none; }
.offline-banner { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: 13px; padding: 6px; font-weight: 600; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { padding: 0 8px 0 16px; padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
  .topbar .mobile-brand { display: block; width: 30px; height: 30px; border-radius: 9px; background: url(/icons/icon-192.png) center/cover; flex: none; }
  .view { padding: 16px 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface);
    border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px;
    color: var(--muted); font-weight: 600; position: relative;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--primary); }
  .tabbar a .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10px; }
  body.in-conv .tabbar, body.in-conv .topbar { display: none; }
  body.in-conv .view { padding: 0; }
}

/* ---------- Cartes & pages ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 2px; }
.page-head .grow { flex: 1; min-width: 200px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flat { box-shadow: none; }
.card.link { display: block; color: var(--text); transition: border-color .15s, transform .1s; cursor: pointer; }
.card.link:hover { border-color: var(--primary); text-decoration: none; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h3 { font-size: 16px; font-weight: 750; flex: 1; display: flex; align-items: center; gap: 8px; }
.cards { display: grid; gap: 14px; }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cards.three { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .emoji { font-size: 38px; margin-bottom: 8px; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); padding: 6px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; gap: 6px; align-items: center;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.chip .n { opacity: .7; font-weight: 500; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); color: var(--text); }
.list-item:first-child { border-top: 0; }
a.list-item:hover { text-decoration: none; background: var(--surface-2); margin: 0 -10px; padding: 12px 10px; border-radius: 10px; }
.list-item .title { font-weight: 600; }
.list-item .meta { font-size: 13px; color: var(--muted); }
.list-item .body { flex: 1; min-width: 0; }
.searchbox { position: relative; flex: 1; min-width: 180px; }
.searchbox svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.searchbox .input { padding-left: 38px; border-radius: 999px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s; }
.richtext { overflow-wrap: anywhere; }
.richtext a { text-decoration: underline; }
.mention { background: var(--primary-soft); color: var(--primary); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 22px 0 10px; }

/* ---------- Accueil ---------- */
.hero {
  background: linear-gradient(135deg, #0f766e, #115e59 55%, #134e4a); color: #fff; border-radius: 20px; padding: 24px;
  position: relative; overflow: hidden; margin-bottom: 18px;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255, 255, 255, .07); box-shadow: -60px 120px 0 rgba(255, 255, 255, .05);
}
.hero h2 { font-size: 24px; font-weight: 800; }
.hero p { opacity: .85; margin-top: 4px; }
.hero-stats { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-stats div { font-size: 13px; opacity: .9; }
.hero-stats b { display: block; font-size: 22px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.quick a {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 13px; font-weight: 600; text-align: center;
}
.quick a:hover { border-color: var(--primary); text-decoration: none; }
.quick .q-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; }
@media (max-width: 560px) { .quick { grid-template-columns: repeat(2, 1fr); } }
.home-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Messagerie ---------- */
.chat {
  display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 60px - 44px); min-height: 420px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.chat-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: 14px; display: flex; gap: 8px; border-bottom: 1px solid var(--border); }
.chat-list-body { overflow-y: auto; flex: 1; padding: 6px; }
.chan {
  display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 12px; color: var(--text); cursor: pointer;
}
.chan:hover { background: var(--surface-2); text-decoration: none; }
.chan.active { background: var(--primary-soft); }
.chan-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.chan-body { flex: 1; min-width: 0; }
.chan-top { display: flex; gap: 6px; align-items: baseline; }
.chan-name { font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-time { font-size: 12px; color: var(--muted); flex: none; }
.chan-last { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan.unread .chan-name, .chan.unread .chan-last { color: var(--text); font-weight: 700; }
.chat-conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.conv-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 62px; }
.conv-head .back { display: none; }
.conv-title { font-weight: 750; }
.conv-sub { font-size: 12px; color: var(--muted); }
.conv-messages { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; }
.conv-placeholder { flex: 1; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 20px; }
.day-sep { align-self: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 3px 12px; border-radius: 99px; margin: 14px 0 8px; }
.msg { display: flex; gap: 8px; align-items: flex-end; margin-top: 2px; position: relative; max-width: 100%; }
.msg.head { margin-top: 10px; }
.msg .avatar-spacer { width: 32px; flex: none; }
.msg-main { max-width: min(560px, 78%); display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.msg.mine { flex-direction: row-reverse; }
.msg.mine .msg-main { align-items: flex-end; }
.msg-author { font-size: 12px; font-weight: 700; margin: 0 0 3px 10px; display: flex; gap: 6px; align-items: center; }
.bubble {
  background: var(--bubble); border: 1px solid var(--border); padding: 7px 12px 6px; border-radius: 16px 16px 16px 5px;
  max-width: 100%; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0, 0, 0, .03);
}
.msg.mine .bubble { background: var(--bubble-mine); color: var(--bubble-mine-text); border-color: transparent; border-radius: 16px 16px 5px 16px; }
.msg.mine .bubble a, .msg.mine .bubble .mention { color: #fff; }
.msg.mine .bubble .mention { background: rgba(255, 255, 255, .2); }
.bubble .deleted { font-style: italic; opacity: .7; }
.msg-time { font-size: 11px; opacity: .65; margin-left: 8px; float: right; margin-top: 6px; white-space: nowrap; }
.quote { border-left: 3px solid var(--primary); background: var(--surface-2); color: var(--text); border-radius: 6px; padding: 4px 8px; margin: 2px 0 6px; font-size: 13px; }
.msg.mine .quote { background: rgba(255, 255, 255, .15); border-color: #fff; color: #fff; }
.quote b { display: block; font-size: 12px; }
.bubble img.attach { display: block; max-height: 260px; border-radius: 10px; margin: 4px 0; cursor: zoom-in; }
.file-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); margin: 4px 0; font-size: 13px; }
.msg.mine .file-chip { background: rgba(255, 255, 255, .15); color: #fff; }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.reaction {
  border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 1px 8px; font-size: 13px; cursor: pointer;
  display: inline-flex; gap: 4px; align-items: center;
}
.reaction.mine { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.msg-actions {
  display: none; align-self: center; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 99px;
  padding: 2px; box-shadow: var(--shadow);
}
.msg-actions button { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 50%; cursor: pointer; color: var(--muted); display: grid; place-items: center; font-size: 15px; }
.msg-actions button:hover { background: var(--surface-2); color: var(--text); }
.msg:hover .msg-actions, .msg.show-actions .msg-actions { display: flex; }
.msg.deleted:hover .msg-actions { display: none; }
.typing { font-size: 12px; color: var(--muted); padding: 0 16px 4px; height: 18px; }
.composer { padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: calc(10px + env(safe-area-inset-bottom)); position: relative; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--border); background: var(--surface-2); border-radius: 20px; padding: 9px 14px;
  max-height: 140px; min-height: 40px; outline: none; line-height: 1.4; overflow-y: auto; scrollbar-width: none;
}
.composer textarea:focus { border-color: var(--primary); }
.composer .send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; cursor: pointer; flex: none; }
.composer .send:disabled { opacity: .5; }
.composer-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 6px 6px 6px 12px; margin-bottom: 8px; }
.composer-bar .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mention-pop {
  position: absolute; bottom: calc(100% - 4px); left: 56px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; min-width: 220px; z-index: 5;
}
.mention-pop button { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; cursor: pointer; text-align: left; }
.mention-pop button:hover, .mention-pop button.active { background: var(--surface-2); }
.emoji-row { display: flex; gap: 2px; }
.load-more { align-self: center; margin-bottom: 8px; }

@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; border: 0; border-radius: 0; box-shadow: none; height: auto; min-height: 0; background: transparent; }
  .chat.has-conv .chat-list { display: none; }
  .chat:not(.has-conv) .chat-conv { display: none; }
  .chat-list { border: 0; }
  .chat-list-head { padding: 0 0 12px; border: 0; }
  .chat-list-body { padding: 0; overflow: visible; }
  .chat.has-conv { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; }
  .chat.has-conv .chat-conv { flex: 1; }
  .conv-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .conv-head .back { display: inline-grid; }
  .msg-main { max-width: 82%; }
}

/* ---------- Votes ---------- */
.poll h3 { font-size: 17px; margin: 10px 0 4px; }
.poll-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.poll-desc { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.poll-options { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.opt-choice {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 14px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600;
}
.opt-choice:hover { border-color: var(--primary); }
.opt-choice .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: grid; place-items: center; }
.opt-choice.multi .dot { border-radius: 5px; }
.opt-choice.selected { border-color: var(--primary); background: var(--primary-soft); }
.opt-choice.selected .dot { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); }
.opt-choice.multi.selected .dot { box-shadow: none; }
.opt-result { position: relative; }
.opt-result .top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.opt-result .top b { font-weight: 650; }
.opt-result .bar { height: 10px; background: var(--surface-2); border-radius: 99px; position: relative; overflow: visible; }
.opt-result .bar > div { height: 100%; border-radius: 99px; background: var(--primary); transition: width .5s; }
.opt-result.pour .bar > div { background: var(--ok); }
.opt-result.contre .bar > div { background: var(--danger); }
.opt-result.abst .bar > div { background: var(--muted); }
.opt-result .threshold { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--text); border-radius: 2px; }
.opt-result .voters { font-size: 12px; color: var(--muted); margin-top: 3px; }
.verdict { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.verdict.ok { background: var(--ok-soft); }
.verdict.ko { background: var(--danger-soft); }
.verdict.pending { background: var(--surface-2); }
.verdict .big { font-size: 24px; }
.poll-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.poll-foot .progress { width: 120px; }
.opt-inputs { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Signalements ---------- */
.issue-card { display: flex; gap: 14px; align-items: flex-start; }
.issue-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; flex: none; }
.issue-card .body { flex: 1; min-width: 0; }
.issue-card h3 { font-size: 15px; font-weight: 700; }
.issue-card .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.issue-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.issue-thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; }
.support-btn { display: inline-flex; gap: 6px; align-items: center; }
.stepper { display: flex; align-items: center; margin: 18px 0; }
.step { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); flex: none; width: 74px; text-align: center; }
.step .dot { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--border); display: grid; place-items: center; font-size: 13px; }
.step.done .dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.step.current { color: var(--primary); }
.step.current .dot { box-shadow: 0 0 0 4px var(--primary-soft); }
.step-line { flex: 1; height: 2px; background: var(--border); margin-bottom: 22px; }
.step-line.done { background: var(--primary); }
.issue-photo { width: 100%; max-height: 380px; object-fit: cover; border-radius: 12px; margin-bottom: 14px; cursor: zoom-in; }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.tl-item { display: flex; gap: 10px; }
.tl-item .content { flex: 1; min-width: 0; }
.tl-item .who { font-size: 13px; }
.tl-item .text { background: var(--surface-2); padding: 8px 12px; border-radius: 4px 12px 12px 12px; margin-top: 4px; font-size: 14px; }
.tl-status { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.tl-status .ico { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .detail-layout { grid-template-columns: minmax(0, 1fr); } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-grid button { border: 1.5px solid var(--border); background: var(--surface); border-radius: 12px; padding: 10px 4px; cursor: pointer; font-size: 12px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cat-grid button span { font-size: 22px; }
.cat-grid button.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
@media (max-width: 480px) { .cat-grid { grid-template-columns: repeat(2, 1fr); } }
.photo-drop { border: 2px dashed var(--border); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; display: block; }
.photo-drop:hover { border-color: var(--primary); color: var(--primary); }
.photo-drop img { max-height: 160px; border-radius: 8px; }

/* ---------- Annonces ---------- */
.announce { border-left: 5px solid var(--info); }
.announce.important { border-left-color: var(--warn); }
.announce.urgent { border-left-color: var(--danger); }
.announce h3 { font-size: 17px; font-weight: 750; }
.announce .body { margin: 10px 0 12px; }
.announce-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.mini-announce { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border-left: 4px solid var(--info); color: var(--text); display: block; }
.mini-announce.important { border-left-color: var(--warn); }
.mini-announce.urgent { border-left-color: var(--danger); }
.mini-announce:hover { text-decoration: none; filter: brightness(.98); }

/* ---------- Agenda ---------- */
.event { display: flex; gap: 16px; align-items: flex-start; }
.date-tile { width: 62px; flex: none; border-radius: 14px; overflow: hidden; text-align: center; border: 1px solid var(--border); background: var(--surface); }
.date-tile .m { background: var(--primary); color: var(--on-primary); font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 3px 0; letter-spacing: .05em; }
.date-tile .d { font-size: 24px; font-weight: 800; line-height: 1.15; padding-top: 4px; }
.date-tile .w { font-size: 11px; color: var(--muted); padding-bottom: 5px; text-transform: capitalize; }
.date-tile.ag .m { background: var(--violet); }
.date-tile.travaux .m { background: var(--warn); }
.date-tile.fete .m { background: #db2777; }
.event .body { flex: 1; min-width: 0; }
.event h3 { font-size: 16px; font-weight: 750; }
.event .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 5px 0 8px; }
.event .meta span { display: inline-flex; gap: 5px; align-items: center; }
.rsvp { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.rsvp .btn.selected.yes { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.rsvp .btn.selected.maybe { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.rsvp .btn.selected.no { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* ---------- Documents ---------- */
.doc-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 11px; flex: none; background: var(--info-soft); color: var(--info); }
.doc-ico.pdf { background: var(--danger-soft); color: var(--danger); }
.doc-ico.img { background: var(--violet-soft); color: var(--violet); }

/* ---------- Cotisations ---------- */
.due-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) {
  .due-row { flex-wrap: wrap; }
  .due-row .body { flex: 1 1 calc(100% - 52px); }
  .due-row .due-actions { width: 100%; padding-left: 50px; justify-content: flex-start; }
}

/* ---------- Entraide ---------- */
.listing { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.listing .photo { height: 150px; background: var(--surface-2) center/cover; display: grid; place-items: center; font-size: 46px; }
.listing .content { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.listing h3 { font-size: 16px; font-weight: 700; }
.listing .desc { font-size: 14px; color: var(--muted); flex: 1; }
.listing.inactive { opacity: .6; }
.listing .author { display: flex; gap: 8px; align-items: center; font-size: 13px; }

/* ---------- Voisins ---------- */
.person { display: flex; gap: 14px; align-items: flex-start; }
.person .body { flex: 1; min-width: 0; }
.person h3 { font-size: 15px; font-weight: 700; }
.person .bio { font-size: 13px; color: var(--muted); margin-top: 6px; }
.person .contact { font-size: 13px; margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }

/* ---------- Admin ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.user-row { display: grid; grid-template-columns: minmax(170px, 1.4fr) minmax(210px, 1.4fr) 130px 90px 115px auto; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.user-row:first-child { border-top: 0; }
.user-row .input { min-height: 36px; padding: 6px 10px; }
.user-row-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-top: 0; padding-bottom: 4px; }
@media (max-width: 980px) {
  .user-row { grid-template-columns: 1fr 1fr; }
  .user-row > :first-child, .user-row > .loc-fields { grid-column: 1 / -1; }
  .user-row-head { display: none; }
}
.code-box { font-family: ui-monospace, Consolas, monospace; font-size: 20px; font-weight: 700; letter-spacing: .08em; background: var(--surface-2); padding: 10px 16px; border-radius: 10px; }

/* ---------- Menu mobile ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.menu-grid a { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 650; position: relative; }
.menu-grid a:hover { text-decoration: none; border-color: var(--primary); }
.menu-grid .m-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.menu-grid .count { position: absolute; top: 12px; right: 12px; }

/* ---------- Connexion ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side {
  background: linear-gradient(150deg, #0f766e, #134e4a); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 24px;
}
.auth-side h1 { font-size: 36px; font-weight: 850; letter-spacing: -.02em; }
.auth-side p { font-size: 17px; opacity: .88; max-width: 460px; }
.auth-features { display: grid; gap: 14px; margin-top: 8px; }
.auth-features div { display: flex; gap: 12px; align-items: center; font-weight: 600; }
.auth-features span { width: 38px; height: 38px; border-radius: 10px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; font-size: 18px; flex: none; }
.auth-main { display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { padding: 0 0 22px; }
.demo-box { margin-top: 22px; padding: 14px; border: 1px dashed var(--border); border-radius: var(--radius); }
.demo-box .people { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.demo-box button { display: flex; gap: 8px; align-items: center; text-align: left; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.demo-box button:hover { border-color: var(--primary); }
.demo-box button small { display: block; color: var(--muted); font-size: 11px; }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 999px; font-weight: 650; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* ---------- Modale, popover, toasts ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(8, 15, 14, .5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex;
  flex-direction: column; box-shadow: var(--shadow-lg); animation: rise .18s ease-out;
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { flex: 1; font-size: 17px; font-weight: 750; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
@media (max-width: 560px) {
  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, .85); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-height: 100%; max-width: 100%; border-radius: 8px; }
.notif-panel {
  position: fixed; top: 64px; right: 16px; width: 380px; max-width: calc(100vw - 24px); max-height: min(560px, calc(100vh - 90px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); z-index: 90;
  display: flex; flex-direction: column; animation: rise .15s;
}
.notif-panel .head { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); gap: 8px; }
.notif-panel .head b { flex: 1; }
.notif-panel .items { overflow-y: auto; padding: 6px; }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: 10px; color: var(--text); cursor: pointer; }
.notif:hover { background: var(--surface-2); text-decoration: none; }
.notif .n-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); flex: none; font-size: 16px; }
.notif.unread { background: var(--primary-soft); }
.notif .t { font-weight: 650; font-size: 14px; }
.notif .b { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif .w { font-size: 11px; color: var(--muted); margin-top: 2px; }
@media (max-width: 860px) { .notif-panel { top: calc(60px + env(safe-area-inset-top)); right: 12px; } }
#toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); bottom: 24px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: #15201d; color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .2s; pointer-events: auto; display: flex; gap: 8px; align-items: center; }
.toast.error { background: #b91c1c; }
.toast.ok { background: #166534; }
@media (max-width: 860px) { #toasts { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); } }
.popover { position: fixed; z-index: 110; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; height: 80px; }
@keyframes shimmer { to { background-position: -200% 0; } }
