/* Cassiopeia Dataroom — брендовая светлая тема, Montserrat, 2026-05-29. */

/* ─── Шрифт ──────────────────────────────────────────────────── */
@font-face { font-family: 'Montserrat'; font-weight: 400; font-style: normal;
  src: url('/static/fonts/Montserrat-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Montserrat'; font-weight: 500; font-style: normal;
  src: url('/static/fonts/Montserrat-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Montserrat'; font-weight: 600; font-style: normal;
  src: url('/static/fonts/Montserrat-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Montserrat'; font-weight: 700; font-style: normal;
  src: url('/static/fonts/Montserrat-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Montserrat'; font-weight: 800; font-style: normal;
  src: url('/static/fonts/Montserrat-ExtraBold.ttf') format('truetype'); }

/* ─── Токены ─────────────────────────────────────────────────── */
:root {
  --cas-blue: #1043D4;
  --cas-blue-700: #0C36A8;
  --cas-blue-50: #EEF2FE;
  --ink: #10151F;
  --muted: #5A647A;
  --dim: #8A93A6;
  --line: #E6E9F0;
  --line-strong: #D5DAE6;
  --bg: #FFFFFF;
  --bg-soft: #F7F8FC;
  --grad: linear-gradient(90deg,#04133D 2.88%,#08236D 23.18%,#0C36A8 50.95%,#0F44D3 73.48%,#D5DDF2 95.19%);

  /* Для совместимости с существующими шаблонами (admin) */
  --accent: #1043D4;
  --accent-hover: #0C36A8;
  --accent-soft: #EEF2FE;
  --border: #E6E9F0;
  --border-strong: #D5DAE6;
  --text: #10151F;
  --text-muted: #5A647A;
  --text-dim: #8A93A6;
  --bg-elevated: #FFFFFF;
  --bg-card: #F7F8FC;
  --danger: #C0392B;
  --danger-soft: rgba(192, 57, 43, 0.10);
  --success: #1E8E5A;
  --warn: #C77A12;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow: 0 1px 4px rgba(16,21,31,0.08);
  --shadow-lg: 0 10px 30px rgba(16,21,31,0.12);
  --max-w: 1180px;
  --font: 'Montserrat', sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, monospace;
}

/* ─── Сброс ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cas-blue); text-decoration: none; }
a:hover { color: var(--cas-blue-700); }

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

/* ─── Топбар (светлый) ───────────────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__grad {
  height: 3px;
  background: var(--grad);
}
.topbar__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* alias: mock использует .topbar__in */
.topbar__in {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
/* alias: mock uses .brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
.brand img { height: 26px; width: auto; display: block; }
.brand__wm { font-weight: 600; font-size: 18px; letter-spacing: -0.01em; color: var(--ink); }
.brand__sub {
  font-weight: 500;
  color: var(--dim);
  font-size: 13px;
  border-left: 1px solid var(--line-strong);
  padding-left: 10px;
  margin-left: 2px;
}

.topbar__brand-logo { height: 26px; width: auto; display: block; }
.topbar__brand-sub {
  font-weight: 500;
  color: var(--dim);
  font-size: 13px;
  border-left: 1px solid var(--line-strong);
  padding-left: 10px;
  margin-left: 2px;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar__nav-link {
  color: var(--cas-blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--cas-blue-50);
  border-radius: 8px;
}
.topbar__nav-link:hover { background: var(--cas-blue-50); }
/* alias for mock */
.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar__user {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 9px;
}
/* alias for mock */
.user {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.topbar__role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--cas-blue-50);
  color: var(--cas-blue);
}
.topbar__role--admin { background: var(--cas-blue-50); color: var(--cas-blue); }
.topbar__role--editor { background: #EAF6EE; color: #1E8E5A; }
.topbar__role--reader { background: var(--bg-soft); color: var(--muted); }
/* alias for mock */
.role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--cas-blue-50);
  color: var(--cas-blue);
}

.topbar__logout { display: inline; }
.topbar__logout-btn {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease;
}
.topbar__logout-btn:hover { border-color: var(--cas-blue); color: var(--cas-blue); }
/* alias */
.btn-ghost {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--cas-blue); color: var(--cas-blue); }

/* MFA-предупреждение */
.topbar__warn {
  background: rgba(199, 122, 18, 0.12);
  border: 1px solid rgba(199, 122, 18, 0.3);
  color: #C77A12;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: all 120ms ease;
}
.topbar__warn:hover {
  background: rgba(199, 122, 18, 0.20);
  color: #a0620d;
}

/* ─── Основная обёртка ───────────────────────────────────────── */
.main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 26px 28px;
}

/* ─── Layout (кабинет с сайдбаром) ──────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
}
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
}

/* ─── Обёртка 2-колонок (из _base.css: .wrap) ───────────────── */
.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 26px 28px;
  display: grid;
  grid-template-columns: 248px 1fr;
  gap: 30px;
}
@media (max-width: 768px) {
  .wrap { grid-template-columns: 1fr; }
}

/* ─── Сайдбар разделов ───────────────────────────────────────── */
.sidebar {
  height: fit-content;
  position: sticky;
  top: 76px;
}
.sidebar__group { margin-bottom: 20px; }
.sidebar__group:last-child { margin-bottom: 0; }
.sidebar__group--admin {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.sidebar__group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
  margin: 0 0 12px 8px;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
  transition: all 100ms;
}
.sidebar__link:hover { background: var(--bg-soft); color: var(--ink); }
.sidebar__link--active,
.sidebar__link.on { background: var(--cas-blue-50); color: var(--cas-blue); font-weight: 600; }
.sidebar__link--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.sidebar__empty {
  padding: 12px;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.sidebar__empty-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--dim);
}

/* Дерево разделов (левый сайдбар кабинета) */
.side {}
.side__t {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--dim);
  margin: 0 0 12px 8px;
}
.tree { list-style: none; }
.tree li { margin: 1px 0; }
.tree a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
}
.tree a:hover { background: var(--bg-soft); color: var(--ink); }
.tree a.on { background: var(--cas-blue-50); color: var(--cas-blue); font-weight: 600; }
.tree .sub {
  margin-left: 14px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}
/* Нечликабельный предок: виден ради доступного потомка, но сам недоступен */
.tree-label-muted {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--dim);
  font-weight: 500;
  font-size: 13.5px;
  cursor: default;
  user-select: none;
}

/* ─── Контент ────────────────────────────────────────────────── */
.content { min-width: 0; }
.content__title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  color: var(--ink);
}
.content__subtitle {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 12px;
  color: var(--ink);
}
.content__lede {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 13.5px;
}
.content__hint { font-size: 13px; color: var(--muted); }
.content__hint a { color: var(--cas-blue); }

/* Хлебные крошки */
.crumbs {
  font-size: 12.5px;
  color: var(--dim);
  margin-bottom: 10px;
  font-weight: 500;
}
.crumbs b { color: var(--muted); font-weight: 600; }

/* Заголовок + кнопка */
.head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 6px;
}
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.lede { color: var(--muted); margin-bottom: 22px; font-size: 13.5px; }

/* ─── Кнопки-пилюли ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--cas-blue);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 120ms;
  text-decoration: none;
}
.btn:hover { background: var(--cas-blue-700); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-sec {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: var(--cas-blue);
  border: 1px solid var(--cas-blue);
  padding: 10px 18px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 120ms;
  text-decoration: none;
}
.btn-sec:hover { background: var(--cas-blue-50); }
.btn-sec:disabled { opacity: 0.55; cursor: not-allowed; }

/* кнопки размером меньше */
.btn--small { padding: 6px 12px; font-size: 12px; }
.btn--ok { background: #1E8E5A; }
.btn--ok:hover { background: #186e47; }
.btn--warn { background: var(--warn); color: #fff; }
.btn--warn:hover { background: #a0620d; }

/* ─── Панель-таблица документов (плотные строки) ──────────────── */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dim);
  font-weight: 700;
  padding: 11px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--cas-blue-50); }

/* Имя файла с иконкой */
.fname {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  color: var(--ink);
}

/* Иконки типов */
.ic {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  flex: 0 0 auto;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ic-pdf { background: #C0392B; }
.ic-xls { background: #1E8E5A; }
.ic-doc { background: #2C5BCB; }
.ic-img { background: #8A56C4; }
.ic-html { background: #E2620E; }
.ic-bin { background: #8A93A6; }

/* Muted/dim утилиты */
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 12.5px; }
.rowact { color: var(--dim); font-weight: 600; font-size: 12.5px; }

/* ─── Бейджи доступа ─────────────────────────────────────────── */
.tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 999px;
}
.tag-org { background: #EAF6EE; color: #1E8E5A; }
.tag-rest { background: #FDF0E3; color: #C77A12; }
.tag-priv { background: #FBE9E9; color: #C0392B; }
.tag-pub { background: var(--cas-blue-50); color: var(--cas-blue); }

/* ─── Страница документа (2-колонки) ────────────────────────── */
.doc {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 760px) { .doc { grid-template-columns: 1fr; } }

.preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  height: 620px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  color: var(--dim);
}
.preview .big {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  flex: 0 0 auto;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.preview .big-pdf { background: #C0392B; }
.preview .big-xls { background: #1E8E5A; }
.preview .big-doc { background: #2C5BCB; }
.preview .big-img { background: #8A56C4; }
.preview .big-html { background: #E2620E; }
.preview .big-bin { background: #8A93A6; }

.meta {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.meta h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 14px;
}
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}
.kv dt { color: var(--dim); }
.kv dd { color: var(--ink); font-weight: 600; text-align: right; }
.kv__muted { color: var(--muted); font-size: 13px; }
.kv__warn { color: var(--warn); }
.acts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.acts .btn, .acts .btn-sec { justify-content: center; }

/* ─── Градиент-бэнд (страница документа) ───────────────────── */
.grad-band {
  position: relative;
  flex: none;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(90deg,#04133D 0%,#08236D 24%,#0C36A8 50%,#0F44D3 74%,#1B57E6 100%);
}
.grad-band .star {
  position: absolute;
  right: 56px;
  bottom: 24px;
  height: 128px;
  width: auto;
}
.grad-band .label {
  position: absolute;
  left: 40px;
  bottom: 26px;
  color: rgba(255,255,255,0.96);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.grad-band .label small {
  display: block;
  font-weight: 500;
  font-size: 12px;
  color: rgba(255,255,255,0.66);
  margin-top: 3px;
  letter-spacing: 0.04em;
}

/* ─── Декоративные полукруги (низ кабинета) ─────────────────── */
.arcs {
  position: relative;
  margin-top: 54px;
  height: 200px;
  overflow: hidden;
}
.arcs svg {
  position: absolute;
  left: 50%;
  bottom: -340px;
  transform: translateX(-50%);
  width: 1100px;
  height: 540px;
}

/* ─── Страница-раздел: flex-body для footer-band ─────────────── */
body.page-doc {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-main {
  flex: 1 0 auto;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 26px 28px;
  width: 100%;
}

/* ─── Admin tables / badges ──────────────────────────────────── */
.table-wrap {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th,
.table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dim);
  font-weight: 700;
  background: var(--bg-soft);
}
.table tbody tr:hover { background: var(--cas-blue-50); }
.table__link { color: var(--ink); font-weight: 500; }
.table__link:hover { color: var(--cas-blue); }
.table__muted { color: var(--muted); font-size: 13px; }
.table__mono { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.table__ua {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Бейджи (admin) */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.badge--soft { background: var(--cas-blue-50); color: var(--cas-blue); margin-left: 6px; }
.badge--ok { background: #EAF6EE; color: #1E8E5A; }
.badge--warn { background: #FDF0E3; color: #C77A12; }
.badge--role-admin { background: var(--cas-blue-50); color: var(--cas-blue); }
.badge--role-editor { background: #EAF6EE; color: #1E8E5A; }
.badge--role-reader { background: var(--bg-soft); color: var(--muted); }
.badge--status-active { background: #EAF6EE; color: #1E8E5A; }
.badge--status-suspended { background: #FDF0E3; color: #C77A12; }
.badge--status-deleted { background: #FBE9E9; color: #C0392B; }

/* ─── Cards ──────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.card--pending { opacity: 0.6; }
.card__title { font-weight: 600; font-size: 14px; margin-bottom: 6px; color: var(--ink); }
.card__body { font-size: 13px; color: var(--muted); line-height: 1.55; }
.card__muted { display: block; margin-top: 4px; color: var(--dim); font-size: 12px; }
.cards--detail { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .cards--detail { grid-template-columns: 1fr; } }

/* ─── Flash ──────────────────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid;
}
.flash--success { background: #EAF6EE; border-color: #b6e1c8; color: #1E8E5A; }
.flash--warn { background: #FDF0E3; border-color: #f5c88a; color: #C77A12; }
.flash--error { background: #FBE9E9; border-color: #f5b4b0; color: #C0392B; }

/* ─── Форма авторизации (login) — сохраняем классы для Jinja ─── */
.auth {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth__card {
  width: 100%;
  max-width: 380px;
}
.auth__error {
  background: #FBE9E9;
  border: 1px solid rgba(192, 57, 43, 0.3);
  color: #C0392B;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
.auth__form { display: flex; flex-direction: column; gap: 14px; }
.auth__field { display: flex; flex-direction: column; gap: 6px; }
.auth__label { font-size: 12.5px; }
.auth__step {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  text-align: center;
  margin-bottom: 16px;
}
.auth__code-input {
  font-family: var(--font-mono) !important;
  font-size: 24px !important;
  text-align: center;
  letter-spacing: 0.3em;
  padding: 12px 16px !important;
}
.auth__hint {
  margin-top: 20px;
  font-size: 11.5px;
  text-align: center;
  line-height: 1.6;
}

/* ─── MFA setup ──────────────────────────────────────────────── */
.mfa-setup {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  margin-top: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
}
@media (max-width: 760px) {
  .mfa-setup { grid-template-columns: 1fr; }
  .mfa-setup__col--qr { order: -1; }
}
.mfa-setup__steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 22px; }
.mfa-setup__step-title { font-weight: 600; margin-bottom: 6px; }
.mfa-setup__step-body { color: var(--muted); font-size: 14px; line-height: 1.6; }
.mfa-setup__secret {
  margin-top: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  word-break: break-all;
  user-select: all;
}
.mfa-setup__code-row { display: flex; gap: 10px; align-items: stretch; }
.mfa-setup__code-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.2em;
  text-align: center;
  outline: none;
}
.mfa-setup__code-input:focus { border-color: var(--cas-blue); }
.mfa-setup__submit {
  background: var(--cas-blue);
  border: none;
  color: white;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
.mfa-setup__submit:hover { background: var(--cas-blue-700); }
.mfa-setup__qr {
  background: white;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: start;
}
.mfa-setup__qr svg { width: 100%; height: auto; max-width: 256px; }

/* ─── Narrow layout (account-страницы) ──────────────────────── */
.layout--narrow {
  grid-template-columns: 1fr;
  max-width: 900px;
  margin: 0 auto;
}

/* ─── Invite form ────────────────────────────────────────────── */
.invite-form {
  display: grid;
  grid-template-columns: 2fr 1fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 760px) { .invite-form { grid-template-columns: 1fr; } }
.invite-form select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}
.invite-form select:focus { border-color: var(--cas-blue); }
.invite-form button { padding: 10px 16px; }

.invite-url {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
  user-select: all;
}

/* ─── Дерево разделов (admin, 3.3) ──────────────────────────── */
.sec-tree { list-style: none; margin: 0; padding: 0; }
.sec-tree--root { margin-top: 8px; }
.sec-node > .sec-tree {
  margin-left: 22px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  min-height: 12px;
}
.sec-node { margin: 4px 0; }
.sec-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.sec-handle { cursor: grab; user-select: none; opacity: 0.5; font-size: 14px; line-height: 1; }
.sec-handle:active { cursor: grabbing; }
.sec-name { font-weight: 600; }
.sec-slug { font-family: var(--font-mono); font-size: 12px; opacity: 0.55; }
.sec-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.sec-rename { position: relative; }
.sec-rename > summary { cursor: pointer; list-style: none; }
.sec-rename > summary::-webkit-details-marker { display: none; }
.sec-rename__form { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.sec-rename__form input {
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
}
.sortable-ghost { opacity: 0.4; }
.sortable-ghost .sec-row { border-style: dashed; border-color: var(--cas-blue); }

/* ─── Поля форм (upload / admin) ─────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-control {
  display: block;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms;
}
.form-control:focus { border-color: var(--cas-blue); }
.form-control select { appearance: none; }

/* ─── Upload-форма (отдельная страница) ──────────────────────── */
.upload-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 560px;
}
.upload-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--ink);
}
.upload-card .sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}

/* ─── Action row (admin) ─────────────────────────────────────── */
.action-row { margin-bottom: 10px; }
.action-row:last-child { margin-bottom: 0; }

/* ─── Form fields (light vault theme) ────────────────────────────
   Светлый вариант .fld для форм кабинета (login имеет свой тёмный .fld
   локально — он перекрывает этот глобальный). Используется в share-форме. */
.fld { margin-bottom: 26px; }
.fld > label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 9px;
}
.fld input[type="text"],
.fld input[type="password"],
.fld input[type="number"],
.fld input[type="datetime-local"],
.fld input[type="email"],
.fld select {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 15px;
  font-size: 14.5px;
  line-height: 1.4;
  font-family: 'Montserrat', sans-serif;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  transition: border-color 120ms, box-shadow 120ms;
}
.fld input::placeholder { color: #9AA3B5; }
.fld input:focus,
.fld select:focus {
  outline: none;
  border-color: var(--cas-blue);
  box-shadow: 0 0 0 3px var(--cas-blue-50);
}
.fld .hint {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}
.fld-check {
  margin-bottom: 26px;
  padding: 16px 18px;
  background: var(--cas-blue-50);
  border-radius: 12px;
}
.fld-check label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.fld-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--cas-blue);
  cursor: pointer;
  flex-shrink: 0;
}
.fld-check .hint {
  display: block;
  margin: 5px 0 0;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.55;
}
/* Вводная подпись формы */
.form-lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 24px;
  max-width: 560px;
}

/* ─── Полноэкранный просмотрщик (vault viewer) ───────────────── */
body.viewer-page {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}
html:has(body.viewer-page) {
  height: 100%;
  overflow: hidden;
}
/* Top-bar просмотрщика */
.vw-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
  z-index: 100;
}
.vw-bar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.vw-bar__back {
  font-size: 13px;
  font-weight: 600;
  color: var(--cas-blue);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.vw-bar__back:hover { text-decoration: underline; }
.vw-bar__sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  flex-shrink: 0;
}
.vw-bar__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vw-bar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.vw-bar__props {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.vw-bar__props:hover { color: var(--ink); }
.vw-bar__dl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  background: var(--cas-blue);
  color: #fff;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 120ms;
}
.vw-bar__dl:hover { background: var(--cas-blue-700); }
/* Document area */
.vw-doc {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
}
.vw-doc iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}
.vw-doc img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.vw-doc--img {
  background: #1e1e1e;
}
/* No-preview message */
.vw-nopreview {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
}
.vw-nopreview__msg {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}
.vw-nopreview__link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent);
  text-decoration: underline;
}
