/* ELX-Cloud — оформление интерфейса */

:root {
  /* Подсветка карточки под курсором: цвет и размер свечения. Меняются
     из меню «Подсветка плиток», значения хранит браузер. */
  --tile-glow: #5b8cff;
  --tile-glow-size: 18px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "SF Mono", monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --speed: .22s;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- Тёмная тема (по умолчанию) ---------- */
html[data-theme="dark"] {
  --bg: #080b14;
  --bg-2: #0c1020;
  --surface: rgba(20, 26, 44, .72);
  --surface-solid: #141a2c;
  --surface-2: rgba(30, 38, 62, .6);
  --surface-dir: rgba(46, 57, 90, .72);
  --editor-bg: #0b0f1c;
  --editor-fg: #dfe6f5;
  --tk-com: #6b7796;
  --tk-str: #8ee08a;
  --tk-num: #f0b464;
  --tk-kw: #7aa2ff;
  --tk-key: #63d5cd;
  --tk-var: #e08ad6;
  --tk-fn: #ffd479;
  --tk-head: #a78bfa;
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e8ecf7;
  --text-2: #a5b0c9;
  --text-3: #6e7a96;
  --accent: #5b8cff;
  --accent-2: #a06bff;
  --accent-3: #35d9d0;
  --accent-soft: rgba(91, 140, 255, .16);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 20px 50px rgba(0, 0, 0, .55);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .4);
  --glow: 0 0 0 1px rgba(91, 140, 255, .35), 0 0 28px rgba(91, 140, 255, .28);
  --aurora-1: rgba(91, 140, 255, .38);
  --aurora-2: rgba(160, 107, 255, .32);
  --aurora-3: rgba(53, 217, 208, .22);
  --skeleton: linear-gradient(90deg, rgba(255,255,255,.03), rgba(255,255,255,.09), rgba(255,255,255,.03));
  color-scheme: dark;
}

/* ---------- Светлая тема ---------- */
html[data-theme="light"] {
  --bg: #f4f6fc;
  --bg-2: #eaeefa;
  --surface: rgba(255, 255, 255, .82);
  --surface-solid: #ffffff;
  --surface-2: rgba(240, 243, 252, .9);
  --surface-dir: rgba(255, 255, 255, .95);
  --editor-bg: #ffffff;
  --editor-fg: #1c2436;
  --tk-com: #8a93a8;
  --tk-str: #1a7f37;
  --tk-num: #b45309;
  --tk-kw: #2b57d1;
  --tk-key: #0e7490;
  --tk-var: #a21caf;
  --tk-fn: #92400e;
  --tk-head: #6d28d9;
  --border: rgba(16, 24, 48, .1);
  --border-strong: rgba(16, 24, 48, .18);
  --text: #131a2c;
  --text-2: #4d5872;
  --text-3: #7e8aa6;
  --accent: #3b6dff;
  --accent-2: #8b4dff;
  --accent-3: #17b3ab;
  --accent-soft: rgba(59, 109, 255, .12);
  --ok: #0ea472;
  --warn: #d98a00;
  --danger: #e0455f;
  --shadow: 0 18px 44px rgba(24, 39, 84, .14);
  --shadow-sm: 0 6px 16px rgba(24, 39, 84, .1);
  --glow: 0 0 0 1px rgba(59, 109, 255, .3), 0 0 24px rgba(59, 109, 255, .2);
  --aurora-1: rgba(59, 109, 255, .22);
  --aurora-2: rgba(139, 77, 255, .18);
  --aurora-3: rgba(23, 179, 171, .16);
  --skeleton: linear-gradient(90deg, rgba(16,24,48,.04), rgba(16,24,48,.09), rgba(16,24,48,.04));
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

.svg-sprite { display: none; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Фоновое сияние ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
/* Мягкое пятно рисуем градиентом, а не размытием: тот же вид, но браузеру
   не приходится размывать полэкрана при каждой перерисовке. */
.aurora span { position: absolute; display: block; opacity: .85; }
/* Пятна стоят на месте: бесконечное движение фона держало браузер в работе
   всё время, пока открыта страница, и отклик на наведение проседал. */
.aurora .a1 { width: 46vw; height: 46vw; left: -10vw; top: -14vw; background: radial-gradient(closest-side, var(--aurora-1), transparent); }
.aurora .a2 { width: 40vw; height: 40vw; right: -12vw; top: 8vh; background: radial-gradient(closest-side, var(--aurora-2), transparent); }
.aurora .a3 { width: 44vw; height: 44vw; left: 24vw; bottom: -22vw; background: radial-gradient(closest-side, var(--aurora-3), transparent); }


/* ---------- Каркас: боковое меню + контент ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

/* Боковое меню одинаково на всех страницах, поэтому оно не анимируется:
   иначе при каждом переходе казалось бы, что интерфейс дёргается. */
.sidebar {
  position: sticky; top: 0; z-index: 60;
  display: flex; flex-direction: column; gap: 4px;
  height: 100vh; padding: 18px 14px 16px; overflow-y: auto;
  background: var(--surface-solid); border-right: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 20px -6px var(--accent);
  transition: transform var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.brand-mark svg { width: 22px; height: 22px; stroke: #fff; }
.brand:hover .brand-mark { transform: translateY(-2px) rotate(-6deg); box-shadow: 0 10px 26px -6px var(--accent); }
.brand-text { font-size: 18px; }
.brand-text span { background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-title { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin: 16px 10px 6px; }
.side-nav .side-title:first-child { margin-top: 4px; }

.side-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px; color: var(--text-2); font-size: 14px;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.side-item svg { width: 18px; height: 18px; flex: none; }
.side-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.side-item.is-active { background: var(--accent-soft); color: var(--text); font-weight: 500; }
.side-item.is-active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent);
}

.side-block { margin-top: 18px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 11px;
  color: var(--text-2); font-size: 13.5px; cursor: pointer; transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.side-link svg { width: 17px; height: 17px; flex: none; }
.side-link .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link:hover { background: var(--surface-2); color: var(--text); transform: translateX(2px); }
.side-link.is-active { background: var(--accent-soft); color: var(--text); font-weight: 500; }
.side-link .sub { margin-left: auto; font-size: 10.5px; color: var(--text-3); }

.side-build {
  margin-top: auto; display: flex; flex-direction: column; gap: 1px;
  padding: 10px 12px 8px; font-size: 11px; line-height: 1.35; color: var(--text-3);
  transition: color .2s var(--ease);
}
.side-build .bv { font-weight: 600; letter-spacing: .02em; }
.side-build:hover { color: var(--text-2); }
.side-build + .side-foot { margin-top: 0; }

.side-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); }

.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; color: var(--text-2);
  transition: background-color var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: translateY(0) scale(.96); }

.theme-toggle { position: relative; overflow: hidden; }
/* Иконки лежат друг на друге, поэтому центрируем их вручную:
   у элемента с position: absolute выравнивание сеткой не работает. */
.theme-toggle svg {
  position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  transition: transform .45s var(--ease), opacity .3s var(--ease);
}
html[data-theme="dark"] .ic-sun { transform: translateY(0) rotate(0); opacity: 1; }
html[data-theme="dark"] .ic-moon { transform: translateY(26px) rotate(45deg); opacity: 0; }
html[data-theme="light"] .ic-sun { transform: translateY(-26px) rotate(-45deg); opacity: 0; }
html[data-theme="light"] .ic-moon { transform: translateY(0) rotate(0); opacity: 1; }

.user-menu { position: relative; flex: 1; min-width: 0; }
.user-chip {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 12px 5px 5px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; transition: background-color var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.user-chip:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em; flex: none;
}
.avatar-lg { width: 42px; height: 42px; font-size: 15px; }
/* Загруженный аватар занимает то же место, что и кружок с инициалами */
img.avatar { object-fit: cover; background: var(--surface-2); }
.avatar-upload { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.avatar-preview { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  display: grid; place-items: center; font-size: 28px; font-weight: 700; }
.user-name { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu-pop {
  position: absolute; left: 0; bottom: calc(100% + 10px); width: 252px; padding: 8px;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(8px) scale(.97);
  transition: background-color var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease), box-shadow var(--speed) var(--ease); z-index: 80;
}
.menu-pop.is-open { opacity: 1; visibility: visible; transform: none; }
.menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 12px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head strong { display: block; font-size: 14px; }
.menu-head small { color: var(--text-3); font-size: 12px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-2); font-size: 14px; text-align: left; transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.menu-item:hover { background: var(--accent-soft); color: var(--text); }
.menu-item.danger:hover { background: rgba(251, 113, 133, .14); color: var(--danger); }
.menu-item svg { width: 18px; height: 18px; }
.menu-state {
  margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: .03em;
  padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
}

/* Переключатель прямо в пункте меню — то же, что и в настройках, только меньше */
.menu-switch {
  margin-left: auto; position: relative; flex: none; width: 34px; height: 19px;
  border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface-2);
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.menu-switch::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--text-3); transition: transform var(--speed) var(--ease), background var(--speed) var(--ease);
}
.menu-switch.is-on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 0 12px -3px var(--accent); }
.menu-switch.is-on::after { transform: translateX(15px); background: #fff; }
html[data-motion="off"] .menu-switch, html[data-motion="off"] .menu-switch::after { transition: none; }
html[data-motion="off"] .menu-state { background: var(--surface-2); color: var(--text-3); }
.menu-form { margin: 0; }

.content { min-width: 0; display: flex; flex-direction: column; }
.mobilebar {
  display: none; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}
.mobilebar-title { font-weight: 600; }
.sidebar-veil { display: none; }

/* ---------- Контент ---------- */
.main { width: 100%; padding: clamp(16px, 1.8vw, 26px) clamp(16px, 2vw, 32px) 40px; }
.main-plain { display: grid; place-items: center; min-height: 100vh; padding: 24px; position: relative; }
/* На странице входа сообщение не должно сдвигать карточку — она остаётся по центру. */
.main-plain > .flash {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 100; width: min(440px, calc(100vw - 32px)); margin: 0;
  box-shadow: var(--shadow); background: var(--surface-solid);
}

.card {
  background: var(--surface-solid);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; animation: fadeIn .25s var(--ease) both; }
.page-head h1 { margin: 0; font-size: clamp(21px, 2.4vw, 27px); letter-spacing: -.02em; }
.page-head p { margin: 2px 0 0; color: var(--text-3); font-size: 13.5px; }
.page-head .spacer { margin-left: auto; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } }
@keyframes fadeIn { from { opacity: 0; } }
.fade-in { animation: fadeIn .25s var(--ease) both; }

/* ---------- Кнопки ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 500; font-size: 14px;
  cursor: pointer; overflow: hidden; white-space: nowrap;
  transition: transform .16s var(--ease), box-shadow var(--speed) var(--ease), background var(--speed) var(--ease), border-color var(--speed) var(--ease), opacity var(--speed) var(--ease);
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent;
  box-shadow: 0 8px 22px -10px var(--accent);
}
.btn-primary:hover { box-shadow: 0 12px 30px -8px var(--accent), var(--glow); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: rgba(251, 113, 133, .3); background: rgba(251, 113, 133, .1); }
.btn-danger:hover { background: rgba(251, 113, 133, .18); box-shadow: 0 0 20px -6px var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { padding: 9px; }

/* Волна при клике */
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255, 255, 255, .35); pointer-events: none; animation: ripple .55s var(--ease); }
@keyframes ripple { to { transform: scale(3.2); opacity: 0; } }

/* ---------- Поля ввода ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--text-3); }
.input, .select {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease), background var(--speed) var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--glow); }

/* На широких экранах поля не растягиваются во всю колонку: короткие значения
   (порты, числа, выбор из списка) занимают ровно столько, сколько нужно. */
.panel .field .input,
.panel .field .select { max-width: 440px; }
.panel .field .select { max-width: 340px; }
.panel .field .input-num { max-width: 180px; }
.panel .field .input-wide { max-width: 760px; }
.panel .field .flex .input { max-width: 180px; }

.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-2); user-select: none; }
.check input { appearance: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); background: var(--surface-2); cursor: pointer; position: relative; transition: background-color var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease), box-shadow var(--speed) var(--ease); flex: none; }
.check input:checked { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 0 14px -3px var(--accent); }
.check input:checked::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(42deg); }

/* Подсекция внутри панели настроек: длинную форму проще читать частями */
.subsection { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.subsection:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.subsection h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--text); }
.subsection .subsection-sub { margin: 0 0 16px; font-size: 12.5px; line-height: 1.55; color: var(--text-3); max-width: 70ch; }
.toggle-list { display: flex; flex-direction: column; gap: 14px; }

/* Настройка с пояснением: подсказка выровнена под текстом галочки,
   поэтому видно, к какому переключателю она относится */
.opt + .opt { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.opt-hint { margin: 8px 0 0 30px; font-size: 12.5px; line-height: 1.55; color: var(--text-3); max-width: 70ch; }
.opt-actions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.opt-actions .flex { row-gap: 10px; }

/* Переключатель: для настроек он понятнее галочки — сразу видно «включено/выключено» */
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 14px; color: var(--text-2); user-select: none; }
.toggle input {
  appearance: none; position: relative; flex: none; width: 42px; height: 24px; cursor: pointer;
  border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface-2);
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.toggle input::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--text-3); transition: transform var(--speed) var(--ease), background var(--speed) var(--ease);
}
.toggle input:checked { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 0 14px -3px var(--accent); }
.toggle input:checked::after { transform: translateX(18px); background: #fff; }
.toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html[data-motion="off"] .toggle input, html[data-motion="off"] .toggle input::after { transition: none; }

/* ---------- Флеш-сообщения и всплывашки ---------- */
.flash {
  display: flex; align-items: center; gap: 11px; padding: 13px 16px; margin-bottom: 18px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); font-size: 14px;
}
.flash svg { width: 19px; height: 19px; flex: none; }
.flash span { white-space: pre-line; }
.flash-ok { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .1); color: var(--ok); }
.flash-err { border-color: rgba(251, 113, 133, .35); background: rgba(251, 113, 133, .1); color: var(--danger); }
.flash-x { margin-left: auto; background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; opacity: .6; }
.flash-x:hover { opacity: 1; }

/* Уведомления — поверх всего, включая модальные окна и просмотрщик:
   сообщение об ошибке бесполезно, если его закрывает затемнение. */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px;
  padding: 12px 15px; border-radius: 13px; background: var(--surface-solid);
  border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 14px;
  animation: toastIn .32s var(--ease) both;
}
.toast.is-out { animation: toastOut .28s var(--ease) forwards; }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast-ok { border-left: 3px solid var(--ok); }
.toast-ok svg { color: var(--ok); }
.toast-err { border-left: 3px solid var(--danger); }
.toast-err svg { color: var(--danger); }
.toast-info { border-left: 3px solid var(--accent); }
.toast-info svg { color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.95); } }

/* ---------- Вход ---------- */
.auth-card {
  width: min(430px, 100%); padding: clamp(26px, 4vw, 40px);
  background: var(--surface); backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--border); border-radius: 26px; box-shadow: var(--shadow);
  animation: authIn .6s var(--ease) both;
}
@keyframes authIn { from { opacity: 0; transform: translateY(26px) scale(.97); } }
.auth-logo { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 40px -12px var(--accent); animation: floaty 5s ease-in-out infinite; }
.auth-logo svg { width: 34px; height: 34px; stroke: #fff; }
@keyframes floaty { 50% { transform: translateY(-7px); } }
.auth-card h1 { margin: 0 0 4px; text-align: center; font-size: 25px; letter-spacing: -.02em; }
.auth-card .sub { margin: 0 0 26px; text-align: center; color: var(--text-3); font-size: 14px; }
.auth-card .btn { width: 100%; margin-top: 8px; padding: 13px; font-size: 15px; }
.auth-foot { margin-top: 22px; text-align: center; color: var(--text-3); font-size: 12.5px; }

/* ---------- Файловый менеджер ---------- */
.quota { padding: 12px 12px 14px; border-radius: 14px; background: var(--surface-2); margin-top: 14px; }
.quota-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.quota-bar { height: 7px; border-radius: 5px; background: var(--border); overflow: hidden; }
.quota-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 12px var(--accent); transition: width .6s var(--ease); }
.quota-fill.warn { background: linear-gradient(90deg, var(--warn), var(--danger)); box-shadow: 0 0 12px var(--warn); }

.fm-main { min-width: 0; animation: fadeIn .25s var(--ease) both; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 14px; }
.crumbs { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; min-width: 0; }
.crumb { padding: 5px 10px; border-radius: 9px; font-size: 13.5px; color: var(--text-2); cursor: pointer; transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease); }
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.is-last { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--text-3); opacity: .6; }

.search-box { position: relative; margin-left: auto; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.search-box .input { padding-left: 36px; width: 210px; transition: width .3s var(--ease); }
.search-box .input:focus { width: 280px; }

.view-switch { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.view-switch button {
  display: grid; place-items: center; width: 34px; height: 32px; border: 0; border-radius: 9px;
  background: none; color: var(--text-3); cursor: pointer; transition: background-color .18s var(--ease), color .18s var(--ease);
}
.view-switch button:hover { color: var(--text); }
.view-switch button.is-active { background: var(--surface-solid); color: var(--accent); box-shadow: var(--shadow-sm); }

/* Панель действий не участвует в потоке: иначе её появление сдвигало бы
   список файлов вниз при каждом выделении. */
.selbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 120; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin: 0; max-width: calc(100vw - 40px); overflow-x: auto;
  border-radius: 16px; background: var(--surface-solid);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: selbarIn .2s var(--ease) both;
}
@keyframes selbarIn { from { opacity: 0; transform: translate(-50%, 14px); } }
.selbar strong { white-space: nowrap; }
.selbar .btn { flex: none; }
.selbar .spacer { min-width: 8px; margin: 0; }

@media (max-width: 720px) {
  .selbar { left: 12px; right: 12px; transform: none; max-width: none; justify-content: flex-start; }
  @keyframes selbarIn { from { opacity: 0; transform: translateY(14px); } }
}
.selbar strong { font-size: 14px; }
.selbar .spacer { margin-left: auto; }

/* Область файлов */
.fm-body { position: relative; min-height: 380px; padding: 6px; border-radius: var(--radius-lg); }
.fm-body.is-dragover::after {
  content: "Отпустите файлы для загрузки";
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: var(--radius-lg);
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 16px;
  backdrop-filter: blur(3px); animation: pulseGlow 1.6s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: inset 0 0 30px -10px var(--accent); }
  50% { box-shadow: inset 0 0 60px -6px var(--accent); }
}

/* Табличный вид */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap;
}
.tbl th:hover { color: var(--text-2); }
.tbl th .arrow { opacity: 0; margin-left: 4px; }
.tbl th.sorted .arrow { opacity: 1; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.tbl tr { transition: background .16s var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.is-selected { background: var(--accent-soft); }
.tbl .col-name { width: 55%; }
.tbl .col-check { width: 34px; }
.tbl .col-actions { width: 130px; text-align: right; }
.row-name { display: flex; align-items: center; gap: 11px; cursor: pointer; min-width: 0; }
.row-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-mini { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent); margin-left: 7px; vertical-align: middle; }
.badge-mini svg { width: 11px; height: 11px; stroke-width: 2.2; }
.badge-lock { background: rgba(251, 191, 36, .16); color: var(--warn); }

.ficon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; background: var(--surface-2); transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease); }
.ficon svg { width: 19px; height: 19px; }
.k-folder { color: var(--accent); background: var(--accent-soft); }
.k-image { color: #f472b6; background: rgba(244, 114, 182, .14); }
.k-video { color: #a78bfa; background: rgba(167, 139, 250, .14); }
.k-audio { color: #34d399; background: rgba(52, 211, 153, .14); }
.k-pdf, .k-doc { color: #fb7185; background: rgba(251, 113, 133, .13); }
.k-sheet { color: #4ade80; background: rgba(74, 222, 128, .13); }
.k-slides { color: #fb923c; background: rgba(251, 146, 60, .13); }
.k-archive { color: #fbbf24; background: rgba(251, 191, 36, .14); }
.k-code { color: #38bdf8; background: rgba(56, 189, 248, .14); }
.k-text { color: var(--text-2); }
.k-app { color: #c084fc; background: rgba(192, 132, 252, .14); }

/* Цветные метки: раскрашивают значок объекта, чтобы его было видно сразу */
.c-red { color: #fb7185 !important; background: rgba(251, 113, 133, .18) !important; }
.c-orange { color: #fb923c !important; background: rgba(251, 146, 60, .18) !important; }
.c-yellow { color: #fbbf24 !important; background: rgba(251, 191, 36, .18) !important; }
.c-green { color: #34d399 !important; background: rgba(52, 211, 153, .18) !important; }
.c-teal { color: #2dd4bf !important; background: rgba(45, 212, 191, .18) !important; }
.c-blue { color: #60a5fa !important; background: rgba(96, 165, 250, .18) !important; }
.c-violet { color: #a78bfa !important; background: rgba(167, 139, 250, .18) !important; }
.c-pink { color: #f472b6 !important; background: rgba(244, 114, 182, .18) !important; }
.c-gray { color: #94a3b8 !important; background: rgba(148, 163, 184, .18) !important; }

/* Папка, из которой вернулись: короткая подсветка, чтобы взгляд её нашёл */
.tile.is-returned, .tbl tbody tr.is-returned { animation: returnGlow 1.2s var(--ease); }
@keyframes returnGlow {
  0%, 60% { box-shadow: 0 0 0 2px var(--accent), var(--glow); }
  100% { box-shadow: none; }
}
html[data-motion="off"] .tile.is-returned,
html[data-motion="off"] .tbl tbody tr.is-returned { animation: none; box-shadow: 0 0 0 2px var(--accent); }

/* Удалённый объект тает на месте, список смыкается без перерисовки */
.tile.is-removing, .tbl tbody tr.is-removing {
  animation: itemOut .24s var(--ease) forwards;
  pointer-events: none;
}
@keyframes itemOut {
  to { opacity: 0; transform: scale(.94); }
}
html[data-motion="off"] .tile.is-removing,
html[data-motion="off"] .tbl tbody tr.is-removing { animation: none; opacity: 0; }

.thumb-stat { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); margin-top: 6px; }
.thumb-stat b { color: var(--text-2); font-weight: 600; }

/* Папки светлее файлов: в длинном списке видно, где каталог, а где документ */
.tile.is-dir { background: var(--surface-dir); }
.tile.is-dir .tile-thumb { background: var(--surface-dir); }
.tbl tbody tr.is-dir { background: var(--surface-dir); }
.tbl tbody tr.is-dir:hover { background: var(--surface-2); }
/* Выделение важнее подсветки папок — иначе выбранная папка выглядит как обычная */
.tbl tbody tr.is-dir.is-selected { background: var(--accent-soft); }

/* Цветная метка красит всю карточку, а не только значок */
[data-color="red"] { --tint: #fb7185; }
[data-color="orange"] { --tint: #fb923c; }
[data-color="yellow"] { --tint: #fbbf24; }
[data-color="green"] { --tint: #34d399; }
[data-color="teal"] { --tint: #2dd4bf; }
[data-color="blue"] { --tint: #60a5fa; }
[data-color="violet"] { --tint: #a78bfa; }
[data-color="pink"] { --tint: #f472b6; }
[data-color="gray"] { --tint: #94a3b8; }

.tile[data-color] {
  background: color-mix(in srgb, var(--tint) 16%, var(--surface-2));
  border-color: color-mix(in srgb, var(--tint) 40%, var(--border));
}
.tile[data-color] .tile-thumb { background: color-mix(in srgb, var(--tint) 10%, var(--surface)); }
.tile[data-color]:hover { border-color: var(--tint); box-shadow: 0 0 var(--tile-glow-size) calc(var(--tile-glow-size) / -4) var(--tint); }
.tile[data-color].is-selected { border-color: var(--accent); }

.tbl tbody tr[data-color] { background: color-mix(in srgb, var(--tint) 11%, transparent); }
.tbl tbody tr[data-color]:hover { background: color-mix(in srgb, var(--tint) 20%, transparent); }
.tbl tbody tr[data-color].is-selected { background: var(--accent-soft); }

.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 4px 0 4px; }
.swatch {
  height: 52px; border-radius: 14px; border: 1px solid var(--border); cursor: pointer;
  display: grid; place-items: center; color: var(--text-3);
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.swatch:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.swatch svg { width: 18px; height: 18px; }
.swatch-none { background: var(--surface-2); }

/* В палитре образцы залиты цветом целиком — так выбирать нагляднее */
.swatch.c-red { background: #fb7185 !important; }
.swatch.c-orange { background: #fb923c !important; }
.swatch.c-yellow { background: #fbbf24 !important; }
.swatch.c-green { background: #34d399 !important; }
.swatch.c-teal { background: #2dd4bf !important; }
.swatch.c-blue { background: #60a5fa !important; }
.swatch.c-violet { background: #a78bfa !important; }
.swatch.c-pink { background: #f472b6 !important; }
.swatch.c-gray { background: #94a3b8 !important; }
tr:hover .ficon, .tile:hover .ficon { transform: scale(1.08); }

.rowbtns { display: flex; gap: 3px; justify-content: flex-end; opacity: 0; transition: opacity .18s var(--ease); }
tr:hover .rowbtns, tr.is-selected .rowbtns { opacity: 1; }
.rowbtn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 9px; background: none; color: var(--text-3); cursor: pointer; transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease); }
.rowbtn:hover { background: var(--surface-solid); color: var(--accent); box-shadow: var(--shadow-sm); }
.rowbtn.danger:hover { color: var(--danger); }
.rowbtn svg { width: 16px; height: 16px; }

/* Плитки */
.grid { display: grid; gap: 14px; padding: 8px 6px; }
.grid-sm { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid-lg { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.tile {
  position: relative; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
  animation: tileIn .22s var(--ease) both;
}
@keyframes tileIn { from { opacity: 0; transform: translateY(10px); } }
.tile:hover { border-color: var(--tile-glow); box-shadow: 0 0 var(--tile-glow-size) calc(var(--tile-glow-size) / -4) var(--tile-glow); }
.tile.is-selected { border-color: var(--accent); box-shadow: var(--glow); }
.tile-thumb { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--surface); overflow: hidden; }
.grid-lg .tile-thumb { aspect-ratio: 16 / 11; }
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s var(--ease), transform .45s var(--ease); }
.tile-thumb img.loaded { opacity: 1; }
/* Из кэша браузера — сразу, без проявления: иначе повторный заход в папку
   выглядит как повторное создание миниатюр */
.tile-thumb img.ready { opacity: 1; transition: none; }
.tile-thumb .ficon { width: 54px; height: 54px; border-radius: 15px; }
.tile-thumb .ficon svg { width: 28px; height: 28px; }
.grid-sm .tile-thumb .ficon { width: 42px; height: 42px; }
.grid-sm .tile-thumb .ficon svg { width: 22px; height: 22px; }
.tile-body { padding: 9px 11px 11px; }
.tile-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.tile-check { position: absolute; left: 8px; top: 8px; z-index: 3; opacity: 0; transition: opacity .18s var(--ease); }
.tile:hover .tile-check, .tile.is-selected .tile-check { opacity: 1; }
/* Значки складываются столбиком: в ряд они занимали место названия,
   а сверху справа свободного места больше по высоте, чем по ширине. */
.tile-badges { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.tile-badge { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: rgba(0, 0, 0, .62); color: #fff; }
.tile-badge svg { width: 13px; height: 13px; }

/* Пустая папка и загрузка */
.empty { display: grid; place-items: center; gap: 12px; padding: 70px 20px; text-align: center; color: var(--text-3); animation: fadeUp .4s var(--ease) both; }
.empty svg { width: 54px; height: 54px; opacity: .35; }
.empty strong { color: var(--text-2); font-size: 16px; font-weight: 600; }
.empty p { margin: 0; font-size: 13.5px; max-width: 340px; }

.skeleton { border-radius: 12px; background: var(--skeleton); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-row { height: 52px; margin: 6px 0; }

/* Загрузка файлов */
.uploads { position: fixed; right: 20px; bottom: 20px; z-index: 150; width: min(370px, calc(100vw - 40px)); }
.uploads-card { padding: 0; overflow: hidden; background: var(--surface-solid); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); animation: toastIn .3s var(--ease) both; }
.uploads-head { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; font-weight: 600; }
.uploads-head .spacer { margin-left: auto; }
.uploads-list { max-height: 260px; overflow-y: auto; }
.up-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px; }
.up-item .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .st { font-size: 11.5px; color: var(--text-3); }
.up-item.done .st { color: var(--ok); }
.up-item.err .st { color: var(--danger); }
.up-bar { height: 3px; background: var(--border); border-radius: 3px; overflow: hidden; width: 64px; flex: none; }
.up-item .up-btn { width: 26px; height: 26px; flex: none; padding: 0; }
.up-item .up-btn svg { width: 15px; height: 15px; }
.up-item.paused .st { color: var(--warn); }
.up-item.paused .up-fill { opacity: .5; }
.up-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s var(--ease); box-shadow: 0 0 8px var(--accent); }

/* ---------- Контекстное меню ---------- */
.ctx {
  position: fixed; z-index: 250; min-width: 226px; padding: 6px;
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  animation: ctxIn .16s var(--ease) both;
}
@keyframes ctxIn { from { opacity: 0; transform: scale(.96); } }
html[data-motion="off"] .ctx { animation: none; }

.ctx-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 10px; background: none;
  color: var(--text-2); font-size: 13.5px; text-align: left; cursor: pointer;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.ctx-item:hover { background: var(--accent-soft); color: var(--text); }
.ctx-item svg { width: 17px; height: 17px; flex: none; }
.ctx-item .hint-key { margin-left: auto; font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.ctx-item.danger:hover { background: rgba(251, 113, 133, .14); color: var(--danger); }
.ctx-item[disabled] { opacity: .4; pointer-events: none; }
.sort-switch { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.sort-switch button {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px;
  border: 0; border-radius: 9px; background: transparent; cursor: pointer;
  color: var(--text-2); font: inherit; font-size: 13px; transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}
.sort-switch button:hover { color: var(--text); background: var(--surface); }
.sort-switch button.is-on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sort-switch .arrow { font-size: 12px; }

.ctx-sep { height: 1px; margin: 5px 8px; background: var(--border); }
.ctx-head {
  padding: 8px 12px 9px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ctx-head strong { color: var(--text); font-size: 13px; }

/* Объекты, вырезанные в буфер, показываются приглушённо */
.is-cut { opacity: .45; }

/* ---------- Модальные окна ---------- */
.modal-back {
  /* Выше просмотрщика (400): вопрос об удалении не должен прятаться за снимком. */
  position: fixed; inset: 0; z-index: 450; display: grid; place-items: center; padding: 20px;
  background: rgba(3, 6, 16, .6); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .16s var(--ease), visibility .16s;
}
.modal-back:not(.is-open) { pointer-events: none; }
.modal-back.is-open { opacity: 1; visibility: visible; }
.modal {
  width: min(480px, 100%); max-height: 88vh; overflow-y: auto; padding: 24px;
  background: var(--surface-solid); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow);
  transform: translateY(18px) scale(.97); transition: transform .3s var(--ease);
}
.modal-back.is-open .modal { transform: none; }
.modal-wide { width: min(680px, 100%); }
.modal h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.01em; }
.modal .modal-sub { margin: 0 0 18px; color: var(--text-3); font-size: 13.5px; }
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; }
.modal-x { position: absolute; }

/* ---------- Текстовый редактор ---------- */
.editor-modal { width: min(1080px, 100%); max-width: 100%; height: min(84vh, 900px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.editor-head { padding: 16px 20px 10px; border-bottom: 1px solid var(--border); }
.editor-title { font-size: 16px; font-weight: 600; word-break: break-all; }
.editor-meta { margin-top: 3px; font-size: 12px; color: var(--text-3); }

.editor-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.editor-tool { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.editor-tool .select { width: auto; }
.select-sm { padding: 6px 10px; font-size: 12.5px; }
.editor-font { display: flex; align-items: center; gap: 6px; }
.editor-font b { min-width: 22px; text-align: center; font-size: 12.5px; color: var(--text-2); }
.editor-font .btn { padding: 5px 10px; }
.editor-state { font-size: 12px; color: var(--text-3); }
.editor-state.is-dirty { color: var(--warn); }

.editor-body { flex: 1; min-height: 0; padding: 0; }
/* Подсвеченный текст лежит снизу, прозрачное поле ввода — сверху.
   У обоих одинаковые шрифт, отступы и перенос строк, иначе символы разъедутся. */
.editor-wrap { position: relative; height: 100%; overflow: hidden; background: var(--editor-bg); }
.editor-hl, .editor-input {
  position: absolute; inset: 0; margin: 0; padding: 16px 20px;
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  font-size: 13px; line-height: 20px; tab-size: 4;
  white-space: pre; overflow: auto; border: 0;
}
.editor-hl { color: var(--editor-fg); pointer-events: none; }
.editor-hl code { font: inherit; }
.editor-input {
  background: transparent; color: transparent; caret-color: var(--accent);
  resize: none; outline: none; width: 100%; height: 100%;
}
.editor-input::selection { background: var(--accent-soft); color: transparent; }
.editor-input[readonly] { caret-color: transparent; }

/* Цвета подсветки: на тёмной теме — тёмное поле, на светлой — белое */
.tk-com { color: var(--tk-com); font-style: italic; }
.tk-str { color: var(--tk-str); }
.tk-num { color: var(--tk-num); }
.tk-kw { color: var(--tk-kw); font-weight: 600; }
.tk-key { color: var(--tk-key); }
.tk-var { color: var(--tk-var); }
.tk-fn { color: var(--tk-fn); }
.tk-head { color: var(--tk-head); font-weight: 600; }
.tk-code { color: var(--tk-str); }
.tk-bold { font-weight: 700; color: var(--editor-fg); }
.tk-em { font-style: italic; color: var(--editor-fg); }
.tk-link { color: var(--tk-fn); text-decoration: underline; }

/* Разворот окна редактора: настоящий полный экран и запасной вариант */
.editor-modal:fullscreen { width: 100vw; height: 100vh; max-width: 100vw; border-radius: 0; }
.editor-back.is-full { padding: 0; }
.editor-back.is-full .editor-modal { width: 100vw; height: 100vh; max-width: 100vw; border-radius: 0; }

@media (max-width: 720px) {
  .editor-modal { height: 92vh; }
  .editor-tools { gap: 10px; padding: 10px 14px; }
  .editor-hl, .editor-input { padding: 12px 14px; }
}

/* Скрытый ввод там, где пароль не от учётной записи.
   Поле остаётся текстовым, поэтому браузер не принимает форму за вход
   и не предлагает сохранить пароль, а символы всё равно не видны. */
.secret { -webkit-text-security: disc; text-security: disc; }

/* Подключённая папка сервера: значок сервера отличает её от своих */
.badge-mount { color: var(--accent-3); }
.tile-badge.badge-mount { background: rgba(0, 0, 0, .5); }

/* Звёздочка избранного — заметная, но не спорит с цветными метками */
.badge-fav { color: #fbbf24; }
.tile-badge.badge-fav { background: rgba(0, 0, 0, .5); }
.fav-table .is-gone .nm { text-decoration: line-through; opacity: .7; }

.list-title { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }

/* Панель-кнопка в профиле и список публичных ссылок */
.stat-btn { text-align: left; cursor: pointer; font: inherit; color: inherit; border: 1px solid var(--border);
  transition: transform .16s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease); }
.stat-btn:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.link-list { max-height: 52vh; overflow-y: auto; margin: 4px -4px 0; padding: 0 4px; }
.link-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.link-row:last-child { border-bottom: 0; }
.link-main { min-width: 0; flex: 1; }
.link-path { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-url { display: block; font-size: 12px; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 3px; }
.link-actions { display: flex; gap: 8px; flex: none; }

@media (max-width: 640px) {
  .link-row { flex-direction: column; align-items: stretch; }
  .link-actions { justify-content: flex-end; }
}

/* Карточка файла, который нечем открыть */
.info-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.info-head .ficon { width: 46px; height: 46px; border-radius: 14px; flex: none; }
.info-head .ficon svg { width: 24px; height: 24px; }
.info-title { min-width: 0; }
.info-title h3 { margin: 0; font-size: 16px; word-break: break-word; }
.info-title .modal-sub { margin: 3px 0 0; }
.info-rows { border-top: 1px solid var(--border); }
.info-row { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-row span { color: var(--text-3); }
.info-row b { color: var(--text-2); font-weight: 500; text-align: right; word-break: break-word; }
.info-foot { flex-wrap: wrap; }

/* Цифровая клавиатура */
.numpad { width: min(340px, 100%); text-align: center; }
.numpad h3 { text-align: left; margin-bottom: 14px; }
.numpad-display {
  padding: 14px 18px; margin-bottom: 16px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: .04em;
  color: var(--text); min-height: 62px; display: grid; place-items: center;
  box-shadow: inset 0 0 24px -18px var(--accent);
}
.numpad-display.is-empty { color: var(--text-3); }
.numpad-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.numpad-key {
  position: relative; overflow: hidden;
  padding: 16px 0; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-size: 21px; font-weight: 600; font-family: var(--mono); cursor: pointer;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.numpad-key:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 20px -8px var(--accent); transform: translateY(-1px); }
.numpad-key:active { transform: scale(.95); }
.numpad-fn { color: var(--text-2); font-size: 18px; }
.numpad-fn:hover { color: var(--danger); border-color: rgba(251, 113, 133, .4); background: rgba(251, 113, 133, .12); box-shadow: 0 0 18px -8px var(--danger); }

/* Просмотр изображений */
.lightbox {
  position: fixed; inset: 0; z-index: 400; display: grid; place-items: center;
  background: rgba(2, 4, 12, .93); opacity: 0; visibility: hidden; transition: opacity .16s var(--ease), visibility .16s;
}
.lightbox:not(.is-open) { pointer-events: none; }
.lightbox.is-open { opacity: 1; visibility: visible; }
.lb-loading {
  position: absolute; display: none; flex-direction: column; align-items: center; gap: 14px;
  color: #fff; font-size: 14px; letter-spacing: .02em;
}
.lb-loading.is-on { display: flex; }
.lb-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .18); border-top-color: #fff;
  animation: lbSpin .8s linear infinite;
}
@keyframes lbSpin { to { transform: rotate(360deg); } }
html[data-motion="off"] .lb-spinner { animation: none; border-top-color: rgba(255,255,255,.6); }
/* Содержимое лежит в отдельном окне: видно, где кончается снимок,
   и есть куда нажать мимо него, чтобы закрыть просмотр. */
.lb-stage {
  position: relative; display: grid; place-items: center;
  max-width: min(1180px, 88vw); max-height: 82vh;
  border-radius: 18px; overflow: hidden; background: #05070f;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
}
.lightbox img[data-lb-img] {
  display: block; max-width: min(1180px, 88vw); max-height: 82vh;
  opacity: 0; transition: opacity .12s var(--ease); cursor: zoom-in;
}
.lightbox img[data-lb-img].is-ready { opacity: 1; }

.lightbox video[data-lb-video] { display: block; max-width: min(1180px, 88vw); max-height: 82vh; background: #000; }
.lightbox audio[data-lb-audio] { display: block; width: min(560px, 84vw); margin: 26px 22px; }

/* Показываем только то, что относится к текущему типу файла */
.lightbox video[data-lb-video], .lightbox audio[data-lb-audio] { display: none; }
.lightbox[data-kind="video"] video[data-lb-video] { display: block; }
.lightbox[data-kind="audio"] audio[data-lb-audio] { display: block; }
.lightbox[data-kind="video"] img[data-lb-img],
.lightbox[data-kind="audio"] img[data-lb-img] { display: none; }
.lightbox[data-kind="audio"] .lb-stage { background: var(--surface-solid); }

/* Разворот: и настоящий полноэкранный режим, и запасной — на всё окно */
.lb-stage:fullscreen { max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; border-radius: 0; background: #000; }
.lb-stage:fullscreen img[data-lb-img],
.lb-stage:fullscreen video[data-lb-video] { max-width: 100vw; max-height: 100vh; cursor: zoom-out; }
.lightbox.is-full .lb-stage { max-width: 100vw; max-height: 100vh; border-radius: 0; }
.lightbox.is-full img[data-lb-img],
.lightbox.is-full video[data-lb-video] { max-width: 100vw; max-height: 100vh; cursor: zoom-out; }

.lightbox img, .lightbox video { max-width: 92vw; max-height: 84vh; border-radius: 12px; box-shadow: 0 30px 90px rgba(0, 0, 0, .7); animation: lbIn .35s var(--ease) both; }
@keyframes lbIn { from { opacity: 0; transform: scale(.94); } }
.lb-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 16px 20px; color: #fff; background: linear-gradient(rgba(0,0,0,.55), transparent); }
.lb-bar .nm { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar .spacer { margin-left: auto; }
.lb-btn { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.1); color: #fff; cursor: pointer; transition: background-color .16s var(--ease), transform .16s var(--ease); }
.lb-btn:hover { background: rgba(255,255,255,.22); transform: scale(1.07); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-count { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 6px 14px; border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; font-size: 13px; }

/* ---------- Таблицы админки и списки ---------- */
.panel { padding: 20px; margin-bottom: 20px; animation: fadeIn .25s var(--ease) both; }
.panel h2 { margin: 0 0 4px; font-size: 17px; }
.panel .panel-sub { margin: 0 0 18px; color: var(--text-3); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); position: relative; overflow: hidden; animation: fadeIn .25s var(--ease) both; transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat::before { content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: var(--accent); opacity: .09; filter: blur(20px); }
.stat .lbl { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.stat .lbl svg { width: 15px; height: 15px; }
.stat .val { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.stat .val small { font-size: 13px; font-weight: 500; color: var(--text-3); }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); border-bottom: 1px solid var(--border); font-weight: 600; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr { transition: background .16s var(--ease); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }

.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.tag svg { width: 12px; height: 12px; stroke-width: 2.2; }
.tag-admin { background: rgba(160, 107, 255, .16); color: var(--accent-2); border-color: rgba(160, 107, 255, .3); }
.tag-ok { background: rgba(52, 211, 153, .14); color: var(--ok); border-color: rgba(52, 211, 153, .3); }
.tag-off { background: rgba(251, 113, 133, .13); color: var(--danger); border-color: rgba(251, 113, 133, .28); }
.tag-warn { background: rgba(251, 191, 36, .14); color: var(--warn); border-color: rgba(251, 191, 36, .3); }

.mini-bar { width: 110px; height: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.mini-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.mini-fill.warn { background: linear-gradient(90deg, var(--warn), var(--danger)); }

.code { font-family: var(--mono); font-size: 12.5px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); word-break: break-all; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.inline-form { display: inline; margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }

/* ---------- Публичная страница ---------- */
.pub-wrap { max-width: 1200px; margin: 0 auto; padding: clamp(12px, 2vw, 28px); }
.pub-head { display: flex; align-items: center; gap: 14px; padding: 20px 22px; margin-bottom: 18px; animation: fadeUp .45s var(--ease) both; }
.pub-head .ficon { width: 50px; height: 50px; border-radius: 15px; }
.pub-head .ficon svg { width: 26px; height: 26px; }
.pub-head h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; word-break: break-word; }
.pub-head .meta { color: var(--text-3); font-size: 13px; }
.pub-preview { display: grid; place-items: center; padding: 20px; margin-bottom: 18px; }
.pub-preview img, .pub-preview video { max-width: 100%; max-height: 68vh; border-radius: 14px; box-shadow: var(--shadow); }
.pub-foot { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 24px 0 8px; }

.drop-zone {
  display: grid; place-items: center; gap: 10px; padding: 30px; margin-top: 16px; text-align: center;
  border: 2px dashed var(--border-strong); border-radius: var(--radius); color: var(--text-3);
  cursor: pointer; transition: background-color var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}
.drop-zone:hover, .drop-zone.is-dragover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 40px -20px var(--accent); }
.drop-zone svg { width: 34px; height: 34px; }

/* ---------- Прочее ---------- */
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 18px; }
.mb-2 { margin-bottom: 18px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* Режим без анимации: движение выключено полностью, остаётся только
   мгновенная подсветка активных элементов. */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}
html[data-motion="off"] .aurora span { animation: none !important; }
html[data-motion="off"] .tile,
html[data-motion="off"] .stat,
html[data-motion="off"] .btn,
html[data-motion="off"] .side-item,
html[data-motion="off"] .side-link,
html[data-motion="off"] .icon-btn,
html[data-motion="off"] .user-chip { transform: none !important; }
html[data-motion="off"] .ripple { display: none !important; }

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

@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 274px; height: 100vh;
    transform: translateX(-102%); transition: transform .3s var(--ease); box-shadow: var(--shadow);
  }
  .sidebar.is-open { transform: none; }
  .sidebar-veil {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(3, 6, 16, .55); backdrop-filter: blur(3px);
    opacity: 0; visibility: hidden; transition: opacity .28s var(--ease), visibility .28s;
  }
  .sidebar-veil.is-open { opacity: 1; visibility: visible; }
  .mobilebar { display: flex; }
}

@media (max-width: 720px) {
  .search-box { width: 100%; margin-left: 0; }
  .search-box .input, .search-box .input:focus { width: 100%; }
  .tbl .col-actions { width: 70px; }
  .tbl td:nth-child(3), .tbl th:nth-child(3) { display: none; }
}

/* ---------- Перетаскивание внутри списка ---------- */
/* Тянем карточку целиком, а не картинку внутри неё. */
.tile img, .row-name img, .ficon svg { -webkit-user-drag: none; user-select: none; }
.is-dragging { opacity: .45; }
body.is-moving { cursor: grabbing; }
body.is-moving .row-name, body.is-moving .tile { cursor: grabbing; }

/* Папка, на которую можно бросить: подсвечиваем её целиком, чтобы было
   видно, куда именно уедут файлы. */
.is-drop {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft) !important;
  border-radius: 12px;
}
tr.is-drop td { background: var(--accent-soft); }
.crumb.is-drop { background: var(--accent-soft); color: var(--text); }

/* Сообщение о долгой работе: с крутилкой и без самоисчезновения. */
.toast-busy { border-color: var(--border-strong); }
.busy-spin {
  width: 15px; height: 15px; flex: none; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: busySpin .8s linear infinite;
}
@keyframes busySpin { to { transform: rotate(360deg); } }

/* Выбор, что делать с совпавшими именами при переносе. */
.conflict-list {
  margin: 4px 0 12px; padding: 10px 14px 10px 28px; max-height: 160px; overflow-y: auto;
  background: var(--surface-2); border-radius: 12px; color: var(--text-2); font-size: 13.5px;
}
.conflict-list li { margin: 2px 0; }
.conflict-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.conflict-actions .btn { justify-content: flex-start; }
@media (max-width: 520px) { .conflict-actions { grid-template-columns: 1fr; } }

/* Рамка выделения: тянется мышью по пустому месту списка. */
.marquee {
  position: absolute; left: 0; top: 0; z-index: 90; pointer-events: none;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
}

/* ---------- Поиск повторов ---------- */
.dup-bar { height: 4px; margin: 4px 0 14px; border-radius: 3px; background: var(--border); overflow: hidden; }
.dup-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s var(--ease); }
.dup-body { max-height: 46vh; overflow-y: auto; margin-bottom: 12px; }
.dup-empty { padding: 24px; text-align: center; color: var(--text-3); }
.dup-group { margin-bottom: 12px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.dup-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); }
.dup-row {
  display: grid; grid-template-columns: 22px 44px 1fr auto auto; gap: 10px;
  align-items: center; padding: 7px 12px; border-top: 1px solid var(--border);
  cursor: pointer; font-size: 13.5px;
}
.dup-row:hover { background: var(--surface-2); }
.dup-thumb { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.dup-thumb img { width: 100%; height: 100%; object-fit: cover; }
.dup-thumb svg { width: 20px; height: 20px; color: var(--text-3); }
.dup-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup-meta { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.dup-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }

/* Строка с галочкой внутри модального окна. */
.check-line { display: flex; align-items: center; gap: 9px; margin: 10px 0 4px; color: var(--text-2); font-size: 13.5px; cursor: pointer; }

/* Крупный показ снимка поверх окна повторов. */
.dup-view {
  position: fixed; inset: 0; z-index: 500; display: grid; place-items: center;
  padding: 24px; background: rgba(2, 4, 12, .88); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .15s var(--ease), visibility .15s;
  cursor: zoom-out;
}
.dup-view:not(.is-open) { pointer-events: none; }
.dup-view.is-open { opacity: 1; visibility: visible; }
.dup-view figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; max-height: 100%; }
.dup-view img { max-width: min(1100px, 92vw); max-height: 82vh; object-fit: contain; border-radius: 12px; box-shadow: var(--shadow); }
.dup-view figcaption { color: var(--text-2); font-size: 13px; text-align: center; }
.dup-thumb { cursor: zoom-in; }

/* Панель хода переноса в боковом меню — рядом с «Занято». */
[data-task-panel] .btn-danger { justify-content: center; }

/* ---------- Настройка подсветки ---------- */
.glow-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.glow-dot {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--border); background: var(--dot);
  transition: transform .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.glow-dot:hover { border-color: var(--border-strong); }
.glow-dot.is-on { border-color: var(--text); box-shadow: 0 0 14px -2px var(--dot); }
.glow-demo {
  height: 92px; margin: 14px 0 6px; border-radius: 16px;
  border: 1px solid var(--tile-glow); background: var(--surface-2);
  display: grid; place-items: center; color: var(--text-3); font-size: 13px;
  box-shadow: 0 0 var(--tile-glow-size) calc(var(--tile-glow-size) / -4) var(--tile-glow);
}

/* Метка вида файла в углу миниатюры: расширение буквами, у видео — со значком. */
.tile-ktag {
  position: absolute; right: 6px; bottom: 6px; z-index: 2;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, .58); color: #fff;
  font-size: 10px; font-weight: 600; letter-spacing: .3px; line-height: 1.2;
  pointer-events: none;
}
.grid-sm .tile-ktag { right: 4px; bottom: 4px; padding: 1px 4px; font-size: 9px; }
.tile-ktag .ktag-play { width: 11px; height: 11px; fill: currentColor; stroke: none; }
.grid-sm .tile-ktag .ktag-play { width: 9px; height: 9px; }

/* Длинные списки разгружает оконная отрисовка (см. ниже): в разметке живут
   только видимые карточки. Пробовали ещё и content-visibility, но вместе они
   мешают друг другу — при быстрой прокрутке карточка успевает появиться
   пустой рамкой, поэтому здесь его нет. */

/* ---------- Оконная отрисовка больших папок ---------- */
/* Распорки занимают место того, что сейчас не нарисовано: полоса прокрутки
   показывает настоящий размер папки, а в разметке живёт только видимое. */
.vspacer td { padding: 0 !important; border: 0 !important; }
.vspacer-box { width: 100%; }
.tile.is-skeleton, tr.is-skeleton {
  background: var(--surface-2); border-color: var(--border);
  pointer-events: none; animation: none;
}
.tile.is-skeleton { min-height: 120px; opacity: .5; }
tr.is-skeleton td { height: 44px; }
.sk-line {
  display: block; width: 40%; height: 10px; border-radius: 5px;
  background: var(--border); opacity: .7;
}

/* При оконной отрисовке карточки не «появляются»: их рисуют и стирают по мере
   прокрутки, и анимация превращалась бы в дрожание. */
.grid.is-virtual .tile { animation: none; }
.tbl tbody tr.is-virtual, .vspacer { animation: none; }

/* Ряды при оконной отрисовке — строго заданной высоты. Тогда нарисованное
   окно занимает ровно столько, сколько обещают распорки, и общая высота
   страницы не меняется от прокрутки: без этого список мигал, подстраивая
   положение прокрутки под собственную же перерисовку. */
.grid.is-virtual .tile { height: var(--tile-h, auto); }
.tbl tbody tr[style*="height"] > td { overflow: hidden; }

/* Выбор из двух вариантов кнопками — вместо выпадающего списка, где длинная
   подпись не помещалась и обрезалась. */
.pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick {
  display: flex; flex-direction: column; gap: 3px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-2); color: var(--text-2);
  text-align: left; cursor: pointer; font: inherit;
  transition: border-color .16s var(--ease), background-color .16s var(--ease), color .16s var(--ease);
}
.pick:hover { border-color: var(--border-strong); }
.pick strong { font-size: 13.5px; color: var(--text); font-weight: 600; }
.pick span { font-size: 12px; color: var(--text-3); line-height: 1.35; }
.pick.is-on { border-color: var(--accent); background: var(--accent-soft); }
.pick.is-on strong { color: var(--accent); }
@media (max-width: 520px) { .pick-row { grid-template-columns: 1fr; } }

/* Где лежит найденный объект. Поиск идёт по вложенным папкам, и без этой
   подписи файл из соседней папки выглядит как файл текущей. */
.tile-where {
  display: flex; align-items: center; gap: 4px; margin-top: 3px;
  font-size: 11px; color: var(--accent); opacity: .85;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-where svg { width: 11px; height: 11px; flex: none; }
.row-where {
  margin-left: 10px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; white-space: nowrap;
}
