/* Gestion locative SCI — design sobre et chaleureux */
:root {
  --bg: #f7f3ee; --panel: #fffdfa; --ink: #2a2420; --muted: #7a6f66; --line: #e8dfd5; --line2: #f0e9e1;
  --accent: #b4532a; --accent-2: #9a4421; --accent-soft: #f8e9e0;
  --ok: #2f7a4f; --ok-soft: #e4f2e8; --warn: #a86a00; --warn-soft: #fbf0d9; --danger: #b3261e; --danger-soft: #fbe5e3; --info: #2b5f8a; --info-soft: #e3eef7;
  --side: #2d2622; --side-ink: #e9e1d8; --radius: 12px; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 4px 16px rgba(60,40,20,.05);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-2); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -.01em; } h2 { font-size: 1.15rem; margin: 0; } h3 { font-size: 1rem; margin: 0; } h4 { margin: .8rem 0 .4rem; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
code { background: var(--line2); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .strong { font-weight: 600; } .grow { flex: 1; min-width: 0; } .center { text-align: center; } .pad { padding: 1.5rem; }
.ok { color: var(--ok); } .danger { color: var(--danger); }
.row { display: flex; align-items: center; } .gap { gap: .5rem; } .wrap { flex-wrap: wrap; } .end { justify-content: flex-end; margin-bottom: .6rem; } .nowrap { flex-wrap: nowrap; white-space: nowrap; }
.ic { flex-shrink: 0; }
.boot { display: grid; place-items: center; min-height: 60vh; color: var(--muted); text-align: center; padding: 2rem; }
.boot.err { color: var(--danger); }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1rem .7rem; }
.brand { display: flex; gap: .7rem; align-items: center; padding: .3rem .5rem 1.2rem; }
.logo { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.logo.big { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 1rem; }
.brand-t { font-weight: 700; color: #fff; } .brand-s { font-size: .75rem; opacity: .7; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 8px; color: var(--side-ink); font-size: .93rem; }
.side nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side nav a.on { background: var(--accent); color: #fff; }
.nav-sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: .9rem .7rem .3rem; min-height: .6rem; }
.pill { margin-left: auto; background: #fff; color: var(--accent); border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 0 .45rem; }
.side-foot { margin-top: auto; padding: 1rem .6rem 0; } .side-foot .link { color: var(--side-ink); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem; padding: .7rem 1.6rem; background: rgba(247,243,238,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.burger { display: none; }
.content { padding: 1.5rem 1.6rem 4rem; max-width: 1400px; width: 100%; }
.side-back { display: none; }

/* ---------- Recherche globale ---------- */
.gsearch { position: relative; flex: 1; max-width: 560px; display: flex; align-items: center; gap: .5rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 .8rem; color: var(--muted); }
.gsearch input { border: 0; background: transparent; padding: .55rem 0; width: 100%; outline: none; font: inherit; color: var(--ink); }
.gs-res { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; z-index: 30; }
.gs-res a { display: flex; gap: .6rem; align-items: center; padding: .55rem .8rem; color: var(--ink); border-bottom: 1px solid var(--line2); }
.gs-res a:hover { background: var(--accent-soft); text-decoration: none; }
.top-actions { margin-left: auto; }

/* ---------- Composants ---------- */
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-h p { margin: .25rem 0 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.2rem; min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line2); flex-wrap: wrap; }
.card-b { padding: 1rem 1.1rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 1.2rem; } .grid2 > .span2 { grid-column: 1 / -1; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); border-top: 4px solid var(--line); }
.stat.ok { border-top-color: var(--ok); } .stat.danger { border-top-color: var(--danger); } .stat.info { border-top-color: var(--info); } .stat.warn { border-top-color: var(--warn); }
.stat-l { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-v { font-size: 1.55rem; font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; } .stat-v.sm { font-size: 1.05rem; }
.stat-s { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.bar { height: 7px; background: var(--line2); border-radius: 99px; overflow: hidden; margin: .4rem 0 .2rem; display: inline-block; width: 100%; vertical-align: middle; }
.bar.sm { width: 70px; margin: 0 .3rem 0 0; } .bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.qa { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.1rem; background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); text-align: left; }
.qa:nth-child(2) { background: #6b5a4c; } .qa:nth-child(3) { background: #2f6b5a; }
.qa:hover { filter: brightness(1.07); }
.badge { display: inline-flex; align-items: center; padding: .1rem .55rem; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--line2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.danger { background: var(--danger-soft); color: var(--danger); } .badge.info { background: var(--info-soft); color: var(--info); }
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: .5rem .9rem; border-radius: 9px; font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--line2); text-decoration: none; } .btn:disabled { opacity: .55; cursor: default; }
.btn.sm { padding: .3rem .6rem; font-size: .82rem; border-radius: 7px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost-danger { color: var(--danger); border-color: #efc9c5; background: transparent; } .btn.ghost-danger:hover { background: var(--danger-soft); }
.btn.block { width: 100%; justify-content: center; }
.icon-btn { border: 0; background: transparent; padding: .3rem; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; }
.icon-btn:hover { background: var(--line2); color: var(--ink); } .icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-2); cursor: pointer; } .link:hover { text-decoration: underline; } .link.danger { color: var(--danger); }
.empty { color: var(--muted); padding: 1.4rem; text-align: center; background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(0,0,0,.012) 8px 16px); border-radius: 8px; }
.notice { display: flex; gap: .5rem; align-items: center; padding: .7rem .9rem; border-radius: 9px; background: var(--info-soft); color: var(--info); margin: .6rem 0; font-size: .9rem; flex-wrap: wrap; }
.notice.warn { background: var(--warn-soft); color: var(--warn); } .notice.ok { background: var(--ok-soft); color: var(--ok); }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tab { border: 0; background: none; padding: .65rem .9rem; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-n { background: var(--line2); border-radius: 99px; padding: 0 .4rem; font-size: .75rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid var(--line2); flex-wrap: wrap; } .list li:last-child { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; } .num.danger { color: var(--danger); }
.kv { display: grid; grid-template-columns: 1fr; margin: 0; }
.kv > div { display: grid; grid-template-columns: 42% 1fr; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line2); }
.kv dt { color: var(--muted); font-size: .88rem; } .kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: .4rem 0 .6rem 1rem; position: relative; } .timeline li::before { content: ''; position: absolute; left: -6px; top: .75rem; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.danger-zone { margin-top: 2rem; padding-top: 1rem; border-top: 1px dashed var(--line); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: .6rem 0; }
.chip { padding: .2rem .6rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent-2); font-size: .82rem; }
.bien { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.bien-h { display: flex; justify-content: space-between; gap: .5rem; }
.bien-s { display: flex; gap: 1rem; margin-top: .6rem; font-size: .88rem; color: var(--muted); }
.mini-sum { background: var(--line2); border-radius: 8px; padding: .55rem .75rem; font-size: .9rem; }
.total-box { font-weight: 700; font-size: 1.1rem; padding: .8rem 1rem; border-radius: 10px; text-align: center; }
.total-box.due { background: var(--warn-soft); color: var(--warn); } .total-box.refund { background: var(--ok-soft); color: var(--ok); }

/* ---------- Tableaux ---------- */
.dt-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.search { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 8px; padding: 0 .6rem; background: #fff; color: var(--muted); }
.search input { border: 0; outline: none; padding: .45rem 0; font: inherit; width: 180px; background: transparent; }
select, input, textarea { font: inherit; color: var(--ink); }
.flt, .field select, .field input:not([type=checkbox]), .field textarea, .dt-tools select, select { border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; background: #fff; max-width: 100%; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .55rem .6rem; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none; }
.table td { padding: .6rem .6rem; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.table .r { text-align: right; }
.table tr.click { cursor: pointer; } .table tbody tr:hover { background: #fcf8f3; }
.table td.actions { text-align: right; white-space: nowrap; }

/* ---------- Formulaires & modales ---------- */
.overlay { position: fixed; inset: 0; background: rgba(40,30,20,.45); display: grid; place-items: center; z-index: 100; padding: 1rem; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 2rem); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.lg { width: min(820px, 100%); } .modal.xl { width: min(1100px, 100%); height: calc(100vh - 2rem); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line2); }
.modal-b { padding: 1.1rem 1.2rem; overflow: auto; flex: 1; }
.modal-f { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.2rem; border-top: 1px solid var(--line2); flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .8rem 1rem; }
.form-grid > .wide, .form-grid > h4 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; } .field.wide { grid-column: 1 / -1; }
.field label { font-size: .84rem; font-weight: 600; color: #4d433b; }
.field input:focus, .field select:focus, .field textarea:focus, .flt:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.switch { display: flex; gap: .5rem; align-items: center; font-weight: 400 !important; }
.check { display: flex; gap: .5rem; align-items: flex-start; cursor: pointer; font-weight: 400; }
.check input { margin-top: .2rem; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .3rem .8rem; padding: .6rem; border: 1px solid var(--line); border-radius: 8px; max-height: 200px; overflow: auto; background: #fff; }
.attach { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; background: var(--line2); border-radius: 8px; }
.pdf-frame { width: 100%; height: 100%; min-height: 60vh; border: 0; border-radius: 8px; background: #eee; }
.zoom { max-width: 100%; max-height: 75vh; display: block; margin: auto; border-radius: 8px; }
.toasts { position: fixed; bottom: 1rem; right: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; font-size: .9rem; animation: up .2s ease; }
.toast.error { background: var(--danger); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.imgfield { display: flex; align-items: center; gap: .5rem; padding: .5rem; border: 1px dashed var(--line); border-radius: 8px; }
.imgfield img { height: 40px; max-width: 120px; object-fit: contain; background: #fff; }
.import-prev { margin-top: 1rem; }

/* ---------- Documents & photos ---------- */
.doclist { list-style: none; margin: 0; padding: 0; }
.doclist li { display: flex; gap: .7rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line2); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.gallery img, .gallery .ph { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; cursor: zoom-in; background: var(--line2); }
.gallery figcaption { display: flex; align-items: center; gap: .3rem; padding: .4rem .5rem; font-size: .84rem; } .gallery figcaption span:first-child { flex: 1; }

/* ---------- Calendrier ---------- */
.cal-nav { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; } .cal-nav h3 { min-width: 160px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px; }
.cal-h { font-size: .75rem; color: var(--muted); text-transform: uppercase; text-align: center; padding: .3rem; }
.cal-c { min-height: 92px; background: #fff; border: 1px solid var(--line2); border-radius: 8px; padding: .3rem; display: flex; flex-direction: column; gap: 3px; }
.cal-c.empty { background: transparent; border: 0; } .cal-c.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-d { font-size: .78rem; color: var(--muted); }
.cal-e { border: 0; text-align: left; font: inherit; font-size: .74rem; padding: .15rem .35rem; border-radius: 5px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--line2); }
.cal-e.ok { background: var(--ok-soft); color: var(--ok); } .cal-e.warn { background: var(--warn-soft); color: var(--warn); } .cal-e.danger { background: var(--danger-soft); color: var(--danger); } .cal-e.info { background: var(--info-soft); color: var(--info); }
.legend { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .8rem; }

/* ---------- Checklist EDL ---------- */
.checklist { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 1.5rem; }
.cl-group h4 { border-bottom: 1px solid var(--line2); padding-bottom: .3rem; }
.cl-item { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; flex-wrap: wrap; }
.cl-item .check { flex: 1; min-width: 200px; } .cl-item.done .check span { color: var(--muted); text-decoration: line-through; }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(circle at 20% 10%, #f3e3d6, var(--bg) 60%); }
.login-card { width: min(400px, 100%); background: var(--panel); border-radius: 16px; padding: 2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .9rem; text-align: center; }
.login-card .field { text-align: left; }

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .menu-open .side { transform: none; } .menu-open .side-back { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50; }
  .burger { display: inline-flex; }
  .top { padding: .6rem .8rem; } .content { padding: 1rem .8rem 4rem; }
  .grid2, .checklist { grid-template-columns: 1fr; }
  .quick { grid-template-columns: 1fr; }
  .top-actions span { display: none; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.3rem; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: .6rem; padding: .3rem .6rem; background: #fff; }
  .table td { border: 0; padding: .25rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; }
  .table td.actions { justify-content: flex-end; } .table td.actions::before { content: none; }
  .search input { width: 120px; }
  .kv > div { grid-template-columns: 1fr; gap: 0; }
  .cal-c { min-height: 60px; } .cal-e { font-size: .65rem; }
}
