:root {
  --blue: #145064; --dark: #0d3545; --orange: #F0A000; --grey: #646464;
  --bg: #f2f5f6; --card: #ffffff; --line: #dfe5e8; --text: #1d2a30; --muted: #6b7a80;
  --ok: #1f8a4c; --ok-bg: #e6f4ec; --err: #c0392b; --err-bg: #fbeaea; --warn: #9a6400; --warn-bg: #fff4dc;
  --r: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
h1 { font-size: 1.45rem; margin: .2rem 0 1rem; color: var(--dark); }
h2 { font-size: 1.02rem; margin: 1.4rem 0 .6rem; color: var(--dark); }
.card > h2:first-child, section > h2:first-child { margin-top: 0; }
h3 { font-size: .95rem; margin: 1.2rem 0 .5rem; color: var(--dark); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.pre { white-space: pre-line; }
.empty { padding: 1rem; text-align: center; }
.pad { padding: .6rem .8rem; }
[hidden] { display: none !important; }

/* Mise en page */
.wrap { max-width: 860px; margin: 0 auto; padding: 16px 16px 110px; }
body.center-page .wrap { padding-bottom: 32px; }
.wrap.wide { max-width: 1240px; }
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(13,53,69,.06); border: 1px solid #e8edef; }
.narrow { max-width: 440px; margin: 6vh auto; }
.center-page main.card.narrow { margin: 5vh auto; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.head-row h1 { margin-bottom: .6rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.grid2, .grid3 { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: 1.3fr 1fr 1fr; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } .grid3 { grid-template-columns: 1fr 1fr; } .grid3 label:first-child { grid-column: 1 / -1; } }

/* Barre du haut */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: var(--dark); color: #fff; border-bottom: 3px solid var(--orange); }
.topbar .brand { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.topbar .brand span { color: #fff; }
.topbar .back { color: #fff; text-decoration: none; font-size: 2rem; line-height: 1; margin-right: -4px; padding: 0 6px 4px 0; }
.topnav { display: none; margin-left: 18px; gap: 4px; flex: 1; }
.topnav a { color: #cfe0e6; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.topnav a.on, .topnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar .me { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: var(--dark); font-weight: 700;
  display: flex; align-items: center; justify-content: center; text-decoration: none; }

/* Barre d'onglets mobile */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 8px; font-size: .72rem; color: var(--muted); text-decoration: none; }
.tabbar a i { font-style: normal; font-size: 1.25rem; line-height: 1.2; }
.tabbar a.on { color: var(--blue); font-weight: 600; }
.tabbar a.new i { background: var(--orange); color: #fff; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; }
/* Barre du bas adaptative : les onglets qui ne tiennent pas passent dans le menu « Plus ». — v2.57.0 */
.tabbar .tab-more { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 8px; font-size: .72rem; color: var(--muted); background: none; border: 0; cursor: pointer; font-family: inherit; white-space: nowrap; }
.tabbar .tab-more i { font-style: normal; font-size: 1.25rem; line-height: 1.2; }
.tabbar .tab-more.on { color: var(--blue); font-weight: 600; }
.tabbar.tab-measure a, .tabbar.tab-measure .tab-more { flex: 0 0 auto; }
.tab-sheet { position: fixed; left: 8px; right: 8px; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -8px 28px rgba(0,0,0,.2); padding: 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
.tab-sheet a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 11px 4px; font-size: .74rem; color: var(--muted); text-decoration: none; border-radius: 10px; white-space: nowrap; }
.tab-sheet a i { font-style: normal; font-size: 1.3rem; line-height: 1.2; position: relative; }
.tab-sheet a i .nbadge { position: absolute; top: -4px; right: -14px; margin: 0; }
.tab-sheet a.on { color: var(--blue); font-weight: 600; }
.tab-sheet a:active { background: var(--bg); }
@media (min-width: 900px) { .tab-sheet, .tabbar .tab-more { display: none !important; } }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .wrap { padding-bottom: 40px; }
  .sticky-actions { position: static !important; box-shadow: none !important; background: none !important; padding: 0 !important; }
}
/* Coquille flexible mobile : en-tête + barre du bas toujours visibles, seul .wrap défile.
   Corrige la barre du bas qui « remontait » au défilement sur iOS (viewport dynamique). — v2.52.0 */
@media (max-width: 899px) {
  html { height: 100%; }
  body.with-nav { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
  body.with-nav > .topbar { position: static; flex: 0 0 auto; }
  /* La zone de contenu ne doit jamais dépasser la largeur de l'écran (sinon les cartes sont coupées à droite). — v2.58.0 */
  body.with-nav > .wrap { flex: 1 1 auto; min-width: 0; max-width: 100%; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 20px; }
  body.with-nav > .tabbar { position: static; flex: 0 0 auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
  body.with-nav > .wrap .chat-form { bottom: 0; }
  /* La barre d'action « Valider » colle au bas de la zone défilante (la barre de navigation est déjà hors du
     contenu dans la coquille flex) — sinon elle flottait au milieu du formulaire. — v2.78.0 */
  body.with-nav > .wrap .sticky-actions { bottom: 0; }
}

/* Formulaires */
label { display: block; font-size: .85rem; font-weight: 600; color: var(--grey); margin-bottom: 12px; }
label small { display: block; font-weight: 400; margin-top: 4px; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 11px 12px; font: inherit; font-size: 16px; color: var(--text);
  border: 1px solid #cfd8dc; border-radius: 10px; background: #fff; -webkit-appearance: none; appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--grey) 50%), linear-gradient(135deg, var(--grey) 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[type=checkbox], input[type=radio] { display: inline-block; width: auto; margin: 0 8px 0 0; -webkit-appearance: auto; appearance: auto; transform: scale(1.25); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,80,100,.15); }
textarea { resize: vertical; }
label.check { display: flex; align-items: center; font-weight: 500; color: var(--text); font-size: .95rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 2px; margin: 0 0 16px; }
legend { font-weight: 700; color: var(--dark); padding: 0 6px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid #cfd8dc; background: #fff;
  color: var(--dark); font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--dark); }
.btn.danger { color: var(--err); border-color: #e9b8b2; }
.btn.small { padding: 7px 12px; font-size: .88rem; }
.btn.block { display: flex; width: 100%; }
.btn.big { padding: 15px; font-size: 1.08rem; margin-bottom: 14px; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--blue); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; padding: 0 0 0 10px; text-decoration: underline; }
.file-btn { cursor: pointer; margin: 0; }

.seg { display: flex; background: #e9eff1; border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px; border-radius: 8px; color: var(--grey); font-size: 1rem; cursor: pointer; }
.seg input:checked + span { background: #fff; color: var(--dark); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .95rem; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.err { background: var(--err-bg); color: var(--err); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* Listes */
.list { background: #fff; border-radius: var(--r); border: 1px solid #e8edef; overflow: hidden; margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #edf1f2; color: var(--text); text-decoration: none; }
.row:last-child { border-bottom: 0; }
.row:hover { background: #f8fafb; }
.row.off { opacity: .55; }
.row-main { flex: 1; min-width: 0; }
.row-sub { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.row-side { text-align: right; }
.search input { margin: 0 0 12px; padding-left: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 8px; }
.stats div { background: #fff; border-radius: var(--r); padding: 12px; border: 1px solid #e8edef; }
.stats b { display: block; font-size: 1.5rem; color: var(--dark); }
.stats span { font-size: .8rem; color: var(--muted); }
.stats .warn b { color: var(--warn); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0 0 10px; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }
.note { background: var(--warn-bg); padding: 10px 12px; border-radius: 8px; font-size: .92rem; }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); }
.tbl td { padding: 9px 8px; border-bottom: 1px solid #edf1f2; vertical-align: top; }
.tbl .r { text-align: right; }
.tbl.small { font-size: .8rem; }
.tbl.office td { white-space: nowrap; }
.tbl.office td.wrap-cell { white-space: normal; min-width: 140px; max-width: 280px; }

/* Suivi des commandes — v2.61.0 */
.order-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.order-filter input[type=search] { flex: 1 1 200px; margin: 0; }
.order-filter select { margin: 0; width: auto; }
.order-filter .btn { margin: 0; }
.order-sum { margin: 6px 0 12px; color: var(--muted); font-size: .9rem; }
.orders-tbl td.num { text-align: right; white-space: nowrap; }
.orders-tbl th.num { text-align: right; }
.orders-tbl .os-select { margin: 0; padding: 4px 6px; font-size: .85rem; width: auto; }
.orders-tbl .row-actions { white-space: nowrap; text-align: right; }
.orders-tbl .row-actions .btn { margin: 0 0 0 4px; padding: 4px 8px; }
.orders-tbl tr.order-note td { border-bottom: 1px solid #edf1f2; padding-top: 0; }
@media (max-width: 720px) {
  .orders-tbl thead { display: none; }
  .orders-tbl, .orders-tbl tbody, .orders-tbl tr, .orders-tbl td { display: block; width: 100%; }
  .orders-tbl tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 6px 10px; }
  .orders-tbl td { border: 0; padding: 4px 0; text-align: left !important; }
  .orders-tbl td.num { text-align: left; }
  .orders-tbl td[data-l]::before { content: attr(data-l) " : "; font-weight: 600; color: var(--muted); }
  .orders-tbl td.row-actions::before, .orders-tbl td[data-l=""]::before { content: ""; }
  .orders-tbl tr.order-note td { padding-left: 0; }
}
.filters { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.filters label { flex: 1 1 140px; }
.filters .grow { flex: 2 1 220px; }
.filter-btns { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

/* Formulaire BL */
.client-pill { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #ecf2f4; border-radius: 10px; padding: 12px; }
.results { margin: 6px 0 10px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.results:empty { display: none; }
.result { display: block; width: 100%; text-align: left; padding: 11px 12px; background: #fff; border: 0; border-bottom: 1px solid #edf1f2; font: inherit; cursor: pointer; }
.result:last-child { border-bottom: 0; }
.result span { display: block; font-size: .85rem; }
.result:hover { background: #f5f8f9; }
#client_search { margin: 0 0 8px; }
.subform { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.lines .line { display: grid; grid-template-columns: 90px 1fr 62px 36px; gap: 6px; margin-bottom: 8px; }
.lines input { margin: 0; padding: 10px 8px; }
.l-qty { text-align: center; }
.l-del { border: 0; background: #f1f4f5; border-radius: 8px; font-size: 1.3rem; color: var(--grey); cursor: pointer; }
@media (max-width: 420px) { .lines .line { grid-template-columns: 1fr 58px 36px; } .lines .l-ref { grid-column: 1 / -1; } }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 10px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; background: #eee; }
.ph { position: relative; }
.ph button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.1rem; cursor: pointer; }
.sig-label { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; font-weight: 600; color: var(--grey); margin: 4px 0 6px; }
canvas.sigpad { display: block; width: 100%; height: 190px; border: 2px dashed #b9c6cb; border-radius: 10px; background: #fff; touch-action: none; margin-bottom: 14px; cursor: crosshair; }
canvas.sigpad.signed { border-style: solid; border-color: var(--blue); }
.sig-current { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.sig-preview { height: 80px; max-width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px; }
.sticky-actions { position: sticky; bottom: calc(58px + env(safe-area-inset-bottom)); padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.sticky-actions .btn { margin: 0; box-shadow: 0 4px 14px rgba(13,53,69,.25); }
.sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sigs figure { margin: 0; }
.sigs img, .sigs figure > div { width: 100%; height: 110px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.sigs figcaption { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { margin: 0; flex: 1; }

/* Connexion */
.login { padding: 28px 22px; }
.logo-big { text-align: center; margin-bottom: 22px; }
.logo-big span { display: inline-block; font-size: 1.9rem; font-weight: 800; letter-spacing: 1px; color: var(--dark); border-bottom: 4px solid var(--orange); padding-bottom: 2px; }
.logo-big small { display: block; color: var(--muted); margin-top: 8px; }
.logo-prev { max-width: 240px; max-height: 80px; display: block; margin-bottom: 8px; }
.qr-prev { width: 110px; display: block; margin-bottom: 6px; }
code { font-size: .85em; }

/* v1.1 : BL en attente, suppression, catalogue de pièces */
:root { --info: #145064; --info-bg: #e3eef2; }
.badge.info { background: var(--info-bg); color: var(--info); }
.alert.info { background: var(--info-bg); color: var(--info); }
a.block-link { display: block; text-decoration: none; }
.nbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px;
  background: var(--orange); color: var(--dark); font-size: .72rem; font-weight: 800; font-style: normal; line-height: 1; vertical-align: 2px; }
.tabbar a i { position: relative; }
.tabbar a i .nbadge { position: absolute; top: -4px; right: -14px; margin: 0; }
form.inline { display: inline; margin: 0; }
.row-btns { display: flex; gap: 6px; justify-content: flex-end; }
.actions form.inline .btn { height: 100%; }
.note { margin-bottom: 14px; }
.lines .part-results { grid-column: 1 / -1; margin: 0 0 4px; max-height: 280px; overflow-y: auto; box-shadow: 0 4px 14px rgba(13,53,69,.12); }
.lines .part-results .result { padding: 9px 12px; }
.tbl .c { text-align: center; }
.tbl.office tr.billed td { opacity: .45; }
.geo-note { margin: 0 0 10px; }
.geo-pin { text-decoration: none; }
.ebp-card .file-btn { margin-bottom: 8px; }
#ebp_status { margin: 4px 0 0; }

/* Bandeau d'installation */
.install-banner { position: fixed; left: 10px; right: 10px; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 30; display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 12px; padding: 10px 10px 10px 12px; box-shadow: 0 6px 24px rgba(13,53,69,.22); font-size: .88rem; }
body.center-page .install-banner { bottom: calc(14px + env(safe-area-inset-bottom)); }
.install-banner img { width: 40px; height: 40px; border-radius: 9px; flex: none; }
.install-banner .ib-txt { flex: 1; line-height: 1.35; }
.install-banner .ib-txt strong:first-child { display: block; color: var(--dark); }
.install-banner .ib-x { border: 0; background: none; font-size: 1.5rem; color: var(--muted); cursor: pointer; padding: 0 4px; align-self: flex-start; }
@media (min-width: 900px) { .install-banner { left: auto; right: 20px; bottom: 20px; max-width: 420px; } }
.ios-share { display: inline-block; width: 15px; height: 18px; vertical-align: -3px; margin: 0 2px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 24' fill='none' stroke='%23007AFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 15V2M5.5 6.5 10 2l4.5 4.5'/%3E%3Cpath d='M6 10H3v12h14V10h-3'/%3E%3C/svg%3E"); }

/* Adresse cliquable + choix de l'appli de navigation */
a.nav-addr:not(.btn) { color: var(--blue); text-decoration: none; display: inline-block; }
a.nav-addr:not(.btn)::after { content: ''; display: inline-block; width: 14px; height: 14px; margin-left: 6px; vertical-align: -1px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23145064'%3E%3Cpath d='M21.7 2.3a1 1 0 0 0-1.1-.2l-18 8a1 1 0 0 0 .1 1.9l7.6 2.1 2.1 7.6a1 1 0 0 0 1.9.1l8-18a1 1 0 0 0-.6-1.5z'/%3E%3C/svg%3E"); }
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(13,53,69,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; background: #fff; border-radius: 16px 16px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 30px rgba(0,0,0,.2); }
@media (min-width: 600px) { .sheet-bg { align-items: center; } .sheet { border-radius: 16px; } }
.sheet-title { font-size: .8rem; color: var(--muted); text-align: center; }
.sheet-addr { font-weight: 600; color: var(--dark); text-align: center; margin: 2px 0 12px; font-size: .95rem; }
.sheet-btn { display: block; width: 100%; padding: 14px; margin-bottom: 8px; border-radius: 12px; border: 1px solid var(--line); background: #f7f9fa;
  color: var(--dark); font: inherit; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; }
.sheet-btn.app-waze { background: #33ccff; border-color: #33ccff; color: #fff; }
.sheet-btn.app-gmaps { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.sheet-btn.app-apple { background: #111; border-color: #111; color: #fff; }
.sheet-cancel { background: #fff; color: var(--muted); margin-bottom: 0; }
a.nav-addr.cs-addr { display: block; font-size: .92rem; margin-top: 2px; }
a.nav-addr.cs-addr:empty { display: none; }

/* Logo dans la barre du haut (fond blanc : le logo est en couleurs sur fond clair) */
.topbar .brand { display: inline-flex; align-items: center; }
.topbar .brand-logo { display: block; height: 36px; width: auto; max-width: 150px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px 8px; }
@media (max-width: 380px) { .topbar .brand-logo { height: 32px; max-width: 128px; } }
.logo-big .login-logo { display: block; max-width: 240px; max-height: 72px; margin: 0 auto; }
.grid2.tight, .grid2 .grid2.tight { grid-template-columns: 1.4fr 1fr; gap: 0 10px; }
@media (max-width: 520px) { .grid2.tight { grid-template-columns: 1.4fr 1fr; } }
.home-results { margin: -4px 0 14px; background: #fff; }
a.result { color: var(--text); text-decoration: none; }
a.result.more { color: var(--blue); font-weight: 600; font-size: .9rem; }

/* Localisation par technicien */
.geo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.geo-card { display: flex; flex-direction: column; gap: 2px; margin: 0; text-decoration: none; color: var(--text); }
.geo-card.on { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(20,80,100,.25); }
.geo-card.off { opacity: .55; }
.geo-map-card { padding: 6px; }
.geo-map { position: relative; z-index: 0; isolation: isolate; height: 460px; border-radius: 8px; }
@media (max-width: 600px) { .geo-map { height: 340px; } }
.geo-pin-num span, .geo-num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--dark); color: #fff; font-weight: 700; font-size: .8rem; border: 2px solid var(--orange); }
.geo-pin-num { background: none; border: 0; }

/* Mobile : écran d'autorisation de la localisation */
html.gated, html.gated body { overflow: hidden; }
.geo-gate { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow-y: auto; display: flex; align-items: flex-start; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.geo-gate-box { width: 100%; max-width: 440px; background: #fff; border-radius: 16px; padding: 24px 20px; box-shadow: 0 4px 24px rgba(13,53,69,.12); text-align: center; }
.geo-gate-ico { font-size: 2.6rem; line-height: 1; margin-bottom: 8px; }
.geo-gate h2 { margin: 0 0 10px; font-size: 1.25rem; }
.geo-gate ol { text-align: left; padding-left: 20px; font-size: .9rem; margin: 6px 0 16px; }
.geo-gate ol li { margin-bottom: 6px; }
.geo-gate .btn.big { margin: 8px 0 12px; }
.geo-gate .link { padding: 0; }
.seg.seg4 span { padding: 10px 4px; font-size: .95rem; }
@media (max-width: 560px) { .seg.seg4 { flex-wrap: wrap; } .seg.seg4 label { flex: 1 1 50%; } }

/* Bons à suivre + notes internes */
.follow-box .actions { margin: 10px 0 0; }
.series { display: flex; gap: 8px; flex-wrap: wrap; }
.series-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--text); font-size: .9rem; }
.series-item b { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #e9eff1; color: var(--dark); }
.series-item.on { border-color: var(--blue); }
.series-item.on b { background: var(--blue); color: #fff; }
.internal-note { border-left: 4px solid var(--grey); }
.internal-note textarea { margin-bottom: 8px; }

/* Tableau de bord (bureau) */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { display: block; background: #fff; border: 1px solid #e8edef; border-radius: var(--r); padding: 12px 14px; text-decoration: none; color: var(--text); }
a.kpi:hover { border-color: var(--blue); }
.kpi b { display: block; font-size: 1.7rem; line-height: 1.15; color: var(--dark); font-variant-numeric: tabular-nums; }
.kpi span { font-size: .82rem; color: var(--muted); }
.kpi .late { font-style: normal; color: var(--err); font-weight: 600; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.list.flat { border: 0; margin: 0; }
.list.flat .row { padding: 10px 4px; }
.row-time { min-width: 62px; font-weight: 700; color: var(--dark); font-variant-numeric: tabular-nums; }
.row-time.late { color: var(--err); font-size: .85rem; }
.bars { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 150px; border-bottom: 1px solid var(--line); padding-top: 22px; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; outline: none; }
.bar-col .bar { display: block; width: 100%; background: var(--blue); border-radius: 4px 4px 0 0; min-height: 0; }
.bar-col:hover .bar, .bar-col:focus .bar { background: var(--dark); }
.bar-col:hover, .bar-col:focus { background: rgba(20,80,100,.06); }
.bars-tip { position: absolute; top: 0; background: var(--dark); color: #fff; font-size: .78rem; padding: 3px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.bars-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: 4px; }

/* Code couleur des dates prévues */
.due { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.due-late { background: var(--err-bg); color: var(--err); }
.due-today { background: #fff1d6; color: #9a5b00; }
.due-soon { background: var(--info-bg); color: var(--info); }
.due-future { background: #eef2f3; color: var(--muted); }
.due-nodate { background: #eef2f3; color: var(--muted); font-weight: 600; }
.due-row { border-left: 5px solid transparent; }
.due-row-late { border-left-color: var(--err); background: #fff8f7; }
.due-row-today { border-left-color: var(--orange); }
.due-row-soon { border-left-color: var(--blue); }
.due-row-future, .due-row-nodate { border-left-color: #c9d3d7; }
.due-legend { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.due-legend .due { font-size: .7rem; }
/* Onglet boutique */
.tabbar a.shop { color: var(--orange); }
.ico-shop { display: inline-block; width: 22px; height: 22px; margin: 1px 0 2px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F0A000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4h2l2.4 10.2a1.5 1.5 0 0 0 1.5 1.1h8.6a1.5 1.5 0 0 0 1.5-1.1L21 7H6.2'/%3E%3Ccircle cx='9.5' cy='19.5' r='1.5'/%3E%3Ccircle cx='17' cy='19.5' r='1.5'/%3E%3C/svg%3E"); }
.due-top { margin-bottom: 4px; }
.icon-prev { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.icon-prev img { width: 84px; height: 84px; border-radius: 19px; box-shadow: 0 2px 8px rgba(0,0,0,.18); flex: none; }
.tbl.perms td, .tbl.perms th { vertical-align: middle; }
.tbl.perms th.c { text-align: center; min-width: 110px; }
.role-perms { margin: -6px 0 12px; }
#office_results.loading { opacity: .55; transition: opacity .15s; }
.line.line-auto input { background: #f6fafb; }
tr.row-late td { background: #fff8f7; }
.txt-late { color: var(--err); }
.bill-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 400; margin: 0; }
.client-pending { margin-top: 8px; }
.client-pending a { font-weight: 600; }
.client-pending ul { margin: 6px 0 0; padding-left: 18px; }

/* Messagerie */
.seg-tabs { overflow-x: auto; }
.seg-tabs a { flex: 1; text-align: center; padding: 9px 8px; border-radius: 8px; color: var(--grey); text-decoration: none; white-space: nowrap; font-size: .92rem; }
.seg-tabs a.on { background: #fff; color: var(--dark); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.seg.seg3 span { padding: 8px 4px; font-size: .92rem; }
.thread-row.unread { background: #f4f9fb; }
.thread-row.unread strong { color: var(--dark); }
.to-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-flex; margin: 0; font-weight: 500; color: var(--text); }
.chip input { position: absolute; opacity: 0; }
.chip span { padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: #fff; cursor: pointer; font-size: .9rem; }
.chip span small { color: var(--muted); }
.chip input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip input:checked + span small { color: #cfe0e6; }
.msg-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.msg-photo img, .chat-form img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; }
.msg-more { margin-bottom: 14px; font-size: .9rem; }
.msg-more summary { cursor: pointer; color: var(--blue); margin-bottom: 8px; }
.thread-head h1 { margin-bottom: .3rem; font-size: 1.2rem; }
.thread-ctl { margin-top: 12px; }
.thread-ctl .seg { margin-bottom: 8px; }
.members .seen { color: var(--ok); }
.chat { display: flex; flex-direction: column; gap: 10px; padding: 6px 0 12px; }
.chat-day { align-self: center; font-size: .72rem; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; margin: 4px 0; }
.msg-row { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.msg-row.them { align-self: flex-start; }
.msg-row.me { align-self: flex-end; flex-direction: row-reverse; }
.msg-row .av { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .7rem; }
.av.g-bureau { background: #145064; } .av.g-tech { background: #cf7a0c; } .av.g-it { background: #2b8a7a; } .av.g-sales { background: #7a4fb0; }
.bubble { min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 12px; }
.bubble.mine { background: var(--blue); border-color: var(--blue); color: #fff; border-radius: 14px 14px 4px 14px; }
.bubble .b-name { font-size: .76rem; font-weight: 700; color: var(--blue); margin-bottom: 1px; }
.bubble .b-body { white-space: normal; overflow-wrap: anywhere; }
.bubble img { display: block; max-width: 220px; max-height: 220px; border-radius: 8px; margin-top: 4px; }
.bubble .b-at { font-size: .68rem; color: var(--muted); text-align: right; margin-top: 2px; }
.bubble.mine .b-at { color: rgba(255,255,255,.75); }
.chat-ev { align-self: center; font-size: .78rem; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: 3px 10px; border-radius: 99px; text-align: center; }

/* Liste des conversations (messagerie) */
.conv-list .conv { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-bottom: 1px solid var(--line); position: relative; text-decoration: none; color: var(--text); background: var(--card); }
.conv-list .conv:last-child { border-bottom: 0; }
.conv-list .conv::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.conv-list .conv.s-todo::before { background: var(--orange); }
.conv-list .conv.s-wip::before { background: var(--blue); }
.conv-list .conv:hover { background: var(--bg); }
.conv .av { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .9rem; }
.conv .c-main { min-width: 0; flex: 1; }
.conv .c-top { display: flex; align-items: baseline; gap: 8px; }
.conv .c-subj { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .c-subj { font-weight: 800; }
.conv .c-time { margin-left: auto; flex: 0 0 auto; font-size: .76rem; color: var(--muted); }
.conv.unread .c-time { color: var(--orange); font-weight: 700; }
.conv .c-prev { font-size: .86rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv.unread .c-prev { color: var(--text); }
.conv .c-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin-top: 5px; font-size: .74rem; color: var(--muted); }
.pill { font-size: .68rem; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill.todo { background: var(--warn-bg); color: var(--warn); }
.pill.wip { background: #e7eef1; color: var(--blue); }
.pill.done { background: var(--ok-bg); color: var(--ok); }
.conv .c-badge { flex: 0 0 auto; align-self: center; background: var(--orange); color: var(--dark); font-weight: 800; font-size: .72rem; min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; }
.conv-wrap { position: relative; }
.conv-list .conv-wrap:last-child .conv { border-bottom: 0; }
.conv-wrap .conv { padding-right: 42px; }
.conv-del { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: 1rem; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; opacity: .55; }
.conv-del:hover { opacity: 1; background: var(--err-bg); color: var(--err); }

/* Tchat : présence, « en train d'écrire », bouton flottant */
.on-txt { color: var(--ok); font-weight: 600; }
.conv .av { position: relative; }
.conv .av .dot-on { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--card); }
.typing { font-size: .8rem; color: var(--ok); font-style: italic; padding: 2px 4px 8px; }
.chat-fab { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(70px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 1.5rem; text-decoration: none; box-shadow: 0 3px 12px rgba(13,53,69,.3); z-index: 15; }
@media (min-width: 900px) { .chat-fab { bottom: calc(20px + env(safe-area-inset-bottom, 0px)); } }

/* Fenêtre « nouvelle discussion » (bouton flottant global) */
.qc-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(13,53,69,.45); display: flex; align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 640px) { .qc-overlay { align-items: center; padding: 20px; } }
.qc-box { background: var(--card); width: 100%; max-width: 460px; max-height: 85vh; display: flex; flex-direction: column; border-radius: 16px 16px 0 0; overflow: hidden; box-shadow: 0 -4px 24px rgba(0,0,0,.25); }
@media (min-width: 640px) { .qc-box { border-radius: 16px; } }
.qc-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--dark); color: #fff; }
.qc-head strong { font-size: 1.02rem; }
.qc-x { background: rgba(255,255,255,.14); color: #fff; border: 0; width: 30px; height: 30px; border-radius: 50%; font-size: 1rem; cursor: pointer; }
.qc-search { margin: 12px 16px 6px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.qc-people { overflow-y: auto; padding: 4px 16px; flex: 1; }
.qc-grp { margin-bottom: 10px; }
.qc-grp-t { font-size: .74rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin: 6px 0 4px; }
.qc-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; margin: 0 6px 6px 0; cursor: pointer; font-size: .9rem; }
.qc-chip input { margin: 0; }
.qc-chip:has(input:checked), .qc-chip.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.qc-box textarea { margin: 6px 16px; resize: none; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); font: inherit; }
.qc-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.qc-foot .btn { margin: 0; }

/* Fenêtres de chat flottantes (style Messenger) */
.chatdock { position: fixed; right: 84px; bottom: 0; z-index: 40; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 12px; padding: 0 0 10px; pointer-events: none; }
.chatdock .cw { pointer-events: auto; }
.cw { width: 320px; max-width: calc(100vw - 32px); height: 440px; max-height: calc(100vh - 100px); background: var(--card); border: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: 0 6px 28px rgba(13,53,69,.28); display: flex; flex-direction: column; overflow: hidden; }
.cw.min { height: auto !important; }
.cw.min .cw-body, .cw.min .cw-form, .cw.min .cw-typing { display: none; }
.cw-head { background: var(--dark); color: #fff; display: flex; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer; }
.cw-title { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.cw-pres { font-size: .7rem; opacity: .85; white-space: nowrap; flex: 0 0 auto; }
.cw-pres.on-txt { color: #7ee0a8; opacity: 1; }
.cw-btns { display: flex; gap: 2px; flex: 0 0 auto; }
.cw-ic { background: transparent; border: 0; color: #fff; width: 26px; height: 26px; border-radius: 6px; font-size: 1rem; line-height: 1; cursor: pointer; text-decoration: none; display: grid; place-items: center; }
.cw-ic:hover { background: rgba(255,255,255,.14); }
.cw-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.cw-body .msg-row { max-width: 92%; }
.cw-typing { font-size: .76rem; color: var(--ok); font-style: italic; padding: 3px 10px 7px; background: var(--bg); }
.cw-form { display: flex; align-items: flex-end; gap: 6px; padding: 8px; border-top: 1px solid var(--line); background: var(--card); }
.cw-form textarea { flex: 1; resize: none; min-height: 38px; max-height: 110px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; background: var(--bg); }
.cw-send { flex: 0 0 auto; width: 40px; height: 38px; border: 0; border-radius: 10px; background: var(--blue); color: #fff; font-size: 1.05rem; cursor: pointer; }
@media (max-width: 640px) {
  .chatdock { left: 0; right: 0; padding: 0 8px calc(60px + env(safe-area-inset-bottom, 0px)); justify-content: center; }
  .chatdock .cw ~ .cw { display: none; }
  .cw { width: 100%; max-width: 100%; height: 62vh; border-radius: 12px; }
  body.has-cw .chat-fab { display: none; }
}
.chat-form { position: sticky; bottom: calc(58px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; background: var(--bg); padding: 8px 0; }
.chat-form textarea { margin: 0; flex: 1; resize: none; min-height: 44px; }
.chat-form .btn { margin: 0; }
.chat-validate { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: .82em; color: var(--muted); cursor: pointer; padding: 0 2px; }
.chat-validate input { margin: 0; }
@media (min-width: 900px) { .chat-form { bottom: 0; } }
.push-banner { border-left-color: var(--blue); }
.tabbar a { white-space: nowrap; }
@media (max-width: 420px) { .tabbar a { font-size: .66rem; } }
.due-todo { background: #fff1d6; color: #9a5b00; }
.due-row-todo { border-left-color: var(--orange); }
.geo-legend { display: flex; gap: 16px; margin: -4px 0 8px; color: var(--muted); align-items: center; }
.geo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.geo-legend .lg-trail { display: inline-block; width: 22px; height: 3px; background: #145064; opacity: .7; border-radius: 2px; }
.geo-legend .geo-num { width: 20px; height: 20px; font-size: .7rem; font-style: normal; }
.warn-txt { color: var(--warn); }

/* Journal du bon atelier */
.steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.step { border-left: 3px solid var(--primary, #1f6f8b); padding: 4px 0 4px 10px; }
.step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-head form { margin-left: auto; }
.step p { margin: 4px 0 0; }
.step-photo { display: block; max-width: 160px; max-height: 160px; border-radius: 8px; margin-top: 6px; object-fit: cover; }
.step-form { border-top: 1px solid var(--line, #e3e7ea); padding-top: 10px; }
.step-form .file-row { display: flex; align-items: center; gap: 8px; }

/* En attente : groupes Mes BL / Atelier / Télémaintenance */
.pend-group { margin-bottom: 22px; }
.pend-group h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pend-group > .muted { margin-top: 0; }
.pend-group h2 { border-left: 4px solid var(--dark, #0d3446); padding-left: 8px; }
.pend-atelier h2 { border-left-color: #e8a33d; }
.pend-telemaintenance h2 { border-left-color: #3d8be8; }
.pend-group + .pend-group { border-top: 1px solid #dde4e8; padding-top: 14px; }

/* Parc matériel */
.equip-pick { margin: -4px 0 12px; }
.eq-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.eq-chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; font-size: .88rem; cursor: pointer; color: var(--text); }
.eq-chip:active { background: #e9eff1; }
.eq-warr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 12px; }
.equip-row .row-sub .badge { margin-right: 6px; }

/* Messagerie : destinataires par groupe (Bureau / Techniciens / Informatique / Commerciaux) */
.to-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin: 6px 0 14px; align-items: start; }
.to-group { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 12px; margin: 0; }
.to-group legend { font-weight: 600; font-size: .9rem; padding: 0 6px; display: flex; align-items: center; gap: 8px; }
.to-group legend .link { font-weight: 500; font-size: .82rem; }
.seg-groups { flex-wrap: wrap; margin-top: 8px; }
.seg-groups a { flex: 0 1 auto; padding: 7px 12px; }

/* Garantie en lecture seule (profils sans droit de saisie) */
.field-label { font-size: .85rem; font-weight: 600; color: var(--grey); margin-bottom: 6px; }
.warr-ro { margin: 2px 0 0; }

/* Suppression d'une conversation (admin) */
.thread-del { margin-top: 10px; text-align: right; }

/* En attente (admin) : filtre par personne */
.pend-filter { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.pend-filter label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .95rem; cursor: pointer; }
.pend-filter .pf-all { flex: 0 0 100%; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.pend-person h2 { border-left: 4px solid var(--dark, #0d3446); padding-left: 8px; }

/* Nouveau message : praticien / client + matériel */
.msg-client { margin-bottom: 14px; }
.msg-client > label { display: block; font-size: .85rem; font-weight: 600; color: var(--grey); margin-bottom: 6px; }
.mc-equip { margin-top: 10px; }

/* Recommande de pièces (réappro) */
.rlines .rline { display: grid; grid-template-columns: 90px 1fr 54px 110px 36px; gap: 6px; margin-bottom: 8px; position: relative; }
.rlines .rline .rpart-results { grid-column: 1 / -1; }
.rl-qty { text-align: center; }
.rl-del { border: 0; background: #f1f4f5; border-radius: 8px; font-size: 1.3rem; color: var(--grey); cursor: pointer; }
#rl_from_lines { margin-bottom: 10px; }
@media (max-width: 480px) { .rlines .rline { grid-template-columns: 1fr 50px 100px 36px; } .rlines .rl-ref { grid-column: 1 / -1; } }

/* À faire */
.todo-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* À faire — partage (listes Perso / En commun) v2.63.0 */
.todo-tabs { margin: 0 0 12px; }
.seg-tabs .seg-count { display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 5px; border-radius: 11px; background: var(--orange); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.5; vertical-align: middle; }
.todo-add-actions { flex-basis: 100%; display: flex; gap: 8px; }
.todo-add-actions .btn { margin: 0; }
.todo-share-wrap { flex-basis: 100%; }
.todo-share-wrap > summary { margin: 2px 0; }
.todo-share-sec { width: 100%; }
.todo-grp-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.todo-grp-row .todo-grp-btn { margin: 0; }
.todo-grp-row .todo-grp-btn.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.todo-share-box { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.todo-edit-form .todo-share-box { margin-bottom: 4px; }
.todo-add input[name=title] { flex: 1 1 180px; }
.todo-row { display: flex; align-items: center; gap: 10px; }
.todo-row .row-main { flex: 1; }
.todo-row.done .row-main strong { text-decoration: line-through; color: var(--muted); }
.todo-list .row-sub { margin-top: 2px; }
.seg-sort { align-items: center; gap: 6px; flex-wrap: wrap; }
.seg-sort .muted { padding: 0 4px; }

/* À faire : praticien + lieu */
.todo-cl { flex: 1 1 180px; position: relative; }
.todo-cl #tc_box input, .todo-add input[name=place] { width: 100%; }
.todo-add input[name=place] { flex: 1 1 140px; }
.todo-pill { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #ecf2f4; border-radius: 8px; padding: 8px 10px; }
.todo-cl .results { position: absolute; left: 0; right: 0; z-index: 5; background: #fff; }

/* Pilotage */
.pilot-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.bars-month { height: 175px; }
.bars-month .bar-col { flex-direction: column; justify-content: flex-end; gap: 4px; }
.bars-month .bar-col .bar { flex: 0 0 auto; }
.bars-month .bar-col small { font-size: .6rem; color: var(--muted); white-space: nowrap; }
.type-bars, .rank { display: flex; flex-direction: column; gap: 12px; }
.type-head, .rank-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .92rem; margin-bottom: 4px; }
.type-track { height: 10px; background: #eef3f5; border-radius: 6px; overflow: hidden; }
.type-fill { display: block; height: 100%; background: var(--blue); border-radius: 6px; }

/* Maintenance / Tournées */
.maint-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 12px; margin: 0 0 14px; }
.maint-box legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.maint-done { display: inline-flex; gap: 6px; align-items: center; }
.maint-done input[type=month] { width: 130px; }
.tour-map { position: relative; z-index: 0; isolation: isolate; height: clamp(300px, 58vh, 540px); border-radius: 12px; overflow: hidden; margin-bottom: 10px; border: 1px solid var(--line); }
@media (max-width: 560px) { .tour-map { height: 240px; } }
.tour-pin span { display: block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.map-card { padding: 12px; }
.map-card .tour-map { margin-bottom: 0; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 10px; }
.map-leg { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--ink); }
button.map-leg { background: #f1f5f6; border: 1px solid #dfe6e8; border-radius: 20px; padding: 4px 11px 4px 8px; cursor: pointer; }
button.map-leg.off { opacity: .4; text-decoration: line-through; }
.map-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
/* Onglets segment du Commercial : couleurs de la carte */
.deal-segs a { display: flex; align-items: center; justify-content: center; }
.deal-segs .seg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex: none; }
.deal-segs a.on { background: var(--seg-c); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.deal-segs a.on .seg-dot { background: #fff !important; }
/* Onglets du module commercial (ligne d'onglets façon navigation) */
.subnav { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 12px; padding: 4px; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px; -webkit-overflow-scrolling: touch; }
.subnav a { white-space: nowrap; padding: 8px 14px; border-radius: 8px; color: var(--grey); text-decoration: none; font-size: .92rem; font-weight: 500; }
.subnav a.on { background: var(--blue, #145064); color: #fff; }
.subnav a:not(.on):hover { background: rgba(0,0,0,.05); }
/* Catalogue de pièces */
.part-row { display: flex; align-items: center; gap: 8px; }
.part-edit { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.part-edit .row-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.part-edit .row-main strong { flex: 0 0 auto; }
.part-edit .ti.wide { flex: 1; min-width: 0; }
.part-row .inline { flex: 0 0 auto; }
/* Champ à compléter (ex. e-mail / téléphone d'une fiche client créée depuis un BL EBP) */
.field-todo { border-color: var(--orange) !important; background: #fff8ec; box-shadow: 0 0 0 2px rgba(240,160,0,.18); }
/* Bloc de champs d'une affaire commerciale (sans bordure de fieldset ; grisé en lecture seule) */
.deal-fields, .bare-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.deal-fields[disabled] { opacity: .7; }
/* Bouton « traité » (propre à chaque utilisateur) dans une conversation */
.th-done { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 2px; }
/* Onglets de la fiche client */
.ctab-nav { margin-bottom: 12px; }
.ctab-panel[hidden] { display: none !important; }


/* Filtre cliquable par échéance (carte + liste) */
.map-head { margin-bottom: 8px; }
.due-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.due-filter button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 6px; cursor: pointer; opacity: .4; filter: grayscale(.5); transition: opacity .12s; }
.due-filter button.on { opacity: 1; filter: none; }
.due-filter button .due { margin: 0; }
.pend-map-card .tour-map { margin-bottom: 10px; }

/* BL non localisés sur la carte */
.map-unplaced:empty { display: none; }
.map-unplaced { color: var(--err); background: var(--err-bg); border-radius: 8px; padding: 7px 10px; margin-bottom: 12px; }

/* CRM commercial */
.deal-row.deal-late { border-left: 3px solid var(--err); }
.kpi.kpi-alert b { color: var(--err); }
.kpi.kpi-hot { border-color: var(--orange); background: var(--warn-bg, #fff7e6); }
.kpi.kpi-hot b { color: var(--orange); }
.bill-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.bill-stat { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 14px; }
.bill-stat b { font-size: 1.4rem; color: var(--dark); font-variant-numeric: tabular-nums; }
.bill-tbl tbody tr:hover { background: var(--bg); }

/* Demandes de devis */
.quote-card { margin-bottom: 10px; }
.quote-card .head-row { align-items: center; }
.quote-card .pre { margin: 6px 0; }
.quote-done .quote-card { opacity: .85; }

/* Lignes d'articles d'une demande de devis */
.qlines .qline { display: grid; grid-template-columns: 90px 1fr 54px 32px; gap: 6px; margin-bottom: 8px; }
.qlines .qline .qpart-results { grid-column: 1 / -1; }
.ql-qty { text-align: center; }
.ql-del { border: 0; background: #f1f4f5; border-radius: 8px; font-size: 1.3rem; color: var(--grey); cursor: pointer; }
.ql-section { margin: 4px 0 14px; }
@media (max-width: 480px) { .qlines .qline { grid-template-columns: 1fr 50px 32px; } .qlines .ql-ref { grid-column: 1 / -1; } }

/* Documents commerciaux */
.doc-row { align-items: flex-start; }
.doc-row .row-main .badge { margin: 2px 4px 2px 0; }
.doc-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.doc-form label { display: block; margin-bottom: 8px; }
.ti { width: 100%; padding: 6px 8px; }
#tsearch #tq { width: 100%; margin-bottom: 8px; }

/* Projet : type prospect/existant + relance rapide (v1.47.7) */
.seg-choice { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.seg-choice legend { font-weight: 600; }
.seg-choice .radio { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; font-weight: 500; }
.seg-choice .radio input { width: auto; margin: 0; }
.quick-dates { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 14px; }

/* Pièce jointe document dans la messagerie (v1.48.1) */
.doc-chip { display: inline-flex; align-items: center; max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: var(--chip, #eef2f7); color: #334; border-radius: 999px; padding: 4px 10px; font-size: .82rem; cursor: pointer; }
.msg-attach { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-bottom: 6px; }
.att-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--chip, #eef2f7); border: 1px solid var(--line); border-radius: 8px; padding: 2px; max-width: 200px; }
.att-chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; display: block; }
.att-chip .att-name { font-size: .8rem; color: #334; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 2px 2px 2px 6px; }
.att-chip button { border: 0; background: rgba(0,0,0,.06); color: #334; border-radius: 6px; width: 22px; height: 22px; line-height: 1; cursor: pointer; flex: 0 0 auto; }
.att-chip.att-photo button { position: relative; margin-left: -24px; align-self: flex-start; background: rgba(255,255,255,.85); }
a.b-file { display: inline-flex; align-items: center; gap: 4px; margin: 4px 0 2px; padding: 6px 10px; background: rgba(0,0,0,.06); border-radius: 8px; text-decoration: none; font-size: .9rem; max-width: 100%; }
.bubble.mine a.b-file { background: rgba(255,255,255,.25); color: #fff; }

/* Catégories de parc matériel (v1.49.0) */
h3.equip-cat { margin: 16px 0 6px; font-size: 1rem; color: var(--muted, #667); display: flex; align-items: center; gap: 8px; }
/* Catégories dépliables (v1.49.1) */
details.equip-cat-box { padding: 0; margin: 0 0 8px; overflow: hidden; }
details.equip-cat-box > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 12px 14px; font-weight: 600; list-style: none; }
details.equip-cat-box > summary::-webkit-details-marker { display: none; }
details.equip-cat-box > summary::before { content: "▸"; color: var(--muted, #889); transition: transform .15s; }
details.equip-cat-box[open] > summary::before { transform: rotate(90deg); }
details.equip-cat-box > summary .badge { margin-left: auto; }
details.equip-cat-box > .equip-list { padding: 0 14px 12px; }
details.equip-cat-box:not([open]) > .equip-list { display: none; }

/* Suivi messagerie : pièces concernées (v1.50.0) */
.th-parts .part-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin-top: 10px; }
.th-parts .part-field { position: relative; flex: 0 0 130px; }
.th-parts .part-field .results { position: absolute; left: 0; right: 0; z-index: 6; background: #fff; max-height: 240px; overflow: auto; }
.th-parts .part-add input[name=label] { flex: 1 1 200px; }
.th-parts .part-add .ti-qty { width: 72px; flex: 0 0 72px; }
.todo-add .todo-time { max-width: 110px; }
.todo-add .todo-note-in { flex: 1 1 100%; resize: vertical; min-height: 2.4em; font: inherit; }
.todo-note { white-space: pre-wrap; color: var(--muted); font-size: .9em; margin: 2px 0; }
.todo-edit { margin-top: 4px; }
.todo-edit > summary { cursor: pointer; color: var(--muted); list-style: none; display: inline-block; }
.todo-edit > summary::-webkit-details-marker { display: none; }
.todo-edit-form { margin-top: 6px; display: grid; gap: 6px; max-width: 480px; }
.todo-edit-form textarea { resize: vertical; font: inherit; width: 100%; }
.loan-form h3 { margin: 10px 0 4px; font-size: 1em; }
.loan-form .loan-cl { position: relative; }
.loan-form .loan-cl .results { position: absolute; left: 0; right: 0; z-index: 5; background: #fff; }
.loan-row .row-side.loan-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.loan-row.done .row-main strong { color: var(--muted); }
.loan-ln { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.loan-ln .loan-sel { flex: 1 1 auto; min-width: 0; }
.loan-ln .loan-ret { max-width: 150px; }

/* Accusé de lecture dans la liste messagerie (v1.50.2) */
.msg-seen { color: #2a9d5c; font-weight: 600; }

/* Compteur « à traiter » sous l'onglet Messagerie (v1.50.3) */
.topnav .nav-msg { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; gap: 1px; }
.tab-todo { font-size: .62rem; color: #c47d00; font-weight: 700; white-space: nowrap; }
.tabbar .tab-todo { display: block; margin-top: -2px; }

/* Visionneuse photos / PDF (v1.51.1) */
html.fv-open, html.fv-open body { overflow: hidden; }
#fileview { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; padding: 12px; }
#fileview[hidden] { display: none; }
/* Ligne Objet + Catégorie (messagerie) — v2.49.0 */
.objet-row { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; }
.objet-row .grow { flex: 1 1 260px; }
.objet-row .cat-pick { flex: 0 0 auto; min-width: 150px; }
.objet-row .cat-pick.off { opacity: .55; }
.objet-row .cat-pick select:disabled { background: var(--bg); cursor: not-allowed; }
/* Pièce en attente de validation (messagerie) */
.msg-hold-panel { border: 1px solid var(--orange); background: #fff8ef; }
.msg-hold-panel .row { align-items: center; }
.hold-validate { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.hold-validate .hv-dest { margin: 0; width: auto; min-width: 180px; }
.hold-validate .btn { margin: 0; }
.b-held { display: inline-block; margin-top: 4px; font-size: .82rem; color: #b06a00; font-style: italic; }

/* Visionneuse avec barre d'outils (télécharger / imprimer / ouvrir / zoom) — v2.36.0 */
#fileview .fv-body { max-width: 100%; max-height: 100%; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: stretch; }
#fileview .fv-bar { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 2px 52px 8px; }
#fileview .fv-tb { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: rgba(255,255,255,.95); color: #111; font-size: 1.05rem; font-weight: 700; line-height: 1; text-decoration: none; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
#fileview .fv-tb:active { transform: translateY(1px); }
#fileview .fv-zpct { color: #fff; font-size: .9rem; min-width: 46px; text-align: center; }
#fileview .fv-img { flex: 1 1 auto; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; align-items: center; justify-content: center; }
#fileview .fv-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
#fileview .fv-pages { flex: 1 1 auto; overflow: auto; -webkit-overflow-scrolling: touch; width: 100%; display: block; padding: 2px 2px 20px; }
#fileview .fv-page { display: block; margin: 0 auto 10px; background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,.45); border-radius: 4px; }
#fileview .fv-loading { color: #fff; text-align: center; padding: 48px 0; font-size: .95rem; }
#fileview .fv-pages .fv-ifr { width: 100%; height: 100%; min-height: 75vh; border: 0; background: #fff; border-radius: 6px; }
#fileview .fv-close { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); right: 14px; z-index: 2; width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); color: #111; font-size: 1.4rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.4); }

/* ---- Configurateur ANTHOS ---- */
.model-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:.6rem;margin-top:.4rem}
.model-card{display:flex;align-items:center;justify-content:space-between;gap:.4rem;padding:.8rem .9rem;border:1px solid var(--line);border-radius:10px;background:var(--card);text-decoration:none;color:inherit;font-weight:600}
.model-card:hover{border-color:var(--orange);background:var(--bg)}
.cfg-group{margin-bottom:.5rem}
.cfg-opts{display:flex;flex-direction:column;gap:.15rem;margin-top:.5rem}
.cfg-opt{display:flex;align-items:flex-start;gap:.6rem;padding:.3rem .2rem;border-bottom:1px solid var(--line)}
.cfg-opt.on{background:rgba(240,160,0,.06)}
.cfg-qty{width:3.4rem;flex:0 0 auto;text-align:center;padding:.3rem}
.cfg-desc{flex:1;line-height:1.3}
.cfg-code{display:inline-block;margin-left:.3rem}
.note-box{background:var(--bg);border-left:3px solid var(--orange);padding:.5rem .7rem;border-radius:6px}
.chip-new{background:var(--orange);color:#fff}
.res-item{display:block;width:100%;text-align:left;padding:.45rem .6rem;border:none;border-bottom:1px solid var(--line);background:none;cursor:pointer}
.res-item:hover{background:var(--bg)}
.row-link:hover{background:var(--bg)}

/* ---- Module devis : stats + demandes configurateur ---- */
.stat-row{display:flex;gap:.5rem;flex-wrap:wrap;margin:.6rem 0 1rem}
.stat{flex:1 1 90px;background:var(--card);border:1px solid var(--line);border-radius:10px;padding:.5rem .7rem;text-align:center}
.stat b{display:block;font-size:1.5rem;line-height:1.1;color:var(--blue)}
.stat span{font-size:.72rem;color:var(--muted)}
.stat.done b{color:var(--ok)}
.quote-card.is-cfg{border-left:4px solid var(--blue)}
.cfg-admin{border-left:4px solid var(--orange)}
.cfg-admin .tbl.small th,.cfg-admin .tbl.small td{padding:.25rem .4rem}
.cfg-admin td.r,.cfg-admin th.r{white-space:nowrap}

/* Récapitulatif des options choisies (visible quand la catégorie est repliée) */
.cfg-sel-badge{display:inline-block;margin-left:.4rem;background:var(--orange);color:#fff;font-size:.72rem;font-weight:600;padding:.05rem .4rem;border-radius:10px;vertical-align:middle}
details[open] .cfg-sel-badge{display:none}
.cfg-sel-recap{margin-top:.4rem;font-weight:normal}
.cfg-sel-recap:empty{display:none}
details[open] .cfg-sel-recap{display:none}
.cfg-sel-line{font-size:.85rem;color:var(--text);padding:.12rem 0 .12rem .6rem;border-left:2px solid var(--orange);margin-top:.15rem}
.cfg-sel-line b{color:var(--blue)}

/* Rubrique Tarif */
.tarif-view{width:100%;height:78vh;min-height:420px;border:1px solid var(--line);border-radius:8px;margin-top:.6rem;background:#fff}

/* Catalogue tarif */
.tarif-opt{align-items:center}
.tarif-price{flex:0 0 auto;margin-left:auto;white-space:nowrap;font-weight:600;color:var(--blue)!important}

/* Entrées de création de devis (hub « Demandes de devis ») */
.newquote-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.6rem;margin:.6rem 0 1.1rem}
.newquote-card{display:flex;flex-direction:column;gap:.15rem;padding:.9rem 1rem;border:1px solid var(--line);border-radius:12px;background:var(--card);text-decoration:none;color:inherit;transition:border-color .1s}
.newquote-card:hover{border-color:var(--orange);background:var(--bg)}
.newquote-card .nq-ico{font-size:1.5rem;line-height:1}
.newquote-card strong{color:var(--blue)}

/* Panier de devis */
.cart-banner{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;background:var(--warn-bg);border:1px solid var(--orange);border-radius:10px;padding:.5rem .8rem;margin:.6rem 0}
.cart-config{display:flex;align-items:center;justify-content:space-between;gap:.6rem;padding:.4rem 0;border-bottom:1px solid var(--line)}
.grid-free{display:flex;gap:.6rem;flex-wrap:wrap;align-items:flex-end}
.grid-free label{flex:1 1 140px}
.grid-free label:nth-child(3){flex:1 1 260px}

/* Résumé configuration dans la liste des devis */
.cfg-summary{padding:.3rem .5rem;margin:.3rem 0;border-left:3px solid var(--blue);background:var(--bg);border-radius:4px}

/* Matériel d'occasion */
.occ-form .grid2{display:grid;grid-template-columns:1fr 1fr;gap:.6rem}
.occ-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:.7rem}
.occ-card{display:flex;flex-direction:column;gap:.35rem}
.occ-card.sold{opacity:.6}
.occ-opts{white-space:pre-wrap;background:var(--bg);border-radius:6px;padding:.4rem .5rem;margin:.2rem 0}
.occ-foot{display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex-wrap:wrap;margin-top:auto}
.occ-price{font-size:1.2rem;font-weight:700;color:var(--blue)}

/* Statut facturation (menus) */
.bill-sel{font-size:.85rem;padding:.2rem .3rem;border:1px solid var(--line);border-radius:6px}
.bill-pick{display:inline-flex;align-items:center;gap:.4rem;font-size:.9rem}

/* ===== Tableaux de bord v2.16 : compteurs & tuiles priorité ===== */
.sec-title { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.ct { display: flex; flex-direction: column; justify-content: space-between; gap: 4px; background: #fff; border: 1px solid #e8edef; border-radius: var(--r); padding: 13px 15px; text-decoration: none; color: var(--text); position: relative; min-height: 90px; }
a.ct:hover { border-color: var(--blue); }
.ct .top { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); font-weight: 600; }
.ct b { font-size: 1.9rem; line-height: 1; color: var(--dark); font-variant-numeric: tabular-nums; }
.ct .sub { font-size: .75rem; color: var(--muted); }
.ct.hot { border-color: var(--orange); background: var(--warn-bg); }
.ct.hot b { color: #b06d00; }
.ct.alert { border-color: #e9b8b2; background: var(--err-bg); }
.ct.alert b { color: var(--err); }
.ct.zero { opacity: .6; }
.ct.zero b { color: var(--muted); }
.ct .pill { position: absolute; top: 10px; right: 12px; font-size: .67rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #fff; color: var(--err); border: 1px solid #e9b8b2; }

.prio { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pbox { border-radius: var(--r); padding: 14px 16px; color: #fff; text-decoration: none; display: block; }
.pbox h3 { margin: 0 0 2px; font-size: .95rem; font-weight: 600; opacity: .92; }
.pbox .n { font-size: 2.1rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.pbox .d { font-size: .8rem; opacity: .92; margin-top: 4px; }
.pbox .d strong { color: #ffd7cf; }
.pbox-dark { background: linear-gradient(135deg, #145064, #0d3545); }
.pbox-blue { background: linear-gradient(135deg, #1f6f8b, #145064); }
.pbox-red { background: linear-gradient(135deg, #c0392b, #8f2a1f); }
.pbox-red .d strong { color: #fff; }

/* ===== Pièces jointes télémaintenance (v2.17) ===== */
.file-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.tk-files { margin-top: 12px; }
.tk-files-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.tk-photo { display: block; line-height: 0; }
.tk-photo img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.tk-doc { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: .9rem; text-decoration: none; color: var(--blue); max-width: 240px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tk-doc:hover { border-color: var(--blue); }

/* ===== Envoi du devis par e-mail (v2.18) ===== */
.quote-mail { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfd; }
.quote-mail .mail-form label { display: block; margin-bottom: 8px; font-size: .9rem; font-weight: 600; color: var(--grey); }
.quote-mail .mail-form input, .quote-mail .mail-form textarea { width: 100%; }

/* ===== Boutons couleur-statut (prêts : disponible / en prêt) ===== */
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { background: #176b3a; }
.btn.warn { background: var(--orange); border-color: var(--orange); color: var(--dark); }
.btn.warn:hover { background: #d98f00; }

/* Compteurs devis cliquables */
a.stat { text-decoration: none; color: inherit; transition: border-color .12s; }
a.stat:hover { border-color: var(--blue); }
h2[id^="q-"], details[id^="q-"] { scroll-margin-top: 72px; }

/* Marquage « en option » (configurateur / catalogue → dossier devis) */
.cfg-optchk { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); white-space: nowrap; cursor: pointer; margin-left: auto; }
.cfg-optchk input { margin: 0; }
.chip-opt { background: var(--warn-bg); color: var(--warn); }
tr.row-opt td { background: #fffaf0; }

/* Récap de confirmation d'envoi du devis + pièces jointes */
.qm-files { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 4px 0 10px; background: #fafcfd; }
.qm-files .check { margin: 4px 0; }
.qm-overlay { position: fixed; inset: 0; background: rgba(13,53,69,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.qm-box { background: #fff; border-radius: 14px; padding: 20px; max-width: 460px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.qm-box .kv { margin: 0 0 14px; }

/* Devis : lignes d'articles repliées (première ligne + flèche) — v2.83.0 */
.ql-one { padding: 8px 2px; font-size: .92rem; }
details.qlines { margin: 2px 0; }
details.qlines > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 8px 2px; font-size: .92rem; border-radius: 8px; }
details.qlines > summary:hover { background: var(--bg); }
details.qlines > summary::-webkit-details-marker { display: none; }
details.qlines > summary::before { content: "\25B8"; color: var(--grey); font-size: 1.05em; line-height: 1; transition: transform .15s ease; flex: 0 0 auto; }
details.qlines[open] > summary::before { transform: rotate(90deg); }
details.qlines[open] .ql-closed { display: none; }
details.qlines:not([open]) .ql-open { display: none; }
details.qlines > table { margin-top: 4px; }

/* ===== Calculateur de marge (admin) ===== */
.calc-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px}
.calc-form label,.calc-grid label{display:flex;flex-direction:column;gap:4px;font-weight:600;font-size:.9rem;color:var(--muted,#5a6b74)}
.calc-grid input{font-size:1.1rem;padding:10px 12px}
.calc-stats{margin-top:4px}
.calc-stats .hi{background:var(--accent-bg,#e8f3f1);border-color:var(--accent,#0d7a63)}
.calc-stats .hi b{color:var(--accent,#0d7a63)}
.calc-tbl th.grp{text-align:center;background:#eef3f6;border-bottom:2px solid #cdd8de}
.calc-tbl th.grp2{background:#eaf4f1}
.calc-tbl td{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.calc-tbl tbody th{text-align:center;font-weight:700}
.calc-tbl td.m-mb{font-weight:700;color:var(--accent,#0d7a63)}
.calc-tbl td.m-cht,.calc-tbl td.m-ctt,.calc-tbl td.m-mb{background:#f4faf8}

/* ===== Fiches matériel de prêt repliées par défaut (lisibilité) ===== */
.loan-fiche { min-width: 0; }
.loan-fiche > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.loan-fiche > summary::-webkit-details-marker { display: none; }
.loan-fiche > summary::before { content: "▸"; color: var(--muted); font-size: .8rem; flex: 0 0 auto; transition: transform .15s; }
.loan-fiche[open] > summary::before { transform: rotate(90deg); }
.loan-fiche > summary strong { font-weight: 700; }
.loan-fiche > summary .row-sub { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; }
.loan-fiche .loan-more { margin: 8px 0 2px 18px; display: flex; flex-direction: column; gap: 6px; }

/* ===== Droit « Marquer Accord » par utilisateur (Profils et accès) ===== */
.accord-perms { border-top: 1px solid #edf1f2; padding-top: 12px; }
.accord-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.accord-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid #e8edef; border-radius: var(--r); background: #fff; }
.accord-item input { flex: 0 0 auto; }

/* ===== Espace client (portail) — identité Denta3D ===== */
.portal-body {
  --pb-blue:#1C75BC; --pb-blue-d:#145a91; --pb-orange:#F5A01E; --pb-green:#0d7a63; --pb-green-d:#0b6a56;
  --pb-navy:#163a4a; --pb-ink:#24323a; --pb-muted:#6b7b86; --pb-bg:#eef3f5; --pb-soft:#f5f8f9; --pb-line:#e7eef1;
  background: var(--pb-bg); margin: 0; color: var(--pb-ink);
}
/* En-tête façon boutique : fond blanc, vrai logo, tagline, bandeau liens, filet orange */
.portal-head { background: #fff; border-bottom: 1px solid #e9eef1; }
.portal-head-in { max-width: 820px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.portal-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-decoration: none; min-width: 0; }
.portal-brand .pb-logo { height: 46px; width: auto; display: block; }
.portal-brand .pb-tag { display: block; font-size: .68rem; color: var(--pb-muted); font-style: italic; }
.portal-who { font-size: .82rem; color: var(--pb-muted); text-align: right; white-space: nowrap; }
.portal-who .pw-name { display: block; color: var(--pb-navy); font-weight: 600; }
.portal-who a { color: var(--pb-blue); text-decoration: none; }
.portal-who a:hover { text-decoration: underline; }
/* Bandeau de liens vers la boutique */
.portal-shopnav { background: #f4f7f8; border-top: 1px solid #eef2f4; }
.portal-shopnav-in { max-width: 820px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.psn-links { display: flex; gap: 18px; flex-wrap: wrap; }
.psn-links a { color: var(--pb-navy); text-decoration: none; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.psn-links a:hover { color: var(--pb-blue); }
.psn-back { color: var(--pb-blue); text-decoration: none; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.psn-back:hover { text-decoration: underline; }
.portal-accent { height: 3px; background: var(--pb-orange); }

.portal-wrap { max-width: 820px; margin: 0 auto; padding: 18px 16px 40px; }
.portal-wrap h1 { font-size: 1.5rem; margin: 6px 0 16px; color: var(--pb-navy); }
.portal-card { background: #fff; border: 1px solid var(--pb-line); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(20,60,80,.04); }
.portal-card h2 { font-size: 1rem; margin: 0 0 12px; color: var(--pb-navy); display: flex; align-items: center; gap: 8px; }
.portal-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.portal-card-head h2 { margin: 0; }
.portal-login { max-width: 460px; margin: 7vh auto 0; }
.portal-login h1 { margin-top: 0; }
.portal-login label, .portal-card form label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; color: var(--pb-navy); }
.portal-card form input, .portal-card form select, .portal-card form textarea { width: 100%; box-sizing: border-box; margin-top: 4px; font-weight: 400; }
.btn.block { display: block; width: 100%; box-sizing: border-box; text-align: center; margin-top: 6px; }
.portal-body .btn.primary { background: var(--pb-green); border-color: var(--pb-green); color: #fff; }
.portal-body .btn.primary:hover { background: var(--pb-green-d); border-color: var(--pb-green-d); }
.portal-list { list-style: none; margin: 0; padding: 0; }
.portal-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eff4f6; }
.portal-list li:last-child { border-bottom: 0; }
.pl-main { min-width: 0; }
.pl-main strong { color: var(--pb-navy); }
.pl-main .muted { font-size: .78rem; }
.pl-side { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.portal-tv { background: var(--pb-soft); border: 1px solid var(--pb-line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.portal-contact fieldset.portal-contact, .portal-card fieldset { border: 1px solid var(--pb-line); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.portal-card fieldset legend { font-weight: 600; font-size: .85rem; padding: 0 6px; color: var(--pb-navy); }
/* Badges de statut */
.portal-body .badge { font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 3px 9px; background: #eef3f5; color: var(--pb-navy); }
.portal-body .badge.ok { background: #e3f5ee; color: var(--pb-green-d); }
.portal-body .badge.warn { background: #fff3df; color: #9a6400; }
.portal-body .badge.info { background: #e7f0f9; color: var(--pb-blue-d); }
.portal-foot { max-width: 820px; margin: 0 auto; padding: 16px; text-align: center; color: #8a9aa1; font-size: .8rem; }

/* ===== Accès TeamViewer répétables (poste + ID + MDP) ===== */
.tv-group { margin-bottom: 14px; }
.tv-legend { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.tv-rows { display: flex; flex-direction: column; gap: 8px; }
.tv-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 8px; align-items: center; }
.tv-row input { width: 100%; box-sizing: border-box; margin: 0; }
.tv-del { border: 1px solid var(--line, #d6dee2); background: #fff; color: #b23; border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; line-height: 1; flex: 0 0 auto; }
.tv-del:hover { background: #fdecec; }
.tv-add { margin-top: 8px; }
.tv-line { margin-bottom: 2px; }
@media (max-width: 560px) {
  .tv-row { grid-template-columns: 1fr 1fr auto; }
  .tv-row input[name="tv_poste[]"] { grid-column: 1 / -1; }
}

/* ===== Téléchargement devis (mobile) ===== */
.dl-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dl-hint { background: #eef7f3; border: 1px solid #bfe3d6; border-radius: 8px; padding: 8px 10px; margin-top: 8px; }

/* Pièces concernées (thread) : formulaire d'ajout plus lisible sur mobile */
@media (max-width: 560px) {
  .th-parts .part-add .part-field,
  .th-parts .part-add input[name=label] { flex: 1 1 100%; }
  .th-parts .part-add .part-field .results { right: 0; }
  .th-parts .part-add .ti-qty { flex: 0 0 80px; }
  .th-parts .part-add .btn { flex: 1 1 auto; }
}

/* Zone de message (thread) : sur mobile, le champ texte passe en pleine largeur au-dessus des boutons */
@media (max-width: 560px) {
  .chat-form textarea { flex: 1 1 100%; order: -1; }
}

/* ===== Espace client — finitions ===== */
.portal-hello { margin: 2px 0 18px; padding-bottom: 14px; border-bottom: 3px solid var(--pb-orange); }
.portal-hello h1 { font-size: 1.5rem; margin: 0; font-weight: 800; color: var(--pb-navy); }
.portal-sub { margin: 2px 0 0; font-size: .82rem; font-weight: 600; color: var(--pb-green); }
.portal-card h2 .ic { width: 26px; height: 26px; border-radius: 7px; display: inline-grid; place-items: center; font-size: .9rem; background: var(--pb-soft); }
.portal-contact .pc-ref { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--pb-soft); border: 1px solid var(--pb-line); border-radius: 10px; padding: 11px 13px; margin-bottom: 11px; }
.portal-contact .pc-ref strong { font-size: 1.02rem; color: var(--pb-navy); }
.portal-contact .pc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.portal-contact .pc-actions .btn { flex: 1 1 auto; min-width: 150px; text-align: center; }
@media (max-width: 560px) {
  .portal-head-in { align-items: flex-start; }
  .portal-contact .pc-ref { flex-direction: column; align-items: stretch; }
  .portal-contact .pc-ref .btn { width: 100%; box-sizing: border-box; text-align: center; }
  .portal-contact .pc-actions .btn { width: 100%; min-width: 0; }
}

/* Accès espace client (administration) */
.pick-results { margin-top: 4px; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.pick-results:empty { box-shadow: none; }
.em-row { border-bottom: 1px solid #edf1f2; }
.em-row:last-child { border-bottom: 0; }
.em-row > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 2px; cursor: pointer; list-style: none; }
.em-row > summary::-webkit-details-marker { display: none; }
.em-row > summary::after { content: '⌄'; color: #9fb0b5; margin-left: 4px; }
.em-row[open] > summary::after { content: '⌃'; }
.em-row .row-main { flex: 1; min-width: 0; }
.em-actions { padding: 8px 2px 14px; display: flex; flex-direction: column; gap: 10px; }
.em-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.em-actions .inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.em-actions .inline-form input[type=text] { flex: 1; min-width: 140px; }

/* Espace client — bouton d'installation PWA */
.portal-install { display: block; width: calc(100% - 32px); max-width: 640px; margin: 12px auto 0; padding: 11px 14px;
  background: #0d7a63; color: #fff; border: 0; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.portal-install:hover { background: #0b6a56; }

/* Espace client — conversation « Mon interlocuteur » */
.conv { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 16px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.conv-empty { margin: 16px 0; }
.conv-msg { display: flex; flex-direction: column; max-width: 82%; }
.conv-msg.me { align-self: flex-end; align-items: flex-end; }
.conv-msg.them { align-self: flex-start; align-items: flex-start; }
.conv-bubble { padding: 9px 13px; border-radius: 14px; font-size: .92rem; line-height: 1.4; word-break: break-word; }
.conv-msg.me .conv-bubble { background: var(--pb-green); color: #fff; border-bottom-right-radius: 4px; }
.conv-msg.them .conv-bubble { background: #eef3f5; color: var(--pb-ink); border-bottom-left-radius: 4px; }
.conv-meta { font-size: .68rem; color: var(--pb-muted); margin-top: 3px; padding: 0 4px; }
.conv-form { display: flex; flex-direction: column; gap: 8px; }
.conv-form textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.conv-form .btn { align-self: flex-end; }

/* Popup d'alerte des nouveaux messages clients */
#d3-toasts { position: fixed; right: 14px; bottom: 14px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.d3-toast { position: relative; display: block; text-decoration: none; color: #16323c; background: #fff;
  border: 1px solid #e3e9ec; border-left: 4px solid #0d7a63; border-radius: 12px; padding: 11px 32px 11px 13px;
  box-shadow: 0 6px 20px rgba(13,53,69,.18); animation: d3toastin .25s ease; }
.d3-toast.out { opacity: 0; transform: translateY(6px); transition: .4s; }
.d3-toast-h { font-size: .72rem; font-weight: 700; color: #0d7a63; text-transform: uppercase; letter-spacing: .3px; }
.d3-toast-t { font-weight: 700; margin-top: 2px; }
.d3-toast-b { font-size: .85rem; color: #5a6b74; margin-top: 2px; }
.d3-toast-x { position: absolute; top: 6px; right: 9px; font-size: 1.1rem; line-height: 1; color: #9fb0b5; }
.d3-toast-x:hover { color: #16323c; }
@keyframes d3toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
