/* mobile.css — Nexus responsive layout (MOBILE_TZ.md) */

/* === Tablet (≤1024px) — scroll-friendly tables, no desktop regressions === */
@media (max-width: 1024px) {
  .rd-table-wrap,
  .st-table-wrap,
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* === Base rules (≤768px) === */
@media (max-width: 768px) {
  body.authenticated {
    padding-top: 52px;
  }

  /* Мессенджер сам управляет своим скроллом (внутренние панели).
     Запрещаем внешнюю прокрутку body, иначе на телефонах из-за
     dvh-квирков/субпикселей появляется лишний вертикальный скролл. */
  body.mx-body {
    overflow: hidden;
  }



  input,
  select,
  textarea,
  .form-control {
    min-height: 40px;
    font-size: 16px;
  }

  .btn,
  .rd-btn,
  .fb-btn,
  .st-btn,
  button.rd-btn,
  a.rd-btn {
    min-height: 40px;
    min-width: 40px;
  }

  input:focus,
  select:focus,
  textarea:focus,
  .btn:focus,
  .rd-btn:focus,
  .fb-btn:focus,
  .st-btn:focus,
  .nx-burger:focus,
  .nx-nav-link:focus {
    outline: 2px solid var(--rd-accent, #2563eb);
    outline-offset: 2px;
  }

  .modal-content {
    max-width: 92%;
    margin: 1rem auto;
  }

  .st-modal {
    max-width: 92%;
    width: 92%;
  }

  .rd-page-actions,
  .rd-bulk-bar,
  .st-page-actions,
  .st-action-row,
  .actions,
  .form.inline {
    flex-wrap: wrap;
  }

  .rd-page-actions .rd-btn,
  .st-page-actions .st-btn {
    flex: 1 1 auto;
  }

  /* Messenger (/messages/) — full-bleed shell (details in messages.css) */
  .mx-page .mx-search-field input,
  .mx-page .mx-search-select,
  .mx-page .mx-composer textarea {
    font-size: 16px;
  }
}

/* === Base rules (≤480px) === */
@media (max-width: 480px) {
  body.authenticated {
    padding-top: 48px;
  }



  input,
  select,
  textarea,
  .form-control {
    min-height: 44px;
  }

  .btn,
  .rd-btn,
  .fb-btn,
  .st-btn,
  button.rd-btn,
  a.rd-btn {
    min-height: 10px;
    min-width: 10px;
  }

  .modal-content,
  .st-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    max-width: none;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
  }

  .st-modal-backdrop .st-modal {
    max-height: 100vh;
    overflow-y: auto;
  }
}

/* === Navbar / burger (≤768px) === */
.nx-burger,
.nx-mobile-drawer,
.nx-mobile-backdrop,
.nx-nav-tools-mobile,
.fb-sidebar-toggle,
.st-sidebar-toggle,
.fb-sidebar-backdrop,
.st-sidebar-backdrop {
  display: none;
}

/* На десктопе контейнер действий тулбара прозрачен — кнопки flow как обычно */
.fb-toolbar-actions {
  display: contents;
}

.nx-nav-chevron {
  font-size: 8px;
  margin-left: 2px;
}

@media (max-width: 768px) {
  .nx-navbar {
    height: 52px;
  }

  .nx-nav--desktop,
  .nx-nav-tools-desktop {
    display: none !important;
  }

  .nx-nav-right {
    margin-left: auto;
    gap: 6px;
    align-items: center;
  }

  .nx-nav-tools-mobile {
    display: flex;
    align-items: center;
    flex-shrink: 0;
  }

  .nx-nav-tools-mobile .nx-notification-dd {
    position: relative;
  }

  .nx-nav-tools-mobile .nx-bell {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }

  .nx-nav-tools-mobile .nx-dropdown-menu.nx-notification-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: min(300px, calc(100vw - 16px));
    width: min(300px, calc(100vw - 16px));
    max-width: calc(100vw - 16px);
    max-height: min(62vh, 440px);
    overflow-y: auto;
    display: block;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .nx-nav-tools-mobile .nx-notification-dd.nx-open .nx-dropdown-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .nx-nav-tools-mobile .nx-notification-dd::after {
    display: none;
  }

  .nx-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    cursor: pointer;
    flex-shrink: 0;
  }

  /* Drawer справа → выезжает справа налево */
  .nx-mobile-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 52px;
    right: 0;
    left: auto;
    bottom: 0;
    width: min(300px, 88vw);
    max-width: 100vw;
    z-index: 1045;
    background: rgba(15, 23, 42, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 0.22s ease;
    overflow: hidden;
    box-sizing: border-box;
  }

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

  body.nx-mobile-nav-open .nx-mobile-drawer,
  body.nx-mobile-nav-open .nx-mobile-drawer[aria-hidden="false"] {
    transform: translateX(0);
  }

  .nx-mobile-drawer-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
  }

  .nx-mobile-drawer-title {
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
  }

  .nx-mobile-drawer-body {
    flex: 1;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding: 10px 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
  }

  .nx-mobile-drawer-body,
  .nx-mobile-drawer-body * {
    box-sizing: border-box;
  }

  /* Верх drawer: тема и аккаунт (отдельно от desktop navbar) */
  .nx-mobile-drawer-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
  }

  .nx-mobile-tool {
    width: 100%;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    padding: 10px 12px;
  }

  .nx-mobile-tool-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #94a3b8;
  }

  .nx-mobile-tool-title i {
    font-size: 13px;
    color: #cbd5e1;
  }

  .nx-mobile-theme-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    min-width: 0;
  }

  .nx-mobile-theme-mode {
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    min-width: 42px;
  }

  .nx-mobile-theme-mode--dark {
    text-align: left;
  }

  html[data-theme="dark"] .nx-mobile-theme-mode:first-of-type,
  html.dark .nx-mobile-theme-mode:first-of-type {
    opacity: 0.55;
  }

  html[data-theme="light"] .nx-mobile-theme-mode--dark,
  html.light .nx-mobile-theme-mode--dark {
    opacity: 0.55;
  }

  html[data-theme="dark"] .nx-mobile-theme-mode--dark,
  html.dark .nx-mobile-theme-mode--dark {
    color: #f1f5f9;
    opacity: 1;
  }

  html[data-theme="light"] .nx-mobile-theme-mode:first-of-type,
  html.light .nx-mobile-theme-mode:first-of-type {
    color: #f1f5f9;
    opacity: 1;
  }

  .nx-mobile-tool--theme .theme-switch {
    flex-shrink: 0;
  }

  .nx-mobile-tool--account {
    position: relative;
    padding: 0;
    border: none;
    background: transparent;
  }

  .nx-mobile-account-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    cursor: pointer;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
  }

  .nx-mobile-account-btn:hover {
    background: rgba(255, 255, 255, 0.07);
  }

  .nx-mobile-tool--account.is-open .nx-mobile-account-btn {
    border-color: rgba(37, 99, 235, 0.45);
    background: rgba(37, 99, 235, 0.15);
  }

  .nx-mobile-account-avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .nx-mobile-account-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .nx-mobile-account-caption {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
  }

  .nx-mobile-account-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nx-mobile-account-chevron {
    flex-shrink: 0;
    font-size: 12px;
    color: #94a3b8;
    transition: transform 0.2s ease;
  }

  .nx-mobile-tool--account.is-open .nx-mobile-account-chevron {
    transform: rotate(180deg);
    color: #93c5fd;
  }

  .nx-mobile-account-menu {
    display: none;
    margin-top: 6px;
    padding: 4px 0 2px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.6);
  }

  .nx-mobile-tool--account.is-open .nx-mobile-account-menu {
    display: block;
  }

  .nx-mobile-account-menu .nx-mobile-menu-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 6px;
  }

  .nx-mobile-account-menu .nx-mobile-menu-link:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
  }

  .nx-mobile-menu-link--danger {
    color: #f87171;
  }

  .nx-mobile-menu-link--danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
  }

  /* Строка темы внутри аккаунт-меню (перенесена из отдельного блока drawer'а) */
  .nx-mobile-menu-theme {
    cursor: default;
  }

  .nx-mobile-menu-theme-switch {
    margin-left: auto;
    flex-shrink: 0;
  }

  /* Сброс desktop .nx-nav { margin: 0 16px } — иначе горизонтальный скролл в drawer */
  .nx-nav.nx-nav--drawer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 !important;
    padding: 0;
    flex: none;
  }

  .nx-nav--drawer .nx-mobile-nav-item,
  .nx-nav--drawer .nx-mobile-nav-group {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .nx-nav--drawer .nx-mobile-nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: left;
  }

  .nx-nav--drawer .nx-mobile-nav-item:hover,
  .nx-nav--drawer .nx-mobile-nav-item.active {
    color: #f1f5f9;
    background: rgba(37, 99, 235, 0.22);
    text-decoration: none;
  }

  .nx-mobile-nav-group-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding-right: 14px;
    box-sizing: border-box;
  }

  .nx-nav--drawer .nx-mobile-nav-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    min-width: 0;
    text-align: left;
  }

  .nx-nav--drawer .nx-mobile-nav-main:hover,
  .nx-nav--drawer .nx-mobile-nav-main.active {
    color: #f1f5f9;
    background: rgba(37, 99, 235, 0.22);
    text-decoration: none;
  }

  .nx-mobile-nav-toggle {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: 2px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .nx-mobile-nav-toggle i {
    font-size: 13px;
    pointer-events: none;
  }

  .nx-mobile-nav-group.is-open .nx-mobile-nav-toggle {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
  }

  /* Подменю: сброс глобального .nx-dropdown-menu (visibility:hidden) */
  .nx-nav--drawer .nx-dropdown-menu.nx-mobile-nav-sub {
    display: none !important;
    position: static !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 2px 8px 4px 20px;
    border: none;
    box-shadow: none;
    background: transparent;
    backdrop-filter: none;
  }

  .nx-mobile-nav-group.is-open .nx-dropdown-menu.nx-mobile-nav-sub {
    display: block !important;
  }

  .nx-nav--drawer .nx-mobile-nav-sub .nx-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    font-size: 13px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 6px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
  }

  .nx-nav--drawer .nx-nav-link,
  .nx-nav--drawer .nx-dropdown-item {
    white-space: normal;
  }

  .nx-nav--drawer .nx-mobile-nav-sub .nx-dropdown-item:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
  }

  .nx-mobile-backdrop {
    display: block;
    position: fixed;
    inset: 52px 0 0 0;
    z-index: 1040;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .nx-mobile-backdrop:not([hidden]) {
    pointer-events: auto;
    opacity: 1;
  }

  body.nx-mobile-nav-open .nx-burger {
    background: rgba(37, 99, 235, 0.35);
    border-color: rgba(147, 197, 253, 0.45);
    color: #fff;
  }
}

@media (min-width: 769px) {
  .nx-mobile-drawer,
  .nx-mobile-backdrop,
  .nx-burger,
  .nx-nav-tools-mobile,
  .nx-mobile-drawer-top {
    display: none !important;
  }

  /* Desktop navbar tools — всегда в шапке, порядок: тема → уведомления → пользователь */
  #nxNavToolsDesktop {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
  }

  #nxNavToolsDesktop .nx-theme-wrap {
    display: flex;
    align-items: center;
  }

  #nxNavToolsDesktop .nx-user-dd {
    display: flex;
    align-items: center;
  }

  #nxNavToolsDesktop .nx-user-dd .nx-dropdown-menu {
    left: auto;
    right: 0;
  }
}

@media (max-width: 480px) {
  .nx-navbar {
    height: 48px;
  }

  .nx-mobile-drawer {
    top: 48px;
  }

  .nx-mobile-backdrop {
    inset: 48px 0 0 0;
  }

  .nx-brand-text {
    display: none;
  }
}

/* === Tables → cards (≤480px) === */
@media (max-width: 480px) {
  table[data-mobile-cards] thead {
    display: none;
  }

  table[data-mobile-cards] tbody tr {
    display: block;
    margin-bottom: 8px;
    padding: 12px;
    border: 1px solid var(--rd-border);
    border-radius: 8px;
    background: var(--rd-surface);
  }

  table[data-mobile-cards] tbody td {
    display: block;
    padding: 4px 0;
    border: none;
  }

  table[data-mobile-cards] tbody td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--rd-muted);
    margin-right: 6px;
  }

  table[data-mobile-cards] tbody td.col-check::before,
  table[data-mobile-cards] tbody td[data-label=""]::before {
    content: none;
  }

  table[data-mobile-cards] tbody td.col-check {
    padding-bottom: 8px;
  }
}

/* === Dashboard === */
@media (max-width: 768px) {
  .nx-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nx-quick-list .nx-quick-link {
    flex-direction: row;
  }
}

@media (max-width: 480px) {
  .nx-module-grid {
    grid-template-columns: 1fr;
  }

  .nx-quick-list {
    padding-left: 12px;
    padding-right: 12px;
  }

  .nx-quick-list li + li {
    margin-top: 6px;
  }

  .nx-quick-link {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

/* === Tickets list === */
@media (max-width: 768px) {
  .rd-filters {
    position: sticky;
    top: 52px;
    z-index: 20;
    flex-wrap: wrap;
    padding: 8px 0;
    background: var(--rd-bg, #f3f4f6);
  }

  .rd-pagination a,
  .rd-pagination span {
    min-height: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
  }
}

@media (max-width: 480px) {
  .rd-filters {
    top: 48px;
  }

  .rd-pagination a,
  .rd-pagination span {
    min-height: 44px;
    min-width: 44px;
  }
}

/* === Ticket detail === */
@media (max-width: 768px) {
  .rd-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .rd-header-badges {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .rd-header-actions {
    flex-wrap: wrap;
  }

  .rd-comment-form textarea,
  .rd-edit-main textarea {
    width: 100%;
  }

  .rd-attachments .rd-attach-item {
    min-height: 56px;
  }

  .rd-attach-thumb,
  .rd-attach-file-icon {
    width: 48px;
    height: 48px;
  }
}

/* === Files browser === */
.fb-sidebar-toggle,
.fb-sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .fb-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 12px;
    margin-right: 8px;
    border: 1px solid var(--rd-border);
    border-radius: 6px;
    background: var(--rd-surface);
    color: var(--rd-text);
    cursor: pointer;
    flex-shrink: 0;
  }

  .fb-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 52px 0 0 0;
    z-index: 1024;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .fb-sidebar-backdrop:not([hidden]) {
    pointer-events: auto;
    opacity: 1;
  }

  .fb-wrap .fb-sidebar {
    display: flex !important;
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: min(280px, 88vw);
    z-index: 1025;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.2);
  }

  body.fb-sidebar-open .fb-wrap .fb-sidebar {
    transform: translateX(0);
  }

  .fb-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .fb-toolbar > * {
    flex: 0 1 auto;
    min-width: 0;
  }

  /* Действия (Новая папка / Загрузить / шаринг) — отдельной нижней строкой,
     под рядом «домой + вид просмотра». Кнопки рядом, делят ширину. */
  .fb-toolbar-actions {
    display: flex;
    flex: 1 1 100%;
    gap: 6px;
    flex-wrap: wrap;
  }
  .fb-toolbar-actions .fb-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .fb-toolbar-actions .fb-btn-icon {
    flex: 0 0 auto;
  }
}

@media (max-width: 480px) {
  .fb-sidebar-backdrop {
    inset: 48px 0 0 0;
  }

  .fb-wrap .fb-sidebar {
    top: 48px;
  }

  .fb-sidebar-toggle {
    min-height: 44px;
  }

  .fb-grid {
    grid-template-columns: 1fr !important;
  }

  /* Список влезает по ширине без горизонтального скролла:
     прячем size (user/date уже скрыты в files-browser.css ≤768),
     остаётся чекбокс/иконка/имя/действия. */
  .fb-list {
    overflow-x: hidden;
  }

  .fb-list-hdr,
  .fb-list-row {
    min-width: 0;
  }

  .fb-list-size,
  .fb-list-hdr-size {
    display: none;
  }

  /* Ничто внутри браузера файлов не должно растягивать страницу вправо */
  .fb-wrap,
  .fb-main {
    min-width: 0;
    max-width: 100%;
  }
}

/* === Storage === */
.st-sidebar-toggle,
.st-sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .st-layout {
    grid-template-columns: 1fr !important;
  }

  .st-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 40px;
    min-height: 40px;
    padding: 0;
    margin-bottom: 12px;
    align-self: flex-start;
    border: 1px solid var(--rd-border);
    border-radius: 6px;
    background: var(--rd-surface);
    color: var(--rd-text);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
  }

  .st-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 52px 0 0 0;
    z-index: 1024;
    background: rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
  }

  .st-sidebar-backdrop:not([hidden]) {
    pointer-events: auto;
    opacity: 1;
  }

  .st-sidebar {
    display: flex !important;
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 0;
    width: min(280px, 88vw);
    z-index: 1025;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.2);
  }

  body.st-sidebar-open .st-sidebar {
    transform: translateX(0);
  }

  .st-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .st-widgets {
    grid-template-columns: 1fr !important;
  }

  .st-tool-card {
    flex-direction: column;
    align-items: stretch;
  }

  .st-tool-card .st-action-row,
  .st-tool-card .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .st-tool-card .st-btn,
  .st-tool-card .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .st-sidebar {
    top: 48px;
  }

  .st-sidebar-backdrop {
    inset: 48px 0 0 0;
  }

  .st-sidebar-toggle {
    min-height: 44px;
    width: 44px;
  }

  .st-stat-grid {
    grid-template-columns: 1fr !important;
  }
}

/* === Messages === */
@media (max-width: 768px) {
  .msg-bubble,
  .dm-msg-bubble,
  .nx-msg-bubble {
    max-width: 85%;
  }
}

/* === Storage integrations (photo reports) === */
@media (max-width: 480px) {
  .si-reports-table[data-mobile-cards] tbody tr {
    display: block;
  }
}

/* === Mobile paths / breadcrumbs === */
.fb-mobile-back {
  display: none;
}

@media (max-width: 768px) {
  .nx-page-content [class*="breadcrumb"],
  .nx-page-content nav[aria-label="breadcrumb"] {
    display: none !important;
  }

  .fb-mobile-back {
    display: inline-flex;
    flex: 0 0 42px;
    width: 42px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 16px;
  }
}
