
:root, [data-theme="clair"] {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f1f3f6; --border: #e4e7ec;
  --text: #101828; --muted: #667085;
  --accent: #4f46e5; --accent-ink: #ffffff; --accent-text: #4338ca;
  --side-bg: #ffffff; --side-text: #475467; --side-border: #e4e7ec;
  --ok: #12805c; --warn: #b54708; --bad: #c0362c; --star: #f5a400;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
}
[data-theme="nuit"] {
  --bg: #0f1218; --surface: #181c25; --surface-2: #212633; --border: #2b3140;
  --text: #eef0f4; --muted: #98a2b3;
  --accent: #7c83ff; --accent-ink: #0f1218; --accent-text: #a5abff;
  --side-bg: #131720; --side-text: #b3bccb; --side-border: #232836;
  --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --star: #fbbf24;
  --shadow: none;
}
[data-theme="chantier"] {
  --bg: #f4f1ea; --surface: #ffffff; --surface-2: #f3efe5; --border: #e2dccd;
  --text: #1c1a17; --muted: #6f6a5f;
  --accent: #f5b400; --accent-ink: #1c1a17; --accent-text: #8a6100;
  --side-bg: #1c1a17; --side-text: #cfc8b8; --side-border: #1c1a17;
  --ok: #12805c; --warn: #b54708; --bad: #c0362c; --star: #f5a400;
  --shadow: 0 1px 2px rgba(28,26,23,.06);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.stack, .grid > * { min-width: 0; }
.card { overflow-x: auto; }

/* Barre latérale */
aside {
  background: var(--side-bg); border-right: 1px solid var(--side-border); color: var(--side-text);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; padding: 0 8px 18px; color: var(--side-text); }
[data-theme="clair"] .brand { color: var(--text); }
[data-theme="nuit"] .brand, [data-theme="chantier"] .brand { color: #fff; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.nav {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; color: inherit; font: inherit; font-weight: 500;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
}
.nav svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nav.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); font-weight: 600; }
[data-theme="chantier"] .nav.active { color: var(--accent); }
.count { margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11.5px; font-weight: 700; padding: 0 7px; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid color-mix(in srgb, var(--side-text) 18%, transparent); }
.themes { display: flex; gap: 8px; margin-bottom: 14px; }
.themes button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; outline: 1px solid color-mix(in srgb, var(--side-text) 35%, transparent); }
.themes button.on { border-color: var(--side-bg); outline: 2px solid var(--accent); }
.who-box { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
[data-theme="chantier"] .avatar { color: var(--accent); }
.who-box small { display: block; opacity: .7; font-size: 12px; }

/* Contenu */
main { padding: 28px 32px 60px; max-width: 1120px; width: 100%; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; }
.sub { color: var(--muted); margin: 2px 0 0; }

.grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 15.5px; margin: 0 0 4px; letter-spacing: -.01em; }
.card .desc { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.card h2 + table, .card h2 + form, .card h2 + div { margin-top: 12px; }

label.f { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; background: var(--surface); color: var(--text);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 0; border-color: var(--accent); }
::placeholder { color: var(--muted); opacity: .75; }

.btn { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; font: inherit; font-weight: 600; cursor: pointer; background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(.94); }
.btn.full { width: 100%; margin-top: 16px; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.btn.no { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.linkbtn { background: none; border: 0; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.bubble { background: var(--surface); border-radius: 14px 14px 14px 4px; padding: 10px 12px; border: 1px solid var(--border); font-size: 13.5px; }
.bubble a { color: var(--accent-text); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--border); }
td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.small:not(.btn) { font-size: 12.5px; color: var(--muted); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.wait, .pill.late { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.pill.sent { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); }
.pill.done { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.pill.lost { background: color-mix(in srgb, var(--bad) 13%, transparent); color: var(--bad); }
.stars { color: var(--star); letter-spacing: 1px; }
.stars i { color: var(--border); font-style: normal; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.actions.left { justify-content: flex-start; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { left: 20px; }

.qr { display: flex; gap: 16px; align-items: center; }
.qr svg { width: 108px; height: 108px; flex: none; border-radius: 10px; padding: 7px; background: #fff; border: 1px solid var(--border); }
.qr p { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; }

.review { border-bottom: 1px solid var(--border); padding: 16px 0; }
.review:first-child { padding-top: 4px; }
.review:last-child { border-bottom: 0; padding-bottom: 0; }
.review .head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.review textarea { margin-bottom: 8px; }

/* Import de devis */
.step { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.num { width: 24px; height: 24px; border-radius: 50%; flex: none; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; margin-top: 1px; }
.step b { display: block; }
.step p { margin: 2px 0 10px; color: var(--muted); font-size: 13.5px; }
.addr { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 8px 8px 8px 12px; margin-bottom: 8px; }
.addr code { font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.drop { display: block; border: 1.5px dashed color-mix(in srgb, var(--accent) 55%, var(--border)); border-radius: 12px; padding: 18px 12px; text-align: center; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.drop:hover, .drop.over { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.drop strong { color: var(--accent-text); display: block; }
.drop input { display: none; }
.pending { border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); border-radius: 12px; padding: 14px; margin-top: 12px; }
.pending .src { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.pending .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.pending .fields label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; }
.pending .fields input { padding: 7px 10px; margin-top: 3px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #101828; color: #fff; padding: 12px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: .25s; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 90vw; z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.note { margin-top: 26px; font-size: 12.5px; color: var(--muted); }
.hidden { display: none !important; }

@media (max-width: 1180px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  aside { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; border-right: 0; border-bottom: 1px solid var(--side-border); }
  .brand { padding: 0 8px 0 4px; }
  .nav { width: auto; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .who-box { display: none; }
  .themes { margin: 0; }
  main { padding: 20px 16px 50px; }
  .grid { grid-template-columns: 1fr; }
}

/* --- Ajouts pour la vraie app --- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 400px; }
.auth .brand { color: var(--text) !important; padding: 0 0 14px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.auth-tabs button { flex: 1; padding: 8px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.auth-tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.err { color: var(--bad); font-size: 13.5px; margin-top: 10px; min-height: 20px; }
.qr img { width: 120px; height: 120px; flex: none; border-radius: 10px; background: #fff; border: 1px solid var(--border); }
.empty { color: var(--muted); padding: 18px 4px; text-align: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.logout { margin-top: 10px; }
input[type=password], input[type=tel] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; background: var(--surface); color: var(--text);
}
a.btn { display: inline-block; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border)); border-radius: 12px; padding: 10px 14px; margin-bottom: 18px; font-weight: 500; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 13.5px; }
.check input { margin-top: 3px; }
a { color: var(--accent-text); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .5; }

/* ===== Refonte : écrans plus simples, pensés en premier pour le téléphone ===== */
body { font-size: 15.5px; }
main { max-width: 960px; }
h1 { font-size: 26px; }
.sub { font-size: 15.5px; }
.card h2, .titre-liste { font-size: 17px; }
.titre-liste { margin: 0 0 10px; letter-spacing: -.01em; }
.card .desc { font-size: 14.5px; }
label.f { font-size: 14px; }
.help { font-size: 13.5px; }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=tel], input:not([type]), select, textarea { padding: 12px 13px; font-size: 16px; }
.btn { padding: 11px 16px; font-size: 15px; min-height: 44px; }
.btn.small { min-height: 0; padding: 8px 12px; font-size: 14px; }
.btn.ghost { border-color: var(--border); }
.linkbtn.discret { color: var(--muted); font-weight: 500; font-size: 13.5px; text-decoration: underline; padding: 6px 4px; }
.linkbtn.discret:hover { color: var(--bad); }
.pill { font-size: 13px; padding: 3px 10px; }
.empty { background: var(--surface); border: 1px dashed var(--border); border-radius: 14px; padding: 22px 14px; }
.count { display: inline-block; min-width: 20px; text-align: center; }
.side-foot .who-box { margin-bottom: 4px; }
.mobile-top { display: none; }
nav.bas { display: none; }

/* Accueil */
.gros { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gros-btn, .choix-btn { display: flex; align-items: center; gap: 14px; text-align: left; font: inherit; cursor: pointer; border-radius: 16px; padding: 18px; min-height: 76px; }
.gros-btn { background: var(--accent); color: var(--accent-ink); border: 0; box-shadow: var(--shadow); }
.gros-btn:hover { filter: brightness(.95); }
.gros-btn svg, .choix-btn svg { width: 30px; height: 30px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gros-btn b, .choix-btn b { display: block; font-size: 16.5px; }
.gros-btn small, .choix-btn small { display: block; font-size: 13.5px; opacity: .8; }
.guide { border: 2px solid var(--accent); }
.etape { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.etape:first-of-type { border-top: 0; }
.etape .rond { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.etape.encours .rond { background: var(--accent); color: var(--accent-ink); }
.etape.faite .rond { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.etape.faite b { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.etape .corps { min-width: 0; flex: 1; }
.etape .corps p { margin: 2px 0 10px; color: var(--muted); font-size: 14.5px; }
.etape:not(.encours):not(.faite) { opacity: .65; }
.ligne-champ { display: flex; gap: 8px; }
.ligne-champ input { flex: 1; min-width: 0; }
details.aide, details.apercu { margin-top: 12px; font-size: 14.5px; }
details.aide summary, details.apercu summary { cursor: pointer; color: var(--accent-text); font-weight: 600; }
details.aide ol { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }
details.aide p { color: var(--muted); margin: 8px 0 0; }
details.apercu .bubble { margin-top: 10px; }
.tache { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.tache:first-child { border-top: 0; padding-top: 4px; }
.tache > div { min-width: 0; }
.tache b, .rien b { display: block; }
.tache small, .rien small { display: block; color: var(--muted); font-size: 13.5px; }
.tache .btn { flex: none; }
.rien { display: flex; align-items: center; gap: 14px; padding: 6px 0; }
.rien > span { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); font-weight: 700; font-size: 18px; }
.auto-info { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--muted); font-size: 14px; }
.auto-info p { margin: 0; }
.auto-info p + p { margin-top: 6px; }
.resume { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tuile { text-align: left; font: inherit; color: var(--text); cursor: pointer; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.tuile:hover { border-color: var(--accent); }
.tuile small { display: block; color: var(--muted); font-size: 13.5px; }
.tuile b { display: block; font-size: 30px; letter-spacing: -.02em; line-height: 1.2; }
.tuile span { display: block; font-size: 13.5px; color: var(--ok); font-weight: 500; }

/* Devis et avis : des fiches plutôt que des tableaux */
.choix { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choix-btn { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.choix-btn:hover, .choix-btn.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.choix-btn svg { color: var(--accent-text); }
.choix-btn input { display: none; }
.choix-btn.occupe { opacity: .6; pointer-events: none; }
.sous-form { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--border); }
.filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filtres button { font: inherit; font-weight: 600; font-size: 14.5px; cursor: pointer; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.filtres button span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.filtres button.on { background: var(--side-bg); color: #fff; border-color: var(--side-bg); }
[data-theme="clair"] .filtres button.on { background: var(--accent); border-color: var(--accent); }
.filtres button.on span { color: inherit; opacity: .75; }
.liste { display: grid; gap: 12px; }
.fiche { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.fiche-haut { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.fiche .qui { min-width: 0; }
.fiche .qui b { display: block; font-size: 16.5px; }
.fiche .qui small { display: block; color: var(--muted); font-size: 14px; }
.fiche .montant { font-weight: 700; font-size: 18px; white-space: nowrap; }
.fiche-infos { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.fiche-infos small { color: var(--muted); font-size: 13.5px; flex-basis: 100%; overflow-wrap: anywhere; }
.fiche-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fiche-actions .discret { margin-left: auto; }
.choix-note { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.choix-note > div { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.alerte { border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); border-radius: 12px; padding: 14px; }
.alerte p { margin: 4px 0 10px; color: var(--muted); font-size: 14.5px; }
.pending .fields label { font-size: 13px; }
.pending .fields input { padding: 10px 12px; }

/* Réglages */
.phrase { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 0; }
.phrase input { width: 76px; text-align: center; }
.row > span b { display: block; font-weight: 600; }
.row > span small { display: block; color: var(--muted); font-size: 13.5px; }
.enregistrer { position: sticky; bottom: 12px; z-index: 2; display: flex; }
.enregistrer .btn { box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.themes { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.themes button { width: auto; height: auto; border-radius: 10px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; font: inherit; font-weight: 600; background: var(--surface); color: var(--text); border: 1.5px solid var(--border); outline: 0; cursor: pointer; }
.themes button i { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--border); }
.themes button.on { border-color: var(--accent); outline: 0; }

@media (max-width: 900px) {
  .app { display: block; }
  aside { display: none; }
  main { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); max-width: none; }
  .mobile-top { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin: 0 -16px 18px; padding: 12px 16px; background: var(--side-bg); color: #fff; }
  [data-theme="clair"] .mobile-top { color: var(--text); border-bottom: 1px solid var(--border); }
  h1 { font-size: 24px; }
  nav.bas { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  nav.bas button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 7px 2px; border-radius: 10px; cursor: pointer; }
  nav.bas svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  nav.bas button.active { color: var(--text); background: color-mix(in srgb, var(--accent) 22%, transparent); }
  nav.bas .count { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }
  .toast { bottom: calc(92px + env(safe-area-inset-bottom)); width: calc(100% - 32px); text-align: center; }
  .enregistrer { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .enregistrer .btn { width: 100%; }
}
@media (max-width: 620px) {
  .gros, .choix, .resume { grid-template-columns: minmax(0, 1fr); }
  .tuile { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 12px; }
  .tuile b { grid-row: 1 / span 2; grid-column: 2; font-size: 28px; }
  .tache { flex-direction: column; align-items: stretch; }
  .fiche-actions .btn { flex: 1 1 auto; }
  .fiche-actions .discret { margin-left: 0; flex-basis: 100%; text-align: center; }
  .two, .pending .fields { grid-template-columns: minmax(0, 1fr); }
  .qr { flex-direction: column; align-items: flex-start; }
  .ligne-champ { flex-direction: column; }
}
.pill.wait { background: var(--surface-2); color: var(--muted); }
.fiche-actions .discret { margin-left: 0; }
.fiche-actions .discret:last-child { margin-left: auto; }
@media (max-width: 620px) { .fiche-actions .discret:last-child { margin-left: 0; } }
@media (max-width: 620px) { .fiche-actions .btn:first-child { flex-basis: 100%; } }
.etape:not(.encours):not(.faite) { opacity: 1; }
.etape:not(.encours):not(.faite) b { color: var(--muted); }

/* Réponse du client en un clic */
.fiche-infos small.suivi { color: var(--muted); }
.fiche-infos small.suivi.vu { color: var(--ok); font-weight: 600; }
.question { margin-top: 12px; padding: 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 50%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.question p { margin: 4px 0 10px; overflow-wrap: anywhere; }
.nouvelle { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; margin-bottom: 10px; background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--border)); }
.nouvelle > span { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--ok); color: #fff; }
.nouvelle b { display: block; }
.nouvelle small { display: block; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.nouvelle.refuse { background: var(--surface-2); border-color: var(--border); }
.nouvelle.refuse > span { background: var(--muted); }
.tache small { overflow-wrap: anywhere; }

/* Factures et rappels */
.gros { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.resume { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tuile span.alerte-txt { color: var(--warn); }
#sous-clients { margin-bottom: 16px; }
input[type=date] { width: 100%; padding: 12px 13px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 16px; background: var(--surface); color: var(--text); min-height: 48px; }
nav.bas { grid-template-columns: repeat(5, 1fr) !important; }
@media (max-width: 1100px) { .resume { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .gros { grid-template-columns: minmax(0, 1fr); } nav.bas button { font-size: 11.5px; } }
@media (max-width: 620px) { .resume { grid-template-columns: minmax(0, 1fr); } }

/* Bilan : ce que les relances ont ramené */
.bilan { background: var(--side-bg); color: #fff; border-color: var(--side-bg); }
[data-theme="clair"] .bilan { color: var(--text); border-color: var(--border); }
.bilan h2 { color: inherit; }
.gains { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.gains b { display: block; font-size: 26px; letter-spacing: -.02em; color: var(--accent); line-height: 1.2; }
.gains small { display: block; font-size: 13.5px; opacity: .8; }
@media (max-width: 620px) { .gains { grid-template-columns: minmax(0, 1fr); gap: 12px; } }

/* Rendez-vous */
.gros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .gros { grid-template-columns: minmax(0, 1fr); } }
#rdv-texte { min-height: 110px; }
input[type=time] { width: 100%; padding: 12px 13px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 16px; background: var(--surface); color: var(--text); min-height: 48px; }
.cache-fichier { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
label.btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
label.btn.occupe { opacity: .55; pointer-events: none; }
.compris { border: 1px solid color-mix(in srgb, var(--ok, #1f9d55) 45%, var(--border)); background: color-mix(in srgb, var(--ok, #1f9d55) 9%, var(--surface)); border-radius: 12px; padding: 12px 14px; margin-bottom: 6px; }
.compris.doute { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.compris b { display: block; font-size: 16px; }
.compris small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.nouvelle.rdv > span { font-size: 13px; font-weight: 700; }
.haut-reglages { margin-left: auto; background: none; border: 0; color: inherit; padding: 6px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.haut-reglages svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.haut-reglages.active { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ===== Entrée de l'app : écran d'ouverture et connexion ===== */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.splash { position: fixed; inset: 0; z-index: 50; background: #1c1a17; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: opacity .45s ease, transform .45s ease; }
.splash.parti { opacity: 0; transform: scale(1.04); pointer-events: none; }
.splash-logo { width: 92px; height: 92px; border-radius: 26px; background: #f5b400; color: #1c1a17; display: grid; place-items: center; font-weight: 800; font-size: 54px; box-shadow: 0 18px 60px rgba(245,180,0,.35); animation: splash-logo .7s cubic-bezier(.2,1.3,.4,1) both; }
.splash b { font-size: 28px; letter-spacing: -.02em; margin-top: 18px; animation: monte .5s .35s ease both; }
.splash i { width: 34px; height: 3px; border-radius: 3px; background: #f5b400; margin: 10px 0 8px; animation: trait .5s .55s ease both; }
.splash small { color: #cfc8b8; font-size: 14.5px; text-align: center; padding: 0 30px; animation: monte .5s .65s ease both; }
@keyframes splash-logo { from { opacity: 0; transform: scale(.55) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes monte { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes trait { from { opacity: 0; transform: scaleX(0); } to { opacity: 1; transform: none; } }
@keyframes glisse-haut { from { opacity: 0; transform: translateY(70px); } to { opacity: 1; transform: none; } }
@keyframes lueur { 0%, 100% { transform: translate(0, 0) scale(1); opacity: .55; } 50% { transform: translate(-6%, 8%) scale(1.15); opacity: .8; } }

.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: 0; background: #1c1a17; position: relative; overflow: hidden; }
.auth::before { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -220px; border-radius: 50%; background: radial-gradient(circle, rgba(245,180,0,.42), rgba(245,180,0,0) 65%); animation: lueur 9s ease-in-out infinite; pointer-events: none; }
.auth::after { content: ""; position: absolute; width: 380px; height: 380px; left: -200px; top: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(245,180,0,.16), rgba(245,180,0,0) 65%); animation: lueur 12s ease-in-out infinite reverse; pointer-events: none; }
.auth-haut { position: relative; z-index: 1; width: 100%; max-width: 460px; text-align: center; color: #fff; padding: calc(44px + env(safe-area-inset-top)) 28px 30px; }
.auth-marque { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; animation: monte .5s .05s ease both; }
.auth-marque .logo { width: 34px; height: 34px; border-radius: 10px; background: #f5b400; color: #1c1a17; }
.auth-haut h1 { font-size: 34px; letter-spacing: -.03em; margin: 22px 0 8px; line-height: 1.1; animation: monte .5s .15s ease both; }
.auth-haut p { color: #cfc8b8; margin: 0; font-size: 15.5px; animation: monte .5s .25s ease both; }
.auth-carte { position: relative; z-index: 1; width: 100%; max-width: 460px; flex: 1; background: var(--surface); color: var(--text); border-radius: 30px 30px 0 0; padding: 22px 22px calc(26px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 50px rgba(0,0,0,.35); animation: glisse-haut .65s .1s cubic-bezier(.2,.9,.25,1) both; }
@media (min-width: 700px) {
  .auth { justify-content: center; padding: 30px 20px; }
  .auth-haut { padding-top: 10px; }
  .auth-carte { flex: none; border-radius: 30px; padding: 26px; }
}
/* Le sélecteur « Se connecter / Créer un compte », avec sa pastille qui glisse */
.auth-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--surface-2); border-radius: 16px; padding: 5px; margin-bottom: 16px; }
.auth-tabs::before { content: ""; position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 12px; background: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.18); transition: transform .38s cubic-bezier(.3,1.25,.4,1); }
.auth-tabs.droite::before { transform: translateX(100%); }
.auth-tabs button, .auth-tabs button.on { position: relative; z-index: 1; flex: none; border: 0; background: none; padding: 12px 8px; border-radius: 12px; font: inherit; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; transition: color .25s; }
.auth-tabs button.on { color: var(--surface); }
/* Champs avec icône */
.champ { display: flex; align-items: center; gap: 11px; background: var(--surface-2); border: 1.5px solid transparent; border-radius: 15px; padding: 0 15px; min-height: 56px; margin-top: 12px; transition: border-color .2s, background .2s, box-shadow .2s; }
.champ > svg { width: 21px; height: 21px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s; }
.champ input, .champ input:focus { flex: 1; min-width: 0; border: 0 !important; background: none !important; outline: none !important; padding: 0 !important; font: inherit; font-size: 16px; color: var(--text); min-height: 52px; box-shadow: none; }
.champ:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.champ:focus-within > svg { stroke: var(--accent-text); }
.champ.faux { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 6%, var(--surface)); animation: secoue .35s; }
.champ.faux > svg { stroke: var(--bad); }
.champ-err { color: var(--bad); font-size: 13.5px; padding-left: 4px; }
.champ-err:not(:empty) { margin-top: 6px; animation: monte .25s ease both; }
.champ-err:not(:empty)::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; margin-right: 6px; }
@keyframes secoue { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.oeil { background: none; border: 0; padding: 8px; margin-right: -8px; cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.oeil svg { width: 21px; height: 21px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.oeil.on svg { stroke: var(--accent-text); }
#champs-inscription:not(.hidden), #bloc-cgu:not(.hidden), #au-intro:not(.hidden), #au-aide:not(.hidden) { animation: monte .35s ease both; }
.auth .btn.full { min-height: 56px; border-radius: 15px; font-size: 16.5px; margin-top: 18px; box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 38%, transparent); }
.btn.charge { color: transparent !important; position: relative; pointer-events: none; }
.btn.charge::after { content: ""; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--accent-ink) 25%, transparent); border-top-color: var(--accent-ink); animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.auth-pied { margin: 14px 0 0; text-align: center; }
.auth .err:not(:empty) { background: color-mix(in srgb, var(--bad) 8%, var(--surface)); border-radius: 12px; padding: 10px 12px; margin-top: 12px; animation: monte .25s ease both; }
.auth .desc { margin-top: 0; }

/* ===== Animations douces dans toute l'app ===== */
main > section:not(.hidden) { animation: monte .32s ease both; }
main > section:not(.hidden) .stack > *, main > section:not(.hidden) > .grid > * { animation: monte .4s ease both; }
main > section:not(.hidden) .stack > *:nth-child(2) { animation-delay: .05s; }
main > section:not(.hidden) .stack > *:nth-child(3) { animation-delay: .1s; }
main > section:not(.hidden) .stack > *:nth-child(4) { animation-delay: .15s; }
main > section:not(.hidden) .stack > *:nth-child(n+5) { animation-delay: .2s; }
.btn, .gros-btn, .choix-btn, .tuile, nav.bas button, .nav, .filtres button { transition: transform .15s ease, filter .15s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease; }
.btn:active, .gros-btn:active, .choix-btn:active, .tuile:active, nav.bas button:active, .filtres button:active { transform: scale(.96); }
.gros-btn:hover, .tuile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.12); }
.sous-form:not(.hidden), .compris:not(.hidden), .question, .choix-note { animation: monte .3s ease both; }
.toast { transition: opacity .3s ease, transform .4s cubic-bezier(.3,1.3,.4,1); border-radius: 14px; }
input, select, textarea { transition: border-color .2s, box-shadow .2s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ===== Intérieur de l'app, dans le même style que l'entrée ===== */
:root, [data-theme="clair"] { --nav-bg: #101828; --hero-bg: #101828; --hero-ink: #fff; --hero-sub: #c5cbd6; --doux: 0 1px 2px rgba(16,24,40,.04), 0 10px 28px rgba(16,24,40,.07); }
[data-theme="chantier"] { --nav-bg: #1c1a17; --hero-bg: #1c1a17; --hero-ink: #fff; --hero-sub: #cfc8b8; --doux: 0 1px 2px rgba(28,26,23,.04), 0 10px 28px rgba(28,26,23,.07); }
[data-theme="nuit"] { --nav-bg: #232836; --hero-bg: #131720; --hero-ink: #fff; --hero-sub: #b3bccb; --doux: 0 0 0 1px #2b3140; }

/* Cartes et fiches : plus rondes, posées sur une ombre douce plutôt que cernées d'un trait */
.card, .fiche, .tuile, .empty { border-radius: 22px; }
.card, .fiche, .tuile { border-color: transparent; box-shadow: var(--doux); }
.card { padding: 22px; }
.card h2, .titre-liste { font-size: 18.5px; letter-spacing: -.02em; }
.fiche { padding: 18px; }
.fiche .qui b { font-size: 17.5px; letter-spacing: -.01em; }
.fiche .montant { font-size: 19px; letter-spacing: -.01em; }
.guide { border: 0; box-shadow: var(--doux), inset 0 0 0 2px var(--accent); }
.pending, .question, .alerte, .auto-info, .choix-note, .nouvelle, .compris { border-radius: 16px; }
.pill { padding: 4px 11px; }
.bilan { border-radius: 22px; position: relative; overflow: hidden; }
.bilan::after { content: ""; position: absolute; width: 260px; height: 260px; right: -110px; top: -130px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 38%, transparent), transparent 65%); pointer-events: none; }

/* Champs : fond plein, coins ronds, halo quand on écrit */
input[type=text], input[type=email], input[type=number], input[type=password], input[type=tel], input[type=date], input[type=time], input:not([type]), select, textarea {
  background: var(--surface-2); border: 1.5px solid transparent; border-radius: 14px; min-height: 50px;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.pending .fields input, .phrase input { background: var(--surface); border-color: var(--border); }
label.f { margin-top: 14px; }

/* Boutons */
.btn { border-radius: 14px; min-height: 48px; padding: 12px 18px; }
.btn:not(.ghost):not(.ok):not(.no):not(.small) { box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 32%, transparent); }
.btn.ghost { background: var(--surface-2); border-color: transparent; }
.btn.ghost:hover { background: color-mix(in srgb, var(--text) 9%, var(--surface-2)); }
.btn.small { border-radius: 11px; min-height: 0; }
.btn.full { min-height: 54px; font-size: 16px; }
.choix-btn { border-radius: 18px; border-color: transparent; background: var(--surface-2); }
.choix-btn svg { width: 46px; height: 46px; padding: 10px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); }

/* Filtres : un sélecteur d'un seul bloc */
.filtres { display: inline-flex; gap: 2px; background: color-mix(in srgb, var(--text) 6%, var(--surface-2)); padding: 5px; border-radius: 16px; max-width: 100%; }
.filtres button, [data-theme="clair"] .filtres button { border: 0; background: none; border-radius: 12px; padding: 9px 14px; color: var(--muted); }
.filtres button.on, [data-theme="clair"] .filtres button.on { background: var(--text); color: var(--surface); box-shadow: 0 4px 12px rgba(0,0,0,.16); }

/* Interrupteurs */
.switch { width: 48px; height: 28px; }
.switch span::after { width: 22px; height: 22px; transition: left .25s cubic-bezier(.3,1.3,.4,1); }
.switch input:checked + span::after { left: 23px; }

/* Accueil : quatre tuiles d'action, comme sur une application */
.gros { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.gros-btn { flex-direction: column; align-items: flex-start; gap: 12px; background: var(--surface); color: var(--text); border-radius: 22px; padding: 16px; min-height: 138px; box-shadow: var(--doux); }
.gros-btn svg { width: 46px; height: 46px; padding: 10px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); }
.gros-btn b { font-size: 16px; line-height: 1.25; letter-spacing: -.01em; }
.gros-btn small { font-size: 13px; opacity: 1; color: var(--muted); margin-top: 3px; line-height: 1.3; }
.gros-btn:first-child { background: var(--nav-bg); color: #fff; }
.gros-btn:first-child small { color: #cfc8b8; }
.gros-btn:hover { filter: none; }
.tuile b { font-size: 32px; }
.nouvelle > span, .rien > span { border-radius: 14px; }
.etape .rond { border-radius: 12px; }

/* Menu de gauche (ordinateur) */
.nav { border-radius: 12px; padding: 11px 12px; }
.nav.active, [data-theme="chantier"] .nav.active { background: var(--accent); color: var(--accent-ink); }
.nav.active .count { background: var(--accent-ink); color: var(--accent); }

@media (max-width: 1100px) { .gros { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Téléphone : haut sombre, contenu sur une feuille arrondie, menu flottant */
@media (max-width: 900px) {
  main { padding-bottom: calc(118px + env(safe-area-inset-bottom)); background: linear-gradient(var(--hero-bg), var(--hero-bg)) top / 100% 220px no-repeat; }
  .mobile-top, [data-theme="clair"] .mobile-top { background: var(--hero-bg); color: var(--hero-ink); margin-bottom: 0; padding: calc(12px + env(safe-area-inset-top)) 18px 6px; border: 0; }
  .top { position: relative; overflow: hidden; margin: 0 -16px; padding: 14px 20px 48px; background: var(--hero-bg); color: var(--hero-ink); }
  .top::after { content: ""; position: absolute; width: 300px; height: 300px; right: -120px; top: -150px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 42%, transparent), transparent 65%); pointer-events: none; animation: lueur 10s ease-in-out infinite; }
  .top > div { position: relative; z-index: 1; }
  .top h1 { font-size: 30px; letter-spacing: -.03em; line-height: 1.1; }
  .top .sub { color: var(--hero-sub); margin-top: 6px; }
  .banner { margin: 10px 0; }
  main > section { position: relative; margin: -28px -16px 0; padding: 20px 16px 0; background: var(--bg); border-radius: 28px 28px 0 0; min-height: 60vh; }
  .gros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resume { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tuile { display: block; padding: 16px; }
  .tuile b { font-size: 30px; }

  nav.bas { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); border: 0; border-radius: 26px; padding: 7px; background: var(--nav-bg); box-shadow: 0 14px 40px rgba(0,0,0,.3); }
  nav.bas button { color: #a8a294; border-radius: 19px; padding: 8px 2px; font-size: 11.5px; }
  nav.bas button.active { background: var(--accent); color: var(--accent-ink); }
  nav.bas .count { top: 0; background: #fff; color: #1c1a17; }
  .toast { bottom: calc(104px + env(safe-area-inset-bottom)); }
  .enregistrer { bottom: calc(98px + env(safe-area-inset-bottom)); }
}
@media (max-width: 620px) {
  .gros, .resume { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tuile { display: block; }
  .tuile b { grid-row: auto; grid-column: auto; }
  .choix { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 360px) { .gros-btn { padding: 13px; min-height: 128px; } .gros-btn b { font-size: 15px; } }

/* Accueil : les actions d'abord, puis ce qui est à faire */
#tab-accueil .gros { order: -2; }

/* Fenêtre de confirmation de l'app */
.dialogue { border: 0; padding: 0; background: var(--surface); color: var(--text); border-radius: 26px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.dialogue::backdrop { background: rgba(15,13,10,.55); backdrop-filter: blur(3px); animation: fondu .25s ease both; }
.dialogue[open] { animation: glisse-haut .35s cubic-bezier(.2,.9,.25,1) both; }
.dialogue form { padding: 24px 22px 20px; }
.dialogue h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.02em; }
.dialogue p { margin: 0; color: var(--muted); font-size: 15px; }
.dlg-poignee { display: none; width: 42px; height: 5px; border-radius: 5px; background: var(--border); margin: -8px auto 16px; }
.dlg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.btn.danger { background: var(--bad); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--bad) 30%, transparent) !important; }
@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 620px) {
  .dialogue { margin: auto 0 0; width: 100%; max-width: none; border-radius: 28px 28px 0 0; }
  .dialogue form { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .dlg-poignee { display: block; }
  .dlg-actions { grid-template-columns: 1fr; }
  .dlg-actions #dlg-oui { order: -1; }
}
#bandeau-verif { align-items: flex-start; }
#bandeau-verif span { flex: 1 1 240px; font-weight: 400; }

/* Recherche, carnet de clients, fenêtre de correction */
.recherche { margin-bottom: 12px; padding-left: 44px !important; border-radius: 16px !important; background-color: var(--surface) !important; box-shadow: var(--doux); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23857f73' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.500 4.500'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; background-size: 20px; }
input[type=search] { width: 100%; padding: 12px 13px; font: inherit; font-size: 16px; border: 1.5px solid transparent; min-height: 50px; color: var(--text); -webkit-appearance: none; appearance: none; }
.initiale { width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 18px; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--accent-text); }
#edition form { max-height: 88vh; overflow-y: auto; }
@media (max-width: 620px) { .dlg-actions #ed-oui { order: -1; } }
#ed-champs label.f:first-child { margin-top: 10px; }
#ed-champs select { width: 100%; }

/* ===== Finitions ===== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
button, a.btn, label.btn, .choix-btn { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
select { -webkit-appearance: none; appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23857f73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; text-align: left; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; }
@media (max-width: 900px) { html { background: var(--hero-bg); } body { min-height: 100dvh; } }

/* Messages : réussite ou erreur */
.toast { display: flex; align-items: center; gap: 10px; text-align: left; }
.toast::before { content: "✓"; flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: #2fb47c; color: #fff; }
.toast.erreur { background: #7a1d16; }
.toast.erreur::before { content: "!"; background: #fff; color: #7a1d16; }

/* Écrans vides : une invitation plutôt qu'une case en pointillés */
.empty { border: 0; background: color-mix(in srgb, var(--text) 4%, transparent); color: var(--muted); padding: 30px 22px; font-size: 15px; }
.empty::before { content: ""; display: block; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 18px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a39c8e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 13l2.500-7h11L20 13v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z'/%3E%3Cpath d='M4 13h4.500l1 2h5l1-2H20'/%3E%3C/svg%3E") center / 26px no-repeat; box-shadow: var(--doux); }

/* Fiches sur téléphone : les petits liens côte à côte au lieu d'être empilés */
@media (max-width: 620px) {
  .fiche-actions .discret, .fiche-actions .discret:last-child { flex: 1 1 0; flex-basis: 0; margin-left: 0; text-align: center; white-space: nowrap; padding: 8px 2px; }
  .fiche-actions .discret:first-of-type { margin-top: 2px; }
}
.guide-pied { margin: 12px 0 0; text-align: right; }
.etape .actions { gap: 8px; }

/* Historique d'un client, suite logique, bilan */
.dlg-corps { padding: 24px 22px 20px; }
#historique p { margin-bottom: 14px; }
.fil { max-height: 55vh; overflow-y: auto; margin: 0 -6px 4px; padding: 0 6px; }
.fil-ligne { display: flex; gap: 14px; padding-bottom: 16px; position: relative; }
.fil-ligne > i { flex: none; width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.fil-ligne:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
.fil-ligne b { display: block; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.fil-ligne small { display: block; color: var(--muted); font-size: 13px; }
.btn.suite { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--text); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.suite::before { content: "→ "; font-weight: 800; }
.nouvelle .btn.suite { flex: none; margin-left: auto; }
@media (max-width: 620px) { .nouvelle { flex-wrap: wrap; } .nouvelle .btn.suite { flex-basis: 100%; } .dlg-corps { padding-bottom: calc(22px + env(safe-area-inset-bottom)); } }
.gains { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------- Passages : photos avant/après et compte rendu ---------- */
.passage-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.passage-tete h2 { margin-bottom: 2px; }
.pas { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 22px 0 10px; }
.pas span { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 10px; }
.vignettes:empty { display: none; }
.vignette { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignette button { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .62); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.vignette.envoi { display: grid; place-items: center; color: var(--muted); font-size: 12.5px; text-align: center; padding: 6px; animation: battement 1.2s ease-in-out infinite; }
@keyframes battement { 50% { opacity: .45; } }
#passage-ouvert label.btn { position: relative; cursor: pointer; }
.fiche .alerte { margin: 10px 0 0; }
.fiche-infos small.extrait { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fil-ligne a { color: var(--accent-text); font-weight: 600; font-size: 13.5px; }
@media (prefers-reduced-motion: reduce) { .vignette.envoi { animation: none; } }
/* La première tuile de l'accueil (le passage) prend toute la largeur */
.gros-btn:first-child { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; gap: 14px; }
#passage-ouvert .actions .btn { flex: 1 1 140px; text-align: center; }
.vignettes { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }

/* ---------- Villas : fil des passages ---------- */
.extrait.complet { display: block; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-line-clamp: unset; max-height: none; }
.fil-photos { margin-top: 8px; }
.fil-photos > small { display: block; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fil-photos .vignettes { margin-bottom: 0; }
.fil-reste { margin-top: 10px; padding: 10px 12px; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; }
a.vignette { display: block; }
