/* Planning BMIN – styles */
:root {
  --bg: #eef1f5;
  --card: #ffffff;
  --ink: #1d2533;
  --muted: #6b7280;
  --line: #d4d9e1;
  --grid: #b7b7b7;
  --brand: #1f3a5f;
  --brand-2: #2c5282;
  --accent: #217346;
  --ok: #137333;
  --ko: #c5221f;
  --wait: #b06000;
  --sel: rgba(33, 115, 70, .30);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 13px/1.4 "Segoe UI", Calibri, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); }
h1 { font-size: 18px; margin: 0; min-width: 190px; text-align: center; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 18px 0 6px; }
code { background: #eef; padding: 0 3px; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.err-txt { color: var(--ko); }
.warn-txt { color: var(--ko); font-weight: 600; }

/* ---------- boutons, champs */
.btn { font: inherit; border: 1px solid #c3c9d3; background: #fff; color: var(--ink); padding: 5px 11px; border-radius: 5px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f1f4f8; border-color: #9aa5b4; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--ko); border-color: #e3b4b1; }
.btn.danger.primary { background: var(--ko); color: #fff; }
.btn.ok { color: var(--ok); border-color: #a8d5b5; }
.btn.ko { color: var(--ko); border-color: #e3b4b1; }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn.ghost:hover { background: rgba(255,255,255,.12); }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn.tiny { padding: 0 5px; font-size: 10px; line-height: 16px; }
.btn.big { padding: 9px 18px; font-size: 15px; width: 100%; margin-top: 6px; }
.btn:disabled { opacity: .45; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid #c3c9d3; border-radius: 4px; padding: 4px 6px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #93b4e0; border-color: #6d93c7; }
.fld { display: block; margin: 8px 0; }
.fld > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.fld input:not([type=checkbox]):not([type=color]), .fld select, .fld textarea { width: 100%; }
.fld input[type=time] { width: auto; }
.check { display: block; margin: 6px 0; cursor: pointer; }
label.inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 18px; }
.form-grid .span2 { grid-column: 1 / -1; }
table.offgrid { width: auto; }
table.offgrid th, table.offgrid td { padding: 3px 5px; }
table.offgrid select { font-size: 12px; padding: 2px 3px; }
.palette { margin-top: 4px; line-height: 22px; }
.pal-l { display: inline-block; width: 90px; font-size: 11px; color: var(--muted); }
.sw { display: inline-block; width: 20px; height: 18px; margin: 1px; padding: 0; border: 1px solid rgba(0,0,0,.35); border-radius: 3px; cursor: pointer; vertical-align: middle; }
.sw:hover { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- alertes */
.alert { padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.alert.err { background: #fde8e7; color: #8c1d18; }
.alert.warn { background: #fff4d6; color: #7a4b00; }
.alert.info { background: #e6effa; color: #1f3a5f; }
.banner { display: flex; gap: 10px; align-items: center; padding: 7px 16px; border-bottom: 1px solid var(--line); }
.banner.err { background: #fde8e7; }
.banner.warn { background: #fff4d6; }
.banner.info { background: #e6effa; }
.banner span { flex: 1; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: #333; color: #fff; padding: 9px 14px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.25); max-width: 420px; transition: opacity .4s, transform .4s; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--ko); }
.toast.warn { background: #a35a00; }
.toast.info { background: var(--brand); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- écrans de connexion */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #1f3a5f 0, #2c5282 60%, #eef1f5 60%); }
.card { background: var(--card); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.1); padding: 14px 16px; margin: 10px 12px; }
.card.login { width: 400px; max-width: 100%; padding: 26px 28px; }
.brand-big { font-size: 22px; margin-bottom: 14px; color: var(--brand); }
.steps { padding-left: 20px; }
.steps li { margin: 4px 0; }
.demo-link { margin-top: 18px; text-align: center; }

/* ---------- en-tête */
header.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; padding: 0 14px; height: 46px; background: var(--brand); color: #fff; }
header.top .brand { font-size: 16px; white-space: nowrap; }
.tag { font-size: 11px; background: #f6c343; color: #3a2b00; padding: 1px 6px; border-radius: 8px; vertical-align: middle; }
nav#nav { display: flex; gap: 2px; height: 100%; overflow-x: auto; }
nav#nav a { color: #dbe5f3; text-decoration: none; padding: 0 12px; display: flex; align-items: center; border-bottom: 3px solid transparent; white-space: nowrap; }
nav#nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
nav#nav a.on { color: #fff; border-bottom-color: #f6c343; font-weight: 600; }
.badge { background: #f6c343; color: #3a2b00; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; font-weight: 700; }
.top-right { margin-left: auto; display: flex; gap: 14px; align-items: center; font-size: 12px; white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot.green { background: #4ade80; }
.dot.red { background: #f87171; }
.dot.grey { background: #aaa; }

/* ---------- barre d'outils */
.toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; }
.toolbar.wrap { flex-wrap: wrap; }
.page-planning .toolbar { background: #fff; border-bottom: 1px solid var(--line); }
.hint { font-size: 11px; color: var(--muted); padding: 3px 12px 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 10px; flex-wrap: wrap; }
.tab { font: inherit; border: 1px solid transparent; border-bottom: none; background: none; padding: 6px 12px; cursor: pointer; color: var(--muted); border-radius: 5px 5px 0 0; }
.tab.on { background: #fff; border-color: var(--line); color: var(--ink); font-weight: 600; margin-bottom: -1px; }

/* ---------- grille du planning (aspect Excel) */
.grid-wrap { overflow: auto; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; outline: none; }
.page-planning .grid-wrap { height: calc(100vh - 46px - 47px - 20px - 34px - 46px); min-height: 300px; }
table.plan { border-collapse: separate; border-spacing: 0; font: 11px Calibri, "Segoe UI", Arial, sans-serif; user-select: none; }
table.plan th, table.plan td { border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); padding: 0 2px; background-clip: padding-box; line-height: 15px; }
table.plan thead th { position: sticky; background: #fff; z-index: 3; font-weight: 600; text-align: center; }
table.plan tr.weeks th { top: 0; height: 20px; background: #dde8f6; }
table.plan tr.weeks th.c0 { background: #d9d9d9; font-size: 13px; text-align: left; padding-left: 6px; }
table.plan tr.days th { top: 20px; height: 18px; }
table.plan tr.wdays th { top: 38px; height: 15px; font-size: 9px; font-weight: 400; color: #555; }
table.plan thead th.we { background: #d9d9d9; }
table.plan thead th.today { box-shadow: inset 0 -3px 0 #d93025; }
table.plan .sticky { position: sticky; z-index: 2; background: #fff; }
table.plan thead .sticky { z-index: 5; }
table.plan .c0 { left: 0; min-width: 30px; max-width: 30px; }
table.plan .c1 { left: 30px; min-width: 40px; max-width: 40px; }
table.plan .c2 { left: 70px; min-width: 170px; max-width: 170px; }
table.plan .c3 { left: 240px; min-width: 54px; max-width: 54px; box-shadow: 2px 0 0 #888; }
table.plan td.gr, table.plan td.grade, table.plan td.mat { text-align: center; color: #333; }
table.plan td.nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
table.plan td.nm:not(.sticky) { min-width: 150px; max-width: 150px; }
table.plan .taux { font-weight: 400; color: #666; font-size: 10px; }
table.plan td.roc { min-width: 110px; max-width: 160px; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #444; }
table.plan td.cell { min-width: 34px; max-width: 34px; height: 17px; text-align: center; white-space: nowrap; overflow: hidden; cursor: cell; position: relative; }
table.plan td.cell.long { font-size: 9px; letter-spacing: -.2px; }
table.plan td.cell.we:not([style]) { background: #d9d9d9; }
table.plan td.cell.off { background: repeating-linear-gradient(45deg, #9a9a9a 0 3px, #b5b5b5 3px 6px); cursor: not-allowed; }
table.plan td.cell.today { box-shadow: inset 1px 0 0 #d93025, inset -1px 0 0 #d93025; }
table.plan td.cell.pending { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.75) 0 3px, transparent 3px 7px); font-style: italic; }
table.plan td.cell.note::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 6px 6px 0; border-color: transparent #d93025 transparent transparent; }
table.plan td.cell.sel { box-shadow: inset 0 0 0 100px var(--sel); }
table.plan td.cell.cur { outline: 2px solid var(--accent); outline-offset: -2px; }
table.plan td.cell.flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: inset 0 0 0 100px rgba(255, 165, 0, .75); } 100% { box-shadow: none; } }
table.plan tr.sep td { height: 5px; padding: 0; background: #000; border: none; }
table.plan td.nm.movable { cursor: grab; }
table.plan tr.drop-before td { box-shadow: inset 0 3px 0 var(--accent); }
table.plan tr.drop-after td { box-shadow: inset 0 -3px 0 var(--accent); }
table.plan tr.me td.nm { text-decoration: underline; text-decoration-color: #217346; text-underline-offset: 2px; }
table.plan tr.me td.c0 { box-shadow: inset 4px 0 0 var(--accent); }
table.plan tfoot td { position: sticky; bottom: 0; background: #f3f6fa; text-align: center; font-size: 10px; color: #444; height: 16px; z-index: 2; }
table.plan tfoot tr.staff:first-child td { bottom: 17px; border-top: 2px solid #888; }
table.plan tfoot td.lbl { text-align: right; padding-right: 6px; z-index: 4; font-weight: 600; }
table.plan tfoot td.low { background: #fde8e7; color: var(--ko); font-weight: 700; }
table.plan tfoot td.we { background: #d9d9d9; }
table.plan td.empty { padding: 20px; text-align: center; color: var(--muted); }

.cell-editor { position: absolute; z-index: 20; }
.cell-editor input { height: 22px; font: 12px Calibri, Arial, sans-serif; border: 2px solid var(--accent); border-radius: 0; padding: 0 3px; text-transform: none; }
.ac { background: #fff; border: 1px solid #9aa5b4; box-shadow: 0 6px 18px rgba(0,0,0,.18); min-width: 260px; max-height: 300px; overflow-y: auto; }
.ac-item { padding: 3px 6px; cursor: pointer; white-space: nowrap; }
.ac-item:hover, .ac-item.hi { background: #e6effa; }
.ac-item.dis { opacity: .45; }
.ac-free { padding: 4px 6px; color: var(--muted); font-style: italic; border-top: 1px solid var(--line); }

.chip { display: inline-block; min-width: 26px; padding: 1px 5px; border-radius: 3px; font: 600 11px Calibri, Arial, sans-serif; text-align: center; border: 1px solid rgba(0,0,0,.18); background: #fff; }
.chip.big { font-size: 15px; padding: 4px 12px; }
.chip.pending-demo { background: #00FF00 repeating-linear-gradient(45deg, rgba(255,255,255,.75) 0 3px, transparent 3px 7px); font-style: italic; }
.chip.note-demo { position: relative; background: #C00000; color: #fff; }
.chip.note-demo::after { content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 6px 6px 0; border-color: transparent #ffe000 transparent transparent; }
.dotc { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.2); }

.ctx { position: fixed; z-index: 60; background: #fff; border: 1px solid #9aa5b4; border-radius: 6px; box-shadow: 0 10px 28px rgba(0,0,0,.25); width: 380px; max-height: 90vh; overflow-y: auto; font-size: 12px; }
.ctx-head { padding: 6px 10px; background: #f3f6fa; border-bottom: 1px solid var(--line); font-weight: 600; }
.ctx-codes { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ctx-cat { margin: 3px 0; }
.ctx-cat-l { display: block; font-size: 10px; color: var(--muted); }
.ctx-codes .chip { cursor: pointer; margin: 1px; }
.ctx-codes .chip:hover { outline: 2px solid var(--accent); }
.ctx-codes .chip.dis { opacity: .35; cursor: not-allowed; }
.ctx-items button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 6px 12px; font: inherit; cursor: pointer; }
.ctx-items button:hover { background: #e6effa; }

.sheet-tabs { display: flex; gap: 0; background: #e3e7ee; padding: 0 8px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.sheet-tabs .tab { border: 1px solid transparent; border-top: none; border-radius: 0 0 5px 5px; padding: 5px 12px; font-size: 12px; }
.sheet-tabs .tab.on { background: #fff; color: var(--accent); border-color: var(--line); font-weight: 700; margin: 0; box-shadow: inset 0 -2px 0 var(--accent); }
.sheet-tabs .tab.yr { color: var(--brand-2); font-weight: 600; }
.legend { background: #fff; padding: 6px 12px; font-size: 12px; }
.legend summary { cursor: pointer; color: var(--muted); }
.leg-cat { margin: 4px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.leg-title { min-width: 210px; font-weight: 600; border-left: 4px solid #ccc; padding-left: 6px; }
.leg-lbl { margin-right: 10px; color: #444; }

/* ---------- horaire souple */
.hs-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.hs-dayname { font-weight: 600; display: inline-block; }
.hs-dayname::first-letter { text-transform: uppercase; }
.hs-form { max-width: 820px; }
.hs-plan { margin-bottom: 8px; }
.hs-grid { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0; }
.hs-block { background: #f6f8fb; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.hs-block.off { opacity: .55; }
.hs-block.total { min-width: 110px; text-align: center; }
.hs-block.total b { font-size: 18px; }
.hs-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 3px; }
.hs-status { margin: 10px 0; }
.hs-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.hs-actions.left { justify-content: flex-start; }
.st { font-weight: 700; }
.st.ok { color: var(--ok); }
.st.ko { color: var(--ko); }
.st.wait { color: var(--wait); }
.late { color: #a35a00; font-size: 11px; margin-left: 3px; }
.hs-wrap { max-height: 70vh; border: 1px solid var(--line); }
table.hs-table { border-collapse: separate; border-spacing: 0; font: 12px Calibri, "Segoe UI", Arial, sans-serif; }
table.hs-table th, table.hs-table td { border-right: 1px solid var(--grid); border-bottom: 1px solid var(--grid); padding: 2px 5px; white-space: nowrap; text-align: center; }
table.hs-table thead th { position: sticky; top: 0; background: #ffc000; z-index: 3; }
table.hs-table thead tr + tr th { top: 22px; background: #fbe3a6; font-weight: 400; font-size: 11px; }
table.hs-table th.day { text-transform: capitalize; height: 22px; }
table.hs-table th.day.today { box-shadow: inset 0 -3px 0 #d93025; }
table.hs-table th.day.cur { outline: 2px solid var(--accent); outline-offset: -2px; }
table.hs-table .sticky { position: sticky; background: #fff; z-index: 2; text-align: left; }
table.hs-table thead .sticky { z-index: 5; background: #ffc000; }
table.hs-table .c0 { left: 0; min-width: 34px; }
table.hs-table .c1 { left: 34px; min-width: 170px; box-shadow: 2px 0 0 #888; }
table.hs-table tr.odd td { background: #f3f7fc; }
table.hs-table tr.odd td.sticky { background: #f3f7fc; }
table.hs-table tr.me td.nm { font-weight: 700; }
table.hs-table tr.sep td { height: 5px; padding: 0; background: #000; }
table.hs-table td.clickable { cursor: pointer; }
table.hs-table td.clickable:hover { background: #e6effa; }
table.hs-table td.focus { box-shadow: inset 0 0 0 2px var(--accent); }
table.hs-table td.na { color: var(--muted); }
table.hs-table td.missing.late-miss { background: #fdecea; color: var(--ko); font-size: 11px; }
table.hs-table td.off { background: repeating-linear-gradient(45deg, #ccc 0 3px, #ddd 3px 6px); }
table.hs-table td.tot { font-weight: 600; background: #f2f2f2; }
table.hs-table td.copp { min-width: 30px; }

/* ---------- listes */
table.list { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.list th { text-align: left; background: #f3f6fa; border-bottom: 2px solid var(--line); padding: 5px 7px; font-weight: 600; position: sticky; top: 0; }
table.list td { border-bottom: 1px solid #e6e9ee; padding: 4px 7px; vertical-align: middle; }
table.list tr:hover td { background: #fafbfd; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list td.t { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list td.actions { white-space: nowrap; text-align: right; }
table.list td.actions .btn { margin-left: 3px; }
table.list tfoot td { border-top: 2px solid var(--line); font-weight: 600; }
table.list tr.inactive td { color: #999; }
table.list td.empty { text-align: center; color: var(--muted); padding: 16px; }
table.v-list tr.st-valide td { background: #f0faf3; }
table.v-list tr.st-refuse td { background: #fdf0ef; }
table.v-list tr.missing-row td { background: #fff8e6; }
table.journal td { vertical-align: top; }
table.journal tr.k-loginFail td { background: #fdf0ef; }
table.journal tr.k-login td, table.journal tr.k-logout td { color: var(--muted); }
ul.jd { margin: 4px 0 0; padding-left: 18px; font-size: 12px; }
.before { color: #8c1d18; text-decoration: line-through; text-decoration-color: rgba(140,29,24,.4); }
.after { color: var(--ok); }
.matrix th { white-space: nowrap; }
.mx { max-height: 70vh; }
.mx .sticky { position: sticky; left: 0; background: #fff; z-index: 2; }
.rights-box { columns: 2; column-gap: 20px; }
ul.rights { padding-left: 18px; }

/* ---------- fenêtres */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 8px; width: 460px; max-width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal.wide { width: 820px; }
.modal-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { flex: 1; }
.modal-head .x { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 10px 16px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 8px 8px; flex-wrap: wrap; }

/* ---------- petits écrans */
@media (max-width: 800px) {
  header.top { height: auto; flex-wrap: wrap; padding: 6px 10px; gap: 6px; }
  nav#nav { order: 3; width: 100%; height: 36px; }
  .top-right { font-size: 11px; }
  .page-planning .grid-wrap { height: 70vh; }
  .card { margin: 8px 4px; }
}

/* ---------- impression : A3 paysage, comme le fichier Excel */
@media print {
  @page { size: A3 landscape; margin: 8mm; }
  body { background: #fff; }
  header.top, #banners, .toolbar, .hint, .sheet-tabs, #toasts, .cell-editor, .ctx, .hs-card, .hs-head .btn { display: none !important; }
  .grid-wrap { height: auto !important; max-height: none !important; overflow: visible !important; border: none; }
  table.plan .sticky, table.plan thead th, table.plan tfoot td { position: static !important; }
  table.plan td.cell.sel { box-shadow: none; }
  table.plan td.cell.cur { outline: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .legend { page-break-inside: avoid; }
  .card { box-shadow: none; margin: 0; }
}

/* ---------- version téléphone */
.mb { padding-bottom: 64px; }
.mb-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgba(0,0,0,.06); padding-bottom: env(safe-area-inset-bottom); }
.mb-tabs button { flex: 1; border: none; background: none; padding: 10px 2px 12px; font: 600 12px "Segoe UI", Arial, sans-serif; color: var(--muted); border-top: 3px solid transparent; }
.mb-tabs button.on { color: var(--brand); border-top-color: #f6c343; }
.mb-nav { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 46px; z-index: 5; }
.mb-nav .btn { min-width: 40px; padding: 6px 10px; }
.mb-date { flex: 1; text-align: center; font-weight: 600; }
.mb-date::first-letter { text-transform: uppercase; }
.mb-list { background: #fff; }
.mb-row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid #edf0f4; min-height: 44px; flex-wrap: wrap; width: 100%; text-align: left; font: inherit; background: #fff; border-left: none; border-right: none; border-top: none; color: inherit; text-decoration: none; }
.mb-row.tap { cursor: pointer; }
.mb-row.tap:active { background: #e6effa; }
.mb-row.me { background: #f0faf3; }
.mb-row.today { box-shadow: inset 4px 0 0 #d93025; }
.mb-row.we { background: #eeeeee; color: #777; }
.mb-name { flex: 1 1 140px; font-weight: 600; }
.mb-name small { font-weight: 400; color: var(--muted); }
.mb-codes { display: flex; gap: 3px; align-items: center; }
.mb-codes .chip { min-width: 34px; padding: 3px 6px; font-size: 12px; }
.mb-sl { color: #aaa; }
.mb-off { font-size: 11px; color: #777; background: #e3e3e3; border-radius: 3px; padding: 2px 5px; }
.mb-empty { color: #bbb; }
.mb-hs { flex-basis: 100%; font-size: 12px; color: #444; padding-left: 2px; }
.mb-sep { height: 4px; background: #1d2533; }
.mb-hint { padding: 8px 12px; }
.mb-card { margin: 8px; }
.mb-card.st-valide { border-left: 4px solid var(--ok); }
.mb-card.st-refuse { border-left: 4px solid var(--ko); }
.mb-card.st-attente { border-left: 4px solid var(--wait); }
.mb-hsline { margin: 4px 0; }
.mb-actions { display: flex; gap: 8px; margin-top: 6px; }
.mb-actions .btn { flex: 1; padding: 9px; }
.mb-link { font-weight: 600; color: var(--brand); }
.mb-link.danger { color: var(--ko); }
.modal.sheet .seg { display: flex; border: 1px solid var(--brand); border-radius: 6px; overflow: hidden; margin-bottom: 8px; }
.modal.sheet .seg button { flex: 1; border: none; background: #fff; padding: 8px; font: inherit; color: var(--brand); }
.modal.sheet .seg button.on { background: var(--brand); color: #fff; }
.mb-cat { font-size: 11px; color: var(--muted); margin: 8px 0 3px; }
.mb-codes-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.mb-codes-grid .chip.big { min-width: 54px; padding: 8px 6px; font-size: 14px; cursor: pointer; }
.mb-codes-grid .chip.dis { opacity: .3; }
.mb-current { margin-bottom: 4px; font-size: 13px; }
.mb-free { display: flex; gap: 6px; margin-top: 12px; }
.mb-free input { flex: 1; }
.code-big { font: 700 30px Consolas, monospace; letter-spacing: 3px; text-align: center; background: #f3f6fa; border: 2px dashed var(--brand); border-radius: 8px; padding: 14px; }

@media (max-width: 760px) {
  body { font-size: 15px; }
  header.top { flex-wrap: nowrap; height: 46px; padding: 0 10px; }
  body.on-mobile-page header.top nav#nav { display: none; }
  header.top nav#nav { position: fixed; top: 46px; left: 0; right: 0; height: 38px; background: var(--brand-2); z-index: 29; }
  body:not(.on-mobile-page) #page { margin-top: 38px; }
  .top-right #sync { display: none; }
  .page-mobile { padding: 0; }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { width: 100% !important; border-radius: 12px 12px 0 0; max-height: 92vh; display: flex; flex-direction: column; }
  .modal-body { max-height: none; flex: 1; overflow-y: auto; }
  .hs-grid { gap: 8px; }
  .hs-block { flex: 1 1 140px; }
  .hs-block select, .hs-block input { font-size: 16px; padding: 6px; }
  .fld input, .fld select, .fld textarea { font-size: 16px; }
  .hs-actions .btn { flex: 1; padding: 10px; }
  .card { margin: 8px 6px; padding: 12px; }
  .toolbar { flex-wrap: wrap; }
  #toasts { left: 10px; right: 10px; bottom: 74px; }
  .toast { max-width: none; }
}

/* ---------- historique des groupes, e-mail */
.group-box { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 8px 0; background: #f8fafc; }
.group-box table.gh { width: auto; margin: 6px 0; }
.group-box table.gh td { padding: 2px 10px 2px 0; border: none; }
.gh-new { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.gh-new .check { margin: 0 0 0 8px; }
.row-inline { display: flex; gap: 6px; }
.row-inline input { flex: 1; }
