/* AquaPiol mobile layer for the unified platform: drawer sidebar, safe areas
   and small-screen layout fixes. Loaded after app.css. */

.mobile-nav-btn { display: none; }

@media (max-width: 900px) {
  body { overflow-x: hidden; }

  .layout { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 70;
    width: min(84vw, 300px);
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-right: 0;
    border-bottom: 0;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .22s ease, visibility .22s ease;
    box-shadow: 0 24px 70px rgba(4, 20, 24, .45);
  }
  html.nav-open .sidebar { transform: none; visibility: visible; }

  .side-nav { flex-direction: column; overflow: visible; padding-bottom: 0; }
  .side-link { flex: 0 0 auto; white-space: normal; }
  .side-foot { flex-direction: column; align-items: stretch; margin-top: auto; }
  .side-foot form { margin-left: 0; }
  .btn-side { width: 100%; }

  .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(6, 24, 26, .55);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
  }
  html.nav-open .mobile-backdrop { opacity: 1; visibility: visible; }
  html.nav-open,
  html.nav-open body { overflow: hidden; }

  .mobile-nav-btn {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--brand-dark);
    cursor: pointer;
  }
  .mobile-nav-btn:focus-visible { outline: 3px solid rgba(15, 118, 110, .45); outline-offset: 2px; }

  .wrap { width: min(1180px, calc(100% - 28px)); }
  .topbar-inner { flex-wrap: wrap; gap: 10px; }
  .topbar-inner .brand { min-width: 0; }
  .topbar-inner .brand-sub { display: none; }
  .topbar-title { min-width: 0; }
  .topbar-inner .btn-ghost { white-space: nowrap; }
  .admin-wrap { width: min(1180px, calc(100% - 28px)); }
}

@media (max-width: 560px) {
  .topbar-inner .btn-ghost { padding: 9px 11px; font-size: 13px; }
  .hero h1 { font-size: clamp(25px, 8vw, 32px); }
  .panel { padding: 16px; }
  /* 16px prevents iOS Safari from zooming the page when a field is focused. */
  html .field input,
  html .field select,
  html .field textarea { font-size: 16px; }
}

@supports (padding: max(0px)) {
  .wrap,
  .admin-wrap {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}
