/* БЛОК: Файлы на телефоне — компактная сетка и список */

@media (max-width: 768px) {
  body.is-mobile .main {
    margin: 8px 8px 12px;
    border-radius: 10px;
  }

  /* Сортировка / вид */
  body.is-mobile .file-controls {
    padding: 0 8px 6px;
  }
  body.is-mobile .file-controls-inner {
    gap: 4px;
  }
  body.is-mobile .file-control-btn {
    padding: 6px 8px;
    font-size: 12px;
    min-height: 34px;
    border-radius: 8px;
  }
  body.is-mobile .file-control-btn .ctrl-icon {
    width: 16px;
    height: 16px;
  }
  body.is-mobile .file-control-btn .ctrl-chevron {
    width: 12px;
    height: 12px;
  }
  body.is-mobile .file-control-btn span:not(.item-check) {
    max-width: 5.5em;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Режим «Значки» */
  body.is-mobile .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 6px;
    padding: 6px 8px 12px;
  }
  body.is-mobile .grid-item {
    padding: 6px 4px 5px;
    border-radius: 8px;
  }
  body.is-mobile .grid-icon-wrap {
    width: 40px;
    height: 40px;
    font-size: 20px;
    margin-bottom: 4px;
    border-radius: 8px;
  }
  body.is-mobile .grid-name {
    font-size: 11px;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  body.is-mobile .grid-meta {
    font-size: 10px;
    margin-top: 2px;
  }

  /* Режим «Таблица» — компактные строки, без кнопок в карточке */
  body.is-mobile .file-table tbody {
    padding: 6px 8px 10px;
  }
  body.is-mobile .file-table tr {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 10px;
    box-shadow: none;
  }
  body.is-mobile .file-table tr:last-child {
    margin-bottom: 0;
  }
  body.is-mobile .file-table td {
    display: block;
    padding: 0;
    border: none;
  }
  body.is-mobile .file-table td:first-child {
    padding: 0;
  }
  body.is-mobile .file-item-name {
    gap: 8px;
    align-items: center;
  }
  body.is-mobile .file-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-radius: 6px;
    flex-shrink: 0;
  }
  body.is-mobile .file-icon.img {
    width: 32px;
    height: 32px;
  }
  body.is-mobile .file-name {
    font-size: 14px;
    line-height: 1.3;
    font-weight: 500;
    word-break: break-word;
  }
  body.is-mobile .file-table td:nth-child(2),
  body.is-mobile .file-table td:nth-child(3) {
    display: inline;
    font-size: 11px;
    color: var(--yd-text-muted);
    line-height: 1.35;
  }
  body.is-mobile .file-table td:nth-child(2)::before,
  body.is-mobile .file-table td:nth-child(3)::before {
    display: none;
  }
  body.is-mobile .file-table td:nth-child(2)::after {
    content: ' · ';
    color: var(--yd-text-muted);
  }
  body.is-mobile .file-size,
  body.is-mobile .file-date {
    font-size: 11px;
  }
  /* Действия: long-press / меню «⋯» — не дублируем кнопками в строке */
  body.is-mobile .file-table td:last-child {
    display: none !important;
  }
  body.is-mobile .file-actions {
    display: none !important;
  }

  body.is-mobile .empty-state {
    padding: 40px 16px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  body.is-mobile .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 5px;
  }
  body.is-mobile .grid-icon-wrap {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  body.is-mobile .file-name {
    font-size: 13px;
  }
}
