/* Stile "app" per le PWA (barra di navigazione in basso) e adattamenti mobile */
:root { --tabbar-h: 64px; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
html.pwa body { overscroll-behavior-y: contain; }
.app-tabbar, .app-sheet { display: none; }
@media (max-width: 767.98px) {
  html.pwa body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  html.pwa .app-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(10,10,10,.97); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  html.pwa .app-sheet { display: block; }
  html.pwa .chat-fab { display: none !important; }
  html.pwa header button[aria-label="Menu"], html.pwa header nav[aria-label="Mobile"] { display: none !important; }
}
.app-tab {
  flex: 1 1 0; min-width: 0; min-height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; font-weight: 500; background: none; border: 0; position: relative; text-decoration: none; touch-action: manipulation;
}
.app-tab .ico { font-size: 22px; line-height: 1; display: inline-flex; color: inherit; }
.app-tab .ico svg { display: block; }
.app-tab { color: rgba(255,255,255,.72); }
.app-tab.active { color: #ff5722; }
.app-tab:active { background: rgba(255,255,255,.06); }
.app-tab .badge { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff5722; color: #fff; font-size: 11px; font-weight: 700; display: none; align-items: center; justify-content: center; }
.app-tab .badge.on { display: flex; }
.app-sheet-bg { position: fixed; inset: 0; z-index: 46; background: rgba(0,0,0,.6); }
.app-sheet-panel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 47; background: #111; border-top-left-radius: 20px; border-top-right-radius: 20px; padding: 14px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); max-height: 80dvh; overflow-y: auto; }
.app-sheet-panel a, .app-sheet-panel button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 8px; color: #fff; font-size: 15px; border: 0; background: none; text-align: left; border-bottom: 1px solid rgba(255,255,255,.07); text-decoration: none; }
.app-sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); margin: 0 auto 10px; }
/* Admin: campi e tabelle adatti al touch */
@media (max-width: 767.98px) {
  .admin-body main input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), .admin-body main select, .admin-body main textarea { font-size: 16px !important; min-height: 44px; }
  .admin-body main button, .admin-body main a[class*="bg-"] { min-height: 40px; }
  .admin-body main { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); overflow-x: hidden; }
  .admin-body main table { font-size: 13px; }
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
img, video, canvas { max-width: 100%; }

/* Browser datati: fallback per unità dvh e blocchi flex con contenuto largo */
@supports not (height: 100dvh) { .h-\[100dvh\] { height: 100vh !important; } .max-h-\[80dvh\] { max-height: 80vh; } }
.admin-body main form { max-width: 100%; }
/* Banner installazione app */
.install-banner { position: fixed; left: 12px; right: 12px; z-index: 44; bottom: calc(12px + env(safe-area-inset-bottom)); background: #151515; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; padding: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5); max-width: 460px; margin: 0 auto; color: #fff; }
aside nav .svg-sm, aside nav svg { width: 18px; height: 18px; flex-shrink: 0; }
