/* Maison Clé : pierre de taille, brun, or. Sidebar sur PC, barre d'onglets en bas sur téléphone. */
:root {
  --bg: #F4EFE7; --surface: #FFFDF9; --surface-2: #EFE7DA; --ink: #2E2119; --muted: #7A6B5D; --line: #E3D7C6;
  --brand: #7A4E2D; --brand-ink: #FFFFFF; --gold: #A9844D; --gold-soft: #EADBC0;
  --ok: #4C7A47; --ok-soft: #E2EDDC; --warn: #A97A1F; --warn-soft: #F5E8C9; --danger: #B0412C; --danger-soft: #F6DDD6;
  --shadow: 0 1px 2px rgba(60,40,20,.06), 0 6px 24px rgba(60,40,20,.07);
  --display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --body: "Work Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 14px; --nav-w: 232px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #17120F; --surface: #211A15; --surface-2: #2A221C; --ink: #F1E8DC; --muted: #B2A391; --line: #3A3028;
  --brand: #C4946A; --brand-ink: #1A130E; --gold: #D2AE73; --gold-soft: #3B3020;
  --ok: #8CC283; --ok-soft: #233321; --warn: #E2B65A; --warn-soft: #3A2E17; --danger: #EF8A73; --danger-soft: #3E211B;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #17120F; --surface: #211A15; --surface-2: #2A221C; --ink: #F1E8DC; --muted: #B2A391; --line: #3A3028;
  --brand: #C4946A; --brand-ink: #1A130E; --gold: #D2AE73; --gold-soft: #3B3020;
  --ok: #8CC283; --ok-soft: #233321; --warn: #E2B65A; --warn-soft: #3A2E17; --danger: #EF8A73; --danger-soft: #3E211B;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 2rem; } h2 { font-size: 1.45rem; } h3 { font-size: 1.15rem; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 600; }

/* ---------- Coquille ---------- */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100%; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 14px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 38px; height: 44px; flex: none; }
.brand-name { font-family: var(--display); font-size: 1.35rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); line-height: 1; }
.brand-sub { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: left; color: var(--muted); font-weight: 500; }
.nav button svg { width: 20px; height: 20px; flex: none; }
.nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav button[aria-current="page"] { background: var(--gold-soft); color: var(--ink); }
.nav button[aria-current="page"] svg { color: var(--brand); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: .85rem; flex: none; }

.main { min-width: 0; padding-block: 28px 48px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.topbar { display: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding-block: 12px calc(84px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
  .topbar { display: flex; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; align-items: center; justify-content: space-between; gap: 12px;
    margin: -12px calc(-1 * max(16px, env(safe-area-inset-right, 0px))) 16px calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
    padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
    background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; } .topbar .brand-mark { width: 28px; height: 32px; } .topbar .brand-name { font-size: 1.1rem; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .tabbar button { border: 0; background: none; padding: 8px 2px 7px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); cursor: pointer; }
  .tabbar button svg { width: 22px; height: 22px; }
  .tabbar button[aria-current="page"] { color: var(--brand); font-weight: 600; }
  h1 { font-size: 1.6rem; }
}

/* ---------- Éléments ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); min-height: 40px; }
.btn:hover { border-color: var(--gold); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { padding: 5px 12px; min-height: 32px; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: wait; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--muted); display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.gold { background: var(--gold-soft); color: var(--ink); }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid; }
.banner svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.banner.danger { background: var(--danger-soft); border-color: var(--danger); color: var(--ink); }
.banner.danger svg { color: var(--danger); }
.banner.info { background: var(--gold-soft); border-color: var(--gold); }
.banner.info svg { color: var(--brand); }
.banner.warn { background: var(--warn-soft); border-color: var(--warn); }
.demo-banner { background: var(--gold-soft); border-bottom: 1px solid var(--gold); padding: 8px 16px; font-size: .85rem; text-align: center; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--display); font-size: 2rem; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.empty { color: var(--muted); padding: 12px 0; font-size: .92rem; }
.clickable { cursor: pointer; }
.clickable:hover .title { color: var(--brand); }

/* ---------- Tableaux ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.search { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); min-height: 40px; }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; padding: 8px 0; }
.search svg { width: 18px; height: 18px; color: var(--muted); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: thin; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 5px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; font-size: .85rem; }
.chip b { font-variant-numeric: tabular-nums; margin-left: 4px; color: var(--muted); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip[aria-pressed="true"] b { color: inherit; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface); }
table.data th[aria-sort] { color: var(--ink); }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td.strong { font-weight: 600; }
@media (max-width: 760px) {
  .table-wrap { border: 0; background: none; overflow: visible; }
  table.data thead { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data tr { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
  table.data td { border: 0; padding: 3px 0; display: flex; gap: 10px; justify-content: space-between; text-align: right; }
  table.data td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; flex: none; }
  table.data td.strong { font-size: 1.02rem; justify-content: flex-start; text-align: left; }
  table.data td.strong::before { display: none; }
  table.data td:empty { display: none; }
}

/* ---------- Tiroir / formulaire ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30,20,12,.42); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: min(640px, 100%); height: 100%; background: var(--bg); display: flex; flex-direction: column; box-shadow: var(--shadow); animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .drawer, .modal { animation: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 18px; }
.drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; padding: 12px 20px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.drawer-foot .row { gap: 8px; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 22px; width: min(440px, 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; animation: slide .15s ease-out; }

fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
fieldset legend { grid-column: 1 / -1; font-family: var(--display); font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; padding: 0; width: 100%; border-bottom: 1px solid var(--line); padding-bottom: 6px; color: var(--brand); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field .hint { font-size: .78rem; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 11px; min-height: 42px; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
@media (max-width: 560px) { fieldset { grid-template-columns: 1fr; } input, select, textarea { font-size: 16px; } }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }

.soncas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .soncas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.soncas button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: 58px; }
.soncas button b { font-family: var(--display); font-size: 1.05rem; }
.soncas button span { font-size: .72rem; color: var(--muted); }
.soncas button[data-rank="1"] { border-color: var(--brand); background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.soncas button[data-rank="2"] { border-color: var(--gold); border-style: dashed; }
.soncas-tip { font-size: .85rem; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }

.copy-line { display: flex; gap: 6px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 6px 6px 6px 12px; min-width: 0; }
.copy-line code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: .78rem; scrollbar-width: none; }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
@media (min-width: 861px) { .toasts { bottom: 24px; } }
.toast { background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: .9rem; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Connexion ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-card .brand { justify-content: center; flex-direction: column; text-align: center; gap: 8px; }
.auth-card .brand-mark { width: 56px; height: 64px; }
.auth-card .brand-name { font-size: 1.9rem; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: .88rem; }
.auth-links button { border: 0; background: none; color: var(--brand); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Agenda ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.cal-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.cal { display: grid; min-width: 100%; position: relative; }
.cal-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); display: grid; }
.cal-day-h { text-align: center; padding: 8px 4px 6px; border-left: 1px solid var(--line); }
.cal-day-h .d { font-family: var(--display); font-size: 1.3rem; font-weight: 600; line-height: 1; }
.cal-day-h.today .d { color: var(--brand); }
.cal-day-h .sub { display: grid; grid-template-columns: 1fr 1fr; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.cal-body { display: grid; position: relative; }
.cal-hours { position: relative; }
.cal-hours div { position: absolute; right: 6px; font-size: .72rem; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.cal-col.theory { background: repeating-linear-gradient(135deg, transparent 0 9px, var(--surface-2) 9px 10px); }
.cal-col.half { border-left-style: dashed; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); opacity: .7; pointer-events: none; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--danger); z-index: 2; pointer-events: none; }
.ev { position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 7px; font-size: .78rem; line-height: 1.25; overflow: hidden; cursor: pointer; color: #fff; border: 1px solid rgba(0,0,0,.08); z-index: 1; }
.ev.theory { background: var(--surface); color: var(--ink); border: 1.5px dashed currentColor; }
.ev.theory .t { color: var(--ink); }
.ev .t { font-weight: 600; display: block; }
.ev .h { opacity: .9; font-variant-numeric: tabular-nums; }
.ev.done { opacity: .6; }
.ev.done .t { text-decoration: line-through; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.gap-bars { display: flex; flex-direction: column; gap: 8px; }
.gap-row { display: grid; grid-template-columns: 150px 1fr 74px; gap: 10px; align-items: center; font-size: .85rem; }
.gap-track { display: flex; flex-direction: column; gap: 3px; }
.gap-track i { display: block; height: 7px; border-radius: 4px; min-width: 2px; }
.gap-track i.th { opacity: .35; }
@media (max-width: 560px) { .gap-row { grid-template-columns: 100px 1fr 64px; } }

/* ---------- Calendrier des biens ---------- */
.tl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tl { display: grid; position: relative; width: max-content; min-width: 100%; }
.tl-name { position: sticky; left: 0; z-index: 2; background: var(--surface); padding: 8px 12px; border-right: 1px solid var(--line); border-top: 1px solid var(--line); font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.tl-day { font-size: .7rem; color: var(--muted); text-align: center; padding: 6px 0; border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tl-day.we { background: var(--surface-2); }
.tl-day.today { color: var(--brand); font-weight: 700; }
.tl-row { position: relative; border-top: 1px solid var(--line); height: 44px; }
.tl-bar { position: absolute; top: 8px; height: 28px; border-radius: 6px; color: #fff; font-size: .72rem; padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; cursor: pointer; font-weight: 600; }
.tl-bar.echo { opacity: .35; }
.tl-bar.manuel { background: repeating-linear-gradient(135deg, var(--gold) 0 6px, var(--brand) 6px 12px) !important; }
.tl-bar.conflict { outline: 3px solid var(--danger); outline-offset: 1px; }
.platform-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.platform-tag i { width: 10px; height: 10px; border-radius: 50%; }
.channel { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
details.help { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
details.help summary { cursor: pointer; font-weight: 600; }
details.help[open] summary { margin-bottom: 10px; }
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

/* ---------- Menu « Plus » (téléphone) ---------- */
.overlay.sheet-wrap { align-items: flex-end; justify-content: stretch; }
.sheet { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 8px 12px calc(14px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; animation: up .18s ease-out; box-shadow: var(--shadow); }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 10px; }
.sheet button { display: flex; align-items: center; gap: 12px; padding: 14px 10px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 1rem; text-align: left; cursor: pointer; }
.sheet button:last-child { border-bottom: 0; color: var(--muted); }
.sheet button span { flex: 1; }
.sheet button[aria-current="page"] { color: var(--brand); font-weight: 600; }
.sheet button svg { width: 20px; height: 20px; flex: none; }

/* ---------- Jauge ---------- */
.meter { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 8px; }
.meter i.warn { background: var(--warn); } .meter i.danger { background: var(--danger); }

/* ---------- Simulateur ---------- */
.sim-result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 16px; }
.sim-big { display: flex; flex-direction: column; gap: 2px; }
.sim-big b { font-family: var(--display); font-size: 2.3rem; line-height: 1.05; color: var(--brand); font-weight: 600; }
.sim-lines { margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.sim-lines div { display: flex; justify-content: space-between; gap: 10px; }
.sim-lines dt { color: var(--muted); } .sim-lines dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sim-lines .total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; font-weight: 600; }
.sim-lines .total dt { color: var(--ink); }
@media (max-width: 560px) { .sim-result { grid-template-columns: 1fr; } }

/* ---------- Étapes de relance ---------- */
.dunning { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.dunning li { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 0 7px 22px; font-size: .92rem; color: var(--muted); }
.dunning li::before { content: ""; position: absolute; left: 4px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.dunning li:not(:last-child)::after { content: ""; position: absolute; left: 9px; top: calc(50% + 7px); height: calc(100% - 12px); width: 2px; background: var(--line); }
.dunning li.reached { color: var(--ink); }
.dunning li.reached::before { background: var(--gold); border-color: var(--gold); }
.dunning li.current::before { background: var(--danger); border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.dunning li.current { font-weight: 600; }
.dunning-day { min-width: 46px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--brand); }

/* ---------- Dossier sécurisé ---------- */
.vault-lock { margin: 24px auto; align-items: center; text-align: center; padding: 28px 22px; }
.vault-lock form { width: 100%; }
.vault-icon { width: 44px; height: 44px; color: var(--gold); }

/* ---------- Proposition commerciale (aperçu + PDF) ---------- */
.print-root { position: fixed; inset: 0; z-index: 60; background: var(--surface-2); overflow: auto; }
.print-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); background: var(--surface); border-bottom: 1px solid var(--line); }
.proposal { --ink: #2E2119; --muted: #7A6B5D; --line: #E3D7C6; --brand: #7A4E2D; --gold: #A9844D; color: var(--ink); background: #FFFDF9; width: min(210mm, calc(100% - 24px)); margin: 20px auto 40px; padding: 18mm 16mm; box-shadow: 0 6px 24px rgba(60,40,20,.12); font-size: 10.5pt; line-height: 1.5; }
.proposal h1 { font-family: var(--display); font-weight: 600; font-size: 22pt; line-height: 1.15; margin: 4px 0 18px; color: var(--brand); }
.proposal h2 { font-family: var(--display); font-weight: 600; font-size: 14pt; margin: 22px 0 8px; color: var(--brand); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.proposal p { margin: 6px 0; }
.proposal .eyebrow { color: var(--gold); margin: 0; }
.pp-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--gold); }
.pp-head .brand-mark { width: 34px; height: 40px; }
.pp-date { margin-left: auto; color: var(--muted); font-size: 9.5pt; }
.pp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 14px; }
.pp-kpis div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.pp-kpis div:first-child { background: #F4EFE7; border-color: var(--gold); }
.pp-kpis span { font-size: 8.5pt; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pp-kpis b { font-family: var(--display); font-size: 20pt; color: var(--brand); line-height: 1.1; }
.pp-kpis small { color: var(--muted); font-size: 8.5pt; }
.pp-table { width: 100%; border-collapse: collapse; }
.pp-table td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pp-table td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; padding-left: 12px; }
.pp-table tr.total td { font-weight: 600; border-bottom: 0; border-top: 2px solid var(--brand); color: var(--brand); }
.pp-note { font-size: 8.5pt; color: var(--muted); }
.pp-list { margin: 4px 0; padding-left: 20px; } .pp-list li { margin: 3px 0; }
.pp-foot { display: flex; justify-content: space-between; gap: 16px; margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--gold); font-size: 9pt; color: var(--muted); }
@media (max-width: 600px) { .proposal { padding: 22px 16px; font-size: 10pt; } .pp-kpis { grid-template-columns: 1fr; } .pp-head { flex-wrap: wrap; } }

@media print {
  @page { size: A4; margin: 0; }
  body.printing > *:not(.print-root) { display: none !important; }
  body.printing { background: #fff; }
  .print-root { position: static; overflow: visible; background: #fff; }
  .print-bar { display: none; }
  .proposal { width: auto; margin: 0; box-shadow: none; padding: 16mm 16mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .proposal section { break-inside: avoid; }
}

/* ---------- Dossier sécurisé par bien ---------- */
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vault-group { font-family: var(--display); font-weight: 600; font-size: 1.45rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.vault-group .count { font-family: var(--body); font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 2px 9px; }
.vault-prop { text-align: left; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 8px; cursor: pointer; border: 1px solid var(--line); }
.vault-prop:hover { border-color: var(--gold); }
.vault-prop svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.vault-prop .row svg { width: 14px; height: 14px; }
.vp-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; color: var(--muted); }
.vp-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.linklike { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; letter-spacing: inherit; text-transform: inherit; }
.linklike svg { width: 14px; height: 14px; }
.stay-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.stay-facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: .9rem; }
.stay-facts div { min-width: 0; }
.stay-facts .wide { grid-column: 1 / -1; }
.stay-facts dt { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stay-facts dd { margin: 0; overflow-wrap: anywhere; }
table.data.compact td, table.data.compact th { padding-block: 8px; }

/* ---------- Brouillon de facture ---------- */
.inv-line { display: flex; flex-direction: column; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.inv-line.missing { border-color: var(--danger); background: var(--danger-soft); }
.inv-line textarea { min-height: 0; }
.inv-line label { display: inline-flex; align-items: center; gap: 6px; }
.print-doc { padding: 20px 12px 40px; }
.print-doc > div { box-shadow: 0 6px 24px rgba(60,40,20,.12); }
@media print { .print-doc { padding: 0; } .print-doc > div { box-shadow: none; max-width: none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* ---------- Signature en ligne ---------- */
.sign-card { width: min(520px, 100%); }
.sign-steps { margin: 4px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 16px; }
.sign-steps li::marker { color: var(--gold); font-weight: 700; }
.sign-steps .btn { margin-top: 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .95rem; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.sign-done { display: flex; justify-content: center; }
.sign-done svg { width: 54px; height: 54px; color: var(--ok); }
.grid.vault-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* ---------- V4 : étude de marché ---------- */
.mk-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .mk-layout { grid-template-columns: 1fr; } }
.mk-form .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mk-extras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
@media (max-width: 420px) { .mk-extras { grid-template-columns: 1fr; } }
.mk-sc { display: flex; flex-direction: column; gap: 4px; }
.mk-sc b { font-family: var(--display); font-size: 1.9rem; line-height: 1.05; font-variant-numeric: tabular-nums; }
.mk-sc b small { font-family: var(--body); font-size: .8rem; font-weight: 400; color: var(--muted); }
.mk-sc.mk-main { border: 1.5px solid var(--gold); }
.mk-chart { width: 100%; height: auto; display: block; }
.mk-chart .mk-hi { fill: var(--gold-soft); }
.mk-chart .mk-mid { fill: var(--brand); }
.mk-chart .mk-lo { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 3 3; opacity: .55; }
.mk-chart .mk-ax { font-size: 11px; fill: var(--muted); }
.mk-chart .mk-val { font-size: 10px; fill: var(--ink); font-weight: 600; }
.mk-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.mk-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mk-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.mk-legend i.mk-mid { background: var(--brand); } .mk-legend i.mk-hi { background: var(--gold-soft); border: 1px solid var(--gold); }
.mk-legend i.mk-lo { height: 0; border-top: 2px dashed var(--ink); border-radius: 0; opacity: .55; }
.mk-add { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; align-items: center; }
.mk-add input[name=url] { grid-column: span 2; }

/* ---------- V4 : avis ---------- */
.stars { color: var(--gold); letter-spacing: 1px; white-space: nowrap; }
.stars i { font-style: normal; color: var(--line); }
.rev { cursor: pointer; }
.rev:hover { border-color: var(--gold); }
.rev b.low { color: var(--danger); }
.rev-avg { font-family: var(--display); font-size: 1.8rem; font-weight: 600; line-height: 1; }

/* ---------- V4 : livret d'accueil ---------- */
.drawer.wide { width: min(820px, 100%); }
.bk-sec.off { opacity: .55; }
.bk-page { width: min(640px, 100%); margin: 0 auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.bk-head { display: flex; align-items: center; gap: 12px; }
.bk-head h1 { font-size: 1.8rem; }
.bk-head .brand-mark { width: 44px; height: 50px; }
.bk-head > div:nth-child(2) { flex: 1; min-width: 0; }
.bk-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bk-times > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; }
.bk-times b { font-family: var(--display); font-size: 1.7rem; line-height: 1.1; }
.bk-wifi { display: flex; flex-direction: column; gap: 6px; }
.bk-code { font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem; letter-spacing: .03em; overflow-wrap: anywhere; }
.bk-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-toc a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .85rem; }
section.bk-sec h2 { font-size: 1.3rem; margin-bottom: 6px; }
section.bk-sec p { margin: 0; white-space: pre-line; }
.bk-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: sticky; bottom: 0; padding: 10px 0 12px; background: var(--bg); }
.bk-contact .btn { justify-content: center; }

/* ---------- V4 : espace propriétaire et compte ménage ---------- */
.os-page, .cl-page { width: min(900px, 100%); margin: 0 auto; padding: 18px 16px 40px; display: flex; flex-direction: column; gap: 14px; }
.cl-page { width: min(620px, 100%); }
.os-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.os-hello { font-size: 2rem; }
.os-block { border-top: 1px solid var(--line); padding-top: 12px; }
.os-block .row .field { min-width: 140px; }
.cl-day { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cl-task { display: flex; flex-direction: column; gap: 6px; }
.cl-task.done { opacity: .65; }
.cl-info { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: .9rem; }
.cl-info.warn { background: var(--warn-soft); }
.grid.mk-scs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1180px) and (min-width: 1001px), (max-width: 640px) { .grid.mk-scs { grid-template-columns: 1fr; } }
.mk-sc b { font-size: 1.7rem; }
#mk-res table.data td:first-child { min-width: 170px; }
[hidden] { display: none !important; }
.page-head .actions, .page-head .seg { max-width: 100%; }

/* ---------- V5 : prestations du livret, ménages ---------- */
.bk-svc { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.bk-svc.off { opacity: .55; }
.bk-svc-row { display: flex; gap: 6px; align-items: center; }
.bk-svc-row input[type=text], .bk-svc-row input[type=url] { flex: 1; min-width: 0; }
.bk-svc-row input[type=number] { width: 90px; flex: none; }
.bk-svcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.bk-svc-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; background: var(--bg); }
.bk-svc-card .btn { align-self: flex-start; margin-top: auto; }
.bk-price { font-family: var(--display); font-size: 1.25rem; font-weight: 600; white-space: nowrap; }
.cl-task.late { border-color: var(--danger); }
.cl-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.cl-sum .stat { padding: 10px 12px; }
.cl-sum .stat b { font-size: 1.6rem; }
.mn-row { flex-wrap: wrap; }
@media (max-width: 600px) { .mn-row .grow { flex-basis: calc(100% - 100px); } }

/* Studio flyers : occupe toute la place disponible */
.main.is-studio { padding: 0; }
.main.is-studio .topbar { margin: 0; }
.studio-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.studio-frame { display: block; width: 100%; height: 80vh; border: 0; background: #1F1B16; }
@media (max-width: 860px) { .studio-bar .small { display: none; } .studio-bar { padding: 4px 12px; justify-content: flex-end; } }

/* QR codes à imprimer */
.qr-preview{background:var(--bg,#faf6ef);border:1px solid var(--line);border-radius:12px;padding:10px;display:flex;justify-content:center;align-items:center;min-height:200px}
.qr-preview img{max-width:100%;max-height:340px;box-shadow:0 2px 10px rgba(0,0,0,.12);border-radius:4px}
