/* Application mobile : complète app.css (mêmes couleurs, thèmes clair / sombre). */
body.m {
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  --tabs-h: calc(58px + env(safe-area-inset-bottom));
}
body.m .gate { padding: max(24px, env(safe-area-inset-top)) 16px 24px; align-items: start; }
body.m .gate-card { padding: 24px 20px; margin-top: 6vh; }
body.m .input, body.m select.input, body.m textarea.input { min-height: 44px; font-size: 16px; }   /* 16 px : pas de zoom automatique sur iPhone */
body.m .btn { min-height: 40px; padding: 8px 14px; font-size: 14px; }
body.m a.btn { text-decoration: none; color: var(--ink); }
body.m .btn.small { min-height: 34px; padding: 5px 10px; font-size: 13px; }
body.m .btn.m-block { width: 100%; justify-content: center; min-height: 48px; font-size: 15px; }
body.m .icon-btn { min-width: 40px; min-height: 40px; }
body.m .icon-btn svg { width: 20px; height: 20px; }
body.m .field { margin-bottom: 12px; }

/* --- coque --- */
.m-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.m-top {
  display: flex; align-items: center; gap: 6px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; min-height: 56px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex: none;
}
.m-back { font-size: 30px; line-height: 1; color: var(--ink); margin-left: -6px; }
.m-titles { flex: 1; min-width: 0; }
.m-titles h1 { margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-titles p { margin: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-titles p:empty { display: none; }
.m-sync { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 6px; cursor: pointer; flex: none; }
.m-actions { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; flex: none; border-bottom: 1px solid var(--line); background: var(--bg); }
.m-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px calc(24px + var(--tabs-h)); }
body.m .offline-banner { padding: 7px 12px; font-size: 12.5px; flex: none; }

.m-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); height: var(--tabs-h);
}
.m-tab { flex: 1; border: 0; background: none; color: var(--faint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; position: relative; cursor: pointer; }
.m-tab svg { width: 24px; height: 24px; }
.m-tab.on { color: var(--brand-text); }
.m-tab .badge.count { position: absolute; top: 5px; left: calc(50% + 6px); font-size: 10px; padding: 0 5px; }

/* --- listes --- */
.m-search { margin-bottom: 10px; }
.m-chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.m-chips::-webkit-scrollbar, .m-actions::-webkit-scrollbar { display: none; }
.m-chip { flex: none; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--muted); border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.m-chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--ink); }
.m-list { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.m-list:empty { display: none; }
.m-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; color: inherit; min-height: 58px; }
button.m-row { cursor: pointer; }
button.m-row:active { background: var(--panel-2); }
.m-row:last-child { border-bottom: 0; }
.m-row > svg { color: var(--muted); width: 20px; height: 20px; }
.m-row-main { flex: 1; min-width: 0; }
.m-row-main .faint { font-size: 13px; }
.m-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sep { padding: 14px 14px 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); background: var(--bg); border-bottom: 1px solid var(--line); }
.m-list > .m-sep:first-child { padding-top: 10px; }
.m-more { padding: 12px; text-align: center; font-size: 13px; }
.m-date { width: 44px; flex: none; text-align: center; background: var(--brand-soft); border-radius: 10px; padding: 5px 0; line-height: 1.1; }
.m-date b { display: block; font-size: 18px; color: var(--brand-text); }
.m-date span { font-size: 11px; color: var(--muted); }
.m-fab { position: fixed; right: 18px; bottom: calc(var(--tabs-h) + 16px); width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; box-shadow: var(--shadow); display: grid; place-items: center; z-index: 20; cursor: pointer; }
.m-fab svg { width: 26px; height: 26px; stroke-width: 2.2; }

/* --- fiche contact --- */
.m-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.m-quick:empty { display: none; }
.m-q { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; }
.m-q svg { width: 22px; height: 22px; color: var(--brand-text); }
.m-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
body.m .props { grid-template-columns: 110px 1fr; font-size: 14px; }
body.m .card { padding: 14px; }
body.m .card + .card, body.m .card + .grid, body.m .grid + .card { margin-top: 12px; }
body.m .card-head { flex-wrap: wrap; }

/* --- justificatifs --- */
.m-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.m-thumbs:empty { display: none; }
.m-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--panel-3); display: grid; place-items: center; font-size: 11px; padding: 4px; text-align: center; }
.m-thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.m-thumb .icon-btn { position: absolute; top: 2px; right: 2px; background: rgba(0, 0, 0, .55); color: #fff; min-width: 28px; min-height: 28px; padding: 2px; }

/* --- coffre --- */
.m-secret { display: flex; flex-direction: column; }
.m-secret-row { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.m-secret-row:last-child { border-bottom: 0; }
.m-secret-val { overflow-wrap: anywhere; font-size: 15px; }

/* --- preuve de présence (pointage) --- */
.m-proof { display: flex; flex-direction: column; gap: 10px; }
.m-scan { position: relative; max-width: 420px; margin: 0 auto; }
.m-scan-frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); pointer-events: none; }

/* --- modules repris du logiciel --- */
body.m .grid { grid-template-columns: minmax(0, 1fr) !important; }
body.m .pt-clock { font-size: 52px; text-align: center; }
body.m .pt-actions .btn { min-height: 56px; font-size: 17px; }
body.m .pt-sum { justify-content: center; }
body.m .seg { display: flex; }
.m-actions > .seg { flex: 1; }
body.m .seg button { flex: 1; padding: 9px 10px; }
body.m .table-wrap { -webkit-overflow-scrolling: touch; }
body.m .pt-week td:last-child { min-width: 180px; }
body.m .pt-now { grid-template-columns: 1fr; }

/* messagerie : conversation plein écran, la liste des canaux est un écran à part */
body.m .chat { display: flex; flex-direction: column; height: calc(100dvh - 56px - var(--tabs-h) - env(safe-area-inset-top) - 24px); border-radius: var(--radius); }
body.m .chat-side, body.m .chat-head { display: none; }
body.m .chat-main { flex: 1; min-height: 0; }
body.m .chat-log { padding: 12px; }
body.m .chat-input { padding: 8px; }
body.m .chat-input textarea { font-size: 16px; }
body.m .msg { grid-template-columns: 28px 1fr; gap: 8px; }
body.m .msg .avatar { width: 28px; height: 28px; font-size: 11px; }

/* fenêtres : feuille plein écran sur téléphone */
@media (max-width: 700px) {
  body.m .modal-host { padding: 0; place-items: end stretch; }
  body.m .modal, body.m .modal.small, body.m .modal.large { width: 100%; max-height: 94dvh; border-radius: 16px 16px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  body.m .modal-body { padding: 14px 16px; }
  body.m .modal-head { padding: 14px 16px; }
  body.m .modal-foot { padding: 10px 16px; flex-wrap: wrap; }
  body.m .modal-foot .btn { flex: 1; justify-content: center; }
  body.m .modal-foot .left { flex-basis: 100%; margin: 0; }
  body.m .form-grid { grid-template-columns: minmax(0, 1fr); }
  body.m .toasts { left: 12px; right: 12px; bottom: calc(var(--tabs-h) + 12px); }
  body.m .toast { max-width: none; }
}
