/* ============================================================================
 *  niro-mobile.css — v1 — [ROUGE 2026-11-16] OPTIMISATIONS TÉLÉPHONE / TABLETTE
 *  Toutes les règles commencent par html.nm-mobile : cette classe n'est posée
 *  par niro-mobile.js que sur téléphone / tablette. AUCUN EFFET SUR PC.
 * ==========================================================================*/

/* ── 1. iOS : plus de zoom automatique en touchant un champ (texte ≥ 16 px) ── */
html.nm-mobile input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]),
html.nm-mobile select,
html.nm-mobile textarea{font-size:16px!important;}

/* ── 2. Listes (Devis, Factures, BL, BC, Avoirs…) : filtres et en-têtes sur plusieurs lignes ── */
html.nm-mobile.nm-narrow main.overflow-auto{overflow-x:hidden!important;}
html.nm-mobile.nm-narrow main .flex:has(> select),
html.nm-mobile.nm-narrow main .flex:has(> div > select),
html.nm-mobile.nm-narrow main .flex:has(> input[type=text]),
html.nm-mobile.nm-narrow main .flex:has(> input[type=search]){flex-wrap:wrap!important;row-gap:8px!important;}
html.nm-mobile.nm-narrow main .flex:has(> select) > select,
html.nm-mobile.nm-narrow main .flex:has(> select) > div{flex:1 1 140px;min-width:0;max-width:100%;}
html.nm-mobile.nm-narrow main .flex.items-center.justify-between:has(> div > h1),
html.nm-mobile.nm-narrow main .flex.items-center.justify-between:has(> h1){flex-wrap:wrap!important;gap:10px!important;}
html.nm-mobile.nm-narrow main .flex.items-center.justify-between:has(> div > h1) > div:not(:has(> h1)){flex-wrap:wrap;gap:8px;}
html.nm-mobile.nm-narrow main .flex.items-center.justify-between:has(> div > h1) button{white-space:nowrap;}
/* Graphiques larges : défilement dans leur carte, jamais de la page entière. */
html.nm-mobile.nm-narrow main .recharts-wrapper{max-width:100%;overflow-x:auto;overflow-y:hidden;}

/* ── 3. Fiches (tableaux affichés en cartes) ── */
html.nm-mobile table.gc-cardify tbody tr>td{max-width:none!important;overflow:visible!important;text-overflow:clip!important;white-space:normal!important;overflow-wrap:anywhere;}
html.nm-mobile table.gc-cardify tbody tr>td.nm-long{display:block!important;text-align:left!important;}
html.nm-mobile table.gc-cardify tbody tr>td.nm-long::before{display:block!important;margin-bottom:4px;}

/* ── 4. Lignes de saisie des documents (Article, Qté, P.U. HT, TVA, Total) ── */
html.nm-mobile table.nm-lines{display:block!important;width:100%!important;min-width:0!important;}
html.nm-mobile table.nm-lines thead{display:none!important;}
html.nm-mobile table.nm-lines tbody{display:block!important;}
html.nm-mobile table.nm-lines tbody>tr.nm-line{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px 10px;padding:12px 12px 14px!important;border-top:1px solid var(--border,#e5e7eb);}
html.nm-mobile table.nm-lines tbody>tr.nm-line:first-child{border-top:0;}
html.nm-mobile table.nm-lines tbody>tr.nm-empty{display:block!important;}
html.nm-mobile table.nm-lines tbody>tr.nm-empty>td{display:block!important;text-align:center!important;padding:14px!important;}
html.nm-mobile table.nm-lines tr.nm-line>td{display:block!important;padding:0!important;border:0!important;background:transparent!important;min-width:0!important;width:auto!important;max-width:none!important;text-align:left!important;}
html.nm-mobile table.nm-lines tr.nm-line>td::before{content:attr(data-nm-label);display:block;font-size:11px;font-weight:600;color:var(--muted-foreground,#64748b);margin:0 0 3px;line-height:1.2;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-num{grid-column:1/4;grid-row:1;align-self:center;font-weight:700;color:var(--foreground,#0f172a);}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-num::before{content:'Ligne';display:inline;margin-right:6px;font-size:12px;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-del{grid-column:4;grid-row:1;justify-self:end;align-self:center;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-del::before{display:none;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-del button{min-width:40px;min-height:40px;display:inline-flex;align-items:center;justify-content:center;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-art,
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-oth{grid-column:1/-1;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-tot{grid-column:span 2;}
html.nm-mobile table.nm-lines tr.nm-line:not(:has(> td.nm-c-num))>td.nm-c-del{grid-row:auto;grid-column:4;align-self:end;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-qty{grid-column:1/2;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-pu{grid-column:2/4;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-tva,
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-rem,
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-unit{grid-column:span 1;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-art textarea{min-height:76px!important;width:100%!important;}
html.nm-mobile table.nm-lines tr.nm-line>td input,
html.nm-mobile table.nm-lines tr.nm-line>td select{width:100%!important;min-height:42px;}
html.nm-mobile table.nm-lines tr.nm-line>td.nm-c-tot input{font-weight:700;}
html.nm-mobile table.nm-lines .gc-dl-hint{display:block;font-size:11px;line-height:1.4;margin-top:4px;}
html.nm-mobile .gc-scroll-x:has(> table.nm-lines),
html.nm-mobile .table-wrap:has(> table.nm-lines),
html.nm-mobile .overflow-x-auto:has(> table.nm-lines){overflow:visible!important;}

/* ── 5. Fenêtre ouverte : ☰ et Assistant ne recouvrent plus l'en-tête ni « Enregistrer » ── */
html.nm-mobile.nm-modal #gc-ham9,
html.nm-mobile.nm-modal #niro-fab{clip-path:inset(50%)!important;opacity:0!important;}

/* ── 6. Fin de page : le bouton Assistant ne cache plus la dernière ligne ── */
html.nm-mobile.nm-narrow main.overflow-auto>*:last-child{padding-bottom:84px!important;}

/* ── 7. Barre du haut des pages autonomes (Stock, TVA, Agenda, Fournisseurs…) ── */
html.nm-mobile .nm-tb{display:flex!important;flex-wrap:wrap!important;align-items:center!important;column-gap:8px!important;row-gap:8px!important;height:auto!important;min-height:0!important;padding:10px 12px!important;}
html.nm-mobile .nm-tb.nm-tb-reserve{padding-left:56px!important;}
html.nm-mobile .nm-tb::after{content:''!important;display:block!important;order:2!important;flex:0 0 100%!important;height:0!important;width:auto!important;margin:0!important;padding:0!important;border:0!important;background:none!important;position:static!important;}
html.nm-mobile .nm-tb>.nm-tb-hide{display:none!important;}
html.nm-mobile .nm-tb>.nm-tb-burger{order:0!important;flex:0 0 auto!important;margin:0!important;}
html.nm-mobile .nm-tb>.nm-tb-nav{order:1!important;flex:0 0 auto!important;margin:0!important;}
html.nm-mobile .nm-tb>.nm-tb-nav.nm-first{margin-left:auto!important;}
html.nm-mobile .nm-tb>.nm-tb-nav:not(a):not(button){display:flex!important;flex-wrap:nowrap!important;gap:6px!important;width:auto!important;height:auto!important;}
html.nm-mobile .nm-tb>.nm-tb-title{order:3!important;flex:1 1 100%!important;min-width:0!important;width:auto!important;max-width:none!important;height:auto!important;margin:0!important;}
html.nm-mobile .nm-tb>.nm-tb-title.topbar-icon{flex:0 0 auto!important;}
html.nm-mobile .nm-tb>.nm-tb-title.topbar-icon+.nm-tb-title{flex:1 1 calc(100% - 40px)!important;}
html.nm-mobile .nm-tb>.nm-tb-title,
html.nm-mobile .nm-tb>.nm-tb-title *{white-space:normal!important;}
html.nm-mobile .nm-tb>.nm-tb-title h1,
html.nm-mobile .nm-tb>h1.nm-tb-title,
html.nm-mobile .nm-tb>.nm-tb-title .page-title,
html.nm-mobile .nm-tb>.page-title.nm-tb-title,
html.nm-mobile .nm-tb>.nm-tb-title .topbar-title,
html.nm-mobile .nm-tb>.topbar-title.nm-tb-title,
html.nm-mobile .nm-tb>.nm-tb-title .tb-title{font-size:19px!important;line-height:1.25!important;width:auto!important;max-width:none!important;height:auto!important;}
html.nm-mobile .nm-tb>.nm-tb-title small,
html.nm-mobile .nm-tb>.nm-tb-title .sub,
html.nm-mobile .nm-tb>.nm-tb-title .page-sub,
html.nm-mobile .nm-tb>.nm-tb-title .tb-sub{display:block;font-size:12px!important;line-height:1.35!important;}
html.nm-mobile .nm-tb>.nm-tb-act{order:4!important;flex:0 0 auto!important;width:auto!important;height:auto!important;min-height:38px;margin:0!important;}
html.nm-mobile .nm-tb>.nm-tb-title.topbar-left{display:flex!important;align-items:center;gap:10px;}
html.nm-mobile .nm-tb :is(.tb-clock,.topbar-clock,.hdr-clock,#tbClock,#tb-clock){display:none!important;}

/* ── 8. GED : un seul bouton ☰ (celui de la GED) et horloge masquée ── */
html.nm-mobile.nm-narrow body:has(#mobile-menu) #gc-ham9{clip-path:inset(50%)!important;opacity:0!important;}
html.nm-mobile.nm-narrow .app-topbar #topbar-clock{display:none!important;}

/* ── 9. Formulaires en fenêtre trop larges : une colonne / retour à la ligne ── */
html.nm-mobile .nm-grid1{grid-template-columns:minmax(0,1fr)!important;}
html.nm-mobile .nm-grid1>*{grid-column:1/-1!important;min-width:0!important;}
html.nm-mobile .nm-wrap{flex-wrap:wrap!important;row-gap:8px;}
html.nm-mobile .nm-wrap>*{min-width:0;max-width:100%;}
