@font-face { font-family: "Sora"; font-weight: 400; font-style: normal; font-display: swap; src: url(../fonts/sora-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 500; font-style: normal; font-display: swap; src: url(../fonts/sora-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 600; font-style: normal; font-display: swap; src: url(../fonts/sora-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 700; font-style: normal; font-display: swap; src: url(../fonts/sora-latin-700-normal.woff2) format("woff2"); }
:root {
  --navy: #14213d;
  --navy-2: #1f3158;
  --amber: #fca311;
  --amber-soft: #fff3d6;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b1f27;
  --muted: #6b7280;
  --line: #e3e6ec;
  --ok: #1f8a4c;
  --ok-soft: #e3f4ea;
  --bad: #c62828;
  --bad-soft: #fde8e8;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 "Sora", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app { max-width: 720px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding: 12px 14px 96px; }

/* ---------- En-tête ---------- */
.top { background: var(--navy); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5; }
.top .brand { font-weight: 700; letter-spacing: .2px; }
.top .who { font-size: 13px; opacity: .8; }
.icon-btn { background: transparent; border: 0; color: #fff; font-size: 24px; width: 44px; height: 44px; border-radius: 10px; }
.icon-btn:active { background: var(--navy-2); }

/* ---------- Boutons ---------- */
.btn { border: 0; border-radius: 12px; padding: 14px 18px; font-weight: 700; background: var(--navy); color: #fff; min-height: 48px; }
.btn:active { opacity: .85; }
.btn.amber { background: var(--amber); color: #1b1f27; }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; font-weight: 600; min-height: 42px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.chips.scroll .chip { white-space: nowrap; }

/* ---------- Formulaires ---------- */
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password], input[type=number], input[type=search] {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px; background: #fff; min-height: 48px; font-size: 17px; }
input:focus { outline: 2px solid var(--amber); border-color: var(--amber); }

/* ---------- Connexion ---------- */
.login { padding: 48px 22px; max-width: 420px; margin: 0 auto; }
.login .logo { width: 72px; height: 72px; border-radius: 18px; margin-bottom: 14px; }
.login h1 { margin: 0 0 4px; font-size: 26px; }
.login p { margin: 0 0 18px; color: var(--muted); }
.err { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 10px; margin: 12px 0 0; font-weight: 600; }

/* ---------- Semaine ---------- */
.week-nav { display: flex; align-items: center; gap: 8px; margin: 4px 0 12px; }
.week-nav .label { flex: 1; text-align: center; }
.week-nav .label b { display: block; font-size: 17px; }
.week-nav .label small { color: var(--muted); }
.nav-btn { width: 48px; height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font-size: 22px; font-weight: 700; }
.day { width: 100%; text-align: left; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; display: block; }
.day:active { background: #fafbfc; }
.day .dhead { display: flex; align-items: center; gap: 8px; }
.day .dname { font-weight: 700; font-size: 17px; flex: 1; }
.day .dtot { font-weight: 700; }
.day .dlines { margin-top: 6px; color: var(--text); font-size: 15px; }
.day .dlines div { padding: 2px 0; display: flex; justify-content: space-between; gap: 8px; }
.day .dlines span:last-child { color: var(--muted); white-space: nowrap; }
.day.todo { border-color: #f3b8b8; background: var(--bad-soft); }
.day.today { border-color: var(--amber); background: var(--amber-soft); }
.day.done { border-color: #bfe3cd; }
.day.off { background: #fafafa; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.tag.todo { background: var(--bad); color: #fff; }
.tag.today { background: var(--amber); color: #1b1f27; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.grey { background: #ececf0; color: var(--muted); }
.summary { display: flex; justify-content: space-between; align-items: center; background: var(--navy); color: #fff;
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; }
.summary b { font-size: 20px; }

/* ---------- Feuilles (bottom sheets) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 18, 35, .55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
#picker { z-index: 30; }
.sheet { background: var(--bg); width: 100%; max-width: 720px; max-height: 92vh; border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column; animation: up .18s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
.sheet .sh-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.sheet .sh-head h2 { margin: 0; font-size: 19px; }
.sheet .sh-body { overflow-y: auto; padding: 6px 16px 12px; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet .sh-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff;
  display: flex; gap: 10px; align-items: center; }
.sheet .sh-foot .btn { flex: 1; }

.line { background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.line .lname { font-weight: 700; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.line .lname small { display: block; font-weight: 400; color: var(--muted); }
.line .del { background: transparent; border: 0; color: var(--bad); font-size: 20px; width: 40px; height: 40px; flex: none; }
.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.stepper button { width: 52px; height: 48px; font-size: 24px; font-weight: 700; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; }
.stepper input { text-align: center; font-weight: 700; font-size: 20px; width: 90px; }
.stepper .unit { color: var(--muted); font-weight: 600; }
.quick { display: flex; gap: 8px; flex-basis: 100%; }
.quick button { flex: 1; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; height: 42px; font-weight: 700; }
.addrow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.addrow .btn { padding: 12px 8px; }
.total-line { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; padding: 8px 2px; }
.hint { color: var(--muted); font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* ---------- Sélecteur de chantier ---------- */
.pick-item { width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; display: block; }
.pick-item:active { background: var(--amber-soft); }
.pick-item b { display: block; }
.pick-item small { color: var(--muted); }
.pick-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 12px 2px 6px; }

/* ---------- Admin ---------- */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs .in { display: flex; width: 100%; max-width: 720px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 10px 4px 12px; font-weight: 700; color: var(--muted); font-size: 13px; }
.tabs button .ic { display: block; font-size: 22px; line-height: 1.1; }
.tabs button.on { color: var(--navy); box-shadow: inset 0 3px 0 var(--amber); }
.card { background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }
.miss { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; }
.miss:first-of-type { border-top: 0; }
.miss .who { font-weight: 700; }
.miss small { color: var(--muted); display: block; }
.tablewrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th, table.t td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 700; white-space: normal; text-align: right; vertical-align: bottom; min-width: 64px; }
table.t th:first-child, table.t td:first-child { text-align: left; position: sticky; left: 0; background: #fff; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
table.t tr.tot td { font-weight: 700; border-top: 2px solid var(--navy); }
table.t td.z { color: #c2c6cf; }
.crow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.crow:first-child { border-top: 0; }
.crow small { color: var(--muted); display: block; }
.crow.off { opacity: .5; }
.switch { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 12px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.switch.on { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cd; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: #1b1f27; color: #fff;
  padding: 11px 18px; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--bad); }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- Terrain (problèmes / RAS / photos) ---------- */
textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; font-size: 17px; resize: vertical; min-height: 96px; font-family: inherit; }
textarea:focus { outline: 2px solid var(--amber); border-color: var(--amber); }
.typebtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.typebtn { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 14px 8px; font-weight: 800; font-size: 17px; min-height: 76px; }
.typebtn span { display: block; font-size: 26px; line-height: 1.1; }
.typebtn.prob.on { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.typebtn.ras.on { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.post { padding: 12px 14px; }
.post.open { border-color: #f3b8b8; }
.phead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.phead small { color: var(--muted); }
.pname small { display: block; color: var(--muted); }
.ptxt { margin: 8px 0 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.th { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: #e9ebf0; }
.th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.th .rm { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 14px; }
.pact { display: flex; gap: 8px; margin-top: 10px; }
.pact .btn { flex: 1; padding: 10px 8px; min-height: 42px; font-size: 14px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.94); z-index: 60; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button { position: absolute; background: rgba(255,255,255,.18); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 24px; }
.lb-x { top: calc(10px + env(safe-area-inset-top)); right: 10px; }
.lb-prev { left: 8px; top: 50%; margin-top: -24px; }
.lb-next { right: 8px; top: 50%; margin-top: -24px; }
.lb-n { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: #fff; font-weight: 700; }

/* ---------- Fiches chantier ---------- */
.frow { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 0; }
.frow:first-child { border-top: 0; }
.frow:active { background: var(--amber-soft); }
.frow .fmain { min-width: 0; }
.frow .fmain b { display: block; }
.frow small { color: var(--muted); }
.fbadges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.finfo { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.finfo:first-of-type { margin-top: 8px; }
.finfo span { color: var(--muted); flex: none; }
.finfo b, .finfo a { text-align: right; overflow-wrap: anywhere; }
.maps { color: #1a56c4; font-weight: 700; text-decoration: none; }
.prog { height: 14px; background: #e9ebf0; border-radius: 999px; overflow: hidden; }
.prog div { height: 100%; background: var(--ok); border-radius: 999px; transition: width .3s; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.task .tt { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 6px; }
.task .tt small { display: block; color: var(--muted); }
.task.done .tt > div:first-child { text-decoration: line-through; color: var(--muted); }
.chk { flex: none; width: 36px; height: 36px; border-radius: 10px; border: 2px solid #b8bec9; background: #fff; font-size: 20px; font-weight: 800; color: #fff; }
.task.done .chk { background: var(--ok); border-color: var(--ok); }
.tbtn { flex: none; width: 38px; height: 38px; border: 0; background: transparent; font-size: 18px; border-radius: 10px; }
.tbtn.sure { background: var(--bad-soft); }
.addtask { display: flex; gap: 8px; margin-top: 10px; }
.addtask input { flex: 1; min-width: 0; }
.addtask .btn { flex: none; padding: 0 16px; }

/* ---------- Lots ---------- */
.lot { width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; display: block; }
.lot:active { background: var(--amber-soft); }
.lot .lhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.lot .lpct { font-weight: 800; font-size: 18px; }
.lot .lpct.full { color: var(--ok); }
.lot small { display: block; color: var(--muted); margin-top: 6px; }
.prog.big { height: 18px; }
.prog.sm { height: 7px; flex: 1; }
.bigpct { font-size: 38px; font-weight: 800; text-align: center; margin-bottom: 8px; color: var(--navy); }
.mini { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.mini b { display: inline; font-size: 13px; min-width: 40px; text-align: right; }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 17px; }
.opt input { width: 24px; height: 24px; accent-color: var(--navy); flex: none; }
#bar { height: 100%; background: var(--ok); border-radius: 999px; transition: width .15s; }

.poids { display: inline-block; font-size: 12px; font-weight: 700; background: var(--amber-soft); color: var(--navy); padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 4px; white-space: nowrap; }
.prow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.prow span { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.prow input { width: 84px; text-align: center; font-weight: 700; padding: 8px; min-height: 44px; }
.prow b { color: var(--muted); }

/* Sélecteur de chantier : ancré en haut pour rester visible au-dessus du clavier */
#picker { align-items: flex-start; }
#picker .sheet { border-radius: 0 0 20px 20px; max-height: 100%; padding-top: env(safe-area-inset-top); animation: down .18s ease-out; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
#picker .sh-head { padding-bottom: 2px; }
@keyframes down { from { transform: translateY(-30px); opacity: .6; } }
#picker .pick-item small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#picker .pick-item { padding: 10px 14px; margin-bottom: 6px; }

/* sous-traitants : deux boutons côte à côte */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.two .btn { font-size: 14px; padding-left: 6px; padding-right: 6px; white-space: nowrap; }
.who-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--amber-soft); color: var(--text); margin-bottom: 4px; }
.who-tag.st { background: #e3ecff; color: #1d3f8f; }
#rq { width: 100%; min-height: 48px; font-size: 16px; }

/* commandes de matériel */
.cmd { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.cmd:first-child { border-top: 0; }
.cmd .cmain { flex: 1; min-width: 0; }
.cmd .cmain small { display: block; color: var(--muted); }
.tagbtn { background: none; border: 0; padding: 4px; }
.cres { margin-top: 8px; }
.catg { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 4px; }
.ci { display: flex; align-items: center; gap: 6px; }
.cat-item { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 6px; min-height: 46px; }
.cat-item small { color: var(--muted); flex: none; }
.cat-item:active { background: var(--amber-soft); }
.cat-item.other { border-style: dashed; }
.bl { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.bl:first-child { border-top: 0; }
.bl > b { flex: 1 1 100%; }
.bl .qty { display: flex; align-items: center; gap: 6px; flex: 1; }
.bl .qty button { width: 44px; height: 44px; font-size: 22px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; }
.bl .qty input { width: 80px; text-align: center; min-height: 44px; font-size: 18px; }
.tot { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.tot:first-of-type { border-top: 0; }
.urg { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.urg input { width: 22px; height: 22px; }
.cnote { font-size: 14px; margin-top: 2px; }
.thumbs.sm { grid-template-columns: repeat(3, 60px); margin-top: 6px; }
.thumbs.sm .th { width: 60px; height: 60px; }
.bl .lnote { flex: 1 1 100%; min-height: 42px; font-size: 15px; }
.bl .thumbs { flex: 1 1 auto; margin: 0; }

/* =====================================================================
   THÈMES DE COULEURS + finitions
   ===================================================================== */
:root, html[data-theme="electrique"] {
  --navy: #1e3a8a; --navy-2: #2563eb; --amber: #ff6b6b; --amber-soft: #ffe3e3;
  --bg: #eef2fb; --ok: #16a34a; --ok-soft: #dcf5e5; --line: #dfe5f1; --hdr-glow: rgba(37, 99, 235, .35);
}
html[data-theme="chantier"] {
  --navy: #2d2a32; --navy-2: #4a4452; --amber: #ff6b2c; --amber-soft: #ffe8db;
  --bg: #f7f4ef; --ok: #2f9e44; --ok-soft: #e0f3e4; --line: #e8e2d9; --hdr-glow: rgba(255, 107, 44, .30);
}
html[data-theme="foret"] {
  --navy: #0b5d46; --navy-2: #14906b; --amber: #f5b82e; --amber-soft: #fff1cc;
  --bg: #edf7f1; --ok: #15803d; --ok-soft: #d9f2e2; --line: #d9e8df; --hdr-glow: rgba(20, 144, 107, .35);
}
html[data-theme="ocean"] {
  --navy: #0b4f6c; --navy-2: #0e8aa6; --amber: #ff7a59; --amber-soft: #ffe5dd;
  --bg: #ecf7fa; --ok: #0f9d6e; --ok-soft: #d6f4ea; --line: #d6e6ec; --hdr-glow: rgba(14, 138, 166, .35);
}
html[data-theme="violet"] {
  --navy: #4c1d95; --navy-2: #7c3aed; --amber: #fbbf24; --amber-soft: #fff0c4;
  --bg: #f4f1fd; --ok: #16a34a; --ok-soft: #dcf5e5; --line: #e4def5; --hdr-glow: rgba(124, 58, 237, .35);
}
body { background: var(--bg); }
.top { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); box-shadow: 0 4px 18px var(--hdr-glow); }
.top .brand { font-size: 17px; }
.card, .day, .line, .lot, .pick-item { box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 20px rgba(16, 24, 40, .05); border-color: var(--line); }
.card { border-radius: 18px; padding: 14px 16px; }
.card h3 { font-size: 17px; }
.btn:not(.ghost):not(.amber):not(.danger) { background: linear-gradient(135deg, var(--navy), var(--navy-2)); box-shadow: 0 6px 16px var(--hdr-glow); }
.btn.amber { background: linear-gradient(135deg, var(--amber), color-mix(in srgb, var(--amber) 80%, #fff)); box-shadow: 0 6px 16px color-mix(in srgb, var(--amber) 45%, transparent); color: #1b1f27; }
.btn { border-radius: 14px; }
.btn.ghost { border-color: var(--line); color: var(--navy); }
.chip.on { background: linear-gradient(135deg, var(--navy), var(--navy-2)); border-color: transparent; }
.summary { background: linear-gradient(135deg, var(--navy), var(--navy-2)); box-shadow: 0 6px 16px var(--hdr-glow); }
.tabs { box-shadow: 0 -6px 20px rgba(16, 24, 40, .07); border-top: 0; }
.tabs button { border-radius: 14px; margin: 4px 2px; padding: 6px 2px 8px; }
.tabs button.on { box-shadow: none; background: color-mix(in srgb, var(--navy-2) 12%, transparent); color: var(--navy); }
.tabs button .ic { font-size: 24px; transition: transform .15s; }
.tabs button.on .ic { transform: translateY(-2px) scale(1.12); }
.prog { background: color-mix(in srgb, var(--navy) 10%, #fff); }
.prog div { background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 60%, #6ee7b7)); }
.bigpct { color: var(--navy); }
.sheet { border-radius: 24px 24px 0 0; }
.day.today { box-shadow: 0 0 0 2px var(--amber), 0 8px 20px rgba(16, 24, 40, .06); }
input:focus, textarea:focus { outline: 2px solid var(--navy-2); border-color: var(--navy-2); }
.login { padding-top: 56px; }
.login .logo { box-shadow: 0 10px 28px var(--hdr-glow); }
.login h1 { color: var(--navy); }
.frow .fmain b, .lot .lhead b { font-weight: 800; }
.emo { display: inline-block; width: 1.5em; text-align: center; }
.th-swatch { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; }
.th-swatch.on { border-color: var(--navy-2); background: color-mix(in srgb, var(--navy-2) 8%, #fff); }
.th-swatch .dots { display: flex; flex: none; }
.th-swatch .dots i { width: 26px; height: 26px; border-radius: 50%; margin-right: -8px; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.th-swatch b { flex: 1; }

/* =====================================================================
   EFFET VERRE (transparence façon Apple)
   ===================================================================== */
body {
  background:
    radial-gradient(60vmax 50vmax at 0% 0%, color-mix(in srgb, var(--navy-2) 38%, transparent), transparent 60%),
    radial-gradient(55vmax 45vmax at 100% 25%, color-mix(in srgb, var(--amber) 34%, transparent), transparent 60%),
    radial-gradient(60vmax 50vmax at 20% 100%, color-mix(in srgb, var(--navy) 30%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
.card, .day, .line, .lot, .pick-item, .frow, .post, .th-swatch {
  background: rgba(255, 255, 255, .58);
  -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 8px 28px rgba(31, 38, 135, .10), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.day.today { background: color-mix(in srgb, var(--amber) 22%, rgba(255, 255, 255, .6)); border-color: var(--amber); }
.th-swatch.on { background: color-mix(in srgb, var(--navy-2) 14%, rgba(255, 255, 255, .6)); }
.top {
  background: linear-gradient(135deg, color-mix(in srgb, var(--navy) 82%, transparent), color-mix(in srgb, var(--navy-2) 78%, transparent));
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, .25);
}
.tabs {
  background: rgba(255, 255, 255, .80);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid rgba(255, 255, 255, .8);
}
.overlay { background: rgba(10, 18, 35, .32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet {
  background: rgba(244, 247, 255, .74);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .8); border-bottom: 0;
}
.sheet .sh-foot { background: rgba(255, 255, 255, .55); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.sheet .card, .sheet .line, .sheet .pick-item { background: rgba(255, 255, 255, .6); }
input, textarea, select { background: rgba(255, 255, 255, .7); }
.btn.ghost { background: rgba(255, 255, 255, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.chip { background: rgba(255, 255, 255, .6); }

/* =====================================================================
   STYLE « iOS 27 » : verre plus clair, moins flou, bords nets, barre flottante
   ===================================================================== */
:root { --g: .40; }
.card, .day, .line, .lot, .pick-item, .frow, .post, .th-swatch, .chip, .btn.ghost {
  background: rgba(255, 255, 255, var(--g));
  -webkit-backdrop-filter: blur(9px) saturate(200%) brightness(1.04); backdrop-filter: blur(9px) saturate(200%) brightness(1.04);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 0 0 .5px rgba(20, 30, 60, .14), 0 10px 26px rgba(31, 38, 100, .12);
}
.day.today { background: color-mix(in srgb, var(--amber) 26%, rgba(255, 255, 255, var(--g))); }
.th-swatch.on { background: color-mix(in srgb, var(--navy-2) 18%, rgba(255, 255, 255, var(--g))); }
.chip.on { background: linear-gradient(135deg, var(--navy), var(--navy-2)); }
input, textarea, select { background: rgba(255, 255, 255, calc(var(--g) + .25)); border: 1px solid rgba(255, 255, 255, .9); box-shadow: inset 0 0 0 .5px rgba(20, 30, 60, .18); }
.top {
  background: linear-gradient(135deg, color-mix(in srgb, var(--navy) 70%, transparent), color-mix(in srgb, var(--navy-2) 62%, transparent));
  -webkit-backdrop-filter: blur(12px) saturate(200%); backdrop-filter: blur(12px) saturate(200%);
  box-shadow: inset 0 -.5px 0 rgba(10, 20, 50, .35), 0 6px 20px var(--hdr-glow);
}
/* barre d'onglets flottante en capsule */
.tabs {
  left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); padding-bottom: 0;
  border-radius: 30px; background: rgba(255, 255, 255, calc(var(--g) + .18));
  -webkit-backdrop-filter: blur(14px) saturate(200%); backdrop-filter: blur(14px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 0 0 .5px rgba(20, 30, 60, .16), 0 12px 32px rgba(20, 30, 90, .22);
  max-width: 720px; margin: 0 auto;
}
.tabs button { border-radius: 24px; margin: 5px 3px; }
.tabs button.on { background: rgba(255, 255, 255, .7); box-shadow: inset 0 0 0 .5px rgba(20, 30, 60, .2), 0 2px 8px rgba(20, 30, 90, .12); }
.tabs button .ic { filter: none; }
/* boutons en capsule */
.btn { border-radius: 999px; }
.btn:not(.ghost):not(.danger) { box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .45), inset 0 0 0 .5px rgba(0, 0, 0, .18), 0 6px 14px var(--hdr-glow); }
/* fenêtres : très claires, bord net */
.overlay { background: rgba(10, 18, 35, .22); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet {
  background: rgba(244, 247, 255, calc(var(--g) + .22));
  -webkit-backdrop-filter: blur(16px) saturate(200%); backdrop-filter: blur(16px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, .9); border-bottom: 0; border-radius: 32px 32px 0 0;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, .95), inset 0 0 0 .5px rgba(20, 30, 60, .14), 0 -10px 40px rgba(20, 30, 90, .2);
}
.sheet .sh-foot { background: rgba(255, 255, 255, .35); border-top: 0; }
.sheet .card, .sheet .line, .sheet .pick-item { background: rgba(255, 255, 255, calc(var(--g) + .1)); }
body { padding-bottom: 96px; }

/* =====================================================================
   THÈME « APPLE » (inspiré d'apple.com) : blanc/gris clair, noir, bleu Apple, très sobre
   ===================================================================== */
html[data-theme="apple"] {
  --navy: #1d1d1f; --navy-2: #1d1d1f; --amber: #0071e3; --amber-soft: #e8f2fd;
  --bg: #f5f5f7; --text: #1d1d1f; --muted: #6e6e73; --line: #e8e8ed; --ok: #30a46c; --ok-soft: #e3f6ec;
  --hdr-glow: rgba(0, 0, 0, 0); --g: 1;
  --blue: #0071e3;
}
html[data-theme="apple"] body {
  background: #f5f5f7;
  font-family: "Sora", system-ui, -apple-system, sans-serif;
  letter-spacing: -.01em;
}
/* barre du haut : blanche translucide, texte noir, comme le menu d'apple.com */
html[data-theme="apple"] .top {
  background: rgba(251, 251, 253, .8); color: #1d1d1f;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid rgba(0, 0, 0, .16); box-shadow: none;
}
html[data-theme="apple"] .top .brand { font-weight: 600; font-size: 17px; }
html[data-theme="apple"] .top .who { color: #6e6e73; opacity: 1; }
html[data-theme="apple"] .top .iconbtn, html[data-theme="apple"] .top button { color: #1d1d1f; }
/* cartes : blanc pur, grands arrondis, quasi sans ombre */
html[data-theme="apple"] .card, html[data-theme="apple"] .day, html[data-theme="apple"] .line, html[data-theme="apple"] .lot,
html[data-theme="apple"] .pick-item, html[data-theme="apple"] .frow, html[data-theme="apple"] .post, html[data-theme="apple"] .th-swatch {
  background: #fff; border: 0; border-radius: 22px;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .04);
}
html[data-theme="apple"] .day { border-radius: 18px; }
html[data-theme="apple"] .day.today { background: var(--amber-soft); box-shadow: inset 0 0 0 2px var(--blue); }
html[data-theme="apple"] .th-swatch.on { background: var(--amber-soft); box-shadow: inset 0 0 0 2px var(--blue); }
html[data-theme="apple"] .card h3 { font-weight: 700; letter-spacing: -.02em; }
html[data-theme="apple"] .bigpct { color: #1d1d1f; font-weight: 700; letter-spacing: -.03em; }
/* boutons : pastille bleue Apple */
html[data-theme="apple"] .btn:not(.ghost):not(.danger):not(.amber) { background: var(--blue); box-shadow: none; }
html[data-theme="apple"] .btn.amber { background: var(--blue); color: #fff; box-shadow: none; }
html[data-theme="apple"] .btn.ghost { background: transparent; color: var(--blue); border: 1px solid transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; background: #fff; }
html[data-theme="apple"] .btn { border-radius: 999px; font-weight: 500; }
html[data-theme="apple"] .btn.danger { box-shadow: none; }
html[data-theme="apple"] .chip { background: #fff; border: 0; box-shadow: none; color: #1d1d1f; -webkit-backdrop-filter: none; backdrop-filter: none; }
html[data-theme="apple"] .chip.on { background: #1d1d1f; color: #fff; }
/* bandeau « total » : noir comme les bandeaux d'apple.com */
html[data-theme="apple"] .summary { background: #1d1d1f; box-shadow: none; border-radius: 22px; }
html[data-theme="apple"] .prog { background: #e8e8ed; }
html[data-theme="apple"] .prog div { background: var(--ok); }
html[data-theme="apple"] input, html[data-theme="apple"] textarea, html[data-theme="apple"] select {
  background: #fff; border: 0; box-shadow: inset 0 0 0 1px #d2d2d7; border-radius: 14px;
}
html[data-theme="apple"] input:focus, html[data-theme="apple"] textarea:focus { outline: 0; box-shadow: 0 0 0 4px rgba(0, 113, 227, .3), inset 0 0 0 1px var(--blue); }
html[data-theme="apple"] .login h1 { color: #1d1d1f; font-weight: 700; letter-spacing: -.03em; font-size: 32px; }
html[data-theme="apple"] .login .logo { box-shadow: 0 4px 16px rgba(0, 0, 0, .12); }
/* barre d'onglets : verre blanc sobre */
html[data-theme="apple"] .tabs {
  background: rgba(251, 251, 253, .8); border: 0; border-radius: 28px;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12), 0 8px 30px rgba(0, 0, 0, .12);
}
html[data-theme="apple"] .tabs button { color: #6e6e73; font-weight: 500; }
html[data-theme="apple"] .tabs button.on { background: rgba(0, 0, 0, .06); color: var(--blue); box-shadow: none; }
/* fenêtres */
html[data-theme="apple"] .overlay { background: rgba(0, 0, 0, .3); }
html[data-theme="apple"] .sheet { background: #f5f5f7; border: 0; border-radius: 28px 28px 0 0; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 -10px 40px rgba(0, 0, 0, .15); }
html[data-theme="apple"] .sheet .sh-foot { background: rgba(251, 251, 253, .85); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid rgba(0, 0, 0, .12); }
html[data-theme="apple"] .sheet .card, html[data-theme="apple"] .sheet .line, html[data-theme="apple"] .sheet .pick-item { background: #fff; }
html[data-theme="apple"] .glass-ctl { display: none; }

/* icônes fines (remplacent les émojis) */
.ico { display: inline-block; width: 1.12em; height: 1.12em; vertical-align: -.2em; line-height: 0; }
.ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.tabs button .ic { display: block; margin: 0 auto 2px; }
.tabs button .ic .ico { width: 1em; height: 1em; }
.tabs button .ic .ico svg { stroke-width: 1.6; }
.btn .ico, .chip .ico { margin-right: 2px; }
.emo .ico { width: 1.15em; height: 1.15em; }
html[data-theme="apple"] .tabs button.on .ico, html[data-theme="apple"] .card h3 .ico { color: var(--blue); }

/* logo Helbul */
.logo-box { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 4px 0 26px; color: #1B2BFF; }
.logo-sym { width: 170px; height: auto; }
.logo-name { font-family: 'Sora', system-ui, sans-serif; font-weight: 600; font-size: 54px; line-height: 1; letter-spacing: -.03em; color: #0B1020; margin-top: 14px; }
.logo-tag { font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: #4F5A72; margin-top: 12px; max-width: 300px; line-height: 1.6; }
.top .brand { display: flex; align-items: center; gap: 9px; }
.top-sym { width: 30px; height: auto; flex: none; color: #fff; }
html[data-theme="apple"] .top-sym { color: #1B2BFF; }
.login .logo, .login h1 { display: none; }
.login { padding-top: 44px; }
.login p { text-align: center; }

/* ---------- Plan du chantier ---------- */
.sheet.tall { max-height: 94vh; min-height: 70vh; }
.bat-line { margin: 10px 0 4px; }
.bat-line .bl-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; font-size: 14px; }
.bat-line .bl-top span { color: var(--muted); font-size: 13px; }
.seg { display: flex; background: rgba(120, 120, 128, .14); border-radius: 12px; padding: 3px; margin-bottom: 10px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 8px 4px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.bat-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.bat-tabs button { flex: 1; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.bat-tabs button small { color: var(--muted); font-size: 12px; }
.bat-tabs button.on { border-color: var(--blue, var(--navy-2)); background: var(--amber-soft); }
.bat-tabs button.on b { color: var(--blue, var(--navy-2)); }
.plan-sum { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 6px; }
.plan-sum small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.bld { margin-top: 14px; }
.bld .roof { height: 18px; margin: 0 14px -1px; background: var(--navy); clip-path: polygon(0 100%, 8% 0, 92% 0, 100% 100%); opacity: .88; border-radius: 6px 6px 0 0; }
html[data-theme="apple"] .bld .roof { background: #1d1d1f; }
.flr { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 10px; text-align: left; box-shadow: inset 3px 0 0 var(--line); }
.flr:first-of-type { border-radius: 4px 4px 0 0; }
.flr.part { box-shadow: inset 3px 0 0 var(--blue, var(--navy-2)); }
.flr.full { box-shadow: inset 3px 0 0 var(--ok); background: var(--ok-soft); }
.flr .fl { width: 42px; font-weight: 700; font-size: 13px; flex: none; }
.flr .fb { position: relative; flex: 1; height: 26px; border-radius: 9px; background: rgba(120, 120, 128, .16); overflow: hidden; }
.flr .fb i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--blue, var(--navy-2)), color-mix(in srgb, var(--blue, var(--navy-2)) 70%, #7dd3fc)); border-radius: 9px; }
.flr.full .fb i { background: var(--ok); }
.flr .fb em { position: relative; z-index: 1; font-style: normal; font-weight: 700; font-size: 12px; line-height: 26px; padding-left: 10px; color: var(--text); mix-blend-mode: normal; }
.flr.part .fb em, .flr.full .fb em { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.flr .fp { display: flex; flex-direction: column; gap: 2px; flex: none; min-width: 52px; align-items: flex-end; }
.flr .fp u { text-decoration: none; font-size: 10.5px; font-weight: 700; color: #c026d3; background: #fae8ff; border-radius: 6px; padding: 1px 6px; }
.bld .ground { height: 8px; background: repeating-linear-gradient(45deg, #8e8e93 0 6px, #aeaeb2 6px 12px); border-radius: 0 0 6px 6px; }
.mat { background: #fff; border-radius: 16px; padding: 6px; }
.mrow { display: grid; grid-template-columns: 62px repeat(4, 1fr); align-items: center; gap: 5px; width: 100%; border: 0; background: transparent; padding: 3px 0; text-align: center; }
.mrow .fl { text-align: left; font-weight: 700; font-size: 13px; padding-left: 6px; }
.mrow .fl small { display: block; font-weight: 500; color: var(--muted); font-size: 10.5px; }
.mhead span { font-size: 18px; } .mhead small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 700; }
.mc { display: flex; align-items: center; justify-content: center; height: 34px; border-radius: 10px; background: rgba(120, 120, 128, .12); font-weight: 700; font-size: 12px; color: var(--text); }
.mc.part { background: color-mix(in srgb, var(--blue, var(--navy-2)) calc(18% + var(--p) * .5), #fff); color: #0b2a66; }
.mc.full { background: var(--ok); color: #fff; }
.legend { display: flex; gap: 14px; justify-content: center; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.legend .mc { display: inline-block; width: 14px; height: 14px; vertical-align: -3px; margin-right: 5px; border-radius: 5px; }
.nrow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.nrow .nn { font-weight: 600; font-size: 14px; }
.step { display: inline-flex; align-items: center; gap: 8px; }
.step button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(120, 120, 128, .16); font-size: 20px; line-height: 1; font-weight: 600; }
.step b { min-width: 52px; text-align: center; font-size: 14px; }
#pbody .chips { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 2px 0 6px; margin: 0 -2px; scrollbar-width: none; }
#pbody .chips::-webkit-scrollbar { display: none; }
#pbody .chip { flex: none; font-size: 12.5px; padding: 7px 12px; min-height: 0; white-space: nowrap; }
.nsub { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }

.ico svg.s64 { stroke-width: 3.2; }
