/* Проблематика ВК — interface styles.
   Two sides, two inks: CC7 (stamp violet) raises a problem, PESCO / IPMT (teal) answers it.
   Document numbers are set in a monospace face because they are compared character by character. */

@font-face {
  font-family: "Golos";
  src: url("fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos";
  src: url("fonts/golos-text-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Doc Mono";
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Doc Mono";
  src: url("fonts/jetbrains-mono-cyrillic-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Doc Mono";
  src: url("fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Doc Mono";
  src: url("fonts/jetbrains-mono-cyrillic-500-normal.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

:root {
  color-scheme: light;
  --paper: #eef0f4;
  --sheet: #ffffff;
  --sheet-2: #f7f8fa;
  --sheet-3: #f1f3f6;
  --ink: #161a22;
  --ink-2: #545c6c;
  --ink-3: #848b9a;
  --rule: #d9dde5;
  --rule-2: #e8ebf0;
  --stamp: #5b3e9e;
  --stamp-strong: #48307f;
  --stamp-tint: #f0ebf9;
  --stamp-line: #cdbfe9;
  --pesco: #0b6a64;
  --pesco-strong: #08534e;
  --pesco-tint: #e1f2ef;
  --pesco-line: #a9d7d0;
  --mto: #1f5fa6;
  --mto-strong: #184c86;
  --mto-tint: #e5eef9;
  --mto-line: #b3cbec;
  --amber: #8f5208;
  --amber-tint: #fdf0d8;
  --green: #1f7046;
  --green-tint: #e2f3e8;
  --olive: #6f600c;
  --olive-tint: #f4efd2;
  --grey: #626a7b;
  --grey-tint: #eceef2;
  --danger: #b3261e;
  --danger-tint: #fbe9e7;
  --row-hover: #f6f4fb;
  --row-active: #efeaf9;
  --overlay: rgba(22, 20, 40, 0.32);
  --shadow-pop: 0 10px 30px rgba(24, 22, 48, 0.16), 0 2px 6px rgba(24, 22, 48, 0.08);
  --shadow-drawer: -18px 0 50px rgba(24, 22, 48, 0.18);
  --font: "Golos", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Doc Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 6px;
  --header-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #15171d;
    --sheet: #1c1f27;
    --sheet-2: #20242d;
    --sheet-3: #252a34;
    --ink: #e8eaf0;
    --ink-2: #a8afbd;
    --ink-3: #7d8494;
    --rule: #333946;
    --rule-2: #2a2f3a;
    --stamp: #a891e6;
    --stamp-strong: #c2b2f0;
    --stamp-tint: #2b2541;
    --stamp-line: #4d4176;
    --pesco: #5cc2b6;
    --pesco-strong: #86d6cc;
    --pesco-tint: #18332f;
    --pesco-line: #2c5a54;
    --mto: #7eb0ef;
    --mto-strong: #a5c8f4;
    --mto-tint: #1a2a40;
    --mto-line: #33507a;
    --amber: #f0b45e;
    --amber-tint: #3a2b14;
    --green: #74cf98;
    --green-tint: #183424;
    --olive: #d8c867;
    --olive-tint: #33301a;
    --grey: #a3aaba;
    --grey-tint: #2a2e38;
    --danger: #ff8a80;
    --danger-tint: #3b1f1d;
    --row-hover: #232633;
    --row-active: #2a2540;
    --overlay: rgba(0, 0, 0, 0.5);
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-drawer: -18px 0 50px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15171d;
  --sheet: #1c1f27;
  --sheet-2: #20242d;
  --sheet-3: #252a34;
  --ink: #e8eaf0;
  --ink-2: #a8afbd;
  --ink-3: #7d8494;
  --rule: #333946;
  --rule-2: #2a2f3a;
  --stamp: #a891e6;
  --stamp-strong: #c2b2f0;
  --stamp-tint: #2b2541;
  --stamp-line: #4d4176;
  --pesco: #5cc2b6;
  --pesco-strong: #86d6cc;
  --pesco-tint: #18332f;
  --pesco-line: #2c5a54;
  --mto: #7eb0ef;
  --mto-strong: #a5c8f4;
  --mto-tint: #1a2a40;
  --mto-line: #33507a;
  --amber: #f0b45e;
  --amber-tint: #3a2b14;
  --green: #74cf98;
  --green-tint: #183424;
  --olive: #d8c867;
  --olive-tint: #33301a;
  --grey: #a3aaba;
  --grey-tint: #2a2e38;
  --danger: #ff8a80;
  --danger-tint: #3b1f1d;
  --row-hover: #232633;
  --row-active: #2a2540;
  --overlay: rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-drawer: -18px 0 50px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--stamp); }
:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 0.93em; letter-spacing: -0.01em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--sheet); color: var(--ink);
  font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--stamp); border-color: var(--stamp); color: #fff; }
.btn.primary:hover { background: var(--stamp-strong); border-color: var(--stamp-strong); }
:root[data-theme="dark"] .btn.primary { color: #17131f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #17131f; } }
.btn.pesco { background: var(--pesco); border-color: var(--pesco); color: #fff; }
.btn.pesco:hover { background: var(--pesco-strong); }
.btn.mto { background: var(--mto); border-color: var(--mto); color: #fff; }
.btn.mto:hover { background: var(--mto-strong); }
:root[data-theme="dark"] .btn.mto { color: #0e1622; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.mto { color: #0e1622; } }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sheet-3); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-tint); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; }
.btn.icon.sm { width: 28px; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: rgba(255, 255, 255, 0.9) transparent rgba(255, 255, 255, 0.9) transparent;
  animation: spin 0.7s linear infinite;
}
.btn:not(.primary):not(.pesco):not(.mto).busy::after { border-color: var(--ink-2) transparent var(--ink-2) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.lbl-hint { font-weight: 400; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; min-width: 0; height: 36px; padding: 0 11px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea { height: auto; min-height: 92px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-tint);
}
.input[readonly] { background: var(--sheet-2); color: var(--ink-2); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.select { padding-right: 30px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
.field.invalid .input, .field.invalid .textarea, .field.invalid .select { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--stamp); margin: 0; flex: none; }
.check-block { align-items: flex-start; line-height: 1.4; }
.check-block input { margin-top: 2px; }

/* ---------- app shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 22px;
  padding: 0 20px;
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-name { font-weight: 650; font-size: 15px; line-height: 1.15; white-space: nowrap; }
.nav { display: flex; gap: 2px; height: 100%; }
.nav a {
  display: flex; align-items: center; padding: 0 12px; height: 100%;
  color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--ink); border-bottom-color: var(--stamp); }
.topbar .spacer { flex: 1; }
/* a header that does not fit (fitTopbar): closer tabs, then no name by the avatar, then the tabs in the menu */
.topbar.fit-tight { gap: 14px; }
.topbar.fit-tight .nav a { padding: 0 9px; }
.topbar.fit-name .userbtn .who { display: none; }
.topbar.fit-tabs .nav { display: none; }
.userbtn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px;
  border: 1px solid transparent; background: none; cursor: pointer; }
.userbtn:hover { background: var(--sheet-3); }
.userbtn .who { text-align: left; line-height: 1.2; }
.userbtn .who b { display: block; font-weight: 600; font-size: 13px; }
.userbtn .who small { color: var(--ink-2); font-size: 12px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--grey);
}
.avatar.cc7 { background: var(--stamp); }
.avatar.pesco { background: var(--pesco); }
.avatar.mto { background: var(--mto); }
:root[data-theme="dark"] .avatar { color: #121418; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { color: #121418; } }

.org {
  display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; vertical-align: 1px;
  background: var(--grey-tint); color: var(--grey);
}
.org.cc7 { background: var(--stamp-tint); color: var(--stamp); }
.org.pesco { background: var(--pesco-tint); color: var(--pesco); }
.org.mto { background: var(--mto-tint); color: var(--mto); white-space: nowrap; }

.menu {
  position: absolute; z-index: 60; min-width: 230px; padding: 6px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow-pop);
}
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 5px;
  background: none; text-align: left; cursor: pointer; color: var(--ink); text-decoration: none;
}
.menu button:hover, .menu a:hover { background: var(--sheet-3); }
.menu hr { border: 0; border-top: 1px solid var(--rule-2); margin: 6px 0; }
.menu .menu-note { padding: 6px 10px 8px; font-size: 12.5px; color: var(--ink-2); }
.menu-period { width: 300px; }
.period { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 0 8px 8px; }
.period .input { height: 32px; padding: 0 6px; font-size: 13px; }
.period-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 2px 4px 4px; }
.menu .period-actions .btn { width: auto; display: inline-flex; justify-content: center; padding: 0 12px; border: 1px solid var(--rule); }
.menu .period-actions .btn.primary { background: var(--stamp); border-color: var(--stamp); }
.menu .period-actions .btn.primary:hover { background: var(--stamp-strong); }

main.page { padding: 18px 20px 40px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head .grow { flex: 1; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }

/* ---------- register ---------- */
.register { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.views-row { display: flex; align-items: center; gap: 12px; padding-right: 12px; border-bottom: 1px solid var(--rule); }
.views-row > .btn { flex: none; }
.views { flex: 1; min-width: 0; display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.views button {
  display: flex; align-items: baseline; gap: 8px; padding: 13px 10px 11px; border: 0; background: none;
  color: var(--ink-2); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.views button:hover { color: var(--ink); }
.views button.on { color: var(--ink); border-bottom-color: var(--stamp); }
.views .n { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.views button.on .n { color: var(--stamp); }
.views .dot { width: 7px; height: 7px; border-radius: 50%; align-self: center; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.search { position: relative; display: block; flex: 1 1 280px; max-width: 460px; }
.toolbar .search { flex-basis: 176px; min-width: 176px; }
.search .input { padding-left: 34px; }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--ink-3); }
.search kbd { position: absolute; right: 9px; top: 8px; }
kbd {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 4px;
  border: 1px solid var(--rule); background: var(--sheet-2); color: var(--ink-3); font: 500 11px var(--font);
}
.toolbar .select, .toolbar .input.date { width: auto; height: 34px; }
.toolbar .select { max-width: 220px; }
.toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: var(--r);
  border: 1px solid var(--rule); background: var(--sheet); cursor: pointer; font-weight: 500; color: var(--ink-2);
}
.toggle[aria-pressed="true"] { border-color: var(--stamp-line); background: var(--stamp-tint); color: var(--stamp); }
.toolbar .grow { flex: 1; }
.filters-note { padding: 8px 14px; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--rule-2); background: var(--sheet-2); }
.filters-note button { border: 0; background: none; color: var(--stamp); cursor: pointer; padding: 0; font-weight: 500; }

.table-wrap { overflow: auto; max-height: calc(100vh - var(--header-h) - 190px); min-height: 240px; }
table.grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; min-width: 100%; }
.grid th, .grid td { padding: 9px 12px; border-bottom: 1px solid var(--rule-2); text-align: left; vertical-align: top; }
.grid th {
  position: sticky; top: 0; z-index: 2; background: var(--sheet-2); font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); white-space: nowrap; border-bottom: 1px solid var(--rule); padding-top: 10px; padding-bottom: 10px;
  user-select: none;
}
.grid th.sortable { cursor: pointer; }
.grid th.sortable:hover { color: var(--ink); }
.grid th .arrow { color: var(--stamp); margin-left: 4px; }
.grid th:nth-child(1), .grid td:nth-child(1) { position: sticky; left: 0; z-index: 1; }
.grid th:nth-child(2), .grid td:nth-child(2) { position: sticky; left: 96px; z-index: 1; }
.grid th:nth-child(3), .grid td:nth-child(3) { position: sticky; left: 228px; z-index: 1; box-shadow: 1px 0 0 var(--rule-2); }
.grid th:nth-child(-n+3) { z-index: 3; }
.grid td:nth-child(-n+3) { background: var(--sheet); }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--row-hover); }
.grid tbody tr.active td { background: var(--row-active); }
.grid td { font-size: 13.5px; }
.cell-id { color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.cell-id .unread { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--stamp); margin-right: 6px; vertical-align: 1px; }
.cell-doc { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; line-height: 1.4; }
.cell-doc.lead { font-weight: 500; color: var(--ink); }
.cell-doc .more { font-family: var(--font); color: var(--ink-3); font-size: 12px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp3 { -webkit-line-clamp: 3; }
.cell-date { white-space: nowrap; color: var(--ink-2); }
.cell-chat { white-space: nowrap; color: var(--ink-3); }
.cell-chat.has { color: var(--ink-2); }
.cell-chat.new { color: var(--stamp); font-weight: 600; }
.ns { display: inline-block; margin-top: 3px; font: 500 11.5px var(--font); color: var(--olive); }
.empty { padding: 56px 24px; text-align: center; color: var(--ink-2); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; font-weight: 600; }
.loadmore { padding: 14px; text-align: center; border-top: 1px solid var(--rule-2); }
.list-foot { display: flex; justify-content: space-between; align-items: center; padding: 9px 14px; font-size: 12.5px;
  color: var(--ink-3); border-top: 1px solid var(--rule-2); }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 7px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--grey-tint); color: var(--grey);
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.requested { background: var(--amber-tint); color: var(--amber); }
.chip.resolved, .chip.done { background: var(--green-tint); color: var(--green); }
.chip.partial { background: var(--olive-tint); color: var(--olive); }
.chip.cancelled { background: var(--grey-tint); color: var(--grey); }
.chip.in_work { background: var(--pesco-tint); color: var(--pesco); }
.register-mto .chip.in_work, .drawer.mto .chip.in_work, .chip.in_work.mto { background: var(--mto-tint); color: var(--mto); }
.chip.none { background: transparent; color: var(--ink-3); padding-left: 0; }
.chip.none::before { display: none; }

/* cards for narrow screens */
.cards { display: none; }
.card {
  display: block; width: 100%; text-align: left; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--rule-2);
  background: var(--sheet); cursor: pointer;
}
.card:hover { background: var(--row-hover); }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card .doc { font-family: var(--mono); font-size: 13px; font-weight: 500; word-break: break-all; }
.card .sup { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.card .prob { margin: 6px 0 8px; font-size: 13.5px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12.5px; color: var(--ink-2); }

/* ---------- drawer ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; background: var(--overlay); animation: fade 0.16s ease-out; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(1120px, 94vw); background: var(--paper); box-shadow: var(--shadow-drawer);
  display: flex; flex-direction: column; animation: slidein 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slidein { from { transform: translateX(28px); opacity: 0.4; } }
.d-head {
  display: flex; gap: 18px; align-items: flex-start; padding: 16px 20px 16px 24px;
  background: var(--sheet); border-bottom: 1px solid var(--rule);
}
.d-title { flex: 1; min-width: 0; }
.d-num { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.d-avk { margin: 5px 0 3px; font: 500 21px/1.3 var(--mono); letter-spacing: -0.02em; word-break: break-all; }
.d-avk.none { font-family: var(--font); font-weight: 600; letter-spacing: -0.01em; color: var(--ink-2); }
.d-sup { color: var(--ink-2); font-size: 14px; }
.d-actions { display: flex; gap: 6px; align-items: center; }
.d-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr); }
.d-main { overflow-y: auto; padding: 18px 20px 28px 24px; }
.d-side { min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--rule); background: var(--sheet); }

/* the status stamp: the one loud element */
.stamp {
  position: relative; flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 150px; padding: 7px 14px 6px; margin: 2px 4px 0 0;
  border: 2.5px solid currentColor; border-radius: 9px; color: var(--amber);
  text-align: center; line-height: 1.15;
}
.stamp::after { content: ""; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 6px; opacity: 0.6; }
.stamp b { font-size: 15px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.stamp small { margin-top: 2px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.stamp.requested { color: var(--amber); }
.stamp.resolved { color: var(--green); }
.stamp.partial { color: var(--olive); }
.stamp.cancelled { color: var(--grey); }
.stamp.press { animation: press 0.42s cubic-bezier(0.25, 0.9, 0.3, 1.25); }
@keyframes press {
  0% { transform: scale(1.4); opacity: 0; }
  55% { transform: scale(0.96); opacity: 1; }
  100% { transform: scale(1); }
}

.side-block { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; margin-bottom: 16px; }
.side-block > header {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px 11px 16px; border-bottom: 1px solid var(--rule-2);
}
.side-block > header h2 { margin: 0; font-size: 14.5px; font-weight: 650; flex: 1; }
.side-block > header .who { font-size: 12.5px; color: var(--ink-2); }
.side-block.cc7 { border-left: 3px solid var(--stamp); }
.side-block.pesco { border-left: 3px solid var(--pesco); }
.side-block.mto { border-left: 3px solid var(--mto); }
.side-block .inner { padding: 14px 16px 16px; display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.kv .wide { grid-column: 1 / -1; }
.kv dt { font-size: 12.5px; color: var(--ink-2); margin-bottom: 3px; }
.kv dd { margin: 0; min-width: 0; }
.doc-val { display: flex; align-items: flex-start; gap: 6px; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.doc-val .copy { margin-top: -4px; opacity: 0; }
.doc-val.plain { font-family: var(--font); font-size: 14px; word-break: normal; overflow-wrap: anywhere; }
.doc-val:hover .copy, .doc-val .copy:focus-visible { opacity: 1; }
.text-val { white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.text-val.collapsed { max-height: 10.9em; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent); mask-image: linear-gradient(to bottom, #000 62%, transparent); }
.more-btn { margin: 4px 0 0 -10px; color: var(--stamp); }
.d-avk .btn { vertical-align: 2px; opacity: 0.55; }
.d-avk .btn:hover, .d-avk .btn:focus-visible { opacity: 1; }
.text-val.empty-val, .empty-val { color: var(--ink-3); }
.ref-extra { margin-top: 4px; font-size: 12px; color: var(--ink-3); white-space: pre-wrap; font-family: var(--mono); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 2px; }
.hint { font-size: 12.5px; color: var(--ink-2); }
.hint.pesco-hint { color: var(--pesco); }
.lock-note { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-3); }

.seg { display: inline-flex; justify-self: start; max-width: 100%; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--sheet); }
.seg button { height: 34px; padding: 0 14px; border: 0; border-right: 1px solid var(--rule); background: none; cursor: pointer;
  font-weight: 500; color: var(--ink-2); }
.seg button:last-child { border-right: 0; }
.seg button:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--sheet-3); color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--pesco); color: #fff; }
.seg button[aria-pressed="true"][data-v="done"] { background: var(--green); }
.drawer.mto .seg button[aria-pressed="true"]:not([data-v="done"]) { background: var(--mto); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { color: #10151a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button[aria-pressed="true"] { color: #10151a; } }
.seg button:disabled { cursor: default; }

/* AVK autocomplete */
.ac { position: relative; }
.ac-list {
  position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px); max-height: 330px; overflow-y: auto;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 4px;
}
.ac-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 5px; background: none; cursor: pointer; }
.ac-item[aria-selected="true"], .ac-item:hover { background: var(--stamp-tint); }
.ac-item .a { font-family: var(--mono); font-size: 13px; font-weight: 500; word-break: break-all; }
.ac-item .b { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.ac-item .used { color: var(--danger); font-weight: 500; }
.ac-empty { padding: 10px; color: var(--ink-2); font-size: 13px; }
.ref-box { border: 1px dashed var(--stamp-line); border-radius: 8px; padding: 12px 14px; background: var(--stamp-tint); }
.ref-box.manual { border-color: var(--rule); background: var(--sheet-2); }
.ref-box .kv dt { color: var(--stamp); }
.ref-box.manual .kv dt { color: var(--ink-2); }
.ref-state { font-size: 12.5px; color: var(--stamp); margin-bottom: 10px; display: flex; gap: 6px; align-items: center; }
.ref-box.manual .ref-state { color: var(--ink-2); }
/* 1.8.0: the MTO list */
.ref-box.rd-box { margin-top: 8px; border-color: var(--mto-line); background: var(--mto-tint); }
.ref-box.rd-box .kv dt { color: var(--mto); }
.ref-box.rd-box .hint { margin-top: 6px; }
.ref-box[hidden] { display: none; }
.rd-hint { font-size: 12px; margin-top: 2px; }
.list-chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 9px; vertical-align: 2px;
  background: var(--mto-tint); color: var(--mto); letter-spacing: 0; }
/* the switch between the lists stays under the header while the page scrolls */
.ref-tabs { padding: 6px 0 0; margin: -6px 0 14px; position: sticky; top: var(--header-h); z-index: 20; background: var(--paper); }
.ref-tabs button[aria-selected="true"] { border-bottom-color: var(--mto); }
.ref-tabs button[data-ref-tab="pesco"][aria-selected="true"] { border-bottom-color: var(--stamp); }
.sup-add { flex-wrap: wrap; }
.sup-add .input, .sup-add .select { max-width: 360px; flex: 1 1 240px; }
.sup-tools { padding-bottom: 0; }
.sup-tools .search { max-width: 420px; }
.matrix tr.matrix-group th { text-align: left; font-weight: 650; padding-top: 14px; background: var(--sheet-2); }

/* chat */
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--rule-2); }
.chat-head h2 { margin: 0; font-size: 14.5px; font-weight: 650; flex: 1; }
.chat-head .check { font-size: 12.5px; color: var(--ink-2); }
.timeline { flex: 1; overflow-y: auto; padding: 14px 16px 8px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.msg-head b { font-weight: 600; font-size: 13.5px; }
.msg-head time { font-size: 12px; color: var(--ink-3); }
.msg-body { margin-top: 3px; padding: 8px 11px; border-radius: 3px 10px 10px 10px; background: var(--sheet-3);
  white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.msg.cc7 .msg-body { background: var(--stamp-tint); }
.msg.pesco .msg-body { background: var(--pesco-tint); }
.msg.mto .msg-body { background: var(--mto-tint); }
.msg.mine .msg-body { box-shadow: inset 0 0 0 1px var(--rule); }
.ev { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.ev .ev-ico { display: grid; place-items: center; width: 30px; height: 22px; color: var(--ink-3); }
.ev .ev-text b { color: var(--ink); font-weight: 600; }
.ev time { color: var(--ink-3); margin-left: 6px; }
.ev details { margin-top: 3px; }
.ev summary { cursor: pointer; color: var(--stamp); width: max-content; }
.ev .diff { margin: 6px 0 0; display: grid; gap: 6px; }
.ev .diff div { padding: 6px 8px; border-radius: 5px; background: var(--sheet-2); white-space: pre-wrap; word-break: break-word; }
.ev .diff del { color: var(--ink-3); }
.ev .diff ins { text-decoration: none; color: var(--ink); }
.day-sep { align-self: center; font-size: 12px; color: var(--ink-3); padding: 2px 10px; border-radius: 999px; background: var(--sheet-2); }
.new-sep { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--stamp); font-weight: 600; }
.new-sep::before, .new-sep::after { content: ""; flex: 1; border-top: 1px solid var(--stamp-line); }
.composer { border-top: 1px solid var(--rule); padding: 10px 12px 12px; display: grid; gap: 8px; background: var(--sheet); }
.composer textarea { min-height: 44px; max-height: 220px; resize: none; }
.composer-row { display: flex; align-items: center; gap: 10px; }
.composer-row .hint { flex: 1; font-size: 12px; color: var(--ink-3); }

/* ---------- dialogs ---------- */
.dialog-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: var(--overlay);
  animation: fade 0.14s ease-out; }
.dialog { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--sheet); border-radius: 10px;
  box-shadow: var(--shadow-pop); border: 1px solid var(--rule); }
.dialog.wide { width: min(640px, 100%); }
.dialog > header { padding: 18px 20px 6px; }
.dialog > header h2 { margin: 0; font-size: 17px; font-weight: 650; }
.dialog > header p { margin: 6px 0 0; color: var(--ink-2); }
.dialog .body { padding: 12px 20px; display: grid; gap: 14px; }
.dialog > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.secret { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 6px; background: var(--sheet-2);
  border: 1px dashed var(--rule); font: 500 16px var(--mono); letter-spacing: 0.04em; }
.secret span { flex: 1; user-select: all; }
.choice { display: grid; gap: 8px; }
.choice label { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 7px; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--stamp-line); background: var(--stamp-tint); }
.choice input { accent-color: var(--stamp); margin-top: 3px; }
.choice b { display: block; font-weight: 600; }
.choice small { color: var(--ink-2); }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 20px; bottom: 20px; z-index: 90; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 8px; background: var(--ink); color: var(--sheet);
  box-shadow: var(--shadow-pop); animation: toastin 0.18s ease-out; font-size: 13.5px; }
.toast.error { background: var(--danger); color: #fff; }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
.login-art { position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--sheet); border-right: 1px solid var(--rule); }
.login-art h1 { margin: 0; max-width: 620px; font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -0.025em; font-weight: 700; }
.login-art p { max-width: 520px; color: var(--ink-2); font-size: 15px; line-height: 1.55; margin: 18px 0 0; }
.login-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); gap: 18px; margin-top: 34px; }
.login-sides div { padding-left: 12px; border-left: 3px solid var(--stamp); }
.login-sides div + div { border-left-color: var(--pesco); }
.login-sides b { display: block; font-size: 14px; }
.login-sides span { font-size: 13px; color: var(--ink-2); }
.login-form { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 40px; }
.login-tools { position: absolute; top: 16px; right: 16px; }
.theme-btn { color: var(--ink-2); }
.topbar .theme-btn { margin-right: -10px; }
.login-form form { display: grid; gap: 16px; width: 100%; max-width: 340px; margin: 0 auto; }
.login-form h2 { margin: 0 0 4px; font-size: 20px; font-weight: 650; }
.login-form .btn { height: 40px; }
.login-foot { margin-top: 26px; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.form-error { padding: 10px 12px; border-radius: 6px; background: var(--danger-tint); color: var(--danger); font-size: 13px; }

/* ---------- admin pages ---------- */
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; }
.panel + .panel { margin-top: 16px; }
.panel > header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--rule-2); flex-wrap: wrap; }
.panel > header h2 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.panel .inner { padding: 16px; }
.stats { display: flex; flex-wrap: wrap; gap: 28px; }
.stat b { display: block; font-size: 24px; font-weight: 650; letter-spacing: -0.01em; }
.stat span { font-size: 12.5px; color: var(--ink-2); }
table.plain { width: 100%; border-collapse: collapse; }
.plain th, .plain td { padding: 9px 14px; border-bottom: 1px solid var(--rule-2); text-align: left; vertical-align: top; font-size: 13.5px; }
.plain th { font-size: 12.5px; color: var(--ink-2); font-weight: 600; background: var(--sheet-2); white-space: nowrap; }
.plain tr.off td { color: var(--ink-3); }
.plain td.actions { white-space: nowrap; text-align: right; }
.status-line { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 7px; background: var(--sheet-2); }
.status-line.ok { background: var(--green-tint); color: var(--green); }
.status-line.bad { background: var(--danger-tint); color: var(--danger); }
.status-line div { color: var(--ink); }
.upload { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.matrix td, .matrix th { font-size: 13px; }
.matrix td:not(:first-child), .matrix th:not(:first-child) { text-align: center; }
.yes { color: var(--green); font-weight: 600; }
.no { color: var(--ink-3); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .d-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .d-main { overflow: visible; }
  .d-side { border-left: 0; border-top: 1px solid var(--rule); min-height: 520px; }
}
@media (max-width: 900px) {
  .topbar { gap: 12px; padding: 0 12px; }
  .nav { display: none; }
  .userbtn .who { display: none; }
  main.page { padding: 12px 12px 32px; }
  .table-wrap { display: none; }
  .cards { display: block; }
  .views-row { flex-wrap: wrap; padding: 0 0 10px; }
  .views-row > .btn { margin-left: 12px; }
  .views { flex-basis: 100%; }
  .toolbar .adv { display: none; }
  .toolbar.expanded .adv { display: inline-flex; }
  .toolbar.expanded .select.adv { display: block; }
  .search { flex-basis: 100%; max-width: none; }
  .drawer { width: 100vw; }
  .d-head { position: relative; padding: 12px 12px 14px 16px; flex-wrap: wrap; gap: 10px; }
  .d-title { flex: 1 1 100%; padding-right: 84px; }
  .d-avk { font-size: 16px; }
  .d-actions { position: absolute; top: 8px; right: 8px; }
  .d-main { padding: 14px 12px 20px; }
  .stamp { min-width: 0; padding: 5px 12px 4px; margin-left: 2px; }
  .stamp b { font-size: 13px; }
  .side-block > header .who { display: none; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { padding: 28px 20px 24px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .login-sides { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 20px; }
  .login-form { padding: 28px 20px; }
  .toolbar .select { max-width: none; flex: 1 1 140px; }
  .plain { display: block; overflow-x: auto; }
}
@media (min-width: 901px) {
  .mobile-only { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- combobox: type to narrow a long list ---------- */
.combo { position: relative; min-width: 0; }
.combo .combo-input { padding-right: 56px; text-overflow: ellipsis; }
.combo-chev { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.combo-clear { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 4px; background: none; color: var(--ink-3); cursor: pointer; }
.combo-clear:hover { background: var(--sheet-3); color: var(--ink); }
.combo-clear .i { width: 14px; height: 14px; }
.combo .ac-list { min-width: 100%; width: max-content; max-width: min(420px, 92vw); max-height: 300px; }
.combo-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-item.current { font-weight: 600; }
.combo-item .i { color: var(--stamp); }
.toolbar .combo-filter { width: 178px; flex: 0 1 178px; }
.toolbar .combo-filter .combo-input { height: 34px; }
.toolbar .combo-filter.has-value .combo-input { border-color: var(--stamp-line); background: var(--stamp-tint); color: var(--stamp); font-weight: 500; }

/* ---------- attachments ---------- */
.files-block { border-left: 3px solid var(--rule); }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.file { display: flex; align-items: center; gap: 10px; padding: 7px 6px 7px 4px; border-radius: 6px; }
.file:hover { background: var(--sheet-2); }
.file-main { flex: 1; min-width: 0; }
.file-name { display: block; font-weight: 500; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.file-name:hover { color: var(--stamp); text-decoration: underline; }
.file-meta { font-size: 12.5px; color: var(--ink-2); }
.ext { flex: none; display: inline-grid; place-items: center; width: 38px; height: 26px; border-radius: 5px; font: 700 10.5px var(--font);
  text-transform: uppercase; letter-spacing: 0.02em; background: var(--grey-tint); color: var(--grey); }
.ext-pdf { background: var(--danger-tint); color: var(--danger); }
.ext-img { background: var(--pesco-tint); color: var(--pesco); }
.ext-xls { background: var(--green-tint); color: var(--green); }
.ext-doc { background: var(--stamp-tint); color: var(--stamp); }
.ext-zip, .ext-cad { background: var(--olive-tint); color: var(--olive); }
.ext-mail { background: var(--amber-tint); color: var(--amber); }
.dropzone { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1.5px dashed var(--rule); border-radius: 8px;
  color: var(--ink-2); background: var(--sheet-2); }
.dropzone .i { width: 20px; height: 20px; color: var(--ink-3); }
.dropzone b { color: var(--ink); font-weight: 600; }
.dropzone small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.linkbtn { border: 0; padding: 0; background: none; color: var(--stamp); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.upload-progress { display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.up-line { display: flex; justify-content: space-between; gap: 10px; }
.up-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-line b { color: var(--stamp); }
.bar { height: 4px; border-radius: 2px; background: var(--rule-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--stamp); transition: width 0.15s linear; }
.composer .upload-progress { padding: 0 2px; }
.composer-row .btn.icon { color: var(--ink-2); }
.msg-file { margin-top: 3px; display: inline-flex; align-items: center; gap: 9px; max-width: 100%; padding: 7px 11px 7px 8px;
  border-radius: 3px 10px 10px 10px; background: var(--sheet-3); border: 1px solid var(--rule-2); }
.msg.cc7 .msg-file { background: var(--stamp-tint); border-color: transparent; }
.msg.pesco .msg-file { background: var(--pesco-tint); border-color: transparent; }
.msg.mto .msg-file { background: var(--mto-tint); border-color: transparent; }
.msg-file a { font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file a:hover { color: var(--stamp); }
.msg-file.gone span:not(.faint):not(.ext) { text-decoration: line-through; color: var(--ink-3); }
.new-files:empty { display: none; }
.drop-overlay { display: none; }
.drawer.dragging .drop-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--paper) 82%, transparent); border: 3px dashed var(--stamp); border-radius: 10px; pointer-events: none; }
.drop-overlay > div { display: grid; justify-items: center; gap: 6px; color: var(--stamp); text-align: center; }
.drop-overlay .i { width: 36px; height: 36px; }
.drop-overlay b { font-size: 18px; }
.drop-overlay span { color: var(--ink-2); }
.cell-chat span { display: inline-flex; align-items: center; gap: 3px; margin-right: 8px; }
.cell-chat span:last-child { margin-right: 0; }
@media (max-width: 900px) {
  .toolbar.expanded .combo.adv { display: block; flex: 1 1 100%; width: auto; }
}

/* ---------- discipline ---------- */
.cell-disc { font-size: 13px; line-height: 1.35; color: var(--ink); hyphens: auto; overflow-wrap: anywhere; }
.card-disc { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 3px; }
.disc-chip { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--sheet-3); color: var(--ink-2); border: 1px solid var(--rule); }
.disc-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.disc-opt { position: relative; cursor: pointer; }
.disc-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.disc-opt span { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--sheet); color: var(--ink-2); font-weight: 500; transition: background-color 0.12s, border-color 0.12s, color 0.12s; }
.disc-opt:hover span { border-color: var(--ink-3); color: var(--ink); }
.disc-opt input:checked + span { background: var(--stamp); border-color: var(--stamp); color: #fff; }
:root[data-theme="dark"] .disc-opt input:checked + span { color: #17131f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .disc-opt input:checked + span { color: #17131f; } }
.disc-opt input:focus-visible + span { outline: 2px solid var(--stamp); outline-offset: 2px; }
.field.invalid .disc-opt span { border-color: var(--danger); }
.toolbar .combo-narrow { width: 182px; flex-basis: 182px; }
.disc-add { display: flex; gap: 8px; }
.disc-add .input { max-width: 420px; }
.i.flip { transform: rotate(180deg); }

/* ---------- deleted positions ---------- */
.views .view-admin { margin-left: auto; color: var(--ink-3); }
.views .view-admin .i { width: 14px; height: 14px; align-self: center; }
.views .view-admin.on { color: var(--danger); border-bottom-color: var(--danger); }
.views .view-admin.on .n { color: var(--danger); }
.deleted-banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin-bottom: 16px; border-radius: 8px;
  background: var(--danger-tint); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.deleted-banner > div { flex: 1; color: var(--ink); font-size: 13.5px; }
.deleted-banner b { display: block; color: var(--danger); }
.composer-off { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 13px; padding: 14px 16px; }

/* ---------- notifications: the bell, its panel, toasts ---------- */
.bell { position: relative; color: var(--ink-2); }
.bell.has { color: var(--stamp); }
.bell-n { position: absolute; top: 1px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--sheet); pointer-events: none; }
:root[data-theme="dark"] .bell-n { color: #1b0f0e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bell-n { color: #1b0f0e; } }
.bell-panel { position: absolute; z-index: 65; width: 400px; max-width: calc(100vw - 16px); display: flex; flex-direction: column;
  max-height: min(620px, calc(100vh - 80px)); background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: var(--shadow-pop); overflow: hidden; }
.bell-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px 16px; }
.bell-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 650; }
.bell-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--rule-2); }
.bell-tabs button { height: 34px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--ink-2); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.bell-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--stamp); }
.bell-tabs .n { font-size: 11.5px; font-weight: 700; color: #fff; background: var(--stamp); border-radius: 9px; padding: 0 6px; line-height: 17px; }
:root[data-theme="dark"] .bell-tabs .n { color: #17131f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bell-tabs .n { color: #17131f; } }
.bell-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.bell-empty { padding: 28px 22px; text-align: center; color: var(--ink-2); font-size: 13px; }
.bell-empty b { display: block; color: var(--ink); font-size: 14.5px; margin-bottom: 4px; }
.note { display: block; width: 100%; padding: 10px 16px 10px 26px; border: 0; background: none; text-align: left; cursor: pointer;
  position: relative; color: var(--ink); border-bottom: 1px solid var(--rule-2); }
.note:last-child { border-bottom: 0; }
.note:hover { background: var(--row-hover); }
.note.unread::before { content: ""; position: absolute; left: 11px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--stamp); }
.note.unread { background: var(--stamp-tint); }
.note.unread:hover { background: var(--row-active); }
.note-top { display: flex; align-items: baseline; gap: 10px; }
.note-title { flex: 1; min-width: 0; font: 600 12.5px var(--mono); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-top time { flex: none; font-size: 12px; color: var(--ink-3); }
.note-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-text { margin-top: 3px; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-text b { font-weight: 600; }
.note-more { margin-top: 3px; font-size: 12px; color: var(--ink-2); }
.note.gone .note-title { text-decoration: line-through; color: var(--ink-3); }
.bell-foot { padding: 10px 16px 12px; border-top: 1px solid var(--rule-2); font-size: 12.5px; color: var(--ink-2); background: var(--sheet-2); }
.bell-foot .check { align-items: flex-start; line-height: 1.35; }
.bell-foot .check input { margin-top: 1px; }
.toast.notice { width: min(420px, calc(100vw - 40px)); align-items: center; padding: 10px 10px 10px 14px; background: var(--sheet); color: var(--ink);
  border: 1px solid var(--stamp-line); border-left: 4px solid var(--stamp); }
.toast.notice > .i { color: var(--stamp); }
.toast .note-body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.toast .note-body b { font: 600 12.5px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast .note-body span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast-open { flex: none; height: 28px; padding: 0 10px; border: 1px solid var(--stamp-line); border-radius: 6px; background: var(--stamp-tint);
  color: var(--stamp); font-weight: 600; font-size: 12.5px; cursor: pointer; }
.toast-open:hover { border-color: var(--stamp); }
.toast-x { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 5px; background: none;
  color: var(--ink-3); cursor: pointer; }
.toast-x:hover { background: var(--sheet-3); color: var(--ink); }
.news-toggle .n { margin-left: 2px; font-size: 12px; font-weight: 700; }
.news-toggle.has:not([aria-pressed="true"]) { color: var(--stamp); border-color: var(--stamp-line); }
.news-toggle.has:not([aria-pressed="true"]) .n { background: var(--stamp); color: #fff; border-radius: 9px; padding: 0 6px; line-height: 17px; }
:root[data-theme="dark"] .news-toggle.has:not([aria-pressed="true"]) .n { color: #17131f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .news-toggle.has:not([aria-pressed="true"]) .n { color: #17131f; } }
.grid tr.has-news td.cell-id, .grid tr.has-news .cell-doc.lead { font-weight: 700; color: var(--ink); }
.card .doc .unread { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--stamp); margin-right: 6px; vertical-align: 2px; }
.follow { color: var(--ink-3); }
.follow.on { color: var(--stamp); }
.prev-login { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-3); }

/* ---------- security journal and service status ---------- */
.audit-filters { display: grid; gap: 12px; border-bottom: 1px solid var(--rule-2); }
.audit-cats { padding: 0; border-bottom: 0; flex-wrap: wrap; }
.audit-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field.inline { display: flex; align-items: center; gap: 6px; }
.field.inline .input { width: 160px; }
.audit-table td { font-size: 13px; }
.audit-table tr.bad td { color: var(--danger); }
.audit-table tr.bad td .faint { color: inherit; opacity: 0.75; }
.nowrap { white-space: nowrap; }
.stat b.warn { color: var(--danger); }
.status-kv { margin-top: 18px; }
#svc-status .status-line + .status-line, #svc-status .status-line + .stats { margin-top: 10px; }
#svc-status .stats { margin-top: 4px; }
#svc-status:not(:empty) { margin-bottom: 16px; }
@media (max-width: 900px) {
  .bell-panel { left: 8px !important; right: 8px; width: auto; }
  .audit-table .plain th:nth-child(4), .audit-table .plain td:nth-child(4) { display: none; }
}

/* ---------- 1.4.0: deleting attachments */
.file-del-btn { gap: 5px; }
.file-del-btn svg { width: 15px; height: 15px; }
@media (max-width: 640px) { .file-del-btn span { display: none; } .file-del-btn { width: 28px; padding: 0; } }
.msg-file .file-del { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; margin: -4px -6px -4px 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); cursor: pointer; }
.msg-file .file-del svg { width: 15px; height: 15px; }
.msg-file .file-del:hover, .msg-file .file-del:focus-visible { background: var(--danger-tint); color: var(--danger); outline: none; }

/* ---------- 1.4.0: users page for many users */
.users-toolbar .search { flex: 1 1 260px; max-width: 360px; min-width: 200px; }
.users-toolbar .select { max-width: 200px; }
.uf-count { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
@media (max-width: 640px) { .users-toolbar .seg { width: 100%; } .users-toolbar .seg button { flex: 1 1 auto; padding: 0 8px; font-size: 13px; } }
.users-wrap { overflow: auto; max-height: calc(100vh - var(--header-h) - 230px); min-height: 200px; }
.users-table thead th { position: sticky; top: 0; z-index: 1; padding: 0; }
.th-sort { display: flex; align-items: center; gap: 4px; width: 100%; padding: 9px 14px; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.th-sort:hover { color: var(--ink); background: var(--sheet-3); }
.th-sort .arr { color: var(--stamp); }
.users-table th.th-plain { padding: 9px 14px; }
.users-table td { padding-top: 8px; padding-bottom: 8px; }
.users-table tr.off td { color: var(--ink-3); }
.users-table tr.off .u-name { font-weight: 500; }
.users-table .u-name { font-weight: 600; }
.users-table .u-mail { font-size: 12.5px; }
.users-table td.actions { white-space: nowrap; text-align: right; }
.users-table td.actions .btn + .btn { margin-left: 4px; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--sheet-3); color: var(--ink-2); font-size: 11.5px; font-weight: 500; vertical-align: 1px; }
.tag.off { background: var(--grey-tint); color: var(--grey); }
.matrix-panel { margin-top: 16px; }
.matrix-panel > summary { padding: 14px 16px; font-size: 15px; font-weight: 650; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.matrix-panel > summary::-webkit-details-marker { display: none; }
.matrix-panel > summary::before { content: "›"; display: inline-block; transition: transform .15s; color: var(--ink-3); font-size: 18px; line-height: 1; }
.matrix-panel[open] > summary::before { transform: rotate(90deg); }
.matrix-panel[open] > summary { border-bottom: 1px solid var(--rule-2); }

/* ---------- 1.4.0: «Сводка» (dashboard). Series colours validated for colour-blind separation on both themes. */
:root { --viz-1: #2a78d6; --viz-2: #eb6834; --viz-warn: #fab219; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --viz-1: #3987e5; --viz-2: #d95926; } }
:root[data-theme="dark"] { --viz-1: #3987e5; --viz-2: #d95926; }
.dash-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 18px; }
.dash-date { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
.dash-date .input { height: 34px; width: auto; }
.dash-filters .select { width: auto; height: 34px; max-width: 240px; }
.dash-sec { margin: 0 0 18px; }
.dash-sec > h2 { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.dash-sec > h2 span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-3); margin-left: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 13px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px;
  color: var(--ink); text-decoration: none; min-height: 92px; }
a.tile:hover { border-color: var(--stamp-line); background: var(--sheet-2); }
.t-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.t-label svg { width: 15px; height: 15px; color: var(--amber); }
.t-val { font-size: 28px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.1; }
.t-sub { font-size: 12.5px; color: var(--ink-3); }
.tile.warn { border-color: var(--amber); background: var(--amber-tint); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.dash-grid + .panel, .panel + .dash-grid { margin-top: 16px; }
.dash-grid .panel + .panel { margin-top: 0; }
.dash-grid.stack { grid-template-columns: minmax(0, 1fr); }  /* both lists: the tables have a column for each list */
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.legend { display: inline-flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend span, .viz-tip span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.s1 { background: var(--viz-1); }
.sw.s2 { background: var(--viz-2); }
.chart-box { position: relative; padding: 12px 12px 6px; }
svg.trend { display: block; overflow: visible; }
svg.trend .grid { stroke: var(--rule-2); stroke-width: 1; }
svg.trend .axis { stroke: var(--rule); stroke-width: 1; }
svg.trend .tick { fill: var(--ink-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
svg.trend .s1 { fill: var(--viz-1); }
svg.trend .s2 { fill: var(--viz-2); }
svg.trend .hit { fill: transparent; }
svg.trend .col.on .hit { fill: var(--sheet-3); }
.viz-tip { position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; min-width: 170px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); font-size: 12.5px; pointer-events: none; }
.viz-tip b { font-weight: 600; margin-bottom: 2px; }
.age-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.age-list li { display: grid; grid-template-columns: 132px 1fr 34px; align-items: center; gap: 10px; font-size: 13px; }
.age-list .a-label { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); }
.age-list .a-label svg { width: 14px; height: 14px; flex: none; color: var(--amber); }
.age-list .a-track { height: 14px; border-radius: 4px; background: var(--sheet-3); overflow: hidden; }
.age-list .a-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--viz-1); }
.age-list .late-row .a-track i { background: var(--viz-warn); }
.age-list b { text-align: right; font-variant-numeric: tabular-nums; }
.age-note { margin: 12px 0 0; font-size: 12.5px; }
.dash-table { overflow-x: auto; }
.dash-table td.mono { white-space: nowrap; }
.plain.num td, .plain.num th { white-space: nowrap; }
.plain.num td:not(:first-child), .plain.num th:not(:first-child), .plain td.r, .plain th.r { text-align: right; font-variant-numeric: tabular-nums; }
.plain.num td:first-child { white-space: normal; min-width: 160px; }
.with-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.mini-bar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--sheet-3); overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--viz-1); border-radius: 0 3px 3px 0; }
.late { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; }
.late svg { width: 14px; height: 14px; color: var(--amber); }

/* ---------- 1.9.0: «Сводка» of the IPMT list, the CC7 MTO list or both. The two lists: aqua and blue of the validated
   palette (colour-blind and normal-vision separation pass on both themes; aqua is under 3:1 on white, so every value
   is also written as text). Stacked parts are kept apart by a 2px gap of the surface. */
:root { --viz-ipmt: #1baf7a; --viz-mto: #2a78d6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --viz-ipmt: #199e70; --viz-mto: #3987e5; } }
:root[data-theme="dark"] { --viz-ipmt: #199e70; --viz-mto: #3987e5; }
.dash-tabs { padding: 0; margin: 0 0 14px; }
.sw.sl-ipmt, .split-bar i.sl-ipmt, .mini-bar.split i.sl-ipmt, .a-track.split i.sl-ipmt { background: var(--viz-ipmt); }
.sw.sl-mto, .split-bar i.sl-mto, .mini-bar.split i.sl-mto, .a-track.split i.sl-mto { background: var(--viz-mto); }
svg.trend .sl-ipmt { fill: var(--viz-ipmt); }
svg.trend .sl-mto { fill: var(--viz-mto); }
.t-split { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.t-split span { display: inline-flex; align-items: center; gap: 5px; }
.split-bar { display: flex; gap: 2px; height: 5px; margin-top: 6px; }
.split-bar i { display: block; height: 100%; }
.split-bar i:first-child { border-radius: 3px 0 0 3px; }
.split-bar i:last-child { border-radius: 0 3px 3px 0; }
.mini-bar.split, .a-track.split { display: inline-flex; }
.a-track.split { display: flex; }
.mini-bar.split i, .a-track.split i { flex: none; border-radius: 0; }
.mini-bar.split i + i, .a-track.split i + i { box-shadow: -2px 0 0 var(--sheet); }
.mini-bar.split i:last-child { border-radius: 0 3px 3px 0; }
.a-track.split i:last-child { border-radius: 0 4px 4px 0; }
.age-list.split li { grid-template-columns: 132px 1fr 34px auto; }
.a-split { display: inline-flex; gap: 8px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.a-split span { display: inline-flex; align-items: center; gap: 4px; }
.side-tag { display: inline-flex; align-items: center; gap: 5px; margin-right: 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }

/* ---------- 1.4.0: AVK reference from the ODCI database */
.odci-line { margin-top: 14px; }
.odci-err { margin-top: 4px; color: var(--ink-2); }
.odci-admin { border-top: 1px solid var(--rule-2); }
.odci-admin > p { margin: 0 0 12px; }
.odci-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.odci-details { margin-top: 12px; }
.odci-details > summary { cursor: pointer; color: var(--ink-2); font-size: 13.5px; }
.odci-report { margin-top: 8px; max-width: 820px; }
.odci-report td.r { white-space: nowrap; }
.odci-report td { padding-top: 6px; padding-bottom: 6px; }
.status-line.warn { background: var(--amber-tint); color: var(--ink); }
.status-line.warn svg { color: var(--amber); }

/* 1.5.0 — «Проблематика»: chips in the register / card and the multi-select in the form */
.prob-chips { display: flex; flex-wrap: wrap; gap: 4px 5px; }
.prob-chip {
  display: inline-block; max-width: 100%; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--stamp-line);
  background: var(--stamp-tint); color: var(--stamp-strong); font-size: 12.5px; font-weight: 500; line-height: 1.5;
  overflow-wrap: anywhere;
}
td .prob-chips + .prob-text { margin-top: 5px; }
.prob-text { color: var(--ink-2); font-size: 13px; }
.card .prob-chips { margin: 6px 0 4px; }
.card .prob-chips + .prob { margin-top: 4px; color: var(--ink-2); }
.side-block .prob-chips .prob-chip { font-size: 13px; padding: 2px 10px; }

.msel { position: relative; }
.msel-box {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 36px; padding: 3px 4px 3px 6px;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.msel-box:hover { border-color: var(--ink-3); }
.msel:focus-within .msel-box { border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-tint); }
.field.invalid .msel-box { border-color: var(--danger); }
.msel-chips { display: contents; }
.msel-chip {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 2px 2px 2px 9px; border-radius: 999px;
  background: var(--stamp-tint); border: 1px solid var(--stamp-line); color: var(--stamp-strong); font-size: 13px; font-weight: 500;
  line-height: 1.35; overflow-wrap: anywhere; cursor: default;
}
.msel-chip button {
  display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; padding: 0; border: 0; border-radius: 50%;
  background: none; color: inherit; cursor: pointer;
}
.msel-chip button:hover { background: var(--stamp-line); }
.msel-chip button:focus-visible { outline: 2px solid var(--stamp); outline-offset: 1px; }
.msel-chip svg { width: 13px; height: 13px; }
.msel-toggle {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; flex: 1 0 auto; min-height: 28px;
  padding: 0 6px; border: 0; background: none; color: var(--ink-3); font: inherit; text-align: left; cursor: pointer;
}
/* with chips the arrow stays in the top right corner however many lines they take */
.msel.has-value .msel-box { padding-right: 36px; }
.msel.has-value .msel-toggle { position: absolute; right: 3px; top: 4px; height: 26px; min-height: 0; }
.msel-toggle:focus-visible { outline: none; }
.msel-toggle svg { flex: none; color: var(--ink-2); transition: transform 0.12s; }
.msel-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.msel-ph[hidden] { display: none; }
.msel-pop {
  position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); display: flex; flex-direction: column;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow-pop); overflow: hidden;
}
.msel-pop[hidden] { display: none; }
.msel-q { margin: 8px 8px 2px; width: auto; }
.msel-list { max-height: 290px; overflow-y: auto; padding: 4px; overscroll-behavior: contain; }
.msel-opt { display: flex; align-items: flex-start; gap: 9px; padding: 7px 9px; border-radius: 5px; cursor: pointer; line-height: 1.4; }
.msel-opt:hover { background: var(--row-hover); }
.msel-opt[hidden] { display: none; }
.msel-opt input { width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--stamp); }
.msel-opt input:checked + span { font-weight: 500; }
.msel-empty { padding: 10px; font-size: 13px; }
.msel-foot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--rule-2); background: var(--sheet-2); }
.msel-count { flex: 1; font-size: 12.5px; }

/* e-mails of the applicant and the responsible IPMT in the card: write or copy */
.mail-val { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 13px; min-width: 0; }
.mail-val a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 2px; overflow-wrap: anywhere; }
.mail-val a:hover { color: var(--stamp); text-decoration-color: currentColor; }
.mail-val .copy { flex: none; width: 26px; height: 26px; }
.mail-val.none { color: var(--ink-3); font-size: 12.5px; }
.combo + .mail-val { margin-top: 6px; }

.tag.warn { background: var(--amber-tint); color: var(--amber); }
.users-nomail { margin: 0 14px 12px; align-items: center; }
.users-nomail > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.prob-table td:nth-child(2) { white-space: nowrap; }
.plain td.actions .btn { vertical-align: middle; }

/* ---------- «Руководство»: the manual, read by everyone, edited by administrators ---------- */
.topbar .help-btn { margin-right: -14px; color: var(--ink-2); }
.help-btn.on { color: var(--stamp); background: var(--stamp-tint); }
.help-page { max-width: 1240px; }
.help-head p { max-width: 760px; }
.help-tools { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.help-viewas { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.help-viewas .select { width: auto; height: 34px; }
.help { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 20px; align-items: start; }
.help-toc {
  position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto;
  padding: 10px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; overscroll-behavior: contain;
}
.help-toc > summary { display: none; }
.help-toc .help-search { margin-bottom: 8px; max-width: none; }
.help-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.help-toc li { counter-increment: toc; }
.help-toc a {
  display: grid; grid-template-columns: 24px minmax(0, 1fr); padding: 6px 8px; border-radius: 5px;
  color: var(--ink-2); text-decoration: none; font-size: 13px; line-height: 1.35;
}
.help-toc a::before { content: counter(toc) "."; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.help-toc a:hover { background: var(--sheet-3); color: var(--ink); }
.help-toc a.on { background: var(--stamp-tint); color: var(--stamp-strong); font-weight: 600; }
.help-toc a.on::before { color: var(--stamp); }
.help-toc-empty { padding: 6px 8px; font-size: 13px; }
.help-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.help-main > * { min-width: 0; }
.help-main > .panel + .panel { margin-top: 0; }
.help-found { font-size: 13px; margin-bottom: -6px; }
.help-sec { scroll-margin-top: calc(var(--header-h) + 14px); }
.help-sec > header { gap: 8px 12px; }
.help-sec > header h2 { font-size: 17px; letter-spacing: -0.005em; }
.help-sec .aud { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.sec-tools { display: inline-flex; align-items: center; gap: 4px; }
.help-sec .sec-link { opacity: 0; transition: opacity 0.15s; }
.help-sec:hover .sec-link, .help-sec .sec-link:focus-visible { opacity: 1; }
@media (hover: none) { .help-sec .sec-link { opacity: 1; } }
.sec-meta { padding: 8px 16px 11px; font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--rule-2); }
.is-editing .help-sec:not(.editing) .sec-tools, .is-editing .help-add, .is-editing .help-deleted { opacity: 0.35; pointer-events: none; }
.aud-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; background: var(--grey-tint); color: var(--grey);
}
.aud-chip.cc7, .aud-chip.cc7_editor { background: var(--stamp-tint); color: var(--stamp); }
.aud-chip.pesco, .aud-chip.pesco_editor { background: var(--pesco-tint); color: var(--pesco); }
.aud-chip.mto, .aud-chip.mto_editor { background: var(--mto-tint); color: var(--mto); }
.aud-chip.admin { background: var(--amber-tint); color: var(--amber); }
.aud-chip.dashboard { background: var(--olive-tint); color: var(--olive); }

/* the text of a section */
.help-body { font-size: 14.5px; line-height: 1.62; overflow-wrap: break-word; }
.help-body > :first-child { margin-top: 0; }
.help-body > :last-child { margin-bottom: 0; }
.help-body p { margin: 0 0 10px; max-width: 80ch; }
.help-body h3 { margin: 20px 0 8px; font-size: 15.5px; font-weight: 650; }
.help-body h4 { margin: 16px 0 6px; font-size: 14.5px; font-weight: 650; }
.help-body ul, .help-body ol { margin: 0 0 12px; padding-left: 24px; max-width: 80ch; }
.help-body li { margin: 4px 0; padding-left: 2px; }
.help-body li > ul, .help-body li > ol { margin: 4px 0 2px; }
.help-body ol > li::marker { color: var(--stamp); font-weight: 650; }
.help-body ul > li::marker { color: var(--ink-3); }
.help-body code {
  font-family: var(--mono); font-size: 0.86em; padding: 1px 5px; border-radius: 4px;
  background: var(--sheet-3); border: 1px solid var(--rule-2); white-space: pre-wrap;
}
.help-body hr { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }
.help-body a { text-underline-offset: 2px; }
.help-body mark { background: var(--amber-tint); color: inherit; border-radius: 2px; box-shadow: 0 0 0 2px var(--amber-tint); }
.help-note {
  margin: 0 0 12px; padding: 10px 14px; max-width: 80ch;
  background: var(--pesco-tint); border-left: 3px solid var(--pesco); border-radius: 0 6px 6px 0;
}
.help-note > :last-child { margin-bottom: 0; }
.help-table { margin: 0 0 14px; overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; }
.help-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; line-height: 1.45; }
.help-table th, .help-table td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule-2); }
.help-table td + td, .help-table th + th { border-left: 1px solid var(--rule-2); }
.help-table th { background: var(--sheet-2); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.help-table tbody tr:last-child td { border-bottom: 0; }
.help-body figure { margin: 6px 0 16px; }
.help-body img {
  max-width: 100%; height: auto; vertical-align: middle; cursor: zoom-in;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--sheet-2);
}
.help-body figure img { display: block; }
.help-body figcaption { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }

/* the editor */
.help-sec.editing { border-color: var(--stamp-line); box-shadow: 0 0 0 3px var(--stamp-tint); }
.help-editor { display: grid; gap: 14px; }
.he-aud { margin: 0; padding: 0; border: 0; min-width: 0; }
.he-aud legend { padding: 0; margin-bottom: 4px; }
.he-aud-list { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 2px 0 2px; }
.he-aud-list .check:has(input:disabled) { color: var(--ink-3); }
.he-bar { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.he-bar .grow { flex: 1; }
.he-mode button { height: 30px; padding: 0 12px; font-size: 13px; }
.seg.he-mode button[aria-pressed="true"] { background: var(--stamp); }
.he-tools { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.he-tools.off { opacity: 0.35; pointer-events: none; }
.he-tools .he-b, .he-tools .he-i { width: 28px; padding: 0; font-size: 14px; }
.he-b { font-weight: 800; }
.he-i { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.he-text { min-height: 360px; font-family: var(--mono); font-size: 13px; line-height: 1.6; tab-size: 4; }
.he-text.drop { border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-tint); }
.he-preview { min-height: 360px; padding: 14px 16px; border: 1px dashed var(--rule); border-radius: var(--r); }
.he-actions { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.he-status { font-size: 12.5px; }
.help-add { display: flex; justify-content: center; }
.help-deleted ul { list-style: none; margin: 0; padding: 0; }
.help-deleted li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--rule-2); }
.help-deleted li:first-child { border-top: 0; }
.help-deleted li > span { flex: 1; min-width: 0; display: grid; gap: 1px; }
.help-deleted small { font-size: 12px; }

/* versions of a section */
.dialog.xwide { width: min(1040px, 100%); }
.help-versions { grid-template-columns: 236px minmax(0, 1fr); align-items: start; }
.hv-list { display: grid; gap: 2px; max-height: 62vh; overflow-y: auto; }
.hv-item { display: grid; gap: 1px; padding: 8px 10px; text-align: left; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.hv-item b { font-weight: 600; font-size: 13px; }
.hv-item span { font-size: 12px; color: var(--ink-2); }
.hv-item:hover { background: var(--sheet-3); }
.hv-item[aria-pressed="true"] { background: var(--stamp-tint); }
.hv-view { min-width: 0; max-height: 62vh; overflow-y: auto; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 8px; }
.hv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--rule-2); }

/* a picture opened full size */
.lightbox {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px;
  background: rgba(12, 12, 20, 0.84); cursor: zoom-out;
}
.lightbox figure { margin: 0; display: grid; gap: 8px; justify-items: center; }
.lightbox img { max-width: calc(100vw - 48px); max-height: calc(100vh - 96px); width: auto; height: auto; border-radius: 6px; background: #fff; }
.lightbox figcaption { color: #e8eaf0; font-size: 13px; text-align: center; }
.lightbox-x { position: fixed; top: 12px; right: 12px; color: #fff; }
.lightbox-x:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

@media (max-width: 900px) {
  .help { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .help-toc { position: static; max-height: none; }
  .help-toc > summary { display: list-item; padding: 2px 4px; font-weight: 600; cursor: pointer; }
  .help-toc[open] > summary { margin-bottom: 8px; }
  .help-tools { width: 100%; }
  .help-sec > header h2 { font-size: 16px; flex-basis: 100%; }
  .help-sec .sec-link { position: absolute; }
  .help-sec > header { position: relative; padding-right: 44px; }
  .help-sec > header .sec-link { top: 10px; right: 8px; }
  .help-versions { grid-template-columns: minmax(0, 1fr); }
  .hv-list { max-height: 28vh; }
}
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light; --paper: #fff; --sheet: #fff; --sheet-2: #f5f6f8; --sheet-3: #eef0f3; --ink: #111;
    --ink-2: #444; --ink-3: #666; --rule: #c9ccd3; --rule-2: #dfe2e7; --stamp: #4b2f8f; --stamp-tint: #f0ebf9;
    --pesco: #0b6a64; --pesco-tint: #e8f4f2; --mto: #1f5fa6; --mto-tint: #e9f0fa; --amber-tint: #fdf0d8;
  }
  body { background: #fff; }
  .topbar, .help-toc, .help-tools, .sec-tools, .sec-link, .help-add, .help-deleted, .toasts, .aud { display: none !important; }
  main.page { padding: 0; }
  .help { display: block; max-width: none; }
  .help-main { display: block; }
  .help-sec { margin: 0 0 18px; border: 0; break-inside: auto; }
  .help-sec > header { padding: 0 0 6px; border-bottom: 1px solid var(--rule); }
  .help-sec .inner { padding: 10px 0 0; }
  .help-body figure, .help-table tr, .help-note { break-inside: avoid; }
  .help-body img { max-height: 90vh; width: auto; }
}

/* ---------- language: RU / EN / 中文 — on the sign-in page and in the header ---------- */
.login-tools { display: flex; align-items: center; gap: 8px; }
.lang-switch { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; background: var(--sheet); }
.lang-switch button { height: 30px; min-width: 42px; padding: 0 10px; border: 0; border-right: 1px solid var(--rule); background: none;
  cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.lang-switch button:last-child { border-right: 0; }
.lang-switch button:hover:not([aria-pressed="true"]) { background: var(--sheet-3); color: var(--ink); }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); cursor: default; }
.lang-switch button:focus-visible { outline-offset: -2px; }
.lang-btn { gap: 5px; padding: 0 8px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.topbar .lang-btn { margin-right: -14px; }
.menu-lang { min-width: 190px; }
.menu-gap { display: inline-block; width: 16px; flex: none; }
@media (max-width: 900px) { /* on a phone the switch stays at the top of the sign-in page, above the title */
  .login { position: relative; }
  .login-form { position: static; }
  .login-tools { top: 12px; right: 12px; }
  .login-art { padding-top: 60px; }
}
@media (max-width: 420px) {
  .topbar { gap: 10px; }
  .lang-btn span { display: none; }
  .lang-btn { width: 34px; padding: 0; justify-content: center; }
}

/* translations of list items and of the user guide (administrator) */
.list-tl { font-size: 12.5px; line-height: 1.45; }
.he-langs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.seg.he-lang button { min-width: 52px; font-weight: 600; }
.seg.he-lang button[aria-pressed="true"] { background: var(--stamp); }
.seg.he-lang button.empty:not([aria-pressed="true"]) { color: var(--ink-3); font-weight: 500; }
.seg.he-lang button.empty:not([aria-pressed="true"])::after { content: "·"; margin-left: 4px; }
.sec-langs { display: inline-flex; gap: 4px; margin-left: 10px; vertical-align: 1px; }
.lang-chip { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 4px;
  font-size: 11px; font-weight: 600; background: var(--grey-tint); color: var(--ink-3); }
.lang-chip.ok { background: var(--green-tint); color: var(--green); }
.lang-chip .i { width: 11px; height: 11px; stroke-width: 2.4; }
.help-body .help-untr { display: flex; align-items: flex-start; gap: 8px; max-width: none; margin: 0 0 14px; padding: 8px 12px;
  border-radius: var(--r); background: var(--sheet-3); color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.help-body .help-untr .i { margin-top: 1px; color: var(--ink-3); }
/* Chinese: Golos draws the Latin letters and digits, the Chinese text takes a Simplified Chinese face of the system */
:root:lang(zh-CN) { --font: "Golos", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
