:root {
  --ink: #16233a; --ink-2: #45536e; --mut: #6b7891; --line: #e3e8f1;
  --bg: #f5f7fb; --card: #fff; --brand: #1d3557; --accent: #2f6fed; --accent-d: #1f54c4;
  --ok: #1f7a4d; --ok-bg: #e4f3ea; --warn: #9a5b00; --warn-bg: #fdf1dc;
  --bad: #a4273a; --bad-bg: #fbe7eb; --orange: #c9761a; --orange-bg: #fdf1e2;
  --radius: 14px; --shadow: 0 1px 2px rgba(22,35,58,.05), 0 8px 24px -12px rgba(22,35,58,.18);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 "Avenir Next","Segoe UI",system-ui,sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.3rem; margin: 0 0 .75rem; }
h2 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
h3 { font-size: .9rem; margin: 0 0 .4rem; color: var(--ink-2); }
.hidden { display: none !important; }
.container { max-width: 1060px; margin: 0 auto; padding: 0 20px; }
main.container { padding-top: 24px; padding-bottom: 10px; display: grid; gap: 16px; align-content: start; }
.top { background: #fff; border-bottom: 1px solid var(--line); }
.top__row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 12px 20px; }
.brand { font-weight: 700; font-size: 1.1rem; }
.brand__dot { color: var(--accent); }
.brand__sub { font-weight: 500; color: var(--mut); font-size: .9rem; margin-left: .3rem; }
.nav { display: flex; gap: .3rem; align-items: center; }
.nav a { font-size: .9rem; font-weight: 600; color: var(--ink-2); padding: .4rem .7rem; border-radius: 9px; }
.nav a:hover { background: #eef1f7; text-decoration: none; color: var(--ink); }
.nav a[aria-current="true"] { background: #e2ebff; color: var(--accent-d); }
.nav__user { color: var(--mut) !important; font-weight: 500 !important; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nav-logout { color: var(--bad) !important; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card--form { max-width: 460px; margin: 8vh auto 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; margin-bottom: 1rem; }
.kpi { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fbfcfe; cursor: pointer; }
.kpi:hover { border-color: var(--accent); background: #f6f9ff; }
.kpi b { display: block; font-size: 1.5rem; color: var(--brand); }
.kpi span { color: var(--mut); font-size: .82rem; font-weight: 600; }
.kpi--alert { background: var(--warn-bg); border-color: #f0d9a8; }
.kpi--alert span { color: var(--warn); }
.hint { color: var(--mut); font-size: .85rem; margin: .4rem 0 .8rem; }
.error { color: var(--bad); font-size: .88rem; font-weight: 600; margin: .4rem 0; }
.btn { display: inline-flex; align-items: center; gap: .4rem; font: inherit; font-size: .9rem; font-weight: 600; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); padding: .5rem .9rem; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f3f6ff; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn--primary { background: var(--accent); border-color: var(--accent-d); color: #fff; }
.btn--primary:hover { background: var(--accent-d); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: #eef1f7; }
.field { display: grid; gap: .3rem; font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.field input, .field select { font: inherit; font-size: .95rem; font-weight: 400; padding: .55rem .7rem; border: 1px solid #cdd6e5; border-radius: 10px; background: #fff; color: var(--ink); }
.btn--w { width: 100%; }
/* ——— Biens ——— */
.bien { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.bien:first-child { border-top: 0; }
.bien:hover { background: #fbfcfe; }
.bien__t { display: flex; flex-direction: column; }
.bien__adresse { font-weight: 700; }
.bien__meta { color: var(--mut); font-size: .82rem; }
.bien__right { display: flex; align-items: center; gap: 1.2rem; }
.bien__cta { font-weight: 700; color: var(--accent); cursor: pointer; text-align: right; }
.bien__cta small { display: block; color: var(--mut); font-weight: 500; }
.add-bien { margin-top: .8rem; border-top: 1px dashed var(--line); padding-top: .8rem; display: none; gap: .6rem; flex-wrap: wrap;}
.add-bien.open { display: flex; }
.add-bien .field { width: 100%; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: .1rem .55rem; }
.b-badge { color: var(--ink-2); background: #eef1f7; }
/* ——— Table ——— */
.table-head { display: flex; align-items: center; gap: 1rem; }
.filters { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.filters .chip { font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink-2); padding: .3rem .7rem; }
.filters .chip:hover { border-color: var(--accent); }
.filters .chip[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mut); padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .92rem; }
.tbl tr.row { cursor: pointer; }
.tbl tr.row:hover { background: #f6f9ff; }
.sortb { cursor: pointer; user-select: none; }
.sortb::after { content: ' ↕'; opacity: .4; }
.sortb[aria-sort]::after { content: ' ↓'; opacity: 1; }
.pill { display: inline-block; font-size: .76rem; font-weight: 700; border-radius: 999px; padding: .16rem .6rem; white-space: nowrap; }
.pill--RECU, .pill--VERIFICATION { background: #e2ebff; color: #1f3f8f; }
.pill--COMPLET { background: var(--ok-bg); color: var(--ok); }
.pill--INCOMPLET { background: var(--warn-bg); color: var(--warn); }
.pill--A_VERIFIER { background: var(--orange-bg); color: #8a5410; }
.pill--CLOS { background: #eceff4; color: var(--mut); }
.feu { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.feu .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.feu--VERT { color: var(--ok); } .feu--VERT .dot { background: #22a35f; }
.feu--ORANGE { color: #b56a00; } .feu--ORANGE .dot { background: #f09819; }
.feu--ROUGE { color: var(--bad); } .feu--ROUGE .dot { background: #d5304f; }
.score { font-weight: 700; }
.score small { color: var(--mut); font-weight: 500; }
.ratio { font-size: .82rem; color: var(--ink-2); }
.ratio.bad { color: var(--bad); font-weight: 700; }
.flag-ic { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; }
.flag-ic--WARN { background: var(--warn-bg); color: var(--warn); }
.flag-ic--INFO { background: #e2ebff; color: var(--accent-d); }
.pager { display: flex; gap: .6rem; align-items: center; margin-top: .9rem; color: var(--mut); font-size: .88rem; }
.muted { color: var(--mut); }
.ref { font: 700 .95rem ui-monospace,monospace; letter-spacing: .12em; color: var(--brand); }
/* ——— Détail ——— */
.dhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; }
.dhead__main h2 { margin: 0; font-size: 1.15rem; }
.dgrid { display: grid; grid-template-columns: 1.2fr .9fr; gap: 1.4rem; margin-top: 1.1rem; }
@media (max-width: 820px) { .dgrid { grid-template-columns: 1fr; } }
.kv { font-size: .92rem; }
.kv div { display: flex; gap: .8rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.kv dt { width: 130px; flex: none; color: var(--mut); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.piece-line { display: flex; gap: .6rem; align-items: baseline; padding: .35rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.piece-line:last-child { border-bottom: 0; }
.p-type { width: 170px; flex: none; font-weight: 600; }
.p-stat { font-size: .78rem; font-weight: 700; }
.p-stat--LUE { color: var(--ok); } .p-stat--RECUE { color: var(--accent-d); } .p-stat--ILLISIBLE { color: var(--bad); }
.p-meta { color: var(--mut); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flag-line { display: flex; gap: .55rem; padding: .35rem 0; font-size: .88rem; align-items: flex-start; }
.scorebar { background: #eef1f7; border-radius: 6px; height: 8px; overflow: hidden; margin: .5rem 0 1rem; }
.scorebar i { display: block; height: 100%; background: var(--accent); }
.sline { display: flex; justify-content: space-between; gap: 1rem; font-size: .86rem; padding: .22rem 0; }
.sline b { font-variant-numeric: tabular-nums; }
.sline .max { color: var(--mut); font-weight: 500; }
.empty { text-align: center; color: var(--mut); padding: 2rem 0; }
.foot { color: var(--mut); font-size: .8rem; text-align: center; padding: 18px 20px 34px; }
.spin { display: inline-block; width: 1em; height: 1em; border: 2px solid rgba(0,0,0,.15); border-top-color: currentColor; border-radius: 50%; animation: sp .7s linear infinite; vertical-align: -2px; }
@keyframes sp { to { transform: rotate(360deg); } }
