/* Адаптивный каркас и общие правила доступности. */
@media (max-width: 980px) {
  .sidebar {
    height: 60px;
    flex-wrap: nowrap;
    padding: 12px 16px;
  }

  .nav {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  .mobile-nav {
    display: block;
  }

  .content {
    width: calc(100% - 32px);
    padding: 20px 0 40px;
  }

  .documents-row {
    grid-template-columns: minmax(200px, 1fr) 86px 112px 156px;
  }

  .documents-head > span:nth-child(4),
  .documents-head > span:nth-child(5),
  .documents-head > span:nth-child(6),
  .documents-row > span:nth-child(4),
  .documents-row > span:nth-child(5),
  .documents-row > span:nth-child(6) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 960px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-count {
    display: none;
  }
}

@media (max-width: 720px) {
  .filter-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .search-box {
    grid-column: 1 / -1;
    width: 100%;
  }

  .filter-right {
    grid-column: 1 / -1;
    margin-left: 0;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .documents-table {
    overflow: hidden;
  }

  .documents-head {
    display: none;
  }

  .document-record {
    border-top: 1px solid var(--border-subtle);
  }

  .document-record:first-of-type {
    border-top: 0;
  }

  .documents-row {
    grid-template-columns: minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    align-items: start;
    gap: 10px 12px;
    padding: 14px 16px;
  }

  .documents-row > span:nth-child(1) {
    grid-column: 1 / -1;
  }

  .documents-row > span:nth-child(2) {
    grid-column: 1;
  }

  .documents-row > span:nth-child(3) {
    grid-column: 2;
    justify-self: end;
  }

  .documents-row > span:nth-child(4),
  .documents-row > span:nth-child(5),
  .documents-row > span:nth-child(6) {
    display: none;
  }

  .document-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-top: 10px;
    border-top: 1px solid var(--border-subtle);
  }

}

@media (max-width: 480px) {
  .tab-row {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .tab-row::-webkit-scrollbar {
    display: none;
  }

  .tab-item {
    flex: 0 0 auto;
    padding: 10px 8px;
    font-size: 13px;
    gap: 5px;
  }

  .topbar {
    flex-direction: column;
    gap: 12px;
  }

  .topbar .primary {
    width: 100%;
  }
}

@media (min-width: 481px) and (max-width: 980px) {
  .topbar {
    flex-direction: row;
    align-items: flex-start;
  }

  .topbar .primary {
    width: auto;
  }
}
