html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img,
video,
iframe {
  max-width: 100%;
}

.mobile-admin-toggle,
.mobile-admin-close,
.mobile-admin-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .container {
    width: 100%;
  }

  #mobile-menu {
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    border-top: 1px solid #e5e7eb;
  }

  nav h1 {
    max-width: 220px;
    font-size: 1.15rem !important;
    line-height: 1.25;
  }

  section,
  main {
    overflow-x: hidden;
  }

  .grid {
    min-width: 0;
  }

  .text-5xl,
  .text-6xl,
  .text-7xl {
    font-size: clamp(2rem, 11vw, 3.2rem) !important;
    line-height: 1.08 !important;
  }

  .text-4xl {
    font-size: clamp(1.8rem, 9vw, 2.5rem) !important;
    line-height: 1.15 !important;
  }

  .py-24 {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
  }

  .px-6 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  footer .grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 1100px) {
  .admin-shell {
    display: block;
    min-height: 100vh;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 80;
  }

  .admin-sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-admin-backdrop {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(15, 23, 42, 0.52);
    opacity: 0;
    visibility: hidden;
    transition: 0.2s ease;
    z-index: 70;
  }

  .mobile-admin-backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }

  .mobile-admin-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    background: var(--bg-soft);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    flex: 0 0 auto;
  }

  .mobile-admin-toggle span {
    position: relative;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
  }

  .mobile-admin-toggle span::before,
  .mobile-admin-toggle span::after {
    content: "";
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
  }

  .mobile-admin-toggle span::before {
    top: -7px;
  }

  .mobile-admin-toggle span::after {
    top: 7px;
  }

  .mobile-admin-close {
    margin-left: auto;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.16);
    font-size: 28px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    flex: 0 0 auto;
  }

  .mobile-admin-close:hover {
    background: rgba(255, 255, 255, 0.26);
  }

  .admin-main {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar > div:first-child {
    min-width: 0;
  }

  .page-subtitle {
    max-width: 100%;
  }

  body.admin-menu-open {
    overflow: hidden;
  }
}

@media (max-width: 720px) {
  .admin-main {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    gap: 14px;
  }

  .topbar > div:first-child {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 12px;
    width: 100%;
  }

  .page-title,
  .page-subtitle {
    grid-column: 2;
  }

  .page-title {
    font-size: clamp(1.45rem, 7vw, 2rem);
  }

  .page-subtitle {
    margin-top: 4px;
    font-size: 13px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
    gap: 10px;
  }

  .topbar-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .content-card {
    padding: 16px;
    border-radius: 20px;
  }

  .table-header {
    gap: 12px;
  }

  .table-header .btn,
  .form-actions .btn {
    width: 100%;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  table.admin-table {
    min-width: 760px;
  }

  .login-shell {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  .admin-main {
    padding: 12px;
  }

  .content-card {
    padding: 14px;
    border-radius: 18px;
  }

  .admin-profile-dropdown {
    right: -2px;
    width: calc(100vw - 24px);
  }

  .login-body {
    padding: 12px;
  }

  .login-hero {
    min-height: 230px;
  }

  .login-hero,
  .login-panel {
    padding: 24px 20px;
  }

  .panel-header h2 {
    font-size: 26px;
  }

  .theme-toggle {
    right: 12px;
    top: 12px;
  }
}
