/* Giat Drive — стиль в духе Giat Hub.
 *
 * Три темы: Reader (по умолчанию — как Hub под Dark Reader), Hub (как сама панель) и Светлая.
 * Тема — это набор переменных (--имя) в html[data-theme="…"]. Хочешь поменять оттенок —
 * меняй его здесь, и он изменится во всём Drive.
 *
 * Порядок файла: шрифты и темы → основа → элементы → оболочка → страницы → узкие экраны.
 * Правила для узких экранов стоят в самом конце, чтобы перебивать обычные.
 */

@font-face { font-family: "Inter"; src: url("../fonts/inter-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Tektur"; src: url("../fonts/tektur-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Tektur"; src: url("../fonts/tektur-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }

/* ===================== Темы ===================== */
:root, html[data-theme="reader"] {
  --bg: #000; --panel: #000; --card: #000; --hover: #0d0d0c;
  --line: #7f7566; --soft: #847969;            /* тёплые рамки, как под Dark Reader */
  --text: #eeebe6; --muted: #aea698; --faint: #9c9181;
  --accent: #f05c5c; --mark: #900c0c;          /* красный: значки и текст / отметки и полоски */
  --sel-border: #880a0a; --sel-bg: #0b0101; --avatar: #140202;
  --nav-active: #0a0908;
  --btn: #161a1c; --btn-border: #2b3133; --btn-text: #ebe8e3; --btn-hover: #1e2427;
  --input: #000;
  --up: #228751; --up-text: #60d497; --warn-text: #eaae42; --bad-text: #f1a5a5;
  --meter: #2e2d2a; --track: #101010;
  --grid: #e5e1db; --line1: #eeebe6; --line2: #7ec9ff;     /* светлая сетка — как на скрине с Dark Reader */
  --logo-bg: #f0ece9; --logo-bar: #e2ddd7; --logo-red: #f05c5c;
  --menu: #000; --drawer: #000; --dim: rgba(0, 0, 0, .65); --code: #050505;
  color-scheme: dark;
}
html[data-theme="hub"] {
  --bg: #000; --panel: #0b0b0b; --card: #111; --hover: #151515;
  --line: #262626; --soft: #1a1a1a;
  --text: #f2f2f2; --muted: #9a9a9a; --faint: #808080;
  --accent: #e05a5a; --mark: #e05a5a;
  --sel-border: #e05a5a; --sel-bg: rgba(224, 90, 90, .08); --avatar: rgba(224, 90, 90, .14);
  --nav-active: #161616;
  --btn: #e9e9e9; --btn-border: #e9e9e9; --btn-text: #111; --btn-hover: #fff;
  --input: #070707;
  --up: #3aa76d; --up-text: #3aa76d; --warn-text: #d9a03a; --bad-text: #f1a5a5;
  --meter: #f2f2f2; --track: #1c1c1c;
  --grid: #1f1f1f; --line1: #f2f2f2; --line2: #8fb8ff;
  --logo-bg: #0b0b0b; --logo-bar: #ececec; --logo-red: #e05a5a;
  --menu: #0b0b0b; --drawer: #050505; --dim: rgba(0, 0, 0, .65); --code: #070707;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f3f3f1; --panel: #fafaf8; --card: #fff; --hover: #efefec;
  --line: #dededa; --soft: #ebebe7;
  --text: #151515; --muted: #5c5c5c; --faint: #6b6b6b;
  --accent: #c43a3d; --mark: #c43a3d;
  --sel-border: #c43a3d; --sel-bg: rgba(196, 58, 61, .07); --avatar: rgba(196, 58, 61, .1);
  --nav-active: #efefec;
  --btn: #151515; --btn-border: #151515; --btn-text: #fff; --btn-hover: #333;
  --input: #fff;
  --up: #2a8a57; --up-text: #2a8a57; --warn-text: #9a6500; --bad-text: #b3261e;
  --meter: #151515; --track: #e4e4e0;
  --grid: #e6e6e2; --line1: #151515; --line2: #2f6fd6;
  --logo-bg: #151515; --logo-bar: #f3f3f1; --logo-red: #e05a5a;
  --menu: #fff; --drawer: #fafaf8; --dim: rgba(0, 0, 0, .3); --code: #f6f6f4;
  color-scheme: light;
}

:root {
  --radius: 10px;
  --radius-sm: 6px;
  --gap: 16px;
  --sidebar: 236px;
  --font: "Inter", system-ui, sans-serif;
  --display: "Tektur", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "DejaVu Sans Mono", monospace;
}

/* ===================== Основа ===================== */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: "tnum", "zero";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: 0; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-feature-settings: normal; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===================== Элементы ===================== */

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --- Кнопки --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer;
  font-weight: 500; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--btn); color: var(--btn-text); border-color: var(--btn-border); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-danger { color: var(--accent); }
.btn-danger:hover { border-color: var(--accent); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 30px; height: 30px; padding: 0; }
.btn-icon .icon { width: 16px; height: 16px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--hover); }

/* --- Поля --- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--input); color: var(--text); outline: none;
}
.input:focus { border-color: var(--muted); }
.input::placeholder { color: var(--faint); }

/* --- Карточки --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--soft); }
.card-body { padding: 16px; }
.card + .card { margin-top: var(--gap); }
.tiles > .card, .grid-2 > .card, .grid-3 > .card { margin-top: 0; }

/* --- Метки --- */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.dot.up, .dot.local { background: var(--up); }
.dot.bridge { background: var(--line2); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--up-text); }
.badge.warn { color: var(--warn-text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  color: var(--text); font-size: 13px; text-decoration: none; max-width: 100%;
}
.chip .icon { width: 14px; height: 14px; color: var(--muted); }
button.chip, a.chip { cursor: pointer; }
button.chip:hover, a.chip:hover { background: var(--hover); }
.chip-sep { color: var(--faint); align-self: center; }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--sel-border); background: var(--sel-bg); color: var(--bad-text); font-size: 13px; margin-bottom: 14px; }
.alert.info { border-color: var(--line); background: transparent; color: var(--muted); }
.alert.peek { color: var(--text); display: flex; align-items: center; gap: 10px; }
.alert code { color: var(--text); font-family: var(--mono); word-break: break-all; }

/* --- Полоски заполнения --- */
.meter { position: relative; height: 4px; border-radius: 2px; background: var(--track); margin-top: 12px; }
.meter > i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--meter); transition: width .4s; }
.meter > .mark { position: absolute; top: -4px; width: 2px; height: 12px; border-radius: 1px; background: var(--mark); margin-left: -1px; }
.meter.big { height: 8px; border-radius: 4px; display: flex; overflow: hidden; }
.meter.big > i { border-radius: 0; }
.meter.big > i.second { background: var(--faint); opacity: .35; }

/* --- Таблицы --- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

/* --- Окна --- */
.modal-backdrop { position: fixed; inset: 0; background: var(--dim); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px; background: var(--menu); }
.modal.wide { max-width: 560px; }
.modal h2 { margin-bottom: 12px; }
.modal p { color: var(--muted); margin: 0 0 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.qr { display: block; margin: 4px auto 12px; background: #fff; padding: 10px; border-radius: 8px; image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: var(--mono); font-size: 13px; margin: 8px 0 4px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { font-family: var(--mono); font-size: 12px; }

/* --- Всплывающее меню --- */
.popup { position: fixed; z-index: 50; min-width: 190px; padding: 6px; background: var(--menu); }
.popup-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; }
.popup-item:hover, .popup-item:focus-visible { background: var(--hover); }
.popup-item .icon { width: 16px; height: 16px; color: var(--muted); }
.popup-item.danger, .popup-item.danger .icon { color: var(--accent); }
.popup-sep { height: 1px; margin: 6px 0; background: var(--soft); }

/* --- Уведомления --- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--menu); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; max-width: 380px; font-size: 13px; }
.toast.err { border-color: var(--sel-border); color: var(--bad-text); }
.toast.ok { border-color: var(--up); }

/* ===================== Вход ===================== */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .btn-primary { width: 100%; height: 42px; margin-top: 4px; }
.login-box .btn.wide { width: 100%; height: 40px; margin-top: 8px; }
.login-box p { margin: 0 0 14px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-name { font-size: 18px; font-weight: 600; }
.brand-sub { color: var(--muted); font-size: 13px; }
.logo { width: 34px; height: 34px; flex: none; }
.logo .bg { fill: var(--logo-bg); }
.logo .bar { fill: var(--logo-bar); }
.logo .red { fill: var(--logo-red); }

/* ===================== Оболочка: меню слева ===================== */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.main { min-width: 0; padding: 28px 32px 120px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--soft); padding: 18px 12px;
}
.sidebar .brand { margin: 0 6px 22px; }
.sidebar .logo { width: 32px; height: 32px; }
.sidebar .brand-name { font-size: 16px; }
.nav-section { margin-bottom: 20px; }
.nav-title { margin: 0 10px 8px; color: var(--faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a.active { color: var(--text); background: var(--nav-active); box-shadow: inset 2px 0 0 var(--mark); }

/* Аккаунты этого браузера — как выбор сервера в Hub */
.acc-list { display: grid; gap: 6px; margin-bottom: 10px; }
.acc-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; padding: 0 10px 0 6px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--text);
  font-size: 13px; text-align: left; cursor: pointer;
}
.acc-btn:hover { background: var(--hover); }
.acc-btn.active { border-color: var(--sel-border); background: var(--sel-bg); }
.acc-btn .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-btn .name small { color: var(--muted); font-size: 13px; }
.acc-btn .icon { width: 16px; height: 16px; color: var(--accent); }
.acc-add { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 10px; color: var(--muted); font-size: 13px; text-decoration: none; border-radius: var(--radius-sm); }
.acc-add:hover { color: var(--text); background: var(--hover); }
.acc-add .icon { width: 14px; height: 14px; }

/* Аватар: картинка или буква. Светится, только если стоит своя картинка. */
.avatar {
  width: 26px; height: 26px; flex: none; border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center;
  background: var(--avatar); color: var(--accent); font-weight: 600; font-size: 12px; line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.md { width: 34px; height: 34px; font-size: 15px; }
.avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.avatar.xl { width: 96px; height: 96px; font-size: 38px; margin: 4px auto 14px; display: grid; }

.sidebar-foot { margin-top: auto; padding-top: 20px; }
.account {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text);
  text-align: left; cursor: pointer;
}
.account[aria-expanded="true"] { border-color: var(--sel-border); }
.account-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.account .user-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .route { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.account > .icon { color: var(--muted); width: 16px; height: 16px; }

/* Меню настроек (по клику на аватар) */
.menu {
  position: fixed; left: 12px; bottom: 86px; z-index: 30; width: 300px; max-height: calc(100vh - 100px); overflow-y: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--menu);
}
.menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 12px; }
.menu-head b { display: block; font-weight: 600; }
.menu-head span span { color: var(--muted); font-size: 12px; }
.menu-sep { height: 1px; margin: 8px 0; background: var(--soft); }
.menu-title { padding: 4px 8px 6px; color: var(--faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 8px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; text-decoration: none;
}
.menu-item:hover { background: var(--hover); }
.menu-item.active { background: var(--sel-bg); }
.menu-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item small { color: var(--muted); font-size: 13px; }
.menu-item > .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item.active > .icon:last-child { color: var(--accent); }
.menu-item.danger, .menu-item.danger .icon { color: var(--accent); }
.themes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 8px 4px; }
.theme-btn { height: 32px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: transparent; color: var(--text); font-size: 12px; cursor: pointer; }
.theme-btn[aria-pressed="true"] { border-color: var(--sel-border); background: var(--sel-bg); }

/* ===================== Общее для страниц ===================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { overflow-wrap: anywhere; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input { width: 220px; height: 36px; }
.group { margin-bottom: var(--gap); }
.group-title { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 8px 2px; }
.group-title .icon { width: 16px; height: 16px; }
.group-title .count { color: var(--faint); }

/* Строки файлов — как строки контейнеров в Hub */
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--soft); }
.row:first-child { border-top: 0; }
.row-main { min-width: 0; }
.move-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.modal.center { text-align: center; }
.modal.center .modal-actions { justify-content: center; }
.row-open { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 0; border: 0; background: none; color: var(--text); font-weight: 500; text-align: left; cursor: pointer; text-decoration: none; }
.row-open:hover { color: var(--accent); }
.row-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-open .icon { width: 16px; height: 16px; color: var(--muted); }
.row-open .icon.folder-icon { color: var(--accent); }
.row-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 3px 0 0 26px; font-size: 12px; color: var(--muted); }
.row-meta .warn { color: var(--warn-text); }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row-actions .btn-icon { color: var(--text); }

/* Перетаскивание файлов на страницу */
.dropzone {
  position: fixed; inset: 12px 12px 12px calc(var(--sidebar) + 12px); z-index: 35; display: grid; place-items: center;
  border: 2px dashed var(--accent); border-radius: var(--radius); background: var(--dim); color: var(--text);
  font-family: var(--display); font-size: 20px; pointer-events: none;
}

/* ===================== Обзор ===================== */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.tile { padding: 16px; min-width: 0; }
.tile-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.tile-value { font-family: var(--display); font-size: 28px; font-weight: 600; margin: 8px 0 2px; white-space: nowrap; }
.tile-value small { font-size: 15px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.tile-sub { color: var(--muted); font-size: 12px; min-height: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-bottom: var(--gap); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--line1); }
.legend i.alt { background: var(--line2); }
.chart { display: block; width: 100%; height: 170px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .l1 { stroke: var(--line1); stroke-width: 1.6; fill: none; stroke-linejoin: round; }
.chart .l2 { stroke: var(--line2); stroke-width: 1.6; fill: none; stroke-linejoin: round; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--hover); }
.chart-days { display: flex; justify-content: space-between; color: var(--faint); font-size: 11px; margin-top: 4px; }
.folders { display: grid; gap: 16px; }
.folder-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.folder-head a { color: var(--muted); font-size: 13px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-head a:hover { color: var(--text); }
.folder-head b { font-family: var(--display); font-size: 17px; font-weight: 600; white-space: nowrap; }
.folder-head b small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.folders .meter { margin-top: 6px; }
.kv { display: grid; gap: 10px; font-size: 13px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; }
.kv > div > :first-child { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv > div > :last-child { white-space: nowrap; }
.kv a { text-decoration: none; }
.kv .icon { width: 14px; height: 14px; vertical-align: -2px; color: var(--muted); }
.ok-text { color: var(--up-text); }
.warn-text { color: var(--warn-text); }
.kv a:hover { color: var(--accent); }

/* ===================== Просмотр файла (панель справа, как логи в Hub) ===================== */
.drawer-backdrop { position: fixed; inset: 0; background: var(--dim); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); z-index: 21;
  background: var(--drawer); border-left: 1px solid var(--line); display: flex; flex-direction: column;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--soft); }
.drawer-title { min-width: 0; }
.drawer-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-title div { font-size: 12px; color: var(--muted); }
.drawer-body { flex: 1; overflow: auto; display: grid; place-items: center; padding: 16px; }
.drawer-body.text { display: block; place-items: normal; padding: 10px 0; background: var(--code); }
.drawer-body img, .drawer-body video { max-width: 100%; max-height: calc(100vh - 120px); border-radius: var(--radius-sm); }
.drawer-body audio { width: 100%; }
.code { margin: 0; font: 12.5px/1.7 var(--mono); counter-reset: line; }
.code span { display: block; padding: 0 16px 0 0; white-space: pre-wrap; word-break: break-word; }
.code span::before { counter-increment: line; content: counter(line); display: inline-block; width: 44px; padding-right: 14px; text-align: right; color: var(--faint); }

/* ===================== Загрузки (окошко в углу) ===================== */
.uploads { position: fixed; right: 16px; bottom: 16px; z-index: 25; width: 380px; max-width: calc(100vw - 32px); }
.uploads-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--soft); }
.uploads-head b { font-family: var(--display); font-weight: 600; }
.uploads-list { max-height: 260px; overflow-y: auto; }
.upload { padding: 10px 12px; border-top: 1px solid var(--soft); font-size: 13px; }
.upload:first-child { border-top: 0; }
.upload-top { display: flex; justify-content: space-between; gap: 10px; }
.upload-top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-top b { flex: none; font-family: var(--display); font-weight: 600; padding-right: 2px; }
.upload .meter { margin: 8px 0 6px; }
.upload .meter > i { background: var(--line1); transition: none; }
.upload-sub { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.upload-sub .route { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.upload.failed .upload-sub { color: var(--bad-text); }

/* ===================== Аккаунты (админ) ===================== */
.disk-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 14px; }
.disk-stats span { display: block; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.disk-stats b { font-family: var(--display); font-size: 20px; font-weight: 600; }
.acc-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.acc-cell div { display: grid; min-width: 0; }
.acc-cell b { font-weight: 500; }
.acc-cell small { color: var(--muted); font-size: 12px; }
.used-cell { min-width: 180px; }
.used-cell .meter { margin-top: 6px; }
.quota-edit { display: flex; gap: 6px; align-items: center; }
.quota-edit .input { width: 90px; height: 30px; font-size: 13px; }

/* ===================== Журнал ===================== */
.journal tr.foreign td { background: var(--sel-bg); }
.nowrap { white-space: nowrap; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bad-text { color: var(--bad-text); }
.more-row { display: flex; justify-content: center; margin-top: var(--gap); }
.input.select { width: auto; height: 36px; min-width: 160px; cursor: pointer; }
.group-gap { margin-top: 24px; }
.acc-cell .badge { margin-left: 8px; height: 18px; font-size: 11px; }

/* ===================== Узкие экраны ===================== */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .disk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .main { padding: 18px 14px 120px; }
  .sidebar {
    position: sticky; z-index: 15; height: auto; overflow: visible; flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 6px; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--soft);
  }
  .sidebar .brand { margin: 0; }
  .sidebar .brand > div { display: none; }
  .nav-section { display: contents; }
  .nav-title, .acc-list, .acc-add { display: none; }
  .nav { display: flex; gap: 2px; }
  .nav a { height: 36px; padding: 0 9px; }
  .nav a span { display: none; }
  .nav a.active { box-shadow: inset 0 -2px 0 var(--mark); }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; }
  .account { padding: 4px; border: 0; background: none; }
  .account-text, .account > .icon { display: none; }
  .menu { left: auto; right: 8px; top: 56px; bottom: auto; }
  .dropzone { inset: 8px; }
  .toolbar .input { width: 100%; flex: 1 1 160px; }
  .row { padding: 10px 12px; gap: 8px; }
  .row-meta { margin-left: 0; }
  .tiles { gap: 10px; }
  .tile { padding: 12px; }
  .tile-value { font-size: 22px; }
  .field-row { grid-template-columns: 1fr; }
  .uploads { right: 8px; bottom: 8px; }
}

@media (max-width: 420px) {
  .tiles { grid-template-columns: 1fr; }
}
