/* Charge Support — interface mobile. Colonne unique centrée, onglets en bas, feuilles qui glissent du bas. */
:root {
  --bg: #FFFFFF; --page: #F3F6FA; --card: #F5F8FC; --line: #E7ECF3; --line2: #D6DEE8;
  --ink: #1B2433; --sub: #667085; --mute: #98A2B3;
  --b50: #EAF3FC; --b100: #C9E0F7; --b200: #9CC5EE; --b400: #4A90DD; --b600: #1F64AE; --b800: #0F426F; --b900: #082B4B;
  --p50: #FCEEF3; --p100: #F7CFDD; --p200: #EFA2BD; --p400: #D9628C; --p600: #A23D63; --p800: #772A47; --p900: #4E1A2E;
  --ok-bg: #EAF3FC; --ok-fg: #0F426F; --bad-bg: #FCEEF3; --bad-fg: #772A47;
  --me50: var(--p50); --me100: var(--p100); --me200: var(--p200); --me400: var(--p400); --me600: var(--p600); --me900: var(--p900);
  --ot50: var(--b50); --ot100: var(--b100); --ot200: var(--b200); --ot400: var(--b400); --ot600: var(--b600); --ot900: var(--b900);
  --font: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 18px; --tab-h: 64px;
  color-scheme: light;
}
.swap {
  --me50: var(--b50); --me100: var(--b100); --me200: var(--b200); --me400: var(--b400); --me600: var(--b600); --me900: var(--b900);
  --ot50: var(--p50); --ot100: var(--p100); --ot200: var(--p200); --ot400: var(--p400); --ot600: var(--p600); --ot900: var(--p900);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--b400); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--sub); } .tiny { font-size: 12px; color: var(--mute); }
[hidden] { display: none !important; }

/* Colonne de l'appli */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; background: var(--bg); position: relative;
  padding: 0 max(16px, env(safe-area-inset-right)) calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
@media (min-width: 760px) {
  html, body { background: var(--page); }
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
.top { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-left))); padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; }
.brand svg { flex: none; }
.top-actions { display: flex; gap: 4px; }
.ib { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--sub); }
.ib:active { background: var(--card); }
main { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; animation: fade .22s ease; }
@keyframes fade { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.spin { animation: spin 1.1s linear infinite; transform-origin: 50% 50%; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { main, .sh, .toast { animation: none !important; transition: none !important; } }

/* Barre d'onglets */
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: grid; grid-template-columns: repeat(6, 1fr); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 700; color: var(--mute); border-radius: 14px; }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--b600); }
.tab.on .tab-ic { background: var(--b50); }
.tab-ic { width: 44px; height: 28px; border-radius: 14px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.fab { position: fixed; z-index: 31; right: max(18px, calc(50vw - 262px)); bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 20px; background: var(--b600); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(31,100,174,.32); }
.fab:active { transform: scale(.95); }

/* Blocs */
.hello { padding-top: 4px; }
.card { background: var(--card); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card.white { background: var(--bg); border: 1px solid var(--line); }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sec { font-size: 15px; margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--card); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; text-align: left; }
.kpi .lbl { font-size: 12px; color: var(--sub); font-weight: 700; }
.kpi b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi b small { font-size: 13px; color: var(--mute); font-weight: 700; }
.kpi.me { background: var(--me50); } .kpi.me .lbl { color: var(--me600); } .kpi.me b { color: var(--me900); }
.kpi.ot { background: var(--ot50); } .kpi.ot .lbl { color: var(--ot600); } .kpi.ot b { color: var(--ot900); }
.mini { height: 6px; border-radius: 3px; background: rgba(0,0,0,.06); overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--me200); border-radius: 3px; }
.hero { text-align: left; width: 100%; background: var(--b50); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.hero .lbl { color: var(--b600); font-weight: 700; font-size: 13px; }
.hero .big { color: var(--b900); font-size: 32px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hero .s { color: var(--b600); font-size: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hero.neg { background: var(--p50); } .hero.neg .lbl, .hero.neg .s { color: var(--p600); } .hero.neg .big { color: var(--p900); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; width: fit-content; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); } .pill.bad { background: var(--bad-bg); color: var(--bad-fg); } .pill.n { background: #EEF1F5; color: var(--sub); }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #EEF1F5; }
.stack i { display: block; height: 100%; transition: width .3s; } .stack .me { background: var(--me200); } .stack .ot { background: var(--ot200); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--sub); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.dot.me { background: var(--me200); } .dot.ot { background: var(--ot200); } .dot.pen { background: var(--b600); border-radius: 50%; } .dot.out { background: var(--p400); border-radius: 50%; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; font-weight: 800; font-size: 13.5px; min-height: 86px; }
.tile .ti-ic { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.tile:active, .hero:active, .kpi:active { transform: scale(.98); }
.ic-b { background: var(--b50); color: var(--b600); } .ic-p { background: var(--p50); color: var(--p600); }
.banner { background: var(--p50); color: var(--p800); border-radius: 14px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; }
.link { color: var(--b600); font-weight: 800; font-size: 13px; }
.msw { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 14px; padding: 4px; }
.msw span { font-weight: 800; font-size: 15px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { padding: 9px; border-radius: 11px; font-weight: 800; font-size: 14px; color: var(--sub); }
.seg button.on { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.empty { text-align: center; color: var(--sub); padding: 22px 12px; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* Listes */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); text-align: left; width: 100%; }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t1 { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t2 { font-size: 12px; color: var(--sub); }
.li .amt { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.li.done .t1, .li.done .amt { color: var(--mute); text-decoration: line-through; }
.cat-dot { width: 36px; height: 36px; border-radius: 12px; flex: none; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.dd { width: 42px; flex: none; text-align: center; border-radius: 12px; padding: 5px 0; font-size: 11px; line-height: 1.2; font-weight: 700; }
.dd b { display: block; font-size: 16px; font-weight: 800; }
.bar { height: 7px; border-radius: 4px; background: #EBEFF5; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }

/* Cases à cocher */
.cb { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line2); background: var(--bg); display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: all .15s; flex: none; }
.cb svg { width: 16px; height: 16px; stroke-width: 3; }
.cb.on { color: #fff; transform: scale(1.02); }
.cb.me.on { background: var(--me400); border-color: var(--me400); }
.cb.ot.on { background: var(--ot400); border-color: var(--ot400); }
.cb.pen.on { background: var(--b600); border-color: var(--b600); }
.cb.out.on { background: var(--p400); border-color: var(--p400); }
.cb.neu.on { background: var(--b600); border-color: var(--b600); }
.cb:active { transform: scale(.9); }

/* Garde */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; scroll-snap-align: center; min-width: 58px; border: 1px solid var(--line); border-radius: 14px; padding: 6px 8px; text-align: center; font-weight: 800; font-size: 13px; color: var(--ink); background: var(--bg); }
.chip small { display: block; font-size: 11px; color: var(--mute); font-weight: 700; }
.chip.on { background: var(--b50); border-color: var(--b200); color: var(--b800); }
.chip.on small { color: var(--b600); }
.chip.full small { color: var(--b600); }
.wk { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 11px; font-weight: 800; color: var(--mute); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cd { aspect-ratio: 1; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; background: #F1F4F8; color: var(--mute); position: relative; }
.cd.g-m { background: var(--me100); color: var(--me900); }
.cd.g-a { background: var(--ot100); color: var(--ot900); }
.cd.today { box-shadow: inset 0 0 0 2px var(--b600); }
.cd i { display: flex; gap: 2px; height: 5px; margin-top: 2px; }
.cd i b { width: 5px; height: 5px; border-radius: 50%; }
.cd .dp { background: var(--b600); } .cd .ds { background: var(--p400); }
.dhead, .drow { display: grid; grid-template-columns: 50px repeat(4, minmax(0, 1fr)) 58px; align-items: center; gap: 2px; }
.dhead { font-size: 11px; font-weight: 800; color: var(--sub); text-align: center; padding: 6px 0; position: sticky; top: calc(60px + env(safe-area-inset-top)); background: var(--bg); z-index: 5; border-bottom: 1px solid var(--line); }
.drow { padding: 6px 0; border-bottom: 1px solid var(--line); justify-items: center; border-radius: 12px; }
.drow.g-m { background: var(--me50); } .drow.g-a { background: var(--ot50); }
.dlab { justify-self: stretch; text-align: center; line-height: 1.1; padding: 2px 0; }
.dlab b { display: block; font-size: 16px; font-weight: 800; }
.dlab small { font-size: 11px; color: var(--sub); font-weight: 700; }
.drow.we .dlab small { color: var(--p400); }
.dtime { font-size: 12.5px; font-weight: 800; color: var(--sub); padding: 6px 4px; border-radius: 9px; font-variant-numeric: tabular-nums; }
.dtime.set { color: var(--ink); background: rgba(255,255,255,.7); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 14px; font-weight: 800; font-size: 14.5px; }
.btn.pri { background: var(--b600); color: #fff; } .btn.pri:active { background: var(--b800); }
.btn.soft { background: var(--b50); color: var(--b600); }
.btn.pink { background: var(--p50); color: var(--p800); }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.danger { background: var(--p50); color: var(--p600); }
.btn.block { width: 100%; }
.row-btns { display: flex; gap: 8px; } .row-btns .btn { flex: 1; }

/* Feuilles du bas */
#sheet { position: fixed; inset: 0; z-index: 50; }
.sh-bg { position: absolute; inset: 0; background: rgba(16,24,40,.32); opacity: 0; transition: opacity .2s; }
#sheet.open .sh-bg { opacity: 1; }
.sh { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border-radius: 26px 26px 0 0; padding: 8px max(18px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; gap: 14px; }
#sheet.open .sh { transform: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line2); margin: 0 auto 4px; flex: none; }
.sh-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span { font-size: 12.5px; font-weight: 800; color: var(--sub); }
.inp { width: 100%; border: 1.5px solid var(--line2); border-radius: 14px; padding: 12px 14px; background: var(--bg); font-size: 16px; font-weight: 700; }
.inp:focus { outline: none; border-color: var(--b400); box-shadow: 0 0 0 3px var(--b50); }
textarea.inp { min-height: 76px; resize: vertical; font-weight: 600; }
.big-amt { font-size: 30px; font-weight: 800; text-align: center; padding: 14px; font-variant-numeric: tabular-nums; }
.err { color: var(--p600); font-size: 13px; font-weight: 700; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--card); border-radius: 14px; font-weight: 800; font-size: 14.5px; width: 100%; text-align: left; }
.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segb { padding: 14px 10px; border-radius: 16px; border: 2px solid var(--line); font-weight: 800; font-size: 14.5px; color: var(--sub); }
.segb.me.on { background: var(--me50); border-color: var(--me200); color: var(--me900); }
.segb.ot.on { background: var(--ot50); border-color: var(--ot200); color: var(--ot900); }
.catgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.catb { padding: 10px; border-radius: 12px; border: 1.5px solid var(--line); font-weight: 800; font-size: 13px; text-align: left; display: flex; align-items: center; gap: 8px; }
.catb.on { border-color: var(--b400); background: var(--b50); color: var(--b800); }
.catb i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--tab-h) + 26px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 14px; font-weight: 800; font-size: 13.5px; animation: toast 2.2s ease forwards; white-space: nowrap; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 8px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* Graphiques */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 10px; font-weight: 700; fill: var(--mute); }
.donut-wrap { display: flex; align-items: center; gap: 14px; }
.donut-wrap .legend { flex-direction: column; gap: 4px; }
.heat { display: grid; gap: 3px; }
.heat-row { display: grid; grid-template-columns: 22px repeat(31, 1fr); gap: 1.5px; align-items: center; }
.heat-row span { height: 8px; border-radius: 2px; }
.heat-row em { font-style: normal; font-size: 10px; font-weight: 800; color: var(--mute); }

/* Réglages */
.set-group { display: flex; flex-direction: column; gap: 10px; }
.set-group h2 { font-size: 13px; color: var(--sub); text-transform: uppercase; letter-spacing: .06em; }
.range { width: 100%; accent-color: var(--b600); }

/* Activation */
.gate { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: calc(24px + env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left)); max-width: 460px; margin: 0 auto; }
.gate .logo { width: 72px; height: 72px; border-radius: 22px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.gate h1 { font-size: 26px; }

/* Rapport */
.doc { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; font-size: 12.5px; }
.doc h2 { font-size: 16px; } .doc h3 { font-size: 13px; margin-top: 4px; }
.doc table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.doc th, .doc td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { font-size: 11px; color: var(--sub); text-transform: uppercase; letter-spacing: .04em; }
.doc td.c, .doc th.c { text-align: center; } .doc td.r, .doc th.r { text-align: right; }
.doc .kv td:first-child { color: var(--sub); width: 42%; }
.tbl-wrap { overflow-x: auto; }

@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }
  .top, .tabbar, .fab, .noprint, #sheet, .toast { display: none !important; }
  .app { max-width: none; padding: 0; border: 0; }
  main { animation: none; gap: 0; }
  .doc { border: 0; padding: 0; font-size: 11px; }
  .doc tr { break-inside: avoid; }
}
