/* ==========================================================================
   DemenApp — Design system (charte Demen'House : or #bd9e5b, anthracite)
   Thème clair par défaut, sombre via [data-theme="dark"]. Mobile-first.
   ========================================================================== */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --bg: #f4f3ef;
  --bg-2: #ecebe5;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --surface-3: #efede6;
  --border: rgba(29, 29, 29, 0.09);
  --border-2: rgba(29, 29, 29, 0.17);
  --text: #1d1d1d;
  --text-2: #3f3f3f;
  --muted: #6f6a60;
  --muted-2: #9c968a;

  --accent: #b08a3e;
  --accent-2: #8a6a2b;
  --accent-bg: rgba(189, 158, 91, 0.16);
  --accent-text: #8a6a2b;
  --gold: #bd9e5b;
  --success: #22a35a; --success-bg: rgba(34, 163, 90, 0.13); --success-text: #15753f;
  --warning: #e3a008; --warning-bg: rgba(227, 160, 8, 0.15); --warning-text: #9a6b05;
  --danger: #dc3545; --danger-bg: rgba(220, 53, 69, 0.11); --danger-text: #b3202e;
  --info: #2f7fd6; --info-bg: rgba(47, 127, 214, 0.13); --info-text: #1f5fa5;

  --shadow: 0 1px 2px rgba(29,29,29,.05), 0 8px 24px -12px rgba(29,29,29,.12);
  --shadow-lg: 0 24px 60px -20px rgba(29,29,29,.25);
  --ring: 0 0 0 3px rgba(189, 158, 91, 0.35);

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --sidebar: 264px;
  --topbar: 64px;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-2: #181818;
  --surface: #1e1e1e;
  --surface-2: #252525;
  --surface-3: #2e2e2e;
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.15);
  --text: #f0ede6;
  --text-2: #c9c4b8;
  --muted: #8f897c;
  --muted-2: #67625a;
  --accent: #c9a75c;
  --accent-2: #a2823f;
  --accent-bg: rgba(201, 167, 92, 0.16);
  --accent-text: #e2c88a;
  --success-bg: rgba(34, 163, 90, 0.16); --success-text: #7fdca4;
  --warning-bg: rgba(227, 160, 8, 0.16); --warning-text: #f2c14e;
  --danger-bg: rgba(220, 53, 69, 0.16); --danger-text: #f58a95;
  --info-bg: rgba(47, 127, 214, 0.16); --info-text: #8fbcf0;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
  --ring: 0 0 0 3px rgba(201, 167, 92, 0.35);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; } h4 { font-size: .9rem; }
p { margin: 0 0 .75rem; } p:last-child { margin-bottom: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, .mono { font-family: var(--mono); font-size: .86em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.icon { width: 1.15em; height: 1.15em; flex: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .xs { font-size: .78rem; }
.text-2 { color: var(--text-2); }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100dvh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #1d1d1d; color: #e9e5dc; border-right: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; z-index: 50; transform: translateX(-100%); transition: transform .3s var(--ease); }
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 49; backdrop-filter: blur(2px); }
.brand { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.35rem 1rem 1.1rem; position: relative; background: radial-gradient(ellipse 70% 80% at 50% 30%, rgba(189,158,91,.18), transparent 75%); text-decoration: none !important; }
.brand::after { content: ""; position: absolute; left: 1.25rem; right: 1.25rem; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .8; }
.brand .logo-img { height: 74px; width: auto; background: #fff; border-radius: 14px; padding: 6px 10px; filter: drop-shadow(0 10px 22px rgba(189,158,91,.28)); transition: transform .2s var(--ease); }
.brand:hover .logo-img { transform: scale(1.03); }
.brand .brand-sub { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.logo-img { height: 40px; width: auto; display: block; }
.logo-img.lg { height: 72px; }
.nav { padding: .9rem .75rem; flex: 1; overflow-y: auto; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #7d7768; padding: .9rem .75rem .4rem; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: var(--r-sm); color: #cfcabf; font-weight: 500; transition: .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(189,158,91,.16); color: #f0dfb5; box-shadow: inset 3px 0 0 var(--gold); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.nav a .icon { width: 18px; height: 18px; opacity: .85; }
.nav a .count { margin-left: auto; font-size: .72rem; font-weight: 700; background: rgba(255,255,255,.1); padding: .1rem .5rem; border-radius: 99px; color: #e9e5dc; }
.nav a.active .count, .nav a .count.hot { background: var(--gold); color: #1d1d1d; }
.nav .nav-cta { margin: .5rem .75rem .25rem; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .65rem .75rem; border-radius: var(--r-sm); background: linear-gradient(135deg, var(--gold), #9a7a3a); color: #1d1d1d; font-weight: 700; box-shadow: 0 8px 20px -10px var(--gold); }
.nav .nav-cta:hover { filter: brightness(1.06); text-decoration: none; color: #1d1d1d; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding: .75rem; }
.userchip { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: var(--r-sm); color: #e9e5dc; }
.userchip:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.userchip .avatar { background: var(--gold); color: #1d1d1d; }
.userchip .muted { color: #8f897c; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; background: var(--surface-3); color: var(--text-2); flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: .7rem; }
.avatar.gold { background: var(--accent-bg); color: var(--accent-text); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar); display: flex; align-items: center; gap: .75rem; padding: 0 1rem; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 1.1rem; }
.topbar .spacer { flex: 1; }
.content { padding: 1.25rem 1rem 3rem; max-width: 1360px; width: 100%; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head p { color: var(--muted); margin: .25rem 0 0; }
.breadcrumb { display: flex; gap: .4rem; align-items: center; font-size: .8rem; color: var(--muted); margin-bottom: .4rem; }
.breadcrumb a { color: var(--muted); }

@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .sidebar-backdrop { display: none; }
  .main { margin-left: var(--sidebar); }
  .topbar { padding: 0 1.75rem; }
  .content { padding: 1.75rem 1.75rem 4rem; }
  .topbar .menu-btn { display: none; }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem .95rem; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 560; font-size: .88rem; cursor: pointer; transition: .15s var(--ease); white-space: nowrap; line-height: 1.2; text-decoration: none !important; }
.btn:hover { background: var(--surface-3); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, var(--gold), #9a7a3a); border-color: transparent; color: #1d1d1d; box-shadow: 0 8px 20px -10px var(--gold); font-weight: 700; }
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--gold), #9a7a3a); }
.btn-dark { background: #1d1d1d; border-color: transparent; color: #fff; }
.btn-dark:hover { background: #333; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger-bg); border-color: transparent; color: var(--danger-text); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-bg); border-color: transparent; color: var(--success-text); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning-bg); border-color: transparent; color: var(--warning-text); }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1rem; border-radius: var(--r); }
.btn-icon { padding: .5rem; width: 36px; height: 36px; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: .3rem; }
.btn-block { width: 100%; }
.btn .icon { width: 1.1em; height: 1.1em; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: .5rem; }
.card-head .icon { color: var(--accent-text); }
.card-body { padding: 1.25rem; }
.card-body + .card-body { border-top: 1px solid var(--border); }
.card-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--border); display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card.flat { box-shadow: none; }
.card.soft { background: var(--surface-2); }
.card.gold { border-color: color-mix(in srgb, var(--gold) 45%, transparent); background: linear-gradient(160deg, var(--accent-bg), transparent 60%), var(--surface); }
.stack { display: grid; gap: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.cols-main { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .cols-main { grid-template-columns: minmax(0, 1fr) minmax(0, 380px); } .cols-main.rev { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); } }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.gap-sm { gap: .35rem; }
.card, .card-body, .cols-main > * { min-width: 0; }

/* ---------- KPI ---------- */
.kpi { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: .4rem; position: relative; overflow: hidden; color: inherit; text-decoration: none !important; }
a.kpi:hover { border-color: var(--border-2); transform: translateY(-1px); }
.kpi .label { font-size: .8rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: .4rem; }
.kpi .value { font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: .85rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.kpi .kpi-icon { position: absolute; right: 1rem; top: 1rem; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-bg); color: var(--accent-text); }
.kpi .kpi-icon .icon { width: 20px; height: 20px; }
.kpi.warn .kpi-icon { background: var(--warning-bg); color: var(--warning-text); }
.kpi.ok .kpi-icon { background: var(--success-bg); color: var(--success-text); }
.kpi.danger .kpi-icon { background: var(--danger-bg); color: var(--danger-text); }
.kpi.info .kpi-icon { background: var(--info-bg); color: var(--info-text); }
.kpi.gold .value { color: var(--accent-text); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 600; letter-spacing: .01em; line-height: 1.4; white-space: nowrap; }
.badge .icon { width: .9em; height: .9em; }
.badge-muted { background: var(--surface-3); color: var(--text-2); }
.badge-accent { background: var(--accent-bg); color: var(--accent-text); }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-outline { background: transparent; border: 1px solid var(--border-2); color: var(--text-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field label, .label { font-size: .84rem; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: .35rem; }
.field label .req { color: var(--danger-text); }
.help { font-size: .78rem; color: var(--muted); line-height: 1.45; }
.input, .select, .textarea { width: 100%; padding: .62rem .8rem; border-radius: var(--r-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); transition: .15s; min-height: 40px; }
[data-theme="dark"] .input, [data-theme="dark"] .select, [data-theme="dark"] .textarea { background: var(--bg-2); }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237f889c' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; padding-right: 2.2rem; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-group .addon { display: flex; align-items: center; padding: 0 .8rem; border: 1px solid var(--border-2); border-left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--surface-2); color: var(--muted); font-size: .85rem; white-space: nowrap; }
.error { color: var(--danger-text); font-size: .8rem; display: flex; gap: .3rem; align-items: center; }
.form-grid { display: grid; gap: 1rem 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.25rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; cursor: pointer; font-weight: 500; color: var(--text); }
.check input { margin-top: .2rem; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.tiles { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tile { position: relative; display: flex; flex-direction: column; gap: .35rem; padding: .9rem; border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface-2); cursor: pointer; transition: .15s var(--ease); }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.tile .icon { width: 22px; height: 22px; color: var(--accent-text); }
.tile .t { font-weight: 600; font-size: .9rem; }
.tile .d { font-size: .78rem; color: var(--muted); line-height: 1.4; }
.tile:has(input:checked), .tile.selected { border-color: var(--accent); background: var(--accent-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.radios { display: flex; flex-wrap: wrap; gap: .5rem; }
.radios label { padding: .5rem .9rem; border: 1px solid var(--border-2); border-radius: 99px; cursor: pointer; position: relative; font-weight: 500; font-size: .88rem; background: var(--surface); display: inline-flex; align-items: center; gap: .35rem; }
.radios input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.radios label:has(input:checked) { background: var(--accent-bg); border-color: var(--accent); color: var(--accent-text); }

/* ---------- Alerts / toasts ---------- */
.alert { display: flex; gap: .7rem; padding: .85rem 1rem; border-radius: var(--r); border: 1px solid; font-size: .88rem; line-height: 1.5; align-items: flex-start; }
.alert .icon { width: 18px; height: 18px; flex: none; margin-top: .1rem; }
.alert strong { display: block; margin-bottom: .1rem; }
.alert-info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 40%, transparent); color: var(--info-text); }
.alert-success { background: var(--success-bg); border-color: color-mix(in srgb, var(--success) 40%, transparent); color: var(--success-text); }
.alert-warning { background: var(--warning-bg); border-color: color-mix(in srgb, var(--warning) 40%, transparent); color: var(--warning-text); }
.alert-danger { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--danger-text); }
.alert-muted { background: var(--surface-2); border-color: var(--border); color: var(--text-2); }
.alert-gold { background: var(--accent-bg); border-color: color-mix(in srgb, var(--gold) 50%, transparent); color: var(--accent-text); }
.alert .alert-body { flex: 1; min-width: 0; }
.alert a { color: inherit; text-decoration: underline; }
.toasts { position: fixed; right: 1rem; bottom: 1rem; z-index: 200; display: grid; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--r); background: var(--surface); color: var(--text); border: 1px solid var(--border-2); box-shadow: var(--shadow-lg); animation: toast-in .3s var(--ease); font-size: .88rem; }
.toast .icon { width: 18px; height: 18px; flex: none; margin-top: .1rem; }
.toast.success .icon { color: var(--success-text); } .toast.error .icon { color: var(--danger-text); } .toast.info .icon { color: var(--info-text); } .toast.warning .icon { color: var(--warning-text); }
.toast button { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .7rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { background: var(--surface-2); font-weight: 600; }
@media (max-width: 767px) {
  .table-responsive table, .table-responsive thead, .table-responsive tbody, .table-responsive tr, .table-responsive td { display: block; }
  .table-responsive thead { display: none; }
  .table-responsive tr { border: 1px solid var(--border); border-radius: var(--r); margin-bottom: .7rem; background: var(--surface); padding: .35rem 0; }
  .table-responsive td { border: 0; padding: .35rem 1rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
  .table-responsive td::before { content: attr(data-label); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
  .table-responsive td.no-label::before { display: none; }
  .table-responsive td.no-label { justify-content: flex-start; }
  .table-responsive .num { text-align: left; }
  .table-responsive tfoot { display: block; }
}

/* ---------- Lists / timeline ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: .9rem; align-items: center; padding: .8rem 1.25rem; border-bottom: 1px solid var(--border); transition: background .12s; color: inherit; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.list-item .meta { font-size: .8rem; color: var(--muted); }
.timeline { position: relative; padding-left: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline-item { position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -1.5rem; top: .35rem; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-3); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); }
.timeline-item.status::before { background: var(--accent); }
.timeline-item.won::before { background: var(--success); }
.timeline-item.lost::before { background: var(--muted-2); }
.timeline-item.message::before { background: var(--info); }
.timeline-item.payout::before { background: var(--gold); }
.timeline-item .when { font-size: .76rem; color: var(--muted); }
.timeline-item .bubble { margin-top: .3rem; padding: .6rem .8rem; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; font-size: .88rem; }
.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.empty .icon { width: 40px; height: 40px; opacity: .5; }
.empty h3 { color: var(--text-2); }

/* ---------- Tabs / seg / dropdown ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { padding: .7rem .9rem; color: var(--muted); font-weight: 560; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: .9rem; display: inline-flex; gap: .4rem; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-text); border-color: var(--accent); }
.tabs a .n { font-size: .7rem; background: var(--surface-3); padding: .05rem .4rem; border-radius: 99px; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button { padding: .35rem .75rem; border-radius: 6px; font-size: .82rem; font-weight: 560; color: var(--muted); border: 0; background: none; cursor: pointer; white-space: nowrap; }
.seg .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: .35rem; z-index: 60; }
.menu a, .menu button { display: flex; gap: .6rem; align-items: center; width: 100%; text-align: left; padding: .55rem .7rem; border-radius: var(--r-sm); color: var(--text-2); background: none; border: 0; cursor: pointer; font-size: .88rem; font-weight: 500; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.menu .danger { color: var(--danger-text); }

/* ---------- Divers ---------- */
.kv { display: grid; grid-template-columns: minmax(120px, 36%) 1fr; gap: .45rem 1rem; font-size: .88rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.ref { font-family: var(--mono); font-weight: 600; letter-spacing: .02em; }
.steps { display: flex; gap: .35rem; flex-wrap: wrap; }
.steps .st { display: flex; align-items: center; gap: .4rem; font-size: .78rem; padding: .35rem .65rem; border-radius: 99px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }
.steps .st.done { color: var(--success-text); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.steps .st.current { color: var(--accent-text); border-color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.steps .st.lost { color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--accent-2)); border-radius: 99px; }
.rank { display: grid; gap: .45rem; }
.rank-row { display: flex; align-items: center; gap: .6rem; font-size: .86rem; }
.rank-n { width: 20px; font-size: .72rem; color: var(--muted); text-align: right; flex: none; }
.rank-l { flex: 1 1 90px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-v { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; min-width: 44px; text-align: right; white-space: nowrap; }
.hbar { flex: 1 1 60px; min-width: 40px; height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.hbar span { display: block; height: 100%; border-radius: 99px; background: var(--gold); }
.hbar span.success { background: var(--success); }
.big-amount { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.pay-card { display: flex; flex-direction: column; gap: .4rem; padding: 1.25rem; }
.pay-card .big-amount { color: var(--accent-text); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .6rem; border: 1px solid var(--border-2); border-radius: 99px; font-size: .78rem; font-weight: 600; color: var(--text-2); background: var(--surface); }
.chip .icon { width: 13px; height: 13px; }

/* ---------- Dépôt de fichier ---------- */
.file-drop { border: 1.5px dashed var(--border-2); border-radius: var(--r); padding: .9rem 1rem; display: flex; gap: .8rem; align-items: center; background: var(--surface-2); cursor: pointer; transition: .15s; }
.file-drop:hover, .file-drop.over { border-color: var(--accent); background: var(--accent-bg); }
.file-drop input { display: none; }
.file-drop .icon { width: 22px; height: 22px; color: var(--accent-text); }
.file-drop .fn { font-size: .84rem; color: var(--muted); flex: 1; min-width: 0; }
.file-drop.has .fn { color: var(--text); font-weight: 600; }
.help.strong { color: var(--success-text); font-weight: 600; }
.help.error { color: var(--danger-text); }

/* ---------- Graphique (SVG serveur) ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--border); }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar-leads { fill: var(--surface-3); stroke: var(--border-2); }
.chart .bar-won { fill: var(--gold); }
.chart .bar:hover .bar-leads { fill: var(--accent-bg); }
.chart .line { fill: none; stroke: var(--success); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--success); stroke: var(--surface); stroke-width: 2; }
.chart .val { fill: var(--text-2); font-size: 10.5px; font-weight: 600; font-family: var(--font); }
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: .5rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart-legend .l-leads { background: var(--surface-3); border: 1px solid var(--border-2); }
.chart-legend .l-won { background: var(--gold); }
.chart-legend .l-com { background: var(--success); height: 3px; border-radius: 2px; width: 16px; }

/* ---------- Auth / pages nues ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(900px 500px at 50% 0%, rgba(189,158,91,.22), transparent 60%), var(--bg); }
.auth .card { width: 100%; max-width: 440px; }
.auth .brand-top { display: flex; flex-direction: column; align-items: center; gap: .4rem; margin-bottom: 1.25rem; }
.auth .brand-top .brand-sub { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); font-weight: 700; }
.auth-foot { text-align: center; color: var(--muted-2); font-size: .78rem; margin-top: 1rem; }
.auth-foot a { color: var(--muted); }
@media print { .sidebar, .topbar, .no-print { display: none !important; } .main { margin: 0 !important; } body { background: #fff; color: #000; } }

/* ---------- CGU ---------- */
.legal h2 { font-size: 1.02rem; margin: 1.5rem 0 .5rem; color: var(--accent-text); }
.legal p { color: var(--text-2); line-height: 1.7; }
.auth .card.legal { max-width: 860px; }
