.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(31, 36, 48, 0.15);
  background: var(--panel);
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 999px;
}

.sidenav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

body.nav-open {
  overflow: hidden;
}

@media (max-width: 960px) {
  .nav-toggle {
    display: flex; /* IMPORTANT: when visible */
    flex-direction: column; /* ✅ makes 3 lines vertical */
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 260px;
    max-width: 82%;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
    overflow-y: auto;
  }

  .app-shell.is-nav-open .sidebar {
    transform: translateX(0);
  }

  .sidenav-backdrop {
    display: block;
  }

  .app-shell.is-nav-open .sidenav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    width: 100%;
    min-width: 0;
  }

  .hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .topbar h1 {
    font-size: 26px;
  }

  .card__row {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    min-width: 0;
  }

  .topbar__actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar__actions > * {
    width: 100%;
    justify-content: center;
  }

  .actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .actions > * {
    width: 100%;
  }

  .actions input,
  .actions select,
  .actions button {
    width: 100%;
    max-width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .sidebar {
    width: 280px;
    max-width: calc(100% - 16px);
    padding: var(--space-3);
  }

  .main {
    padding: var(--space-3);
  }

  .card {
    padding: var(--space-4);
  }

  .brand__mark {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .topbar__actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar__actions > * {
    width: 100%;
    justify-content: center;
  }

  .sidebar__footer {
    display: none;
  }
}

@media (max-width: 420px) {
  .topbar h1 {
    font-size: 22px;
  }

  .card {
    padding: var(--space-3);
  }

  .brand__text {
    display: none;
  }

  .btn {
    padding: 9px 14px;
  }

  .pill {
    font-size: 11px;
    padding: 4px 10px;
  }

  .nav-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .nav-toggle span {
    width: 16px;
  }

  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }
}
