/* REAL TREZZANO - compatibilità Safari / Chrome / Edge / Firefox */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-behavior:smooth}
body{min-width:320px;overflow-x:hidden;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
img,svg,video,canvas{max-width:100%;height:auto}
button,input,select,textarea{-webkit-appearance:none;appearance:none;max-width:100%;color:#17191c;background-color:#fff;border-radius:8px}
button{touch-action:manipulation}
select{padding-right:38px!important;background-image:linear-gradient(45deg,transparent 50%,#111 50%),linear-gradient(135deg,#111 50%,transparent 50%);background-position:calc(100% - 18px) 50%,calc(100% - 12px) 50%;background-size:6px 6px,6px 6px;background-repeat:no-repeat}
input[type="date"],input[type="time"],input[type="datetime-local"]{min-height:42px;line-height:normal}
input[type="checkbox"],input[type="radio"]{-webkit-appearance:auto;appearance:auto;width:auto;max-width:none}
textarea{resize:vertical;min-height:100px}
.hidden{display:none!important}

/* Dialog affidabili anche su Safari */
dialog{position:fixed;inset:0;margin:auto;max-height:calc(100dvh - 24px);overflow:auto;-webkit-overflow-scrolling:touch;background:#fff;color:#17191c}
dialog[open]{display:block}
dialog::backdrop{background:rgba(0,0,0,.72);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.side-dialog{inset:0 0 0 auto;margin:0;width:min(560px,100%);height:100dvh;max-height:100dvh;overflow:auto;-webkit-overflow-scrolling:touch}
.dialog-head{position:sticky;top:0;z-index:3;background:#fff}
.dialog-actions{position:sticky;bottom:0;z-index:3;background:#fff;padding-bottom:max(16px,env(safe-area-inset-bottom))}

/* Layout generale: niente colonne schiacciate */
.app-main,.rt-main-v3{width:100%;min-width:0}
.page-heading,.calendar-toolbar,.toolbar,.search-activity-toolbar,.rt-topbar,.rt-panel-head{min-width:0}
.page-heading>div,.rt-topbar>div,.rt-panel,.search-activity-info{min-width:0}
.main-nav{-webkit-overflow-scrolling:touch;scrollbar-width:thin}
.nav-link{flex:0 0 auto;white-space:nowrap}

/* Home dashboard */
.rt-app-shell{width:100%;max-width:none;min-height:100dvh}
.rt-workspace{min-width:0;overflow:hidden}
.rt-filterbar{grid-template-columns:repeat(6,minmax(0,1fr))}
.rt-filterbar>*{min-width:0}
.rt-filterbar select,.rt-filterbar input{min-width:0}
.rt-dashboard-grid{grid-template-columns:minmax(260px,.88fr) minmax(330px,1.22fr) minmax(360px,1.31fr)}
.rt-panel{min-width:0;overflow:hidden}
.rt-teams-panel{overflow-x:auto;-webkit-overflow-scrolling:touch}
.team-preview-head,.home-team-row{min-width:600px}

/* Calendario */
.calendar-layout-v5{min-width:0}
.calendar-main-v5,.calendar-sidebar-v5{min-width:0}
.calendar-board,.month-calendar,.calendar-weekdays{min-width:700px}
.calendar-main-v5{overflow-x:auto;-webkit-overflow-scrolling:touch}
.calendar-event{overflow-wrap:anywhere;word-break:normal}
.calendar-cell,.calendar-day{min-width:0}

/* Tabelle/liste */
.content-card,.calendar-shell,.search-activity-card,.team-list-row,.match-row{min-width:0}
.search-activity-card{grid-template-columns:minmax(100px,115px) minmax(0,1fr) minmax(150px,180px)}
.search-card-actions{min-width:0}
.match-row{grid-template-columns:minmax(115px,150px) minmax(70px,90px) minmax(180px,1fr) minmax(170px,240px) auto}
.team-list-row{grid-template-columns:minmax(180px,1.2fr) minmax(420px,2.6fr) auto}

/* Evita font/icone fuori asse su Safari */
.avatar,.round-cal,.user-chip>b,.rt-secondary-search span,.icon-notice i,.notification i{display:flex;align-items:center;justify-content:center}
.primary,.action-link,.rt-primary,.rt-secondary-search,.filter-btn,.search-card-actions button{line-height:1.2;text-align:center}

@media(max-width:1280px){
 .rt-filterbar{grid-template-columns:repeat(3,minmax(0,1fr))}
 .rt-dashboard-grid{grid-template-columns:1fr 1fr}
 .rt-teams-panel{grid-column:1/-1}
 .dashboard-grid{grid-template-columns:1fr 1fr}
 .search-activity-card{grid-template-columns:105px minmax(0,1fr) 160px}
}
@media(max-width:980px){
 .rt-app-shell{display:block}
 .rt-sidebar{min-height:auto;position:sticky;top:0;z-index:50;overflow:visible}
 .rt-side-brand,.rt-side-footer{display:none}
 .rt-side-nav{display:flex;overflow-x:auto;gap:6px;padding:8px;-webkit-overflow-scrolling:touch}
 .rt-side-nav a{flex:0 0 auto;height:44px;padding:0 14px;font-size:13px}
 .rt-topbar{padding:20px 18px 8px;gap:16px}
 .rt-topbar h1{font-size:34px}
 .rt-main-v3{padding:0 18px 20px}
 .rt-filterbar{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 .rt-dashboard-grid,.dashboard-grid{grid-template-columns:1fr}
 .rt-teams-panel{grid-column:auto}
 .club-hero{height:auto;min-height:120px}
 .match-row,.team-list-row{grid-template-columns:1fr}
 .team-meta{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
 .club-hero{padding:12px 14px;gap:12px}
 .brand-lockup{min-width:0}.brand-lockup img{flex:0 0 58px}.brand-lockup h1{font-size:24px;white-space:nowrap}.hero-user{display:none}
 .main-nav{height:54px;padding:0 6px}.nav-link{height:54px;padding:0 11px}.nav-link b{display:inline;font-size:11px}
 .app-main{padding:16px 10px 50px}
 .page-heading{display:grid;gap:14px}.page-heading .primary{width:100%}
 .rt-topbar{display:grid}.rt-top-actions{width:100%;flex-wrap:wrap;gap:8px}.season-select{flex:1}.user-chip{border-left:0;padding-left:0}
 .rt-main-v3{padding:0 10px 18px}.home-main-actions>*{width:100%;justify-content:center}
 .rt-filterbar{grid-template-columns:1fr}.home-away{width:100%}
 .rt-dashboard-grid{grid-template-columns:1fr}.rt-panel{padding:14px;min-height:0}
 .search-activity-stats{grid-template-columns:1fr}
 .search-activity-toolbar{display:grid;grid-template-columns:1fr}.search-activity-toolbar>*{width:100%}
 .search-activity-card{grid-template-columns:1fr;padding:14px}.search-date-box{text-align:left;border-right:0;border-bottom:1px solid #eceef1;padding:0 0 10px}.search-card-actions{grid-template-columns:1fr 1fr}
 .form-grid,.form-grid-sub{grid-template-columns:1fr!important}.full-width{grid-column:1!important}
 .dialog-head h2{font-size:18px}.dialog-actions{display:grid;grid-template-columns:1fr;gap:8px}
 .calendar-board,.month-calendar,.calendar-weekdays{min-width:630px}
 .calendar-control-v5,.calendar-heading-v5{align-items:stretch!important}.calendar-filters{display:grid!important;grid-template-columns:1fr!important}.calendar-filters>*{width:100%!important}
 .poster-sheet{width:100%;margin:10px 0}.poster-header{padding:14px}.poster-game{grid-template-columns:1fr}
}
@supports not (height:100dvh){dialog,.side-dialog{height:100vh;max-height:100vh}}

/* V5.5 - FIX DEFINITIVO HOME MAC: evita il collasso della colonna principale */
.dashboard-v3 .rt-app-shell{
  display:-webkit-flex!important;
  display:flex!important;
  flex-direction:row!important;
  width:100%!important;
  max-width:1536px!important;
  min-width:0!important;
  margin:0 auto!important;
}
.dashboard-v3 .rt-sidebar{
  -webkit-flex:0 0 205px!important;
  flex:0 0 205px!important;
  width:205px!important;
  min-width:205px!important;
  max-width:205px!important;
}
.dashboard-v3 .rt-workspace{
  -webkit-flex:1 1 auto!important;
  flex:1 1 auto!important;
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  overflow:visible!important;
}
.dashboard-v3 .rt-topbar,
.dashboard-v3 .rt-main-v3,
.dashboard-v3 .rt-footer{
  width:100%!important;
  min-width:0!important;
}
.dashboard-v3 .rt-dashboard-grid{
  width:100%!important;
  min-width:0!important;
}
.dashboard-v3{overflow-x:auto!important}

@media(max-width:1280px){
  .dashboard-v3 .rt-sidebar{
    -webkit-flex-basis:180px!important;
    flex-basis:180px!important;
    width:180px!important;
    min-width:180px!important;
    max-width:180px!important;
  }
}
@media(max-width:820px){
  .dashboard-v3 .rt-app-shell{display:block!important}
  .dashboard-v3 .rt-sidebar{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
  }
  .dashboard-v3 .rt-workspace{width:100%!important}
}
