/* Дизайн-система «Барс-Консалтинг · База знаний».
   Палитра bars-ocenka.ru: #001434 / #0584EA / #6118D3 / #E94524, Manrope, r=10px.
   Темы: [data-theme=light|dark] на html; auto — по prefers-color-scheme. */

@font-face {
  font-family: "Manrope";
  src: url("../fonts/Manrope-Regular.c067951e63c0.woff2") format("woff2");
  font-weight: 400 500;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/Manrope-Bold.be3f697fb995.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}

:root {
  --bg: #f5f4fa;
  --surface: #ffffff;
  --surface-2: #f0eef7;
  --text: #001434;
  --muted: #5c6f80;
  --accent: #6118d3;          /* фирменный фиолетовый bars-ocenka.ru */
  --accent-strong: #4e13aa;
  --accent-soft: #f0e9fb;
  --accent-2: #0584ea;        /* вторичный синий — инфо-элементы */
  --accent-2-soft: #e3f1fd;
  --danger: #e94524;
  --danger-soft: #fdeae5;
  --ok: #148055;
  --ok-soft: #e3f5ec;
  --warn: #9a6b0c;
  --warn-soft: #fdf3dc;
  --border: #dfe5ee;
  --shadow: 0 1px 3px rgba(0, 20, 52, 0.07), 0 4px 16px rgba(0, 20, 52, 0.05);
  --radius: 10px;
  --header-bg: #ffffff;
  --diff-add: #e3f5ec;
  --diff-add-strong: #b7e6cf;
  --diff-del: #fdeae5;
  --diff-del-strong: #f6c4b6;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #101a2e;
  --surface-2: #16233c;
  --text: #e6ebf2;
  --muted: #8fa1b8;
  --accent: #a37ef2;
  --accent-strong: #b997f5;
  --accent-soft: #241a3e;
  --accent-2: #33a1f2;
  --accent-2-soft: #12253c;
  --danger: #f4674a;
  --danger-soft: #33170f;
  --ok: #2fbf7f;
  --ok-soft: #0e2b1f;
  --warn: #d8a72e;
  --warn-soft: #2d2410;
  --border: #223049;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --header-bg: #0e1730;
  --diff-add: #10301f;
  --diff-add-strong: #1d5c39;
  --diff-del: #3a1710;
  --diff-del-strong: #6e2a1a;
  color-scheme: dark;
}

/* --- Базовое --- */
* { box-sizing: border-box; }
/* атрибут hidden обязан работать даже у элементов с display-правилами (.btn и т.п.) */
[hidden] { display: none !important; }
/* тонкие скроллбары */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
html { height: 100%; }
body {
  margin: 0;
  font: 16px/1.55 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
}
h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; font-weight: 700; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* --- Шапка: два уровня — бренд/пользователь и строка навигации --- */
.topbar {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
}
.topbar-top { padding-top: 10px; padding-bottom: 8px; justify-content: space-between; }
.topbar-navrow { border-top: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.brand img { height: 32px; width: auto; display: block; }
html[data-theme="dark"] .brand img { filter: brightness(0) invert(1); }
.brand-title { font-weight: 700; color: var(--text); font-size: 1rem; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; min-width: 0; }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  padding: 10px 14px; white-space: nowrap; position: relative;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--accent); border-bottom-color: var(--accent); }
.user-menu { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; flex-shrink: 0; }
.user-menu form { display: inline; }
.linklike { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-weight: 600; padding: 0; }

/* выпадающее меню пользователя (details/summary — без JS) */
.user-dd { position: relative; }
.user-dd summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border);
  font-weight: 600; color: var(--text); font-size: 0.9rem; white-space: nowrap;
}
.user-dd summary::-webkit-details-marker { display: none; }
.user-dd summary::after { content: "▾"; font-size: 0.7rem; color: var(--muted); }
.user-dd[open] summary { background: var(--surface-2); }
/* dd-menu — общий контейнер выпадающих меню (шапка, оргсхема) */
.dd-menu {
  min-width: 210px; max-width: 280px; z-index: 100;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 20, 52, 0.18), var(--shadow);
  padding: 6px; display: flex; flex-direction: column;
}
.user-dd .dd-menu { position: absolute; right: 0; top: calc(100% + 6px); }
.dd-menu button.danger { color: var(--danger); }
.dd-menu button.danger:hover { background: var(--danger-soft); color: var(--danger); }
.dd-menu a, .dd-menu button {
  display: block; width: 100%; text-align: left; padding: 8px 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 500; font-size: 0.92rem;
  background: none; border: none; cursor: pointer; font-family: inherit;
}
.dd-menu a:hover, .dd-menu button:hover { background: var(--surface-2); color: var(--accent); }
.dd-menu .dd-sep { border-top: 1px solid var(--border); margin: 6px 4px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 34px; height: 34px; cursor: pointer; font-size: 1rem; line-height: 1;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* --- Контент --- */
.content { max-width: 1160px; margin: 28px auto; padding: 0 20px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.page-head h1 { margin: 0.2em 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }

/* --- Кнопки --- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: 1px solid transparent;
  border-radius: var(--radius); padding: 9px 16px; font: inherit; font-weight: 600;
  font-size: 0.92rem; cursor: pointer; text-decoration: none; transition: background 0.12s;
}
.btn:hover { background: var(--accent-strong); color: #fff; }
button[type="submit"]:not(.linklike) { composes: none; }
.btn-secondary { background: transparent; color: var(--accent); border-color: var(--border); }
.btn-secondary:hover { background: var(--accent-soft); color: var(--accent-strong); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c93a1e; }
.btn-small { padding: 5px 11px; font-size: 0.85rem; border-radius: 8px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

form button[type="submit"] {
  background: var(--accent); color: #fff; border: none; border-radius: var(--radius);
  padding: 9px 16px; font: inherit; font-weight: 600; font-size: 0.92rem; cursor: pointer;
}
form button[type="submit"]:hover { background: var(--accent-strong); }
form .btn-danger[type="submit"] { background: var(--danger); }
.linklike[type="submit"] { background: none !important; color: var(--accent) !important; padding: 0; border-radius: 0; }

/* --- Формы --- */
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 0.95rem; background: var(--surface); color: var(--text);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="number"].num, .num { width: 72px; }
select { width: auto; max-width: 100%; }
label { font-weight: 600; font-size: 0.9rem; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: 4px 0; font-size: 0.9rem; }
.helptext { color: var(--muted); font-size: 0.82rem; }

/* --- Карточки и списки --- */
.card, .policy-card, .auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.policy-card { padding: 24px 30px; }
.auth-card { max-width: 430px; margin: 56px auto; padding: 28px 32px; }
.auth-card h1 { font-size: 1.35rem; margin-top: 0; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 8px; }
.auth-brand img { height: 44px; }
html[data-theme="dark"] .auth-brand img { filter: brightness(0) invert(1); }

.policy-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.policy-list li {
  position: relative; /* для растянутой зоны клика заголовка */
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow); transition: border-color 0.12s;
  cursor: pointer;
}
.policy-list li:hover { border-color: var(--accent); }
.policy-list a { color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.02rem; }
.policy-list a:hover, .policy-list li:hover > a:first-of-type { color: var(--accent); }
/* клик в любом месте карточки открывает регламент */
.policy-list li > a:first-of-type::after { content: ""; position: absolute; inset: 0; }
.policy-list .meta-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); }
.snippet { font-size: 0.88rem; margin-top: 6px; color: var(--muted); }

.empty-state {
  text-align: center; padding: 48px 20px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty-state .big { font-size: 2rem; display: block; margin-bottom: 8px; }

/* --- Теги-статусы --- */
.tag { background: var(--accent-soft); color: var(--accent-strong); border-radius: 999px; padding: 3px 12px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.tag-muted { background: var(--surface-2); color: var(--muted); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-violet { background: var(--accent-2-soft); color: var(--accent-2); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 0.75rem; margin-left: 4px; }

/* --- Сообщения --- */
.messages { list-style: none; padding: 0; margin: 0 0 14px; }
.msg { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 8px; background: var(--accent-soft); border: 1px solid transparent; }
.msg.warning { background: var(--warn-soft); color: var(--warn); }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.success { background: var(--ok-soft); color: var(--ok); }
.notice { background: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--radius); padding: 11px 16px; margin: 14px 0; color: var(--text); }
.notice.muted { background: var(--surface-2); border-color: var(--border); }

/* --- Таблицы --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: 0.92rem; }
.table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px 14px; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr[data-href] { cursor: pointer; }

/* --- Поиск, фильтры --- */
.search-form { display: flex; gap: 8px; margin: 14px 0; max-width: 520px; }
.search-form button { background: var(--accent); color: #fff; border: none; border-radius: var(--radius); padding: 9px 16px; font-weight: 600; cursor: pointer; }
.report-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.report-filters select { max-width: 300px; }

/* --- Карточка регламента --- */
.policy-meta { margin: 4px 0 14px; font-size: 0.9rem; }
.policy-content { line-height: 1.7; font-size: 1.02rem; }
.policy-content h2 { margin-top: 1.4em; }
.policy-content img { max-width: 100%; border-radius: 8px; }
.policy-content pre.code { background: var(--surface-2); border-radius: 8px; padding: 14px; overflow-x: auto; font-size: 0.88rem; }
.policy-content table { border-collapse: collapse; margin: 12px 0; }
.policy-content td, .policy-content th { border: 1px solid var(--border); padding: 7px 11px; }
.policy-content .checklist { list-style: none; padding-left: 0; }
.policy-content blockquote { border-left: 3px solid var(--accent); margin: 12px 0; padding: 4px 16px; color: var(--muted); }
.study-status { display: flex; gap: 12px; align-items: center; margin: 12px 0; flex-wrap: wrap; }

/* «Действует для:» — аудитория регламента бейджами */
.audience-row {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  margin: 10px 0 4px; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.audience-caption { color: var(--muted); font-size: 0.85rem; font-weight: 600; margin-right: 2px; }
.audience-except { margin-left: 8px; color: var(--danger); }
.aud-chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 12px; font-size: 0.82rem; font-weight: 600;
  text-decoration: none; border: 1px solid transparent; white-space: nowrap;
}
.aud-org { background: var(--accent-2-soft); color: var(--accent-2); }
.aud-dept { background: var(--accent-soft); color: var(--accent-strong); }
.aud-dept::before { content: "🏢"; font-size: 0.78rem; }
a.aud-dept:hover { border-color: var(--accent); color: var(--accent); }
.aud-user { background: var(--surface-2); color: var(--muted); }
.aud-user::before { content: "👤"; font-size: 0.78rem; }
.aud-except { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
a.aud-except:hover { border-color: var(--danger); text-decoration: line-through; }

/* --- Секреты --- */
.secret-field {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--accent-2-soft); border: 1px dashed var(--accent-2);
  border-radius: 8px; padding: 5px 12px; margin: 4px 0;
  font-size: 0.92rem; color: var(--accent-2); font-weight: 600;
}
.secret-field .secret-inline-value {
  font-family: ui-monospace, "Cascadia Code", monospace; font-weight: 400;
  color: var(--text); user-select: all;
}
.secrets h2 { display: flex; align-items: center; gap: 6px; }
.secret-list { list-style: none; padding: 0; }
.secret-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.secret-row:last-child { border-bottom: none; }
.secret-label { font-weight: 700; min-width: 200px; }
.secret-value { font-family: ui-monospace, "Cascadia Code", monospace; font-size: 0.95rem; }

/* --- Комментарии, согласование --- */
.comment { border-left: 3px solid var(--border); padding: 8px 14px; margin: 10px 0; }
.review-actions { background: var(--surface-2); border-radius: var(--radius); padding: 14px 20px 16px; margin: 18px 0; }
.review-actions h2 { margin: 0 0 12px; font-size: 1.02rem; }
.review-row { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.review-row form:first-child { display: flex; }
.review-row form:first-child .btn { align-self: stretch; }
.reject-form { display: flex; flex: 1; gap: 8px; min-width: 320px; }
.reject-form textarea { flex: 1; margin: 0; resize: vertical; min-height: 42px; }
.reject-form .btn { align-self: stretch; }
.comments textarea { display: block; width: 100%; max-width: 560px; margin: 8px 0; }

/* --- Дифф версий --- */
.diff-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.diff-toggle a { padding: 6px 14px; font-size: 0.85rem; font-weight: 600; text-decoration: none; color: var(--muted); }
.diff-toggle a.active { background: var(--accent-soft); color: var(--accent); }
.diff-add { background: var(--diff-add); border-left: 3px solid var(--ok); }
.diff-del { background: var(--diff-del); border-left: 3px solid var(--danger); text-decoration: line-through; opacity: 0.75; }
.diff-block { margin: 4px 0; padding: 2px 12px; border-radius: 6px; }
.diff-block > *:first-child { margin-top: 0.35em; }
.diff-block > *:last-child { margin-bottom: 0.35em; }
.diff-block p { margin: 0.35em 0; }
ins.diff-w { background: var(--diff-add-strong); text-decoration: none; border-radius: 3px; padding: 0 2px; }
del.diff-w { background: var(--diff-del-strong); border-radius: 3px; padding: 0 2px; }
.diff-legend { display: flex; gap: 16px; font-size: 0.82rem; color: var(--muted); margin: 8px 0; }
.diff-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* --- Редактор --- */
.editor-page .page-head h1 { font-size: 1.35rem; }
.editorjs-holder { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 20px; min-height: 340px; margin: 14px 0; box-shadow: var(--shadow); }
.editor-toolbar input { font-size: 1.25rem; font-weight: 700; }
.secrets-panel, .study-settings-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 14px 0; box-shadow: var(--shadow); }
.secrets-panel h2, .study-settings-panel h2 { margin-top: 0; font-size: 1.05rem; }
.secret-edit-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.secret-edit-row input { flex: 1; }
.editor-actions {
  display: flex; gap: 12px; align-items: center; margin: 18px 0;
  position: sticky; bottom: 12px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 16px;
}
.error-text { color: var(--danger); }
.secret-block-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-2-soft); border: 1px dashed var(--accent-2); color: var(--accent-2); border-radius: 8px; padding: 6px 12px; font-weight: 600; }
.secret-block-chip select { border: none; background: transparent; color: inherit; font-weight: 600; padding: 0; }

/* EditorJS под бренд */
/* контент во всю ширину холдера (по умолчанию узкая центрированная колонка) */
.editorjs-holder { padding-left: 56px; padding-right: 24px; }
.editorjs-holder .ce-block__content,
.editorjs-holder .ce-toolbar__content { max-width: none; margin: 0; }
.editorjs-holder .ce-toolbar__actions { left: -48px; right: auto; }
.editorjs-holder .ce-toolbar__plus, .editorjs-holder .ce-toolbar__settings-btn { color: var(--muted); background: var(--surface); border-radius: 6px; width: 28px; height: 28px; }
.editorjs-holder .ce-toolbar__plus:hover, .editorjs-holder .ce-toolbar__settings-btn:hover { background: var(--accent-soft); color: var(--accent); }
.editorjs-holder .ce-popover {
  --color-background: var(--surface);
  --color-border: var(--border);
  --color-text-primary: var(--text);
  --color-text-secondary: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); border-radius: var(--radius);
}
.editorjs-holder .ce-popover__container { max-height: 380px; }
.editorjs-holder .ce-popover-item { color: var(--text); border-radius: 8px; padding: 5px 8px; }
.editorjs-holder .ce-popover-item:hover:not(.ce-popover-item--disabled) { background: var(--accent-soft); }
.editorjs-holder .ce-popover-item__icon { background: var(--surface-2); border-radius: 8px; color: var(--accent); box-shadow: none; border: none; }
.editorjs-holder .ce-popover-item__title { font-size: 0.92rem; font-weight: 500; }
.editorjs-holder .cdx-search-field { background: var(--surface-2); border-radius: 8px; border: none; }
.editorjs-holder .cdx-search-field__input { color: var(--text); font-family: inherit; }
.editorjs-holder .ce-inline-toolbar, .editorjs-holder .ce-conversion-toolbar { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); border-radius: 8px; color: var(--text); }
.editorjs-holder .ce-inline-tool:hover, .editorjs-holder .ce-conversion-tool:hover { background: var(--surface-2); }
.editorjs-holder .ce-block--selected .ce-block__content { background: var(--accent-soft); border-radius: 6px; }
.editorjs-holder ::selection { background: var(--accent-soft); }
.editorjs-holder .cdx-block { color: var(--text); }
.editorjs-holder .ce-paragraph[data-placeholder]:empty::before { color: var(--muted); }
@media (max-width: 700px) {
  .editorjs-holder { padding-left: 44px; padding-right: 12px; }
  .editorjs-holder .ce-toolbar__actions { left: -38px; }
}

/* --- Вопросы теста --- */
.quiz-progress { margin: 6px 0 4px; }
.quiz-bar { height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.quiz-bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.25s; }
.quiz-nav { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.question { border: 1px solid var(--border); border-radius: var(--radius); margin: 14px 0; padding: 14px 18px; background: var(--surface); }
.question legend { font-weight: 700; padding: 0 6px; }
.option { display: block; padding: 5px 0; cursor: pointer; font-weight: 400; }
.test-q { border: 1px solid var(--border); border-radius: var(--radius); margin: 10px 0; padding: 12px 14px; background: var(--surface-2); }
.test-q textarea { width: 100%; }
.test-opt { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.test-opt input[type="text"] { flex: 1; }
.test-settings { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.test-settings label { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; }

/* --- Справка --- */
.help-tip { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 0.72rem; font-weight: 700; cursor: help; border: 1px solid var(--border); vertical-align: 2px; text-decoration: none; }
.help-tip:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.help-page h2 { margin-top: 1.6em; }

/* --- Прочее --- */
.backup-codes { columns: 2; list-style: none; padding: 0; }
.backup-codes code { font-size: 1.05rem; }
.history ul { list-style: none; padding: 0; }
.history li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.history li:last-child { border-bottom: none; }

/* --- Оргсхема --- */
.orgchart { padding: 8px 0 40px; }
.org-children { margin: 0 0 0 28px; padding-left: 24px; border-left: 2px solid var(--border); list-style: none; }
.org-children.org-root { margin-left: 0; padding-left: 0; border-left: none; }
.org-item { position: relative; margin: 12px 0; }
.org-children:not(.org-root) > .org-item::before {
  content: ""; position: absolute; top: 24px; left: -24px; width: 20px; height: 2px;
  background: var(--border);
}
.org-node {
  display: inline-block; min-width: 320px; max-width: 560px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 14px; cursor: pointer; transition: border-color 0.12s;
}
.org-node:hover { border-color: var(--accent); }
.org-node--mine { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.org-node.dragging { opacity: 0.5; }
.org-node.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }
.org-node.drop-forbidden { outline: 2px dashed var(--danger); outline-offset: 2px; cursor: not-allowed; }
.org-title-row { display: flex; align-items: center; gap: 8px; }
.org-toggle { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 0.9rem; padding: 0 2px; }
.org-toggle:hover { color: var(--accent); }
.org-name { font-weight: 700; color: var(--text); text-decoration: none; flex: 1; }
.org-name:hover { color: var(--accent); }
.org-menu-btn { background: none; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; color: var(--muted); padding: 0 8px; font-size: 1rem; line-height: 1.4; }
.org-menu-btn:hover { color: var(--accent); border-color: var(--accent); }
.org-ckp { color: var(--muted); font-size: 0.86rem; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.org-people { font-size: 0.84rem; margin-top: 4px; }
.org-people.head { font-weight: 600; }
.org-menu { z-index: 80; min-width: 220px; }
.org-menu .danger { color: var(--danger); }
.org-dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); padding: 20px 24px; min-width: 340px; }
.org-dialog::backdrop { background: rgba(0, 20, 52, 0.45); }
.org-dialog h2 { margin-top: 0; font-size: 1.05rem; }
.org-dialog input, .org-dialog select { width: 100%; margin: 8px 0; }

/* --- Страница отдела --- */
.ckp-box { background: var(--accent-2-soft); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.person { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.avatar-muted { background: var(--muted); }
.duties-details { margin: 10px 0; }
.duties-details summary { cursor: pointer; font-weight: 600; color: var(--accent); }

/* --- Адаптивность --- */
@media (max-width: 860px) {
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .topbar-top { padding-top: 8px; padding-bottom: 6px; }
  .nav a { padding: 9px 10px; font-size: 0.88rem; }
  .user-menu span.user-name { display: none; }
  .content { margin: 16px auto; padding: 0 12px; }
  .policy-card { padding: 16px 18px; }
  .secret-label { min-width: 120px; }
  .review-row { flex-direction: column; }
  .reject-form { min-width: 0; }
}
