/* CABLO — interface web. Identité : signal de réception (barres + arcs), encre indigo, cobalt électrique. */
:root {
  --ink: #0E1330;
  --ink-2: #1A2050;
  --ink-3: #2A3170;
  --signal: #2F4BFF;
  --signal-d: #2238D6;
  --signal-soft: #E8ECFF;
  --bg: #F2F4FA;
  --surface: #FFFFFF;
  --line: #E1E5F1;
  --text: #141A3B;
  --muted: #646C8F;
  --ok: #0C9A78;
  --ok-soft: #DCF5EC;
  --bad: #E04565;
  --bad-soft: #FDE4EA;
  --warn: #C27A00;
  --warn-soft: #FFF0CF;
  --r: 14px;
  --font-d: 'Bricolage Grotesque', 'Trebuchet MS', system-ui, sans-serif;
  --font-b: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font-b); font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-family: var(--font-d); margin: 0; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
a { color: var(--signal); text-decoration: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid rgba(47, 75, 255, .45); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: grid; gap: 16px; }
.hide { display: none !important; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Authentification ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art { position: relative; background: var(--ink); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-art .brand { position: relative; z-index: 1; }
.auth-art h2 { position: relative; z-index: 1; font-size: clamp(30px, 3.6vw, 48px); font-weight: 800; max-width: 12ch; line-height: 1.04; }
.auth-art p { position: relative; z-index: 1; color: #AEB6E4; max-width: 38ch; margin-top: 16px; font-size: 16px; }
.auth-arcs { position: absolute; right: -110px; top: 5vh; width: min(560px, 58vh); height: min(560px, 58vh); overflow: visible; }
.auth-arcs path { fill: none; stroke: var(--signal); stroke-linecap: round; stroke-width: 14; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.6s cubic-bezier(.2, .7, .2, 1) forwards; }
.auth-arcs path:nth-child(2) { stroke: #5B73FF; animation-delay: .25s; }
.auth-arcs path:nth-child(3) { stroke: #8FA0FF; animation-delay: .5s; }
.auth-arcs path:nth-child(4) { stroke: #C3CCFF; animation-delay: .75s; }
.auth-arcs circle { fill: #fff; opacity: 0; animation: pop .5s 1.5s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { to { opacity: 1; } }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { margin-bottom: 6px; }
.tabs { display: inline-flex; background: #E6E9F5; border-radius: 12px; padding: 4px; margin: 22px 0 20px; }
.tabs a { padding: 8px 16px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.tabs a.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(14, 19, 48, .12); }
.price-note { background: var(--signal-soft); color: var(--ink-3); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 18px; }
.price-note b { font-family: var(--font-d); }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-d); font-weight: 800; font-size: 22px; letter-spacing: -0.03em; }
.brand svg { width: 34px; height: 34px; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--ink); color: #C7CDF0; padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; padding: 0 10px; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: #AEB6E4; font-weight: 500; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.on { background: var(--ink-3); color: #fff; box-shadow: inset 3px 0 0 #7C8FFF; }
.side nav .badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.side .me { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding: 14px 10px 0; font-size: 13px; }
.side .me b { display: block; color: #fff; font-size: 14px; }
.side .me a { color: #AEB6E4; display: inline-flex; gap: 8px; align-items: center; margin-top: 8px; }
.main { padding: 28px 34px 60px; max-width: 1280px; width: 100%; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: var(--signal); color: #fff; padding: 10px 16px; border-radius: 11px; font-weight: 600; transition: background .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--signal-d); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: #F6F7FC; }
.btn.danger { background: var(--bad); }
.btn.danger:hover { background: #C93454; }
.btn.ok { background: var(--ok); }
.btn.ok:hover { background: #087A5F; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; padding: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: #E9ECF6; color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: #067257; }
.chip.bad { background: var(--bad-soft); color: #B52A47; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--signal-soft); color: var(--signal-d); }
label { display: grid; gap: 6px; align-content: start; font-weight: 600; font-size: 13.5px; }
label .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid #CFD5E8; border-radius: 10px; padding: 10px 12px; min-height: 42px; width: 100%; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(47, 75, 255, .25); border-color: var(--signal); }
.form { display: grid; gap: 14px; }
.form.two { grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.form-error { color: #B52A47; background: var(--bad-soft); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 18px; min-height: 18px; height: 18px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.filters input, .filters select { width: auto; min-width: 150px; min-height: 38px; padding: 7px 10px; }
.filters .search { flex: 1; min-width: 220px; position: relative; }
.filters .search input { width: 100%; padding-left: 36px; }
.filters .search .icon { position: absolute; left: 11px; top: 10px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFE; }
td { padding: 12px 16px; border-bottom: 1px solid #EEF0F8; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #F8F9FD; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
td .name { font-weight: 600; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-family: var(--font-d); font-size: 18px; margin-bottom: 4px; }

/* Barres de signal : taux de recouvrement */
.sig { display: inline-flex; align-items: flex-end; gap: 3px; height: 22px; vertical-align: middle; }
.sig i { display: block; width: 5px; border-radius: 2px; background: #D9DDEC; }
.sig.ok i.on { background: var(--ok); }
.sig.mid i.on { background: #E5A00D; }
.sig.low i.on { background: var(--bad); }
.sig.lg { height: 64px; gap: 6px; }
.sig.lg i { width: 14px; border-radius: 4px; }
.sig.on-ink i { background: rgba(255, 255, 255, .18); }
.rate { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }

/* Bandeau principal du tableau de bord */
.hero { background: var(--ink); color: #fff; border-radius: 20px; padding: 28px 30px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; position: relative; overflow: hidden; }
.hero .lbl { color: #AEB6E4; font-size: 14px; }
.hero .big { font-family: var(--font-d); font-weight: 800; font-size: clamp(38px, 5vw, 58px); letter-spacing: -0.04em; line-height: 1.05; margin: 6px 0 4px; }
.hero .big small { font-size: .45em; font-weight: 700; color: #AEB6E4; margin-left: 6px; letter-spacing: 0; }
.hero .meta { color: #AEB6E4; }
.hero .sigbox { text-align: center; }
.hero .sigbox .pct { font-family: var(--font-d); font-weight: 800; font-size: 28px; margin-top: 8px; }
.hero .sigbox .cap { color: #AEB6E4; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.stats > div { padding: 16px 20px; border-right: 1px solid var(--line); }
.stats > div:last-child { border-right: 0; }
.stats .v { font-family: var(--font-d); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; }
.stats .l { color: var(--muted); font-size: 13px; }
.month-nav { display: inline-flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.month-nav button { background: 0; border: 0; padding: 8px 10px; color: var(--muted); display: grid; place-items: center; }
.month-nav button:hover { color: var(--text); }
.month-nav span { min-width: 130px; text-align: center; font-weight: 600; text-transform: capitalize; }

.alert { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; font-weight: 500; flex-wrap: wrap; }
.alert.warn { background: var(--warn-soft); color: #7A4B00; }
.alert.bad { background: var(--bad-soft); color: #8E2038; }
.alert.info { background: var(--signal-soft); color: var(--ink-3); }
.alert .btn { margin-left: auto; }
.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.btn.ghost.warn-text { color: var(--bad); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.list { display: grid; }
.list > div { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #EEF0F8; flex-wrap: wrap; }
.list > div:last-child { border-bottom: 0; }

/* Graphique */
.chart text { font-family: var(--font-b); font-size: 11.5px; fill: var(--muted); }
.chart .val { fill: var(--text); font-weight: 600; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* Fenêtres */
.modal-back { position: fixed; inset: 0; background: rgba(14, 19, 48, .55); display: grid; place-items: center; padding: 20px; z-index: 50; overflow-y: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(14, 19, 48, .35); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 22px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.x { background: 0; border: 0; color: var(--muted); padding: 4px; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 80; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(14, 19, 48, .3); max-width: 360px; animation: fade .2s; }
.toast.err { background: #A62A45; }
.secret { font-family: var(--font-d); font-size: 34px; font-weight: 800; letter-spacing: .08em; text-align: center; background: var(--signal-soft); border-radius: 14px; padding: 16px; user-select: all; }

/* Reçu */
.receipt { font-family: 'Courier New', monospace; font-size: 13px; background: #FBFBFD; border: 1px dashed #B9BFD8; border-radius: 10px; padding: 18px; max-width: 340px; margin: 0 auto; color: #111; }
.receipt h4 { margin: 0; text-align: center; font-size: 16px; }
.receipt .c { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 10px 0; }
.receipt .ln { display: flex; justify-content: space-between; gap: 10px; }
.receipt .tot { font-size: 16px; font-weight: 700; }
#print-root { display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(14, 19, 48, .5); z-index: 39; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: 0; border: 0; color: #fff; padding: 4px; }
  .topbar .brand svg { width: 28px; height: 28px; }
  .main { padding: 20px 16px 60px; }
  .cols { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 24px 36px; min-height: 260px; }
  .auth-arcs { width: 300px; height: 300px; right: -90px; top: 20px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div:nth-child(2) { border-right: 0; }
  .stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 560px) {
  h1 { font-size: 24px; }
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .hero .sigbox { text-align: left; display: flex; align-items: center; gap: 14px; }
  .hero .sigbox .pct { margin: 0; }
  .form.two { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .filters input, .filters select { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-arcs path { animation: none; stroke-dashoffset: 0; }
  .auth-arcs circle { animation: none; opacity: 1; }
  * { transition: none !important; }
}
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  body { background: #fff; }
  .p-title { font-family: var(--font-d); font-size: 22px; font-weight: 800; margin-bottom: 4px; }
  .p-sub { color: #555; margin-bottom: 14px; }
  #print-root table { font-size: 12px; }
  #print-root th { background: #f1f1f1 !important; -webkit-print-color-adjust: exact; }
  #print-root .receipt { border: 0; max-width: 300px; margin: 0; }
}

/* Encaissement : liste de mois à cocher */
.paylist { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto; }
.chk { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; background: #fff; cursor: pointer; font-weight: 500; }
.chk input { width: 18px; height: 18px; flex: none; }
.chk span { flex: 1; }
.chk:has(input:checked) { border-color: var(--signal); background: var(--signal-soft); }
