/*
 * ParcIT Manager V3.4.417 — adaptation téléphones et tablettes
 * Chargée en dernier. Toutes les règles dépendent de html[data-device="phone|tablet"]
 * (posé par device-adaptive.js uniquement sur écran tactile) : l'affichage PC est inchangé.
 */
@media screen {

/* ===== Éléments ajoutés par le script : invisibles hors mode tiroir ===== */
html:not([data-layout="drawer"]) .adaptive-nav-toggle,html:not([data-layout="drawer"]) .adaptive-backdrop,.adaptive-backdrop{display:none!important}

/* ===== Tous appareils tactiles (téléphone + tablette) ===== */
html[data-input="touch"]{-webkit-text-size-adjust:100%;text-size-adjust:100%;-webkit-tap-highlight-color:rgba(23,54,93,.12)}
html[data-input="touch"] :is(button,a,select,summary,label,input[type="checkbox"],input[type="radio"],[role="button"]){touch-action:manipulation}
/* 16 px minimum : évite le zoom automatique d'iOS à la saisie. */
html[data-input="touch"] :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]){font-size:max(16px,1em)}
html[data-input="touch"] :is(.topbar,.toolbar,.dialog-actions,.record-footer,.detail-actions) :is(.btn,button){min-height:44px}
html[data-input="touch"] .sidebar .nav-btn{min-height:46px}
html[data-input="touch"] .sidebar{-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
html[data-input="touch"] .table-wrap{-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}
html[data-input="touch"] :is(img,svg,canvas,video){max-width:100%}
/* Encoche / coins arrondis en mode paysage. */
html[data-input="touch"] body{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
html[data-input="touch"] .sidebar{padding-left:max(16px,env(safe-area-inset-left))}
html[data-input="touch"] .main{min-width:0}
html[data-input="touch"] #content{min-width:0;max-width:100%}

/* ===== Tablette large (paysage ≥ 1000 px) : menu fixe plus étroit ===== */
html[data-layout="docked"]{--adaptive-side:232px}
html[data-layout="docked"] .sidebar{width:var(--adaptive-side);padding:18px 12px;overflow-y:auto}
html[data-layout="docked"] .main{margin-left:var(--adaptive-side)}
html[data-layout="docked"] .app-status-footer{left:var(--adaptive-side)}
html[data-layout="docked"] .topbar{padding:14px 20px;height:auto;min-height:84px;flex-wrap:wrap;gap:10px}
html[data-layout="docked"] .top-actions{flex-wrap:wrap;gap:8px}
html[data-layout="docked"] #content{padding-left:max(0px,env(safe-area-inset-left))}

/* ===== Menu tiroir : tablette verticale (ou < 1000 px) et téléphone horizontal ===== */
html[data-layout="drawer"] body .adaptive-nav-toggle{display:inline-flex!important;align-items:center;justify-content:center;flex:0 0 auto;width:48px;height:48px;min-height:48px;padding:0;margin:0 4px 0 0;order:-1}
html[data-layout="drawer"] body .sidebar{position:fixed!important;inset:0 auto 0 0!important;width:min(310px,86vw)!important;max-width:none;height:100%!important;max-height:none!important;overflow-y:auto!important;overflow-x:hidden;padding:16px 14px 16px max(14px,env(safe-area-inset-left));z-index:1200!important;transform:translateX(-105%);visibility:hidden;transition:transform .22s ease,visibility 0s linear .22s;box-shadow:none}
html[data-layout="drawer"][data-nav-open] body .sidebar{transform:none;visibility:visible;transition:transform .22s ease,visibility 0s;box-shadow:8px 0 32px rgba(8,20,36,.45)}
html[data-layout="drawer"] body .sidebar nav{display:flex!important;flex-direction:column;grid-template-columns:none;padding:8px 0;max-height:none!important;overflow:visible!important}
html[data-layout="drawer"] body .sidebar .brand{padding:0;min-height:56px}
html[data-layout="drawer"] .sidebar-note{display:block}
html[data-layout="drawer"] .mobile-menu-toggle,html[data-layout="drawer"] .mobile-bottom-nav{display:none!important}
html[data-layout="drawer"] body .adaptive-backdrop{display:block!important;position:fixed;inset:0;z-index:1190;background:rgba(8,20,36,.5);opacity:0;pointer-events:none;transition:opacity .2s ease}
html[data-layout="drawer"][data-nav-open] .adaptive-backdrop{opacity:1;pointer-events:auto}
html[data-layout="drawer"] body{padding-bottom:0!important}
html[data-layout="drawer"] body .main{margin:0!important;padding-top:0!important;padding-left:0;width:100%;min-width:0}
html[data-layout="drawer"] body .topbar{position:sticky;top:0;z-index:4;height:auto;min-height:64px;padding:10px max(16px,env(safe-area-inset-left)) 10px max(16px,env(safe-area-inset-left));flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:flex-start;gap:10px}
html[data-layout="drawer"] .topbar .page-heading{flex:1 1 200px;min-width:0}
html[data-layout="drawer"] .topbar h1{font-size:clamp(20px,3.2vw,26px);overflow-wrap:anywhere}
html[data-layout="drawer"] body .top-actions{width:auto;margin-left:auto;flex:0 1 auto;flex-wrap:wrap;justify-content:flex-end;gap:8px}
html[data-layout="drawer"] .top-actions .global-search{flex:1 1 220px;max-width:340px;min-width:160px}
html[data-layout="drawer"] .app-status-footer{left:0;bottom:0;padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right));padding-bottom:max(7px,env(safe-area-inset-bottom))}
html[data-layout="drawer"] .main{padding-bottom:calc(52px + env(safe-area-inset-bottom))}

/* Tablette verticale : contenus sur 2 colonnes maximum, formulaires lisibles. */
html[data-device="tablet"][data-layout="drawer"] :is(.cards,.aw-summary,.cw-summary){grid-template-columns:repeat(2,minmax(0,1fr))}
html[data-device="tablet"][data-layout="drawer"] :is(.grid-2,.dashboard-grid){grid-template-columns:1fr}
html[data-device="tablet"][data-layout="drawer"] :is(.form-grid,.settings-fields,.settings-fields.operational){grid-template-columns:repeat(2,minmax(0,1fr))}
html[data-device="tablet"][data-layout="drawer"] .form-field.wide{grid-column:1/-1}
html[data-device="tablet"][data-layout="drawer"] .toolbar{flex-wrap:wrap;gap:10px}
html[data-device="tablet"][data-layout="drawer"] dialog[open]:not(.page-workspace-dialog):not(.context-help-dialog){width:min(94vw,860px)!important;max-width:94vw!important;max-height:calc(100dvh - 24px)!important}

/* ===== Téléphone horizontal : hauteur réduite, tout se gagne en verticalité ===== */
html[data-short="true"] body .topbar{position:static;min-height:0;padding-top:6px;padding-bottom:6px;gap:8px}
html[data-short="true"] .topbar .page-subtitle-line{display:none}
html[data-short="true"] body .top-actions{flex-wrap:nowrap;flex:1 1 auto;min-width:0}
html[data-short="true"] .top-actions .global-search{flex:1 1 120px;min-width:100px;max-width:none}
html[data-short="true"] .topbar h1{font-size:19px;line-height:1.2;margin:0}
html[data-short="true"] .adaptive-nav-toggle{width:44px;height:44px;min-height:44px}
html[data-short="true"] body .app-status-footer{position:static;min-height:0;margin-top:12px;padding-top:6px;padding-bottom:max(6px,env(safe-area-inset-bottom))}
html[data-short="true"] .main{padding-bottom:12px}
html[data-short="true"] :is(.cards,.aw-summary,.cw-summary){grid-template-columns:repeat(2,minmax(0,1fr))}
html[data-short="true"] :is(.grid-2,.dashboard-grid){grid-template-columns:1fr}
html[data-short="true"] :is(.form-grid,.settings-fields,.settings-fields.operational){grid-template-columns:repeat(2,minmax(0,1fr))}
html[data-short="true"] .form-field.wide{grid-column:1/-1}
html[data-short="true"] body .toolbar{flex-direction:row;flex-wrap:wrap;align-items:center}
html[data-short="true"] body .toolbar-left{flex-direction:row;flex-wrap:wrap;align-items:center}
/* Fenêtres : plein écran, comme sur téléphone vertical. */
html[data-short="true"] body dialog[open]:not(.page-workspace-dialog):not(.context-help-dialog){position:fixed;inset:0;margin:0!important;width:100vw!important;max-width:100vw!important;height:100dvh!important;max-height:100dvh!important;border-radius:0!important;overflow:auto}
html[data-short="true"] body .page-workspace-host>dialog.page-workspace-dialog[open]{height:calc(100dvh - 24px)!important;min-height:240px}
html[data-short="true"] body .dialog-head{position:sticky;top:0;padding-top:8px;padding-bottom:8px}

/* ===== Téléphone vertical : compléments à mobile.css ===== */
html[data-layout="phone"] body .main{padding-left:0;padding-right:0}
html[data-layout="phone"] body .mobile-bottom-nav{padding-bottom:max(7px,env(safe-area-inset-bottom))}
html[data-layout="phone"] body .toast{max-width:calc(100vw - 24px)}

}


/* ===== Corrections de débordement constatées sur écrans étroits ===== */
/* Une colonne « 1fr » s'élargit au contenu (liste déroulante longue) : on force minmax(0,1fr). */
@media screen and (max-width:850px){
 .software-deployment-form,.software-custom form,.software-target-grid{grid-template-columns:minmax(0,1fr)}
 .software-deployment-form select,.software-target-grid select{max-width:100%;text-overflow:ellipsis}
}
@media screen{
/* Menu « Plus · vue et export » : ancré à droite du bouton, il sortait de l'écran à gauche. */
html[data-input="touch"] .assets-balanced .ab-options-body{position:fixed;top:auto;left:max(8px,env(safe-area-inset-left));right:max(8px,env(safe-area-inset-right));width:auto;max-width:460px;margin:6px auto 0;max-height:70dvh;overflow:auto}
}

/* Respect de la préférence « réduire les animations ». */
@media (prefers-reduced-motion:reduce){
 html[data-layout="drawer"] body .sidebar,.adaptive-backdrop{transition:none!important}
}
