/* Renov'Concept — interface mobile façon iOS (fonctionne aussi sur ordinateur). */
:root {
  --brand: #253d17;
  --accent: #a8742f;
  --bg: #f5f1e8;
  --card: #ffffff;
  --text: #15181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --field: #f0ece3;
  --ok: #1f9d55;
  --warn: #d97706;
  --bad: #dc2626;
  --info: #2563eb;
  --radius: 14px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --text: #f2f2f7;
    --muted: #9ca3af;
    --line: #2c2c2e;
    --field: #2c2c2e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: var(--brand); text-decoration: none; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand);
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- structure ---------- */
.layout { min-height: 100vh; padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); }
.page { max-width: 860px; margin: 0 auto; padding: calc(var(--safe-t) + 8px) 16px 0; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  padding: calc(var(--safe-t) + 6px) 16px 6px; display: flex; align-items: center; gap: 8px; min-height: 44px; }
.topbar .back { display: inline-flex; align-items: center; gap: 2px; color: var(--brand); font-weight: 500;
  background: none; border: 0; padding: 6px 4px; cursor: pointer; font-size: 17px; }
.topbar .spacer { flex: 1; }
.topbar .tb-title { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar + .page { padding-top: 0; }
.largetitle { font-size: 32px; font-weight: 800; letter-spacing: -.5px; margin: 6px 0 12px; }
.subtitle { color: var(--muted); margin: -8px 0 14px; font-size: 15px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line); padding-bottom: var(--safe-b); display: flex; justify-content: center; }
.tabbar nav { display: flex; width: 100%; max-width: 560px; }
.tabbar a { flex: 1; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--muted); font-size: 10.5px; font-weight: 500; }
.tabbar a.active { color: var(--brand); }
.tabbar svg { width: 25px; height: 25px; }
@media (prefers-color-scheme: dark) { .tabbar a.active, .topbar .back, a { color: color-mix(in srgb, var(--brand) 45%, white); } }

/* ---------- cartes et listes ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card h2 { font-size: 17px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 18px 4px 6px;
  display: flex; justify-content: space-between; align-items: center; }
.list { background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; position: relative; color: var(--text);
  min-height: 52px; cursor: pointer; }
.list .item + .item::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--line); }
.list .item:active { background: var(--field); }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .r { text-align: right; font-size: 14px; color: var(--muted); white-space: nowrap; }
.item .chev { color: #c4c4c7; font-size: 20px; }
.item .thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--field); flex: none; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty .big { font-size: 40px; margin-bottom: 6px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border-radius: var(--radius); padding: 12px 14px; color: var(--text); display: block; }
.kpi .v { font-size: 24px; font-weight: 800; letter-spacing: -.3px; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi.accent .v { color: var(--accent); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--field); color: var(--muted); white-space: nowrap; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.orange { background: #ffedd5; color: #c2410c; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.purple { background: #ede9fe; color: #6d28d9; }
.badge.gray { background: var(--field); color: var(--muted); }
@media (prefers-color-scheme: dark) {
  .badge.blue { background: #1e3a8a; color: #bfdbfe; } .badge.green { background: #14532d; color: #bbf7d0; }
  .badge.orange { background: #7c2d12; color: #fed7aa; } .badge.red { background: #7f1d1d; color: #fecaca; }
  .badge.purple { background: #4c1d95; color: #ddd6fe; }
}

.progress { height: 6px; background: var(--field); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

/* ---------- segments / chips ---------- */
.segments { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px;
  scrollbar-width: none; position: sticky; top: calc(var(--safe-t) + 50px); z-index: 10; background: var(--bg); }
.segments::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; background: var(--card); color: var(--text); padding: 7px 13px; border-radius: 999px;
  font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--brand); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.chips .chip { background: var(--field); }
.chips .chip.active { background: var(--brand); color: #fff; }

/* ---------- boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 12px;
  padding: 12px 16px; font-weight: 600; font-size: 16px; cursor: pointer; background: var(--brand); color: #fff;
  min-height: 46px; text-align: center; }
.btn:active { opacity: .8; }
.btn.block { width: 100%; }
.btn.accent { background: var(--accent); }
.btn.light { background: var(--field); color: var(--text); }
.btn.danger { background: transparent; color: var(--bad); }
.btn.small { padding: 7px 12px; min-height: 34px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.btn-row .btn { flex: 1 1 140px; }
.iconbtn { background: none; border: 0; color: var(--brand); padding: 6px 8px; font-size: 17px; font-weight: 600; cursor: pointer; }
.fab { position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 25; width: 56px; height: 56px;
  border-radius: 50%; background: var(--accent); color: #fff; border: 0; font-size: 30px; line-height: 1;
  box-shadow: 0 6px 18px rgba(0,0,0,.22); cursor: pointer; display: grid; place-items: center; }

/* ---------- formulaires ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin: 0 2px 4px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--field); border: 1px solid transparent;
  border-radius: 10px; padding: 11px 12px; outline: none; -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: var(--card); }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { width: 22px; height: 22px; padding: 0; border-radius: 6px; flex: none; border: 1.5px solid var(--muted);
  background: var(--card); display: inline-grid; place-content: center; cursor: pointer; }
input[type=checkbox]:checked { background: var(--brand); border-color: var(--brand); }
input[type=checkbox]:checked::after { content: "✓"; color: #fff; font-size: 15px; font-weight: 700; }
input[type=color] { padding: 2px; height: 44px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.checkline { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.hint { font-size: 13px; color: var(--muted); margin: -4px 2px 12px; }

.search { position: relative; margin-bottom: 10px; }
.search input { padding-left: 34px; background: var(--card); }
.search::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 18px; }

/* ---------- feuille modale (bottom sheet) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); display: flex; align-items: flex-end;
  justify-content: center; animation: fade .18s ease; }
.sheet { background: var(--bg); width: 100%; max-width: 640px; max-height: calc(100vh - var(--safe-t) - 24px); max-height: calc(100dvh - var(--safe-t) - 24px);
  border-radius: 16px 16px 0 0; display: flex; flex-direction: column; animation: up .24s cubic-bezier(.2,.8,.2,1); }
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 16px; } }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px; gap: 8px; }
.sheet header h3 { font-size: 17px; text-align: center; flex: 1; }
.sheet .body { overflow-y: auto; padding: 4px 16px calc(var(--safe-b) + 18px); -webkit-overflow-scrolling: touch; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); transform: translateX(-50%); z-index: 60;
  background: rgba(30,30,32,.94); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 15px; max-width: 90vw;
  animation: fade .2s ease; }
.toast.error { background: var(--bad); }

/* ---------- photos ---------- */
.grid-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; border-radius: var(--radius); overflow: hidden; }
@media (min-width: 700px) { .grid-photos { grid-template-columns: repeat(5, 1fr); } }
.grid-photos button { position: relative; padding: 0; border: 0; aspect-ratio: 1; background: var(--field); cursor: pointer; }
.grid-photos img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.grid-photos .tag { position: absolute; left: 4px; bottom: 4px; font-size: 10px; padding: 1px 6px; border-radius: 6px;
  background: rgba(0,0,0,.55); color: #fff; }
.viewer img { width: 100%; border-radius: 10px; margin-bottom: 10px; }

/* ---------- devis ---------- */
.qline { background: var(--card); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.qline.section { background: color-mix(in srgb, var(--brand) 10%, var(--card)); }
.qline .top { display: flex; gap: 8px; align-items: flex-start; }
.qline .top input, .qline .top textarea { flex: 1; }
.qline .nums { display: grid; grid-template-columns: 1fr .8fr 1.2fr 1fr; gap: 6px; margin-top: 6px; }
.qline .nums input, .qline .nums select { padding: 8px 8px; font-size: 16px; }
.qline .nums label span { font-size: 11px; color: var(--muted); display: block; margin-left: 2px; }
.qline .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 14px; color: var(--muted); }
.qline .foot b { color: var(--text); }
.qline .tools { display: flex; gap: 2px; }
.qline .tools button { background: var(--field); border: 0; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; color: var(--text); }
.qline textarea { min-height: 40px; font-size: 14px; padding: 8px 10px; margin-top: 6px; }
.totals-bar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 15; margin: 10px -16px 0; padding: 10px 16px;
  background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: .5px solid var(--line); display: flex; align-items: center; gap: 10px; }
.totals-bar .sum { flex: 1; font-size: 13px; color: var(--muted); }
.totals-bar .sum b { font-size: 19px; color: var(--text); display: block; }
.totals-table { width: 100%; font-size: 15px; border-collapse: collapse; }
.totals-table td { padding: 4px 0; }
.totals-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals-table tr.big td { font-weight: 800; font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; }

.room-card .measures { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.sel-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: .5px solid var(--line); }
.sel-item .grow { flex: 1; min-width: 0; font-size: 15px; }
.sel-item .grow small { color: var(--muted); display: block; }
.sel-item input { width: 84px; padding: 7px 8px; text-align: right; }
.sel-item .x { background: none; border: 0; color: var(--bad); font-size: 20px; cursor: pointer; padding: 0 4px; }
.cat-group h4 { margin: 14px 2px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }

/* ---------- connexion ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px calc(24px + var(--safe-b));
  max-width: 420px; margin: 0 auto; }
.login .logo { display: flex; justify-content: center; margin-bottom: 26px; }
.login .logo img { max-height: 120px; max-width: 280px; }
.login .logo .word { font-size: 34px; font-weight: 800; color: var(--brand); letter-spacing: -.5px; }
.login .card { padding: 18px; }

.desktop-only { display: none; }
@media (min-width: 900px) { .desktop-only { display: initial; } }
.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 12px; }
.nowrap { white-space: nowrap; }

/* logo : vert sur fond transparent, posé sur une pastille crème en mode sombre */
.brandlogo { height: 44px; width: auto; margin: 6px 0 2px; }
@media (prefers-color-scheme: dark) { .brandlogo { background: #f5f1e8; padding: 6px 10px; border-radius: 10px; box-sizing: content-box; } }

input[type=range] { -webkit-appearance: auto; appearance: auto; accent-color: var(--accent); background: none; padding: 0; border: 0; height: 32px; }

/* ---------- devis automatique : tuiles des corps de métier ---------- */
.zones .chip { display: inline-flex; align-items: center; gap: 5px; }
.zones .chip.add { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.chip .n, .trade .n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.zone-m { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.zone-m button.badge { border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.trades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
@media (min-width: 600px) { .trades { grid-template-columns: repeat(5, 1fr); } }
.trade { position: relative; border: 0; background: var(--card); border-radius: 18px; padding: 14px 6px 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 96px; color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: transform .12s ease; }
.trade:active { transform: scale(.94); }
.trade .ic { font-size: 34px; line-height: 1; }
.trade .nm { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.15; }
.trade .n { position: absolute; top: 6px; right: 6px; }
.trade.on { background: color-mix(in srgb, var(--brand) 9%, var(--card)); box-shadow: inset 0 0 0 2px var(--brand); }

.pick-where { margin: 0 2px 10px; color: var(--muted); font-size: 14px; }
.pick { background: var(--card); border-radius: 14px; margin-bottom: 8px; overflow: hidden; transition: box-shadow .12s; }
.pick.on { box-shadow: inset 0 0 0 2px var(--brand); }
.pick-head { width: 100%; border: 0; background: none; display: flex; gap: 12px; align-items: center; text-align: left;
  padding: 13px 14px; cursor: pointer; color: var(--text); }
.pick-head .grow { flex: 1; min-width: 0; }
.pick-head .l { display: block; font-weight: 600; font-size: 15px; }
.pick-head .s { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.check { width: 28px; height: 28px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 2px #c4c4c7;
  display: grid; place-items: center; transition: background .12s; }
.pick.on .check { background: var(--brand); box-shadow: none; }
.pick.on .check::after { content: "✓"; color: #fff; font-weight: 800; font-size: 16px; }
.pick .stepper { padding: 0 14px 12px 54px; }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--field); color: var(--brand);
  font-size: 22px; font-weight: 600; cursor: pointer; flex: none; display: grid; place-items: center; }
.stepper button:active { background: var(--brand); color: #fff; }
.stepper input { width: 76px; text-align: center; font-weight: 700; padding: 8px 6px; }
.stepper .u { color: var(--muted); font-size: 14px; min-width: 26px; }
.stepper .amt { margin-left: auto; font-size: 15px; white-space: nowrap; }
.recap { background: var(--card); border-radius: var(--radius); padding: 2px 14px; margin-bottom: 12px; }
.recap-line { padding: 10px 0; }
.recap-line + .recap-line { border-top: .5px solid var(--line); }
.recap-line .top { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.recap-line .top .grow { flex: 1; }
.recap-line .x { background: none; border: 0; color: var(--bad); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px; }
.trade.add { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand) 45%, transparent); color: var(--brand); }
.trade.add .ic { font-size: 30px; font-weight: 300; }
.pick-where + #picks + .btn { margin-top: 4px; }

/* ---------- visionneuse photo plein écran ---------- */
.viewer-full { position: fixed; inset: 0; z-index: 70; background: #000; color: #fff; display: flex; flex-direction: column;
  animation: fade .15s ease; }
.vf-top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 8px) 14px 8px; }
.vf-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.18); color: #fff;
  font-size: 20px; display: grid; place-items: center; cursor: pointer; }
.vf-count { font-size: 15px; font-weight: 600; opacity: .85; }
.vf-stage { flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center; }
.vf-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.vf-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 64px; border: 0; border-radius: 12px;
  background: rgba(0,0,0,.35); color: #fff; font-size: 34px; cursor: pointer; }
.vf-nav.prev { left: 6px; } .vf-nav.next { right: 6px; }
.vf-bottom { padding: 10px 14px calc(var(--safe-b) + 12px); display: grid; gap: 10px; }
.vf-phases { display: flex; background: rgba(255,255,255,.14); border-radius: 12px; padding: 3px; }
.vf-phases button { flex: 1; border: 0; background: none; color: #fff; padding: 10px; border-radius: 9px; font-weight: 600; cursor: pointer; }
.vf-phases button.active { background: #fff; color: #000; }
.vf-actions { display: flex; gap: 8px; }
.vf-actions button { flex: 1; border: 0; border-radius: 12px; padding: 12px; background: rgba(255,255,255,.14); color: #fff;
  font-size: 15px; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vf-actions button.del { flex: none; width: 52px; text-align: center; }

/* ---------- dictée ---------- */
.mic { display: block; margin: 6px auto 4px; width: 92px; height: 92px; border-radius: 50%; border: 0; background: var(--brand);
  color: #fff; font-size: 40px; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.mic.on { background: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--bad) 25%, transparent); } }
.mic-label { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 10px; }
#dtext { min-height: 180px; }
.qlist { margin: 0; padding-left: 18px; font-size: 15px; }
.qlist li + li { margin-top: 4px; }

/* ---------- modèles de travaux ---------- */
.tpl-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 4px; padding: 2px 16px 6px; scrollbar-width: none; }
.tpl-row::-webkit-scrollbar { display: none; }
.tpl { flex: none; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 14px; padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--text); font-weight: 600; font-size: 14px;
  cursor: pointer; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent); }
.tpl span { font-size: 22px; }
.tpl:active { transform: scale(.95); }

/* ---------- signature ---------- */
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain[disabled] .qline .tools, fieldset.plain[disabled] .btn-row { display: none; }
.card.signed { box-shadow: inset 0 0 0 2px var(--ok); }
.card.signed h2 { color: var(--ok); margin-bottom: 2px; }
.card.signed img { max-height: 90px; margin: 8px 0 0; background: #fff; border-radius: 8px; }
.signpad { position: fixed; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; animation: fade .15s ease; }
.sp-top { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 6px) 8px 6px; }
.sp-body { flex: 1; overflow-y: auto; padding: 4px 16px calc(var(--safe-b) + 16px); max-width: 640px; width: 100%; margin: 0 auto; }
.sp-accept { align-items: flex-start; font-size: 15px; margin-bottom: 10px; }
.sp-pad { position: relative; height: 220px; background: #fff; border-radius: 14px; margin-bottom: 12px;
  box-shadow: inset 0 0 0 1.5px var(--line); }
.sp-pad::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 46px; border-bottom: 1.5px dashed #c4c4c7; pointer-events: none; }
.sp-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; border-radius: 14px; }
.sp-hint { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: #9ca3af; font-size: 14px; pointer-events: none; }
.sp-clear { position: absolute; top: 8px; right: 8px; border: 0; background: #f0ece3; color: #15181d; border-radius: 8px;
  padding: 5px 10px; font-size: 13px; cursor: pointer; }

/* ---------- facturation ---------- */
.bill-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.bill-actions .btn { padding: 11px 8px; font-size: 15px; }
.fin-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--field); margin: 4px 0 8px; }
.fin-bar i { display: block; height: 100%; }
.fin-bar i.paid, .fin-legend i.paid { background: var(--ok); }
.fin-bar i.due, .fin-legend i.due { background: var(--accent); }
.fin-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.fin-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--field); margin-right: 5px;
  box-shadow: inset 0 0 0 1px var(--line); }
.fin .kv dt.fin-rest, .fin .kv dd.fin-rest { font-weight: 800; font-size: 17px; color: var(--text); border-top: 1px solid var(--line); padding-top: 8px; }

/* ---------- aperçu PDF ---------- */
.pdfview { position: fixed; inset: 0; z-index: 70; background: #5b5f66; display: flex; flex-direction: column; animation: fade .15s ease; }
.pv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #fff;
  padding: calc(var(--safe-t) + 8px) 12px 8px; background: #2b2e33; }
.pv-top b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-close { border: 0; border-radius: 999px; background: #fff; color: #15181d; font-weight: 700; font-size: 15px;
  padding: 9px 14px; cursor: pointer; flex: none; }
.pv-share { border: 0; width: 42px; height: 42px; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff;
  display: grid; place-items: center; cursor: pointer; flex: none; }
.pv-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 10px calc(var(--safe-b) + 16px); }
.pv-page { width: 100%; max-width: 820px; margin: 0 auto 12px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.pv-hint { text-align: center; color: #e5e7eb; font-size: 13px; margin: 4px 0 0; }
.pdfview .empty { color: #fff; }
.notes-txt { white-space: pre-line; font-size: 15px; max-height: 260px; overflow-y: auto; }
.draft-card { box-shadow: inset 0 0 0 2px var(--accent); }
