/* SAPIRA 360 · interface de direction
   Mise en page : menu latéral bleu nuit fixe, contenu sur fond blanc cassé, accents dorés discrets.
   Thèmes : clair par défaut, sombre selon le système ou le choix mémorisé (data-theme). */
:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #18202f;
  --muted: #69707f;
  --line: #e6e2d8;
  --line-soft: #efece5;
  --navy: #0f1e3a;
  --navy-2: #16294d;
  --navy-3: #27406f;
  --gold: #a8823a;
  --gold-soft: #c9a96a;
  --accent-ink: #1f3a6b;
  --side-bg: #0f1e3a;
  --side-ink: #c9d0de;
  --side-muted: #7e8aa3;
  --side-active: #1b3060;
  --ok: #2c7350;
  --ok-bg: #e5f1ea;
  --warn: #8f6514;
  --warn-bg: #f8eedb;
  --err: #a23b3b;
  --err-bg: #f7e5e5;
  --info-bg: #e9edf5;
  --chip-bg: #eceef3;
  --input-bg: #ffffff;
  --input-line: #cfd3dc;
  --shadow: 0 1px 2px rgba(15, 30, 58, .05), 0 6px 20px rgba(15, 30, 58, .05);
  --radius: 10px;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --c-fiscal: #3d62b0; --c-tva: #2f8a8a; --c-gouv: #8a5aa8; --c-societe: #a8823a;
  --c-bail: #4f7a3a; --c-travaux: #b0623d; --c-location: #c0507a; --c-autre: #7d8494;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1220; --surface: #131b2c; --surface-2: #172034; --ink: #e4e8f0; --muted: #98a2b6; --line: #253048; --line-soft: #1d263a;
    --navy: #dfe5f1; --navy-2: #c5cfe2; --navy-3: #9fb3dc; --gold: #cdac6c; --gold-soft: #d9bd85; --accent-ink: #a9bde6;
    --side-bg: #0a1020; --side-ink: #c3cbdb; --side-muted: #6f7b95; --side-active: #182644;
    --ok: #6cc196; --ok-bg: #16302a; --warn: #e2b35a; --warn-bg: #33291a; --err: #ec8b8b; --err-bg: #3a1e22; --info-bg: #1b2640;
    --chip-bg: #1f2a40; --input-bg: #0f1726; --input-line: #2c3853; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1220; --surface: #131b2c; --surface-2: #172034; --ink: #e4e8f0; --muted: #98a2b6; --line: #253048; --line-soft: #1d263a;
  --navy: #dfe5f1; --navy-2: #c5cfe2; --navy-3: #9fb3dc; --gold: #cdac6c; --gold-soft: #d9bd85; --accent-ink: #a9bde6;
  --side-bg: #0a1020; --side-ink: #c3cbdb; --side-muted: #6f7b95; --side-active: #182644;
  --ok: #6cc196; --ok-bg: #16302a; --warn: #e2b35a; --warn-bg: #33291a; --err: #ec8b8b; --err-bg: #3a1e22; --info-bg: #1b2640;
  --chip-bg: #1f2a40; --input-bg: #0f1726; --input-line: #2c3853; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
h1, h2 { font-family: var(--display); color: var(--navy); font-weight: 600; margin: 0; letter-spacing: .2px; text-wrap: balance; }
h1 { font-size: 30px; line-height: 1.15; }
h1 small { font-family: var(--font); font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 8px; }
h2 { font-size: 21px; margin-bottom: 12px; }
h2 small, .card h2 small { font-family: var(--font); font-size: 13px; font-weight: 400; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.muted { color: var(--muted); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Coquille : menu latéral + contenu ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--side-bg) 252px, transparent 252px); }
.side { background: var(--side-bg); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 28px; border-right: 1px solid rgba(201, 169, 106, .18); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--display); font-size: 22px; font-weight: 600; padding: 4px 10px 18px; letter-spacing: .3px; }
.mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1.5px solid #c9a96a; color: #d9bd85; border-radius: 50%; font-family: var(--display); font-size: 18px; flex: none; }
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 14px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--side-muted); padding: 6px 10px; }
.side-nav a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); text-decoration: none; padding: 7px 10px; border-radius: 7px; font-size: 13.5px; font-weight: 500; position: relative; }
.side-nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.side-nav a.active { background: var(--side-active); color: #fff; }
.side-nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #c9a96a; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-nav .ic { opacity: .85; }
.badge { margin-left: auto; background: #c9a96a; color: #0f1e3a; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 7px; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-title { font-weight: 600; color: var(--muted); font-size: 13px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--ink); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--surface); border-color: var(--line); }
.dot-badge { position: absolute; top: 3px; right: 2px; background: var(--err); color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px; padding: 0 5px; line-height: 15px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 13px; }
.user-chip:hover { background: var(--surface); }
.role { border: 1px solid var(--gold); color: var(--gold); border-radius: 10px; padding: 0 7px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; }
.menu-btn { display: none; }
.side-backdrop { display: none; }
.main { width: 100%; max-width: 1360px; margin: 0 auto; padding: 26px 28px 56px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.no-shell .main { padding: 0; max-width: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: 268px; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-open .side { transform: none; }
  .nav-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(5, 10, 20, .45); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 8px 16px; }
  .user-chip span:not(.role), .user-chip .role { display: none; }
  .main { padding: 18px 16px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  h1 { font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

/* ---------- Structure des pages ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flat { box-shadow: none; background: var(--surface-2); margin-bottom: 0; }
.card.narrow { max-width: 520px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--muted); margin-bottom: 18px; }
.small-note { font-size: 12.5px; margin: 10px 0 0; }
.warn-text { color: var(--warn); }
.nowrap { white-space: nowrap; }
@media (max-width: 860px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--input-line); background: var(--surface); color: var(--ink); padding: 7px 13px; border-radius: 7px; font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; line-height: 1.35; }
.btn:hover { border-color: var(--navy-3); }
.btn.gold { background: #0f1e3a; border-color: #0f1e3a; color: #e3c88f; }
.btn.gold:hover { background: #1b3060; }
.btn.danger { border-color: var(--err); color: var(--err); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; margin-top: 8px; padding: 11px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent-ink); text-decoration: underline; cursor: pointer; font: inherit; }
button.link.danger { color: var(--err); }

/* ---------- Indicateurs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis.compact { margin: 12px 0 0; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; min-width: 0; position: relative; }
.kpi::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; background: var(--gold); border-radius: 2px; opacity: .7; }
.kpi.wide { grid-column: 1 / -1; }
.kpi span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.kpi strong { display: block; font-size: clamp(18px, 1.5vw, 22px); color: var(--navy); margin: 4px 0 2px; font-variant-numeric: tabular-nums; font-weight: 600; overflow-wrap: anywhere; }
.kpi em { font-style: normal; color: var(--muted); font-size: 12px; }
.kpi em.up { color: var(--ok); }
.kpi em.down { color: var(--err); }
.kpi.alert::before { background: var(--err); opacity: 1; }
.kpi.alert strong { color: var(--err); }
.na { font-size: 14px; font-weight: 500; color: var(--muted); font-style: italic; }
.dash-section { margin-bottom: 26px; min-width: 0; }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; }
.sec-head .muted { flex: 1; font-size: 12.5px; }
.sec-head a { font-size: 13px; }
.alerts .flash { margin-bottom: 8px; }
table.bars { width: 100%; }
table.bars th { width: 1%; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); background: none; border: 0; padding: 5px 10px 5px 0; font-weight: 500; }
table.bars td { border: 0; padding: 5px 0; }
table.bars td.num { width: 1%; padding-left: 10px; }
.bar { display: block; height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: #3d62b0; border-radius: 4px; }
.bar.near i { background: var(--warn); }
.bar.over i { background: var(--err); }
.w0 { width: 0; } .w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; } .w25 { width: 25%; } .w30 { width: 30%; }
.w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; } .w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; } .w65 { width: 65%; }
.w70 { width: 70%; } .w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; } .w95 { width: 95%; } .w100 { width: 100%; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.card .table-wrap { box-shadow: none; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.total td { font-weight: 600; background: var(--surface-2); }
tr.is-read td { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a, .row-actions form { margin-left: 10px; }
.row-actions.stack { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-actions.stack a, .row-actions.stack form { margin-left: 0; }
td.details { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); max-width: 360px; word-break: break-word; }
table.sheet td { font-size: 12px; white-space: nowrap; }

/* ---------- Étiquettes d'état ---------- */
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--chip-bg); color: var(--accent-ink); white-space: nowrap; }
.tag-loue, .tag-actif, .tag-paye, .tag-clos, .tag-termine, .tag-exonere, .tag-option_tva, .tag-taxable, .tag-fait, .tag-doc-signe, .tag-tpl-valide,
.tag-tax-deposee, .tag-tax-cloturee, .tag-meet-pv_signe, .tag-meet-archivee, .tag-vote-adoptee { background: var(--ok-bg); color: var(--ok); }
.tag-vacant, .tag-retard, .tag-urgente, .tag-resilie, .tag-tax-contestation, .tag-vote-rejetee, .tag-meet-annulee { background: var(--err-bg); color: var(--err); }
.tag-travaux, .tag-partiel, .tag-haute, .tag-a_valider, .tag-attente_prestataire, .tag-ouvert, .tag-a_faire, .tag-doc-a_signer, .tag-tpl-en_revue,
.tag-tax-a_valider, .tag-tax-paiement_a_suivre, .tag-tax-rectificatif, .tag-meet-pv_a_signer, .tag-meet-tenue, .tag-en_cours { background: var(--warn-bg); color: var(--warn); }
.tag-doc-archive, .tag-tax-sans_objet, .tag-abandonne { background: var(--line-soft); color: var(--muted); }
.tag-odoo { background: #0f1e3a; color: #e3c88f; }

/* ---------- Messages ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash ul { margin: 0; padding-left: 18px; }
.flash.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.flash.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.flash.err { background: var(--err-bg); border-color: color-mix(in srgb, var(--err) 30%, transparent); color: var(--err); }
.flash a { color: inherit; font-weight: 600; }
.env-essai { background: #fbf3df; color: #6e5112; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; padding: 6px 16px; border-bottom: 1px solid #ead3a3; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 20px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.form-grid .field { margin-bottom: 0; }
.field.wide, .form-actions { grid-column: 1 / -1; }
.field > span { font-size: 12px; font-weight: 600; color: var(--navy); }
.field small { color: var(--muted); font-size: 12px; }
.field.check { flex-direction: row; align-items: center; gap: 8px; align-self: end; }
.field.check > span { font-weight: 500; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--input-line); border-radius: 7px; background: var(--input-bg); color: var(--ink); width: 100%; min-width: 0; }
input[type=checkbox] { width: auto; accent-color: var(--gold); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-soft); outline-offset: 0; border-color: var(--gold); }
.page-head select, .actions select { width: auto; min-width: 150px; }
.form-actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.sub-form { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 12px; }
.access-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.access-row select { width: auto; margin-left: auto; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field.grow { flex: 1 1 240px; }
.inline-add { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.inline-add select { flex: 1 1 260px; width: auto; }
form.pay { display: flex; gap: 4px; align-items: center; margin: 0; }
form.pay input { width: 90px; padding: 4px 6px; font-size: 12px; }
form.pay input[type=date] { width: 130px; }
.big-num { font-size: 20px; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% 0%, #22396a 0%, #0f1e3a 55%, #0a1428 100%); }
.login-card { background: var(--surface); width: 100%; max-width: 400px; padding: 32px 28px; border-radius: 12px; border-top: 3px solid #c9a96a; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand .mark { width: 48px; height: 48px; font-size: 26px; margin-bottom: 8px; }
.login-brand p { color: var(--muted); margin: 4px 0 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: 1.5px; }

/* ---------- Import, mapping ---------- */
.upload { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.upload input[type=file], .upload input[type=text] { width: auto; max-width: 100%; flex: 1 1 200px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px 20px; margin-top: 6px; }
.map-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 13px; }
.map-row span { font-weight: 600; color: var(--navy); }
.report { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.inline-form { max-width: 520px; }
.tag-a_venir { background: var(--chip-bg); color: var(--accent-ink); }
.howto { margin: 0 0 16px; padding-left: 20px; }
.howto li { margin-bottom: 4px; }
.acc-class { border-top: 1px solid var(--line); padding: 10px 0; }
.acc-class summary { cursor: pointer; font-weight: 600; color: var(--navy); }
.acc-class .table-wrap { margin-top: 10px; }

/* ---------- GED ---------- */
.dropzone { border: 1.5px dashed var(--input-line); border-radius: var(--radius); padding: 22px; text-align: center; background: var(--surface-2); cursor: pointer; position: relative; }
.dropzone.over { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 8%, var(--surface)); }
.dropzone.has-file { border-style: solid; border-color: var(--ok); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-title { font-weight: 600; color: var(--navy); }
.dz-sub { display: block; font-size: 12px; color: var(--muted); }
.dz-file { display: block; font-weight: 600; color: var(--ok); margin-top: 4px; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { padding: 7px 0; border-bottom: 1px solid var(--line-soft); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.file-list li:last-child { border-bottom: 0; }
.file-list form { margin-left: auto; }
.preview { padding: 12px; }
.pdf-frame { width: 100%; height: 640px; border: 0; border-radius: 6px; background: var(--surface-2); }
.img-preview { display: block; max-width: 100%; max-height: 640px; margin: 0 auto; border-radius: 6px; }
.hash { font-size: 11px; color: var(--muted); }
.facts { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 14px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding-top: 1px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .facts { grid-template-columns: minmax(0, 1fr); } .facts dd { margin-bottom: 6px; } }

/* ---------- Documents et modèles ---------- */
.tag-doc-projet, .tag-tpl-brouillon { background: var(--chip-bg); color: var(--accent-ink); }
.vars { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; margin-top: 16px; }
.vars .field.wide { grid-column: 1 / -1; }
.src { font-style: normal; font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--gold); margin-left: 6px; }
.doc-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.doc-side { position: sticky; top: 70px; }
.meta { margin: 0 0 12px; display: grid; grid-template-columns: 1fr; gap: 2px; font-size: 13px; }
.meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-top: 8px; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.inline-meta { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 10px 0 14px; }
.inline-meta dt { margin-top: 0; }
.stack-form { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.doc-sheet { background: #fff; color: #111; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 56px 64px; max-width: 820px; font: 15px/1.6 Georgia, 'Times New Roman', serif; min-width: 0; border-radius: 4px; }
.doc-sheet h1 { font-family: Georgia, serif; color: #111; font-size: 22px; text-align: center; margin: 0 0 22px; }
.doc-sheet h2 { font-family: Georgia, serif; color: #111; font-size: 16px; margin: 20px 0 8px; }
.doc-sheet h3 { font-size: 15px; margin: 14px 0 6px; color: #111; text-transform: none; letter-spacing: 0; }
.doc-sheet p { margin: 0 0 10px; text-align: justify; }
.doc-sheet ul { margin: 0 0 10px 20px; padding: 0; }
.doc-sheet .doc-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.doc-sheet .doc-table td { border: 0; padding: 8px 12px 48px 0; width: 50%; vertical-align: top; }
.doc-sheet a { color: #1f3a6b; }
.doc-note { border: 1px solid #c9c3b4; background: #faf8f2; color: #222; padding: 8px 12px; margin: 10px 0; font-size: 14px; }
.doc-var { background: #eef3fb; border-radius: 2px; }
.doc-missing { background: #ffeeb8; border-radius: 2px; padding: 0 2px; }
.doc-draft { border: 2px solid #a23b3b; color: #a23b3b; text-align: center; font: 600 12px Inter, sans-serif; letter-spacing: .6px; padding: 6px; margin-bottom: 24px; }
.letterhead { border-bottom: 1.5px solid #a8823a; padding-bottom: 10px; margin-bottom: 26px; font-family: Inter, Arial, sans-serif; }
.lh-name { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 24px; color: #0f1e3a; letter-spacing: .4px; font-weight: 600; }
.lh-form { font-family: Inter, Arial, sans-serif; font-size: 12px; color: #6b7280; font-weight: 500; }
.lh-line { font-size: 11px; color: #4b5260; margin-top: 2px; }
.lh-preview { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 6px; padding: 20px 22px; }
.lh-preview .muted { color: #8b8f99; }
hr.page-break { border: 0; border-top: 1px dashed #ccc; margin: 24px 0; }
.workflow .steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 14px; flex-wrap: wrap; }
.workflow .steps li { padding: 4px 12px; border-radius: 12px; background: var(--chip-bg); color: var(--muted); font-size: 12px; font-weight: 600; }
.workflow .steps li.on { background: #0f1e3a; color: #e3c88f; }
.workflow .steps li.done { background: var(--ok-bg); color: var(--ok); }
.validate-form input[type=text] { width: 240px; }
.validate-form input[type=date] { width: 150px; }
.tpl-edit { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin: 16px 0; }
.code-area { font: 13px/1.55 ui-monospace, Menlo, Consolas, monospace; min-height: 520px; }
.tpl-help { font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; align-self: start; max-height: 640px; overflow: auto; }
.tpl-help h3 { font-size: 12px; margin: 8px 0 6px; color: var(--navy); }
.tpl-help ul { margin: 0; padding-left: 16px; }
.tpl-help code { font-size: 11.5px; background: var(--chip-bg); padding: 0 3px; border-radius: 3px; }
.var-list li { margin-bottom: 3px; }
@media (max-width: 960px) { .doc-layout, .tpl-edit { grid-template-columns: minmax(0, 1fr); } .doc-side { position: static; } .doc-sheet { padding: 28px 22px; } }

/* ---------- Gouvernance, AGO ---------- */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 22px 220px minmax(0, 1fr); gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
.checks li::before { content: "✓"; font-weight: 700; color: var(--ok); }
.checks li.ko::before { content: "✕"; color: var(--err); }
.checks li.warn::before { content: "!"; color: var(--warn); }
.checks li span { color: var(--muted); font-size: 13px; }
@media (max-width: 700px) { .checks li { grid-template-columns: 22px minmax(0, 1fr); } .checks li span { grid-column: 2; } }
details.res { border-top: 1px solid var(--line-soft); padding: 9px 0; }
details.res summary { cursor: pointer; }
details.res form { margin-top: 10px; }
.tag-vote-a_voter, .tag-vote-ajournee, .tag-meet-planifiee, .tag-meet-convoquee, .tag-tax-a_preparer, .tag-tax-en_cours { background: var(--chip-bg); color: var(--accent-ink); }

/* ---------- Double authentification ---------- */
.mfa-setup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.qr { width: 200px; max-width: 100%; aspect-ratio: 1; background: #fff; border-radius: 8px; padding: 6px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { word-break: break-all; }
.codes { columns: 2; list-style: none; padding: 0; }
.codes li { padding: 3px 0; }
@media (max-width: 700px) { .mfa-setup { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Calendrier ---------- */
.cal-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; cursor: pointer; }
.chip input { margin: 0; }
.chip[class*="ev-"]::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c-autre); }
.chip.ev-fiscal::before { background: var(--c-fiscal); } .chip.ev-tva::before { background: var(--c-tva); } .chip.ev-gouvernance::before { background: var(--c-gouv); }
.chip.ev-societe::before { background: var(--c-societe); } .chip.ev-bail::before { background: var(--c-bail); } .chip.ev-travaux::before { background: var(--c-travaux); }
.chip.ev-location::before { background: var(--c-location); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; margin-bottom: 18px; }
.cal-h { background: var(--surface-2); padding: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.cal-d { background: var(--surface); min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-d.out { background: var(--surface-2); }
.cal-d.out .n { color: var(--muted); opacity: .6; }
.cal-d .n { font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-d.today .n { background: #0f1e3a; color: #e3c88f; border-radius: 10px; padding: 0 7px; align-self: flex-start; }
.ev { display: block; font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 4px; text-decoration: none; color: var(--ink); background: var(--chip-bg); border-left: 3px solid var(--c-autre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.done { opacity: .55; text-decoration: line-through; }
.ev.late { background: var(--err-bg); }
.ev-fiscal { border-left-color: var(--c-fiscal); } .ev-tva { border-left-color: var(--c-tva); } .ev-gouvernance { border-left-color: var(--c-gouv); }
.ev-societe { border-left-color: var(--c-societe); } .ev-bail { border-left-color: var(--c-bail); } .ev-travaux { border-left-color: var(--c-travaux); }
.ev-location { border-left-color: var(--c-location); } .ev-autre { border-left-color: var(--c-autre); }
.more { font-size: 11px; color: var(--muted); }
.agenda { display: flex; flex-direction: column; }
.ag-day { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 12px 0 4px; border-bottom: 1px solid var(--line); }
.ag-day.today { color: var(--gold); }
.ag-row { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; flex-wrap: wrap; border-bottom: 1px solid var(--line-soft); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c-autre); align-self: center; }
.dot.ev-fiscal { background: var(--c-fiscal); } .dot.ev-tva { background: var(--c-tva); } .dot.ev-gouvernance { background: var(--c-gouv); } .dot.ev-societe { background: var(--c-societe); }
.dot.ev-bail { background: var(--c-bail); } .dot.ev-travaux { background: var(--c-travaux); } .dot.ev-location { background: var(--c-location); }
.cal-list-mobile { display: none; }
@media (max-width: 760px) { .cal { display: none; } .cal-list-mobile { display: block; } }

/* ---------- Pilotage de l'actif (V1.5) ---------- */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 8px 12px; text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a.on { color: var(--navy); border-bottom-color: var(--gold); }
.subnav .sp { flex: 1; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .tick { font: 11px Inter, sans-serif; fill: var(--muted); }
.legend-row { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend-row i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
table.proj td, table.proj th { white-space: nowrap; }
table.proj tr.strong td { font-weight: 600; background: var(--surface-2); }
td.neg { color: var(--err); }
table.sens td.base { outline: 2px solid var(--gold); outline-offset: -2px; font-weight: 600; }
small.up { color: var(--ok); }
small.down { color: var(--err); }
.legend-row i.sw-noi { background: #3d62b0; }
.legend-row i.sw-cf { background: #a8823a; }

/* ---------- Site internet ---------- */
.small-strong { font-size: 15px !important; }
.theme-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.colors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 6px 0 14px; }
.colors input[type=color] { height: 44px; padding: 3px; cursor: pointer; }
.swatch { width: 100%; max-width: 420px; height: auto; border: 1px solid var(--line); border-radius: 8px; display: block; }
.checks.contrast { margin-top: 12px; }
.checks.contrast li { grid-template-columns: 22px 190px minmax(0, 1fr); }
.code-block { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font: 12.5px/1.6 ui-monospace, Menlo, Consolas, monospace; }
.sections { list-style: none; margin: 0 0 14px; padding: 0; counter-reset: sec; }
.sections li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; counter-increment: sec; }
.sections li::before { content: counter(sec); font-weight: 600; color: var(--muted); width: 22px; }
.sections li.is-hidden .sec-main { opacity: .55; }
.sec-main { flex: 1 1 320px; min-width: 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.sec-type { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--gold); font-weight: 600; min-width: 150px; }
.sec-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.i18n-head, .i18n-row { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.i18n-head { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin: 6px 0 4px; }
.i18n-row { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.i18n-row.single > div { grid-column: 2 / 4; }
.i18n-label { font-size: 12.5px; font-weight: 600; color: var(--navy); padding-top: 8px; }
textarea.md { font: 13.5px/1.55 ui-monospace, Menlo, Consolas, monospace; }
.media-pick { display: flex; gap: 10px; align-items: center; }
.thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 6px; }
.media-cell { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; font-size: 11.5px; cursor: pointer; }
.media-cell.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.media-cell img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; display: block; }
.media-cell input { padding: 3px 6px; font-size: 12px; }
.media-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 14px; }
.media-item { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px; }
.media-item img { width: 110px; height: 82px; object-fit: cover; border-radius: 4px; display: block; }
.media-meta { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.media-meta input { padding: 5px 8px; font-size: 13px; }
details.help { margin: 14px 0; }
details.help summary { cursor: pointer; font-weight: 600; color: var(--navy); font-size: 13px; }
@media (max-width: 860px) {
  .theme-grid { grid-template-columns: minmax(0, 1fr); }
  .colors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .i18n-head { display: none; }
  .i18n-row { grid-template-columns: minmax(0, 1fr); }
  .i18n-row.single > div { grid-column: auto; }
}

/* ---------- Impression ---------- */
@media print {
  .side, .topbar, .no-print, .env-essai, .flash, .side-backdrop { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #111; }
  .main { padding: 0; max-width: none; }
  .doc-layout { display: block; }
  .doc-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 11.5pt; }
  .doc-var, .doc-missing { background: none; }
  hr.page-break { border: 0; page-break-after: always; margin: 0; }
}

/* ---------- Graphiques du tableau de bord (SVG, sans script) ---------- */
.chart-card { margin-bottom: 14px; }
.chart { display: block; width: 100%; height: auto; max-height: 260px; overflow: visible; }
.chart.timeline { max-height: none; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .base { stroke: var(--line); stroke-width: 1.2; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .axis.strong { fill: var(--ink); font-weight: 600; }
.chart .bar-s1 { fill: var(--navy-3, #9fb3dc); }
.chart .bar-s2 { fill: var(--gold); }
.chart rect:hover { opacity: .8; }
.chart .tick-ev { stroke: var(--line); stroke-width: 1; }
.chart .ev { stroke: var(--surface); stroke-width: 1.5; cursor: pointer; }
.chart a:hover .ev { r: 7.5; }
.ev-fiscal { fill: var(--c-fiscal); } .ev-tva { fill: var(--c-tva); } .ev-gouvernance { fill: var(--c-gouv); } .ev-societe { fill: var(--c-societe); }
.ev-bail { fill: var(--c-bail); } .ev-travaux { fill: var(--c-travaux); } .ev-location { fill: var(--c-location); } .ev-autre { fill: var(--c-autre); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.sw-s1 { background: var(--navy-3, #9fb3dc); } .sw-s2 { background: var(--gold); }
.sw-ev-fiscal { background: var(--c-fiscal); } .sw-ev-tva { background: var(--c-tva); } .sw-ev-gouvernance { background: var(--c-gouv); } .sw-ev-societe { background: var(--c-societe); }
.sw-ev-bail { background: var(--c-bail); } .sw-ev-travaux { background: var(--c-travaux); } .sw-ev-location { background: var(--c-location); } .sw-ev-autre { background: var(--c-autre); }
.sw-st-loue { background: var(--ok-bg); border: 1px solid var(--ok); } .sw-st-exploitation_directe { background: var(--warn-bg); border: 1px solid var(--gold); }
.sw-st-vacant { background: var(--err-bg); border: 1px dashed var(--err); } .sw-st-travaux { background: var(--chip-bg); border: 1px solid var(--muted); }

/* Coupe de l'immeuble */
.building { max-width: 760px; margin: 6px auto 0; }
.building .roof { height: 22px; margin: 0 70px 0 110px; background: linear-gradient(to top right, transparent 49%, var(--line) 50%, transparent 51%) left / 50% 100% no-repeat,
  linear-gradient(to top left, transparent 49%, var(--line) 50%, transparent 51%) right / 50% 100% no-repeat; }
.building .ground { height: 6px; margin-left: 96px; border-radius: 2px; background: var(--navy); opacity: .85; }
.floor-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: stretch; }
.floor-name { font-size: 12px; font-weight: 600; color: var(--navy); align-self: center; padding-right: 10px; text-align: right; }
.floor-lots { display: flex; gap: 6px; padding: 5px 8px; border-left: 3px solid var(--navy); border-right: 3px solid var(--navy); border-top: 1px solid var(--line); background: var(--surface); }
.lot-box { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 7px 9px; border-radius: 6px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); }
.lot-box:hover { box-shadow: var(--shadow); }
.lot-box b { font-size: 12.5px; color: var(--navy); }
.lot-box span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lot-box em { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lot-box.st-loue { background: var(--ok-bg); border-color: var(--ok); }
.lot-box.st-exploitation_directe { background: var(--warn-bg); border-color: var(--gold); }
.lot-box.st-vacant { background: var(--err-bg); border: 1px dashed var(--err); }
.lot-box.st-travaux { background: var(--chip-bg); border-color: var(--muted); }
.month-table th, .month-table td { font-size: 11.5px; padding: 4px 5px; }
@media (max-width: 640px) {
  .floor-row { grid-template-columns: 54px minmax(0, 1fr); }
  .building .ground { margin-left: 54px; } .building .roof { margin-left: 70px; margin-right: 20px; }
  .floor-lots { flex-wrap: wrap; } .lot-box { flex-basis: 45%; }
}
.building-name { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 14px 0 0; text-align: center; }
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) { .chart-scroll .chart { min-width: 600px; } }

/* ---------- Lecture IA ---------- */
.ai-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.ai-doc { position: sticky; top: 12px; }
.pdf-frame.tall { height: calc(100vh - 140px); min-height: 520px; }
.ai-form h3 { margin: 22px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.ai-form .ai-type { margin-bottom: 4px; max-width: 360px; }
.ai-dl input[type=text] { width: 100%; }
.ai-dl td { vertical-align: middle; }
.field.check { display: flex; align-items: center; gap: 8px; flex-direction: row; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a { padding: 5px 10px; border-radius: 6px; font-size: 13px; text-decoration: none; color: var(--muted); }
.tabs a.on { background: var(--chip-bg); color: var(--ink); font-weight: 600; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; overflow-x: auto; font-size: 13px; }
@media (max-width: 1100px) { .ai-split { grid-template-columns: minmax(0, 1fr); } .ai-doc { position: static; } .pdf-frame.tall { height: 70vh; } }
