/* Деко-диск: кастомная тема «ФБК Диск», знакомые пропорции веб-диска.
   Один файл, без внешних ассетов — интерфейс приманки самодостаточен. */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0e6ba0;
  --primary-hover: #0b5a87;
  --bg: #f5f6f7;
  --panel: #ffffff;
  --border: #e3e5e8;
  --text: #232527;
  --muted: #6b7176;
  --hover: #f0f4f7;
  --selected: #e6f0f7;
  --danger: #c0392b;
}

html, body { height: 100%; }
body {
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

/* ── Топбар ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  height: 50px; padding: 0 16px;
  background: var(--primary); color: #fff;
}
.topbar .burger { opacity: .85; display: flex; }
.topbar .brand { font-size: 16px; font-weight: 600; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; }
.topbar .brand .logo {
  width: 24px; height: 24px; border-radius: 6px;
  background: #fff; color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.topbar .spacer { flex: 1; }
.topsearch { position: relative; display: flex; align-items: center; }
.topsearch svg { position: absolute; left: 10px; pointer-events: none; }
.topbar .search {
  width: 260px; padding: 6px 12px 6px 32px;
  border: 1px solid rgba(255,255,255,.45); border-radius: 4px;
  background: rgba(255,255,255,.16); color: #fff; outline: none;
  font-size: 13px;
}
.topbar .search::placeholder { color: rgba(255,255,255,.75); }
.topbar .icon-btn {
  width: 32px; height: 32px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: .9;
}
.topbar .icon-btn:hover { background: rgba(255,255,255,.18); }
.topbar .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; color: var(--primary);
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── Каркас ─────────────────────────────────────────── */
.layout { display: flex; min-height: calc(100vh - 50px); }

.sidebar {
  width: 264px; flex: none;
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 14px 10px; display: flex; flex-direction: column;
}
.sidebar .sec { margin-bottom: 18px; }
.sidebar .sec h3 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  color: var(--muted); letter-spacing: .6px; padding: 0 12px 6px;
}
.sidebar .item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: 4px; cursor: pointer;
  color: var(--text); font-size: 14px; text-decoration: none;
}
.sidebar .item:hover { background: var(--hover); }
.sidebar .item .badge { margin-left: auto; font-size: 11px; color: var(--muted); }
.sidebar .quota { margin-top: auto; padding: 10px 12px; border-top: 1px solid var(--border); }
.sidebar .quota .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sidebar .quota .bar { height: 5px; border-radius: 3px; background: #e8eaed; overflow: hidden; }
.sidebar .quota .bar i { display: block; height: 100%; width: 19%; background: var(--primary); }

.content { flex: 1; overflow: auto; padding: 0 26px 60px; }

/* ── Заголовок области файлов ────────────────────────── */
.content-head, .viewer-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0 10px; position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.content-head .crumbs, .viewer-head .crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 19px; font-weight: 600; flex-wrap: wrap;
}
.crumbs .sep { color: var(--muted); font-weight: 400; font-size: 15px; }
.crumbs a { color: var(--text); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .cur { color: var(--muted); font-weight: 400; font-size: 15px; }
.viewer-head .crumbs { font-size: 16px; }
.file-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 4px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text);
  font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.hidden-input { display: none; }

/* Меню «Новое» */
.btn-dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 24px rgba(20,40,60,.14); min-width: 190px; padding: 4px;
}
.menu button {
  display: block; width: 100%; text-align: left;
  padding: 8px 12px; border: none; background: none; border-radius: 4px;
  font-size: 13.5px; cursor: pointer; color: var(--text);
}
.menu button:hover { background: var(--hover); }

/* ── Таблица файлов ─────────────────────────────────── */
table.files { width: 100%; border-collapse: collapse; }
table.files th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
table.files th.num, table.files td.num { width: 36px; }
table.files th.size, table.files td.size { width: 130px; }
table.files th.time, table.files td.time { width: 150px; }
table.files th.act, table.files td.act { width: 60px; text-align: right; }
table.files td { padding: 8px 10px; border-bottom: 1px solid #eff0f2; vertical-align: middle; }
table.files tr:hover td { background: var(--hover); }
.fname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fname svg { flex: none; }
.fname .name { min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.fname .name a {
  color: var(--text); text-decoration: none;
  max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fname .name a:hover { text-decoration: underline; }
.path-hint { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.size, .time { color: var(--muted); font-size: 13px; white-space: nowrap; }
td.act { color: var(--muted); cursor: default; }
.empty-cell { text-align: center; color: var(--muted); padding: 26px 0 !important; }
.cb { width: 15px; height: 15px; accent-color: var(--primary); }

/* ── Вьюер ──────────────────────────────────────────── */
.truncated-note {
  padding: 8px 12px; margin-bottom: 10px;
  background: #fdf6e3; border: 1px solid #f0dfa8; border-radius: 4px;
  color: #7a6215; font-size: 13px;
}
pre.code {
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 14px 0; font: 12.5px/1.6 "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  overflow: auto; max-width: 1000px; margin: 0 auto;
}
pre.code .row { display: block; white-space: pre; padding: 0 16px 0 46px; position: relative; }
pre.code .row:hover { background: var(--hover); }
.file-frame {
  width: 100%; height: calc(100vh - 140px); border: 1px solid var(--border);
  border-radius: 6px; background: #fff;
}
.image-wrap { text-align: center; padding: 10px; }
.image-wrap img { max-width: 100%; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.no-preview { text-align: center; padding: 80px 0; color: var(--muted); }
.no-preview .no-preview-icon { margin-bottom: 12px; }
.no-preview .btn { margin-top: 16px; }

/* ── Оверлей «упаковки» и тосты ─────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20,30,40,.45);
  display: flex; align-items: center; justify-content: center;
}
.overlay-card {
  background: var(--panel); border-radius: 8px; padding: 26px 34px;
  text-align: center; min-width: 300px;
  box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.overlay-card .spinner {
  width: 34px; height: 34px; margin: 0 auto 14px;
  border: 4px solid #e3e5e8; border-top-color: var(--primary);
  border-radius: 50%; animation: spin 1s linear infinite;
}
.overlay-card.err .spinner { border-top-color: var(--danger); animation: none; }
.overlay-card.err .spinner::before { content: "!"; font-size: 20px; font-weight: 700; color: var(--danger); display: block; line-height: 26px; }
.overlay-card div { font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #2c3034; color: #fff; border-radius: 6px;
  padding: 10px 18px; font-size: 13.5px; z-index: 120;
  box-shadow: 0 6px 24px rgba(0,0,0,.35); max-width: 80vw;
}

/* ── Логин ──────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #eef1f3 0%, #f5f6f7 100%);
}
.login-card {
  width: 392px; max-width: 92vw; background: var(--panel); border-radius: 8px;
  box-shadow: 0 2px 18px rgba(20,40,60,.10);
  padding: 38px 38px 26px; text-align: center;
}
.login-card .logo {
  width: 52px; height: 52px; border-radius: 12px; margin: 0 auto 14px;
  background: var(--primary); color: #fff; font-size: 26px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 21px; margin-bottom: 3px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.form-error {
  background: #fdecea; border: 1px solid #f5c6c0; color: var(--danger);
  border-radius: 4px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px;
}
.field { position: relative; margin-bottom: 12px; text-align: left; }
.field svg { position: absolute; left: 12px; top: 10px; opacity: .45; }
.field input {
  width: 100%; padding: 9px 12px 9px 38px;
  border: 1px solid #c9cdd1; border-radius: 4px; font-size: 14px; outline: none;
  background: #fafbfc;
}
.field input:focus { border-color: var(--primary); background: #fff; }
.login-card .remember { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin: 2px 2px 18px; }
.login-card .btn-primary {
  width: 100%; padding: 10px; border: none; border-radius: 4px;
  background: var(--primary); color: #fff; font-size: 15px; cursor: pointer;
}
.login-card .btn-primary:hover { background: var(--primary-hover); }
.login-foot { margin-top: 22px; font-size: 12px; color: #9aa0a6; }

/* ── Страницы ошибок ────────────────────────────────── */
.error-wrap { min-height: calc(100vh - 50px); display: flex; align-items: center; justify-content: center; }
.error-card { max-width: 420px; text-align: center; padding: 20px; }
.error-card h1 { font-size: 22px; margin-bottom: 8px; }
.error-card p { color: var(--muted); margin-bottom: 18px; line-height: 1.5; }
