/* Полка — файловое хранилище */
:root {
  --bg: #eef1f2;
  --surface: #ffffff;
  --surface-2: #f7f9f9;
  --ink: #11212a;
  --ink-soft: #33474f;
  --muted: #66787f;
  --line: #dde4e6;
  --line-strong: #c8d3d6;
  --accent: #0d6b5f;
  --accent-strong: #08544b;
  --accent-soft: #e0f0ec;
  --accent-ink: #0a4a42;
  --danger: #b23a2f;
  --danger-soft: #fbeae8;
  --warn: #a86a12;
  --warn-soft: #fdf3e2;
  --sidebar: #0e1f26;
  --sidebar-2: #122a33;
  --sidebar-ink: #e6efef;
  --sidebar-muted: #8aa0a7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 33, 42, 0.06), 0 8px 24px rgba(17, 33, 42, 0.06);
  --shadow-lg: 0 24px 64px rgba(10, 26, 33, 0.24);
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
[hidden] { display: none !important; }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 550;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #9a2f25; border-color: #9a2f25; }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(17, 33, 42, 0.06); border-color: transparent; }

.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
}
.icon-btn:hover { background: rgba(17, 33, 42, 0.07); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon-btn:disabled:hover { background: transparent; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: 12.5px; color: var(--muted); }

.input, select.input, textarea.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 107, 95, 0.15);
}
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%2366787f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.checkline { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.checkline input { width: 16px; height: 16px; accent-color: var(--accent); }

.process-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.process-row .field { margin-bottom: 0; }
.process-range { width: 100%; accent-color: var(--accent); }

.form-error {
  display: none;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--danger-soft);
  border: 1px solid #f0cfcb;
  color: #8c2c23;
  font-size: 13.5px;
}
.form-error.is-visible { display: block; }

.badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font: 600 11.5px/1.6 var(--mono);
  text-align: center;
}
.badge-neutral { background: #e8edee; color: var(--ink-soft); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- app shell ---------- */

.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 22px 16px 16px;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 22px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  flex: none;
}
.brand small {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  margin-top: 1px;
}

.nav { display: grid; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 14.5px;
  font-weight: 550;
  text-align: left;
}
.nav-item svg { flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--sidebar-ink); }
.nav-item.is-active { background: var(--sidebar-2); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav-item .badge { margin-left: auto; background: rgba(255, 255, 255, 0.1); color: var(--sidebar-ink); }
.nav-sep { height: 1px; background: rgba(255, 255, 255, 0.09); margin: 14px 6px; }

.favorites {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.favorites-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 9px 8px;
  color: var(--sidebar-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.favorites-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--sidebar-ink);
  font: 600 10.5px/1 var(--mono);
}
.favorites-list {
  display: grid;
  gap: 2px;
  min-height: 0;
  max-height: 210px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}
.favorites-empty {
  padding: 8px 9px;
  color: var(--sidebar-muted);
  font-size: 12px;
  line-height: 1.4;
}
.favorite-row {
  display: flex;
  align-items: center;
  min-width: 0;
  border-radius: 8px;
}
.favorite-row:hover { background: rgba(255, 255, 255, 0.055); }
.favorite-open {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 0;
  padding: 7px 4px 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-ink);
  text-align: left;
}
.favorite-open:hover { color: #fff; }
.favorite-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--accent);
}
.favorite-text { display: grid; gap: 1px; min-width: 0; }
.favorite-name, .favorite-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favorite-name { color: inherit; font-size: 13px; font-weight: 550; }
.favorite-path { color: var(--sidebar-muted); font-size: 10.5px; }
.favorite-remove {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--sidebar-muted);
  opacity: 0.5;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.favorite-row:hover .favorite-remove, .favorite-row:focus-within .favorite-remove { opacity: 1; }
.favorite-remove:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.icon-btn.is-favorite { color: var(--accent); }

.quota {
  margin-top: auto;
  padding: 14px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.quota-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--sidebar-muted); margin-bottom: 8px; }
.quota-top strong { color: var(--sidebar-ink); font-family: var(--mono); font-weight: 600; }
.quota-bar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.quota-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }
.quota-bar span.is-full { background: #d9a13a; }

.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--sidebar-ink);
  width: 100%;
  text-align: left;
}
.userbox:hover { background: rgba(255, 255, 255, 0.06); }
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
}
.userbox .who { min-width: 0; }
.userbox .who strong { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.userbox .who span { font-size: 11.5px; color: var(--sidebar-muted); }

.main { min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 64px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  flex: none;
}

.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 220px;
  padding: 4px 7px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb:not(.is-current):hover { background: rgba(17, 33, 42, 0.06); color: var(--ink); }
.crumb.is-current { color: var(--ink); font-weight: 600; cursor: default; }
.crumb-sep { color: var(--line-strong); flex: none; }

.search {
  position: relative;
  margin-left: auto;
  width: min(320px, 34vw);
}
.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 13.5px;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13, 107, 95, 0.12); }
.search svg { position: absolute; left: 10px; top: 10px; color: var(--muted); }
.search-clear { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.search-clear:hover { background: rgba(17, 33, 42, 0.07); }

.workspace { flex: 1; overflow-y: auto; padding: 26px 26px 60px; }

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.view-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.view-head .sub { margin-top: 4px; font-size: 13px; color: var(--muted); }
.view-actions { display: flex; align-items: center; gap: 9px; flex: none; }

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.segmented button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.segmented button.is-active { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- dropzone ---------- */

.dropzone {
  display: none;
  position: relative;
  margin-bottom: 18px;
  padding: 26px;
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f2faf8, #eaf6f3);
  text-align: center;
  color: var(--accent-ink);
}
.dropzone.is-visible { display: block; animation: fadeUp 0.18s ease; }
.dropzone strong { display: block; font-size: 16px; margin-bottom: 3px; }
.dropzone span { font-size: 13px; color: #41756d; }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 26px;
  background: rgba(9, 27, 34, 0.55);
  backdrop-filter: blur(3px);
}
.drop-overlay.is-active { display: grid; }
.drop-panel {
  display: grid;
  place-items: center;
  gap: 10px;
  width: min(620px, 100%);
  padding: 56px 30px;
  border: 2px dashed rgba(255, 255, 255, 0.65);
  border-radius: 20px;
  color: #fff;
  text-align: center;
}
.drop-panel h3 { font-size: 22px; font-weight: 650; }
.drop-panel p { color: #c5d7d6; font-size: 14px; }

/* ---------- file table ---------- */

.file-table { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.file-table .thead,
.file-table .row {
  display: grid;
  grid-template-columns: 28px 34px minmax(0, 1fr) 120px 160px 96px;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
}
.file-table .thead {
  height: 40px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.file-table .thead button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.row {
  min-height: 54px;
  border-bottom: 1px solid #edf1f2;
  cursor: default;
  transition: background 0.12s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: #f8fbfa; }
.row.is-selected { background: var(--accent-soft); }

.cell-check { display: flex; align-items: center; justify-content: center; }
.row-check, .tile-check { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.tile-check { position: absolute; top: 12px; left: 12px; z-index: 3; }
.tile.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.selection-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid #cfe3df;
  border-radius: 10px;
  background: var(--accent-soft);
}
.selection-info { font-size: 13.5px; color: var(--accent-ink); }
.selection-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.row .cell-name { display: flex; align-items: center; gap: 11px; min-width: 0; }
.row .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
  font-weight: 520;
  padding: 4px 0;
  border: 0;
  background: none;
  text-align: left;
  color: var(--ink);
}
.row .name:hover { text-decoration: underline; text-underline-offset: 3px; }
.row .size, .row .date { font: 12.5px/1 var(--mono); color: var(--muted); }
.row .actions { display: flex; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity 0.12s; }
.row:hover .actions, .row:focus-within .actions { opacity: 1; }
.row .actions .icon-btn { width: 30px; height: 30px; }

.file-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 7px;
  background: #eef2f3;
  color: #5c7078;
}
.file-icon.folder { background: var(--accent-soft); color: var(--accent); }
.file-icon.img { background: #eaf1fb; color: #2f66a8; }
.file-icon.doc { background: #eef1fb; color: #3b4f9e; }
.file-icon.sheet { background: #e9f5ec; color: #24774a; }
.file-icon.pdf { background: #fdeceb; color: #b23a2f; }
.file-icon.zip { background: #fbf1e2; color: #96651b; }
.file-icon.video { background: #f3ecfb; color: #7445a8; }
.file-icon.audio { background: #fdeef6; color: #a03a71; }
.file-icon.thumb-wrap, .tile-icon.thumb-wrap { position: relative; overflow: hidden; }
.thumb-wrap .thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  background: #eef2f3;
  display: block;
  animation: thumbIn 0.2s ease;
}
@keyframes thumbIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.thumb-wrap .thumb.is-broken { display: none; }

.pill-share {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  color: var(--accent);
}
.pill-sync {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--accent);
}
.pill-sync.is-off {
  color: #e01b1b;
}
.pill-sync.is-off svg { stroke-width: 2; }
.pill-sync.is-spinning .sync-glyph { will-change: transform; }
.sync-glyph { display: inline-flex; }
.tile-meta .pill-sync { margin-left: 0; }
.pill-missing {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font: 600 10.5px/1.5 var(--mono);
  white-space: nowrap;
}
.tile .tile-meta { flex-wrap: wrap; }
.tile-meta .pill-missing { margin-left: 0; }
.pill-lock {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--accent);
}
.tile-lock {
  position: absolute;
  top: 13px;
  left: 38px;
  color: var(--accent);
  z-index: 2;
}
.pill-versions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font: 600 10.5px/1.5 var(--mono);
  cursor: pointer;
}
.pill-versions:hover { color: var(--accent); border-color: var(--accent); }
.tile-meta .pill-versions { margin-left: 0; }
.versions-list { display: grid; gap: 8px; }
.version-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}
.version-main { min-width: 0; }
.version-title { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.version-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.version-meta span { display: inline-flex; align-items: center; gap: 4px; }
.version-actions { display: flex; align-items: center; gap: 6px; flex: none; }
@media (max-width: 620px) {
  .version-row { align-items: flex-start; flex-direction: column; }
  .version-actions { width: 100%; flex-wrap: wrap; }
}

/* grid view */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.tile .tile-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.tile .tile-icon.folder { background: var(--accent-soft); color: var(--accent); }
.tile .tile-name { margin-top: auto; font-size: 14px; font-weight: 550; line-height: 1.3; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .tile-meta { font: 11.5px/1 var(--mono); color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.tile .actions { position: absolute; top: 8px; right: 8px; display: none; }
.tile:hover .actions, .tile:focus-within .actions { display: flex; }

.empty {
  display: none;
  padding: 54px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.55);
}
.empty.is-visible { display: block; }
.empty .art { margin: 0 auto 14px; width: 76px; height: 76px; color: var(--line-strong); }
.empty h3 { font-size: 17px; font-weight: 650; margin-bottom: 5px; }
.empty p { font-size: 14px; color: var(--muted); max-width: 380px; margin: 0 auto 16px; }

.row .name-wrap { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.row .path-line {
  padding: 0;
  border: 0;
  background: none;
  font: 11.5px/1.3 var(--mono);
  color: var(--muted);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.row .path-line:hover { color: var(--accent); text-decoration: underline; }
.row.is-jump-target, .tile.is-jump-target {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ---------- preview ---------- */

.preview-frame {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.preview-frame img { display: block; max-width: 100%; max-height: 46vh; object-fit: contain; }
.preview-frame.preview-icon { padding: 34px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.preview-frame .preview-thumb { display: block; max-width: 100%; max-height: 46vh; object-fit: contain; }
.preview-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.preview-frame.preview-icon .file-icon { width: 64px; height: 64px; border-radius: 14px; }
.preview-meta { display: grid; gap: 7px; font-size: 13px; }
.preview-meta > div { display: flex; justify-content: space-between; gap: 18px; padding-bottom: 7px; border-bottom: 1px solid #eef2f3; }
.preview-meta > div:last-child { border-bottom: 0; padding-bottom: 0; }
.preview-meta span { color: var(--muted); flex: none; }
.preview-meta strong { font-weight: 550; text-align: right; overflow-wrap: anywhere; }

/* ---------- share dialog / move ---------- */

.share-result { margin-top: 16px; padding: 14px; border: 1px solid #cde5df; border-radius: 10px; background: #f2faf8; }
.share-result .s-title { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; color: var(--accent-ink); margin-bottom: 10px; }
.share-result .hint { margin-top: 6px; }

.move-list { margin-top: 10px; max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.move-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #eef2f3;
  background: none;
  text-align: left;
  font-size: 14px;
}
.move-row:last-child { border-bottom: 0; }
.move-row:hover { background: var(--surface-2); }
.move-row .icon-btn { color: var(--muted); }

/* ---------- context menu ---------- */

.menu {
  position: fixed;
  z-index: 80;
  min-width: 208px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: pop 0.12s ease;
}
.menu button, .menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  text-align: left;
  font-size: 13.5px;
  color: var(--ink);
}
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu button.is-danger { color: var(--danger); }
.menu .menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.menu .menu-label { padding: 6px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---------- modal ---------- */

.modal-root { position: fixed; inset: 0; z-index: 90; display: none; }
.modal-root.is-open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(9, 26, 33, 0.45); backdrop-filter: blur(2px); animation: fade 0.15s ease; }
.modal {
  position: relative;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  margin: 8vh auto 0;
  padding: 22px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  animation: rise 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.modal.modal-wide { width: min(640px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal-head h2 { font-size: 19px; font-weight: 680; letter-spacing: -0.01em; }
.modal-head p { margin-top: 3px; font-size: 13px; color: var(--muted); }
.modal-close { margin-left: auto; flex: none; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- upload tray ---------- */

.tray {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 70;
  width: min(392px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.tray-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.tray-head strong { font-size: 13.5px; font-weight: 650; }
.tray-head .muted { font-size: 12px; font-family: var(--mono); }
.tray-head .icon-btn { margin-left: auto; width: 28px; height: 28px; }
.tray-list { max-height: 300px; overflow-y: auto; }
.tray-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; padding: 9px 14px; border-bottom: 1px solid #eef2f3; }
.tray-item:last-child { border-bottom: 0; }
.tray-file { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12.8px; }
.tray-file .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-file .st { margin-left: auto; font: 11px/1 var(--mono); color: var(--muted); flex: none; }
.tray-file .st.err { color: var(--danger); }
.tray-file .st.done { color: var(--accent); }
.tray-bar { grid-column: 1 / -1; height: 3px; border-radius: 99px; background: #e9eef0; overflow: hidden; }
.tray-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.2s; }
.tray-item.is-error .tray-bar span { background: var(--danger); }
.tray-item.is-clickable { cursor: pointer; }
.tray-item.is-clickable:hover { background: #fff7f5; }
.tray-item.is-external .tray-file .nm { font-weight: 550; }

.process-error-box {
  padding: 12px 14px;
  border: 1px solid #f0cfcb;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #8c2c23;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.process-error-details-wrap { margin-top: 12px; }
.process-error-details-wrap summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.process-error-details {
  margin: 8px 0 0;
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border-radius: 10px;
  background: #101b21;
  color: #d8e6e6;
  font: 12px/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tray-bar.is-indeterminate span {
  width: 40% !important;
  animation: trayIndeterminate 1.2s linear infinite;
}
@keyframes trayIndeterminate {
  from { transform: translateX(-120%); }
  to { transform: translateX(260%); }
}
.tray-actions { display: flex; align-items: center; gap: 2px; }
.tray-actions .icon-btn { width: 26px; height: 26px; }
.tray-lock.is-locked { color: var(--accent); }
.tray-foot { display: flex; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); background: #fcfdfd; }
.tray-foot .btn { flex: 1; }
.tray-mini { font-size: 12px; color: var(--muted); padding: 10px 14px; }

/* ---------- toasts ---------- */

.toasts { position: fixed; top: 16px; right: 16px; z-index: 120; display: grid; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  animation: slideIn 0.18s ease;
}
.toast.is-error { border-left-color: var(--danger); }
.toast.is-warn { border-left-color: var(--warn); }
.toast .t-body { min-width: 0; }
.toast .t-body strong { display: block; font-weight: 600; }
.toast .t-body span { color: var(--muted); font-size: 12.5px; }

/* ---------- shares view ---------- */

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.panel-head h2 { font-size: 15px; font-weight: 650; }
.share-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 18px; border-bottom: 1px solid #eef2f3; }
.share-item:last-child { border-bottom: 0; }
.share-item .s-name { font-size: 14.5px; font-weight: 550; }
.share-item .s-meta { font: 12px/1.5 var(--mono); color: var(--muted); display: flex; flex-wrap: wrap; gap: 10px; margin-top: 3px; }
.share-item .s-actions { display: flex; gap: 6px; }

/* ---------- login ---------- */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  min-height: 100vh;
  background: var(--sidebar);
}
.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px 46px;
  color: #eaf3f2;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 8% 0%, rgba(21, 118, 105, 0.42), transparent 62%),
    radial-gradient(700px 500px at 92% 100%, rgba(20, 68, 78, 0.7), transparent 60%),
    var(--sidebar);
}
.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 78%);
  pointer-events: none;
}
.auth-brand { position: relative; display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; z-index: 1; }
.auth-hero { position: relative; z-index: 1; max-width: 470px; }
.auth-hero h1 { font-size: clamp(30px, 3.4vw, 44px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 720; margin-bottom: 16px; }
.auth-hero h1 em { font-style: normal; color: #8fd6c9; }
.auth-hero p { font-size: 15.5px; line-height: 1.6; color: #a9c3c4; max-width: 420px; }
.auth-points { position: relative; z-index: 1; display: grid; gap: 12px; margin-top: 30px; padding: 0; list-style: none; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #c6d9d8; }
.auth-points svg { flex: none; margin-top: 2px; color: #7dc8b9; }
.auth-shelf { position: absolute; right: -30px; bottom: 56px; width: 300px; opacity: 0.16; z-index: 0; }
.auth-foot { position: relative; z-index: 1; font-size: 12.5px; color: #6f8b91; }

.auth-main { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.auth-card { width: min(404px, 100%); padding: 34px 32px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.auth-mobile-brand small { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 1px; }
.auth-card h2 { font-size: 24px; letter-spacing: -0.025em; font-weight: 700; }
.auth-card .lead { margin: 6px 0 24px; font-size: 13.5px; color: var(--muted); }
.auth-card .btn { width: 100%; height: 42px; }
.auth-note { margin-top: 18px; padding: 11px 13px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---------- public share ---------- */

.share-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.share-top { display: flex; align-items: center; gap: 12px; padding: 18px 26px; border-bottom: 1px solid var(--line); background: #fff; }
.share-wrap { width: min(940px, calc(100% - 40px)); margin: 34px auto 60px; }
.share-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.share-head h1 { font-size: 26px; letter-spacing: -0.025em; font-weight: 700; }
.share-head .meta { margin-top: 5px; font: 12.5px/1.5 var(--mono); color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.share-lock { max-width: 420px; margin: 8vh auto 0; padding: 30px; border-radius: 16px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); text-align: center; }
.share-lock .lock-art { width: 54px; height: 54px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.share-lock h2 { font-size: 20px; margin-bottom: 6px; }
.share-lock p { color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.share-lock form { display: flex; gap: 8px; }
.share-note { margin-top: 22px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ---------- admin ---------- */

.admin-body { background: var(--bg); min-height: 100vh; }
.admin-top { display: flex; align-items: center; gap: 16px; padding: 14px 26px; background: var(--sidebar); color: var(--sidebar-ink); }
.admin-top .brand { padding: 0; font-size: 17px; }
.admin-top .brand-mark { width: 30px; height: 30px; }
.admin-links { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--sidebar-muted); }
.admin-links a:hover { color: #fff; }
.admin-wrap { width: min(1120px, calc(100% - 44px)); margin: 28px auto 60px; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-head h1 { font-size: 26px; letter-spacing: -0.025em; font-weight: 700; }
.admin-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.admin-head-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.admin-search { width: 220px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.stat .v { margin-top: 6px; font: 600 24px/1.1 var(--mono); font-variant-numeric: tabular-nums; }

.admin-table .thead, .admin-table .row {
  grid-template-columns: minmax(0, 2.2fr) 110px 128px minmax(0, 1.2fr) 132px 96px;
}
.admin-table .row { min-height: 62px; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-cell .nm { min-width: 0; }
.user-cell .nm strong { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cell .nm span { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.quota-cell { font: 12px/1.6 var(--mono); color: var(--muted); }
.quota-cell .mini-bar { height: 4px; margin-top: 5px; border-radius: 99px; background: #e9eef0; overflow: hidden; }
.quota-cell .mini-bar span { display: block; height: 100%; background: var(--accent); }
.admin-table .actions { opacity: 1; }

.switch { position: relative; display: inline-flex; width: 36px; height: 21px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { width: 100%; height: 100%; border-radius: 99px; background: #cfd9dc; transition: background 0.16s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform 0.16s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(15px); }

/* ---------- misc ---------- */

.mobile-only { display: none !important; }
.scrim { display: none; position: fixed; inset: 0; z-index: 25; background: rgba(9, 26, 33, 0.4); }
.scrim.is-active { display: block; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-title h2 { font-size: 16px; font-weight: 650; }

.hint-box { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid #cfe3ee; border-radius: 10px; background: #eef7fb; color: #28576c; font-size: 13px; line-height: 1.5; }
.hint-box svg { flex: none; margin-top: 1px; }

.progress-line { height: 4px; border-radius: 99px; background: #e6ebed; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }

.link-row { display: flex; gap: 8px; }
.link-row .input { font-family: var(--mono); font-size: 12.5px; }

/* ---------- PWA и офлайн ---------- */

.offline-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 110;
  max-width: min(560px, calc(100vw - 24px));
  padding: 9px 16px;
  border-radius: 10px;
  background: #12222b;
  color: #eaf3f2;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.offline-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.offline-card {
  width: min(480px, 100%);
  padding: 34px 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.offline-card h1 { margin: 0 0 10px; font-size: 24px; letter-spacing: -0.02em; }
.offline-card p { margin: 0 auto 18px; max-width: 360px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.offline-card .btn { text-decoration: none; }
.offline-mark {
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--warn-soft);
  color: var(--warn);
}
.offline-hint { margin: 18px auto 0 !important; font-size: 12.5px !important; }
body.is-offline .quota { opacity: 0.7; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 1080px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-main { padding: 22px; }
  .auth-mobile-brand { display: flex; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .sidebar.is-open { transform: none; }
  .mobile-only { display: inline-grid !important; }
  .topbar { padding: 0 14px; gap: 10px; height: 58px; }
  .workspace { padding: 18px 14px 80px; }
  .search { width: auto; flex: 1; min-width: 0; }
  .search input { padding-left: 30px; }
  .view-head { flex-direction: column; align-items: flex-start; }
  .view-head h1 { font-size: 22px; }
  .file-table .thead { display: none; }
  .file-table .row { grid-template-columns: 28px 32px minmax(0, 1fr) 70px; padding: 0 10px; gap: 8px; }
  .file-table .row .date, .file-table .thead .th-date { display: none; }
  .file-table .row .actions { opacity: 1; }
  .admin-wrap { width: calc(100% - 24px); margin-top: 18px; }
  .admin-top { flex-wrap: wrap; row-gap: 8px; padding: 12px 14px; }
  .admin-links { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .admin-head-actions { width: 100%; }
  .admin-search { width: 100%; flex: 1 1 160px; }
  .admin-table .thead { display: none; }
  .admin-table .row { grid-template-columns: minmax(0, 1fr) 84px 44px; gap: 8px; padding: 10px 12px; min-height: 0; }
  .admin-table .row .role-cell, .admin-table .row .quota-cell, .admin-table .row .status-cell { display: none; }
  .admin-table .row .actions { opacity: 1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal { margin-top: 4vh; }
  .tray { right: 12px; bottom: 12px; }
  .share-item { grid-template-columns: 30px minmax(0, 1fr); }
  .share-item .s-actions { grid-column: 2; justify-content: flex-start; }
}
