/* Locataire+ 2.0 — composants propres à chaque écran */

/* ---------- Utilitaires ---------- */
.gap-b { margin-bottom: var(--s5); }
.gap-t { margin-top: var(--s6); }
.note-gap { margin-bottom: var(--s4); }
.fine { margin-top: var(--s3); color: var(--muted); font-size: var(--t-xs); line-height: 1.5; }
.sep { height: 1px; margin: var(--s5) 0; border: 0; background: var(--line); }
.item__body { min-width: 0; }
.item__btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--s3); }
.item--rich { align-items: start; }
.item--rich .item__aside { padding-top: 2px; }
.pill--icon { display: inline-flex; align-items: center; gap: 6px; }
.unread-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 3px var(--violet-wash); }
.calc { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-ctl); background: var(--violet-wash); color: var(--ink-2); font-size: var(--t-sm); }
.calc strong { font: 800 var(--t-xl)/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Accueil ---------- */
.home { display: grid; gap: var(--s8); }
.home__main { display: grid; gap: var(--s6); align-content: start; }
.home__main > .sec { margin-top: 0; }
.home__aside { display: grid; gap: var(--s8); align-content: start; }
.home__aside > .sec { margin-top: 0; }
#homeAdd { display: none; } /* sur mobile, le bouton + de la barre suffit */
@media (min-width: 1024px) {
  .home { grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: var(--s10); }
  #homeAdd { display: block; }
}
@media (min-width: 640px) and (max-width: 1023px) { #homeAdd { display: block; } .shortcuts { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Étapes numérotées : la séquence est réelle (configuration, installation) */
.steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { position: relative; display: grid; gap: 2px; padding: 0 0 var(--s4) 44px; counter-increment: step; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 30px; height: 30px;
  border-radius: 50%; background: var(--violet-wash); color: var(--violet-ink); font: 750 var(--t-sm)/1 var(--font-display);
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 14px; top: 32px; bottom: 4px; width: 2px; background: var(--line); }
.steps strong { font-weight: 650; }
.steps span { color: var(--muted); font-size: var(--t-sm); }
.steps--compact li { padding-bottom: var(--s3); padding-left: 40px; }
.steps--compact li::before { width: 26px; height: 26px; font-size: var(--t-xs); }
.steps--compact li:not(:last-child)::after { left: 12px; top: 28px; }

/* ---------- Propriétaire ---------- */
.contact { display: grid; gap: var(--s5); }
.contact__who { display: flex; align-items: center; gap: var(--s4); }
.contact__who strong { display: block; font: 700 var(--t-lg)/1.2 var(--font-display); }
.contact__who div > span { display: block; color: var(--muted); font-size: var(--t-sm); }
.contact__badge { display: grid; place-items: center; flex: 0 0 56px; width: 56px; height: 56px; border-radius: 16px; background: var(--ink); color: var(--paper); font: 750 1.25rem/1 var(--font-display); }
.contact__lines { display: grid; gap: var(--s3); margin: 0; }
.contact__lines > div { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: var(--s3); align-items: center; }
.contact__lines dt { display: flex; color: var(--muted); }
.contact__lines dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Progression et listes à cocher ---------- */
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.progress-head .panel__title { margin-bottom: 0; }
.progress-num { font: 800 var(--t-xl)/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--violet-ink); }
.bar { height: 8px; margin: var(--s3) 0 var(--s4); border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--violet); transition: width .4s var(--ease); }
.checks { display: grid; margin: 0; padding: 0; list-style: none; }
.checks li + li { border-top: 1px solid var(--line); }
.check { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); width: 100%; padding: 12px 2px; border: 0; background: none; text-align: left; color: var(--ink); }
.check__box { display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid var(--line-strong); border-radius: 7px; color: #fff; }
.check.is-done .check__box { border-color: var(--green); background: var(--green); }
.check.is-done > span:nth-child(2) { color: var(--muted); }
.check__state { color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.check.is-done .check__state { color: var(--green-text); }
.check:hover .check__box { border-color: var(--violet); }
.check.is-done:hover .check__box { border-color: var(--green); }
.pair { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* ---------- Chronologie ---------- */
.tl { margin: 0; padding: 0; list-style: none; }
.tl__month { margin: var(--s6) 0 var(--s2); font: 700 var(--t-lg)/1.2 var(--font-display); }
.tl__month:first-child { margin-top: 0; }
.tl__item { position: relative; display: grid; grid-template-columns: 32px 30px minmax(0, 1fr); align-items: start; gap: var(--s3); width: 100%; padding: 8px 6px 14px; border: 0; border-radius: var(--r-tile); background: none; color: var(--ink); text-align: left; }
.tl__item:hover { background: var(--surface); }
.tl__item::before { content: ""; position: absolute; left: 58px; top: 40px; bottom: -6px; width: 2px; background: var(--line); }
.tl li:last-child .tl__item::before, .tl li:has(+ .tl__month) .tl__item::before { display: none; }
.tl__day { padding-top: 5px; font: 750 var(--t-lg)/1 var(--font-display); text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tl__dot { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--violet-wash); color: var(--violet-ink); }
.tl__body { padding-top: 4px; }
.tl__body strong { display: block; font-weight: 650; overflow-wrap: anywhere; }
.tl__body small { display: block; color: var(--muted); font-size: var(--t-sm); }

/* ---------- Compteurs ---------- */
.meters { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.meter { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5); border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.meter__head { display: flex; align-items: center; gap: var(--s3); }
.meter__head h2 { font-size: var(--t-lg); }
.meter__head small { color: var(--muted); font-size: var(--t-xs); }
.meter__value { margin-top: var(--s3); font-size: var(--t-sm); color: var(--muted); }
.meter__value strong { font: 800 2.25rem/1 var(--font-display); font-stretch: 85%; color: var(--ink); letter-spacing: -.01em; }
.meter__date, .meter__none { font-size: var(--t-sm); }
.meter__none { margin: var(--s3) 0 var(--s2); }
.meter__hist { width: 100%; margin-top: var(--s2); border-collapse: collapse; font-size: var(--t-sm); }
.meter__hist td { padding: 6px 0; border-top: 1px solid var(--line); color: var(--ink-2); }
.meter__hist td + td { text-align: right; }
.meter .btn { margin-top: auto; }
.meter__value + .meter__date + .btn, .meter__none + .btn, .meter__hist + .btn { margin-top: var(--s3); }

/* ---------- Documents ---------- */
.docs { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
@media (max-width: 520px) { .docs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.doc { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.doc__open { display: flex; flex-direction: column; flex: 1; gap: 2px; padding: 0 0 var(--s3); border: 0; background: none; color: var(--ink); text-align: left; }
.doc__visual { display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: var(--s2); background: var(--surface-2); overflow: hidden; }
.doc__visual img { width: 100%; height: 100%; object-fit: cover; }
.doc__glyph { position: relative; display: grid; place-items: center; width: 64px; height: 80px; border-radius: 6px 18px 6px 6px; background: var(--surface); color: var(--violet-ink); box-shadow: 0 1px 0 var(--line-strong), 0 6px 16px -10px rgba(23, 23, 37, .4); }
.doc__glyph span { position: absolute; bottom: 8px; font: 750 10px/1 var(--font-text); letter-spacing: .04em; color: var(--muted); }
.doc__name, .doc__meta, .doc__warn, .doc__open .linked { padding: 0 var(--s3); }
.doc__name { font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.doc__meta { color: var(--muted); font-size: var(--t-xs); }
.doc__warn { margin-top: 4px; color: var(--orange-text); font-size: var(--t-xs); font-weight: 600; }
.doc__open:hover .doc__name { color: var(--violet-ink); }
.doc__tools { display: flex; justify-content: flex-end; gap: 2px; padding: 0 4px 4px; border-top: 1px solid var(--line); }
.doc__tools .icon-btn { width: 38px; height: 38px; flex-basis: 38px; }

/* ---------- Photos ---------- */
.photos { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
@media (max-width: 520px) { .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.photo { position: relative; margin: 0; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.photo__open { display: block; width: 100%; padding: 0; border: 0; background: var(--surface-2); }
.photo__open img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo figcaption { padding: 10px var(--s3) var(--s3); padding-right: 44px; }
.photo figcaption strong { display: block; font-size: var(--t-sm); overflow-wrap: anywhere; }
.photo figcaption small { display: block; color: var(--muted); font-size: var(--t-xs); }
.photo__del { position: absolute; right: 2px; bottom: 4px; width: 38px; height: 38px; flex-basis: 38px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }

/* ---------- Scanner ---------- */
.scan { display: grid; gap: var(--s6); align-items: center; padding: var(--s6); border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--line); }
@media (min-width: 720px) { .scan { grid-template-columns: 220px minmax(0, 1fr); } }
.scan__frame { position: relative; display: grid; place-items: center; width: 100%; max-width: 220px; aspect-ratio: 3 / 4; margin: 0 auto; border-radius: 14px; background: var(--violet-wash); color: var(--violet-ink); }
.scan__frame span { position: absolute; width: 34px; height: 34px; border: 4px solid var(--violet); }
.scan__frame span:nth-child(1) { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.scan__frame span:nth-child(2) { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.scan__frame span:nth-child(3) { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.scan__frame span:nth-child(4) { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.scan__text h2 { font-size: var(--t-xl); }
.scan__text p { margin-top: var(--s2); color: var(--muted); max-width: 52ch; }
.scan-preview { display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 120px; padding: var(--s3); border-radius: var(--r-ctl); background: var(--surface-2); color: var(--muted); font-size: var(--t-sm); }
.scan-preview img { max-height: 260px; width: auto; border-radius: 8px; }

/* ---------- Courriers ---------- */
.templates { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.template { display: grid; gap: 4px; padding: var(--s4); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: left; }
.template strong { font: 700 1.0625rem/1.25 var(--font-display); }
.template span { color: var(--muted); font-size: var(--t-sm); line-height: 1.45; }
.template:hover { border-color: var(--violet); }
.template:hover strong { color: var(--violet-ink); }

/* ---------- Agenda ---------- */
.cal { padding: var(--s4); }
@media (min-width: 640px) { .cal { padding: var(--s5); } }
.cal__head { display: flex; align-items: center; gap: 2px; margin-bottom: var(--s3); }
.cal__month { flex: 1; text-align: center; font-size: var(--t-lg); white-space: nowrap; }
.cal__today { margin-left: var(--s2); }
.cal .pills { margin-bottom: var(--s4); }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal__dow { padding-bottom: 6px; text-align: center; color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.cal__day {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px;
  height: 48px; padding: 6px 0 0; border: 0; border-radius: 12px; background: none; color: var(--ink);
  font: 600 var(--t-sm)/1.2 var(--font-text); font-variant-numeric: tabular-nums;
}
.cal__day:hover { background: var(--surface-2); }
.cal__day.is-today span { display: grid; place-items: center; width: 26px; height: 26px; margin-top: -3px; border-radius: 50%; background: var(--violet-wash); color: var(--violet-ink); font-weight: 750; }
.cal__day.is-selected { background: var(--ink); color: var(--paper); }
.cal__day.is-selected.is-today span { background: transparent; color: var(--paper); }
.cal__dots { display: flex; gap: 3px; font-style: normal; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.dot--rent { background: var(--violet); }
.dot--reminder { background: var(--orange); }
.dot--intervention { background: var(--green); }
.cal__day.is-selected .dot { box-shadow: 0 0 0 1.5px var(--ink); }
.cal__legend { display: flex; flex-wrap: wrap; gap: var(--s4); margin-top: var(--s4); color: var(--muted); font-size: var(--t-xs); }
.cal__legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal__legend .dot { width: 8px; height: 8px; }

/* ---------- Infos et assistant ---------- */
.topics { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.topic { display: flex; gap: var(--s3); padding: var(--s4); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; }
.topic:hover { border-color: var(--violet); }
.topic strong { display: block; font: 700 1.0625rem/1.25 var(--font-display); }
.topic > span:last-child > span { display: block; margin-top: 4px; color: var(--muted); font-size: var(--t-sm); line-height: 1.45; }
.topic small { display: inline-flex; align-items: center; gap: 4px; margin-top: var(--s2); color: var(--violet-ink); font-weight: 650; font-size: var(--t-xs); }
.topic .item__icon { flex: 0 0 36px; }

.chat { display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); }
@media (min-width: 900px) { .chat { min-height: 520px; } }
.chat__log { display: flex; flex-direction: column; gap: var(--s3); max-height: 56vh; overflow-y: auto; padding: 2px; }
.bubble { max-width: 88%; padding: var(--s3) var(--s4); border-radius: 18px; font-size: .9375rem; line-height: 1.5; }
.bubble p + p, .bubble ol, .bubble p + .btn, .bubble ol + .btn { margin-top: var(--s2); }
.bubble ol { padding-left: 1.2em; margin-bottom: 0; }
.bubble--ai { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.bubble--me { align-self: flex-end; background: var(--violet); color: #fff; border-bottom-right-radius: 6px; }
.chat__prompts { margin-top: auto; }
.chat__form { display: flex; gap: var(--s2); }
.chat__form .btn { flex: 0 0 46px; padding: 0; }

/* ---------- Profil et réglages ---------- */
.me { display: flex; align-items: center; gap: var(--s4); }
.me h2 { font-size: var(--t-xl); overflow-wrap: anywhere; }
.me__photo { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; }
.avatar--xl { width: 76px; height: 76px; font-size: 1.5rem; }
.me__edit { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--violet); color: #fff; box-shadow: 0 0 0 3px var(--surface); }
.me-edit { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); }
.me-edit .row-actions { margin-top: 0; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { box-shadow: var(--focus); }

.switch { position: relative; display: inline-block; width: 46px; height: 28px; border-radius: 14px; background: var(--line-strong); transition: background-color .2s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
[aria-checked="true"] .switch { background: var(--violet); }
[aria-checked="true"] .switch::after { transform: translateX(18px); }

.account { display: flex; gap: var(--s3); align-items: flex-start; }
.account .item__icon { flex: 0 0 36px; }
.account strong { display: block; font-weight: 650; }
.account .muted { display: block; font-size: var(--t-sm); overflow-wrap: anywhere; }
.account__sync { display: block; margin-top: 4px; color: var(--green-text); font-size: var(--t-xs); font-weight: 600; }
.account__sync.is-pending { color: var(--orange-text); }
.auth-btns { display: grid; gap: var(--s2); margin-top: var(--s4); }
.google__g { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(#EA4335 0 25%, #FBBC05 0 50%, #34A853 0 75%, #4285F4 0); color: #fff; font: 800 13px/1 var(--font-text); }
.auth-switch { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); margin-top: var(--s4); color: var(--muted); font-size: var(--t-sm); }
.diag { margin-top: var(--s4); border-top: 1px solid var(--line); padding-top: var(--s3); font-size: var(--t-sm); }
.diag summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.diag summary:focus-visible { border-radius: 6px; }
.diag ul { margin: var(--s2) 0 var(--s3); padding-left: 1.2em; color: var(--ink-2); }
.diag li + li { margin-top: 2px; }
.diag pre { max-height: 220px; overflow: auto; margin: var(--s2) 0; padding: var(--s3); border-radius: 10px; background: var(--surface-2); font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.diag__err { margin-top: var(--s2); padding: var(--s2) var(--s3); border-radius: 10px; background: var(--red-wash); color: var(--red-text); }
.about { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s8); color: var(--muted); font-size: var(--t-sm); }

/* ---------- Choix de version (synchronisation) ---------- */
.pick { display: grid; gap: var(--s2); }
.pick__opt { display: flex; gap: var(--s3); padding: var(--s4); border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: left; }
.pick__opt:hover { border-color: var(--violet); background: var(--violet-wash); }
.pick__opt .item__icon { flex: 0 0 36px; }
.pick__opt strong { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-weight: 650; }
.pick__opt > span:last-child > span { display: block; margin-top: 2px; color: var(--muted); font-size: var(--t-sm); }
.pick__opt strong .chip { margin-top: 0; }

/* Liste de départ : case + libellé, puis lien vers l’écran concerné */
.checkrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.checkrow .check { grid-template-columns: auto minmax(0, 1fr); }
.check small { display: block; margin-top: 1px; color: var(--muted); font-size: var(--t-xs); font-weight: 500; }
.checkrow .icon-btn { color: var(--faint); }

@media (max-width: 420px) {
  .cal { padding: var(--s3); }
  .cal__month { font-size: var(--t-md); }
  .cal__today { margin-left: 4px; padding: 0 10px; }
  .cal__grid { gap: 2px; }
}
