/* ==========================================================================
   ZUACOOP V2 — design mobile d'abord
   Encre profonde + turquoise Zuacoop + accent ambre. Clair par défaut, sombre automatique.
   ========================================================================== */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f0f3f6;
  --ink: #0b1324;
  --ink-2: #3b4658;
  --muted: #6b7686;
  --line: #e3e8ee;
  --brand: #00a8b5;
  --brand-ink: #00747e;
  --brand-soft: #e2f6f7;
  --accent: #f4a52c;
  --accent-soft: #fff3df;
  --ok: #12a150;
  --ok-soft: #e4f7ec;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --night: #0b1324;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(11, 19, 36, .04), 0 8px 24px rgba(11, 19, 36, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Sora", "Inter", system-ui, sans-serif;
  --tabbar-h: 66px;
  --accent-ink: #9a5b00;
  --btn-dark-bg: #0b1324;
  --btn-dark-ink: #ffffff;
  --side-bg: #0b1324;
  color-scheme: light;
}
/* Thème sombre : choisi par le membre (data-theme="dark") ou automatique si le téléphone est en mode sombre */
:root[data-theme="dark"] {
    --bg: #070c17;
    --surface: #0f1726;
    --surface-2: #162034;
    --ink: #eef2f7;
    --ink-2: #c3ccd9;
    --muted: #8a96a8;
    --line: #1f2b40;
    --brand: #19c3cf;
    --brand-ink: #5fdbe3;
    --brand-soft: #0d2c33;
    --accent-soft: #33240b;
    --accent-ink: #f7c46c;
    --ok-soft: #0c2a1a;
    --danger-soft: #3a1416;
    --btn-dark-bg: #eef2f7;
    --btn-dark-ink: #0b1324;
    --side-bg: #050912;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070c17;
    --surface: #0f1726;
    --surface-2: #162034;
    --ink: #eef2f7;
    --ink-2: #c3ccd9;
    --muted: #8a96a8;
    --line: #1f2b40;
    --brand: #19c3cf;
    --brand-ink: #5fdbe3;
    --brand-soft: #0d2c33;
    --accent-soft: #33240b;
    --accent-ink: #f7c46c;
    --ok-soft: #0c2a1a;
    --danger-soft: #3a1416;
    --btn-dark-bg: #eef2f7;
    --btn-dark-ink: #0b1324;
    --side-bg: #050912;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
img, video { max-width: 100%; display: block; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 4.5vw, 2.1rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
.ic { width: 20px; height: 20px; fill: currentColor; flex: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 8px; }

/* ---------- Coquille ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 9px; font: 800 1.15rem var(--display); color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1rem;
  background: linear-gradient(135deg, var(--brand) 0%, #0b6f9c 100%); box-shadow: 0 4px 12px rgba(0, 168, 181, .35);
}
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
.content { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 18px 16px 28px; }
.is-auth .content { padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
.foot { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; padding: 18px 16px 26px; color: var(--muted); font-size: .82rem; }
.is-auth .foot { padding-bottom: calc(var(--tabbar-h) + 22px); }
.link-btn { background: none; border: 0; color: var(--brand-ink); font: inherit; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; }
.link-btn .ic { width: 16px; height: 16px; }

/* Barre d'onglets (mobile) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: .68rem; font-weight: 600; }
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--brand-ink); }
.tabbar a.active .ic { transform: translateY(-1px); }
.tabbar .dot { top: 9px; right: calc(50% - 16px); }

/* Barre latérale (ordinateur) */
.sidebar { display: none; }
@media (min-width: 960px) {
  .is-auth .sidebar {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 252px; padding: 20px 14px;
    background: var(--side-bg); color: #cfd6e2; z-index: 35;
  }
  .sidebar .brand { color: #fff; padding: 4px 10px 20px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
  .side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #aab4c3; font-weight: 600; font-size: .93rem; }
  .side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
  .side-nav a.active { background: rgba(0, 168, 181, .16); color: #fff; }
  .side-nav a.active .ic { color: #3fd3dd; }
  .side-nav .pill { margin-left: auto; }
  .side-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
  .me-chip { display: flex; gap: 10px; align-items: center; color: #fff; }
  .me-chip img { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; }
  .me-chip span { display: grid; line-height: 1.25; }
  .me-chip small { color: #8a96a8; }
  .ghost-link { display: flex; gap: 8px; align-items: center; color: #8a96a8; font-size: .85rem; padding: 6px 4px; }
  .is-auth .shell { margin-left: 252px; }
  .is-auth .topbar .brand, .is-auth .topbar [data-sheet] { display: none; }
  .is-auth .topbar { justify-content: flex-end; }
  .tabbar { display: none; }
  .is-auth .content { padding: 28px 32px 40px; }
  .is-auth .foot { padding-bottom: 26px; }
}

/* Feuille (menu mobile) */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(4, 8, 16, .45); display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-panel {
  width: 100%; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 12px calc(18px + env(safe-area-inset-bottom));
  display: grid; gap: 2px; animation: up .22s ease-out;
}
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 10px; }
.sheet-panel a { display: flex; gap: 12px; align-items: center; padding: 13px 12px; border-radius: 12px; color: var(--ink); font-weight: 600; }
.sheet-panel a:hover { background: var(--surface-2); text-decoration: none; }
.sheet-panel a.danger { color: var(--danger); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.stack { display: grid; gap: 14px; }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { margin: 0; color: var(--muted); }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 14px; border: 1px solid transparent; font: 650 .95rem var(--font); cursor: pointer; text-decoration: none !important;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(0, 168, 181, .3); }
.btn-primary:hover { background: var(--brand-ink); }
.btn-dark { background: var(--btn-dark-bg); color: var(--btn-dark-ink); }
.btn-accent { background: var(--accent); color: #2a1a00; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ok { background: var(--ok-soft); color: var(--ok); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .85rem; border-radius: 11px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 18px; height: 18px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); }
.badge .ic { width: 13px; height: 13px; }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.pill { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .7rem; display: inline-grid; place-items: center; }

/* Formulaires */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-weight: 650; font-size: .88rem; color: var(--ink-2); }
.field small { font-size: .78rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink); font: 16px var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); margin-top: 2px; }
.choice-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: grid; gap: 2px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); font-weight: 650; transition: .15s; }
.choice span small { font-weight: 500; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 50%, transparent); }

.flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; font-weight: 550; font-size: .92rem; border: 1px solid transparent; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--brand-soft); color: var(--brand-ink); }
.flash-warn { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---------- Héros / recherche ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 26px 20px; margin-bottom: 18px; color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(0, 168, 181, .55) 0%, transparent 55%),
    radial-gradient(80% 80% at 0% 100%, rgba(244, 165, 44, .28) 0%, transparent 60%),
    var(--night);
}
.hero::after {
  content: ""; position: absolute; inset: auto -40px -60px auto; width: 220px; height: 220px; border-radius: 50%;
  border: 36px solid rgba(255, 255, 255, .05);
}
.hero h1 { color: #fff; max-width: 640px; }
.hero p { color: #c8d1de; max-width: 560px; }
.hero .eyebrow { color: #63dfe7; }
.search {
  position: relative; z-index: 1; display: flex; gap: 8px; margin-top: 16px; padding: 6px; background: #fff; border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: 680px;
}
.search input { border: 0; min-height: 46px; background: transparent; color: #0b1324; box-shadow: none !important; }
.search .btn { min-height: 46px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px 10px; padding-left: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: .85rem; font-weight: 600; white-space: nowrap;
}
.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
@media (min-width: 960px) { .chips { margin: 0 0 10px; padding-left: 2px; flex-wrap: wrap; } }

/* ---------- Cartes de membres ---------- */
.members { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .members { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .members { grid-template-columns: repeat(3, 1fr); } }
.member {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .15s, box-shadow .2s;
}
.member:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(11, 19, 36, .1); }
.member.is-premium { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.member.is-premium::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--accent), #ffd27a);
}
.member-top { display: flex; gap: 12px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 16px; object-fit: cover; background: var(--surface-2); flex: none; }
.avatar-lg { width: 96px; height: 96px; border-radius: 26px; }
.member-name { font: 700 1rem var(--display); color: var(--ink); display: block; }
.member-spec { color: var(--muted); font-size: .86rem; }
.member-desc { color: var(--ink-2); font-size: .9rem; margin: 0; }
.member-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
.member-meta span { display: inline-flex; gap: 4px; align-items: center; }
.member-meta .ic { width: 15px; height: 15px; }
.member-foot { display: flex; gap: 8px; margin-top: auto; }
.member-foot .btn { flex: 1; }
.rating { color: var(--accent); letter-spacing: 1px; font-size: .9rem; }
.verified { color: var(--brand); width: 17px; height: 17px; vertical-align: -3px; }

/* ---------- Tableau de bord ---------- */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.kpi span { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; }
.kpi strong { display: block; font: 800 1.7rem var(--display); margin-top: 4px; }
.kpi small { font-size: .75rem; }
.kpi-dark { background: var(--night); color: #fff; border-color: transparent; }
.kpi-dark span, .kpi-dark small { color: #9fb0c4; }
.welcome { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.progress { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #40d6df); border-radius: 6px; }
.todo { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.todo li { display: flex; gap: 10px; align-items: center; font-size: .9rem; }
.todo li .ic { width: 18px; height: 18px; color: var(--muted); }
.todo li.done { color: var(--muted); text-decoration: line-through; }
.todo li.done .ic { color: var(--ok); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .grow small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-av { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font: 700 .85rem var(--display); flex: none; object-fit: cover; }
.alert-sos { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius); background: var(--danger); color: #fff; margin-bottom: 16px; animation: pulse 2s infinite; }
.alert-sos a { color: #fff; text-decoration: underline; font-weight: 700; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .5); } 50% { box-shadow: 0 0 0 10px rgba(229, 72, 77, 0); } }
.promo { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 18px; border-radius: var(--radius);
  background: linear-gradient(120deg, #1a1306, #3a2608 60%, #5b3a08); color: #fff; }
.promo p { color: #f3d9a8; margin: 0; }

/* ---------- Profil public ---------- */
.profile-hero { position: relative; border-radius: 26px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 16px; }
.profile-cover { height: 120px; background: radial-gradient(90% 120% at 90% 0%, rgba(0, 168, 181, .7), transparent 60%), radial-gradient(70% 100% at 0% 100%, rgba(244, 165, 44, .45), transparent 60%), var(--night); }
.profile-body { padding: 0 18px 18px; margin-top: -48px; display: grid; gap: 12px; }
.profile-body .avatar-lg { border: 4px solid var(--surface); box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { text-align: center; padding: 10px; border-radius: 14px; background: var(--surface-2); }
.stat strong { display: block; font: 800 1.15rem var(--display); }
.stat span { font-size: .75rem; color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(4, 1fr); } }
.gallery figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.gallery img, .gallery video { width: 100%; height: 100%; object-fit: cover; }
.gallery button.thumb { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.gallery .del { position: absolute; top: 6px; right: 6px; }
.gallery .vid { position: absolute; left: 6px; bottom: 6px; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(2, 6, 14, .92); display: grid; place-items: center; padding: 20px; }
.lightbox[hidden] { display: none; }
.lightbox img, .lightbox video { max-height: 86vh; border-radius: 12px; }
.lightbox .close { position: absolute; top: 14px; right: 14px; color: #fff; }

/* ---------- Messagerie ---------- */
.inbox { display: grid; gap: 14px; }
@media (min-width: 960px) { .inbox { grid-template-columns: 320px 1fr; align-items: start; } }
.threads { padding: 6px; }
.thread { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; color: var(--ink); }
.thread:hover { background: var(--surface-2); text-decoration: none; }
.thread.active { background: var(--brand-soft); }
.thread .grow { flex: 1; min-width: 0; }
.thread strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat { display: flex; flex-direction: column; min-height: 60vh; padding: 0; overflow: hidden; }
.chat-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-head .grow { flex: 1 1 150px; min-width: 0; }
.chat-head .grow strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-tools { display: flex; gap: 6px; }
@media (max-width: 959px) { .inbox.has-active .chat { order: -1; } }
.chat-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 16px; overflow-y: auto; max-height: 62vh; background: var(--bg); }
.bubble { max-width: 82%; padding: 10px 13px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: .93rem; white-space: pre-wrap; word-wrap: break-word; }
.bubble small { display: block; margin-top: 4px; font-size: .7rem; }
.bubble.me { align-self: flex-end; background: var(--brand); color: #fff; border-color: transparent; border-bottom-right-radius: 5px; }
.bubble.me small { color: rgba(255, 255, 255, .75); }
.bubble.them { align-self: flex-start; border-bottom-left-radius: 5px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form textarea { min-height: 46px; height: 46px; border-radius: 14px; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px 0; background: var(--surface); }
.suggest button { border: 1px dashed var(--brand); background: var(--brand-soft); color: var(--brand-ink); border-radius: 999px; padding: 6px 12px; font-size: .8rem; cursor: pointer; text-align: left; }

/* ---------- Marchés ---------- */
.market { display: grid; gap: 8px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.market + .market { margin-top: 12px; }
.market h3 { margin: 0; }
.market .row { font-size: .82rem; color: var(--muted); }
.match { font-weight: 800; color: var(--ok); }
.cand { padding: 12px; border-radius: 14px; background: var(--surface-2); }
.cand + .cand { margin-top: 8px; }

/* ---------- Tarifs ---------- */
.plans { display: grid; gap: 12px; }
@media (min-width: 760px) { .plans { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
.plan { position: relative; cursor: pointer; }
.plan input { position: absolute; opacity: 0; }
.plan .plan-box { display: grid; gap: 6px; height: 100%; padding: 18px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); transition: .15s; }
.plan input:checked + .plan-box { border-color: var(--accent); box-shadow: 0 10px 24px rgba(244, 165, 44, .18); }
.plan .price { font: 800 1.8rem var(--display); }
.plan .price small { font: 500 .85rem var(--font); color: var(--muted); }
.perks { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; font-size: .88rem; }
.perks li { display: flex; gap: 8px; align-items: flex-start; }
.perks .ic { width: 18px; height: 18px; color: var(--ok); }
.ribbon { position: absolute; top: -10px; right: 14px; z-index: 1; }

/* ---------- Étapes d'inscription ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(60% 50% at 100% 0%, rgba(0, 168, 181, .18), transparent 60%), radial-gradient(50% 40% at 0% 100%, rgba(244, 165, 44, .14), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 460px; }
.auth-card.wide { max-width: 640px; }
.auth-card .brand { margin-bottom: 18px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps i { flex: 1; height: 5px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--brand); }
.step[hidden] { display: none; }
.pw { position: relative; }
.pw button { position: absolute; right: 6px; top: 6px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; font-weight: 600; font-size: .8rem; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Tableaux (admin) ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 650; color: var(--ink); }
.pager span.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .ic { width: 44px; height: 44px; color: var(--line); }
.empty-num { font: 800 4rem var(--display); color: var(--brand); }
.bare { min-height: 100vh; }
.sos-btn {
  width: 190px; height: 190px; border-radius: 50%; border: 0; margin: 10px auto; display: grid; place-items: center; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ff7a7e, var(--danger)); color: #fff; font: 800 2rem var(--display);
  box-shadow: 0 0 0 14px var(--danger-soft), 0 18px 40px rgba(229, 72, 77, .4);
}
.sos-btn:active { transform: scale(.97); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }


/* ---------- Sélecteur de thème ---------- */
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.theme-switch button { border: 0; background: transparent; color: var(--muted); width: 34px; height: 30px; border-radius: 9px; display: grid; place-items: center; cursor: pointer; }
.theme-switch button .ic { width: 17px; height: 17px; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow); }
.sidebar .theme-switch { display: flex; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .08); }
.sidebar .theme-switch button { flex: 1; }
.sidebar .theme-switch button { color: #8a96a8; }
.sidebar .theme-switch button[aria-pressed="true"] { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.sheet-theme { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; font-weight: 600; }
@media (min-width: 960px) { .topbar .theme-switch { display: none; } }

/* ---------- Barres de défilement ---------- */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 40%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--muted) 65%, transparent); }
.side-nav { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; margin-right: -6px; padding-right: 6px; }
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border: 0; border-radius: 6px; }
.side-nav::-webkit-scrollbar-thumb:hover { background: rgba(0, 168, 181, .55); }
.chips::-webkit-scrollbar { display: none; }

/* ---------- Tableau de bord : cartes alignées ligne par ligne ---------- */
.dash { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: stretch; grid-auto-flow: row dense; }
.dash > * { margin: 0 !important; min-width: 0; }
.dash .card { display: flex; flex-direction: column; height: 100%; }
@media (min-width: 760px) {
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash .span-2 { grid-column: 1 / -1; }
}
@media (min-width: 1280px) {
  .dash { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash .span-2 { grid-column: span 2; }
}
@media (max-width: 440px) { .is-guest .topbar .theme-switch { display: none; } }
