
  :root {
    --bg: #f6f5f1; --card: #fff; --ink: #1f2a37; --muted: #6b7280; --line: #e5e2d9;
    --accent: #2f6f5e; --accent-soft: #e3f0ec; --warn: #b45309; --warn-soft: #fef3c7;
    --ok: #166534; --ok-soft: #dcfce7; --danger: #b91c1c; --danger-soft: #fee2e2;
    --side: #23352f; --head: #faf9f6; --field: #fff; --tagoff: #eee; --tagoff-ink: #555;
  }
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#151a18; --card:#1e2522; --ink:#e7ece9; --muted:#9aa6a0; --line:#2f3a35; --accent:#4fa58c; --accent-soft:#1d332c; --warn:#f5b454; --warn-soft:#3a2d12; --ok:#6ee7a0; --ok-soft:#14301f; --side:#0f1513; --head:#222a26; --field:#252d29; --tagoff:#2f3a35; --tagoff-ink:#b4beb8; color-scheme: dark } }
  :root[data-theme="dark"] { --bg:#151a18; --card:#1e2522; --ink:#e7ece9; --muted:#9aa6a0; --line:#2f3a35; --accent:#4fa58c; --accent-soft:#1d332c; --warn:#f5b454; --warn-soft:#3a2d12; --ok:#6ee7a0; --ok-soft:#14301f; --side:#0f1513; --head:#222a26; --field:#252d29; --tagoff:#2f3a35; --tagoff-ink:#b4beb8; color-scheme: dark }
  * { box-sizing: border-box; }
  body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
  .app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
  aside { background: var(--side); color: #e8efec; padding: 24px 16px; position: sticky; top: 0; height: 100vh; }
  aside h1 { font-size: 17px; margin: 0 0 28px 8px; letter-spacing: .2px; }
  aside h1 small { display: block; font-weight: 400; opacity: .6; font-size: 12px; }
  nav button { display: flex; gap: 10px; align-items: center; width: 100%; background: none; border: 0; color: inherit; font: inherit;
    padding: 11px 12px; border-radius: 8px; cursor: pointer; text-align: left; margin-bottom: 2px; }
  nav button:hover { background: rgba(255,255,255,.08); }
  nav button.on { background: rgba(255,255,255,.16); font-weight: 600; }
  .user { position: absolute; bottom: 20px; left: 24px; font-size: 13px; opacity: .65; }
  main { padding: 32px 40px 60px; max-width: 1100px; }
  h2 { margin: 0 0 4px; font-size: 26px; }
  .sub { color: var(--muted); margin: 0 0 24px; }
  .bar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
  .btn { background: var(--accent); color: #fff; border: 0; padding: 10px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
  .btn:hover { filter: brightness(1.1); }
  .btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
  .btn.sm { padding: 6px 11px; font-size: 14px; }
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 28px; }
  .stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
  .stat b { display: block; font-size: 28px; }
  .stat span { color: var(--muted); font-size: 14px; }
  .panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 24px; }
  .panel > h3 { margin: 0; padding: 14px 18px; font-size: 16px; border-bottom: 1px solid var(--line); }
  table { width: 100%; border-collapse: collapse; }
  th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
  th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: var(--head); }
  tr:last-child td { border-bottom: 0; }
  tbody tr:hover { background: var(--head); }
  .tag { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; }
  .tag.ok { background: var(--ok-soft); color: var(--ok); }
  .tag.warn { background: var(--warn-soft); color: var(--warn); }
  .tag.off { background: var(--tagoff); color: var(--tagoff-ink); }
  .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
  .bien { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
  .bien h4 { margin: 0 0 2px; font-size: 17px; }
  .bien p { margin: 2px 0; color: var(--muted); font-size: 14px; }
  .bien .row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
  .modal-bg { position: fixed; inset: 0; background: rgba(8,12,10,.6); display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; z-index: 10; }
  .modal-bg.open { display: flex; }
  .modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 640px; padding: 26px; }
  .modal h3 { margin: 0 0 16px; font-size: 20px; }
  .form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .form label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; }
  .form label.full { grid-column: 1 / -1; }
  input, select { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--field); }
  .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
  /* Quittance */
  .paper { color: #1f2a37; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 14px rgba(0,0,0,.06); padding: 48px 56px; max-width: 720px; font-family: Georgia, "Times New Roman", serif; }
  .paper h1 { text-align: center; font-size: 22px; letter-spacing: 1px; text-transform: uppercase; margin: 0 0 4px; }
  .paper .per { text-align: center; margin-bottom: 30px; color: #444; }
  .paper .parties { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 28px; font-size: 15px; }
  .paper table { margin: 20px 0; }
  .paper td { padding: 8px 4px; border-bottom: 1px solid #ddd; font-size: 15px; }
  .paper td:last-child { text-align: right; }
  .paper tr.tot td { font-weight: bold; border-top: 2px solid #222; border-bottom: 0; }
  .paper .sign { margin-top: 36px; text-align: right; font-size: 15px; }
  .paper .sign i { display: block; margin: 36px 0 0 auto; width: 180px; border-top: 1px solid #999; padding-top: 4px; font-size: 12px; color: #777; }
  .hint { background: var(--accent-soft); border-radius: 10px; padding: 12px 16px; color: var(--ink); font-size: 14px; margin-bottom: 20px; }
  .tabs-note { font-size: 13px; color: var(--muted); }
  @media (max-width: 800px) {
    .app { grid-template-columns: 1fr; }
    aside { position: static; height: auto; padding: 14px; }
    aside h1 { margin-bottom: 10px; }
    nav { display: flex; overflow-x: auto; gap: 4px; }
    nav button { width: auto; white-space: nowrap; }
    .user { display: none; }
    main { padding: 20px 16px 50px; }
    .form { grid-template-columns: 1fr; }
    .paper { padding: 28px 20px; }
    .paper .parties { flex-direction: column; }
    table { display: block; overflow-x: auto; }
  }

/* --- ajouts version PHP --- */
nav a { display:block; padding:11px 12px; border-radius:8px; color:inherit; text-decoration:none; margin-bottom:2px; }
nav a:hover { background: rgba(255,255,255,.08); }
nav a.on { background: rgba(255,255,255,.16); font-weight:600; }
a { color: var(--accent); }
a.btn { display:inline-block; text-decoration:none; }
.btn.danger { color: var(--danger); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
form.inline { display:inline; }
td.r { text-align:right; white-space:nowrap; }
.logout { position:absolute; bottom:20px; left:16px; }
.logout button { background:none; border:0; color:inherit; opacity:.65; cursor:pointer; font:inherit; font-size:13px; }
.logout button:hover { opacity:1; text-decoration:underline; }
.scroll { overflow-x:auto; }
.stat b.warn { color: var(--warn); }
.empty { padding: 20px 18px; color: var(--muted); margin:0; }
.panel.pad { padding: 22px; }
.panel h3.full, .form h3.full { grid-column:1/-1; }
.form .full { grid-column: 1 / -1; }
.flash { padding: 12px 16px; border-radius:10px; margin-bottom:18px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--danger-soft); color: var(--danger); }
.app.solo { display:block; }
.auth { max-width: 420px; margin: 8vh auto 0; padding: 26px; }
.payform { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.payform input, .payform select { padding:6px 8px; }
.hint select { margin-left: 8px; }
.toolbar { display:flex; justify-content:space-between; max-width:720px; margin: 24px auto 16px; padding: 0 16px; }
body.print-page { background: var(--bg); }
.paper h1 { color:#1f2a37; }
.modal-bg { display:none; }
@media print {
  .noprint { display:none !important; }
  body.print-page { background:#fff; }
  .paper { border:0; box-shadow:none; max-width:none; padding:0; }
}
.checks { display:flex; flex-direction:column; gap:6px; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background: var(--field); }
label.check { flex-direction:row; align-items:center; gap:8px; font-size:15px; color: var(--ink); }
label.check input { width:auto; }
.irl-bg { position:fixed; inset:0; background: rgba(8,12,10,.72); display:flex; align-items:center; justify-content:center; padding:16px; z-index:50; overflow:auto; }
.irl-modal { background: var(--card); color: var(--ink); border-radius:16px; width:100%; max-width:640px; padding:36px; box-shadow:0 20px 60px rgba(0,0,0,.4); }
.irl-modal h2 { font-size:28px; margin:0 0 12px; }
.irl-modal p { margin:0 0 22px; color: var(--muted); }
.irl-champ { display:flex; flex-direction:column; gap:6px; margin-bottom:16px; font-size:17px; }
.irl-champ input { font-size:22px; padding:12px 14px; }
.muted { color: var(--muted); }
span.check { display:flex; align-items:center; gap:8px; color: var(--ink); font-size:15px; }
span.check input { width:auto; }
.owner-row { display:flex; gap:12px; align-items:center; justify-content:space-between; }
.owner-row .check { flex:1; }
.owner-row input[type=number] { width: 9.5em; }
.paper .adr { color:#444; }
