/* Gestion locative — direction « registre » : papier froid, encre, chiffres alignés */
:root {
  --bg: #eef1ec; --surface: #fbfcfa; --text: #17201c; --muted: #5b6861;
  --primary: #1e5a4c; --primary-text: #fbfcfa; --border: #cfd7d0; --rule: #17201c;
  --ok: #1d6b3a; --warn: #7d5300; --danger: #a4262c; --radius: 4px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412; --surface: #151d1a; --text: #e4ebe6; --muted: #98a59d; --primary: #6fb8a3;
    --primary-text: #0e1412; --border: #2a3731; --rule: #e4ebe6; --ok: #5cc27f; --warn: #d9a441; --danger: #ff8a80;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412; --surface: #151d1a; --text: #e4ebe6; --muted: #98a59d; --primary: #6fb8a3;
  --primary-text: #0e1412; --border: #2a3731; --rule: #e4ebe6; --ok: #5cc27f; --warn: #d9a441; --danger: #ff8a80;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.55;
  font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}
header.top {
  position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--rule);
  padding: 14px 20px; padding-top: calc(14px + env(safe-area-inset-top));
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
header.top h1 { font-family: "Newsreader", Georgia, serif; font-size: 1.5rem; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
nav.main {
  display: flex; gap: 22px; overflow-x: auto; padding: 0 20px; background: var(--bg);
  border-bottom: 1px solid var(--border); scrollbar-width: none;
}
nav.main::-webkit-scrollbar { display: none; }
nav.main a {
  flex: 0 0 auto; color: var(--muted); text-decoration: none; padding: 12px 0 10px;
  border-bottom: 2px solid transparent; font-size: .95rem; white-space: nowrap;
  min-height: 44px; display: inline-flex; align-items: center;
}
nav.main a:hover { color: var(--text); }
nav.main a.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
main { padding: 28px 20px 56px; max-width: 1100px; margin: 0 auto; }
h2 { font-family: "Newsreader", Georgia, serif; font-size: 2rem; font-weight: 500; line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 20px; }
h3 { font-family: "Newsreader", Georgia, serif; font-size: 1.2rem; font-weight: 500; margin: 28px 0 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; box-shadow: none; }
.grid { display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border-top: 1px solid var(--rule); margin-bottom: 20px; }
.kpi { padding: 14px 16px 14px 0; border-bottom: 1px solid var(--border); }
.kpi .valeur { font-family: "Newsreader", Georgia, serif; font-size: 2rem; font-weight: 500; line-height: 1.1; }
.kpi .label { color: var(--muted); font-size: .88rem; }
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius); font: inherit; font-size: .98rem; cursor: pointer; min-height: 44px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { border-color: var(--text); }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 10px; font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
form .champ { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
form label { font-weight: 600; font-size: .92rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; min-height: 44px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
textarea { min-height: 80px; }
.form-grid { display: grid; gap: 0 20px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .plein { grid-column: 1 / -1; } }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; min-height: auto; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px 11px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; border-bottom: 1px solid var(--rule); }
@media (max-width: 640px) {
  main { padding: 20px 16px 40px; }
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; padding: 8px 12px; background: var(--surface); }
  table.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 0; }
  table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
}
.badge { display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: .8rem; border: 1px solid var(--border); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.danger { color: var(--danger); border-color: var(--danger); }
.alerte { border-left: 3px solid var(--warn); padding: 10px 14px; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 8px; }
.alerte.urgent { border-left-color: var(--danger); }
.frise { position: relative; padding-left: 18px; border-left: 1px solid var(--rule); margin: 8px 0; }
.frise li { list-style: none; margin: 0 0 14px -1px; position: relative; padding-left: 8px; }
.frise li::before { content: ""; position: absolute; left: -23px; top: 7px; width: 9px; height: 9px; border-radius: 0; background: var(--primary); }
ul.plain { list-style: none; padding: 0; margin: 0; }
.msg { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px; border-left: 3px solid currentColor; }
.msg.erreur { background: color-mix(in srgb, var(--danger) 9%, transparent); color: var(--danger); }
.msg.succes { background: color-mix(in srgb, var(--ok) 9%, transparent); color: var(--ok); }
.muted { color: var(--muted); font-size: .92rem; }
.equip { display: grid; gap: 4px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .equip { grid-template-columns: 1fr 1fr; } }
.comparatif td, .comparatif th { font-size: .92rem; }
.vide { color: var(--muted); padding: 28px 0; }
.header-actions { display: flex; gap: 8px; align-items: center; }
@media (prefers-reduced-motion: no-preference) {
  nav.main a, .btn { transition: color .15s, border-color .15s; }
}
@media print { header.top, nav.main, .no-print { display: none !important; } body { background: #fff; color: #000; } .card { border-color: #ccc; } }

/* Ajustements selon le balisage réel de app.js */
.grid .card.kpi { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; margin: 0; padding: 14px 16px 14px 0; }
.card.vide { background: transparent; border: 0; box-shadow: none; text-align: center; color: var(--muted); padding: 28px 0; }
.card > h3:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.card.table-wrap { padding: 8px 20px 12px; }
.card.no-print { border-style: dashed; }
table.comparatif th, table.comparatif td { font-size: .9rem; }

/* Écran de connexion : logo et formulaire uniquement */
body.locked header.top, body.locked nav.main { display: none; }
.connexion { max-width: 380px; margin: 10vh auto 0; padding: 0 4px; }
.connexion img { display: block; margin: 0 auto 14px; border-radius: 14px; }
.connexion h1 { font-family: "Newsreader", Georgia, serif; font-weight: 500; font-size: 1.6rem; text-align: center; margin: 0 0 24px; }
.connexion .btn.plein { width: 100%; margin-top: 4px; }
.ruche { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
