@media (max-width: 960px) {
  :root {
    --shell-mobile-safe-top: max(8px, env(safe-area-inset-top, 0px));
    --shell-mobile-safe-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

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

  .layout.sidebar-expanded,
  .layout.sidebar-pinned {
    grid-template-columns: 1fr;
  }

  .content {
    height: 100dvh;
    min-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
  }

  .topbar-right {
    min-width: 0;
    gap: 8px;
  }

  .topbar {
    padding: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }

  .topbar-search-slot {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
  }

  .admin-global-search-panel {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 66px;
    width: auto;
    max-height: min(72vh, 560px);
  }

  .topbar-brand-block {
    gap: 0;
  }

  .topbar-title-row {
    gap: 10px;
  }

  .topbar-brand-title {
    font-size: 18px;
    line-height: 1.05;
  }

  .topbar-inline-help-slot:not(:empty) {
    display: inline-flex;
  }

  .topbar-inline-help-slot .inline-help-btn {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }

  .topbar-panel-name {
    display: none;
  }

  .topbar-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .topbar-panel-picker {
    display: none !important;
  }

  .admin-live-wrap,
  .admin-message-wrap,
  .admin-voice-wrap {
    position: static;
  }

  .admin-live-dropdown {
    position: fixed;
    top: 68px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }

  .admin-toast-root,
  .admin-live-toast-root {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
  }

  .admin-toast,
  .admin-live-toast {
    min-width: 0;
    width: auto;
    max-width: none;
  }

  .layout > .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(82vw, 312px);
    height: 100dvh;
    max-height: 100dvh;
    border-right: 1px solid #dbe3ee;
    border-bottom: 0;
    transform: translateX(-104%);
    transition: transform 220ms ease;
    z-index: calc(var(--shell-z-topbar) + 12);
    box-shadow: 8px 0 28px rgba(2, 6, 23, 0.35);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: calc(var(--shell-mobile-safe-top) + 12px) 10px var(--shell-mobile-safe-bottom);
    margin-right: 0;
  }

  .layout:not(.sidebar-pinned) > .sidebar,
  .layout.sidebar-expanded:not(.sidebar-pinned) > .sidebar,
  .layout.sidebar-pinned > .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    align-self: auto;
    height: 100dvh;
    max-height: 100dvh;
    z-index: calc(var(--shell-z-topbar) + 12);
    margin-right: 0;
  }
  .sidebar-inner {
    min-height: auto;
    gap: 8px;
    padding-bottom: 8px;
  }

  .sidebar .sidebar-brand-row {
    justify-content: flex-start;
    padding: 4px 6px 12px;
  }

  .sidebar .sidebar-brand-main {
    justify-content: flex-start;
    gap: 12px;
    width: auto;
  }

  .sidebar .sidebar-mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar .sidebar-logo {
    display: none;
  }

  .sidebar .nav-label {
    margin: 8px 8px 4px;
    font-size: 10px;
  }

  .sidebar .nav-label,
  .sidebar .nav-text,
  .sidebar .chev,
  .sidebar .sidebar-brand-text {
    opacity: 1;
    visibility: visible;
    width: auto;
    pointer-events: auto;
  }

  .sidebar .nav-link,
  .sidebar .nav-section-head {
    justify-content: flex-start;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px;
  }

  .sidebar .nav-head-main {
    justify-content: flex-start;
  }

  .sidebar .nav-section.open .nav-section-body {
    display: block;
  }

  .sidebar .nav-link.child {
    min-height: 34px;
    padding-left: 30px;
    font-size: 13px;
  }

  .sidebar .sidebar-pin-btn {
    display: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0%);
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: calc(var(--shell-z-topbar) + 6);
  }

  .mobile-nav-backdrop.show {
    display: block;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  body.mobile-nav-open .topbar {
    pointer-events: none;
  }

  .admin-live-btn .label {
    display: none;
  }

  .admin-live-btn {
    padding: 0 8px;
  }
}

@media (max-width: 640px) {
  .topbar,
  .topbar.show {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
  }

  .topbar-left {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .topbar-right {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    justify-content: flex-end;
  }

  .topbar-search-slot {
    grid-column: 1 / -1;
    grid-row: 2;
    order: initial;
    width: 100%;
    min-width: 0;
  }

  .topbar-brand-title {
    max-width: calc(100vw - 148px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-global-search-panel {
    top: calc(var(--shell-mobile-safe-top, 8px) + 108px);
    max-height: calc(100dvh - var(--shell-mobile-safe-top, 8px) - 126px);
  }

  .layout > .sidebar {
    width: min(88vw, 340px);
  }
}
