:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --side: #fbfbfc;
  --line: #e4e6eb;
  --line-2: #eef0f3;
  --text: #1c1f24;
  --muted: #6b7280;
  --accent: #2f6fe4;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fd;
  --danger: #d23c3c;
  --danger-soft: #fdecec;
  --ok: #1f8a4c;
  --ok-soft: #e6f5ec;
  --hover: #f2f4f7;
  --sel: #eaf1fd;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 24px rgba(16,24,40,.08);
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317; --panel: #181b20; --side: #15181c; --line: #2a2e35; --line-2: #22262c;
    --text: #e7e9ec; --muted: #9aa1ab; --accent: #5b8ff0; --accent-soft: #1d2a42;
    --danger: #ef6b6b; --danger-soft: #3a1f22; --ok: #4cc27f; --ok-soft: #173326;
    --hover: #1f2329; --sel: #1d2a42; --shadow: 0 8px 30px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 14px; margin-top: 20px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; } .break { word-break: break-word; }
.center { text-align: center; }

/* ---------- Формы ---------- */
input, select, textarea {
  font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
label { display: block; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
label > input, label > select, label > textarea { margin-top: 5px; color: var(--text); }
textarea { resize: vertical; min-height: 70px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.big { height: 44px; padding: 0 22px; font-size: 15px; }
.btn.wide { width: 100%; justify-content: center; height: 40px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.btn-link:hover { color: var(--text); }
form.inline { display: inline; }

.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--danger-soft); color: var(--danger); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 16px; }

/* ---------- Каркас приложения ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 248px; flex: none; background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 14px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; color: var(--text); padding: 4px 8px 14px; }
.brand img { width: 26px; height: 26px; }
.side nav { flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text);
  white-space: nowrap; overflow: hidden;
}
.nav-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-item svg { color: var(--muted); }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.nav-item.drop-target { outline: 2px dashed var(--accent); }
.tag { font-style: normal; font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; padding: 0 6px; margin-left: auto; }
.quota { padding: 12px 10px; font-size: 12px; color: var(--muted); }
.quota-bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 6px; }
.quota-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.logout { display: flex; justify-content: space-between; align-items: center; padding: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 1; min-width: 0; padding: 22px 28px 60px; }
.burger { display: none; }
.scrim { display: none; }
.page { max-width: 1200px; }
.page-title { margin-bottom: 18px; }

/* ---------- Файловый менеджер ---------- */
.fm { position: relative; }
.fm-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 18px; flex: 1; min-width: 0; }
.crumbs a, .crumbs b { padding: 2px 6px; border-radius: 6px; color: var(--text); }
.crumbs a { color: var(--muted); } .crumbs a:hover { background: var(--hover); color: var(--text); }
.crumbs a.drop-target { outline: 2px dashed var(--accent); }
.crumbs .sep { color: var(--muted); opacity: .6; }
.fm-search { width: 240px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 34px; }
.tb-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sel-count { font-weight: 600; margin-right: 6px; }
.ro-note { font-size: 13px; color: var(--muted); margin: -4px 0 10px; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: auto; }
.card .table-wrap { border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none; }
th[data-sort] { cursor: pointer; } th[data-sort]:hover { color: var(--text); }
th.sorted::after { content: " ↑"; } th.sorted.desc::after { content: " ↓"; }
td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.files tbody tr { cursor: default; }
.files tbody tr:hover { background: var(--hover); }
.files tbody tr.sel { background: var(--sel); }
.files tbody tr.drop-target { box-shadow: inset 0 0 0 2px var(--accent); }
.c-check { width: 36px; } .c-size { width: 110px; color: var(--muted); white-space: nowrap; }
.c-date { width: 150px; color: var(--muted); white-space: nowrap; } .c-act { width: 48px; text-align: right; }
.name { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; cursor: pointer; }
.name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name:hover > span:last-child { text-decoration: underline; }
.badge-link { color: var(--accent); margin-left: 6px; display: inline-flex; vertical-align: middle; }
.badge-link svg { width: 14px; height: 14px; }
.more { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.more:hover { background: var(--line); color: var(--text); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .5; }

/* значки файлов */
.ico { width: 28px; height: 32px; flex: none; position: relative; display: inline-block; }
.ico svg { width: 100%; height: 100%; stroke-width: 1.2; }
.ico b {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); font-size: 7.5px; font-weight: 700;
  color: #fff; padding: 1px 3px; border-radius: 2px; letter-spacing: .02em; text-transform: uppercase; max-width: 30px; overflow: hidden;
}

/* перетаскивание */
.drop-overlay {
  position: fixed; inset: 0; background: rgba(47,111,228,.10); border: 3px dashed var(--accent);
  display: none; align-items: center; justify-content: center; z-index: 50; pointer-events: none;
}
.drop-overlay div { background: var(--panel); padding: 14px 22px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; }
.drop-overlay.on { display: flex; }

/* меню действий */
.menu {
  position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 5px; min-width: 190px;
}
.menu button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none;
  font: inherit; color: var(--text); border-radius: 6px; cursor: pointer; text-align: left;
}
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* модальные окна */
.modal-back { position: fixed; inset: 0; background: rgba(10,14,20,.45); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); width: 100%; max-width: 460px; max-height: 92vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 1000px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; gap: 10px; }
.modal-head h2 { margin: 0; word-break: break-word; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; flex-wrap: wrap; }
.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; padding: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.result-link { display: flex; gap: 8px; margin-bottom: 8px; }
.result-link input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.preview-box { display: flex; align-items: center; justify-content: center; background: var(--bg); border-radius: 8px; min-height: 200px; }
.preview-box img, .preview-box video { max-width: 100%; max-height: 72vh; display: block; }
.preview-box iframe { width: 100%; height: 72vh; border: 0; background: #fff; border-radius: 8px; }
.preview-box audio { width: 100%; margin: 40px 20px; }
.preview-box pre { width: 100%; max-height: 72vh; overflow: auto; margin: 0; padding: 16px; font: 12.5px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }

/* загрузки */
.uploads {
  position: fixed; right: 20px; bottom: 20px; width: 360px; max-width: calc(100vw - 40px); background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 40; overflow: hidden;
}
.up-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--line); }
.up-list { max-height: 260px; overflow: auto; margin: 0; padding: 0; list-style: none; }
.up-item { padding: 8px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.up-item:last-child { border-bottom: 0; }
.up-row { display: flex; justify-content: space-between; gap: 10px; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-st { color: var(--muted); white-space: nowrap; }
.up-item.done .up-st { color: var(--ok); } .up-item.err .up-st { color: var(--danger); }
.up-bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up-item.done .up-bar i { background: var(--ok); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1c1f24; color: #fff;
  padding: 10px 16px; border-radius: 8px; z-index: 90; box-shadow: var(--shadow); font-size: 13px; max-width: 90vw;
}
.toast.err { background: var(--danger); }

/* ---------- Страницы ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid2 .card { margin: 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.count { color: var(--muted); font-weight: 400; margin-left: 4px; }
.list td { font-size: 13px; }
.list input, .list select { padding: 5px 8px; min-width: 90px; }
.list input.num { width: 80px; min-width: 0; }
.kind { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.copy { font: 12px ui-monospace, Menlo, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; cursor: pointer; color: var(--text); }
.copy:hover { border-color: var(--accent); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.pill.on { background: var(--ok-soft); color: var(--ok); } .pill.off { background: var(--hover); color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 20px; }
.stat b { display: block; font-size: 22px; } .stat span { color: var(--muted); font-size: 13px; }
.usage { min-width: 110px; font-size: 12px; color: var(--muted); }
.row-form { display: flex; gap: 8px; flex-wrap: wrap; }
.row-form input, .row-form select { width: auto; flex: 1 1 140px; }
.row-form input.num { flex: 0 1 110px; }
.shared-folder { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.sf-head { display: flex; gap: 8px; margin-bottom: 10px; }
.sf-name { font-weight: 600; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 14px; }
.perm { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--text); }
.perm span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm select { width: 150px; margin: 0; padding: 5px 8px; }

/* ---------- Публичные страницы ---------- */
.public { min-height: 100vh; }
.pub-head { padding: 16px 24px; }
.pub-main { max-width: 860px; margin: 0 auto; padding: 10px 16px 60px; }
.auth { max-width: 380px; margin: 8vh auto 0; padding: 28px; }
.lock { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.big-code { font-size: 46px; font-weight: 700; color: var(--muted); }
.share-file { text-align: center; padding: 32px 24px; }
.share-file .preview { max-width: 100%; max-height: 60vh; border-radius: 8px; margin-bottom: 18px; }
.share-file audio { width: 100%; margin-bottom: 18px; }
.file-badge { display: flex; justify-content: center; margin-bottom: 14px; }
.file-badge .ico { width: 64px; height: 74px; } .file-badge .ico b { font-size: 13px; bottom: 10px; max-width: 60px; }
.share-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.share-head .crumbs { font-size: 16px; }
.public-files td.c-act { width: 90px; }
.req h1 { margin-bottom: 8px; }
.req-msg { white-space: normal; margin: 0 0 8px; }
.dropzone {
  border: 2px dashed var(--line); border-radius: 12px; padding: 32px 16px; text-align: center; color: var(--muted);
  transition: border-color .15s, background .15s;
}
.dropzone svg { width: 36px; height: 36px; }
.dropzone.on { border-color: var(--accent); background: var(--accent-soft); }
.req-list { list-style: none; padding: 0; margin: 14px 0 0; }
.req-list .up-item { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }

/* ---------- Мобильные ---------- */
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; z-index: 80; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim.on { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 75; }
  .burger { display: inline-flex; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: 6px; margin-bottom: 12px; cursor: pointer; }
  .main { padding: 14px 16px 80px; }
  .fm-top { flex-direction: column; align-items: stretch; gap: 8px; }
  .fm-search { width: 100%; }
  .c-date { display: none; }
  .c-size { width: 80px; }
  .grid2, .stats, .grid-2 { grid-template-columns: 1fr; }
  .btn svg { display: none; }
  .tb-group .btn { padding: 0 10px; }
}
.uploads.min .up-list { display: none; }
.users td:first-child .small { white-space: nowrap; }
.users input[name=name] { min-width: 110px; }
.users td.nowrap .btn { margin: 2px 0; }

/* ---------- Панель управления ---------- */
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-head .page-title { margin: 0; }
.tabs { display: flex; gap: 4px; background: var(--hover); padding: 4px; border-radius: 10px; }
.tabs a { padding: 6px 14px; border-radius: 7px; color: var(--muted); font-weight: 500; }
.tabs a.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card h3 { margin: 0 0 14px; font-size: 15px; }
.sub-form { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 16px; }
.form-grid .span2 { grid-column: span 2; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; margin: 6px 0 12px; }
label.check input { flex: none; margin: 0; }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.check-list { display: flex; flex-direction: column; }
.check-list.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.check-list label.check { margin: 4px 0; }
.filter-input { max-width: 320px; margin-bottom: 12px; }
.list.clickable tbody tr { cursor: pointer; }
.list.clickable tbody tr:hover { background: var(--hover); }
.chip { display: inline-block; font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 1px 8px; margin: 1px 4px 1px 0; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); }
.back:hover { color: var(--text); }
.edit-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
  position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; }
.edit-title h2 { margin: 0; font-size: 20px; }
.edit-actions { display: flex; gap: 8px; }
.note { background: var(--accent-soft); color: var(--text); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.seg { display: inline-flex; gap: 2px; background: var(--hover); padding: 3px; border-radius: 9px; margin-bottom: 12px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font: inherit; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.perm-table th.pc, .perm-table td.pc { text-align: center; width: 104px; }
.perm-table th.pc { white-space: normal; line-height: 1.2; }
.perm-table tr.dim td { opacity: .6; }
.rb { display: inline-flex; margin: 0; cursor: pointer; padding: 4px; }
.rb input { position: absolute; opacity: 0; pointer-events: none; }
.rb i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); display: inline-block; transition: all .12s; }
.rb:hover i { border-color: var(--accent); }
.rb input:checked + i { border-color: var(--accent); background: radial-gradient(var(--accent) 0 4px, transparent 5px); }
.rb input:disabled + i { opacity: .4; }
.rb input:focus-visible + i { box-shadow: 0 0 0 3px var(--accent-soft); }
td.pc:nth-child(3) .rb input:checked + i { border-color: var(--danger); background: radial-gradient(var(--danger) 0 4px, transparent 5px); }
.perm-badge { font-size: 12px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.perm-badge.rw { background: var(--ok-soft); color: var(--ok); }
.perm-badge.ro { background: var(--accent-soft); color: var(--accent); }
.perm-badge.na { background: var(--hover); color: var(--muted); }
@media (max-width: 860px) {
  .form-grid .span2 { grid-column: auto; }
  .perm-table th.pc, .perm-table td.pc { width: 64px; font-size: 11px; }
}

/* ---------- Этап 1: шапка, мониторинг, журнал, аватары, бренд ---------- */
.topbar { display: flex; align-items: center; gap: 12px; margin: -6px 0 16px; min-height: 36px; }
.topbar .burger { margin: 0; }
.tb-quota { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.tb-quota b { color: var(--text); font-weight: 600; }
.tb-quota svg { width: 15px; height: 15px; }
.tb-quota .quota-bar { width: 70px; margin: 0; }
.clock { margin-left: auto; display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; cursor: default; }
.clock b { font-size: 17px; font-weight: 600; }
.clock span { font-size: 12.5px; color: var(--muted); }
.mon { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)) minmax(220px, 1.6fr); gap: 10px; margin-bottom: 18px; }
.mon-item, .mon-log { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; position: relative; overflow: hidden; min-height: 62px; }
.mon-l { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); display: block; }
.mon-item b { font-size: 16px; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.mon-item b.net { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.mon-item b.net i { font-style: normal; }
.mon-item .up { color: #2f9e44; } .mon-item .down { color: var(--accent); }
.mon-item canvas { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 30px; opacity: .9; }
.mon-item.disk .quota-bar { margin-top: 6px; }
.mon-log { padding: 6px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.mon-log .ml { display: flex; gap: 6px; align-items: center; white-space: nowrap; overflow: hidden; }
.mon-log .ml span:last-child { overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.ev-ic { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; margin-right: 6px; font-style: normal; flex: none; }
.ev-ic.up { background: var(--ok-soft); color: var(--ok); }
.ev-ic.down { background: var(--accent-soft); color: var(--accent); }
.ev-ic.edit { background: var(--hover); color: var(--muted); }
.ev-ic.del { background: var(--danger-soft); color: var(--danger); }
.ev-ic.ok { background: var(--ok-soft); color: var(--ok); }
.ev-ic.bad { background: var(--danger-soft); color: var(--danger); }
.list.log tr.ok td:nth-child(2) { color: var(--ok); }
.list.log tr.bad td:nth-child(2) { color: var(--danger); }
.list.log tr.bad { background: color-mix(in srgb, var(--danger-soft) 45%, transparent); }
.list.log .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: currentColor; }
.list.log .ua { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.filters input, .filters select { flex: 1 1 120px; }
.filters input[type=date] { flex: 0 1 150px; }
.seg a { padding: 6px 12px; border-radius: 7px; color: var(--muted); }
.seg a.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }
.form-actions { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.lock-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ava { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; vertical-align: middle; }
.ava.ini { background: hsl(var(--h) 55% 45%); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .02em; }
.ava.xs { width: 20px; height: 20px; font-size: 9px; margin-right: 4px; }
.ava.sm { width: 26px; height: 26px; }
.ava.lg { width: 72px; height: 72px; font-size: 24px; }
.ava-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.ava-row > div { display: flex; gap: 8px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; margin: 0; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.logout .who { display: flex; align-items: center; gap: 8px; color: var(--text); min-width: 0; }
.logout .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-foot { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 10px 6px 2px; color: var(--muted); }
.brand-foot a { color: var(--muted); opacity: .75; transition: opacity .15s; }
.brand-foot a:hover { opacity: 1; color: var(--text); }
.bf-logo svg { width: 76px; height: auto; display: block; }
.bf-text { font-size: 11px; letter-spacing: .02em; white-space: nowrap; }
.pub-foot { padding: 10px 0 24px; }
.pub-foot .bf-logo svg { width: 92px; }
@media (max-width: 1100px) { .mon { grid-template-columns: repeat(3, 1fr); } .mon-log { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  .topbar { margin-top: 0; }
  .tb-quota span { display: none; }
  .clock span { display: none; }
  .clock.open span { display: inline; }
  .mon { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Этап 2: виды, карточки, избранное, корзина, фоны ---------- */
.views { display: flex; gap: 2px; background: var(--hover); padding: 3px; border-radius: 9px; }
.views button { border: 0; background: none; color: var(--muted); padding: 5px 8px; border-radius: 7px; cursor: pointer; display: grid; place-items: center; }
.views button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.views svg { width: 17px; height: 17px; }
#btn-fav-folder.on svg, .star.on svg { fill: #f5b83d; stroke: #e0a32a; }
.table-wrap.bare { background: none; border: 0; overflow: visible; }
.star { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; opacity: 0; transition: opacity .15s; }
.star.on { opacity: 1; }
tr:hover .star, .fcard:hover .star, .card-f:hover .star { opacity: 1; }
.star.small svg { width: 15px; height: 15px; }
.c-act { width: 80px; white-space: nowrap; }
.c-name .sub { margin: 2px 0 0 38px; }
.g-title { font-weight: 600; font-size: 13px; color: var(--muted); margin: 6px 0 10px; }
.g-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.g-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.v-tiles .g-files { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.fcard {
  position: relative; border-radius: 14px; padding: 14px; color: #fff; cursor: default; min-height: 108px;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 70%, #000)); box-shadow: 0 4px 14px color-mix(in srgb, var(--c) 30%, transparent);
  display: flex; flex-direction: column; justify-content: flex-end; transition: transform .12s;
}
.fcard:hover { transform: translateY(-2px); }
.fcard.sel { outline: 3px solid var(--text); outline-offset: 2px; }
.fcard.drop-target { outline: 3px dashed #fff; }
.fc-ico { position: absolute; top: 12px; left: 14px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; cursor: pointer; }
.fc-ico svg { width: 16px; height: 16px; stroke: none; color: #fff; }
.fc-name { font-weight: 700; font-size: 15px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-meta { font-size: 12px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard .star { position: absolute; top: 8px; right: 34px; color: #fff; }
.fcard .more { position: absolute; top: 8px; right: 6px; color: #fff; }
.fcard .cb, .card-f .cb { position: absolute; top: 10px; left: 10px; z-index: 2; opacity: 0; }
.fcard .cb { left: auto; right: 64px; top: 14px; }
.fcard:hover .cb, .card-f:hover .cb, .sel .cb { opacity: 1; }
.card-f { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: box-shadow .15s, transform .12s; }
.card-f:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-f.sel { outline: 3px solid var(--accent); outline-offset: -1px; }
.cf-pic { aspect-ratio: 4 / 3; background: var(--bg); display: grid; place-items: center; cursor: pointer; position: relative; overflow: hidden; }
.v-tiles .cf-pic { aspect-ratio: 3 / 2; }
.cf-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cf-pic .ph .ico { width: 56px; height: 64px; } .cf-pic .ph .ico b { font-size: 11px; bottom: 9px; max-width: 52px; }
.cf-pic .play { position: absolute; width: 42px; height: 42px; border-radius: 50%; background: rgba(0,0,0,.55); display: grid; place-items: center; color: #fff; }
.cf-pic .play svg { width: 18px; height: 18px; stroke: none; margin-left: 3px; }
.cf-body { padding: 9px 36px 10px 12px; }
.cf-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cf-meta { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-f .more { position: absolute; right: 4px; bottom: 10px; }
.card-f .star { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.4); color: #fff; }
.card-f .star.on { background: rgba(0,0,0,.4); }
.trash-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.trash-bar span { margin-right: auto; color: var(--muted); }
.tb-trash { color: var(--muted); }
.tb-trash:hover { color: var(--text); }
.pt { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; flex: none; }
/* выбор фона */
.bgp { margin: 4px 0 6px; }
.bgp-l { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.bgp-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.bgp-it { position: relative; flex: none; width: 92px; height: 60px; border-radius: 8px; border: 2px solid var(--line); overflow: hidden; cursor: pointer; margin: 0;
  display: grid; place-items: center; background: var(--bg) center / cover no-repeat; font-size: 11px; color: var(--text); text-align: center; }
.bgp-it img { width: 100%; height: 100%; object-fit: cover; }
.bgp-it input[type=radio] { position: absolute; opacity: 0; }
.bgp-it:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.bgp-it.def span { background: rgba(0,0,0,.45); color: #fff; padding: 2px 6px; border-radius: 4px; }
.bgp-it.add { font-size: 22px; color: var(--muted); border-style: dashed; }
.bgp-it.add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bgp-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; display: none; }
.bgp-it:hover .bgp-del { display: block; }
.bg-prev { width: 140px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.bg-prev.empty { display: grid; place-items: center; color: var(--muted); background: var(--bg); }
/* публичные страницы с фоном */
body.public.has-bg { background: linear-gradient(rgba(10,12,16,.55), rgba(10,12,16,.7)), var(--bg) center / cover fixed no-repeat; }
body.public.has-bg .pub-head .brand, body.public.has-bg .pub-foot a { color: #fff; }
body.public.has-bg .card { background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 20px 50px rgba(0,0,0,.35); }
@media (max-width: 860px) {
  .g-folders { grid-template-columns: repeat(2, 1fr); }
  .g-files { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .v-tiles .g-files { grid-template-columns: 1fr; }
  .star { opacity: 1; }
  .fcard .cb, .card-f .cb { opacity: 1; }
  .fm-top { flex-wrap: wrap; }
}

/* ---------- Этап 3: сеть, скорость, Telegram ---------- */
.mon { grid-template-columns: repeat(6, minmax(110px, 1fr)) minmax(220px, 1.6fr); }
.mon-item.st .mon-l { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.st-run { border: 1px solid var(--line); background: var(--hover); color: var(--text); font-size: 10.5px; border-radius: 6px; padding: 1px 6px; cursor: pointer; text-transform: none; letter-spacing: 0; }
.st-run:disabled { opacity: .6; cursor: default; }
.mon-item.st .quota-bar { margin-top: 4px; }
.st-res { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.st-big { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 6px 0 10px; }
.st-big b { font-size: 22px; font-variant-numeric: tabular-nums; }
.st-big .st-srv { font-size: 14px; font-weight: 600; }
.tb-speed { position: relative; overflow: hidden; min-width: 150px; font-variant-numeric: tabular-nums; }
.tb-speed span { position: relative; z-index: 1; white-space: nowrap; }
.tb-speed i { font-style: normal; } .tb-speed .up { color: #2f9e44; } .tb-speed .down { color: var(--accent); }
.tb-speed canvas { position: absolute; inset: auto 0 0 0; width: 100%; height: 14px; opacity: .55; }
.tb-load b { font-variant-numeric: tabular-nums; }
.tg-state { font-weight: 500; color: var(--muted); } .tg-state.ok { color: var(--ok); }
.tg-steps { margin: 4px 0 12px 18px; padding: 0; color: var(--muted); font-size: 13.5px; }
.tg-steps li { margin: 3px 0; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.time-range { display: flex; align-items: center; gap: 6px; } .time-range input { flex: 1; }
details.req-lim { margin: 4px 0 10px; } details.req-lim summary { cursor: pointer; color: var(--muted); font-size: 13.5px; margin-bottom: 8px; }
.req-limits { font-size: 12.5px; color: var(--muted); }
@media (max-width: 1100px) { .mon { grid-template-columns: repeat(3, 1fr); } .st-big { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  .mon { grid-template-columns: repeat(2, 1fr); }
  .tb-speed { min-width: 0; } .tb-speed span, .tb-load span { display: inline !important; font-size: 11.5px; }
  .tb-speed canvas { display: none; }
  .tb-load .quota-bar { display: none; }
}
@media (max-width: 560px) { .tb-speed { display: none; } }

/* ---------- Этап 4: плеер ---------- */
.mb { display: inline-block; margin-left: 6px; font-size: 10.5px; line-height: 1; padding: 2px 5px; border-radius: 5px; background: var(--hover); color: var(--muted); vertical-align: middle; }
.mb.ok { color: var(--accent); background: var(--accent-soft); } .mb.run { color: #e8590c; } .mb.err { color: var(--danger); background: var(--danger-soft); }
#btn-player.on { border-color: var(--accent); color: var(--accent); }
.pl { display: flex; flex-direction: column; gap: 10px; }
.pl-stage video { width: 100%; max-height: 70vh; background: #000; border-radius: 8px; display: block; }
.aplayer { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.aplayer audio { width: 100%; }
.wave { width: 100%; height: 72px; cursor: pointer; display: block; }
.wave.fake { opacity: .5; }
.pl-note:empty { display: none; }
.pl-list { margin: 0; padding: 0 0 0 22px; max-height: 240px; overflow: auto; font-size: 13.5px; }
.pl-list li { padding: 5px 4px; cursor: pointer; border-radius: 6px; }
.pl-list li:hover { background: var(--hover); } .pl-list li.on { color: var(--accent); font-weight: 600; }
.pub-player { margin: 12px 0; width: 100%; text-align: left; }
.radio-col { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
form.inline { display: inline; }

/* ---------- Этап 6: 2FA, прокси ---------- */
.otp { font-size: 22px; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.tfa-setup { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.tfa-qr { background: #fff; border-radius: 10px; padding: 8px; width: 220px; height: 220px; }
.tfa-qr svg { width: 100%; height: 100%; display: block; }
.rec-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; }
.rec-codes span { background: var(--hover); border-radius: 6px; padding: 6px 10px; text-align: center; }
.proxy-st { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.proxy-st > div { background: var(--hover); border-radius: 8px; padding: 8px 12px; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; min-height: 180px; }
@media (max-width: 700px) { .tfa-setup { grid-template-columns: 1fr; } .tfa-qr { margin: 0 auto; } }
.proxy-log { background: var(--hover); border-radius: 8px; padding: 10px 12px; font-size: 12px; white-space: pre-wrap; overflow-x: auto; max-height: 260px; }

/* ---------- Этап 5: биллинг ---------- */
.bill-banner { display: block; margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; font-weight: 500; text-decoration: none; }
.bill-banner.soon { background: #fff4e0; color: #8a5a00; }
.bill-banner.grace, .bill-banner.locked { background: var(--danger-soft); color: var(--danger); }
.bill-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.bill-head b { font-size: 18px; } .bill-sum { font-size: 24px !important; }
.bill-st.ok { color: var(--ok); } .bill-st.soon { color: #e8590c; } .bill-st.grace, .bill-st.locked { color: var(--danger); }
.pay-box { text-align: center; } .pay-qr { width: 240px; height: 240px; margin: 0 auto 10px; background: #fff; padding: 8px; border-radius: 10px; }
.pay-qr svg { width: 100%; height: 100%; }
.pay-ok { font-size: 54px; color: var(--ok); line-height: 1; margin: 10px 0; }
@media (prefers-color-scheme: dark) { .bill-banner.soon { background: #3a2c10; color: #ffcf7a; } }
