/* Compta SCI — thème clair uniquement. Registre de comptes : papier chaud, encre sombre, vert bouteille pour l'immobilier.
   Polices système (aucun CDN). Chiffres en tabulaires partout. */
:root{
  --bg:#f4f2ee; --surface:#ffffff; --sunken:#ece9e2; --ink:#1d2321; --muted:#626a66; --line:#dcd8cf; --line-soft:#e9e6df;
  --accent:#1f5f4a; --accent-ink:#ffffff; --accent-soft:#e1ede7;
  --pos:#1d7a4e; --neg:#b3412c; --pos-soft:#e0f0e6; --neg-soft:#f8e4de; --warn:#8a6100; --warn-soft:#f7edd3;
  --c1:#1f5f4a; --c2:#2f6fb0; --c3:#c06a2b; --c4:#7d55b8; --c5:#a08410;
  --f-display:ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --f-body:system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-num:ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --r:10px; color-scheme:light;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--f-body);font-size:15px;line-height:1.45;
  padding:calc(18px + env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) calc(48px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))}
.wrap{max-width:1180px;margin:0 auto;display:flex;flex-direction:column;gap:20px}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.num{font-family:var(--f-num);font-variant-numeric:tabular-nums;white-space:nowrap}
.muted{color:var(--muted)} .pos{color:var(--pos)} .neg{color:var(--neg)}
.eyebrow{font-size:11.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600}
h1,h2,h3{font-family:var(--f-display);font-weight:600;margin:0;letter-spacing:-.01em}
h1{font-size:26px} h2{font-size:20px} h3{font-size:16px}
p{margin:0}
svg.ic{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* en-tête + navigation */
.top{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px}
.brand{display:flex;align-items:center;gap:12px}
.brand img{width:38px;height:38px;border-radius:9px}
.status{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted)}
.dot{width:8px;height:8px;border-radius:50%;background:var(--pos)}
.dot.pending{background:var(--warn)} .dot.saving{background:var(--c2)} .dot.error{background:var(--neg)}
nav.tabs{display:flex;gap:4px;overflow-x:auto;scrollbar-width:none;border-bottom:1px solid var(--line);margin:0 -4px;padding:0 4px}
nav.tabs::-webkit-scrollbar{display:none}
nav.tabs button{border:0;background:none;padding:10px 12px;border-bottom:2px solid transparent;color:var(--muted);font-weight:600;font-size:14px;white-space:nowrap;display:flex;align-items:center;gap:6px}
nav.tabs button[aria-current="page"]{color:var(--ink);border-bottom-color:var(--accent)}

/* briques */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:18px}
.card.flush{padding:0;overflow:hidden}
.card-h{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:12px}
.grid{display:grid;gap:14px}
.g2{grid-template-columns:repeat(auto-fit,minmax(320px,1fr))}
.g3{grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}
.kpi{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:14px 16px;display:flex;flex-direction:column;gap:4px}
.kpi .v{font-family:var(--f-num);font-size:22px;font-weight:600;font-variant-numeric:tabular-nums;letter-spacing:-.02em}
.kpi .s{font-size:12.5px;color:var(--muted)}
.kpi.hero{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.kpi.hero .eyebrow,.kpi.hero .s{color:#cfe3da}
.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.spacer{flex:1}
.stack{display:flex;flex-direction:column;gap:8px}

.btn{border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:8px 12px;font-weight:600;font-size:14px;display:inline-flex;align-items:center;gap:6px;line-height:1.2}
.btn:hover{background:var(--sunken)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.btn.primary:hover{filter:brightness(1.08)}
.btn.ghost{border-color:transparent;background:none}
.btn.danger{color:var(--neg)}
.btn.sm{padding:5px 9px;font-size:13px}
.btn:disabled{opacity:.5;cursor:default}
.iconbtn{border:1px solid var(--line);background:var(--surface);border-radius:8px;width:34px;height:34px;display:inline-grid;place-items:center}
.pill{display:inline-flex;align-items:center;gap:4px;border-radius:99px;padding:2px 9px;font-size:12px;font-weight:600;background:var(--sunken);color:var(--muted);white-space:nowrap;border:0}
.pill.ok{background:var(--pos-soft);color:var(--pos)} .pill.bad{background:var(--neg-soft);color:var(--neg)} .pill.warn{background:var(--warn-soft);color:var(--warn)}
.pill.prevu{background:var(--warn-soft);color:var(--warn)}
button.pill{cursor:pointer}

input[type=text],input[type=number],input[type=date],input[type=month],input[type=search],select,textarea{
  border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:8px 10px;min-height:38px;width:100%}
input[type=number]{font-family:var(--f-num)}
label.f{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var(--muted);font-weight:600}
label.f > *{color:var(--ink);font-weight:400}
.form{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}
.form .wide{grid-column:1/-1}
.check{display:flex;align-items:center;gap:8px;font-size:14px}
.filters{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px}

/* tableaux */
.tbl-wrap{overflow-x:auto}
table{border-collapse:collapse;width:100%;font-size:13.5px}
th,td{padding:7px 10px;border-bottom:1px solid var(--line-soft);text-align:left;vertical-align:middle}
th{font-size:11.5px;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);font-weight:600;background:var(--surface);position:sticky;top:0}
td.n,th.n{text-align:right}
tr.grp td{background:var(--sunken);font-weight:700;font-size:12.5px;letter-spacing:.02em}
tr.cat td{font-weight:600}
tr.line td:first-child{padding-left:26px;color:var(--muted)}
tr.tot td{font-weight:700;border-top:2px solid var(--line);background:#faf9f6}
tr.solde td{font-weight:700;background:var(--accent-soft)}
td.zero{color:#b9b5ac}
.matrix td:first-child,.matrix th:first-child{position:sticky;left:0;background:inherit;z-index:1;min-width:210px;max-width:260px}
.matrix tr td:first-child{background:var(--surface)} .matrix tr.grp td:first-child{background:var(--sunken)} .matrix tr.tot td:first-child{background:#faf9f6} .matrix tr.solde td:first-child{background:var(--accent-soft)}
.matrix th:first-child{z-index:2}

/* journal */
.ledger{display:flex;flex-direction:column}
.op{display:grid;grid-template-columns:56px 1fr auto auto;gap:10px;align-items:center;padding:10px 14px;border-bottom:1px solid var(--line-soft);background:var(--surface);cursor:pointer}
.op:hover{background:#faf9f6}
.op .d{font-family:var(--f-num);font-size:12.5px;color:var(--muted)}
.op .t{min-width:0}
.op .t b{font-weight:600;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.op .t small{color:var(--muted);font-size:12.5px;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.op .a{font-family:var(--f-num);font-weight:600;font-variant-numeric:tabular-nums;text-align:right}
.op.is-prevu{background:repeating-linear-gradient(135deg,#fff,#fff 8px,#fbf8f0 8px,#fbf8f0 16px)}
.sum-strip{display:grid;grid-template-columns:repeat(4,1fr);gap:1px;background:var(--line);border-bottom:1px solid var(--line)}
.sum-strip > div{background:var(--surface);padding:10px 14px;display:flex;flex-direction:column;gap:2px}
.sum-strip .v{font-family:var(--f-num);font-weight:600}
.monthnav{display:flex;align-items:center;gap:8px}
.monthnav .lbl{font-family:var(--f-display);font-size:19px;font-weight:600;min-width:150px;text-align:center;text-transform:capitalize}
.empty{padding:28px;text-align:center;color:var(--muted)}
.callout{border:1px solid var(--warn-soft);background:#fdf8ec;border-radius:var(--r);padding:12px 14px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.callout.info{background:var(--accent-soft);border-color:#cfe1d8}

/* biens */
.bien{display:flex;flex-direction:column;gap:12px}
.bien .head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.dl{display:grid;grid-template-columns:auto 1fr;gap:4px 14px;font-size:14px}
.dl dt{color:var(--muted)} .dl dd{margin:0;text-align:right;font-family:var(--f-num)}
.months{display:grid;grid-template-columns:repeat(12,1fr);gap:3px}
.months span{height:26px;border-radius:4px;background:var(--sunken);display:grid;place-items:center;font-size:10.5px;color:var(--muted);font-weight:600}
.months span.ok{background:var(--pos-soft);color:var(--pos)} .months span.miss{background:var(--neg-soft);color:var(--neg)}
.months span.part{background:var(--warn-soft);color:var(--warn)} .months span.fut{background:transparent;border:1px dashed var(--line)}

/* graphiques */
.chart svg{width:100%;height:auto;display:block}
.chart text{font-family:var(--f-body);font-size:11px;fill:var(--muted)}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:12.5px;color:var(--muted)}
.legend i{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:5px;vertical-align:-1px}
.bar{height:8px;border-radius:99px;background:var(--sunken);overflow:hidden}
.bar > i{display:block;height:100%;background:var(--accent)}

/* écran de connexion */
.gate{max-width:520px;margin:8vh auto 0;display:flex;flex-direction:column;gap:16px;text-align:left}
.gate .card{display:flex;flex-direction:column;gap:14px}

/* dialogue */
dialog{border:0;border-radius:14px;padding:0;width:min(640px,calc(100vw - 24px));max-height:calc(100vh - 40px);box-shadow:0 20px 60px rgba(20,24,22,.25);color:var(--ink)}
dialog::backdrop{background:rgba(29,35,33,.35)}
dialog .dh{display:flex;justify-content:space-between;align-items:center;padding:16px 18px;border-bottom:1px solid var(--line)}
dialog .db{padding:18px;overflow:auto;max-height:calc(100vh - 180px)}
dialog .df{display:flex;gap:8px;justify-content:flex-end;padding:12px 18px;border-top:1px solid var(--line);background:#faf9f6;flex-wrap:wrap}
dialog .df .left{margin-right:auto}
#toast{position:fixed;left:50%;bottom:calc(22px + env(safe-area-inset-bottom,0px));transform:translateX(-50%) translateY(30px);opacity:0;background:var(--ink);color:#fff;padding:10px 16px;border-radius:10px;font-size:14px;transition:.2s;pointer-events:none;z-index:50;max-width:90vw}
#toast.show{opacity:1;transform:translateX(-50%)}
#toast.err{background:var(--neg)}

@media (max-width:640px){
  h1{font-size:22px}
  .op{grid-template-columns:42px 1fr auto;padding:10px;row-gap:4px}
  .op .d{grid-column:1;grid-row:1/3}
  .op .t{grid-column:2;grid-row:1}
  .op .a{grid-column:3;grid-row:1}
  .op .s{grid-column:2/4;grid-row:2;justify-self:start}
  .sum-strip{grid-template-columns:repeat(2,1fr)}
  .card{padding:14px}
  .kpi .v{font-size:19px}
}
@media print{nav.tabs,.status,.btn,.iconbtn{display:none!important} body{background:#fff}}
