/*
  Khung Shell mobile/tablet (A-02): header rut gon + hamburger mo drawer off-canvas +
  bottom nav 5 muc. Chi ap dung duoi 1024px — tren 1024px giu nguyen shell desktop (A-01).
  Chi dung bien token khai bao trong tokens.css — khong hard-code ma mau.
*/

@media (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    display: none;
  }

  .content {
    padding: 16px 16px calc(84px + env(safe-area-inset-bottom, 0px));
  }

  /* Header rut gon */
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 58px;
    padding: 0 10px;
    background: var(--pri-800);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .mobile-topbar-hamburger {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
  }

  .mobile-topbar-hamburger:hover,
  .mobile-topbar-hamburger:active {
    background: rgba(255, 255, 255, .15);
  }

  .mobile-topbar-title {
    flex: 1;
    min-width: 0;
  }

  .mobile-topbar-title strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-topbar .icon-btn {
    background: transparent;
    border-color: transparent;
    color: #fff;
  }

  .mobile-topbar .icon-btn:hover {
    background: rgba(255, 255, 255, .15);
    color: #fff;
  }

  .mobile-topbar .dropdown {
    top: 48px;
    right: 8px;
  }

  /* Scrim + Drawer off-canvas */
  .mobile-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(6, 12, 20, .55);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }

  .mobile-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 82%;
    max-width: 300px;
    background: linear-gradient(180deg, var(--pri-800), var(--pri-900));
    color: #D6E1EE;
    z-index: 61;
    transform: translateX(-102%);
    transition: transform .24s ease;
  }

  .mobile-drawer.is-open {
    transform: translateX(0);
  }

  .mobile-drawer .brand {
    border-bottom-color: rgba(255, 255, 255, .14);
  }

  .mobile-drawer .nav {
    flex: 1;
  }

  .mobile-drawer-foot {
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, .14);
  }

  .mobile-drawer-foot .user {
    width: 100%;
    border-color: rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .06);
  }

  .mobile-drawer-foot .user:hover {
    background: rgba(255, 255, 255, .12);
  }

  .mobile-drawer-foot .u-name {
    color: #fff;
  }

  .mobile-drawer-foot .u-role {
    color: #D6E1EE;
  }

  .mobile-drawer-foot .dropdown {
    top: auto;
    bottom: 52px;
  }

  /* Bottom nav — 5 muc thao tac nhanh theo vai tro */
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 40;
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
  }

  .bottom-nav-item.active {
    color: var(--pri-700);
  }

  .bottom-nav-fab {
    margin-top: -16px;
  }

  .bottom-nav-fab-circle {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin-bottom: 2px;
    border-radius: 999px;
    background: var(--pri-700);
    color: #fff;
    box-shadow: 0 6px 16px rgba(185, 28, 28, .5);
  }
}
