/* Digital Service - livello responsive comune smartphone e tablet */
html{max-width:100%;overflow-x:hidden;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{max-width:100%;overflow-x:hidden}
img,svg,video,canvas,iframe,object{max-width:100%;height:auto}
input,select,textarea,button{max-width:100%}
button,a,summary,input[type="checkbox"],input[type="radio"]{-webkit-tap-highlight-color:transparent}
.table-responsive,.table-wrap,.table-container,.table-scroll,.wt-table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.modal,.modal-card,.modal-content,.dialog,.popup,.drawer,.dropdown-panel{max-width:calc(100vw - 24px)}
.topbar details:not([open])>.topbar-user-panel,.topbar details:not([open])>.topbar-menu-panel{display:none!important}

@media (max-width:1024px){
  .page,.container,.content,.main-content,.dashboard-container,.admin-container,.profile-container,.page-container,.wrapper{max-width:100%!important;padding-left:18px!important;padding-right:18px!important}
  .layout,.page-layout,.dashboard-layout,.content-layout,.main-layout,.customer-layout,.detail-layout,.admin-layout{grid-template-columns:minmax(0,1fr)!important}
  .sidebar,.customer-sidebar,.aside,.side-panel{position:static!important;width:100%!important;max-width:none!important}
  .summary-grid,.stats-grid,.kpi-grid,.metrics-grid,.cards-grid,.dashboard-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .form-grid,.filters-grid,.filter-grid,.fields-grid,.info-grid,.detail-grid,.data-grid,.edit-form-grid,.inline-edit-grid,.activity-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .hero,.page-hero,.customer-hero,.dashboard-hero,.header-card{max-width:100%!important}
  .hero-actions,.header-actions,.page-actions,.toolbar,.actions,.filters-actions,.form-actions{display:flex!important;flex-wrap:wrap!important;gap:10px!important}
  table{display:block!important;width:100%!important;max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;border-collapse:separate!important;border-spacing:0!important}
  table thead,table tbody,table tfoot{width:max-content;min-width:100%}
  table tr{min-width:100%}
  table th,table td{white-space:nowrap}
  table td p,table td .notes,table td .description{white-space:normal;min-width:180px}
  .modal,.modal-card,.modal-content,.dialog,.popup{left:50%!important;right:auto!important;transform:translateX(-50%)!important;width:min(720px,calc(100vw - 28px))!important;max-height:calc(100dvh - 28px)!important;overflow:auto!important}
  .ds-side-menu{width:min(360px,92vw)!important}
  .task-notification-popup,[class*="notification-popup"]{right:12px!important;left:12px!important;width:auto!important;max-width:none!important;bottom:12px!important}
}

@media (max-width:767px){
  body{font-size:15px}
  .page,.container,.content,.main-content,.dashboard-container,.admin-container,.profile-container,.page-container,.wrapper{padding:14px 11px 28px!important}
  h1,.hero h1,.page-hero h1,.customer-hero h1,.header h1{font-size:clamp(28px,9vw,36px)!important;line-height:1.04!important;overflow-wrap:anywhere}
  h2{font-size:clamp(22px,7vw,28px)!important;line-height:1.08!important}
  h3{line-height:1.12!important}
  .topbar{height:60px!important;min-height:60px!important;padding:0 10px!important;gap:8px!important}
  .topbar-logo{width:42px!important;height:42px!important;flex-basis:42px!important}
  .topbar-logo img{width:40px!important;height:40px!important}
  .topbar-right{height:44px!important;min-height:44px!important;gap:7px!important}
  .notification-bell{width:40px!important;height:40px!important;min-width:40px!important;min-height:40px!important;flex-basis:40px!important}
  .topbar-user-dropdown,.topbar-menu{height:44px!important;min-height:44px!important}
  .topbar-user-dropdown>summary{height:40px!important;min-height:40px!important;max-width:132px!important;padding:0 10px!important;font-size:13px!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important}
  .topbar .topbar-user-dropdown .topbar-user-panel{position:fixed!important;top:66px!important;right:10px!important;left:10px!important;width:auto!important;max-width:none!important}
  .topbar .topbar-menu .topbar-menu-panel{position:fixed!important;top:66px!important;right:10px!important;left:10px!important;width:auto!important;max-width:none!important;max-height:calc(100dvh - 78px)!important}
  .ds-side-menu{width:92vw!important;max-width:360px!important;height:100dvh!important}
  .ds-side-menu-nav{padding:64px 10px 20px!important}
  .ds-side-menu-main-link,.ds-side-menu-section summary{min-height:48px!important}
  .hero,.page-hero,.customer-hero,.dashboard-hero,.header-card{display:flex!important;flex-direction:column!important;align-items:stretch!important;padding:20px 16px!important;border-radius:22px!important;gap:14px!important}
  .hero-actions,.header-actions,.page-actions,.wt-actions{width:100%!important;justify-content:stretch!important}
  .hero-actions>a,.hero-actions>button,.header-actions>a,.header-actions>button,.page-actions>a,.page-actions>button{flex:1 1 145px!important;min-height:44px!important}
  .summary-grid,.stats-grid,.kpi-grid,.metrics-grid,.cards-grid,.dashboard-grid,.form-grid,.filters-grid,.filter-grid,.fields-grid,.info-grid,.detail-grid,.data-grid,.edit-form-grid,.inline-edit-grid,.activity-form-grid,.two-columns,.three-columns,.four-columns{grid-template-columns:minmax(0,1fr)!important}
  .field-full,.full,.span-2,.span-3,.span-4{grid-column:1!important}
  .panel,.card,.section-card,.summary-card,.stat-card,.widget,.box{max-width:100%!important;border-radius:17px!important}
  .panel-header,.panel-head,.card-header,.section-header{display:flex!important;flex-wrap:wrap!important;gap:9px!important;padding:13px!important}
  .panel-body,.card-body,.section-body{padding:13px!important}
  input:not([type="checkbox"]):not([type="radio"]),select,textarea{width:100%!important;min-width:0!important;font-size:16px!important}
  input,select,button,.btn,a.btn,summary{min-height:44px}
  textarea{min-height:110px}
  .btn,.button,button[type="submit"],button[type="button"]{touch-action:manipulation}
  .toolbar,.actions,.action-row,.button-row,.form-actions,.filters-actions,.attachment-actions,.nav-actions{display:flex!important;flex-wrap:wrap!important;gap:8px!important}
  .toolbar>.btn,.action-row>.btn,.button-row>.btn,.form-actions>.btn,.form-actions>button,.filters-actions>.btn,.filters-actions>button{flex:1 1 130px!important;justify-content:center!important}
  .filters,.filter-bar,.filter-row,.search-row{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px!important;width:100%!important}
  table{font-size:14px!important;border-radius:12px;min-width:0!important}
  table th,table td{padding:10px 9px!important}
  table::after{content:"Scorri orizzontalmente per vedere tutti i dati →";display:block;position:sticky;left:0;padding:8px 10px;color:#6b7280;background:#f8fafc;font-size:12px;font-weight:800}
  .pagination,.pager{display:flex!important;flex-wrap:wrap!important;gap:6px!important}
  .pagination a,.pagination span,.pager a,.pager span{min-width:42px!important;min-height:42px!important;display:inline-flex!important;align-items:center!important;justify-content:center!important}
  details>summary{touch-action:manipulation}
  .modal,.modal-card,.modal-content,.dialog,.popup{top:12px!important;bottom:12px!important;width:calc(100vw - 20px)!important;max-height:calc(100dvh - 24px)!important;border-radius:18px!important;padding:14px!important}
  .sticky,.is-sticky,[style*="position: sticky"]{position:static!important;top:auto!important}
  .fixed-actions,.sticky-actions,.bottom-actions{position:static!important;width:100%!important;margin-top:14px!important}
  .tabs,.tab-list,.nav-tabs{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch!important;white-space:nowrap!important}
  .badge,.pill,.chip{white-space:normal!important;text-align:center}
  .wt-calendar{grid-template-columns:repeat(7,minmax(170px,1fr))!important;overflow-x:auto!important}
  .wt-day{min-height:260px!important}
  .tasks-filter-panel,.task-sections-panel,.task-tabs-content-panel,#task-tabs-content-area,.tasks-filter-form,.task-collapsible,.task-row-toggle{width:100%!important;max-width:100%!important;min-width:0!important}
  .task-row-status,.task-row-main,.task-row-summary,.task-row-details{width:auto!important;max-width:100%!important;min-width:0!important}
  .hr-container,.hr-container .page-header{width:100%!important;max-width:100%!important;min-width:0!important}
  .hr-container .page-header .btn-primary,.hr-container .page-header>a[class*="btn"]{box-sizing:border-box!important;width:100%!important;max-width:100%!important;margin-left:0!important;margin-right:0!important}
  .print-actions{margin:8px!important;justify-content:stretch!important}
  .print-actions button{width:100%!important}
  .sheet{width:100%!important;min-height:0!important;margin:0!important;padding:18px 12px!important;box-shadow:none!important}
}

@media (max-width:390px){
  .topbar-user-dropdown>summary{max-width:105px!important}
  .topbar{padding-inline:7px!important}
  .page,.container,.content,.main-content,.dashboard-container,.admin-container,.profile-container,.page-container,.wrapper{padding-inline:8px!important}
  .hero,.page-hero,.customer-hero,.dashboard-hero,.header-card{padding:17px 13px!important}
}

@media (orientation:landscape) and (max-height:560px){
  .topbar-menu-panel,.topbar-user-panel{max-height:calc(100dvh - 70px)!important;overflow:auto!important}
  .modal,.modal-card,.modal-content,.dialog,.popup{top:6px!important;bottom:6px!important;max-height:calc(100dvh - 12px)!important}
}

@media print{
  .topbar,.ds-side-menu,.ds-side-menu-backdrop,.mobile-only,.task-notification-popup{display:none!important}
  body{overflow:visible!important}
  table{display:table!important;overflow:visible!important}
  table::after{display:none!important}
}
