/* Layout: one working column — period bar, totals strip, crew ledger; detail opens as a bottom sheet */
:root{
  --bg:#F1F3F1; --surface:#FFFFFF; --sunk:#E7EBE8; --ink:#1B2220; --muted:#5C6763; --line:#D5DBD7;
  --accent:#A9520E; --accent-soft:#F6E6D8; --on-accent:#FFFFFF;
  --pos:#2B7A4B; --neg:#B0281F; --weekend:#ECEFF0;
  --full:#A9520E; --half:#E7B98E;
  --f-display:"Barlow Condensed","Arial Narrow",system-ui,sans-serif;
  --f-body:"Barlow",system-ui,-apple-system,"Segoe UI",sans-serif;
}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){
  --bg:#121614; --surface:#1A201D; --sunk:#232A27; --ink:#E8ECE9; --muted:#97A29D; --line:#2E3632;
  --accent:#E38D45; --accent-soft:#3A2818; --on-accent:#1A120B;
  --pos:#5DC08A; --neg:#F2766B; --weekend:#1F2523; --full:#E38D45; --half:#7A4E2C; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#121614; --surface:#1A201D; --sunk:#232A27; --ink:#E8ECE9; --muted:#97A29D; --line:#2E3632;
  --accent:#E38D45; --accent-soft:#3A2818; --on-accent:#1A120B;
  --pos:#5DC08A; --neg:#F2766B; --weekend:#1F2523; --full:#E38D45; --half:#7A4E2C; color-scheme:dark}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--f-body);font-size:15px;line-height:1.45;
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));padding-block:20px 48px}
.wrap{max-width:960px;margin:0 auto;display:flex;flex-direction:column;gap:18px}
h1,h2,h3{font-family:var(--f-display);font-weight:700;letter-spacing:.01em;margin:0;text-wrap:balance}
h1{font-size:2rem;line-height:1}
h2{font-size:1.35rem}
h3{font-size:1.1rem}
.num{font-variant-numeric:tabular-nums}
.muted{color:var(--muted)}
.label{font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:600}
header.top{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px;border-bottom:3px solid var(--ink);padding-bottom:12px}
header.top .who{font-size:.9rem;color:var(--muted)}
.period{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.period .m{font-family:var(--f-display);font-size:1.3rem;font-weight:600;min-width:9.5ch;text-align:center;text-transform:capitalize}
button,.btn{font:inherit;font-weight:600;border:1px solid var(--line);background:var(--surface);color:var(--ink);
  border-radius:6px;padding:8px 12px;cursor:pointer;min-height:38px}
button:hover{border-color:var(--muted)}
button:focus-visible,input:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
button.primary{background:var(--accent);border-color:var(--accent);color:var(--on-accent)}
button.ghost{background:transparent;border-color:transparent;color:var(--muted)}
button.danger{color:var(--neg)}
button.icon{width:38px;padding:0;font-size:1.1rem}
button:disabled{opacity:.45;cursor:default}
.seg{display:inline-flex;border:1px solid var(--line);border-radius:6px;overflow:hidden}
.seg button{border:0;border-radius:0;min-height:34px;padding:6px 10px;font-size:.85rem;background:var(--surface)}
.seg button[aria-pressed="true"]{background:var(--ink);color:var(--bg)}
input,select{font:inherit;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:6px;padding:8px 10px;min-height:38px;width:100%;min-width:0}
.field{display:flex;flex-direction:column;gap:4px;min-width:0}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end}
.row>.field{flex:1 1 140px}
.totals{display:grid;grid-template-columns:repeat(4,1fr);background:var(--surface);border:1px solid var(--line);border-radius:8px}
.totals>div{padding:14px 16px;display:flex;flex-direction:column;gap:2px;min-width:0}
.totals>div+div{border-left:1px solid var(--line)}
.totals .v{font-family:var(--f-display);font-size:1.6rem;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.totals .v small{font-size:.9rem;color:var(--muted);font-weight:600;margin-left:3px}
.v.rest{color:var(--accent)}
@media (max-width:620px){.totals{grid-template-columns:1fr 1fr}.totals>div:nth-child(3){border-left:0}.totals>div:nth-child(n+3){border-top:1px solid var(--line)}}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:16px;display:flex;flex-direction:column;gap:12px}
.panel.notice{background:var(--accent-soft);border-color:transparent}
.bar{display:flex;flex-wrap:wrap;gap:8px;justify-content:space-between;align-items:center}
.ledger{overflow-x:auto;background:var(--surface);border:1px solid var(--line);border-radius:8px}
table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}
th{font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);font-weight:600;text-align:right;padding:10px 14px;border-bottom:1px solid var(--line);white-space:nowrap}
th:first-child,td:first-child{text-align:left}
td{padding:12px 14px;border-bottom:1px solid var(--line);text-align:right;white-space:nowrap}
tbody tr{cursor:pointer}
tbody tr:hover td{background:var(--sunk)}
tbody tr:last-child td{border-bottom:0}
tfoot td{font-weight:600;border-top:2px solid var(--ink);border-bottom:0}
td .n{font-weight:600}
td .s{font-size:.82rem;color:var(--muted)}
.rest-pos{color:var(--accent);font-weight:600}
.rest-zero{color:var(--pos);font-weight:600}
.rest-neg{color:var(--neg);font-weight:600}
.chip{display:inline-block;font-size:.7rem;font-weight:600;letter-spacing:.04em;padding:1px 6px;border-radius:4px;background:var(--sunk);color:var(--muted);margin-left:6px;vertical-align:1px}
.empty{padding:28px 16px;text-align:center;color:var(--muted)}
/* calendar */
.cal{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}
.cal .dow{font-size:.7rem;text-align:center;color:var(--muted);font-weight:600;text-transform:uppercase;letter-spacing:.06em;padding-bottom:2px}
.day{aspect-ratio:1/1.05;max-width:100%;min-height:0;padding:4px;border-radius:6px;border:1px solid var(--line);background:var(--surface);
  display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;font-variant-numeric:tabular-nums;position:relative;overflow:hidden}
.day .d{font-size:.85rem;font-weight:600}
.day .t{font-size:.66rem;font-weight:600;align-self:flex-end}
.day.we{background:var(--weekend)}
.day.full{background:var(--full);border-color:var(--full);color:var(--on-accent)}
.day.half{background:linear-gradient(135deg,var(--full) 0 50%,var(--half) 50% 100%);border-color:var(--full);color:var(--on-accent)}
.day.today{outline:2px solid var(--ink);outline-offset:-2px}
.day:disabled{opacity:.35}
.legend{display:flex;gap:14px;flex-wrap:wrap;font-size:.82rem;color:var(--muted);align-items:center}
.sw{display:inline-block;width:12px;height:12px;border-radius:3px;vertical-align:-1px;margin-right:5px;border:1px solid var(--line)}
.list{display:flex;flex-direction:column}
.list>div{display:flex;justify-content:space-between;gap:10px;padding:9px 0;border-bottom:1px dashed var(--line);align-items:center}
.list>div:last-child{border-bottom:0}
.list .amt{font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap}
.cols{display:grid;grid-template-columns:1.2fr 1fr;gap:18px}
.cols>*{min-width:0}
@media (max-width:720px){.cols{grid-template-columns:1fr}}
/* sheet */
.scrim{position:fixed;inset:0;background:rgba(10,14,12,.45);z-index:20;display:flex;align-items:flex-end;justify-content:center}
.sheet{background:var(--bg);width:100%;max-width:820px;max-height:92%;overflow-y:auto;border-radius:14px 14px 0 0;
  padding:18px max(16px,env(safe-area-inset-right,0px)) calc(24px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));
  display:flex;flex-direction:column;gap:16px}
@media (min-width:860px){.scrim{align-items:center}.sheet{border-radius:14px;max-height:88%}}
.sheet-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.toast{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(18px + env(safe-area-inset-bottom,0px));background:var(--ink);color:var(--bg);
  padding:10px 16px;border-radius:8px;font-weight:600;z-index:40;max-width:calc(100% - 32px)}
.tabs{display:flex;gap:2px;border-bottom:1px solid var(--line);overflow-x:auto}
.tabs button{border:0;border-bottom:3px solid transparent;border-radius:0;background:transparent;color:var(--muted);font-family:var(--f-display);font-size:1.15rem;padding:6px 14px}
.tabs button[aria-selected="true"]{color:var(--ink);border-bottom-color:var(--accent)}
.bars{display:flex;flex-direction:column;gap:8px}
.bars>div{display:grid;grid-template-columns:minmax(0,9rem) 1fr auto;gap:10px;align-items:center}
.bars .track{height:10px;background:var(--sunk);border-radius:5px;overflow:hidden}
.bars .fill{height:100%;background:var(--accent);border-radius:5px}
.bars .fill.labor{background:var(--ink)}
.bars .amt{font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap;text-align:right}
.bars .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
details summary{cursor:pointer;font-weight:600}
details ol{margin:8px 0 0;padding-left:20px;display:flex;flex-direction:column;gap:4px}
.mini{font-size:.85rem}
@media (prefers-reduced-motion:no-preference){.sheet{animation:up .18s ease-out}@keyframes up{from{transform:translateY(24px);opacity:.6}}}

:root{color-scheme:light;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
[hidden]{display:none!important}
.login{max-width:380px;margin:8vh auto 0;display:flex;flex-direction:column;gap:14px}
.login form{display:flex;flex-direction:column;gap:12px}
.err{color:var(--neg);font-weight:600;margin:0}
.who{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

.day{position:relative}
.note-dot{position:absolute;top:5px;right:5px;width:7px;height:7px;border-radius:50%;background:var(--ink);box-shadow:0 0 0 2px var(--surface)}
.day.full .note-dot,.day.half .note-dot{background:var(--on-accent);box-shadow:0 0 0 2px var(--full)}
textarea{font:inherit;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:6px;padding:8px 10px;width:100%;min-width:0;resize:vertical}
textarea:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.comments{display:flex;flex-direction:column;gap:8px}
.comment{border:1px solid var(--line);border-radius:8px;padding:8px 10px;display:flex;flex-direction:column;gap:4px;min-width:0}
.comment.from-boss{background:var(--accent-soft);border-color:transparent}
.comment-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.comment-head .num{margin-left:auto}
.comment-body{white-space:pre-wrap;overflow-wrap:anywhere}
.chip-note{background:var(--accent-soft);color:var(--accent);margin-left:0}

/* ---- v2 : validation, clôture, caisse ---- */
.day.pending{background:var(--accent-soft);color:var(--ink);border:2px dashed var(--accent)}
.day.pending.half{background:linear-gradient(135deg,var(--half) 0 50%,var(--accent-soft) 50% 100%)}
.day.pending .t{color:var(--accent)}
.day.rejected{background:var(--surface);color:var(--muted);border:2px dashed var(--neg)}
.day.rejected .d{text-decoration:line-through}
.day.rejected .t{color:var(--neg)}
.sw-pending{background:var(--accent-soft);border:2px dashed var(--accent)}
.sw-rejected{background:var(--surface);border:2px dashed var(--neg)}
.chip-pend{background:var(--accent-soft);color:var(--accent)}
.chip-lock{background:var(--ink);color:var(--bg)}
.pend-txt{color:var(--accent);font-weight:600}
.pend-banner{flex-direction:row;flex-wrap:wrap;justify-content:space-between;align-items:center}
.close-panel{border-left:4px solid var(--accent)}
.close-panel.closed{border-left-color:var(--pos)}
.close-panel h3{margin-bottom:2px}
.v.neg{color:var(--neg)}
.receipt-img{width:100%;height:auto;border-radius:8px;border:1px solid var(--line);background:var(--surface)}
details>summary{margin-top:6px}

/* ---- v3 : sociétés et chantiers ---- */
.tabs{align-items:flex-end}
.site-pick{margin-left:auto;display:flex;align-items:center;gap:8px;padding-bottom:6px}
.site-pick select{width:auto;min-width:160px;max-width:240px}
@media (max-width:620px){.site-pick{margin-left:0;width:100%;padding:6px 0}.site-pick select{flex:1;max-width:none}.tabs{flex-wrap:wrap}}
.signup-cta{display:flex;flex-direction:column;gap:6px;border-top:1px dashed var(--line);padding-top:12px}
.code-big{font-family:var(--f-display);font-size:2.2rem;font-weight:700;letter-spacing:.08em;color:var(--accent)}
.invite{display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.invite .qr{width:140px;height:140px;background:#fff;border-radius:8px;padding:6px;border:1px solid var(--line);flex:none}
.invite .qr svg{width:100%;height:100%;display:block}
.expired{border-left:4px solid var(--neg)}
.super-list{display:flex;flex-direction:column}
.super-row{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:12px 0;border-bottom:1px dashed var(--line)}
.super-row:last-child{border-bottom:0}
.super-actions{align-items:center}
.chip-exp{background:var(--neg);color:#fff}
.chip-ok{background:var(--pos);color:#fff}
code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;background:var(--sunk);padding:2px 6px;border-radius:4px}

/* ---- v4 : budget ---- */
.budget-panel{border-left:4px solid var(--pos)}
.budget-panel.warn{border-left-color:var(--accent)}
.budget-panel.over{border-left-color:var(--neg)}
.bud-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.bud-grid>div{display:flex;flex-direction:column;gap:2px;min-width:0}
.bud-grid .v{font-family:var(--f-display);font-size:1.5rem;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bud-grid .v small{font-size:.85rem;color:var(--muted);margin-left:3px}
.bud-grid .v.rest{color:var(--pos)}
@media (max-width:620px){.bud-grid{grid-template-columns:1fr}}
.bud-track{height:12px;background:var(--sunk);border-radius:6px;overflow:hidden}
.bud-fill{height:100%;border-radius:6px;background:var(--pos);transition:width .3s}
.bud-fill.warn{background:var(--accent)}
.bud-fill.over{background:var(--neg)}
.bud-pct{font-weight:600}
.bud-pct.ok{color:var(--pos)}.bud-pct.warn{color:var(--accent)}.bud-pct.over{color:var(--neg)}

/* ---- v5 : équipe ---- */
.staff-row{align-items:center}
.totals.mgr{grid-template-columns:1fr}
span.site-pick{margin-left:auto;padding-bottom:10px}
#dtCal{max-width:560px}
.name-banner{flex-direction:column;align-items:stretch;gap:8px}
.name-banner .field,.name-banner span{flex:none!important}
.name-banner button{align-self:flex-start}

/* ---- v7 : notifications ---- */
.notif-banner{flex-direction:row;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:10px}

/* ---------- hors connexion ---------- */
.panel.notice.offline{border-left:4px solid #8a6d1f;background:#f6efd9}
.day{position:relative}
.day .q-dot{position:absolute;left:5px;top:5px;width:7px;height:7px;border-radius:50%;background:#8a6d1f;box-shadow:0 0 0 2px #fff}
.pdf-btn{margin-top:10px}
.apk-banner{display:flex;flex-direction:row;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between;border-left:4px solid var(--accent,#ad540c)}

/* =================== Refonte 2026-10 : téléphone d'abord =================== */
/* en-tête */
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.brand .logo{width:40px;height:40px;border-radius:10px;flex:none}
.brand h1{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.who .who-name{color:var(--muted)}
.who-actions{display:flex;gap:4px;flex-wrap:wrap}
.menu-btn{display:none}
.menu-btn svg,.tabs svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tabs svg{display:none}
.m-only{display:none}
.tabrow{display:flex;align-items:flex-end;gap:12px;border-bottom:1px solid var(--line)}
.tabrow .tabs{border-bottom:0;flex:1}
/* menu (feuille) */
.menu-list{display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line);border-radius:10px;overflow:hidden}
.menu-item{display:flex;flex-direction:column;align-items:flex-start;gap:1px;text-align:left;border:0;border-radius:0;border-bottom:1px solid var(--line);padding:14px 16px;min-height:56px;background:var(--surface)}
.menu-item:last-child{border-bottom:0}
.menu-item[data-danger]{color:var(--neg)}
/* « Aujourd'hui » (ouvrier) */
.today{border-top:4px solid var(--accent)}
.today h2{font-size:1.6rem}
.today-btns{display:grid;grid-template-columns:2fr 1fr;gap:10px}
.today-btn{min-height:64px;font-size:1.05rem;border:2px solid var(--accent);color:var(--accent);background:var(--surface);border-radius:12px}
.today-btn.on{background:var(--accent);color:var(--on-accent)}
.today-btn:disabled{border-color:var(--line);color:var(--muted)}
.today.is-approved{border-top-color:var(--pos)}
.today.is-approved .today-state{color:var(--pos);font-weight:600}
.today.is-rejected .today-state{color:var(--neg);font-weight:600}
.big-num{font-family:var(--f-display);font-size:1.6rem;font-weight:600}
.me-card .bar{align-items:flex-end}
/* connexion */
.login-hero{max-width:380px;margin:6vh auto 0;text-align:center;display:flex;flex-direction:column;align-items:center;gap:6px}
.login-hero img{border-radius:18px;box-shadow:0 8px 24px rgba(27,34,32,.18)}
.login-hero h2{font-size:1.8rem;margin-top:8px}
.login-hero p{margin:0;color:var(--muted)}
.login-hero+.login{margin-top:18px}
/* chargement */
.skel-wrap{display:flex;flex-direction:column;gap:12px}
.skel{border-radius:8px;background:var(--sunk)}
@media (prefers-reduced-motion:no-preference){
  .skel{background:linear-gradient(90deg,var(--sunk) 25%,var(--surface) 50%,var(--sunk) 75%);background-size:200% 100%;animation:shimmer 1.2s linear infinite}
  @keyframes shimmer{to{background-position:-200% 0}}
  .day,button{transition:transform .08s ease,background-color .15s ease,border-color .15s ease,color .15s ease}
  .day:not(:disabled):active,button:not(:disabled):active{transform:scale(.95)}
  .toast{animation:pop .18s ease-out}@keyframes pop{from{transform:translate(-50%,8px);opacity:0}}
}
/* hors connexion : couleurs du thème (clair et sombre) */
.panel.notice.offline{background:var(--sunk);border-left:4px solid var(--accent)}
.day .q-dot{background:var(--accent);box-shadow:0 0 0 2px var(--surface)}

/* ----- téléphone ----- */
@media (max-width:640px){
  body{padding-block:10px 32px;font-size:15.5px}
  body.has-tabbar{padding-bottom:calc(84px + env(safe-area-inset-bottom,0px))}
  header.top{flex-wrap:nowrap;align-items:center;border-bottom-width:2px;padding-bottom:10px}
  .brand .logo{width:34px;height:34px;border-radius:9px}
  h1{font-size:1.45rem}
  header.top .label{font-size:.66rem}
  .who-actions,.who .who-name,.desk-only{display:none!important}
  .menu-btn{display:inline-flex;align-items:center;justify-content:center;width:44px;min-height:44px}
  .m-only{display:inline}
  /* onglets → barre du bas */
  .tabrow{border-bottom:0;display:block}
  .tabrow .tabs{position:fixed;left:0;right:0;bottom:0;z-index:15;background:var(--surface);border-top:1px solid var(--line);
    display:flex;justify-content:space-around;gap:0;padding:4px 4px calc(4px + env(safe-area-inset-bottom,0px));box-shadow:0 -4px 16px rgba(0,0,0,.06)}
  .tabs button{flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;border:0;padding:6px 2px;font-family:var(--f-body);font-size:.72rem;min-height:54px;border-radius:10px}
  .tabs svg{display:block}
  .tabs button[aria-selected="true"]{color:var(--accent);background:var(--accent-soft)}
  .site-pick,label.site-pick{margin:0;width:100%;padding:0}
  /* bouton flottant */
  .fab-m{position:fixed;right:16px;bottom:calc(78px + env(safe-area-inset-bottom,0px));z-index:16;width:56px;height:56px;min-height:56px;padding:0;border-radius:50%;
    font-size:1.8rem;line-height:1;box-shadow:0 6px 18px rgba(169,82,14,.35);display:flex;align-items:center;justify-content:center}
  .fab-m .fab-txt{display:none}
  .toast{bottom:calc(150px + env(safe-area-inset-bottom,0px))}
  /* liste des ouvriers en cartes */
  .ledger.cards{background:transparent;border:0;overflow:visible}
  .ledger.cards thead{display:none}
  .ledger.cards table,.ledger.cards tbody,.ledger.cards tfoot{display:block}
  .ledger.cards tr{display:grid;grid-template-columns:repeat(3,1fr);gap:8px 10px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:14px;margin-bottom:10px}
  .ledger.cards td{display:flex;flex-direction:column;border:0;padding:0;text-align:left;white-space:normal;font-weight:600}
  .ledger.cards td::before{content:attr(data-label);font-size:.66rem;text-transform:uppercase;letter-spacing:.07em;color:var(--muted);font-weight:600}
  .ledger.cards td:first-child{grid-column:1/-1}
  .ledger.cards td:first-child::before{display:none}
  .ledger.cards td.rest-cell{grid-column:1/-1;order:-1;flex-direction:row;justify-content:space-between;align-items:baseline;font-family:var(--f-display);font-size:1.5rem;
    border-bottom:1px solid var(--line);padding-bottom:8px;margin-bottom:2px}
  .ledger.cards td.rest-cell::before{font-family:var(--f-body)}
  .ledger.cards td.rest-cell small{font-size:.85rem;color:var(--muted)}
  .ledger.cards td:first-child{order:-2}
  .ledger.cards td.empty{grid-column:1/-1}
  .ledger.cards tbody tr:hover td{background:transparent}
  .ledger.cards tbody tr:active{background:var(--sunk)}
  .ledger.cards tfoot tr{background:var(--ink);color:var(--bg);border-color:var(--ink)}
  .ledger.cards tfoot td{border-top:0}
  .ledger.cards tfoot td::before,.ledger.cards tfoot td.rest-cell small{color:inherit;opacity:.7}
  .ledger.cards tfoot td.rest-cell{border-bottom-color:rgba(255,255,255,.2);color:inherit}
  .today-btns{grid-template-columns:1fr}
  .today-btn{min-height:58px}
  .login-hero{margin-top:3vh}
}
@media (max-width:640px){
  .ledger.cards td.rest-cell{justify-content:flex-start;gap:0}
  .ledger.cards td.rest-cell::before{margin-right:auto;align-self:center}
  .ledger.cards td.rest-cell small{margin-left:4px}
  body.has-tabbar #main{padding-bottom:60px}
}

/* ----- ordinateur : onglets en colonne à gauche ----- */
.layout .content{display:flex;flex-direction:column;gap:18px;min-width:0}
.layout:not(.with-side){display:block}
@media (min-width:641px) and (max-width:959px){.layout.with-side{display:flex;flex-direction:column;gap:18px}}
@media (min-width:960px){
  .wrap{max-width:1240px}
  .layout.with-side{display:grid;grid-template-columns:210px minmax(0,1fr);gap:28px;align-items:start}
  .layout.with-side .tabrow{position:sticky;top:16px;flex-direction:column;align-items:stretch;gap:18px;border-bottom:0}
  .layout.with-side .tabs{flex-direction:column;align-items:stretch;gap:4px;overflow:visible}
  .layout.with-side .tabs button{display:flex;align-items:center;justify-content:flex-start;width:100%;gap:12px;text-align:left;border:0;border-radius:8px;padding:10px 12px;
    font-family:var(--f-body);font-size:.98rem;font-weight:600;color:var(--muted);min-height:44px}
  .layout.with-side .tabs button:hover{background:var(--sunk);color:var(--ink)}
  .layout.with-side .tabs button[aria-selected="true"]{background:var(--accent-soft);color:var(--accent)}
  .layout.with-side .tabs svg{display:block;flex:none}
  .layout.with-side .site-pick{margin:0;flex-direction:column;align-items:stretch;gap:6px;padding:14px 12px 0;border-top:1px solid var(--line)}
  .layout.with-side .site-pick select{width:100%;max-width:none;min-width:0}
  .layout.with-side span.site-pick{padding:14px 12px 0}
}

/* ---------- Analyses ---------- */
:root{--s-labor:#2a78d6;--s-buy:#eb6834}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--s-labor:#3987e5;--s-buy:#d95926}}
:root[data-theme="dark"]{--s-labor:#3987e5;--s-buy:#d95926}
.sw-labor,.sw-buy{display:inline-block;width:10px;height:10px;border-radius:3px;background:var(--s-labor);vertical-align:-1px;margin-right:6px}
.sw-buy{background:var(--s-buy)}
.label .dot{margin-right:5px}
.bi-legend{display:flex;gap:14px;font-size:.8rem;color:var(--muted);font-weight:600}
.bi-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.bi-grid>*{min-width:0}
.bi-grid:empty{display:none}
@media (max-width:900px){.bi-grid{grid-template-columns:1fr}}
.hbars{display:flex;flex-direction:column;gap:12px}
.hb{display:grid;grid-template-columns:minmax(0,10rem) minmax(40px,1fr) 8.5rem;gap:4px 12px;align-items:center;cursor:default}
.hb[data-open]{cursor:pointer}
.hb .nm{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:flex;flex-direction:column;line-height:1.25}
.hb .nm small,.hb .amt small{font-weight:500;color:var(--muted);font-size:.76rem}
.hb .amt{text-align:right;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap;display:flex;flex-direction:column;line-height:1.25}
.hb .track{height:12px;background:var(--sunk);border-radius:4px;display:flex;overflow:hidden}
.hb .fill{display:block;height:100%;border-radius:4px;min-width:0}
.hb .stack{display:flex;gap:2px;height:100%}
.hb .stack .fill{border-radius:0;min-width:2px}
.hb .stack .fill:first-child{border-radius:4px 0 0 4px}
.hb .stack .fill:last-child{border-radius:0 4px 4px 0}
.hb .stack .fill:only-child{border-radius:4px}
.hb .fill.labor{background:var(--s-labor)}
.hb .fill.buy{background:var(--s-buy)}
.hb:hover .track{outline:2px solid var(--line);outline-offset:2px}
@media (max-width:640px){.hb{grid-template-columns:1fr auto}.hb .nm{grid-column:1}.hb .amt{grid-column:2;grid-row:1/3}.hb .track{grid-column:1;grid-row:2}}
.cols-chart{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:6px;height:220px;align-items:end;padding-top:6px;border-bottom:1px solid var(--line)}
.cc{height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:4px;min-width:0;position:relative;padding-bottom:22px}
.cc-stack{width:min(100%,38px);display:flex;flex-direction:column;gap:2px;min-height:0}
.cc-stack .seg{display:block;min-height:2px}
.cc-stack .seg:first-child{border-radius:4px 4px 0 0}
.cc-stack .seg.labor{background:var(--s-labor)}
.cc-stack .seg.buy{background:var(--s-buy)}
.cc-val{font-size:.72rem;font-weight:600;color:var(--muted);white-space:nowrap;font-variant-numeric:tabular-nums}
.cc-lab{position:absolute;bottom:2px;font-size:.72rem;color:var(--muted);text-transform:capitalize}
.cc.cur .cc-lab{color:var(--ink);font-weight:700}
.cc:hover .cc-stack{outline:2px solid var(--line);outline-offset:2px;border-radius:4px}
@media (max-width:640px){.cols-chart{gap:3px;height:180px}.cc-val{display:none}.cc.cur .cc-val{display:block}}
.bi-table summary{cursor:pointer;color:var(--muted);font-weight:600}
.bi-table .ledger{margin-top:8px}
.bi-tip{position:fixed;z-index:40;max-width:280px;background:var(--ink);color:var(--bg);font-size:.82rem;font-weight:500;padding:7px 10px;border-radius:6px;pointer-events:none;box-shadow:0 4px 14px rgba(0,0,0,.18)}
/* ouvriers mois par mois */
.heat-wrap{overflow-x:auto;margin:0 -4px;padding:0 4px}
.heat{border-collapse:separate;border-spacing:3px;min-width:720px}
.heat th,.heat td{padding:0;border:0;white-space:nowrap}
.heat thead th{font-size:.7rem;text-transform:capitalize;letter-spacing:0;text-align:center;color:var(--muted);font-weight:600;padding-bottom:4px;line-height:1.1}
.heat thead th small{font-size:.62rem;font-weight:500}
.heat thead th.now{color:var(--ink)}
.heat thead th:first-child,.heat tbody th,.heat tfoot th{text-align:left;position:sticky;left:0;background:var(--surface);z-index:1;padding-right:10px;min-width:8.5rem}
.heat tbody th,.heat tfoot th{text-transform:none;letter-spacing:0;color:var(--ink);font-weight:600;font-size:.9rem}
.heat tfoot th{font-size:.8rem;color:var(--muted)}
.heat tbody th small{display:block;font-weight:500;color:var(--muted);font-size:.72rem}
.heat td.hm{height:40px;min-width:42px;text-align:center;font-weight:600;font-size:.82rem;border-radius:5px;background:var(--sunk);color:var(--ink);font-variant-numeric:tabular-nums}
.heat{--h-lo:#dbe9fb;--h-hi:#184f95}
.heat td.hm[style]{background:color-mix(in oklab,var(--h-hi) var(--k),var(--h-lo))}
.heat td.hm[data-dark="1"]{color:#fff}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .heat{--h-lo:#1f2d40;--h-hi:#86b6ef}:root:not([data-theme="light"]) .heat td.hm[data-dark="1"]{color:#0b1320}}
:root[data-theme="dark"] .heat{--h-lo:#1f2d40;--h-hi:#86b6ef}:root[data-theme="dark"] .heat td.hm[data-dark="1"]{color:#0b1320}
.heat td.hm.best{box-shadow:inset 0 0 0 2px var(--ink)}
.heat td.num-c{text-align:right;font-weight:600;font-size:.85rem;padding:0 6px;font-variant-numeric:tabular-nums}
.heat tfoot th,.heat tfoot td{font-size:.8rem;color:var(--muted);padding-top:6px;border-top:1px solid var(--line)}
.heat tbody tr{cursor:pointer}
.heat tbody tr:hover th{color:var(--accent)}
/* tendance 12 mois d'un ouvrier */
.trend-sum{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.trend-sum>div{display:flex;flex-direction:column;gap:1px;min-width:0}
.trend-sum b{font-family:var(--f-display);font-size:1.45rem;font-weight:600;line-height:1.1}
.trend-sum small{color:var(--muted);font-size:.78rem}
@media (max-width:640px){.trend-sum{grid-template-columns:1fr 1fr}.trend-sum>div:first-child{grid-column:1/-1}}
.mini-chart{height:170px;position:relative;padding-right:58px}
.mini-chart .cc-val{display:block!important;font-size:.7rem}
.mini-chart .cc.best .cc-stack .seg{box-shadow:inset 0 0 0 2px var(--ink)}
.avg-line{position:absolute;left:0;right:0;border-top:2px dashed var(--muted);opacity:.7;pointer-events:none;z-index:2}
.avg-line em{position:absolute;right:0;top:-9px;font-style:normal;font-size:.68rem;font-weight:600;color:var(--muted);background:var(--surface);padding:0 4px}
.backup-banner{display:flex;flex-direction:row;flex-wrap:wrap;gap:10px;align-items:center;justify-content:space-between}
/* formules */
.plans{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
@media (max-width:640px){.plans{grid-template-columns:1fr 1fr}}
.plan{border:1px solid var(--line);border-radius:8px;padding:10px;display:flex;flex-direction:column;gap:2px;background:var(--surface)}
.plan span{color:var(--muted);font-size:.85rem}
.plan small{color:var(--accent);font-weight:700;font-size:.72rem;text-transform:uppercase;letter-spacing:.06em}
.plan.on{border:2px solid var(--accent);background:var(--accent-soft)}
.plan-usage{display:flex;flex-direction:column;gap:6px}
.plan-notice{display:flex;flex-direction:row;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between}
