/* RICCI ÉLECTRICITÉ ET FROID — interface interne */
:root {
  --navy: #23496D;
  --navy-700: #1B3A57;
  --navy-900: #0F2233;
  --navy-50: #EEF3F8;
  --navy-100: #DCE6F0;
  --ink: #0E1116;
  --text: #1D2430;
  --muted: #697386;
  --line: #E1E5EB;
  --line-2: #EDF0F4;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --ok: #1E7F55;   --ok-bg: #E7F4EE;
  --warn: #A86A00; --warn-bg: #FCF3DF;
  --orange: #C2540A; --orange-bg: #FDEEE3;
  --danger: #B42318; --danger-bg: #FDECEA;
  --info: #3B5B7D; --info-bg: #EAF0F6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15,34,51,.06), 0 1px 1px rgba(15,34,51,.04);
  --shadow-lg: 0 10px 30px rgba(15,34,51,.12);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tabbar: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0 0 .6em; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.mono, .ref { font-family: var(--mono); font-size: .92em; letter-spacing: .01em; }
.ref { color: var(--navy); font-weight: 600; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.hidden { display: none !important; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

/* ---------- Structure ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; background: var(--navy-900); color: #C9D5E2; flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .brand { padding: 18px 18px 14px; background: #fff; border-bottom: 3px solid var(--navy); }
.sidebar .brand img { height: 38px; display: block; }
.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; color: #C9D5E2; padding: 9px 12px; border-radius: 8px; font-weight: 500; font-size: 14px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--navy); color: #fff; }
.sidebar nav .sep { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #6F849A; padding: 16px 12px 6px; }
.sidebar nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.sidebar .count { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.sidebar .who { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.sidebar .who strong { color: #fff; display: block; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; align-items: center; gap: 14px; position: sticky; top: 0; z-index: 20; }
.topbar .mobile-logo { display: none; height: 30px; }
.topbar form.search { flex: 1; max-width: 460px; position: relative; }
.topbar form.search input { padding-left: 36px; background: var(--bg); border-color: transparent; }
.topbar form.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--muted); }
.content { padding: 22px 24px 48px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.tabbar { display: none; }

/* ---------- Cartes ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-h { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; display: block; color: inherit; }
a.kpi:hover { text-decoration: none; border-color: var(--navy-100); }
.kpi .v { font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi .h { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.alert { border-left: 3px solid var(--danger); }
.kpi.warn { border-left: 3px solid var(--warn); }
.kpi.navy { background: var(--navy); border-color: var(--navy); }
.kpi.navy .v, .kpi.navy .l, .kpi.navy .h { color: #fff; }
.kpi.navy .l, .kpi.navy .h { opacity: .78; }

dl.facts { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- Tables / listes ---------- */
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FAFBFC; white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.link { cursor: pointer; }
table.t tr.link:hover td { background: #FAFBFD; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 18px; border-bottom: 1px solid var(--line-2); display: flex; gap: 12px; align-items: center; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t1 { font-weight: 600; color: var(--ink); }
.list .t2 { font-size: 13px; color: var(--muted); }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 3px 8px; border-radius: 999px; background: var(--line-2); color: var(--text); white-space: nowrap; letter-spacing: .01em; }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-orange { background: var(--orange-bg); color: var(--orange); }
.b-danger { background: var(--danger-bg); color: var(--danger); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-navy { background: var(--navy); color: #fff; }
.b-muted { background: var(--line-2); color: var(--muted); }

/* ---------- Formulaires ---------- */
label.f { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time],
input[type=password], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: #fff; border: 1px solid #D3D9E1;
  border-radius: var(--radius-sm); padding: 10px 12px; min-height: 42px; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(35,73,109,.15); }
input[type=checkbox], input[type=radio] { accent-color: var(--navy); width: 18px; height: 18px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; }
.form-section { padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { margin-bottom: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 14px; border-radius: var(--radius-sm); padding: 9px 15px; min-height: 40px; border: 1px solid transparent; cursor: pointer; background: var(--navy); color: #fff; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--navy-700); }
.btn svg { width: 17px; height: 17px; }
.btn.secondary { background: #fff; color: var(--ink); border-color: #D3D9E1; }
.btn.secondary:hover { border-color: var(--navy); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.ghost:hover { background: var(--navy-50); }
.btn.danger { background: #fff; color: var(--danger); border-color: #F1C3BE; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.ok { background: var(--ok); }
.btn.big { min-height: 54px; font-size: 16px; padding: 12px 20px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
form.inline { display: inline; }

.flash { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 10px; font-size: 14px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: #BFE3D1; color: #145C3D; }
.flash.error { background: var(--danger-bg); border-color: #F4C7C2; color: #8E1C13; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--navy); border-color: var(--navy); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-height: 38px; padding: 7px 10px; font-size: 14px; }

/* ---------- Arborescence client ---------- */
.tree-site { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 14px; overflow: hidden; }
.tree-site > .hd { padding: 12px 16px; background: #FAFBFC; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tree-inst { padding: 10px 16px 12px; border-bottom: 1px solid var(--line-2); }
.tree-inst:last-child { border-bottom: 0; }
.tree-inst .hd { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.eq-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.eq-chip { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; display: flex; gap: 10px; align-items: center; color: inherit; background: #fff; }
.eq-chip:hover { border-color: var(--navy); text-decoration: none; }
.eq-ico { width: 36px; height: 36px; border-radius: 9px; background: var(--navy-50); color: var(--navy); display: grid; place-items: center; font-size: 11px; font-weight: 800; flex-shrink: 0; letter-spacing: .02em; }
.eq-ico.ue { background: #EEF0F2; color: #3D4652; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding: 4px 0 4px 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--navy); }
.tl-item.ev::before { border-color: #A9B4C2; width: 10px; height: 10px; left: -22px; }
.tl-item.anom::before { border-color: var(--orange); }
.tl-item.closed::before { border-color: var(--ok); }
.tl-date { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.tl-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-top: 4px; }
.tl-photos { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tl-photos img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- Notes /5 ---------- */
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 7px; font-weight: 700; font-size: 12.5px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.s5, .s4 { background: var(--ok-bg); color: var(--ok); }
.s3 { background: var(--warn-bg); color: var(--warn); }
.s2 { background: var(--orange-bg); color: var(--orange); }
.s1 { background: var(--danger-bg); color: var(--danger); }

/* ---------- QR ---------- */
.qr-box { width: 132px; height: 132px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: #fff; }
.qr-box svg { width: 100%; height: 100%; display: block; }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.photo-grid .ph { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--line-2); }
.photo-grid .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .ph .tag { position: absolute; left: 4px; bottom: 4px; background: rgba(15,34,51,.82); color: #fff; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.photo-grid .ph .del { position: absolute; right: 4px; top: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: var(--danger); font-weight: 700; cursor: pointer; }
.photo-grid .ph.uploading { opacity: .55; }

/* ---------- Pages publiques ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(160deg, #fff 0%, var(--bg) 55%, var(--navy-50) 100%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 30px 28px; }
.auth-card .logo { display: block; margin: 0 auto 22px; width: 200px; }
.public { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
.public .head { text-align: center; padding: 10px 0 18px; }
.public .head img { width: 170px; }
.id-plate { background: var(--navy); color: #fff; border-radius: 14px; padding: 18px 20px; }
.id-plate .code { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: .03em; }

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

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  body { font-size: 16px; }
  .sidebar { display: none; }
  .topbar { padding: 8px 12px; gap: 10px; }
  .topbar .mobile-logo { display: block; }
  .topbar .desk-only { display: none; }
  .content { padding: 14px 12px calc(var(--tabbar) + 30px); }
  h1 { font-size: 20px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .v { font-size: 22px; }
  dl.facts { grid-template-columns: 1fr; gap: 2px; }
  dl.facts dt { margin-top: 8px; font-size: 12px; }
  .card-h, .card-b, .form-section { padding-left: 14px; padding-right: 14px; }
  table.t.stack thead { display: none; }
  table.t.stack tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  table.t.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  table.t.stack td::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; text-align: left; }
  table.t.stack td.num { text-align: right; }
  .hide-m { display: none !important; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); z-index: 40; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
  .tabbar a.on { color: var(--navy); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.scan { position: relative; }
  .tabbar a.scan span.ring { width: 54px; height: 54px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 6px 16px rgba(35,73,109,.35); border: 4px solid #fff; }
  .tabbar a.scan svg { width: 24px; height: 24px; }
}
@media (min-width: 821px) { .m-only { display: none !important; } }

/* Menu mobile « Plus » */
.sheet { position: fixed; inset: 0; background: rgba(15,34,51,.45); z-index: 60; display: none; }
.sheet.open { display: block; }
.sheet .panel { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 18px 18px 0 0; padding: 10px 10px calc(16px + env(safe-area-inset-bottom)); max-height: 80vh; overflow: auto; }
.sheet .panel a, .sheet .panel button.link { display: flex; align-items: center; gap: 12px; padding: 14px 14px; font-size: 16px; font-weight: 500; color: var(--ink); border-radius: 10px; width: 100%; background: none; border: 0; font-family: inherit; text-align: left; cursor: pointer; }
.sheet .panel a:active { background: var(--bg); }
.sheet .grip { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 4px auto 10px; }

@media print {
  .sidebar, .topbar, .tabbar, .no-print { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
}

/* ---------- Formulaire d'intervention (mobile d'abord) ---------- */
.int-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.save-state { font-size: 12px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.save-state.saving { color: var(--warn); }
.save-state.saved { color: var(--ok); }
.save-state.err { color: #fff; background: var(--danger); border-color: var(--danger); }
.steps { position: sticky; top: 57px; z-index: 15; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 10px; background: var(--bg); scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps a { flex-shrink: 0; padding: 7px 13px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--text); }
.steps a:hover { text-decoration: none; border-color: var(--navy); }
.sec { scroll-margin-top: 120px; margin-bottom: 14px; }
section.sec > .card, section.sec > details.card { margin-bottom: 12px; }
details.unit > summary { list-style: none; cursor: pointer; }
details.unit > summary::-webkit-details-marker { display: none; }
details.unit[open] > summary { background: var(--navy-50); }
h3.blk { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rows .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line-2); }
.rows .row > span { font-size: 14.5px; font-weight: 500; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 3px; flex-shrink: 0; }
.seg button { font: inherit; font-weight: 700; font-size: 15px; border: 0; background: transparent; color: var(--muted); min-width: 40px; height: 40px; border-radius: 8px; cursor: pointer; padding: 0 10px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.seg button.on.v1 { background: var(--danger); color: #fff; }
.seg button.on.v2 { background: var(--orange); color: #fff; }
.seg button.on.v3 { background: #D9A21B; color: #fff; }
.seg button.on.v4, .seg button.on.v5 { background: var(--ok); color: #fff; }
.seg-wide { display: flex; width: 100%; }
.seg-wide button { flex: 1; font-size: 14px; min-height: 46px; }
.fouling button.on.f-important { background: #D9A21B; color: #fff; }
.fouling button.on.f-extreme { background: var(--danger); color: #fff; }
.levels button { font-size: 12.5px; line-height: 1.15; }
.levels button.on.lv-information { background: var(--info); color: #fff; }
.levels button.on.lv-surveiller { background: #D9A21B; color: #fff; }
.levels button.on.lv-recommandee { background: var(--orange); color: #fff; }
.levels button.on.lv-urgent { background: var(--danger); color: #fff; }
.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; }
.tog { position: relative; display: block; }
.tog input { position: absolute; opacity: 0; pointer-events: none; }
.tog span { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 12px; border: 1px solid #D3D9E1; border-radius: 10px; background: #fff; font-size: 14.5px; font-weight: 500; cursor: pointer; user-select: none; }
.tog span::before { content: ""; width: 20px; height: 20px; border-radius: 6px; border: 2px solid #B8C1CC; flex-shrink: 0; background: #fff center/14px no-repeat; }
.tog input:checked + span { border-color: var(--navy); background: var(--navy-50); color: var(--navy-900); }
.tog input:checked + span::before { background-color: var(--navy); border-color: var(--navy); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.with-btn { display: flex; gap: 6px; align-items: stretch; }
.with-btn > input, .with-btn > textarea { flex: 1; min-width: 0; }
.with-btn .btn { flex-shrink: 0; }
.mic.rec { background: var(--danger); color: #fff; border-color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.rating-note { padding: 4px 0 8px; }
.rating-note input.missing { border-color: var(--danger); background: #FFF8F7; }
.legend { margin-top: 6px; }
details.sub { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
details.sub > summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
details.sub[open] { padding-bottom: 12px; }
.torque { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr auto; gap: 6px; margin-bottom: 6px; }
.cat-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-chips button { font: inherit; font-size: 13px; font-weight: 600; border: 1px solid #D3D9E1; background: #fff; border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.cat-chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.sup { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.sup.propose { border-color: #E9C46A; background: #FFFBF0; }
.sup.accepte { border-color: #A7D7BF; background: var(--ok-bg); }
.sup.refuse { opacity: .6; }
.sup .lbl { flex: 1 1 100%; font-weight: 600; font-size: 14px; }
.sup .amt { display: flex; align-items: center; gap: 6px; margin-right: auto; white-space: nowrap; }
.sup input { width: 90px; min-height: 38px; }
.sig { position: relative; border: 1px dashed #B8C1CC; border-radius: 10px; background: #fff; height: 150px; }
.sig canvas { width: 100%; height: 100%; display: block; touch-action: none; border-radius: 10px; }
.sig button { position: absolute; right: 4px; top: 4px; }
@media (max-width: 820px) {
  .steps { top: 50px; margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
  .rows .row > span { font-size: 14px; line-height: 1.2; }
  .rows .row .seg button { min-width: 38px; padding: 0 6px; }
  .torque { grid-template-columns: 1fr 1fr; }
  .torque input[data-t=point], .torque input[data-t=source] { grid-column: span 2; }
  .toggles { grid-template-columns: 1fr; }
}

/* Suggestions d'anomalies issues des mesures */
.suggest-box:empty { display: none; }
.suggest-box { margin-top: 16px; display: grid; gap: 8px; }
.sugg { border: 1px solid #F0C9A8; border-left: 4px solid var(--orange); background: #FFF7F0; border-radius: 10px; padding: 10px 12px; }
.sugg.urgent { border-left-color: var(--danger); background: #FFF4F3; }
.sugg.surveiller { border-left-color: #D9A21B; background: #FFFBF0; border-color: #EFDDB0; }
.sugg .h { font-weight: 700; font-size: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sugg .r { font-size: 12.5px; color: var(--muted); margin: 2px 0 6px; }
.sugg textarea { min-height: 96px; font-size: 14px; }
.sugg .actions { margin-top: 8px; }
.sugg .diag { font-size: 13px; margin: 4px 0 6px; }
.sugg .diag ul { margin: 2px 0 0; padding-left: 18px; }
.sugg .diag li { margin: 1px 0; }

/* Repérage */
.site-code { display: inline-block; font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--navy-900); background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: 5px; padding: 1px 6px; vertical-align: 1px; }
.site-code:empty { display: none; }
.sys-badge { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 5px; border-radius: 6px; background: var(--navy); color: #fff; font-size: 12px; font-weight: 800; font-family: var(--mono); }
/* Relances */
.relance + .relance { margin-top: 12px; }
.relance-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.relance-actions .plan select { max-width: 160px; }
@media (max-width: 820px) { .relance-actions { grid-template-columns: 1fr; } .relance-actions .with-btn { flex-wrap: wrap; } }
.kind-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.kind-tabs a { padding: 10px 16px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-weight: 700; color: var(--text); display: inline-flex; gap: 8px; align-items: center; }
.kind-tabs a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.kind-tabs a:hover { text-decoration: none; }
.kind-tabs .count { background: var(--danger); color: #fff; font-size: 11px; border-radius: 10px; padding: 1px 7px; }
.relance-actions .plan input[type=date] { min-width: 150px; }

.sugg-hint{background:#F2F4F7;color:#4A5565;border-radius:10px;padding:8px 12px;margin:6px 0;font-size:.88rem}

/* ---- espace client ---- */
.next-visit { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #23496D, #16324D); color: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.next-visit .eyebrow { color: #9FB6CC; }
.next-visit a { color: #fff; text-decoration: underline; }
.next-visit .nv-ico { width: 46px; height: 46px; border-radius: 12px; background: rgba(255,255,255,.12); display: grid; place-items: center; flex-shrink: 0; }
.next-visit .nv-ico svg { width: 24px; height: 24px; }
.next-visit .nv-date { font-size: 20px; font-weight: 700; letter-spacing: -.01em; margin: 2px 0; }
.list-sep { padding: 8px 16px; background: var(--soft, #F4F6F8); font-size: 12.5px; font-weight: 700; color: var(--navy, #23496D); text-transform: uppercase; letter-spacing: .04em; }
.list li.clickable { position: relative; }
.list li.clickable:hover { background: #F7F9FB; }
.stretched::after { content: ""; position: absolute; inset: 0; }
.t-right { text-align: right; }
.facts-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.savings { border-color: #BFE3CF; }
.savings .card-h { background: #EEF8F2; }
.sv-big { font-size: 32px; font-weight: 800; color: #1E7A4A; letter-spacing: -.02em; }
.sv-list, .done-list { margin: 6px 0 0; padding-left: 18px; }
.sv-list li, .done-list li { margin: 2px 0; }

.share-link { border-color: #BFE3CF; background: #F3FBF6; }
.share-link input { font-family: var(--mono); font-size: 13px; }
.wty { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 1px 0; }

/* menu « Plus » compact (mobile) */
.sheet .panel { padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); }
.sheet .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sheet .tiles a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 10px 4px; font-size: 11.5px; font-weight: 600; line-height: 1.2; text-align: center; color: var(--ink); background: var(--bg); border-radius: 12px; min-height: 68px; }
.sheet .tiles a svg { width: 20px; height: 20px; color: var(--navy); }
.sheet .tiles a:active { background: var(--navy-50, #E8EEF4); }
.sheet .tiles .dot { position: absolute; top: 6px; right: 10px; background: var(--danger); color: #fff; font-size: 10px; border-radius: 8px; padding: 0 5px; }
.sheet .sheet-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.sheet .sheet-foot a { color: var(--muted); }
.sheet .panel .sheet-foot a { padding: 6px 4px; font-size: 13px; width: auto; }
.badge.ctr { vertical-align: middle; font-size: 11px; }
h1 .badge.ctr { font-size: 12px; }
.sec-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 3px 0; }
.sec-edit summary { list-style: none; }
.sec-edit summary::-webkit-details-marker { display: none; }
.sec-edit[open] { width: 100%; }
.near { color: var(--navy); margin-top: 3px; }
.pay-suspendu { background: #FDF1F0; }
.pay-attente { background: #FFF8EB; }
/* ---- contrats ---- */
.ct-list { display: grid; gap: 10px; }
.ct-card { margin: 0; border-left: 4px solid var(--line); }
.ct-card.st-suspendu, .ct-banner.st-suspendu { border-left-color: var(--danger); }
.ct-card.st-attente, .ct-banner.st-attente { border-left-color: #E3A008; }
.ct-card.st-paye, .ct-banner.st-paye { border-left-color: #2E8B57; }
.ct-main { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; }
.ct-state { text-align: right; flex-shrink: 0; }
.ct-pay { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 16px 14px; border-top: 1px solid var(--line-2); background: #FAFBFC; }
.ct-pay input[name=amount] { width: 90px; }
.ct-pay input[type=date] { width: 150px; }
.ct-pay select { width: auto; }
.ct-pay .btn { margin-left: auto; }
.ct-banner { border-left: 6px solid var(--line); }
.ct-banner.st-suspendu { background: #FDF1F0; }
.ct-banner.st-attente { background: #FFF8EB; }
.ct-banner.st-paye { background: #F1FAF4; }
.ct-big { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 2px 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.chip.on { background: #E6F4EC; color: #1E6B43; }
.chip.off { background: var(--bg); color: var(--muted); text-decoration: line-through; }
.cov-tree { display: grid; gap: 8px; }
.cov-site { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.cov-site.on { border-color: #9CC9AE; background: #F6FBF8; }
.cov-head { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.cov-head input, .cov-eq input { width: 20px; height: 20px; flex-shrink: 0; }
.cov-eqs { display: grid; gap: 4px; margin: 8px 0 0 30px; }
.cov-eq { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; cursor: pointer; }
.cov-eq.other { opacity: .6; }
.cov-chip { font-size: 11px; }
@media (max-width: 640px) { .ct-main { flex-direction: column; } .ct-state { text-align: left; } .ct-pay .btn { width: 100%; } }
.opt-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; align-items: flex-start; }
.opt-box input { margin-top: 3px; }
