/* XakDrive — оформление */
:root {
  --bg: #0f1420;
  --bg2: #151c2c;
  --bg3: #1c2537;
  --card: #182134;
  --border: #263048;
  --text: #e7ecf5;
  --muted: #8b96ad;
  --accent: #4f7cff;
  --accent2: #7c5cff;
  --grad: linear-gradient(135deg, #4f7cff, #7c5cff);
  --ok: #2ecc71;
  --err: #ff5c69;
  --warn: #ffb020;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: .3em 0; font-weight: 650; }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: Consolas, monospace; font-size: 12.5px; }

/* ---------- кнопки, поля ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg3); color: var(--text);
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); border: none; color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-danger { background: var(--err); border: none; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 13px 26px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; justify-content: center; }
.icon-btn {
  background: none; border: none; cursor: pointer; font-size: 16px;
  padding: 6px; border-radius: 8px; opacity: .75; color: var(--text); line-height: 1;
}
.icon-btn:hover { opacity: 1; background: var(--bg3); }

.field { display: block; margin: 12px 0; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; outline: none; transition: border .15s;
}
input:focus, select:focus { border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; margin: 10px 0; cursor: pointer; }
.check input { width: auto; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 16px; margin: 10px 0; }
.inline-field { display: flex; align-items: center; gap: 8px; }
.inline-field select { width: auto; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted); vertical-align: middle;
}
.badge-admin { background: rgba(79,124,255,.15); color: var(--accent); border-color: var(--accent); }
.badge-public { background: rgba(46,204,113,.12); color: var(--ok); border-color: var(--ok); }
.alert { padding: 11px 14px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.alert-error { background: rgba(255,92,105,.12); border: 1px solid var(--err); color: #ffb3ba; }

/* ---------- логин ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; position: relative; overflow: hidden; }
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 400px at 20% 25%, rgba(79,124,255,.25), transparent 60%),
    radial-gradient(700px 500px at 80% 75%, rgba(124,92,255,.22), transparent 60%),
    var(--bg);
  filter: blur(0.5px);
}
.login-card { position: relative; width: 380px; max-width: 92vw; padding: 34px; box-shadow: var(--shadow); text-align: center; }
.login-card h1 { margin: 8px 0 2px; }
.login-card .card-form, .login-card form { text-align: left; margin-top: 14px; }
.login-logo { margin-bottom: 4px; }
.brand-logo { font-size: 22px; }
.brand-logo.big { font-size: 44px; display: inline-block;
  background: var(--grad); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow); }
.login-footer { margin-top: 18px; font-size: 12.5px; }
.login-card input { margin-top: 2px; }

/* ---------- каркас приложения ---------- */
body.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; min-width: 250px; background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; padding: 4px 8px 18px; }
.nav { flex: 1; overflow-y: auto; }
.nav-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 14px 10px 6px; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  color: var(--text); transition: .12s; margin: 2px 0;
}
.nav-list li:hover { background: var(--bg3); }
.nav-list li.active { background: var(--grad); color: #fff; }
.nav-list li.active .nav-ico { filter: none; }
.nav-ico { width: 20px; text-align: center; }
.nav-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-hint { cursor: default; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 8px; }
.user-chip { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; padding: 0 4px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--grad);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex: none;
}
.user-name { font-weight: 600; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: var(--bg2); position: sticky; top: 0; z-index: 20;
}
.crumbs { flex: 1; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb { color: var(--text); font-weight: 600; cursor: pointer; }
.crumb:hover { color: var(--accent); text-decoration: none; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.search { width: 210px; padding: 8px 12px; background: var(--bg3); }
.burger { display: none; background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; }
.content { flex: 1; padding: 22px; }

/* ---------- список файлов ---------- */
.file-list { display: flex; flex-direction: column; gap: 4px; }
.file-row {
  display: grid; grid-template-columns: 44px minmax(0,1fr) 150px 110px 130px;
  align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px; border: 1px solid transparent;
  transition: .12s;
}
.file-row:hover { background: var(--bg3); border-color: var(--border); }
.file-ico { font-size: 24px; text-align: center; }
.file-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-name:hover { color: var(--accent); }
.file-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.file-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; transition: .12s; }
.file-row:hover .file-actions, .file-row:focus-within .file-actions { opacity: 1; }
.file-row .file-size { text-align: right; }
.row-menu { font-weight: 700; letter-spacing: 1px; }

/* перетаскивание строк */
.file-row.dragging { opacity: .4; }
.file-row.drop-hover { background: rgba(79,124,255,.16) !important; border-color: var(--accent) !important; }
.crumb.drop-hover { background: var(--bg3); border-radius: 8px; }

/* заголовок списка (сортировка кликом) */
.file-list-head {
  display: grid; grid-template-columns: 44px minmax(0,1fr) 150px 110px 130px; gap: 10px;
  padding: 2px 12px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.flh-col {
  background: none; border: none; color: var(--muted); font-family: inherit;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  cursor: pointer; text-align: left; padding: 0; font-weight: 700;
}
.flh-col:hover { color: var(--text); }
.flh-right { text-align: right !important; }

/* ---------- контекстное меню ---------- */
.ctx-menu {
  position: fixed; z-index: 160; min-width: 240px; max-width: 320px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px;
  opacity: 0; transform: scale(.96) translateY(-4px); transform-origin: top left;
  transition: opacity .12s, transform .12s;
}
.ctx-menu.open { opacity: 1; transform: none; }
.ctx-title {
  padding: 8px 10px 7px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; color: var(--text); text-align: left;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-family: inherit; line-height: 1.3;
}
.ctx-item:hover { background: var(--bg3); }
.ctx-ico { width: 20px; text-align: center; flex: none; }
.ctx-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-danger { color: var(--err); }
.ctx-danger:hover { background: rgba(255,92,105,.12); }
.ctx-sep { height: 1px; background: var(--border); margin: 5px 8px; }
.ctx-active { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- чипы (срок ссылки) ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  border-radius: 20px; padding: 7px 14px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: .12s; font-family: inherit;
}
.chip:hover { border-color: var(--accent); }
.chip-on { background: var(--grad); border-color: transparent; color: #fff; }

/* ---------- календарь ---------- */
.cal-wrap {
  margin-top: 10px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px; max-width: 300px;
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 6px; }
.cal-month { font-weight: 700; font-size: 14px; flex: 1; text-align: center; }
.cal-nav {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: 17px; line-height: 1;
  flex: none;
}
.cal-nav:hover { border-color: var(--accent); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-wd { font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0; font-weight: 600; }
.cal-day {
  background: none; border: none; color: var(--text); font-family: inherit;
  font-size: 13px; height: 32px; border-radius: 8px; cursor: pointer;
}
.cal-day:hover:not(:disabled) { background: var(--bg3); }
.cal-out { color: var(--muted); opacity: .4; cursor: default; }
.cal-past { color: var(--muted); opacity: .35; cursor: not-allowed; }
.cal-today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-sel { background: var(--grad); color: #fff; font-weight: 700; }
.cal-sel.cal-today { box-shadow: inset 0 0 0 1.5px #fff; }

/* ---------- дерево папок (диалог перемещения) ---------- */
.tree-picker {
  max-height: 300px; overflow-y: auto; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px;
}
.tree-ul { list-style: none; margin: 0; padding-left: 18px; }
.tree-row {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
.tree-row:hover { background: var(--bg3); }
.tree-row input { width: auto; accent-color: var(--accent); flex: none; }
.tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-root { border-bottom: 1px solid var(--border); margin-bottom: 4px; font-weight: 600; }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); font-size: 15px; }
.empty-ico { font-size: 52px; margin-bottom: 10px; }
.empty.small { padding: 24px; }

/* ---------- drag&drop, загрузка ---------- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center;
  background: rgba(15,20,32,.82); backdrop-filter: blur(4px);
  border: 3px dashed var(--accent); pointer-events: none;
}
.drop-overlay.show { display: flex; }
.drop-hint { font-size: 22px; font-weight: 700; }

.upload-dock {
  position: fixed; right: 18px; bottom: 18px; width: 380px; max-width: 94vw;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 80; overflow: hidden;
}
.upload-dock-head { padding: 12px 16px; font-weight: 650; border-bottom: 1px solid var(--border); background: var(--bg3); }
.upload-dock-list { max-height: 300px; overflow-y: auto; padding: 10px 14px; }
.up-row { display: grid; grid-template-columns: minmax(0,1fr) 90px 60px; gap: 10px; align-items: center; padding: 6px 0; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.up-bar { height: 7px; background: var(--bg3); border-radius: 6px; overflow: hidden; }
.up-fill { height: 100%; width: 0; background: var(--grad); border-radius: 6px; transition: width .2s; }
.up-pct { font-size: 12px; color: var(--muted); text-align: right; }
.up-err .up-fill { background: var(--err); }
.up-done .up-fill { background: var(--ok); }

/* ---------- модалки, тосты ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(5,8,15,.66);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal { width: 460px; max-width: 96vw; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal-wide { width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.img-preview img { max-width: 100%; max-height: 65vh; border-radius: 10px; display: block; margin: 0 auto; }
.share-link-row { display: flex; gap: 8px; }
.share-link-row input { font-family: Consolas, monospace; font-size: 12.5px; }

.toasts { position: fixed; top: 18px; right: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg3); border: 1px solid var(--border); border-left: 4px solid var(--ok);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow);
  opacity: 0; transform: translateX(30px); transition: .3s; max-width: 360px; font-size: 14px;
}
.toast.show { opacity: 1; transform: none; }
.toast-err { border-left-color: var(--err); }
.toast-warn { border-left-color: var(--warn); }

/* ---------- страницы ---------- */
.page-card { max-width: 640px; }
.pw-grid { max-width: 380px; }
.quota-bar { height: 10px; background: var(--bg3); border-radius: 8px; overflow: hidden; margin: 10px 0 4px; }
.quota-fill { height: 100%; background: var(--grad); }

.admin-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-head h2 { margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 8px 16px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.tab.active { background: var(--grad); border-color: transparent; color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { text-align: center; padding: 16px; }
.stat-num { font-size: 26px; font-weight: 750; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.table-card { padding: 0; overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.table-head h3 { margin: 0; }
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }
.perm-hint { padding: 10px 18px 0; }

/* ---------- публичная страница ---------- */
body.share-page { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; padding: 30px 14px;
  background:
    radial-gradient(600px 400px at 15% 20%, rgba(79,124,255,.16), transparent 60%),
    radial-gradient(700px 500px at 85% 80%, rgba(124,92,255,.14), transparent 60%),
    var(--bg);
}
.share-wrap { width: 640px; max-width: 100%; }
.brand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.brand { color: var(--text); font-weight: 700; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.share-card { box-shadow: var(--shadow); }
.share-card.center { text-align: center; padding: 40px 26px; }
.share-emoji { font-size: 56px; margin-bottom: 8px; }
.share-emoji.sm { font-size: 40px; }
.share-title { word-break: break-all; }
.share-actions { margin-top: 18px; display: flex; justify-content: center; gap: 10px; }
.share-head { display: flex; align-items: center; gap: 14px; }
.share-head > div:nth-child(2) { flex: 1; }
.share-head h2 { margin: 0; }
.crumbs { padding: 12px 0 4px; white-space: normal; }
body.share-page .file-row { grid-template-columns: 40px minmax(0,1fr) 110px 40px; }
.pw-form { display: flex; gap: 8px; max-width: 340px; margin: 14px auto 0; }
.share-footer { text-align: center; margin-top: 18px; font-size: 13px; }
.upload-by-link { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 16px; }
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; margin-top: 10px;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); color: var(--text); }

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -260px; z-index: 60; transition: .2s; }
  body.sidebar-open .sidebar { left: 0; box-shadow: var(--shadow); }
  body.sidebar-open::after {
    content: ''; position: fixed; inset: 0; z-index: 55; background: rgba(5,8,15,.5);
  }
  .burger { display: block; }
  .search { width: 150px; }
  .file-row { grid-template-columns: 40px minmax(0,1fr) 120px 80px 110px; }
  .file-list-head { grid-template-columns: 40px minmax(0,1fr) 120px 80px 110px; }
  .content { padding: 14px; }
  .upload-dock { width: 340px; }
}
@media (max-width: 700px) {
  /* меню как нижняя панель (bottom sheet) */
  .ctx-menu {
    left: 10px !important; right: 10px !important; top: auto !important; bottom: 10px !important;
    min-width: 0; max-width: none; transform: translateY(16px); transform-origin: bottom center;
  }
  .ctx-menu.open { transform: none; }
  .ctx-title { white-space: normal; }
  .ctx-item { padding: 12px 12px; }

  /* карточки файлов в две строки */
  .file-list-head { display: none; }
  .file-row {
    grid-template-columns: 38px minmax(0,1fr) auto;
    grid-template-areas: "ico name act" "ico meta act";
    row-gap: 2px; padding: 10px 8px 10px 10px;
  }
  .file-ico { grid-area: ico; font-size: 26px; }
  .file-name-wrap { grid-area: name; min-width: 0; overflow: hidden; }
  .file-date { grid-area: meta; }
  .file-size { display: none; }
  .file-actions { grid-area: act; opacity: 1; align-items: center; }
  .browser-row .file-actions .icon-btn:not(.row-menu) { display: none; }
  .file-list.grid-view .file-row { display: flex; grid-template-areas: none; }

  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .crumbs { order: 3; width: 100%; font-size: 14px; }
  .search { flex: 1; min-width: 110px; width: auto; }
  .content { padding: 10px; }
  .modal { max-height: 92vh; }
  .upload-dock { right: 10px; left: 10px; bottom: 10px; width: auto; }
  .toasts { left: 12px; right: 12px; top: 12px; }
  .toast { max-width: none; }
}
@media (max-width: 400px) {
  .file-list.grid-view { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
}

/* ---------- новые возможности: сетка, сортировка, диалог папки ---------- */
.sort-sel {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; outline: none;
}
.sort-sel:hover { border-color: var(--accent); }
.file-list.grid-view {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}
.file-list.grid-view .file-row {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 6px; padding: 16px 8px 10px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg2);
}
.file-list.grid-view .file-row:hover { border-color: var(--accent); }
.file-list.grid-view .file-ico { font-size: 44px; }
.file-list.grid-view .file-name { white-space: normal; word-break: break-word; font-size: 13.5px; }
.file-list.grid-view .file-meta { display: none; }
.file-list.grid-view .file-actions { opacity: 1; justify-content: center; }
.radio-col { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.radio-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; transition: .12s;
}
.radio-row:hover { border-color: var(--accent); background: var(--bg3); }
.radio-row input { margin-top: 4px; accent-color: var(--accent); }
.radio-row b { font-size: 14px; }
.media-preview video, .media-preview audio { width: 100%; max-height: 70vh; border-radius: 10px; }
.pdf-frame { width: 100%; height: 70vh; border: 0; border-radius: 10px; background: #fff; }
.text-preview {
  max-height: 65vh; overflow: auto; margin: 0;
  background: var(--bg2); border: 1px solid var(--border);
  padding: 12px 14px; border-radius: 10px;
  font-family: Consolas, monospace; font-size: 13px;
  white-space: pre-wrap; word-break: break-word;
}
.user-quota-chip {
  margin-top: 8px; padding: 7px 10px; border-radius: 10px;
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 12px; color: var(--muted); text-align: center;
}

/* ---------- создатель в строке, доступ, тач ---------- */
.file-name-wrap {
  min-width: 0; display: flex; align-items: baseline; gap: 8px;
  overflow: hidden;
}
.owner-tag {
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
  flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis;
}
.file-row[data-type="folder"] .file-ico { cursor: pointer; }
.file-list.grid-view .file-name-wrap { display: block; width: 100%; }
.file-list.grid-view .owner-tag { display: none; }

/* выделение текста мешает долгому нажатию на телефоне */
.file-row {
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: none) and (pointer: coarse) {
  .file-actions { opacity: 1; }
  .icon-btn { min-width: 34px; min-height: 34px; }
}

/* выбор пользователей в диалоге «Доступ» */
.users-pick {
  max-height: 220px; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px 12px;
}
.user-pick { margin: 7px 0; }
.avatar-sm { width: 24px; height: 24px; font-size: 12px; }
.shared-hint { margin: 2px 2px 12px; }

/* смартфоны: меню-доступ быстрее, тач-цели больше */
@media (max-width: 700px) {
  .owner-tag { display: none; }
  .ctx-item { padding: 13px 12px; font-size: 15px; }
  .ctx-menu { max-height: 78vh; overflow-y: auto; }
  .file-date { display: block; }
  .btn { padding: 11px 16px; }
  .icon-btn { padding: 9px; font-size: 18px; }
  .modal { width: 100%; max-width: 100vw; border-radius: 16px 16px 0 0; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .cal-day { height: 38px; font-size: 14px; }
  .cal-nav { width: 38px; height: 38px; }
  .search { height: 38px; }
  .content { padding-bottom: 90px; }
}
