/* SPS Connect — interface. Titres : Saira Stencil One · Texte : DM Sans (polices libres, hébergées avec l'app) */
@font-face{font-family:"DM Sans";src:url(../assets/fonts/DMSans.ttf) format("truetype");font-weight:100 1000;font-style:normal;font-display:swap}
@font-face{font-family:"DM Sans";src:url(../assets/fonts/DMSans-Italic.ttf) format("truetype");font-weight:100 1000;font-style:italic;font-display:swap}
@font-face{font-family:"Saira Stencil One";src:url(../assets/fonts/SairaStencilOne.ttf) format("truetype");font-display:swap}

:root{
  --bg:#f3f2f0; --surface:#ffffff; --surface-2:#eceae7; --surface-3:#e1ded9; --ink:#141313; --muted:#68625d; --line:#dedad5; --line-2:#c9c4be;
  --brand:#ce0000; --brand-ink:#ffffff; --brand-soft:#fbe3e3;
  --ok:#17803d; --ok-soft:#dcf3e4; --warn:#b86e00; --warn-soft:#fdf0d5; --bad:#c42a22; --bad-soft:#fbe2e0; --live:#1d64c8; --live-soft:#dfeafb;
  --bar:#0b0b0c; --bar-2:#18181a; --bar-ink:#f2f0ee; --bar-muted:#9b958f;
  --f-title:"Saira Stencil One","Arial Narrow",Impact,sans-serif; --f-body:"DM Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  --r:12px; --r-s:8px; --shadow:0 1px 2px rgba(20,19,19,.06),0 6px 24px rgba(20,19,19,.06); --side:236px; color-scheme:light;
}
@media (prefers-color-scheme:dark){:root:not([data-theme=light]){
  --bg:#0f0e0e; --surface:#1a1918; --surface-2:#242221; --surface-3:#2e2b2a; --ink:#efecea; --muted:#a59f99; --line:#33302e; --line-2:#46423f;
  --brand-soft:#3b1616; --ok:#4cc27d; --ok-soft:#15361f; --warn:#f0a630; --warn-soft:#3a2b10; --bad:#f2675e; --bad-soft:#3e1d1b; --live:#71a8f3; --live-soft:#182c48; --shadow:none; color-scheme:dark}}
:root[data-theme=dark]{--bg:#0f0e0e; --surface:#1a1918; --surface-2:#242221; --surface-3:#2e2b2a; --ink:#efecea; --muted:#a59f99; --line:#33302e; --line-2:#46423f;
  --brand-soft:#3b1616; --ok:#4cc27d; --ok-soft:#15361f; --warn:#f0a630; --warn-soft:#3a2b10; --bad:#f2675e; --bad-soft:#3e1d1b; --live:#71a8f3; --live-soft:#182c48; --shadow:none; color-scheme:dark}

*{box-sizing:border-box} html,body{margin:0;height:100%}
body{background:var(--bg);color:var(--ink);font:400 15.5px/1.5 var(--f-body);-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;font-feature-settings:"ss01"}
[hidden]{display:none!important}
a{color:var(--live);text-underline-offset:2px}
img{max-width:100%}
.vh{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
h1,h2,.title{font-family:var(--f-title);font-weight:400;letter-spacing:.01em;line-height:1.05;margin:0;text-wrap:balance}
h1{font-size:30px} h2{font-size:23px}
h3{font-size:12.5px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--muted);margin:0}
h4{font-size:16px;font-weight:700;margin:0}
p{margin:0}
.muted{color:var(--muted)} .small{font-size:13px} .tiny{font-size:12px} .num{font-variant-numeric:tabular-nums} .b{font-weight:700} .nowrap{white-space:nowrap} .center{text-align:center} .right{text-align:right}
.ok-t{color:var(--ok)} .bad-t{color:var(--bad)} .warn-t{color:var(--warn)}

/* ---------- structure ---------- */
#app{min-height:100%;display:flex}
.side{width:var(--side);flex:0 0 var(--side);background:var(--bar);color:var(--bar-ink);position:sticky;top:0;height:100vh;overflow-y:auto;display:flex;flex-direction:column;padding:16px 10px calc(16px + env(safe-area-inset-bottom));scrollbar-width:thin}
.side .brandrow{display:flex;align-items:center;gap:10px;padding:2px 8px 14px}
.side .brandrow img{height:34px;width:auto}
.side .brandrow .t{font-family:var(--f-title);font-size:19px;line-height:1}
.side nav{display:flex;flex-direction:column;gap:1px}
.side nav .grp{font-size:11px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--bar-muted);padding:14px 10px 5px}
.side nav a{display:flex;align-items:center;gap:10px;color:var(--bar-ink);text-decoration:none;padding:8px 10px;border-radius:8px;font-weight:500;font-size:14.5px;opacity:.86}
.side nav a:hover{background:var(--bar-2);opacity:1}
.side nav a[aria-current=page]{background:var(--bar-2);opacity:1;box-shadow:inset 3px 0 0 var(--brand)}
.side nav a .ic{width:20px;text-align:center;flex:0 0 20px}
.side nav a .cnt{margin-left:auto}
.side .me{margin-top:auto;border-top:1px solid var(--bar-2);padding:12px 8px 0;display:flex;gap:10px;align-items:center}
.side .me button{background:none;border:0;color:var(--bar-muted);font:inherit;font-size:13px;cursor:pointer;padding:0;text-decoration:underline}
.mainwrap{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{position:sticky;top:0;z-index:20;background:var(--bar);color:var(--bar-ink);padding:calc(8px + env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 8px max(14px,env(safe-area-inset-left));display:none;align-items:center;gap:10px}
.topbar img{height:30px} .topbar .t{font-family:var(--f-title);font-size:18px;flex:1;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar .icbtn{background:none;border:0;color:var(--bar-ink);font-size:21px;width:40px;height:40px;border-radius:10px;position:relative;cursor:pointer;display:grid;place-items:center}
.topbar .icbtn .dot{position:absolute;top:4px;right:3px}
main.page{width:100%;max-width:1320px;margin:0 auto;padding:22px max(18px,env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(18px,env(safe-area-inset-left))}
.tabbar{display:none}
.net{background:var(--bad);color:#fff;font-size:12.5px;font-weight:700;text-align:center;padding:4px}
@media (max-width:900px){
  .side{display:none} .topbar{display:flex}
  main.page{padding:16px max(14px,env(safe-area-inset-right)) calc(92px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
  .tabbar{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:30;background:var(--surface);border-top:1px solid var(--line);padding:4px 4px calc(4px + env(safe-area-inset-bottom))}
  .tabbar a{flex:1;display:flex;flex-direction:column;align-items:center;gap:1px;text-decoration:none;color:var(--muted);font-size:11px;font-weight:600;padding:6px 2px;border-radius:10px;position:relative;min-width:0}
  .tabbar a .ic{font-size:21px;line-height:1.1}
  .tabbar a[aria-current=page]{color:var(--ink)} .tabbar a[aria-current=page] .ic{transform:scale(1.08)}
  .tabbar a .dot{position:absolute;top:3px;left:calc(50% + 8px)}
  h1{font-size:26px}
}
.drawer{position:fixed;inset:0;z-index:60;background:rgba(0,0,0,.45);display:flex}
.drawer .side{display:flex;height:100%;width:min(300px,86vw);flex-basis:auto;animation:slin .18s ease-out}
@keyframes slin{from{transform:translateX(-30px);opacity:.4}}

/* ---------- en-têtes de page ---------- */
.ph{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin-bottom:18px}
.ph .grow{flex:1;min-width:200px} .ph h1+p{margin-top:6px}
.crumb{font-size:13px;color:var(--muted);margin-bottom:6px} .crumb a{color:var(--muted)}

/* ---------- blocs ---------- */
.stack{display:flex;flex-direction:column;gap:14px} .stack.s{gap:8px} .stack.l{gap:22px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap} .row.s{gap:6px} .row.nw{flex-wrap:nowrap} .grow{flex:1;min-width:0} .between{justify-content:space-between} .end{justify-content:flex-end} .top{align-items:flex-start}
.grid{display:grid;gap:14px;grid-template-columns:repeat(auto-fill,minmax(var(--min,280px),1fr))}
.cols2{display:grid;gap:18px;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)} @media(max-width:1000px){.cols2{grid-template-columns:1fr}}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px;box-shadow:var(--shadow);min-width:0}
.card.p0{padding:0;overflow:hidden} .card.flat{box-shadow:none} .card.tint{background:var(--surface-2);border-color:transparent;box-shadow:none}
.card.hl{border-color:var(--brand);box-shadow:0 0 0 1px var(--brand) inset}
.card > h3:first-child,.card .hd{margin-bottom:10px}
.hd{display:flex;align-items:center;gap:10px;justify-content:space-between}
.sep{height:1px;background:var(--line);margin:4px 0}
.kpis{display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
.kpi{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:12px 14px;text-decoration:none;color:inherit;display:block}
.kpi .v{font-family:var(--f-title);font-size:30px;line-height:1.1} .kpi .l{font-size:13px;color:var(--muted);font-weight:500}
.kpi.alert{border-color:var(--brand);background:var(--brand-soft)}
.empty{padding:26px 14px;text-align:center;color:var(--muted)}
.note{background:var(--surface-2);border-radius:var(--r-s);padding:10px 12px;font-size:14px}
.note.warn{background:var(--warn-soft);color:var(--ink)} .note.bad{background:var(--bad-soft)} .note.ok{background:var(--ok-soft)} .note.info{background:var(--live-soft)}
.err{background:var(--bad-soft);color:var(--bad);border-radius:var(--r-s);padding:9px 12px;font-size:14px;font-weight:600}
.pre{white-space:pre-wrap}

/* ---------- listes ---------- */
.list{display:flex;flex-direction:column}
.li{display:flex;gap:12px;align-items:center;padding:11px 14px;border-top:1px solid var(--line);text-decoration:none;color:inherit;min-width:0}
.li:first-child{border-top:0} a.li:hover,button.li:hover{background:var(--surface-2)}
button.li{background:none;border:0;border-top:1px solid var(--line);font:inherit;text-align:left;width:100%;cursor:pointer}
.li .main{flex:1;min-width:0} .li .t1{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .li .t2{font-size:13px;color:var(--muted);overflow:hidden;text-overflow:ellipsis}
.li .t2.wrap{white-space:normal}
.av{width:38px;height:38px;border-radius:50%;background:var(--surface-3);color:var(--ink);display:grid;place-items:center;font-weight:700;font-size:13.5px;flex:0 0 auto;object-fit:cover;overflow:hidden}
.av.s{width:28px;height:28px;font-size:11px} .av.l{width:72px;height:72px;font-size:24px}
.sw{width:10px;height:10px;border-radius:3px;flex:0 0 auto;display:inline-block}

/* ---------- pastilles ---------- */
.chip{display:inline-flex;align-items:center;gap:5px;padding:2px 9px;border-radius:999px;font-size:12.5px;font-weight:600;background:var(--surface-2);color:var(--ink);white-space:nowrap;line-height:1.6}
.chip.ok{background:var(--ok-soft);color:var(--ok)} .chip.bad{background:var(--bad-soft);color:var(--bad)} .chip.warn{background:var(--warn-soft);color:var(--warn)} .chip.live{background:var(--live-soft);color:var(--live)} .chip.brand{background:var(--brand);color:#fff}
.chip.out{background:none;border:1px solid var(--line-2)}
.dot{min-width:18px;height:18px;border-radius:9px;background:var(--brand);color:#fff;font-size:11px;font-weight:700;display:inline-grid;place-items:center;padding:0 5px;line-height:1}

/* ---------- boutons ---------- */
.btn{font:600 15px var(--f-body);border-radius:10px;padding:10px 16px;border:1.5px solid var(--line-2);background:var(--surface);color:var(--ink);cursor:pointer;min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;white-space:nowrap;transition:background .12s,border-color .12s,transform .06s}
.btn:hover{border-color:var(--muted)} .btn:active{transform:translateY(1px)}
.btn:focus-visible,a:focus-visible,button:focus-visible{outline:3px solid var(--live);outline-offset:2px}
.btn.primary{background:var(--brand);border-color:var(--brand);color:var(--brand-ink)} .btn.primary:hover{filter:brightness(1.08)}
.btn.dark{background:var(--ink);border-color:var(--ink);color:var(--bg)}
.btn.ok{background:var(--ok);border-color:var(--ok);color:#fff}
.btn.danger{color:var(--bad);border-color:var(--bad);background:var(--surface)}
.btn.ghost{border-color:transparent;background:transparent} .btn.ghost:hover{background:var(--surface-2)}
.btn.s{min-height:34px;padding:5px 11px;font-size:13.5px;border-radius:8px}
.btn.xl{min-height:64px;font-size:19px;padding:14px 22px;border-radius:14px;width:100%}
.btn.huge{min-height:96px;font-size:23px;border-radius:18px;width:100%;font-family:var(--f-title);font-weight:400;letter-spacing:.02em}
.btn.w{width:100%}
.btn:disabled{opacity:.5;cursor:not-allowed}
.icbtn{background:none;border:0;cursor:pointer;color:inherit;font-size:18px;width:36px;height:36px;border-radius:8px;display:inline-grid;place-items:center}
.icbtn:hover{background:var(--surface-2)}
.seg{display:inline-flex;background:var(--surface-2);border-radius:10px;padding:3px;gap:2px;flex-wrap:wrap}
.seg button,.seg a{border:0;background:none;font:600 14px var(--f-body);padding:7px 12px;border-radius:8px;cursor:pointer;color:var(--muted);text-decoration:none}
.seg [aria-pressed=true],.seg [aria-current=page]{background:var(--surface);color:var(--ink);box-shadow:0 1px 3px rgba(0,0,0,.1)}
.tabs{display:flex;gap:2px;border-bottom:1px solid var(--line);margin-bottom:16px;overflow-x:auto;scrollbar-width:none}
.tabs button{border:0;background:none;font:600 14.5px var(--f-body);padding:10px 12px;color:var(--muted);cursor:pointer;border-bottom:2.5px solid transparent;white-space:nowrap}
.tabs button[aria-selected=true]{color:var(--ink);border-bottom-color:var(--brand)}

/* ---------- formulaires ---------- */
.f{display:flex;flex-direction:column;gap:5px;font-weight:600;font-size:13.5px;min-width:0}
.f .hint{font-weight:400;color:var(--muted);font-size:12.5px}
.fg{display:grid;gap:12px 14px;grid-template-columns:repeat(auto-fill,minmax(var(--min,220px),1fr))}
.fg .full{grid-column:1/-1}
input[type=text],input[type=password],input[type=number],input[type=email],input[type=tel],input[type=date],input[type=time],input[type=datetime-local],input[type=month],input[type=search],input[type=url],select,textarea{
  font:400 16px var(--f-body);color:var(--ink);background:var(--surface);border:1.5px solid var(--line-2);border-radius:9px;padding:9px 11px;width:100%;min-height:44px}
textarea{min-height:92px;resize:vertical;line-height:1.45}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--live);box-shadow:0 0 0 3px var(--live-soft)}
input[readonly],select:disabled,input:disabled{background:var(--surface-2);color:var(--muted)}
.check{display:flex;gap:9px;align-items:flex-start;font-weight:500;font-size:14.5px;cursor:pointer;line-height:1.35}
.check input{width:20px;height:20px;margin:0;flex:0 0 auto;accent-color:var(--brand)}
.radio-cards{display:grid;gap:8px;grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
.radio-cards label{border:1.5px solid var(--line-2);border-radius:10px;padding:10px 12px;cursor:pointer;font-weight:600;display:flex;gap:8px;align-items:center}
.radio-cards input{accent-color:var(--brand)} .radio-cards label:has(input:checked){border-color:var(--brand);background:var(--brand-soft)}
fieldset{border:1px solid var(--line);border-radius:var(--r);padding:12px 14px 14px;margin:0;min-width:0} legend{font-size:12.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding:0 6px}
.acc-sel{display:flex;gap:2px} .acc-sel button{font:600 12px var(--f-body);border:1px solid var(--line-2);background:var(--surface);padding:4px 7px;cursor:pointer;color:var(--muted)}
.acc-sel button:first-child{border-radius:6px 0 0 6px} .acc-sel button:last-child{border-radius:0 6px 6px 0}
.acc-sel button[aria-pressed=true]{background:var(--ink);color:var(--bg);border-color:var(--ink)}

/* ---------- tableaux ---------- */
.tw{overflow-x:auto;-webkit-overflow-scrolling:touch}
table.t{width:100%;border-collapse:collapse;font-size:14px}
table.t th{font-size:12px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-weight:700;text-align:left;padding:9px 10px;border-bottom:1px solid var(--line);white-space:nowrap;background:var(--surface)}
table.t td{padding:9px 10px;border-bottom:1px solid var(--line);vertical-align:top}
table.t tr:last-child td{border-bottom:0} table.t tr.click{cursor:pointer} table.t tr.click:hover td{background:var(--surface-2)}
table.t td.n,table.t th.n{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
table.t tfoot td{font-weight:700;border-top:2px solid var(--line)}

/* ---------- fenêtres ---------- */
.modal-bg{position:fixed;inset:0;z-index:80;background:rgba(10,10,10,.5);display:flex;align-items:center;justify-content:center;padding:20px;animation:fade .15s}
@keyframes fade{from{opacity:0}}
.modal{background:var(--surface);border-radius:16px;width:min(560px,100%);max-height:min(92vh,100%);display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0,0,0,.3);animation:pop .16s ease-out}
.modal.w{width:min(860px,100%)} .modal.xw{width:min(1180px,100%)}
@keyframes pop{from{transform:translateY(10px);opacity:.5}}
.modal .mh{display:flex;align-items:center;gap:10px;padding:16px 18px 10px} .modal .mh h2{flex:1;font-size:21px}
.modal .mb{padding:4px 18px 16px;overflow-y:auto;flex:1;display:flex;flex-direction:column;gap:14px}
.modal .mf{display:flex;gap:10px;justify-content:flex-end;padding:12px 18px calc(14px + env(safe-area-inset-bottom));border-top:1px solid var(--line);flex-wrap:wrap}
@media (max-width:640px){.modal-bg{align-items:flex-end;padding:0}.modal,.modal.w,.modal.xw{width:100%;border-radius:18px 18px 0 0;max-height:94vh}.modal .mf .btn{flex:1}}
.toast{position:fixed;left:50%;bottom:calc(24px + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:120;background:var(--ink);color:var(--bg);padding:11px 18px;border-radius:12px;font-weight:600;font-size:14.5px;box-shadow:0 8px 30px rgba(0,0,0,.25);max-width:min(560px,92vw);text-align:center}
.toast.bad{background:var(--bad);color:#fff} .toast.ok{background:var(--ok);color:#fff}
@media(max-width:900px){.toast{bottom:calc(86px + env(safe-area-inset-bottom))}}
.menu{position:fixed;z-index:110;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 40px rgba(0,0,0,.2);padding:5px;min-width:200px}
.menu button{display:flex;width:100%;gap:10px;align-items:center;border:0;background:none;font:500 15px var(--f-body);padding:10px 12px;border-radius:8px;cursor:pointer;color:var(--ink);text-align:left}
.menu button:hover{background:var(--surface-2)} .menu button.danger{color:var(--bad)}

/* ---------- écrans de connexion ---------- */
.auth{min-height:100vh;width:100%;display:flex;align-items:center;justify-content:center;background:var(--bar);padding:24px 16px;background-image:radial-gradient(circle at 20% 0%,rgba(206,0,0,.25),transparent 50%)}
.auth .box{background:var(--surface);border-radius:18px;padding:26px 24px;width:min(420px,100%);display:flex;flex-direction:column;gap:14px;box-shadow:0 30px 80px rgba(0,0,0,.4)}
.auth .box.w{width:min(640px,100%)}
.auth .logo{height:64px;width:auto;align-self:flex-start;background:var(--bar);border-radius:12px;padding:8px 10px}
.auth h1{font-size:30px}
.codein{font:700 30px var(--f-body)!important;letter-spacing:.4em;text-align:center}

/* ---------- agent : mission ---------- */
.hero{background:var(--bar);color:var(--bar-ink);border-radius:18px;padding:18px;display:flex;flex-direction:column;gap:12px;position:relative;overflow:hidden}
.hero::after{content:"";position:absolute;right:-40px;top:-40px;width:160px;height:160px;border-radius:50%;background:var(--brand);opacity:.18}
.hero .lbl{font-size:12px;letter-spacing:.1em;text-transform:uppercase;color:var(--bar-muted);font-weight:700}
.hero h2{font-size:28px} .hero .muted{color:var(--bar-muted)}
.hero .btn{border-color:#3a3836;background:#1d1c1b;color:var(--bar-ink)} .hero .btn.primary{background:var(--brand);border-color:var(--brand)}
.clock{font-family:var(--f-title);font-size:46px;line-height:1;letter-spacing:.02em}
.live-dot{width:10px;height:10px;border-radius:50%;background:#3bd16f;box-shadow:0 0 0 0 rgba(59,209,111,.6);animation:pulse 1.6s infinite;display:inline-block}
@keyframes pulse{70%{box-shadow:0 0 0 10px rgba(59,209,111,0)}100%{box-shadow:0 0 0 0 rgba(59,209,111,0)}}
.actions{display:grid;gap:10px;grid-template-columns:repeat(auto-fill,minmax(150px,1fr))}
.action{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:6px;text-decoration:none;color:inherit;cursor:pointer;font:inherit;text-align:left;min-height:92px}
.action .ic{font-size:24px} .action .t{font-weight:700} .action .s{font-size:12.5px;color:var(--muted)}
.action:hover{border-color:var(--line-2)}
.sosbtn{position:fixed;right:max(16px,env(safe-area-inset-right));bottom:calc(84px + env(safe-area-inset-bottom));z-index:40;width:62px;height:62px;border-radius:50%;border:0;background:var(--bad);color:#fff;font:400 17px var(--f-title);box-shadow:0 8px 24px rgba(196,42,34,.45);cursor:pointer;letter-spacing:.04em}
@media(min-width:901px){.sosbtn{bottom:24px}}
.callbtn{display:inline-flex;align-items:center;gap:6px;background:var(--ok);color:#fff;border-radius:999px;padding:7px 13px;font-weight:700;text-decoration:none;font-size:14px;white-space:nowrap}

/* ---------- rondes : scanner et confirmation ---------- */
.scanner{position:fixed;inset:0;z-index:100;background:#000;display:flex;flex-direction:column}
.scanner video{flex:1;width:100%;object-fit:cover;min-height:0}
.scanner .frame{position:absolute;left:50%;top:42%;width:min(68vw,300px);aspect-ratio:1;transform:translate(-50%,-50%);border:3px solid rgba(255,255,255,.9);border-radius:20px;box-shadow:0 0 0 100vmax rgba(0,0,0,.35)}
.scanner .msg{position:absolute;top:calc(16px + env(safe-area-inset-top));left:16px;right:16px;text-align:center;color:#fff;font-weight:700;font-size:17px;text-shadow:0 1px 4px #000}
.scanner .bar{display:flex;gap:10px;padding:14px 14px calc(14px + env(safe-area-inset-bottom));background:#000}
.flash{position:fixed;inset:0;z-index:105;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:24px;text-align:center;color:#fff}
.flash.ok{background:var(--ok)} .flash.warn{background:#a76200} .flash.bad{background:var(--bad)}
.flash .big{font-family:var(--f-title);font-size:34px;line-height:1.1}
.cps{display:flex;flex-direction:column;gap:6px}
.cp{display:flex;gap:10px;align-items:center;padding:10px 12px;border-radius:10px;background:var(--surface-2)}
.cp.done{background:var(--ok-soft)} .cp .st{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;font-weight:700;background:var(--surface);flex:0 0 auto}
.cp.done .st{background:var(--ok);color:#fff}
.progress{height:8px;background:var(--surface-3);border-radius:4px;overflow:hidden} .progress i{display:block;height:100%;background:var(--ok);border-radius:4px}

/* ---------- planning ---------- */
.plan-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.plan-tools select,.plan-tools input[type=date]{width:auto;min-height:34px;padding:4px 8px;font-size:14px}
.ph select{width:auto}
.plan{overflow:auto;border:1px solid var(--line);border-radius:var(--r);background:var(--surface);max-height:calc(100vh - 200px);position:relative}
.plan table{border-collapse:separate;border-spacing:0;width:100%;min-width:980px;table-layout:fixed}
.plan th,.plan td{border-right:1px solid var(--line);border-bottom:1px solid var(--line);vertical-align:top;padding:0}
.plan thead th{position:sticky;top:0;z-index:3;background:var(--surface);font-size:12.5px;font-weight:700;padding:8px 6px;text-align:left}
.plan thead th.today{box-shadow:inset 0 -3px 0 var(--brand)}
.plan thead th .hol{display:block;font-weight:600;color:var(--brand);font-size:11px;text-transform:none;letter-spacing:0}
.plan th.who,.plan td.who{position:sticky;left:0;z-index:2;background:var(--surface);width:190px}
.plan thead th.who{z-index:4}
.plan td.who{padding:8px 10px}
.plan td.who .n{font-weight:600;font-size:14px;line-height:1.2} .plan td.who .h{font-size:12px;color:var(--muted)}
.plan td.who.off .n{color:var(--muted);text-decoration:line-through}
.plan td.cell{height:64px;padding:4px;position:relative;cursor:cell}
.plan td.cell.sel{box-shadow:inset 0 0 0 2px var(--live)}
.plan td.cell.over{background:var(--live-soft)}
.plan td.cell.we{background:color-mix(in srgb,var(--surface-2) 45%,var(--surface))}
.plan tr.gaps td{background:var(--bad-soft)}
.plan tr.open td.who{background:color-mix(in srgb,var(--warn-soft) 60%,var(--surface))}
.sh{display:block;border-radius:7px;padding:4px 6px 4px 9px;margin-bottom:3px;font-size:12px;line-height:1.25;background:var(--surface-2);border-left:4px solid var(--c,#888);cursor:grab;user-select:none;-webkit-user-select:none;position:relative;touch-action:manipulation;color:var(--ink)}
.sh .tm{font-weight:700;font-variant-numeric:tabular-nums} .sh .st{color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sh.draft{background:repeating-linear-gradient(-45deg,var(--surface),var(--surface) 5px,var(--surface-2) 5px,var(--surface-2) 10px);outline:1px dashed var(--line-2)}
.sh.warn::after{content:"!";position:absolute;right:4px;top:3px;width:15px;height:15px;border-radius:50%;background:var(--warn);color:#fff;font-weight:800;font-size:10px;display:grid;place-items:center}
.sh.open{border-left-style:dashed}
.sh.picked{outline:2px solid var(--live);outline-offset:1px}
.sh.dragging{opacity:.4}
.absc{font-size:11.5px;font-weight:700;border-radius:6px;padding:3px 6px;margin-bottom:3px;background:repeating-linear-gradient(45deg,var(--surface-3),var(--surface-3) 4px,var(--surface-2) 4px,var(--surface-2) 8px);color:var(--muted)}
.absc.pending{outline:1px dashed var(--warn);color:var(--warn)}
.gapc{font-size:11.5px;font-weight:700;color:var(--bad);padding:3px 5px}
.legend{display:flex;gap:12px;flex-wrap:wrap;font-size:12.5px;color:var(--muted)} .legend span{display:inline-flex;gap:5px;align-items:center}
.day{border-radius:var(--r);background:var(--surface);border:1px solid var(--line);overflow:hidden}
.day .dh{padding:8px 14px;background:var(--surface-2);font-weight:700;font-size:13.5px;display:flex;justify-content:space-between}
.day.today .dh{background:var(--brand);color:#fff}

/* ---------- messagerie ---------- */
.chat{display:grid;grid-template-columns:320px 1fr;height:calc(100vh - 140px);min-height:440px;border:1px solid var(--line);border-radius:var(--r);overflow:hidden;background:var(--surface)}
.chat .convs{border-right:1px solid var(--line);overflow-y:auto}
.chat .thread{display:flex;flex-direction:column;min-width:0}
.chat .msgs{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:6px;background:var(--bg)}
.bub{max-width:min(78%,560px);padding:8px 12px;border-radius:14px;background:var(--surface);border:1px solid var(--line);align-self:flex-start;white-space:pre-wrap;word-wrap:break-word}
.bub.me{align-self:flex-end;background:var(--ink);color:var(--bg);border-color:var(--ink)} .bub .who{font-size:12px;font-weight:700;color:var(--muted)} .bub .at{font-size:11px;opacity:.6;margin-top:2px;text-align:right}
.bub img{max-width:240px;border-radius:8px;display:block;margin-top:4px}
.chat .composer{display:flex;gap:8px;padding:10px;border-top:1px solid var(--line);align-items:flex-end}
.chat .composer textarea{min-height:44px;height:44px;max-height:140px}
@media(max-width:900px){.chat{grid-template-columns:1fr;height:calc(100vh - 170px);border:0;border-radius:0;margin:0 -14px}.chat.open .convs{display:none}.chat:not(.open) .thread{display:none}}

/* ---------- fil d'actualité ---------- */
.post{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);padding:16px;display:flex;flex-direction:column;gap:10px}
.post.pin{border-color:var(--warn)} .post.unread{box-shadow:inset 4px 0 0 var(--brand)}
.post .body{white-space:pre-wrap}

/* ---------- documents riches (cahier des charges) ---------- */
.rich{line-height:1.6} .rich h2{font-family:var(--f-body);font-weight:800;font-size:20px;margin:18px 0 6px} .rich h3{font-size:15px;color:var(--ink);text-transform:none;letter-spacing:0;margin:14px 0 4px} .rich p{margin:0 0 10px}
.rich img{border-radius:8px;margin:6px 0} .rich table{border-collapse:collapse;margin:8px 0} .rich td,.rich th{border:1px solid var(--line-2);padding:5px 8px} .rich ul,.rich ol{padding-left:22px;margin:0 0 10px}
.editor{border:1.5px solid var(--line-2);border-radius:10px;background:var(--surface);overflow:hidden}
.editor .tb{display:flex;gap:2px;flex-wrap:wrap;padding:6px;border-bottom:1px solid var(--line);background:var(--surface-2);position:sticky;top:0}
.editor .tb button{border:0;background:none;font:600 14px var(--f-body);min-width:34px;height:32px;border-radius:6px;cursor:pointer;color:var(--ink)} .editor .tb button:hover{background:var(--surface)}
.editor [contenteditable]{min-height:320px;padding:14px 16px;outline:none}

/* ---------- signature ---------- */
.sigpad{border:2px dashed var(--line-2);border-radius:12px;background:#fff;touch-action:none;width:100%;height:200px;display:block;cursor:crosshair}
.sigwrap{position:relative} .sigwrap .ph{position:absolute;left:14px;bottom:10px;color:#999;font-size:13px;pointer-events:none;margin:0}

/* ---------- divers ---------- */
.thumbs{display:flex;gap:8px;flex-wrap:wrap} .thumbs img{width:86px;height:86px;object-fit:cover;border-radius:8px;border:1px solid var(--line)}
.qrsheet{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px}
.qrcard{border:2px solid #000;border-radius:14px;padding:14px;text-align:center;background:#fff;color:#000;break-inside:avoid}
.qrcard .c{font:700 22px var(--f-body);letter-spacing:.2em}
.skel{background:linear-gradient(90deg,var(--surface-2),var(--surface-3),var(--surface-2));background-size:200% 100%;animation:sk 1.2s infinite;border-radius:8px;height:16px}
@keyframes sk{to{background-position:-200% 0}}
.spin{width:22px;height:22px;border:3px solid var(--line-2);border-top-color:var(--brand);border-radius:50%;animation:rot .8s linear infinite;display:inline-block}
@keyframes rot{to{transform:rotate(360deg)}}
.loading{display:flex;justify-content:center;padding:40px}
.kv{display:grid;grid-template-columns:minmax(120px,max-content) 1fr;gap:6px 16px;font-size:14.5px} .kv dt{color:var(--muted)} .kv dd{margin:0;font-weight:500;min-width:0;overflow-wrap:anywhere}
.steps{display:flex;gap:4px;flex-wrap:wrap} .steps span{font-size:12px;font-weight:700;padding:3px 9px;border-radius:999px;background:var(--surface-2);color:var(--muted)} .steps span.on{background:var(--ok-soft);color:var(--ok)} .steps span.cur{background:var(--live-soft);color:var(--live)} .steps span.ko{background:var(--bad-soft);color:var(--bad)}
.pill-row{display:flex;gap:6px;flex-wrap:wrap}
@media print{.side,.topbar,.tabbar,.sosbtn,.noprint,.toast{display:none!important} main.page{padding:0;max-width:none} body{background:#fff} .card{box-shadow:none;border:0}}
