.mobile-notif  { display: none; }
.desktop-notif { display: flex; }
@media (max-width: 767px) {
  #screen-app { flex-direction: column; }
  .mobile-header { display: flex; }
  .mobile-notif  { display: flex; }
  .desktop-notif { display: none; }
  .sidebar-toggle { display: none; }
  .sidebar {
    position: fixed !important;
    top: 0 !important; left: 0 !important; bottom: 0 !important;
    z-index: 21;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    width: var(--sidebar-w) !important;
    min-width: var(--sidebar-w) !important;
    height: 100% !important;
    padding-left: env(safe-area-inset-left);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .main-content { height: auto; flex: 1; overflow: visible; }
  .page-content { overflow: visible; height: auto; padding: 16px; }
  .topbar { display: none; }
  .auth-container { padding: 16px; }
  .auth-card { padding: 20px; }
  .two-col         { grid-template-columns: 1fr; gap: 16px; }
  .profile-grid    { grid-template-columns: 1fr; }
  .profile-card    { position: static; }
  .stats-row       { grid-template-columns: repeat(2, 1fr); }
  .cards-row       { grid-template-columns: repeat(2, 1fr); }
  .members-grid    { grid-template-columns: repeat(2, 1fr); }
  .admin-grid      { grid-template-columns: 1fr; }
  .table-wrap { border-radius: var(--radius); }
  .data-table { font-size: 12px; min-width: 440px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .app-card-actions { flex-direction: column; align-items: stretch; }
  .app-card-actions .field-input { width: 100%; }
  .app-card-actions .btn-xs { justify-content: center; padding: 8px; font-size: 12px; }
  .quick-actions { flex-direction: column; }
  .quick-btn     { justify-content: center; }
  .form-card    { padding: 16px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn-primary { width: 100%; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%; max-height: 90vh; max-height: 90dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: slide-up-modal 0.3s ease-out;
  }
  @keyframes slide-up-modal {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .toast-container { bottom: calc(12px + env(safe-area-inset-bottom)); right: 12px; left: 12px; }
  .toast { max-width: 100%; }
  .auth-glow { width: 300px; height: 300px; }
  .prefix-manage-grid { gap: 8px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header .btn-primary, .page-header .btn-secondary { width: 100%; justify-content: center; }
  .input-row { flex-wrap: wrap; }
  .members-grid { grid-template-columns: 1fr 1fr; }
  .sidebar-user { padding: 12px; }
  .nav-item { padding: 11px 10px; }
  .sidebar-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --sidebar-w: 200px; }
  .cards-row    { grid-template-columns: repeat(3, 1fr); }
  .two-col      { gap: 16px; }
  .members-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-grid   { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 20px; }
  .topbar { padding: 0 18px; }
  .topbar-stats { display: none; }
}
@media (max-width: 399px) {
  .cards-row    { grid-template-columns: 1fr; }
  .members-grid { grid-template-columns: 1fr; }
  .stats-row    { grid-template-columns: 1fr 1fr; }
  .auth-container { padding: 12px; }
  .page-content   { padding: 12px; }
}
@media (prefers-color-scheme: light) {
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .auth-grid { animation: none; }
  .auth-glow { animation: none; }
}
@media (max-width: 767px) and (orientation: landscape) {
  .auth-container { padding: 12px; }
  .auth-logo      { margin-bottom: 16px; }
  .auth-card      { padding: 16px; }
  .modal { max-height: 95vh; max-height: 95dvh; }
}
@media (min-width: 1400px) {
  .cards-row  { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .admin-grid { grid-template-columns: repeat(3, 1fr); }
}
@supports (-webkit-touch-callout: none) {
  body { -webkit-overflow-scrolling: touch; }
  .sidebar-nav { -webkit-overflow-scrolling: touch; }
  .page-content { -webkit-overflow-scrolling: touch; }
  .modal-body   { -webkit-overflow-scrolling: touch; }
}
@supports (padding: env(safe-area-inset-top)) {
  .mobile-header {
    padding-top: max(0px, env(safe-area-inset-top));
    height: calc(var(--mobile-header-h) + env(safe-area-inset-top));
  }
  .toast-container {
    bottom: calc(20px + env(safe-area-inset-bottom));
    right: calc(20px + env(safe-area-inset-right));
  }
}
.page-content {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
@media (max-width: 767px) {
  #screen-app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
  }
  .mobile-header {
    flex-shrink: 0;
  }
  .app-body {
    flex: 1;
    overflow: hidden;
    min-height: 0;
    position: relative;
  }
  .main-content {
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .page-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding: 16px 16px 80px;
  }
}
@media (max-width: 767px) {
  .xf-profile-body {
    grid-template-columns: 1fr;
  }
  .xf-profile-sidebar {
    order: 2;
  }
  .xf-profile-top {
    flex-wrap: wrap;
    padding: 0 14px 14px;
  }
  .xf-profile-name {
    font-size: 18px;
  }
  .forum-post {
    grid-template-columns: 1fr;
  }
  .forum-post-author {
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    gap: 10px;
  }
  .forum-post-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .logs-filters {
    flex-direction: column;
    gap: 8px;
  }
  .logs-filters .field-input {
    max-width: 100% !important;
    width: 100%;
  }
  .online-user-card {
    padding: 10px 14px;
  }
}
