/* ScaryMF Share — единая тема. */

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Layout ===== */
.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}
.page-center { justify-content: center; }
.page-top { justify-content: flex-start; padding-top: 20px; }

.container {
  background: var(--container-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 800px;
  text-align: center;
  position: relative;
  transition: background 0.3s;
}
.container-narrow { max-width: 500px; padding: 3rem 2rem; }
.container-wide { max-width: 1100px; text-align: left; }
.form-wrapper { max-width: 400px; margin: 0 auto; }

/* ===== Заголовки ===== */
h1 { font-size: 1.5rem; margin: 0 0 1rem 0; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ===== Кнопки ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  color: #fff;
  background: var(--btn-primary);
}
.btn:hover { background: var(--btn-primary-hover); }
.btn-success { background: var(--btn-success); }
.btn-danger  { background: var(--btn-danger); }
.btn-ghost {
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
}
.btn-ghost:hover { background: var(--table-bg); }
.btn-block { width: 100%; }

/* ===== Форма ===== */
input[type="file"] { display: none; }
input[type="text"], select {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-color);
  font-size: 0.9rem;
}
select { margin-bottom: 15px; }

/* ===== Таблица свойств ===== */
.prop-table {
  width: 100%;
  margin: 0 auto 15px auto;
  border-collapse: collapse;
  background: var(--table-bg);
  border-radius: 8px;
  overflow: hidden;
  text-align: left;
}
.prop-table td {
  padding: 8px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}
.prop-table td:first-child { color: var(--text-muted); width: 40%; }
.prop-table td:last-child { color: var(--text-color); font-weight: 500; word-break: break-all; }

/* ===== Ошибки ===== */
.err-icon { font-size: 4rem; margin-bottom: 1rem; line-height: 1; }
.err-code {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-family: monospace;
  margin-bottom: 1rem;
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

/* ===== Переключатель темы ===== */
.theme-toggle {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  color: var(--text-color);
  transition: background 0.2s;
  z-index: 10;
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover,
.theme-toggle:focus,
.theme-toggle:active {
  background: var(--table-bg);
  outline: none;
  box-shadow: none;
}
.theme-toggle:focus-visible { outline: none; }

/* ===== Кнопка «Назад» ===== */
.back-icon {
  position: absolute;
  top: 15px;
  left: 15px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--text-color);
  text-decoration: none;
  transition: background 0.2s;
  z-index: 10;
  font-weight: bold;
  line-height: 1;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.back-icon:hover { background: var(--table-bg); }
.back-icon:focus { outline: none; }

/* ===== Пользователь ===== */
.user-info { position: absolute; top: 15px; left: 15px; z-index: 10; }
.user-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.user-link:hover { background: var(--table-bg); border-color: var(--btn-primary); }
.user-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 5px;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  min-width: 180px;
  overflow: hidden;
  z-index: 100;
}
.user-menu.open { display: block; }
.user-menu a {
  display: block;
  padding: 10px 15px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.85rem;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.user-menu a:hover { background: var(--table-bg); }
.user-menu .logout { color: var(--btn-danger); }
.user-email {
  display: block;
  padding: 8px 15px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  word-break: break-all;
}

/* ===== Спойлер правил TTL ===== */
.ttl-rules {
  margin-top: 10px;
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ttl-rules summary { cursor: pointer; font-weight: 500; }
.ttl-rules ul { margin: 8px 0 0 0; padding-left: 20px; line-height: 1.5; }
.ttl-rules .ttl-max {
  font-weight: 600;
  color: var(--text-color);
  margin-top: 8px;
  list-style: none;
  margin-left: -20px;
}

/* ===== Футер ===== */
.footer {
  margin-top: auto;
  padding: 20px 0 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
}
.footer a { color: var(--text-muted); }

/* ===== /my и /sessions ===== */
.my-title { font-size: 1.5rem; margin: 0 0 0.5rem 0; text-align: center; }
.empty { color: var(--text-muted); text-align: center; padding: 2rem; }

.file-table, .sessions-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--table-bg);
  border-radius: 8px;
  overflow: hidden;
  table-layout: fixed;
  text-align: left;
}
.file-table th, .sessions-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}
.file-table td, .sessions-table td {
  padding: 10px 8px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  text-align: left;
}
.file-table tr:hover, .sessions-table tr:hover { background: var(--table-bg); filter: brightness(1.1); }
.file-table .filename {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  color: inherit;
  text-decoration: none;
}
.file-table .name-short { display: inline; }
.file-table .name-full  { display: none; }
.file-table .dim, .sessions-table .dim { color: var(--text-muted); }
.file-table .thumb-cell img {
  width: 40px; height: 40px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.file-table .actions { text-align: right; white-space: nowrap; }
.num { text-align: center; font-variant-numeric: tabular-nums; }

/* ===== /sessions — колонки ===== */
.sessions-table .col-email { width: 22%; }
.sessions-table .col-ip    { width: 20%; word-break: break-word; overflow-wrap: anywhere; }
.sessions-table .col-ua    { width: 40%; word-break: break-word; overflow-wrap: anywhere; }
.sessions-table .col-date  { width: 18%; text-align: right; white-space: nowrap; }

/* ===== Действия в /my ===== */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.7rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  color: #fff;
  box-sizing: border-box;
  font-family: inherit;
  line-height: 1;
  vertical-align: middle;
}
.action-btn.primary { background: var(--btn-primary); }
.action-btn.primary:hover { background: var(--btn-primary-hover); }
.action-btn.danger { background: var(--btn-danger); }
.action-btn.danger:hover { filter: brightness(0.9); }
.action-btn.copy-btn { background: var(--btn-success); }
.action-btn.copy-btn:hover { filter: brightness(0.9); }

/* ===== Lightbox ===== */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}
#lightbox[style*="display: flex"] { display: flex !important; }
#lightbox img {
  max-width: 95%; max-height: 95%;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ===== Превью на главной ===== */
.preview-thumb {
  max-width: 100%;
  max-height: min(260px, 30vh);
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
}
.preview-thumb:hover { transform: scale(1.02); }

.upload-btn {
  background: var(--btn-primary);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-block;
  font-weight: 600;
  transition: background 0.2s;
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.upload-btn:hover { background: var(--btn-primary-hover); }
.upload-btn.as-link { display: block; text-decoration: none; }

.muted { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }

#result { margin-top: 1.5rem; }
.action-row { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.input-row { display: flex; gap: 10px; }
.btn-group { display: flex; gap: 10px; }
.btn-group .btn { flex: 1; }
.copy-btn { background: var(--btn-success); }
.copy-btn:hover { filter: brightness(0.95); }
.goto-btn { background: var(--btn-primary); }

.note {
  color: #fbbf24;
  font-size: 0.8rem;
  margin-top: 10px;
  background: rgba(251, 191, 36, 0.1);
  padding: 8px;
  border-radius: 6px;
}

/* ===== /f/<id> ===== */
.preview-title {
  margin: 0 0 1rem 0;
  word-break: break-all;
  font-size: 1.4rem;
}
.preview-media { margin: 1rem 0; max-width: 100%; overflow: hidden; }
.preview-media img.thumb {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 70vh;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: zoom-in;
  transition: transform 0.2s;
}
.preview-media img.thumb:hover { transform: scale(1.02); }
.preview-media video { max-width: 100%; max-height: 65vh; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.preview-media audio { width: 100%; }
.preview-media iframe { width: 100%; height: 65vh; border: none; border-radius: 8px; background: #fff; }
.preview-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 10px; }
.preview-actions { display: flex; gap: 10px; justify-content: center; margin-top: 15px; flex-wrap: wrap; }
.preview-media + .prop-table { max-width: 400px; margin: 20px auto; }

/* ===== Confirm modal ===== */
#confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
}
#confirm-modal[style*="display: flex"] { display: flex !important; }
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  cursor: pointer;
}
.modal-card {
  position: relative;
  background: var(--container-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  padding: 1.5rem;
  max-width: 420px;
  width: calc(100% - 40px);
  margin: 20px;
  z-index: 1;
}
.modal-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.5rem 0; }
.modal-message { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.25rem; line-height: 1.4; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-actions .btn { min-width: 100px; }

/* ===== Адаптив: общие ===== */
@media (max-width: 480px) {
  .page { padding: 10px; }
  .container { padding: 1.5rem; }
  h1 { font-size: 1.3rem; }
  .prop-table td { padding: 6px 8px; font-size: 0.8rem; }
  .input-row { flex-direction: column; }
}

/* ===== Адаптив: шапка на мобильном ===== */
@media (max-width: 600px) {
  .user-info { top: 12px; left: 12px; }
  .user-link { padding: 8px 12px; font-size: 0.85rem; }
  .theme-toggle { top: 12px; right: 12px; padding: 8px; }

  .back-icon {
    position: static;
    display: inline-block;
    margin-right: 8px;
    padding: 0;
    font-size: 1.3rem;
    vertical-align: middle;
  }
  .my-title { text-align: left; padding-left: 4px; margin-top: 10px; }
  .page-top { padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
}

/* ===== Адаптив: карточки /my на мобильном ===== */
@media (max-width: 600px) {
  .file-table thead { display: none; }
  .file-table, .file-table tbody { display: block; width: 100%; background: transparent; }
  .file-table tr {
    display: flex;
    flex-wrap: wrap;
    background: var(--table-bg);
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 12px;
    border: 1px solid var(--border-color);
  }
  .file-table td { display: none; padding: 4px 0; border: none; text-align: left; }
  .file-table td.thumb-cell { display: block; order: 2; margin-left: auto; padding: 0; align-self: flex-start; }
  .file-table td.thumb-cell:empty { display: none; }
  .file-table td.thumb-cell img { width: 48px; height: 48px; }
  .file-table td.filename-cell {
    display: block; order: 1; flex: 1;
    font-weight: 600; font-size: 1.1rem;
    word-break: break-all; padding-right: 10px; margin-bottom: 8px;
  }
  .file-table td.filename-cell .filename { white-space: normal; overflow: visible; text-overflow: clip; }
  .file-table td.filename-cell .name-short { display: none; }
  .file-table td.filename-cell .name-full  { display: inline; }
  .file-table td.size-cell,
  .file-table td.expires-cell,
  .file-table td.views-cell,
  .file-table td.downloads-cell {
    display: block; width: 100%; padding: 2px 0; font-size: 0.9rem;
  }
  .file-table td.size-cell      { order: 3; }
  .file-table td.expires-cell   { order: 4; }
  .file-table td.views-cell     { order: 5; }
  .file-table td.downloads-cell { order: 6; }
  .file-table td.size-cell::before      { content: "Размер: ";       color: var(--text-muted); }
  .file-table td.expires-cell::before   { content: "Удаление: ";     color: var(--text-muted); }
  .file-table td.views-cell::before     { content: "Просмотров: ";   color: var(--text-muted); }
  .file-table td.downloads-cell::before { content: "Скачиваний: ";   color: var(--text-muted); }
  .file-table td.actions-cell {
    display: flex; order: 7; width: 100%; gap: 8px; margin-top: 12px; padding: 0;
    flex-wrap: wrap;
  }
  .file-table td.actions-cell .action-btn,
  .file-table td.actions-cell a {
    flex: 1 1 calc(50% - 4px); min-width: 0; text-align: center; padding: 10px 6px;
    border-radius: 6px; font-weight: 600; text-decoration: none; margin: 0; font-size: 0.8rem; display: block;
    box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* /sessions на мобильном — карточки */
  .sessions-table thead { display: none; }
  .sessions-table, .sessions-table tbody { display: block; width: 100%; background: transparent; }
  .sessions-table tr {
    display: block;
    background: var(--table-bg);
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 12px;
    border: 1px solid var(--border-color);
  }
  .sessions-table td { display: block; padding: 4px 0; border: none; width: 100%; }
  .sessions-table td.col-email { font-weight: 600; margin-bottom: 6px; word-break: break-all; }
  .sessions-table td.col-ip::before,
  .sessions-table td.col-ua::before,
  .sessions-table td.col-date::before {
    color: var(--text-muted); font-weight: 500;
  }
  .sessions-table td.col-ip::before { content: "IP: "; }
  .sessions-table td.col-ua::before { content: "UA: "; }
  .sessions-table td.col-date::before { content: "Дата: "; }
}

/* ===== Дата в /sessions — по центру (как заголовок) ===== */
.sessions-table .col-date {
  text-align: center;
}

/* ===== Пагинация /sessions ===== */
.sessions-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: flex-start;
  margin: 0 0 15px 0;
}
.sessions-toolbar .btn-sm {
  margin-left: 0;
}
.sessions-toolbar > :last-child:nth-child(n+5) {
  margin-left: auto;
}
.per-page-form {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}
.per-page-form select {
  width: auto;
  margin: 0;
  padding: 6px 8px;
  font-size: 0.85rem;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
}
.pagination-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.pagination-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pagination-pages {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 8px;
}
.pagination .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== /audit — таблица ===== */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--table-bg);
  border-radius: 8px;
  overflow: hidden;
  table-layout: fixed;
  text-align: left;
}
.audit-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}
.audit-table td {
  padding: 10px 8px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  text-align: left;
}
.audit-table tr:hover { background: var(--table-bg); filter: brightness(1.1); }

/* Колонки: фиксированные ширины */
.audit-table .col-action  { width: 12%; text-align: center; }
.audit-table .col-file    { width: 14%; word-break: break-word; overflow-wrap: anywhere; }
.audit-table .col-email   { width: 18%; word-break: break-word; overflow-wrap: anywhere; }
.audit-table .col-ip      { width: 12%; word-break: break-word; overflow-wrap: anywhere; }
.audit-table .col-ua      { width: 26%; word-break: break-word; overflow-wrap: anywhere; }
.audit-table .col-date    { width: 18%; text-align: center; white-space: nowrap; }

.audit-table .dim { color: var(--text-muted); }

/* Адаптив: карточки на мобильном */
@media (max-width: 600px) {
  .audit-table thead { display: none; }
  .audit-table, .audit-table tbody { display: block; width: 100%; background: transparent; }
  .audit-table tr {
    display: block;
    background: var(--table-bg);
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 12px;
    border: 1px solid var(--border-color);
  }
  .audit-table td { display: block; padding: 4px 0; border: none; width: 100%; }
  .audit-table td.col-action { font-weight: 600; margin-bottom: 6px; text-align: left; }
  .audit-table td.col-file { font-weight: 600; word-break: break-all; margin-bottom: 6px; }
  .audit-table td.col-email::before { content: "Email: "; color: var(--text-muted); }
  .audit-table td.col-ip::before    { content: "IP: ";    color: var(--text-muted); }
  .audit-table td.col-ua::before    { content: "UA: ";    color: var(--text-muted); }
  .audit-table td.col-date::before  { content: "Дата: ";  color: var(--text-muted); }
}

/* ===== /audit — фикс переносов ===== */
.audit-table {
  table-layout: fixed;
  width: 100%;
}
.audit-table th,
.audit-table td {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
}
.audit-table td.col-ua,
.audit-table td.col-ip,
.audit-table td.col-file,
.audit-table td.col-email {
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  max-width: 0;   /* критично для table-layout: fixed — заставляет перенос */
}
.audit-table td.col-date {
  white-space: nowrap;
  overflow-wrap: normal;
}

/* ===== /sessions на мобильном — карточки ===== */
@media (max-width: 600px) {
  .sessions-table thead { display: none; }
  .sessions-table, .sessions-table tbody { display: block; width: 100%; background: transparent; }

  .sessions-table tr {
    display: block;
    background: var(--table-bg);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
  }

  .sessions-table td {
    display: block;
    padding: 4px 0;
    border: none;
    width: 100%;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .sessions-table td.col-email {
    font-weight: 600;
    margin-bottom: 6px;
    word-break: break-all;
  }

  .sessions-table td.col-ip::before   { content: "IP: ";   color: var(--text-muted); }
  .sessions-table td.col-ua::before   { content: "UA: ";   color: var(--text-muted); }
  .sessions-table td.col-date::before { content: "Дата: "; color: var(--text-muted); }
  .sessions-table td.col-date         { text-align: left; }
}

/* ===== /sessions — мобильный фикс ширины колонок ===== */
@media (max-width: 600px) {
  .sessions-table td.col-ip,
  .sessions-table td.col-ua,
  .sessions-table td.col-email,
  .sessions-table td.col-date {
    width: 100% !important;
    max-width: none !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .sessions-table td.col-ip::before,
  .sessions-table td.col-ua::before,
  .sessions-table td.col-date::before {
    display: inline;
    font-weight: 500;
  }
}

/* ===== /sessions — мобильный: сброс table-layout: fixed ===== */
@media (max-width: 600px) {
  .sessions-table {
    table-layout: auto !important;
  }
  .sessions-table td {
    display: block;
    width: 100% !important;
    max-width: none !important;
    word-break: normal !important;
    overflow-wrap: anywhere;
    white-space: normal;
    text-align: left;
  }
}

/* ===== /sessions — ФИНАЛЬНЫЙ мобильный фикс (перебивает width: 20%) ===== */
@media (max-width: 600px) {
  .sessions-table td.col-ip,
  .sessions-table td.col-ua,
  .sessions-table td.col-email,
  .sessions-table td.col-date {
    width: auto !important;
    max-width: none !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
  }
}

/* FINAL: header buttons 60px */
@media (max-width: 600px) {
  .user-info { top: 60px !important; left: 16px !important; }
  .theme-toggle { top: 60px !important; right: 16px !important; }
  .back-icon { top: 60px !important; left: 16px !important; }
}

/* ===== Нижняя навигация (bottom-nav) ===== */
body {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--container-bg);
  border-top: 1px solid var(--border-color);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 6px 4px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus,
.bottom-nav-item.active {
  color: var(--text-color);
  background: var(--table-bg);
  outline: none;
}

.bn-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.bn-label {
  font-size: 0.65rem;
  color: inherit;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Профиль-модалка */
.bn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
}

.bn-profile-menu {
  position: fixed;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  z-index: 201;
  overflow: hidden;
  max-width: 400px;
  margin: 0 auto;
}

.bn-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--table-bg);
}

.bn-menu-email {
  font-size: 0.85rem;
  color: var(--text-color);
  word-break: break-all;
  flex: 1;
  margin-right: 10px;
}

.bn-menu-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
}

.bn-menu-item {
  display: block;
  padding: 14px 16px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.bn-menu-item:last-child {
  border-bottom: none;
}

.bn-menu-item:hover {
  background: var(--table-bg);
}

.bn-menu-logout {
  color: var(--btn-danger);
}

/* ===== /audit — мобильный фикс (сброс table-layout + !important) ===== */
@media (max-width: 600px) {
  .audit-table {
    table-layout: auto !important;
  }
  .audit-table td,
  .audit-table td.col-action,
  .audit-table td.col-file,
  .audit-table td.col-email,
  .audit-table td.col-ip,
  .audit-table td.col-ua,
  .audit-table td.col-date {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    text-align: left !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
    padding: 4px 0 !important;
    border: none !important;
  }
}

/* ===== Меню (bottom-nav) — модалка по центру ===== */
.bn-menu {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bn-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1;
}
.bn-menu-card {
  position: relative;
  z-index: 2;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  max-width: 400px;
  width: calc(100% - 40px);
  margin: 0 auto;
}

/* ===== Меню (bottom-nav) — красивый дизайн ===== */
.bn-menu {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.bn-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1;
}
.bn-menu-card {
  position: relative;
  z-index: 2;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  max-width: 360px;
  width: 100%;
  padding: 8px;
}
.bn-menu-email {
  padding: 12px 8px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  word-break: break-all;
}
.bn-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}
.bn-menu-row {
  display: flex;
  gap: 8px;
}
.bn-menu-row .bn-menu-action {
  flex: 1;
  min-width: 0;
}
.bn-menu-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 10px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.8rem;
  font-family: inherit;
  background: var(--table-bg);
  border: none;
  cursor: pointer;
  transition: background 0.2s, filter 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.bn-menu-action:hover { filter: brightness(1.15); }
.bn-menu-action:active { filter: brightness(0.9); }
.bn-menu-action .bn-menu-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.bn-menu-logout { color: var(--btn-danger); }

/* ===== ПК: нижняя панель по ширине контента (max-width) ===== */

/* ===== ПК: нижняя панель 1100px (единообразно, без page-wide) ===== */
@media (min-width: 601px) {
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    max-width: 1100px;
    border-radius: 16px 16px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    padding: 4px 8px;
  }
}

/* Главная — прозрачный контейнер 1100px, форма 400px по центру */
body:not(.page-wide) .container-wide {
  background: transparent;
  box-shadow: none;
  padding: 0;
}
body:not(.page-wide) .form-wrapper {
  background: var(--container-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 400px;
  margin: 0 auto;
}

/* Форма на всю ширину карточки (1100px) */
.form-wrapper {
  max-width: none;
}
/* Убрать прозрачность у контейнера на главной */
body:not(.page-wide) .container-wide {
  background: var(--container-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 2rem;
}
/* Убрать фон/тень у .form-wrapper (чтобы не дублировать) */
body:not(.page-wide) .form-wrapper {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

/* ===== ФИКС: главная по центру + ширина ===== */
.page.page-center {
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
}
html, body {
  margin: 0;
  /* height: 100% убран: он фиксирует высоту body = высоте экрана,
     и в мобильных браузерах (с адресной строкой) это даёт лишний скролл.
     Теперь body растягивается по контенту. */
}
body {
  display: block;
}

/* Панель ровно 1100px, без padding */
@media (min-width: 601px) {
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    max-width: 1100px;
    width: 1100px;
    padding: 4px 0;
    border-radius: 16px 16px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  }
}

/* Карточка ровно 1100px (без padding по бокам) */
@media (min-width: 601px) {
  .container-wide {
    max-width: 1100px;
    width: 1100px;
  }
}

/* Всегда показываем скролл (нет сдвигов) */
html {
  overflow-y: scroll;
}

/* Превью картинки — по центру */
#preview-box {
  text-align: center;
  margin-bottom: 15px;
}
.preview-thumb {
  display: inline-block;
  max-width: 100%;
  max-height: 40vh;
  margin: 0 auto;
}

/* Главная (неавторизованный) — форма по центру */
@media (min-width: 601px) {
  body .container-wide .form-wrapper {
    max-width: 400px !important;
    margin: 0 auto !important;
    text-align: center !important;
  }
}

/* Таблица /my — текст по центру строки (вертикально) */
.file-table td {
  vertical-align: middle;
}

/* /sessions и /audit — текст по центру + воздух в ячейках */
.sessions-table td,
.audit-table td {
  vertical-align: middle;
  padding: 12px 14px;
}
.sessions-table td.col-email,
.audit-table td.col-email {
  padding-left: 20px;
}

/* Мобильный /my — порядок кнопок: Скачать, Просмотр, Копировать, Удалить */
@media (max-width: 600px) {
  .file-table td.actions-cell .action-btn.primary:nth-child(3) { order: 1; }  /* Скачать */
  .file-table td.actions-cell .action-btn.primary:nth-child(2) { order: 2; }  /* Просмотр */
  .file-table td.actions-cell .action-btn.copy-btn { order: 3; }              /* Копировать */
  .file-table td.actions-cell .action-btn.danger { order: 4; }                /* Удалить */
}

/* /files — больше воздуха */
.files-table td,
.files-table th {
  padding: 14px 12px;
}
.files-table .filename {
  white-space: normal;
  word-break: break-word;
  overflow: visible;
  text-overflow: clip;
}
.files-table .owner-cell {
  white-space: nowrap;
}
.files-table .action-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 2px;
}
.files-table .lock-cell {
  text-align: center;
}

/* /files — колонка действий: фиксированная ширина, кнопки по центру, не прижимаются */
.files-table {
  table-layout: auto;
}
.files-table th.actions-cell,
.files-table td.actions-cell {
  width: 1%;
  white-space: nowrap;
  text-align: center;
  padding-right: 14px;
}
.files-table td.actions-cell .action-btn {
  margin: 0 3px;
}
.files-table th.lock-cell,
.files-table td.lock-cell {
  width: 1%;
  white-space: nowrap;
  text-align: center;
}

/* /f/<id> — заглушка для не-картинок */
.file-stub {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--input);
  color: var(--text-muted);
}
.file-stub-icon {
  font-size: 3rem;
  line-height: 1;
}
.file-stub-hint {
  font-size: 0.9rem;
  text-align: center;
  max-width: 28rem;
}

/* ===== /files — адаптив на мобиле (карточки из строк) ===== */
@media (max-width: 600px) {
  .files-table thead { display: none; }
  .files-table,
  .files-table tbody {
    display: block;
    width: 100%;
    background: transparent;
  }
  .files-table tr {
    display: flex;
    flex-wrap: wrap;
    background: var(--table-bg);
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 12px;
    border: 1px solid var(--border-color);
  }
  .files-table td {
    display: none;
    padding: 4px 0;
    border: none;
    text-align: left;
  }
  .files-table td.thumb-cell {
    display: block;
    order: 2;
    margin-left: auto;
    padding: 0;
    align-self: flex-start;
  }
  .files-table td.thumb-cell:empty { display: none; }
  .files-table td.thumb-cell img { width: 48px; height: 48px; }
  .files-table td.filename-cell {
    order: 1;
    display: block;
    width: 100%;
    flex: 1 1 100%;
    padding-right: 8px;
  }
  .files-table td.filename-cell .filename {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }
  .files-table td.owner-cell {
    order: 3;
    display: block;
    width: 100%;
    font-size: 0.75rem;
    color: var(--text-muted);
  }
  .files-table td.size-cell      { order: 4; display: block; font-size: 0.75rem; }
  .files-table td.expires-cell   { order: 5; display: block; font-size: 0.75rem; }
  .files-table td.size-cell::before    { content: "Размер: ";   color: var(--text-muted); }
  .files-table td.expires-cell::before { content: "Удаление: "; color: var(--text-muted); }
  .files-table td.actions-cell {
    order: 7;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
  }
  .files-table td.actions-cell .action-btn {
    flex: 1 1 auto;
    margin: 0;
    text-align: center;
  }
}

/* ===== .lock-toggle — прозрачная кнопка (без дефолтного белого фона <button>) ===== */
.lock-toggle {
  font-size: 0;
  color: transparent;
  background: transparent;
  border: 1px solid transparent;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.lock-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color);
}
[data-theme="light"] .lock-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
}
.lock-toggle:active {
  background: rgba(255, 255, 255, 0.15);
}
[data-theme="light"] .lock-toggle:active {
  background: rgba(0, 0, 0, 0.12);
}
.lock-toggle:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* ===== /my — компактный список (строки) ===== */
.my-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 900px;
}
.my-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  grid-template-areas:
    "thumb info actions"
    "props props props";
  gap: 8px 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--table-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  position: relative;
  min-height: 68px;
}
.my-thumb {
  grid-area: thumb;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.my-thumb img.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}
.my-info {
  grid-area: info;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.my-name {
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.3;
  display: block;
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



.my-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.my-meta-sep { opacity: 0.6; }
.my-actions {
  grid-area: actions;
  position: relative;
}
.my-menu-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.my-menu-btn:hover { background: rgba(255,255,255,0.08); }
[data-theme="light"] .my-menu-btn:hover { background: rgba(0,0,0,0.06); }
.my-menu {
  position: absolute;
  z-index: 1000;
  min-width: 160px;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
}
.my-menu button,
.my-menu a {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-color);
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.my-menu button:hover,
.my-menu a:hover { background: rgba(255,255,255,0.08); }
[data-theme="light"] .my-menu button:hover,
[data-theme="light"] .my-menu a:hover { background: rgba(0,0,0,0.06); }
.my-menu a.danger { color: var(--btn-danger); }
.my-menu a.danger:hover { background: rgba(239,68,68,0.12); }
.my-props {
  grid-area: props;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}
.my-props-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.my-prop-label { color: var(--text-muted); }
.my-prop-value { color: var(--text-color); }



/* Скрывать .my-menu и .my-props, даже если CSS задаёт display */
.my-menu[hidden],
.my-props[hidden] {
  display: none !important;
}

/* ===== Lightbox: кнопки ◀ ▶ ===== */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 3rem;
  line-height: 1;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s;
  z-index: 1;
  user-select: none;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
@media (max-width: 600px) {
  .lightbox-nav { width: 44px; height: 44px; font-size: 2.2rem; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
}

/* ===== PWA: отключаем случайный pull-to-refresh и bounce ===== */
html, body {
  /* overscroll-behavior-y убрано: на Android ломало скролл */
}

/* Lightbox: не даём странице «тянуться» под ним */
#lightbox {
  overscroll-behavior: contain;
  touch-action: pan-y; /* свайпы ←/→ оставляем через JS, вертикаль глушим */
}

/* ===== Rename modal ===== */
.modal-input {
  width: 100%;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text-color);
  font: inherit;
  font-size: 1rem;
  box-sizing: border-box;
}
.modal-input:focus {
  outline: none;
  border-color: var(--btn-primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}

/* ===== Rename modal — как confirm-modal ===== */
#rename-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
}
#rename-modal[style*="display: flex"] { display: flex !important; }

/* ===== /my mobile: гарантированный padding по краям ===== */
@media (max-width: 600px) {
  .my-list {
    max-width: 100%;
    margin: 0;
    padding: 0 12px;
  }
  .my-row {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}

/* ===== /my mobile: grid не должен растягиваться ===== */
@media (max-width: 600px) {
  .my-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .my-info {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .my-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .my-meta {
    flex-wrap: wrap;
    overflow: hidden;
  }
}

/* ===== ФИКС ШИРИНЫ ФОНА И СПИСКА НА МОБИЛЬНЫХ ===== */
@media (max-width: 600px) {
  /* 1. Запрещаем всему вылезать за экран */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
  }

  /* 2. Плашка (задний фон) должна быть строго по ширине экрана */
  .container-wide {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* 3. Список и строки не должны быть шире контейнера */
  .my-list {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
  .my-row {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 600px) {
  .my-list {
    box-sizing: border-box !important;
  }
}


/* Модалки: запрет жестов (зум, pull-to-refresh) на iOS — ТОЛЬКО когда открыты */
#rename-modal[style*="display: flex"] .modal-overlay,
#confirm-modal[style*="display: flex"] .modal-overlay {
  touch-action: none;
}
#rename-modal[style*="display: flex"] .modal-card,
#confirm-modal[style*="display: flex"] .modal-card {
  touch-action: manipulation;
}

/* Скрыть «Блокировать зум» на устройствах с мышью (ПК) */
@media (hover: hover) and (pointer: fine) {
  #bnZoomLock {
    display: none;
  }
}

/* Кнопка «Переименовать» в /files — синяя (primary), как «Просмотр»/«Скачать» в /my */
.action-btn.rename-btn {
  background: var(--btn-primary);
  color: #fff;
}
.action-btn.rename-btn:hover {
  background: var(--btn-primary-hover);
}

/* ===== /files — компактные карточки на мобиле (переопределение) ===== */
@media (max-width: 600px) {
  .files-table tr {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    grid-template-areas:
      "thumb info lock"
      "actions actions actions";
    gap: 8px 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    min-height: 68px;
    align-items: center;
  }
  .files-table td { padding: 0; }

  .files-table td.thumb-cell {
    grid-area: thumb;
    display: block;
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 0;
    align-self: center;
  }
  .files-table td.thumb-cell img {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    display: block;
  }

  .files-table td.filename-cell {
    grid-area: info;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    width: auto;
    flex: none;
  }
  .files-table td.filename-cell .filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
    font-size: 0.9rem;
    font-weight: 500;
    word-break: normal;
  }
  .files-table td.filename-cell .name-short { display: none; }
  .files-table td.filename-cell .name-full { display: inline; }

  /* Скрываем отдельные ячейки — их данные идут в filename-cell::after */
  .files-table td.owner-cell,
  .files-table td.size-cell,
  .files-table td.expires-cell {
    display: none !important;
  }


  .files-table td.lock-cell {
    grid-area: lock;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0;
    margin: 0;
  }

  .files-table td.actions-cell {
    grid-area: actions;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    padding: 6px 0 0 0;
    margin: 0;
    border-top: 1px solid var(--border-color);
    width: 100%;
  }
  .files-table td.actions-cell .action-btn {
    flex: 0 1 auto;
    margin: 0;
    font-size: 0.7rem;
    padding: 0 10px;
    height: 26px;
  }
}

@media (max-width: 600px) {
  .files-table td.actions-cell .action-btn {
    height: auto !important;
    min-height: 28px !important;
    padding: 6px 10px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 1 auto !important;
    margin: 0 !important;
    font-size: 0.72rem !important;
  }
}

/* ===== /files mobile — финальные штрихи ===== */
@media (max-width: 600px) {
  /* 1. Кнопки: height auto + padding, чтобы текст был по центру */
  .files-table td.actions-cell .action-btn {
    height: auto !important;
    min-height: 28px !important;
    padding: 6px 10px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 1 auto !important;
    margin: 0 !important;
    font-size: 0.72rem !important;
  }

  /* 2. filename-cell: отступ справа под lock */
  .files-table td.filename-cell {
    padding-right: 32px;
  }

  /* 3. lock-cell: по центру по вертикали с thumb */
  .files-table td.lock-cell {
    align-self: center;
  }
}

@media (max-width: 600px) {
  .files-table td.lock-cell {
    position: relative;
    z-index: 10;
  }
  .files-table .lock-toggle {
    position: relative;
    z-index: 11;
    pointer-events: auto !important;
    min-width: 36px;
    min-height: 36px;
    touch-action: manipulation;
  }
}

/* Chrome Android bug: textContent emoji in <button> doesn't repaint.
   Fix: draw icon via CSS ::before, JS toggles only .locked class. */
.lock-toggle {
  font-size: 0;
  line-height: 0;
}
.lock-toggle::before {
  content: "🔓";
  font-size: 1.1rem;
  line-height: 1;
  display: inline-block;
  color: var(--text-color);
}
.lock-toggle.locked::before {
  content: "🔒";
  font-size: 1.1rem;
  line-height: 1;
  display: inline-block;
  color: var(--text-color);
}

/* filename-meta — мета под именем (мобильная карточка) */
.filename-meta {
  display: none;
}
@media (max-width: 600px) {
  .filename-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===== Пагинация /files ===== */
.files-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.files-pagination-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--btn-primary);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.files-pagination-btn:hover { background: var(--btn-primary-hover); }
.files-pagination-btn-disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.files-pagination-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== Пагинация /my ===== */
.my-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.my-pagination-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--btn-primary);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: background 0.15s;
}
.my-pagination-btn:hover { background: var(--btn-primary-hover); }
.my-pagination-btn-disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.my-pagination-info {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ===== /audit и /sessions — компактный список ===== */
.audit-list, .sessions-list {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audit-row, .sessions-row {
  background: var(--table-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
}
.audit-head, .sessions-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  cursor: pointer;
  min-height: 32px;
}
.audit-date, .sessions-date {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-color);
}
.audit-ip, .sessions-ip {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: monospace;
}
.audit-action-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
  white-space: nowrap;
}
.audit-action-upload   { background: rgba(16,185,129,0.15); color: #10b981; }
.audit-action-delete   { background: rgba(239,68,68,0.15);  color: #ef4444; }
.audit-action-rename   { background: rgba(59,130,246,0.15); color: #3b82f6; }
.audit-action-lock     { background: rgba(245,158,11,0.15); color: #f59e0b; }
.audit-action-unlock   { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.audit-action-download { background: rgba(34,197,94,0.15);  color: #22c55e; }
.audit-action-view     { background: rgba(148,163,184,0.15);color: #94a3b8; }
.audit-toggle, .sessions-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: transform 0.15s;
  line-height: 1;
}
.audit-toggle.expanded, .sessions-toggle.expanded {
  transform: rotate(180deg);
}
.audit-props, .sessions-props {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  word-break: break-word;
}
.audit-props[hidden], .sessions-props[hidden] {
  display: none !important;
}
.audit-label, .sessions-label {
  color: var(--text-muted);
  font-weight: 500;
}
@media (max-width: 600px) {
  .audit-list, .sessions-list { max-width: 100%; }
  .audit-head, .sessions-head { gap: 8px; }
}

/* ===== Audio player ===== */
.preview-audio {
  display: block;
  width: 100%;
  max-width: 520px;
  margin: 1rem auto;
}
.my-audio,
.files-audio {
  display: block;
  width: 100%;
  margin: 0.5rem 0;
  height: 36px;
}
[data-theme="light"] .preview-audio,
[data-theme="light"] .my-audio,
[data-theme="light"] .files-audio {
  color-scheme: light;
}

/* ===== Audio player ===== */
.preview-audio {
  display: block;
  width: 100%;
  max-width: 520px;
  margin: 1rem auto;
}
.my-audio,
.files-audio {
  display: block;
  width: 100%;
  margin: 0.5rem 0;
  height: 36px;
}
[data-theme="light"] .preview-audio,
[data-theme="light"] .my-audio,
[data-theme="light"] .files-audio {
  color-scheme: light;
}

/* ===== Audio thumb (логотип для аудиофайлов в списках) ===== */
.audio-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 48px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: #fff;
  border-radius: 6px;
  font-size: 1.4rem;
  user-select: none;
}
.audio-thumb svg {
  width: 60%;
  height: 60%;
}

/* ===== Upload progress ===== */
#upload-progress {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--input-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--border-color);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--btn-primary), var(--btn-success));
  width: 0%;
  transition: width 0.15s ease;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
#uploadCancel {
  width: 100%;
}

/* ===== User quota card (index) ===== */
.user-quota-card {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0 auto 1.5rem;
  max-width: 440px;
}
.user-email-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.user-email-label {
  color: var(--text-muted);
}
.user-email-value {
  font-weight: 500;
  color: var(--text-color);
}
.quota-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.quota-label {
  color: var(--text-muted);
}
.quota-bar-wrap {
  flex: 1;
  min-width: 120px;
}
.quota-bar {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}
.quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--btn-primary), var(--btn-success));
  transition: width 0.3s ease;
}
.quota-text {
  color: var(--text-muted);
  white-space: nowrap;
}
.quota-fill[style*="100"] {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* ===== Users table (admin) ===== */
.users-table {
  table-layout: fixed;
}
.users-table td.email-cell {
  font-weight: 500;
}
.users-table td.quota-cell {
  white-space: nowrap;
}
.users-table .quota-input {
  width: 90px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--text-color);
  font-size: 0.9rem;
}
.users-table td.login-cell {
  font-size: 0.85rem;
}
.users-table td.percent-cell {
  font-size: 0.9rem;
}

/* ===== Stats (index) ===== */
.stats-row {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
.stats-total {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}
.stats-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.stats-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.stats-list li:last-child {
  border-bottom: none;
}
[data-theme="light"] .stats-list li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}
.stats-list .stats-label {
  color: var(--text-muted);
}
.stats-list b {
  color: var(--text-color);
  font-weight: 600;
}

/* "без лимита" (quota_mb = 0) */
.quota-fill-unlimited {
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}
.quota-unlimited {
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ===== Audio thumb (icon в списке) ===== */
.my-thumb .audio-thumb,
.files-table .thumb-cell .audio-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: #fff;
  border-radius: 6px;
  user-select: none;
}
.my-thumb .audio-thumb svg,
.files-table .thumb-cell .audio-thumb svg {
  width: 60%;
  height: 60%;
}

/* ===== Audio player + cover (в раскрытии / под именем) ===== */
.my-audio-wrap,
.files-audio-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  max-width: 460px;
}
[data-theme="light"] .my-audio-wrap,
[data-theme="light"] .files-audio-wrap {
  background: rgba(0, 0, 0, 0.03);
}
.my-audio-cover,
.files-audio-cover {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--input-bg);
}
.my-audio-wrap .my-audio,
.files-audio-wrap .files-audio {
  flex: 1;
  min-width: 0;
  margin: 0;
  height: 40px;
}
@media (max-width: 480px) {
  .my-audio-cover,
  .files-audio-cover {
    width: 44px;
    height: 44px;
  }
  .my-audio-wrap .my-audio,
  .files-audio-wrap .files-audio {
    height: 36px;
  }
}

/* ===== Files: compact row + expandable props ===== */
.files-table .filename-toggle {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-color);
  font-weight: 500;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: inline-block;
  font-family: inherit;
}
.files-table .filename-toggle:hover {
  color: var(--btn-primary);
}
.files-table .filename-toggle.active {
  color: var(--btn-primary);
}
.files-props {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
}
.files-props-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.files-props-meta b {
  color: var(--text-color);
  font-weight: 500;
}
.files-props-link {
  margin-left: auto;
  color: var(--btn-primary);
  text-decoration: none;
  font-size: 0.85rem;
}
.files-props-link:hover {
  text-decoration: underline;
}
/* Player в спойлере — комфортный 56px */
.files-props .files-audio-wrap {
  max-width: 460px;
  margin: 0;
}
.files-props .files-audio {
  height: 56px;
}
.files-props .files-audio-cover {
  width: 56px;
  height: 56px;
}
/* Убрать старые колонки (на случай, если остались) */
.files-table .size-cell,
.files-table .expires-cell {
  display: none;
}

/* ===== files-props-row (как .my-props: border-top, flex) ===== */
.files-table tr.files-props-row > td {
  padding: 0 8px 8px 8px;
  background: var(--table-bg);
  border-bottom: 1px solid var(--border-color);
}
.files-table tr.files-props-row:hover {
  background: var(--table-bg);
  filter: none;
}
.files-table tr.files-props-row .files-props {
  padding: 8px 0 0 0;
  margin: 0;
}
.files-table tr.files-props-row .files-props-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}
.files-table tr.files-props-row .files-props-meta b {
  color: var(--text-color);
  font-weight: 500;
}
.files-table tr.files-props-row .files-props-link {
  margin-left: auto;
  color: var(--btn-primary);
  text-decoration: none;
  font-size: 0.85rem;
}

/* ===== Toolbar menu (⋯) — для /audit и др. ===== */
.toolbar-menu-wrap {
  position: relative;
  margin-left: auto;
}
.toolbar-menu-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}
.toolbar-menu-btn:hover {
  background: var(--table-bg);
}
.toolbar-menu[hidden] {
  display: none !important;
}
.toolbar-menu {
  position: absolute;
  right: 0;
  top: 44px;
  min-width: 200px;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  padding: 4px;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.toolbar-menu a,
.toolbar-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
  text-decoration: none;
}
.toolbar-menu a:hover,
.toolbar-menu button:hover {
  background: var(--table-bg);
}
.toolbar-menu button.danger {
  color: var(--btn-danger);
}

/* Empty state: link on its own line */
.empty a {
  display: inline-block;
  margin-top: 6px;
}

/* my-owner (на /files — краткий email владельца) */
.my-owner {
  color: var(--text-muted);
}

/* lock-toggle в .my-actions (на /files) */
.my-actions .lock-toggle {
  margin-right: 4px;
}

/* ===== Mobile: /files (grid my-list) — lock + menu ===== */
@media (max-width: 600px) {
  /* actions: flex (lock + ⋯ рядом) */
  .my-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  /* lock: touch-target ≥ 36px */
  .my-actions .lock-toggle {
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    font-size: 1.1rem;
    margin-right: 0;
  }
  /* meta: wrap + compact */
  .my-meta {
    flex-wrap: wrap;
    gap: 2px 6px;
    font-size: 0.75rem;
  }
  .my-meta .my-owner {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* pagination: wrap */
  .my-pagination {
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* Desktop: lock in actions — inline (без flex, т.к. grid col auto) */
@media (min-width: 601px) {
  .my-actions .lock-toggle {
    margin-right: 4px;
  }
}

/* mobile: my-menu visibility + tap-highlight fix */
@media (max-width: 600px) {
  .my-actions { z-index: 10; }
  .my-actions:has(.my-menu:not([hidden])) { z-index: 1001; }
  .my-name, .my-menu-btn, .lock-toggle {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ===== /users — мобильная адаптация (карточки вместо таблицы) ===== */
@media (max-width: 600px) {
  .users-table {
    display: block;
    width: 100%;
    border: none;
  }
  .users-table thead {
    display: none; /* скрываем шапку */
  }
  .users-table tbody {
    display: block;
  }
  .users-table tr {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
  }
  .users-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border: none;
    width: 100% !important;
    max-width: 100% !important;
  }
  /* Метки для полей */
  .users-table td::before {
    content: attr(data-label);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
  }
  /* Поле ввода квоты */
  .users-table td input[type="number"] {
    width: 80px !important;
    margin-left: auto;
  }
}

/* ===== /users mobile (финальный, карточки) ===== */
@media (max-width: 600px) {
  .users-table, .users-table tbody, .users-table tr, .users-table td {
    display: block !important;
    width: 100% !important;
  }
  .users-table thead {
    display: none !important;
  }
  .users-table tr {
    background: var(--table-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 12px;
  }
  .users-table td {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0 !important;
    border: none !important;
  }
  /* Метка слева */
  .users-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.85rem;
  }
  /* Поле ввода справа */
  .users-table .quota-input {
    width: 80px !important;
    text-align: right;
    padding: 4px 8px !important;
  }
  /* Обертка для МБ (если она есть) */
  .users-table td.user-quota {
    gap: 8px;
  }
}

.files-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

/* ===== /users mobile — красивые карточки ===== */
@media (max-width: 600px) {
  .users-table {
    display: block !important;
    width: 100% !important;
    border: none !important;
  }
  .users-table thead {
    display: none !important;
  }
  .users-table tbody {
    display: block !important;
  }
  .users-table tr {
    display: flex !important;
    flex-direction: column !important;
    background: var(--container-bg) !important; /* отдельный фон для карточки */
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    margin-bottom: 12px !important;
    gap: 8px !important;
  }
  .users-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
    font-size: 0.95rem !important;
  }
  /* Подписи слева */
  .users-table td::before {
    content: attr(data-label);
    color: var(--text-muted) !important;
    font-size: 0.85rem !important;
    font-weight: normal !important;
  }
  /* Поле ввода квоты */
  .users-table .quota-input {
    width: 80px !important;
    margin-left: auto !important;
    text-align: right !important;
    padding: 4px 8px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    background: var(--input-bg) !important;
    color: var(--text-color) !important;
  }
}

/* ===== Result list (multiupload) ===== */
.result-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}
.result-item {
  background: var(--table-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}
.result-item .preview-thumb {
  border-radius: 6px;
  max-width: 100%;
  height: auto;
}

/* Кнопки «Копировать» / «Перейти» — по 50% ширины */
.result-action-btn {
  flex: 1 1 0;
  text-align: center;
}


/* ===== Умное обрезание длинных имён (text-overflow: ellipsis) ===== */
@media (max-width: 600px) {
  /* На мобилке даём чуть больше места для имени, если нужно */
  .my-name {
    max-width: 100%;
  }
}

/* ===== /users: таблица на ПК, карточки на мобилке ===== */
.users-table-desktop { display: table; }
.users-list-mobile   { display: none; }

@media (max-width: 600px) {
  .users-table-desktop { display: none !important; }
  .users-list-mobile   { display: flex !important; }
  .hide-on-mobile      { display: none !important; }
}

/* ===== /users (desktop): выравнивание и отступы ===== */
.users-table-desktop td.used-cell,
.users-table-desktop td.percent-cell,
.users-table-desktop td.login-cell,
.users-table-desktop th:nth-child(3),
.users-table-desktop th:nth-child(4),
.users-table-desktop th:nth-child(5) {
  text-align: center;
}

/* Email — немного воздуха слева */
.users-table-desktop td.email-cell,
.users-table-desktop th:nth-child(1) {
  padding-left: 20px;
}

/* Подзаголовок в h1 (Scary_M.f. FileSharing) */
.site-subtitle {
  font-size: 0.5em;
  font-weight: normal;
  color: var(--text-muted);
  display: block;
  margin-top: 4px;
}

/* На мобильных футер не нужен (ShareMF уже наверху, а bottom-nav занимает место) */
@media (max-width: 600px) {
  .footer {
    display: none !important;
  }
}

/* Отступ снизу, чтобы контент не прятался под bottom-nav на мобильных */
/* padding-bottom перенесён на списки (см. ниже) */


/* Отступ под bottom-nav — только для длинных списков на мобильных */
@media (max-width: 600px) {
  .my-list,
  .users-table-desktop,
  .audit-list,
  .sessions-list {
    padding-bottom: 80px;
  }
}

/* ===== TOP-NAV (sticky шапка) ===== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--container-bg);
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  box-sizing: border-box;
}

.top-nav-left {
  display: flex;
  flex-direction: column;
}

.top-nav-title {
  font-size: 1.5rem; /* Размер 2 */
  font-weight: 700;
  line-height: 1.2;
}

.top-nav-subtitle {
  font-size: 0.75rem; /* Размер 1 */
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 2px;
}

.top-nav-right {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.top-nav-page {
  font-size: 1.1rem; /* Размер 2 (чуть меньше основного) */
  font-weight: 600;
  line-height: 1.2;
}

.top-nav-user {
  font-size: 0.75rem; /* Размер 1 */
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 2px;
}

/* Отступы после top-nav */
.page-top {
  margin-top: 10px;
}

/* user-quota-card — теперь в прокручиваемом контенте */
.user-quota-card {
  margin-top: 16px;
  margin-bottom: 16px;
}

/* На мобильных top-nav ещё компактнее */
@media (max-width: 600px) {
  .top-nav {
    padding: 8px 12px;
  }
  .top-nav-title {
    font-size: 1.2rem;
  }
  .top-nav-page {
    font-size: 0.95rem;
  }
}

/* ===== TOP-NAV (fixed, всегда наверху) ===== */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--container-bg);
  border-bottom: 1px solid var(--border-color);
  box-sizing: border-box;
}

/* Отступ под fixed top-nav */
.page {
  padding-top: 90px !important; /* высота top-nav + запас */
}

@media (max-width: 600px) {
  .page {
    padding-top: 80px !important;
  }
}

/* ===== TOP-NAV: safe-area (чтобы не лезть под чёлку в PWA) ===== */
.top-nav {
  /* Добавляем отступ сверху под системную строку (часы, батарея, чёлка) */
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

/* .page — сдвигаем контент под fixed top-nav + safe-area */
.page {
  padding-top: calc(90px + env(safe-area-inset-top, 0px)) !important;
}

@media (max-width: 600px) {
  .top-nav {
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
  }
  .page {
    padding-top: calc(80px + env(safe-area-inset-top, 0px)) !important;
  }
}

/* -webkit-overflow-scrolling: touch — убрано (для Android не нужно, для iOS было по умолчанию) */


/* Android: отключаем pull-to-refresh только на html (не на body) */
html {
  overscroll-behavior-y: none;
}

/* ===== TOP-NAV: на ПК как bottom-nav (1100px по центру) ===== */
@media (min-width: 601px) {
  .top-nav {
    max-width: 1100px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-radius: 0 0 12px 12px; /* Скругление снизу, как у bottom-nav */
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
}

/* ===== Видео в раскрытии (my/files) ===== */
.my-video-wrap {
  display: flex;
  justify-content: center;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.my-video-wrap video {
  max-width: 100%;
  max-height: 400px;
  display: block;
}
