/* Maria Labella v1.38.3 — acabamento responsivo global / iPhone
   Camada transversal carregada por todas as páginas. */

html, body{max-width:100%;overflow-x:hidden;}
img,svg,video,canvas{max-width:100%;}
.page,.wrap,.panel,.table-card,.accordion,.modal{min-width:0;}

@supports (height: 100dvh){
  .sidebar{height:100dvh;min-height:100dvh;}
  .overlay,.loading-screen{min-height:100dvh;}
}

@media (max-width:900px){
  .sidebar-toggle{
    top:calc(12px + env(safe-area-inset-top));
    left:calc(12px + env(safe-area-inset-left));
    width:44px;height:44px;
  }
  .sidebar{
    width:min(86vw,320px);
    padding-top:env(safe-area-inset-top);
    padding-bottom:env(safe-area-inset-bottom);
  }
  .sidebar-nav{overscroll-behavior:contain;}
  .page{padding-top:calc(64px + env(safe-area-inset-top));}
  .sidebar-backdrop{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);}
}

@media (max-width:760px){
  body{-webkit-text-size-adjust:100%;text-size-adjust:100%;}
  .wrap{
    width:100%;
    max-width:100%;
    padding-left:max(14px,env(safe-area-inset-left));
    padding-right:max(14px,env(safe-area-inset-right));
    padding-bottom:calc(72px + env(safe-area-inset-bottom));
  }

  .page-header,.admin-hero,.panel-title,.exp-config-header,.pc-header{
    align-items:flex-start;
  }
  .page-header,.admin-hero{flex-direction:column;}
  .page-header h1,.admin-hero h2{overflow-wrap:anywhere;}
  .page-description,.admin-hero p{max-width:100%;}

  .top-actions,.admin-hero-actions,.toolbar,.etq-toolbar,.etq-toolbar-acoes,
  .exp-filtros,.ssh-filters,.modal-actions,.dd-actions{
    width:100%;
    max-width:100%;
    flex-wrap:wrap;
  }
  .top-actions>.btn,.admin-hero-actions>.btn,.toolbar>.btn,.modal-actions>.btn{
    min-height:44px;
  }

  input,select,textarea{
    max-width:100%;
    font-size:16px; /* evita zoom automático do Safari iOS */
  }
  input[type="checkbox"],input[type="radio"]{font-size:initial;}
  button,.btn,.dd-btn,.row-dd-btn,.nav-logout{touch-action:manipulation;-webkit-tap-highlight-color:transparent;}

  .field-row,.map-grid,.account-grid,.password-grid,.fis-grid-dados,
  .update-grid,.dash-grid,.kpi-grid,.est-kpi-grid,.sync-grid,.pendentes-grid,
  .bling-catalogo-grid{grid-template-columns:minmax(0,1fr)!important;}

  .panel,.card,.table-card,.accordion{max-width:100%;}
  .panel{padding:16px 14px 8px;}
  .accordion-header{padding:14px 14px;}
  .accordion-body-inner{padding:14px;}

  /* Tabelas viram cartões legíveis no celular. nav.js injeta data-label
     automaticamente inclusive para linhas adicionadas depois por JavaScript. */
  .table-card,.table-wrap,.table-scroll{overflow:visible!important;}
  table{max-width:100%;}
  table:not(.keep-table-mobile) thead{display:none;}
  table:not(.keep-table-mobile),
  table:not(.keep-table-mobile) tbody,
  table:not(.keep-table-mobile) tr,
  table:not(.keep-table-mobile) td{display:block;width:100%;min-width:0!important;}
  table:not(.keep-table-mobile) tbody tr{
    padding:10px 0;
    border-bottom:1px solid var(--border-soft);
  }
  table:not(.keep-table-mobile) tbody tr:last-child{border-bottom:0;}
  table:not(.keep-table-mobile) tbody td{
    display:grid;
    grid-template-columns:minmax(92px,36%) minmax(0,1fr);
    align-items:start;
    gap:10px;
    padding:7px 14px;
    border:0;
    text-align:right;
    overflow-wrap:anywhere;
    white-space:normal;
  }
  table:not(.keep-table-mobile) tbody td::before{
    content:attr(data-label);
    display:block;
    color:var(--text-faint);
    font-size:10.5px;
    font-weight:700;
    letter-spacing:.04em;
    text-transform:uppercase;
    text-align:left;
    line-height:1.4;
  }
  table:not(.keep-table-mobile) tbody td[data-label=""]::before{display:none;}
  table:not(.keep-table-mobile) tbody td[data-label=""]{grid-template-columns:1fr;text-align:left;}
  table:not(.keep-table-mobile) .row-actions,
  table:not(.keep-table-mobile) td:last-child .row-actions{justify-content:flex-end;flex-wrap:wrap;}

  .overlay{
    padding:calc(12px + env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
    overflow:auto;
  }
  .modal{
    width:100%;
    max-width:100%!important;
    max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow:auto;
    overscroll-behavior:contain;
  }
  .modal-actions{position:relative;gap:8px;}
  .modal-actions>.btn{flex:1 1 140px;justify-content:center;}

  .toast,.toast-progresso{
    left:max(12px,env(safe-area-inset-left))!important;
    right:max(12px,env(safe-area-inset-right))!important;
    bottom:calc(12px + env(safe-area-inset-bottom))!important;
    width:auto!important;
    max-width:none!important;
  }

  .palette-overlay{padding-top:calc(74px + env(safe-area-inset-top));}
  .palette{max-height:calc(100dvh - 100px - env(safe-area-inset-top));border-radius:12px;}

  .dd-panel.dd-menu{
    max-width:calc(100vw - 24px);
    width:calc(100vw - 24px);
    left:12px!important;
    right:12px!important;
  }

  .grupo-header,.grupo-item{align-items:flex-start;flex-wrap:wrap;}
  .grupo-header-actions,.grupo-item .gi-valor,.grupo-item .gi-principal{width:100%;}
  .grupo-item .gi-valor{flex:1 1 100%;}

  .ped-intro,.ped-aviso,.info-note{overflow-wrap:anywhere;}
  .ped-drop{min-height:132px;padding:20px 14px;}
}

@media (max-width:430px){
  .wrap{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right));}
  .page-header h1{font-size:22px;line-height:1.15;}
  .panel{padding-left:12px;padding-right:12px;}
  table:not(.keep-table-mobile) tbody td{grid-template-columns:minmax(82px,34%) minmax(0,1fr);padding-left:10px;padding-right:10px;}
  .btn{max-width:100%;}
  .sidebar{width:min(90vw,310px);}
}

@media (orientation:landscape) and (max-height:500px){
  .page{padding-top:56px;}
  .sidebar-toggle{top:8px;}
  .modal{max-height:calc(100dvh - 12px);}
}
