:root{--app-safe-bottom:env(safe-area-inset-bottom,0px)}
.app-install-card{position:fixed;z-index:12000;left:50%;bottom:calc(18px + var(--app-safe-bottom));width:min(520px,calc(100% - 28px));transform:translateX(-50%);padding:18px;border:2px solid #111;border-top:7px solid #d71920;border-radius:18px;background:#fff;box-shadow:0 18px 55px #0005}
.app-install-card[hidden]{display:none!important}.app-install-card h2{margin:0 0 6px;font-size:1.25rem}.app-install-card p{margin:0 0 14px;color:#555}.app-install-actions{display:grid;grid-template-columns:1fr auto;gap:9px}.app-install-actions button{min-height:48px}.app-install-dismiss{background:#eceef2!important;color:#111!important}
.app-install-status{margin:0 0 13px;padding:11px 12px;border:1px solid #d6dae1;border-radius:10px;background:#f7f8fa;color:#34373d;font-weight:750}.app-install-card.is-working .app-install-status{border-color:#e8a3a6;background:#fff1f2;color:#9f1118}.app-install-card.is-working .app-install-now{opacity:.78;cursor:wait}.app-install-card.is-installed{border-top-color:#168447}.app-install-card.is-installed .app-install-status{border-color:#73c993;background:#edfff3;color:#08662e}
.app-update-toast{position:fixed;z-index:12500;right:16px;bottom:calc(92px + var(--app-safe-bottom));max-width:360px;padding:14px 16px;border-radius:13px;background:#111;color:#fff;box-shadow:0 12px 35px #0005}.app-update-toast button{margin-left:10px;padding:7px 10px;background:#d71920}
.app-bottom-nav{display:none}
.athlete-mobile-header,.athlete-menu-drawer{display:none}
@media(max-width:820px){
  body[data-role="athlete"]{padding-top:calc(64px + env(safe-area-inset-top,0px));padding-bottom:calc(82px + var(--app-safe-bottom))}
  body[data-role="athlete"]>header{display:none!important}
  .athlete-mobile-header{position:fixed;z-index:11520;left:0;right:0;top:0;display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:64px;padding:calc(8px + env(safe-area-inset-top,0px)) 10px 8px;background:#080808;color:#fff;box-shadow:0 5px 18px #0005}
  .athlete-mobile-brand{display:flex;align-items:center;gap:8px;color:#fff;text-decoration:none;font-size:.78rem;letter-spacing:.04em}.athlete-mobile-brand img{width:38px;height:38px;object-fit:contain}.athlete-menu-toggle{min-height:40px!important;margin:0!important;padding:8px 11px!important;border:1px solid #555!important;border-radius:9px!important;background:#181818!important;color:#fff!important;font-size:.75rem!important;font-weight:900!important}
  .athlete-menu-drawer{position:fixed;z-index:11510;left:0;right:0;top:calc(64px + env(safe-area-inset-top,0px));display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:10px;background:#090909;border-top:1px solid #333;box-shadow:0 15px 28px #0008}.athlete-menu-drawer[hidden]{display:none!important}.athlete-menu-drawer a{display:flex;align-items:center;min-height:45px;padding:8px 12px;border:1px solid #333;border-radius:9px;background:#171717;color:#fff;text-decoration:none;font-size:.78rem;font-weight:900}.athlete-menu-drawer a[href="?page=athletes"]{border-color:#d71920;background:#351013}
  body[data-role="athlete"] .shell{width:min(100% - 20px,1120px);margin-top:14px}
  .app-bottom-nav{position:fixed;z-index:11000;left:8px;right:8px;bottom:calc(8px + var(--app-safe-bottom));display:grid;grid-template-columns:repeat(5,1fr);gap:4px;padding:7px;border:1px solid #333;border-radius:18px;background:#090909;color:#fff;box-shadow:0 12px 38px #0006}
  .app-bottom-nav a{position:relative;display:grid;place-items:center;gap:2px;min-width:0;min-height:55px;padding:5px 2px;border-radius:12px;color:#fff;text-decoration:none;font-size:.68rem;font-weight:800;line-height:1.1;text-align:center}
  .app-bottom-nav a.active{background:#d71920}.app-bottom-nav .app-nav-icon{font-size:1.25rem;line-height:1}.app-bottom-nav b{position:absolute;right:7px;top:3px;display:grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border-radius:99px;background:#facc15;color:#111;font-size:10px}
  body[data-page="group-chat"][data-role="athlete"]{height:100dvh;min-height:0;overflow:hidden;padding-bottom:calc(76px + var(--app-safe-bottom))}
  body[data-page="group-chat"][data-role="athlete"] .shell{height:calc(100dvh - 90px - var(--app-safe-bottom));min-height:0;margin:0 auto;padding:6px;overflow:hidden}
  body[data-page="group-chat"][data-role="athlete"] .group-chat-page{height:100%;min-height:0;padding:0!important;display:grid!important;grid-template-rows:auto minmax(0,1fr)!important;gap:6px;overflow:hidden!important}
  body[data-page="group-chat"][data-role="athlete"] .chat-app-topbar{display:none!important}
  body[data-page="group-chat"][data-role="athlete"] .group-chat-heading{display:none!important}
  body[data-page="group-chat"][data-role="athlete"] .group-chat-card{min-height:0!important;height:100%!important;display:grid!important;grid-template-rows:auto minmax(0,1fr) auto!important;overflow:hidden!important}
  body[data-page="group-chat"][data-role="athlete"] .group-chat-stream{height:auto!important;min-height:0!important;max-height:none!important;overflow-y:auto!important;-webkit-overflow-scrolling:touch}
  body[data-page="group-chat"][data-role="athlete"] .group-chat-compose{position:relative!important;bottom:auto!important;grid-template-columns:minmax(0,1fr) 54px!important;width:100%!important;padding:8px!important;background:#fff!important}
  body[data-page="group-chat"][data-role="athlete"] .group-chat-compose textarea{min-width:0!important;width:100%!important;min-height:50px!important;height:50px!important;max-height:92px!important;margin:0!important;font-size:16px!important;resize:none!important}
  body[data-page="group-chat"][data-role="athlete"] .group-chat-compose button{position:static!important;width:52px!important;min-width:52px!important;height:50px!important;margin:0!important;padding:0!important;border-radius:50%!important}
}
@media(display-mode:standalone){html,body{height:auto!important;min-height:100%;overflow-y:auto!important;overscroll-behavior-y:auto!important;touch-action:auto!important}body{padding-top:env(safe-area-inset-top,0px)}.app-install-card{display:none!important}}

/* v168: in app il contenuto resta compatto; la barra inferiore non copre schede e moduli. */
@media(max-width:820px){
 body[data-role="athlete"] .shell{width:calc(100% - 20px)!important;margin-top:12px!important}
 body[data-role="athlete"] .card{margin-block:12px!important}
 .app-bottom-nav{left:6px;right:6px;padding:5px;border-radius:15px}
 .app-bottom-nav a{min-height:50px;font-size:.62rem}
}
