/* IMOIA — application web. Un classeur : des tiroirs à onglets de couleur, des clés, un coffre. */

:root {
  color-scheme: light;
  --paper: #F2F5F1;
  --surface: #FFFFFF;
  --surface-2: #E8EEE9;
  --ink: #15221B;
  --muted: #586A60;
  --line: #D6E0D9;
  --forest: #0B6B3A;
  --forest-hover: #09592F;
  --on-forest: #FFFFFF;
  --forest-soft: #DDEFE3;
  --leaf: linear-gradient(120deg, #59DE5E, #1FCFC3);
  --danger: #B3261E;
  --danger-soft: #FBE9E7;
  --warn: #8A5A00;
  --warn-soft: #FFF1D6;
  --focus: #1B7FD1;

  /* Couleur de chaque tiroir : onglets, puces et liserés. */
  --d-plans: #2F6690;
  --d-photos: #B26B12;
  --d-diagnostics: #3A8A3E;
  --d-equipements: #127A78;
  --d-travaux: #A2462B;
  --d-documents: #5B6676;

  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(21, 34, 27, .06), 0 4px 16px rgba(21, 34, 27, .05);
  --sidebar: 268px;
  --font: "Archivo", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0F1612;
    --surface: #161F1A;
    --surface-2: #1F2A23;
    --ink: #E3EAE5;
    --muted: #9DADA4;
    --line: #2C3A32;
    --forest: #4ADE80;
    --forest-hover: #6BE897;
    --on-forest: #062012;
    --forest-soft: #183324;
    --danger: #F2B8B5;
    --danger-soft: #3A1E1C;
    --warn: #F5C46B;
    --warn-soft: #33270F;
    --focus: #7DB9F0;
    --d-plans: #7FB3DB;
    --d-photos: #E7A955;
    --d-diagnostics: #82C985;
    --d-equipements: #5CC7C3;
    --d-travaux: #E5896C;
    --d-documents: #A6B1C0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0F1612; --surface: #161F1A; --surface-2: #1F2A23; --ink: #E3EAE5; --muted: #9DADA4; --line: #2C3A32;
  --forest: #4ADE80; --forest-hover: #6BE897; --on-forest: #062012; --forest-soft: #183324;
  --danger: #F2B8B5; --danger-soft: #3A1E1C; --warn: #F5C46B; --warn-soft: #33270F; --focus: #7DB9F0;
  --d-plans: #7FB3DB; --d-photos: #E7A955; --d-diagnostics: #82C985; --d-equipements: #5CC7C3; --d-travaux: #E5896C; --d-documents: #A6B1C0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

[data-drawer="plans"] { --drawer: var(--d-plans); }
[data-drawer="photos"] { --drawer: var(--d-photos); }
[data-drawer="diagnostics"] { --drawer: var(--d-diagnostics); }
[data-drawer="equipements"] { --drawer: var(--d-equipements); }
[data-drawer="travaux"] { --drawer: var(--d-travaux); }
[data-drawer="documents"] { --drawer: var(--d-documents); }

/* ------------------------------------------------------------------ Base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 650; line-height: 1.2; font-stretch: 112%; letter-spacing: -.005em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.icon { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------------ Boutons et champs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--forest); color: var(--on-forest); }
.btn-primary:hover:not(:disabled) { background: var(--forest-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--forest); }
.btn-ghost { background: transparent; color: var(--forest); padding: 0 10px; }
.btn-ghost:hover:not(:disabled) { background: var(--forest-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }
.btn.busy span::after { content: "…"; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: var(--radius); background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-stack { display: grid; gap: 8px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, fieldset legend { font-weight: 600; font-size: .9rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
}
.input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
textarea.input { resize: vertical; }
.hint { font-size: .85rem; color: var(--muted); }
.code-input { font-size: 1.6rem; letter-spacing: .35em; font-stretch: 112%; font-variant-numeric: tabular-nums; text-align: center; }

fieldset { border: 0; padding: 0; margin: 0 0 18px; }
fieldset legend { margin-bottom: 8px; padding: 0; }
.check, .radio { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; }
.check:hover, .radio:hover { background: var(--surface-2); }
.check input, .radio input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--forest); flex: none; }
.check[data-drawer] { border-left: 4px solid var(--drawer); }
.check > span, .radio > span { display: grid; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px; }
.check-list { display: grid; gap: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: .88rem; text-decoration: none; cursor: pointer;
}
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-pair { display: inline-flex; }
.chip-pair .chip { border-radius: 999px 0 0 999px; }
.chip-x { border: 1px solid var(--line); border-left: 0; border-radius: 0 999px 999px 0; background: var(--surface); padding: 0 8px; cursor: pointer; color: var(--muted); }

.tag {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.tag.ok { background: var(--forest-soft); color: var(--forest); }
.tag.warn, .tag.wait { background: var(--warn-soft); color: var(--warn); }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700;
}
:root:not([data-theme="light"]) .badge { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { background: #D9443A; } }

/* ------------------------------------------------------------------ Cadre */

.demo-banner {
  position: sticky; top: 0; z-index: 30;
  padding: 6px 16px; text-align: center; font-size: .85rem; font-weight: 600;
  background: var(--warn-soft); color: var(--warn);
}
.shell {
  display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh;
  background: linear-gradient(to right, var(--surface) calc(var(--sidebar) - 1px), var(--line) calc(var(--sidebar) - 1px), var(--line) var(--sidebar), transparent var(--sidebar));
}
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px; padding: 20px 14px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; text-decoration: none; }
.brand img { border-radius: 50%; }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font-weight: 800; font-stretch: 125%; font-size: 1.3rem; letter-spacing: .04em; }
.brand-sub { font-size: .75rem; color: var(--muted); }
.nav-group { display: grid; gap: 2px; }
.nav-title { padding: 0 10px 6px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.nav-link, .nav-home {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--radius-s); text-decoration: none; color: var(--ink);
}
.nav-link:hover, .nav-home:hover { background: var(--surface-2); }
.nav-link.active { background: var(--forest-soft); color: var(--forest); font-weight: 600; }
.nav-home { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; border-left: 3px solid transparent; }
.nav-home.active { background: var(--surface-2); border-left-color: var(--forest); }
.nav-home-addr { font-weight: 600; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-home-city { grid-column: 1; font-size: .8rem; color: var(--muted); }
.nav-home .badge { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.nav-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 26px 40px 18px; max-width: 1180px; width: 100%;
}
.top-brand { display: none; }
.back {
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px;
  border-radius: var(--radius); text-decoration: none; flex: none;
}
.back:hover { background: var(--surface-2); }
.top-title { flex: 1; min-width: 0; display: grid; }
.top-title h1 { font-size: clamp(1.4rem, 2.4vw, 2rem); font-stretch: 118%; font-weight: 700; overflow-wrap: anywhere; }
.top-kicker { color: var(--muted); font-size: .9rem; order: 2; margin-top: 2px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
main { padding: 0 40px 64px; max-width: 1180px; width: 100%; outline: none; }
.tabbar { display: none; }

.page { display: grid; gap: 24px; align-content: start; }
.page.narrow { max-width: 760px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.loading { display: flex; gap: 6px; padding: 48px 0; justify-content: center; }
.loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--forest); opacity: .3; animation: pulse 1s infinite; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 50% { opacity: 1; } }

.empty {
  display: grid; gap: 14px; justify-items: start;
  padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius-l); color: var(--muted);
}
.empty p { max-width: 54ch; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > li, .list > a { background: var(--surface); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; background: var(--surface); }
a.row:hover { background: var(--surface-2); }
.row-text { flex: 1; min-width: 0; display: grid; }
.row-text span { color: var(--muted); font-size: .9rem; }
.row-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.row-value.missing { font-weight: 500; color: var(--warn); font-size: .88rem; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 20px; display: grid; gap: 10px; }

/* ------------------------------------------------------------------ Messages et dialogues */

#toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(520px, calc(100vw - 32px)); padding: 12px 18px; border-radius: var(--radius);
  background: var(--ink); color: var(--paper); font-weight: 500; box-shadow: var(--shadow);
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #toast.error { background: #8C1D18; } }

.dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  padding: 0; border: 0; border-radius: var(--radius-l);
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.dialog.wide { width: min(720px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(10, 20, 14, .45); }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 8px; }
.dialog header h2 { font-size: 1.2rem; }
.dialog-body { padding: 8px 20px 4px; overflow-y: auto; display: grid; gap: 12px; }
.dialog-body > p { max-width: 60ch; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ Connexion */

.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); min-height: 100vh; }
.login-brand {
  display: flex; flex-direction: column; justify-content: center; gap: 40px;
  padding: 48px clamp(24px, 6vw, 88px);
  background: #07120C; color: #E6EEE9;
}
.login-banner { width: min(560px, 100%); border-radius: var(--radius-l); }
.login-pitch { display: grid; gap: 22px; max-width: 34em; }
.pitch { font-size: clamp(1.3rem, 2.2vw, 1.75rem); font-stretch: 115%; font-weight: 600; line-height: 1.3; }
.pitch-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; color: #B9C8BF; }
.pitch-points strong { color: #fff; }
.login-side { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 5vw, 72px); gap: 24px; }
.login-head { display: flex; align-items: center; justify-content: space-between; }
.login-head h1 { font-size: 2rem; font-stretch: 118%; }
.login-form { display: grid; gap: 20px; max-width: 380px; }
.login-form form { display: grid; gap: 4px; }
.login-form form .btn-primary { margin-top: 4px; width: 100%; }
.lead { color: var(--muted); margin-bottom: 14px; max-width: 46ch; }
.known { display: grid; gap: 8px; }
.row-actions { display: flex; justify-content: space-between; flex-wrap: wrap; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.notice { padding: 14px; border-radius: var(--radius); background: var(--forest-soft); margin-bottom: 14px; display: grid; gap: 4px; }

/* ------------------------------------------------------------------ Accueil */

.callout {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 20px 22px; border-radius: var(--radius-l);
  background: var(--forest-soft); border: 1px solid color-mix(in srgb, var(--forest) 25%, transparent);
}
.callout > div { display: grid; gap: 6px; max-width: 60ch; }

.requests-strip {
  padding: 18px 20px; border-radius: var(--radius-l); background: var(--warn-soft); display: grid; gap: 10px;
}
.requests-strip h2 { color: var(--warn); font-size: 1.05rem; }
.requests-strip ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.requests-strip a { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; text-decoration: none; padding: 6px 0; }
.requests-strip a:hover strong { text-decoration: underline; }
.requests-strip .icon { margin-left: auto; }

.homes { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.home-card {
  display: grid; gap: 22px; padding: 22px 22px 0; text-decoration: none; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  transition: border-color .15s;
}
.home-card:hover { border-color: var(--forest); }
.home-card-addr { display: grid; gap: 4px; justify-items: start; }
.home-card h3 { font-size: 1.35rem; font-stretch: 118%; font-weight: 700; }
.home-card p { color: var(--muted); }

/* Le classeur miniature : six onglets alignés au bas de la carte. */
.mini-binder { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; align-items: end; margin: 0 -1px; }
.mini-tab {
  display: grid; gap: 2px; padding: 8px 6px 10px; border-radius: 8px 8px 0 0;
  background: var(--drawer); color: #fff; min-height: 64px; align-content: end;
}
.mini-tab.empty { background: color-mix(in srgb, var(--drawer) 18%, var(--surface)); color: var(--drawer); min-height: 44px; }
.mini-n { font-weight: 700; font-stretch: 120%; font-size: 1.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.mini-l { font-size: .66rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mini-tab:not(.empty) { color: #0F1612; } }

.vault-strip {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
}
.vault-strip:hover { border-color: var(--forest); }
.vault-strip > div { flex: 1; display: grid; gap: 2px; }
.vault-strip p { color: var(--muted); }
.vault-strip > .icon:first-child { color: var(--forest); }
.home-foot { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }

/* ------------------------------------------------------------------ Logement : le classeur */

.page.property { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 28px; }
.binder { min-width: 0; }
.binder-tabs { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; scrollbar-width: none; padding-top: 8px; }
.binder-tabs::-webkit-scrollbar { display: none; }
.binder-tab {
  flex: 1 1 0; display: grid; justify-items: start; align-content: end; gap: 2px; min-width: 0;
  padding: 10px 14px 9px; border: 0; border-radius: 10px 10px 0 0; cursor: pointer; text-align: left;
  background: color-mix(in srgb, var(--drawer) 14%, var(--surface));
  color: var(--ink); border-top: 4px solid var(--drawer);
  transition: padding .15s, background-color .15s;
}
.binder-tab:hover { background: color-mix(in srgb, var(--drawer) 24%, var(--surface)); }
.binder-tab.selected { background: var(--drawer); color: #fff; padding-top: 16px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .binder-tab.selected { color: #0F1612; } }
.tab-label { font-weight: 650; font-size: .88rem; line-height: 1.2; }
.tab-short { display: none; }
@media (max-width: 1360px) and (min-width: 861px) { .tab-full { display: none; } .tab-short { display: inline; } }
.tab-count { font-stretch: 120%; font-weight: 700; font-size: 1.25rem; line-height: 1; font-variant-numeric: tabular-nums; opacity: .85; }
.binder-panel {
  background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--drawer);
  border-radius: 0 0 var(--radius-l) var(--radius-l); padding: 22px 22px 14px; display: grid; gap: 18px;
}
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.4rem; font-stretch: 118%; font-weight: 700; color: var(--drawer); }
.binder-panel .empty { border-color: color-mix(in srgb, var(--drawer) 35%, var(--line)); }
.items { list-style: none; margin: 0; padding: 0; }
.items li + li { border-top: 1px solid var(--line); }
.item-row {
  display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 14px;
  padding: 13px 4px; text-decoration: none; border-radius: var(--radius-s);
}
.item-row:hover { background: var(--surface-2); }
.item-date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .88rem; }
.item-main { display: grid; min-width: 0; }
.item-main strong { font-weight: 600; }
.item-meta { color: var(--muted); font-size: .88rem; }

.side { display: grid; gap: 14px; position: sticky; top: 16px; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 16px; display: grid; gap: 6px; }
.side-card h2 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.side-head { display: flex; justify-content: space-between; align-items: center; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px 8px; margin: 0 -8px; text-decoration: none; border-radius: var(--radius-s); }
.side-link:hover { background: var(--surface-2); }
.side-link > .icon:first-child { color: var(--forest); }
.side-link-text { flex: 1; display: grid; min-width: 0; }
.side-link-text strong { font-weight: 600; font-size: .95rem; }
.side-link-text span { color: var(--muted); font-size: .82rem; }
.side-vault { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.side-vault > span { flex: 1; display: grid; }
.side-vault > span > span { color: var(--muted); font-size: .85rem; }
.side-vault > .icon:first-child { color: var(--forest); }
.side-vault:hover { border-color: var(--forest); }
.key-card { background: var(--forest-soft); }
.rooms { list-style: none; margin: 0; padding: 0; }
.rooms li { display: flex; justify-content: space-between; padding: 6px 0; font-size: .95rem; }
.rooms li + li { border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ Élément, bien, fichiers */

.detail[data-drawer] .facts { border-left: 5px solid var(--drawer); }
.facts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px 24px; margin: 0;
  padding: 18px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
}
.facts dt { font-size: .82rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.files { display: grid; gap: 14px; padding: 18px 22px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.files.dragging, .picker.dragging { outline: 2px dashed var(--forest); outline-offset: 4px; }
.files.uploading { opacity: .8; }
.add-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.upload-status:empty { display: none; }
.upload-status { color: var(--forest); font-weight: 600; }
.drop-hint { margin-top: -4px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.gallery-empty { grid-column: 1 / -1; }
.tile { margin: 0; display: grid; gap: 6px; position: relative; }
.tile > a { text-decoration: none; }
.thumb {
  aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-pdf { font-weight: 800; font-stretch: 125%; color: var(--danger); letter-spacing: .05em; font-size: 1.1rem; }
.thumb-wait { width: 30%; height: 4px; border-radius: 4px; background: var(--line); }
.tile figcaption { display: grid; font-size: .85rem; padding-right: 36px; }
.tile-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .icon-btn { position: absolute; right: -6px; bottom: -4px; color: var(--muted); }
.danger-zone { display: flex; justify-content: flex-end; }

.picker { display: grid; gap: 8px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--radius); }
.picked { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.picked:empty { display: none; }
.picked li { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.picked li span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked .icon-btn { width: 30px; height: 30px; }

/* ------------------------------------------------------------------ Coffre */

.vault-hero {
  display: grid; gap: 6px; padding: 28px; border-radius: var(--radius-l);
  background: #0A1D13; color: #E6EEE9; position: relative; overflow: hidden;
}
.vault-hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 26px solid transparent; border-top-color: #4BDB6C; border-right-color: #1FCFC3; opacity: .55;
}
.vault-label { color: #A8BBB0; }
.vault-total { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 750; font-stretch: 122%; line-height: 1.05; font-variant-numeric: tabular-nums; }
.vault-sub { color: #C9D6CE; }
.vault-warn { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius); background: rgba(245, 196, 107, .14); color: #F5D08F; max-width: 60ch; }
.vault-note { margin-top: 8px; font-size: .88rem; color: #8FA398; max-width: 60ch; }
.asset-group { display: grid; gap: 8px; }
.asset-group-head { display: flex; justify-content: space-between; align-items: baseline; }
.asset-group-head span { font-weight: 650; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--forest); border-radius: 6px; }

/* ------------------------------------------------------------------ QR code */

.page.qr { grid-template-columns: minmax(240px, 380px) minmax(0, 1fr); align-items: start; gap: 36px; }
.sticker { margin: 0; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-l); }
.qr-side { display: grid; gap: 22px; max-width: 520px; }
.qr-side section { display: grid; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.link { display: block; padding: 10px 12px; border-radius: var(--radius-s); background: var(--surface-2); font-size: .85rem; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Partage */

.request, .grant {
  display: grid; gap: 10px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-l);
}
.request { grid-template-columns: 48px 1fr; gap: 16px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--forest-soft); color: var(--forest); font-weight: 700; font-stretch: 115%;
}
.request-body { display: grid; gap: 6px; }
.reason { font-style: italic; }
.past summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.past[open] { display: grid; gap: 12px; }
.grant.inactive { opacity: .7; }
.grant-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grant-head h3 { flex: 1; }
.grant-drawers { display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-chip {
  padding: 3px 10px; border-radius: 6px; font-size: .82rem; font-weight: 600;
  background: color-mix(in srgb, var(--drawer, var(--muted)) 15%, var(--surface)); color: var(--drawer, var(--muted));
  border-left: 3px solid var(--drawer, var(--muted));
}
.scope fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 14px; }

.audit-day { display: grid; gap: 6px; }
.audit-day h2 { font-size: .95rem; color: var(--muted); font-weight: 600; font-stretch: 100%; }
.audit-day h2::first-letter { text-transform: uppercase; }
.audit-day ol { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.audit-day li { display: grid; grid-template-columns: 56px 1fr; gap: 0 12px; padding: 10px 14px; }
.audit-day li + li { border-top: 1px solid var(--line); }
.audit-day time { color: var(--muted); font-variant-numeric: tabular-nums; grid-row: span 2; }
.audit-action { font-weight: 600; }
.audit-day li .muted { font-size: .88rem; }

.handover { gap: 16px; }
.handover form { display: grid; max-width: 400px; }
.warn-text { padding: 12px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); }
.big-code { font-size: 2.6rem; font-weight: 750; font-stretch: 122%; letter-spacing: .08em; text-align: center; padding: 12px; background: var(--surface-2); border-radius: var(--radius); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Professionnel */

.pro-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
  padding: 24px; border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line);
}
.pro-hero > div:first-child { display: grid; gap: 8px; max-width: 56ch; }
.pro-hero p { color: var(--muted); }
.pro-actions { display: grid; gap: 8px; }
.pro section { display: grid; gap: 12px; }
.pro .row { flex-wrap: wrap; }
.pro-foot { padding-top: 18px; border-top: 1px solid var(--line); justify-items: start; }
.request-intro { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--radius-l); background: var(--forest-soft); }
.request-intro .icon { color: var(--forest); }
.stack { display: grid; gap: 4px; }
.stack > .btn { justify-self: start; }
.scan-frame { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 60vh; }
.scan-video { width: 100%; height: 100%; object-fit: cover; }
.scan-target { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; }

.account form { display: grid; }
.account form .btn { justify-self: start; }
.account ul { margin: 0; padding-left: 18px; }

/* ------------------------------------------------------------------ Petits écrans */

@media (max-width: 1080px) {
  .page.property { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar {
    position: sticky; top: 0; z-index: 20; padding: 10px 16px; gap: 10px;
    background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .demo-banner + .shell .topbar { top: 30px; }
  .top-brand { display: block; flex: none; }
  .top-brand img { border-radius: 50%; }
  .top-title h1 { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top-kicker { font-size: .8rem; }
  .top-actions .btn span { display: none; }
  .top-actions .btn { padding: 0 10px; }
  main { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar .nav-link { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: .72rem; justify-content: center; position: relative; }
  .tabbar .nav-link.active { background: transparent; }
  .tabbar .dot { position: absolute; top: 4px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: #D9443A; }
  .homes { grid-template-columns: 1fr; }
  .shell { background: none; }
  #toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .vault-strip .tag { display: none; }
  .requests-strip a { display: grid; grid-template-columns: 1fr auto; }
  .requests-strip a > span { grid-column: 1; }
  .requests-strip a .icon { grid-row: 1 / span 3; grid-column: 2; align-self: center; }
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 20px; gap: 20px; }
  .login-pitch .pitch-points { display: none; }
  .pitch { font-size: 1.1rem; }
  .login-side { padding: 28px 20px 40px; justify-content: flex-start; }
  .page.qr { grid-template-columns: 1fr; }
  .sticker { max-width: 340px; }
  .pro-hero { grid-template-columns: 1fr; }
  .binder-panel { padding: 18px 14px 10px; }
  .item-row { grid-template-columns: 1fr auto; }
  .item-date { grid-column: 1; grid-row: 2; font-size: .8rem; }
  .item-main { grid-column: 1; grid-row: 1; }
  .item-row .icon { grid-row: span 2; }
  .binder-tab { flex: 1 0 auto; min-width: 92px; padding: 8px 10px 7px; }
  .tab-label { white-space: nowrap; }
  .binder-tab.selected { padding-top: 12px; }
  .request { grid-template-columns: 1fr; }
  .avatar { display: none; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .dialog { max-height: calc(100vh - 16px); }
  .dialog footer .btn { flex: 1; }
  .facts { padding: 14px 16px; }
  .files { padding: 14px 16px; }
}

@media print {
  .sidebar, .tabbar, .topbar, .demo-banner { display: none; }
}

.lightbox { width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius); background: var(--surface-2); }
