
/* Mobile-first, une colonne ; la console A2M s'élargit sur desktop */
:root{
  --navy:#15283F; --teal:#00869B; --teal-soft:#E3F3F5; --teal-ink:#006E80;
  --bg:#F3F6F8; --surface:#FFFFFF; --fg:#15283F; --muted:#5A6B7D; --line:#DCE3EA; --btn:#15283F;
  --ok:#1F8A4C; --ok-soft:#E4F4EA; --warn:#A86400; --warn-soft:#FFF1DC; --info:#2D5BBF; --info-soft:#E6EDFB; --grey-soft:#ECEFF2;
  --f-display:"Poppins",system-ui,-apple-system,"Segoe UI",sans-serif;
  --f-mono:"IBM Plex Mono",ui-monospace,Menlo,monospace;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#0D1724; --surface:#15212F; --fg:#E7EEF4; --muted:#93A4B5; --line:#26364A; --teal-soft:#0E3440; --teal-ink:#4CC3D4; --btn:#00869B;
  --ok:#5CC98A; --ok-soft:#123222; --warn:#F0A94A; --warn-soft:#3A2810; --info:#8AAAF0; --info-soft:#18264A; --grey-soft:#202D3C; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#0D1724; --surface:#15212F; --fg:#E7EEF4; --muted:#93A4B5; --line:#26364A; --teal-soft:#0E3440; --teal-ink:#4CC3D4; --btn:#00869B;
  --ok:#5CC98A; --ok-soft:#123222; --warn:#F0A94A; --warn-soft:#3A2810; --info:#8AAAF0; --info-soft:#18264A; --grey-soft:#202D3C; color-scheme:dark}
*{box-sizing:border-box}
body{background:var(--bg);color:var(--fg);font-family:var(--f-display);font-size:15px;line-height:1.5}
button{font:inherit}
.wrap{max-width:520px;margin:0 auto;padding-block:20px 40px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));display:flex;flex-direction:column;gap:16px}
.wrap.wide{max-width:1000px}
h1,h2{margin:0;text-wrap:balance;line-height:1.2}
h1{font-size:19px;font-weight:700}
h2{font-size:15px;font-weight:600}
.muted{color:var(--muted)}
.small{font-size:13px}
.mono{font-family:var(--f-mono);font-variant-numeric:tabular-nums}
.card{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:12px;min-width:0}
.card-h{display:flex;justify-content:space-between;align-items:baseline;gap:10px}
.count{font-size:12px;color:var(--muted);font-weight:500}
:focus-visible{outline:3px solid var(--teal);outline-offset:2px}

/* En-tête */
.head{display:flex;gap:12px;align-items:center}
.head>div{min-width:0}
.logo{display:block;height:22px;width:auto}
.logo-chip{flex:none;background:#15283F;border-radius:10px;padding:13px 10px;display:flex}

/* Dernier passage */
.last{background:var(--teal);color:#fff;border:none;gap:2px}
.last .lbl{font-size:12px;opacity:.85;display:flex;align-items:center;gap:6px}
.last .lbl::before{content:"";width:8px;height:8px;border-radius:50%;background:#B8F0D2}
.last .big{font-size:24px;font-weight:700;line-height:1.2}
.last .row{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;font-size:14px;opacity:.95;margin-top:4px}

/* Boutons */
.btn{font-weight:600;font-size:15px;border:none;border-radius:12px;padding:14px 16px;cursor:pointer;background:var(--btn);color:#fff;text-align:center}
.btn.teal{background:var(--teal)}
.btn.ghost{background:transparent;color:var(--fg);border:1px solid var(--line)}
.btn.sm{font-size:13px;padding:7px 11px;border-radius:9px}
.link{background:none;border:none;color:var(--teal-ink);font-weight:500;font-size:14px;cursor:pointer;padding:4px;display:inline-flex;align-items:center;gap:6px;align-self:center}
.link svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}

/* Statuts */
.pill{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;border-radius:999px;padding:3px 10px;white-space:nowrap}
.pill::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.s-recue{background:var(--info-soft);color:var(--info)}
.s-prise,.s-planifiee{background:var(--warn-soft);color:var(--warn)}
.s-realisee{background:var(--ok-soft);color:var(--ok)}
.s-transmise{background:var(--grey-soft);color:var(--muted)}

/* Demande (résident) */
.list{display:flex;flex-direction:column}
.rq{display:flex;flex-direction:column;gap:3px;padding:12px 0;border-top:1px solid var(--line)}
.rq:first-child{border-top:none;padding-top:0}
.rq:last-child{padding-bottom:0}
.rq-top{display:flex;justify-content:space-between;align-items:center;gap:10px}
.rq-t{font-weight:600}
.rq-z{font-size:13px;color:var(--muted)}
.rq-meta{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--muted)}
.rq-r{color:var(--teal-ink);font-weight:500;font-size:13px}
.track{list-style:none;margin:8px 0 4px;padding:0;display:grid;grid-template-columns:repeat(4,1fr)}
.track li{display:flex;flex-direction:column;align-items:center;gap:4px;font-size:11px;color:var(--muted);text-align:center;position:relative;line-height:1.2}
.track li::before{content:"";position:absolute;top:5px;left:calc(-50% + 10px);width:calc(100% - 20px);height:2px;border-radius:1px;background:var(--line)}
.track li:first-child::before{display:none}
.track li.done::before,.track li.cur::before{background:var(--teal)}
.track .dot{width:12px;height:12px;border-radius:50%;background:var(--surface);border:2px solid var(--line)}
.track li.done .dot{background:var(--teal);border-color:var(--teal)}
.track li.cur .dot{border-color:var(--teal);box-shadow:0 0 0 3px var(--teal-soft)}
.track li.cur{color:var(--fg);font-weight:600}
.track small{font-size:10.5px;font-weight:400;color:var(--muted);font-variant-numeric:tabular-nums}
.track li.cur small{color:var(--teal-ink);font-weight:600}
.ps-badge{font-size:11px;font-weight:600;color:var(--teal-ink);background:var(--teal-soft);border-radius:999px;padding:2px 8px;white-space:nowrap}
.ps-dem{display:flex;flex-direction:column;gap:4px;border-left:3px solid var(--teal);padding-left:10px}
.ps-dem>span{font-size:12px;color:var(--muted);font-weight:500}
.date-in{font-size:13px;padding:6px 8px;width:auto;max-width:160px}
.prevu{font-size:12px;color:var(--muted);margin-top:4px}

/* Passages */
details.ps{border-top:1px solid var(--line);padding:10px 0}
details.ps:first-child{border-top:none;padding-top:0}
details.ps:last-child{padding-bottom:0}
details.ps summary{list-style:none;cursor:pointer;display:grid;grid-template-columns:40px 1fr auto auto;gap:10px;align-items:center}
details.ps summary::-webkit-details-marker{display:none}
details.ps summary::after{content:"";width:8px;height:8px;justify-self:end;border-right:2px solid var(--muted);border-bottom:2px solid var(--muted);transform:translateY(-2px) rotate(45deg);margin-right:4px;transition:transform .15s}
details.ps[open] summary::after{transform:translateY(2px) rotate(225deg)}
.wk{font-family:var(--f-mono);font-size:12px;color:var(--teal-ink)}
.ps-body{margin:8px 0 0 50px;display:flex;flex-direction:column;gap:6px}
.tags{display:flex;flex-wrap:wrap;gap:6px}
.tag{font-size:12px;background:var(--teal-soft);border-radius:6px;padding:2px 8px}

/* Formulaire */
.step{display:flex;flex-direction:column;gap:10px}
.step-h{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:600}
.step-h i{font-style:normal;width:22px;height:22px;border-radius:50%;background:var(--teal);color:#fff;font-size:12px;display:grid;place-items:center;flex:none}
.step-h small{font-weight:400;color:var(--muted);font-size:12px}
.tiles{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.tile{font-size:11.5px;font-weight:500;line-height:1.2;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:78px;padding:10px 2px;border-radius:12px;border:1px solid var(--line);background:var(--surface);color:var(--fg);cursor:pointer;text-align:center;hyphens:manual;overflow-wrap:normal}
.tile svg,.ic{width:24px;height:24px;stroke:var(--teal);fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
.tile[aria-pressed="true"]{background:var(--teal);border-color:var(--teal);color:#fff}
.tile[aria-pressed="true"] svg{stroke:#fff}
.sub{display:flex;flex-direction:column;gap:6px}
.sub>span{font-size:12px;color:var(--muted);font-weight:500}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{font-size:14px;padding:8px 13px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--fg);cursor:pointer}
.chip[aria-pressed="true"]{background:var(--teal);border-color:var(--teal);color:#fff}
input,select,textarea{font:inherit;font-size:16px;color:var(--fg);background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:11px 12px;width:100%}
textarea{min-height:76px;resize:vertical}
.photo-btn{display:flex;align-items:center;gap:12px;padding:12px;border:1px dashed var(--teal);border-radius:12px;background:var(--teal-soft);cursor:pointer;font-size:14px;font-weight:500;position:relative}
.photo-btn img{width:44px;height:44px;object-fit:cover;border-radius:8px;flex:none}
.photo-btn input{position:absolute;inset:0;opacity:0;cursor:pointer}
.hint{font-size:13px;background:var(--teal-soft);border-radius:10px;padding:10px 12px}
.recap{font-size:13px;color:var(--muted)}
.recap b{color:var(--fg)}
.err{font-size:13px;color:var(--warn);font-weight:500}
.confirm{background:var(--ok-soft);border-color:transparent;text-align:center;gap:4px}
.confirm .mono{font-size:20px;color:var(--ok)}
.foot{text-align:center;font-size:12px;color:var(--muted);display:flex;flex-direction:column;gap:2px}

/* Agent */
.check{display:flex;gap:12px;align-items:center;padding:12px;border:1px solid var(--line);border-radius:10px;cursor:pointer;font-weight:500}
.check input{width:22px;height:22px;accent-color:var(--teal);flex:none}
.check:has(input:checked){background:var(--teal-soft);border-color:var(--teal)}
.clock{font-family:var(--f-mono);font-size:36px;text-align:center;line-height:1}

/* Console */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
@media (max-width:640px){.kpis{grid-template-columns:repeat(2,1fr)}}
.kpi{background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:12px;color:var(--fg);text-align:left;cursor:pointer}
.kpi[aria-pressed="true"]{border-color:var(--teal);box-shadow:inset 0 0 0 1px var(--teal)}
.kpi b{display:block;font-size:24px;font-variant-numeric:tabular-nums;line-height:1.2}
.kpi span{font-size:12px;color:var(--muted)}
.tbl{overflow-x:auto}
table{border-collapse:collapse;width:100%;font-size:14px;min-width:640px}
th{text-align:left;font-size:11px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:600;padding:8px;border-bottom:1px solid var(--line)}
td{padding:10px 8px;border-bottom:1px solid var(--line);vertical-align:top}
tr:last-child td{border-bottom:none}
.cat{display:flex;gap:8px;align-items:center;font-weight:600}
.cat .ic{width:18px;height:18px}
.acts{display:flex;gap:6px;flex-wrap:wrap}
.reply-in{font-size:13px;padding:6px 8px;margin-top:6px}
.grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:16px;align-items:start}
.stats{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.stat{background:var(--bg);border-radius:10px;padding:10px 12px}
.stat b{display:block;font-size:22px;font-variant-numeric:tabular-nums;line-height:1.2}
.stat span{font-size:12px;color:var(--muted)}
.thanks{display:flex;flex-direction:column;gap:6px}
.thanks div{font-size:13px;border-left:3px solid var(--teal);padding-left:10px}

/* Affiche (couleurs fixes : support imprimé) */
.poster{background:#fff;color:#15283F;border-radius:6px;overflow:hidden;display:flex;flex-direction:column;text-align:center;border:1px solid var(--line);aspect-ratio:210/297;width:100%;max-width:340px;margin:0 auto;box-shadow:0 8px 24px rgba(21,40,63,.12)}
.p-top{background:#15283F;color:#fff;padding:22px 18px 40px;display:flex;flex-direction:column;align-items:center;gap:10px}
.p-top .logo{height:30px}
.p-top .res{font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:#7FD3DF;font-weight:600}
.p-top .hl{font-size:21px;font-weight:700;line-height:1.2;text-wrap:balance}
.p-top .hl em{font-style:normal;color:#3FC1D3}
.p-qr{width:fit-content;display:flex;justify-content:center;margin:-30px auto 0;background:#fff;border:3px solid #00869B;border-radius:16px;padding:9px;position:relative}
.p-qr img,.p-qr canvas{display:block}
.p-scan{display:inline-block;margin-top:8px;background:#00869B;color:#fff;font-size:11px;font-weight:600;letter-spacing:.14em;text-transform:uppercase;padding:4px 12px;border-radius:999px}
.p-feats{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;padding:14px 12px 4px;flex:1;align-content:center}
.p-feat{display:flex;flex-direction:column;align-items:center;gap:6px;font-size:11.5px;font-weight:600;line-height:1.25}
.p-ico{width:40px;height:40px;border-radius:50%;background:#E3F3F5;display:grid;place-items:center}
.p-ico svg{width:20px;height:20px;stroke:#00869B;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.p-foot{background:#00869B;color:#fff;font-size:11px;font-weight:600;letter-spacing:.06em;padding:9px 10px}

.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(20px + env(safe-area-inset-bottom,0px));background:var(--navy);color:#fff;padding:10px 16px;border-radius:10px;font-size:14px;z-index:20;box-shadow:0 6px 20px rgba(0,0,0,.25);max-width:calc(100% - 32px)}
@media (prefers-reduced-motion:no-preference){html{scroll-behavior:smooth}}

/* Pages réelles */
.top-bar{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.tabs{display:flex;gap:4px;background:var(--grey-soft);border-radius:999px;padding:3px;flex-wrap:wrap}
.tabs a{color:var(--fg);text-decoration:none;font-size:13px;font-weight:500;padding:6px 14px;border-radius:999px}
.tabs a[aria-current="page"]{background:var(--teal);color:#fff}
.empty{text-align:center;color:var(--muted);padding:24px 8px}
.loading{text-align:center;color:var(--muted);padding:40px 8px}
.row2{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:12px}
.days{display:flex;gap:6px;flex-wrap:wrap}
.days label{flex-direction:row;align-items:center;gap:6px;font-weight:500;font-size:14px;border:1px solid var(--line);border-radius:999px;padding:6px 12px;cursor:pointer}
.days input{width:auto;accent-color:var(--teal)}
.res-row{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;padding:12px 0;border-top:1px solid var(--line)}
.res-row:first-child{border-top:none;padding-top:0}
.res-row:last-child{padding-bottom:0}
a.btn{text-decoration:none;display:inline-block}
.thumb{width:56px;height:56px;object-fit:cover;border-radius:8px;margin-top:6px;cursor:zoom-in}
.copy{display:flex;gap:8px}
.pick{border:1px solid var(--line);border-radius:12px;padding:12px 14px 14px;margin:0;display:flex;flex-direction:column;gap:10px;min-width:0}
.pick legend{font-size:14px;font-weight:600;padding:0 6px}
.pick legend small{font-weight:400}
.pick-g{display:grid;grid-template-columns:120px 1fr;gap:8px;align-items:start}
.pick-g>span{font-size:12px;color:var(--muted);font-weight:500;padding-top:8px}
.pick-g .days:empty{display:none}
.pick-g:has(.days:empty){display:none}
@media (max-width:560px){.pick-g{grid-template-columns:1fr}.pick-g>span{padding-top:0}}
.days label:has(input:checked){background:var(--teal-soft);border-color:var(--teal);color:var(--fg)}
.days label{font-size:13px;padding:5px 11px 5px 8px;gap:6px}
.pick .copy{max-width:420px}
.geo-box{display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center;padding-top:4px}
.geo-box .link{font-size:13px}
.ps-geo{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--ok);font-weight:500}
.geo-fs .row2{align-items:end}
.geo-fs .acts{flex-wrap:wrap}
.staff-bar{display:flex;justify-content:center;align-items:center;gap:6px;flex-wrap:wrap;font-size:13px;color:var(--muted);padding-top:8px}
.staff-bar .link{font-size:13px}
.copy input{font-size:13px;padding:7px 10px}
