/* E2C Entreprises : charte graphique tirée du logo */
:root {
  --navy: #263647;
  --navy-2: #1C2936;
  --navy-3: #324559;
  --green: #4CC07B;
  --green-d: #36A465;
  --green-l: #E6F6EC;
  --gray: #758791;
  --gray-l: #AFC0CA;
  --bg: #F3F5F8;
  --card: #FFFFFF;
  --line: #E1E6EB;
  --line-2: #EEF1F4;
  --text: #1E2B38;
  --muted: #6B7C87;
  --neg: #D9534F;
  --neg-l: #FBEBEA;
  --warn: #D9902B;
  --warn-l: #FCF2E3;
  --info: #3D7CC9;
  --info-l: #E8F0FA;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28, 41, 54, .05), 0 2px 8px rgba(28, 41, 54, .04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-title: 'Montserrat', 'Inter', -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green-d); cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-title); color: var(--navy); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money { text-align: right; }
.pos { color: var(--green-d); }
.neg { color: var(--neg); }
[hidden] { display: none !important; }

/* ---------- Structure ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; height: 100vh; }
.side { background: var(--navy); color: #fff; display: flex; flex-direction: column; overflow-y: auto; }
.side .drag { height: 30px; -webkit-app-region: drag; flex: none; }
.side .brand { padding: 4px 22px 18px; }
.side .brand img { width: 150px; display: block; }
.side .brand .tag { font-size: 11px; color: var(--gray-l); margin-top: 6px; letter-spacing: .02em; }
.ctx { margin: 0 14px 14px; background: var(--navy-2); border-radius: 10px; padding: 10px 12px; }
.ctx label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-l); margin: 6px 0 3px; }
.ctx label:first-child { margin-top: 0; }
.ctx select { width: 100%; background: var(--navy-3); color: #fff; border: 1px solid #415569; border-radius: 7px; padding: 6px 8px; font-size: 13px; }
.nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-l); padding: 14px 12px 6px; }
.nav button { all: unset; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: #D5DEE4; cursor: pointer; font-weight: 500; font-size: 13.5px; }
.nav button svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav button.on { background: rgba(76, 192, 123, .16); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.nav button.on svg { color: var(--green); opacity: 1; }
.nav .badge { margin-left: auto; font-size: 10px; font-weight: 700; background: var(--green); color: var(--navy); padding: 2px 6px; border-radius: 20px; letter-spacing: .03em; }
.side .foot { margin-top: auto; padding: 14px 22px 18px; font-size: 11px; color: var(--gray-l); border-top: 1px solid rgba(255, 255, 255, .06); }
.side .foot .saved { display: flex; align-items: center; gap: 6px; }
.side .foot .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.side .foot .dot.busy { background: var(--warn); }

.main { overflow-y: auto; position: relative; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(243, 245, 248, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 14px 32px 12px; display: flex; align-items: center; gap: 14px; -webkit-app-region: drag; min-height: 64px; }
.topbar > * { -webkit-app-region: no-drag; }
.topbar .crumbs { font-size: 12px; color: var(--muted); }
.topbar h1 { font-size: 21px; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.content { padding: 24px 32px 60px; max-width: 1400px; }

/* ---------- Éléments ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card > h3, .card > .head { margin-bottom: 12px; }
.card .head { display: flex; align-items: center; gap: 10px; }
.card .head .actions { margin-left: auto; display: flex; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mt { margin-top: 16px; }
.mt2 { margin-top: 24px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.sub { color: var(--muted); margin: 4px 0 18px; max-width: 820px; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 13px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--navy); white-space: nowrap; }
.btn:hover { border-color: var(--gray-l); background: #FAFBFC; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-d); border-color: var(--green-d); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { color: var(--neg); }
.btn.danger:hover { border-color: var(--neg); background: var(--neg-l); }
.btn.armed { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: .5; cursor: default; }

.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: var(--line-2); color: var(--navy); white-space: nowrap; }
.pill.pos { background: var(--green-l); color: var(--green-d); }
.pill.neg { background: var(--neg-l); color: var(--neg); }
.pill.warn { background: var(--warn-l); color: var(--warn); }
.pill.info { background: var(--info-l); color: var(--info); }
.pill.navy { background: var(--navy); color: #fff; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .k { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.kpi .v { font-family: var(--font-title); font-size: 20px; font-weight: 700; color: var(--navy); margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kpi.pos .v { color: var(--green-d); }
.kpi.neg .v { color: var(--neg); }
.kpi.accent { background: var(--navy); border-color: var(--navy); }
.kpi.accent .k, .kpi.accent .d { color: var(--gray-l); }
.kpi.accent .v { color: #fff; }

/* Lignes de résultats */
.rows .r { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.rows .r:last-child { border-bottom: 0; }
.rows .r > span:last-child { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.rows .r.tot { font-weight: 700; color: var(--navy); border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); margin-top: 2px; }
.rows .r small { color: var(--muted); }
.rows .r { align-items: center; }
.rows .r .pill { flex: none; align-self: center; }

/* Formulaires */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f.wide { grid-column: 1 / -1; }
.f > label { font-size: 12px; font-weight: 600; color: var(--navy); }
.f > label small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.in { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.in:focus-within, input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(76, 192, 123, .18); outline: none; }
.in input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 0; }
.in .u { padding: 0 9px; display: flex; align-items: center; background: var(--line-2); color: var(--muted); font-size: 12px; border-left: 1px solid var(--line); white-space: nowrap; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; font-size: 13.5px; min-width: 0; }
input[type=number] { font-variant-numeric: tabular-nums; text-align: right; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green); }
textarea { resize: vertical; min-height: 70px; }
.calcv { padding: 7px 10px; border-radius: 8px; background: var(--line-2); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; color: var(--navy); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 16px; margin: 0; background: #fff; }
legend { font-family: var(--font-title); font-weight: 700; color: var(--navy); padding: 0 6px; font-size: 13.5px; }

/* Tables */
.tablebox { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 9px 10px; background: #F8FAFB; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #FAFCFB; }
th.r, td.r { text-align: right; }
tr.total td { font-weight: 700; background: #F8FAFB; color: var(--navy); }
table.edit td { padding: 3px 4px; }
table.edit input, table.edit select { width: 100%; border-color: transparent; background: transparent; padding: 5px 6px; }
table.edit input:hover, table.edit select:hover { border-color: var(--line); }
table.edit tr.warn td { background: var(--warn-l); }
tr.clickable { cursor: pointer; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { min-width: 220px; }
.empty { padding: 36px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: #fff; }
.empty h3 { margin-bottom: 6px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { all: unset; cursor: pointer; padding: 9px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13.5px; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--green); }
.tabs button:hover { color: var(--navy); }

/* Cartes de biens */
.bien-card { cursor: pointer; transition: border-color .15s, transform .15s; }
.bien-card:hover { border-color: var(--green); }
.bien-card .top { display: flex; gap: 12px; align-items: flex-start; }
.bien-card .ico { width: 42px; height: 42px; border-radius: 10px; background: var(--green-l); display: grid; place-items: center; flex: none; }
.bien-card .ico svg { width: 22px; height: 22px; stroke: var(--green-d); fill: none; stroke-width: 1.8; }
.bien-card .mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 6px; }
.bien-card .mini .kpi { box-shadow: none; padding: 8px 10px; }
.bien-card .mini .kpi .v { font-size: 16px; }

/* Jauge */
.gauge { position: relative; height: 8px; background: var(--line-2); border-radius: 8px; margin-top: 8px; }
.gauge i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; }
.gauge b { position: absolute; left: 70%; top: -3px; bottom: -3px; width: 2px; background: var(--navy); }

/* Mise en page fiche bien */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.split > aside { display: flex; flex-direction: column; gap: 14px; }
.split > aside .card + .card, .stack > .card + .card, .stack > .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* Modale */
.modal-bg { position: fixed; inset: 0; background: rgba(28, 41, 54, .45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: min(640px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.lg { width: min(980px, 100%); }
.modal header { padding: 18px 22px 0; display: flex; align-items: center; gap: 10px; }
.modal header .x { margin-left: auto; }
.modal .body { padding: 16px 22px; overflow-y: auto; }
.modal footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* Toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 500; z-index: 200; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }

/* Bandeau premium */
.premium { background: linear-gradient(120deg, var(--navy) 0%, #2F4A5F 60%, #2E6B55 100%); color: #fff; border-radius: var(--radius); padding: 18px 22px; display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.premium h3 { color: #fff; }
.premium p { margin: 3px 0 0; color: #D5E3EA; }
.premium .crown { width: 44px; height: 44px; border-radius: 12px; background: rgba(76, 192, 123, .25); display: grid; place-items: center; flex: none; }
.premium .crown svg { width: 24px; height: 24px; stroke: var(--green); fill: none; stroke-width: 2; }

/* Fiches techniques */
.fiche-card { display: flex; flex-direction: column; gap: 8px; }
.fiche-card .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--info-l); display: grid; place-items: center; }
.fiche-card .ico svg { width: 22px; height: 22px; stroke: var(--info); fill: none; stroke-width: 1.8; }
.fiche-card.soon { opacity: .6; }
.guide { max-width: 860px; }
.guide h2 { margin: 22px 0 8px; }
.guide h3 { margin: 16px 0 6px; }
.guide p, .guide li { color: #34444F; }
.guide ul { padding-left: 20px; }
.guide .note { background: var(--info-l); border-left: 3px solid var(--info); padding: 10px 14px; border-radius: 6px; margin: 12px 0; }
.guide .alert { background: var(--warn-l); border-left: 3px solid var(--warn); padding: 10px 14px; border-radius: 6px; margin: 12px 0; }

/* EDL */
.piece { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; background: #fff; overflow: hidden; }
.piece > .ph { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #F8FAFB; border-bottom: 1px solid var(--line); }
.piece > .ph input { font-weight: 700; color: var(--navy); background: transparent; border-color: transparent; font-family: var(--font-title); }
.piece table td { padding: 4px 8px; }
.etat-sel { font-weight: 600; }
.etat-neuf { color: var(--info); }
.etat-bon { color: var(--green-d); }
.etat-usage { color: var(--warn); }
.etat-mauvais { color: var(--neg); }

details.acc { border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: 10px; }
details.acc > summary { padding: 12px 16px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-weight: 600; list-style: none; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
details.acc[open] > summary::before { transform: rotate(90deg); }
details.acc > .body { padding: 0 16px 14px; }

/* Calendrier des loyers */
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; }
.month { border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px; text-align: center; font-size: 11.5px; cursor: pointer; background: #fff; }
.month b { display: block; font-size: 12px; color: var(--navy); }
.month.paid { background: var(--green-l); border-color: #BFE6CD; }
.month.late { background: var(--neg-l); border-color: #F1C5C3; }
.month.part { background: var(--warn-l); border-color: #F0D7AF; }
.month.future { opacity: .55; }

/* Graphique simple */
.chart svg { width: 100%; height: auto; display: block; }
.chart .legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Écran d'accueil */
.welcome { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 30px; }
.welcome .box { background: #fff; border-radius: 18px; padding: 34px 36px; width: min(560px, 100%); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.welcome .box img { width: 220px; display: block; margin-bottom: 18px; }

/* ---------- Impression / PDF ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 11.5px; }
  .app { display: block; height: auto; }
  .side, .topbar, .no-print, .toast, .toolbar { display: none !important; }
  .main { overflow: visible; }
  .content { padding: 0; max-width: none; }
  .print-only { display: block; }
  .card, .kpi, fieldset, .piece { box-shadow: none; break-inside: avoid; }
  .tablebox { overflow: visible; border: 0; }
  th { position: static; }
  input, select, textarea { border: 0; padding: 0; background: transparent; appearance: none; -webkit-appearance: none; }
  table.edit input, table.edit select { padding: 2px 0; }
  .print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--green); padding-bottom: 10px; margin-bottom: 14px; }
  .print-head img { width: 150px; }
  .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
  .sign div { border: 1px solid #999; height: 90px; padding: 6px; font-size: 11px; }
}

/* Zone d'impression dédiée (récaps, quittances, fiches) */
#printarea { display: none; }
@media print {
  body.printing .app, body.printing .modal-bg { display: none !important; }
  body.printing #printarea { display: block; }
}
.doc { font-size: 12px; color: #1E2B38; }
.doc h1 { font-size: 20px; margin: 0 0 4px; }
.doc h2 { font-size: 14px; margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 1px solid #E1E6EB; }
.doc .dhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #4CC07B; padding-bottom: 12px; margin-bottom: 16px; }
.doc .dhead img { width: 150px; }
.doc .dhead .meta { text-align: right; font-size: 11px; color: #6B7C87; }
.doc table { font-size: 11px; }
.doc th { position: static; background: #F3F5F8; }
.doc td, .doc th { padding: 5px 7px; border-bottom: 1px solid #E1E6EB; }
.doc .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.doc .box { border: 1px solid #E1E6EB; border-radius: 8px; padding: 10px 12px; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; }
.doc .sign div { border: 1px solid #AFC0CA; border-radius: 6px; height: 95px; padding: 6px 8px; font-size: 11px; color: #6B7C87; }
.doc .foot { margin-top: 24px; font-size: 10px; color: #6B7C87; border-top: 1px solid #E1E6EB; padding-top: 8px; }
.doc .etat-neuf, .doc .etat-bon, .doc .etat-usage, .doc .etat-mauvais { font-weight: 600; }
.doc .pb { break-before: page; }
.doc tr, .doc .box { break-inside: avoid; }
.doc h2 { break-after: avoid; }

/* Écrans étroits (aperçu en ligne, fenêtre réduite) */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .main { min-width: 0; }
  .side { overflow: visible; }
  .side .drag { display: none; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .sec { display: none; }
  .side .foot { display: none; }
  .main { overflow: visible; }
  .topbar { position: static; padding: 12px 16px; flex-wrap: wrap; }
  .content { padding: 16px 16px 40px; }
  .split, .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr) !important; }
  .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .form.cols2 { grid-template-columns: minmax(0, 1fr); }
  .months { grid-template-columns: repeat(4, 1fr); }
}
.demo-note { background: var(--info-l); color: var(--navy); padding: 8px 32px; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.pdf-render { position: absolute; left: -12000px; top: 0; }
.pdf-page { width: 720px; background: #fff; }
.pdf-render .doc { font-size: 11px; }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13px; }
.notice.warn { background: var(--warn-l); border-left: 3px solid var(--warn); color: var(--navy); }
tr.cur td { background: #F1FAF4; }
.rows .r a, .rows .r small a { color: var(--green-d); cursor: pointer; text-decoration: underline; }
.modal-bg { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal footer { flex-wrap: wrap; }
@media (max-width: 860px) { .modal-bg { padding: 12px; } .modal .body, .modal footer { padding-left: 16px; padding-right: 16px; } .modal footer > * { flex: 1 1 auto; } }
.savebar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 200; background: var(--neg); color: #fff; border-radius: 10px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.savebar span { flex: 1 1 220px; }
@media (max-width: 860px) {
  details.acc > summary { flex-wrap: wrap; row-gap: 6px; }
  .topbar .actions { flex-wrap: wrap; margin-left: 0; }
  .topbar .actions select { max-width: 100% !important; }
}

/* ---------- Formules d'abonnement ---------- */
.planbox { margin-top: 10px; background: var(--navy-2); border-radius: 9px; padding: 9px 11px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: #D5DEE4; }
.planbox b { color: #fff; }
.planbox a { color: var(--green); font-weight: 600; text-decoration: none; white-space: nowrap; }
.nav .badge.lock { background: transparent; border: 1px solid #5B6E80; color: #AFC0CA; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 16px; }
.plan { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 20px 18px; display: flex; flex-direction: column; background: #fff; }
.plan.best { border: 2px solid var(--green); box-shadow: 0 14px 34px rgba(76, 192, 123, .15); }
.plan.cur { background: var(--green-l); }
.plan .ribbon { position: absolute; top: -11px; left: 18px; background: var(--green); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.plan .price b { font-family: var(--font-title); font-size: 26px; color: var(--navy); }
.plan .price span { color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 10px 0 16px; display: grid; gap: 6px; font-size: 13px; flex: 1; }
.plan li.off { color: #AFC0CA; }
.plan .btn { justify-content: center; }
.plans.compact .plan { padding: 16px; }
.paywall { max-width: 980px; margin: 0 auto; padding: 28px; }
.paywall h2 { font-size: 22px; margin: 10px 0 6px; }
.checks { list-style: none; padding: 0; display: grid; gap: 8px; margin: 14px 0; }
.checks li { display: flex; gap: 8px; align-items: flex-start; }
.checks svg { width: 18px; height: 18px; stroke: var(--green-d); fill: none; stroke-width: 2.4; flex: none; margin-top: 2px; }
ol.steps { padding-left: 20px; margin: 6px 0 0; display: grid; gap: 9px; font-size: 13px; }
ol.steps li::marker { color: var(--green-d); font-weight: 700; }
tr.group td { background: var(--bg); font-size: 12.5px; padding-top: 8px; padding-bottom: 8px; }
.doc .pdf-forms .box { margin-top: 12px; break-inside: avoid; }
.doc .pdf-forms .rows .r { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid #EEF1F4; }
.doc .pdf-forms .rows .r.tot { font-weight: 700; }
.doc .pdf-forms h3 { font-size: 13px; margin: 0 0 6px; }
.doc .pdf-forms .tablebox { overflow: visible; max-height: none; }
.demobar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 90; display: flex; align-items: center; gap: 10px; background: var(--navy); color: #fff; padding: 9px 12px 9px 16px; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.25); font-size: 13px; width: min(760px, calc(100% - 24px)); }
.demobar .btn:not(.primary) { background: transparent; color: #fff; border-color: #5B6E80; }
@media print { .demobar { display: none !important; } }
#lt table.edit .in input { min-width: 92px; }
#lt table.edit input[data-id] { min-width: 52px; }

/* ---------- Import de factures en lot, récapitulatif ---------- */
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 28px 16px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; background: #FAFCFB; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus, .dropzone.on { border-color: var(--green); background: var(--green-l); outline: none; }
.dropzone svg { width: 30px; height: 30px; stroke: var(--green-d); fill: none; stroke-width: 1.8; }
.dropzone b { color: var(--navy); font-size: 15px; }
.progress { height: 8px; background: var(--line-2); border-radius: 8px; overflow: hidden; margin: 10px 0 8px; }
.progress i { display: block; height: 100%; background: var(--green); transition: width .2s; }
.modal.xl { width: min(1340px, 100%); }
.imp-box { max-height: calc(100vh - 330px); }
.imp-table { min-width: 1180px; }
.imp-table td.fname { max-width: 220px; font-size: 12.5px; word-break: break-all; }
.imp-table td.fname .tags { margin-top: 3px; }
.imp-table tr.skip td { opacity: .55; }
.imp-table tr.skip td:first-child { opacity: 1; }
.imp-table input[data-num] { text-align: right; font-variant-numeric: tabular-nums; }
.duplist { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; display: grid; gap: 3px; word-break: break-word; }
.imp-done h3 { margin: 4px 0 10px; }
.recap-box { max-height: 520px; }
.recap td.pdfs { white-space: nowrap; }
.recap td.pdfs a { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; }
.recap td.pdfs svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.doc .recap-doc table { font-size: 9.5px; }
.doc .recap-doc td.pdfs { white-space: normal; word-break: break-all; max-width: 120px; }
.doc .recap-doc td.pdfs a { color: #36A465; text-decoration: underline; }
@media (max-width: 860px) {
  .imp-box { max-height: none; overflow: visible; border: 0; background: transparent; }
  .imp-table { min-width: 0; }
  .imp-table thead { display: none; }
  .imp-table, .imp-table tbody { display: block; }
  .imp-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; background: #fff; }
  .imp-table tr.warn { border-color: var(--warn); }
  .imp-table td { display: block; border: 0; padding: 0 !important; background: transparent !important; }
  .imp-table td::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
  .imp-table td:first-child { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; order: -1; }
  .imp-table td:first-child::before { order: 2; }
  .imp-table td.fname, .imp-table td[data-l="Description"] { grid-column: 1 / -1; max-width: none; }
  .imp-table input, .imp-table select { border-color: var(--line) !important; }
}
.recap { min-width: 860px; }
.doc .recap { min-width: 0; }
@media (max-width: 860px) { .imp-table td:first-child::before { display: inline; } }
@media (max-width: 860px) { #delsel:not([hidden]) { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 90; justify-content: center; background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.2); } }

/* Modification groupée des factures */
.bulk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.bulk-r { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.bulk-r label { gap: 8px; padding-top: 7px; cursor: pointer; flex-wrap: nowrap; align-items: flex-start; line-height: 1.3; }
.bulk-r label input { margin-top: 1px; flex: none; }
.bulk-r input[data-v], .bulk-r select { width: 100%; }
.bulk-r small { display: block; margin-top: 3px; }
.bulk-r.on { border-color: var(--green); background: var(--green-l, #eef8f1); }
@media (max-width: 860px) { .bulk { grid-template-columns: minmax(0, 1fr); } .bulk-r { grid-template-columns: minmax(0, 1fr); gap: 4px; } .bulk-r label { padding-top: 0; } }
input.bad { border-color: var(--neg) !important; background: var(--neg-l) !important; }
/* Téléphone : les tableaux de saisie (état des lieux, compteurs) défilent latéralement au lieu d'être coupés */
@media (max-width: 860px) {
  fieldset { min-width: 0; overflow-x: auto; }
  .piece { overflow-x: auto; }
  .piece table.edit { min-width: 520px; }
}
.nav .badge.soon { background: transparent; border: 1px solid var(--green); color: var(--green); font-weight: 600; letter-spacing: 0; white-space: nowrap; }
/* Patrimoine : barre de répartition et pastilles */
.stackbar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--line); margin-top: 6px; }
.stackbar i { display: block; height: 100%; }
.rows .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.card.contact h3 { font-size: 15px; }
/* Indicateur d'enregistrement toujours visible */
.savepill { position: fixed; right: 14px; bottom: 14px; z-index: 150; border: 1px solid var(--line); background: #fff; color: var(--muted); font: 600 12px/1 var(--font, inherit); padding: 7px 11px; border-radius: 20px; box-shadow: 0 4px 14px rgba(0,0,0,.08); cursor: pointer; }
.savepill.ok { color: var(--green-d, #2E8B57); }
.savepill.busy { color: var(--warn, #B7791F); }
.savepill.err { background: var(--neg); border-color: var(--neg); color: #fff; }
@media (max-width: 860px) { .savepill { top: 8px; bottom: auto; right: 8px; } }
@media print { .savepill { display: none !important; } }
/* Achats : aperçu d'un tableau collé depuis Excel */
.px-box { max-height: 52vh; overflow: auto; }
.px-table th { vertical-align: top; }
.px-table th select { width: 100%; font-weight: 600; text-transform: none; letter-spacing: 0; }
.px-table tr.skip td { opacity: .55; }
.px-table tr.skip td:first-child { opacity: 1; }
body:has(.modal-bg) .savepill { display: none; }
